From owner-svn-src-all@freebsd.org Sun Oct 16 02:05:24 2016 Return-Path: Delivered-To: svn-src-all@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 5293BC12E46; Sun, 16 Oct 2016 02:05:24 +0000 (UTC) (envelope-from marcel@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 0BBC0955; Sun, 16 Oct 2016 02:05:23 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9G25NiA035494; Sun, 16 Oct 2016 02:05:23 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9G25Mb2035486; Sun, 16 Oct 2016 02:05:22 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610160205.u9G25Mb2035486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 16 Oct 2016 02:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307385 - in head: etc/mtree include sys/sys sys/sys/disk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 02:05:24 -0000 Author: marcel Date: Sun Oct 16 02:05:22 2016 New Revision: 307385 URL: https://svnweb.freebsd.org/changeset/base/307385 Log: Revert change 306811 so that the change can be re-done using svn copy instead of svn move. This to preserve history on the originals headers as well. Replaced: head/sys/sys/apm.h - copied unchanged from r306810, head/sys/sys/apm.h head/sys/sys/disklabel.h - copied unchanged from r306810, head/sys/sys/disklabel.h head/sys/sys/diskmbr.h - copied unchanged from r306810, head/sys/sys/diskmbr.h head/sys/sys/diskpc98.h - copied unchanged from r306810, head/sys/sys/diskpc98.h head/sys/sys/gpt.h - copied unchanged from r306810, head/sys/sys/gpt.h head/sys/sys/vtoc.h - copied unchanged from r306810, head/sys/sys/vtoc.h Deleted: head/sys/sys/disk/ Modified: head/etc/mtree/BSD.include.dist head/include/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Sat Oct 15 23:46:55 2016 (r307384) +++ head/etc/mtree/BSD.include.dist Sun Oct 16 02:05:22 2016 (r307385) @@ -336,8 +336,6 @@ ssp .. sys - disk - .. .. teken .. Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Sat Oct 15 23:46:55 2016 (r307384) +++ head/include/Makefile Sun Oct 16 02:05:22 2016 (r307385) @@ -59,7 +59,6 @@ LSUBDIRS= cam/ata cam/nvme cam/scsi \ security/audit \ security/mac_biba security/mac_bsdextended security/mac_lomac \ security/mac_mls security/mac_partition \ - sys/disk \ ufs/ffs ufs/ufs LSUBSUBDIRS= dev/mpt/mpilib Copied: head/sys/sys/apm.h (from r306810, head/sys/sys/apm.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/apm.h Sun Oct 16 02:05:22 2016 (r307385, copy of r306810, head/sys/sys/apm.h) @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2007 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_APM_H_ +#define _SYS_APM_H_ + +/* Driver Descriptor Record. */ +struct apm_ddr { + uint16_t ddr_sig; +#define APM_DDR_SIG 0x4552 + uint16_t ddr_blksize; + uint32_t ddr_blkcount; +}; + +#define APM_ENT_NAMELEN 32 +#define APM_ENT_TYPELEN 32 + +/* Partition Map Entry Record. */ +struct apm_ent { + uint16_t ent_sig; +#define APM_ENT_SIG 0x504d + uint16_t _pad_; + uint32_t ent_pmblkcnt; + uint32_t ent_start; + uint32_t ent_size; + char ent_name[APM_ENT_NAMELEN]; + char ent_type[APM_ENT_TYPELEN]; +}; + +#define APM_ENT_TYPE_SELF "Apple_partition_map" +#define APM_ENT_TYPE_UNUSED "Apple_Free" + +#define APM_ENT_TYPE_FREEBSD "FreeBSD" +#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" +#define APM_ENT_TYPE_FREEBSD_SWAP "FreeBSD-swap" +#define APM_ENT_TYPE_FREEBSD_UFS "FreeBSD-UFS" +#define APM_ENT_TYPE_FREEBSD_VINUM "FreeBSD-Vinum" +#define APM_ENT_TYPE_FREEBSD_ZFS "FreeBSD-ZFS" + +#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" +#define APM_ENT_TYPE_APPLE_HFS "Apple_HFS" +#define APM_ENT_TYPE_APPLE_UFS "Apple_UNIX_SVR2" + +#endif /* _SYS_APM_H_ */ Copied: head/sys/sys/disklabel.h (from r306810, head/sys/sys/disklabel.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/disklabel.h Sun Oct 16 02:05:22 2016 (r307385, copy of r306810, head/sys/sys/disklabel.h) @@ -0,0 +1,305 @@ +/*- + * Copyright (c) 1987, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 + * $FreeBSD$ + */ + +#ifndef _SYS_DISKLABEL_H_ +#define _SYS_DISKLABEL_H_ + +#ifndef _KERNEL +#include +#endif +#include + +/* + * Disk description table, see disktab(5) + */ +#define _PATH_DISKTAB "/etc/disktab" + +/* + * Each disk has a label which includes information about the hardware + * disk geometry, filesystem partitions, and drive specific information. + * The label is in block 0 or 1, possibly offset from the beginning + * to leave room for a bootstrap, etc. + */ + +/* XXX these should be defined per controller (or drive) elsewhere, not here! */ +#if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \ + defined(__powerpc__) || defined(__mips__) +#define LABELSECTOR 1 /* sector containing label */ +#define LABELOFFSET 0 /* offset of label in sector */ +#endif + +#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ +#ifndef MAXPARTITIONS +#define MAXPARTITIONS 8 +#endif + +/* Size of bootblock area in sector-size neutral bytes */ +#define BBSIZE 8192 + +#define LABEL_PART 2 /* partition containing label */ +#define RAW_PART 2 /* partition containing whole disk */ +#define SWAP_PART 1 /* partition normally containing swap */ + +struct disklabel { + u_int32_t d_magic; /* the magic number */ + u_int16_t d_type; /* drive type */ + u_int16_t d_subtype; /* controller/d_type specific */ + char d_typename[16]; /* type name, e.g. "eagle" */ + + char d_packname[16]; /* pack identifier */ + + /* disk geometry: */ + u_int32_t d_secsize; /* # of bytes per sector */ + u_int32_t d_nsectors; /* # of data sectors per track */ + u_int32_t d_ntracks; /* # of tracks per cylinder */ + u_int32_t d_ncylinders; /* # of data cylinders per unit */ + u_int32_t d_secpercyl; /* # of data sectors per cylinder */ + u_int32_t d_secperunit; /* # of data sectors per unit */ + + /* + * Spares (bad sector replacements) below are not counted in + * d_nsectors or d_secpercyl. Spare sectors are assumed to + * be physical sectors which occupy space at the end of each + * track and/or cylinder. + */ + u_int16_t d_sparespertrack; /* # of spare sectors per track */ + u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ + /* + * Alternate cylinders include maintenance, replacement, configuration + * description areas, etc. + */ + u_int32_t d_acylinders; /* # of alt. cylinders per unit */ + + /* hardware characteristics: */ + /* + * d_interleave, d_trackskew and d_cylskew describe perturbations + * in the media format used to compensate for a slow controller. + * Interleave is physical sector interleave, set up by the + * formatter or controller when formatting. When interleaving is + * in use, logically adjacent sectors are not physically + * contiguous, but instead are separated by some number of + * sectors. It is specified as the ratio of physical sectors + * traversed per logical sector. Thus an interleave of 1:1 + * implies contiguous layout, while 2:1 implies that logical + * sector 0 is separated by one sector from logical sector 1. + * d_trackskew is the offset of sector 0 on track N relative to + * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew + * is the offset of sector 0 on cylinder N relative to sector 0 + * on cylinder N-1. + */ + u_int16_t d_rpm; /* rotational speed */ + u_int16_t d_interleave; /* hardware sector interleave */ + u_int16_t d_trackskew; /* sector 0 skew, per track */ + u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ + u_int32_t d_headswitch; /* head switch time, usec */ + u_int32_t d_trkseek; /* track-to-track seek, usec */ + u_int32_t d_flags; /* generic flags */ +#define NDDATA 5 + u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ +#define NSPARE 5 + u_int32_t d_spare[NSPARE]; /* reserved for future use */ + u_int32_t d_magic2; /* the magic number (again) */ + u_int16_t d_checksum; /* xor of data incl. partitions */ + + /* filesystem and partition information: */ + u_int16_t d_npartitions; /* number of partitions in following */ + u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ + u_int32_t d_sbsize; /* max size of fs superblock, bytes */ + struct partition { /* the partition table */ + u_int32_t p_size; /* number of sectors in partition */ + u_int32_t p_offset; /* starting sector */ + u_int32_t p_fsize; /* filesystem basic fragment size */ + u_int8_t p_fstype; /* filesystem type, see below */ + u_int8_t p_frag; /* filesystem fragments per block */ + u_int16_t p_cpg; /* filesystem cylinders per group */ + } d_partitions[MAXPARTITIONS]; /* actually may be more */ +}; + +#ifdef CTASSERT +CTASSERT(sizeof(struct disklabel) == 148 + MAXPARTITIONS * 16); +#endif + +static __inline u_int16_t dkcksum(struct disklabel *lp); +static __inline u_int16_t +dkcksum(struct disklabel *lp) +{ + u_int16_t *start, *end; + u_int16_t sum = 0; + + start = (u_int16_t *)lp; + end = (u_int16_t *)&lp->d_partitions[lp->d_npartitions]; + while (start < end) + sum ^= *start++; + return (sum); +} + + +/* d_type values: */ +#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ +#define DTYPE_MSCP 2 /* MSCP */ +#define DTYPE_DEC 3 /* other DEC (rk, rl) */ +#define DTYPE_SCSI 4 /* SCSI */ +#define DTYPE_ESDI 5 /* ESDI interface */ +#define DTYPE_ST506 6 /* ST506 etc. */ +#define DTYPE_HPIB 7 /* CS/80 on HP-IB */ +#define DTYPE_HPFL 8 /* HP Fiber-link */ +#define DTYPE_FLOPPY 10 /* floppy */ +#define DTYPE_CCD 11 /* concatenated disk */ +#define DTYPE_VINUM 12 /* vinum volume */ +#define DTYPE_DOC2K 13 /* Msys DiskOnChip */ +#define DTYPE_RAID 14 /* CMU RAIDFrame */ +#define DTYPE_JFS2 16 /* IBM JFS 2 */ + +#ifdef DKTYPENAMES +static const char *dktypenames[] = { + "unknown", + "SMD", + "MSCP", + "old DEC", + "SCSI", + "ESDI", + "ST506", + "HP-IB", + "HP-FL", + "type 9", + "floppy", + "CCD", + "Vinum", + "DOC2K", + "Raid", + "?", + "jfs", + NULL +}; +#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) +#endif + +/* + * Filesystem type and version. + * Used to interpret other filesystem-specific + * per-partition information. + */ +#define FS_UNUSED 0 /* unused */ +#define FS_SWAP 1 /* swap */ +#define FS_V6 2 /* Sixth Edition */ +#define FS_V7 3 /* Seventh Edition */ +#define FS_SYSV 4 /* System V */ +#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ +#define FS_V8 6 /* Eighth Edition, 4K blocks */ +#define FS_BSDFFS 7 /* 4.2BSD fast filesystem */ +#define FS_MSDOS 8 /* MSDOS filesystem */ +#define FS_BSDLFS 9 /* 4.4BSD log-structured filesystem */ +#define FS_OTHER 10 /* in use, but unknown/unsupported */ +#define FS_HPFS 11 /* OS/2 high-performance filesystem */ +#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ +#define FS_BOOT 13 /* partition contains bootstrap */ +#define FS_VINUM 14 /* Vinum drive */ +#define FS_RAID 15 /* RAIDFrame drive */ +#define FS_FILECORE 16 /* Acorn Filecore Filing System */ +#define FS_EXT2FS 17 /* ext2fs */ +#define FS_NTFS 18 /* Windows/NT file system */ +#define FS_CCD 20 /* concatenated disk component */ +#define FS_JFS2 21 /* IBM JFS2 */ +#define FS_HAMMER 22 /* DragonFlyBSD Hammer FS */ +#define FS_HAMMER2 23 /* DragonFlyBSD Hammer2 FS */ +#define FS_UDF 24 /* UDF */ +#define FS_EFS 26 /* SGI's Extent File system */ +#define FS_ZFS 27 /* Sun's ZFS */ +#define FS_NANDFS 30 /* FreeBSD nandfs (NiLFS derived) */ + +#ifdef FSTYPENAMES +static const char *fstypenames[] = { + "unused", + "swap", + "Version 6", + "Version 7", + "System V", + "4.1BSD", + "Eighth Edition", + "4.2BSD", + "MSDOS", + "4.4LFS", + "unknown", + "HPFS", + "ISO9660", + "boot", + "vinum", + "raid", + "Filecore", + "EXT2FS", + "NTFS", + "?", + "ccd", + "jfs", + "HAMMER", + "HAMMER2", + "UDF", + "?", + "EFS", + "ZFS", + "?", + "?", + "nandfs", + NULL +}; +#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) +#endif + +/* + * flags shared by various drives: + */ +#define D_REMOVABLE 0x01 /* removable media */ +#define D_ECC 0x02 /* supports ECC */ +#define D_BADSECT 0x04 /* supports bad sector forw. */ +#define D_RAMDISK 0x08 /* disk emulator */ +#define D_CHAIN 0x10 /* can do back-back transfers */ + +/* + * NB: defines ioctls from 'd'/128 and up. + */ + +/* + * Functions for proper encoding/decoding of struct disklabel into/from + * bytestring. + */ +void bsd_partition_le_dec(u_char *ptr, struct partition *d); +int bsd_disklabel_le_dec(u_char *ptr, struct disklabel *d, int maxpart); +void bsd_partition_le_enc(u_char *ptr, struct partition *d); +void bsd_disklabel_le_enc(u_char *ptr, struct disklabel *d); + +#ifndef _KERNEL +__BEGIN_DECLS +struct disklabel *getdiskbyname(const char *); +__END_DECLS +#endif + +#endif /* !_SYS_DISKLABEL_H_ */ Copied: head/sys/sys/diskmbr.h (from r306810, head/sys/sys/diskmbr.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/diskmbr.h Sun Oct 16 02:05:22 2016 (r307385, copy of r306810, head/sys/sys/diskmbr.h) @@ -0,0 +1,91 @@ +/*- + * Copyright (c) 1987, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 + * $FreeBSD$ + */ + +#ifndef _SYS_DISKMBR_H_ +#define _SYS_DISKMBR_H_ + +#include + +#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ +#define DOSDSNOFF 440 /* WinNT/2K/XP Drive Serial Number offset */ +#define DOSPARTOFF 446 +#define DOSPARTSIZE 16 +#define NDOSPART 4 +#define NEXTDOSPART 32 +#define DOSMAGICOFFSET 510 +#define DOSMAGIC 0xAA55 + +#define DOSPTYP_EXT 0x05 /* DOS extended partition */ +#define DOSPTYP_FAT16 0x06 /* FAT16 partition */ +#define DOSPTYP_NTFS 0x07 /* NTFS partition */ +#define DOSPTYP_FAT32 0x0b /* FAT32 partition */ +#define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */ +#define DOSPTYP_PPCBOOT 0x41 /* PReP/CHRP boot partition */ +#define DOSPTYP_LDM 0x42 /* Win2k dynamic extended partition */ +#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ +#define DOSPTYP_LINUX 0x83 /* Linux partition */ +#define DOSPTYP_LINLVM 0x8e /* Linux LVM partition */ +#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ +#define DOSPTYP_APPLE_UFS 0xa8 /* Apple Mac OS X boot */ +#define DOSPTYP_APPLE_BOOT 0xab /* Apple Mac OS X UFS */ +#define DOSPTYP_HFS 0xaf /* HFS/HFS+ partition type */ +#define DOSPTYP_PMBR 0xee /* GPT Protective MBR */ +#define DOSPTYP_EFI 0xef /* EFI FAT parition */ +#define DOSPTYP_VMFS 0xfb /* VMware VMFS partition */ +#define DOSPTYP_VMKDIAG 0xfc /* VMware vmkDiagnostic partition */ +#define DOSPTYP_LINRAID 0xfd /* Linux raid partition */ + +struct dos_partition { + unsigned char dp_flag; /* bootstrap flags */ + unsigned char dp_shd; /* starting head */ + unsigned char dp_ssect; /* starting sector */ + unsigned char dp_scyl; /* starting cylinder */ + unsigned char dp_typ; /* partition type */ + unsigned char dp_ehd; /* end head */ + unsigned char dp_esect; /* end sector */ + unsigned char dp_ecyl; /* end cylinder */ + u_int32_t dp_start; /* absolute starting sector number */ + u_int32_t dp_size; /* partition size in sectors */ +}; +#ifdef CTASSERT +CTASSERT(sizeof (struct dos_partition) == DOSPARTSIZE); +#endif + +void dos_partition_dec(void const *pp, struct dos_partition *d); +void dos_partition_enc(void *pp, struct dos_partition *d); + +#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ +#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ + +#define DIOCSMBR _IOW('M', 129, u_char[512]) + +#endif /* !_SYS_DISKMBR_H_ */ Copied: head/sys/sys/diskpc98.h (from r306810, head/sys/sys/diskpc98.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/diskpc98.h Sun Oct 16 02:05:22 2016 (r307385, copy of r306810, head/sys/sys/diskpc98.h) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 1987, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 + * $FreeBSD$ + */ + +#ifndef _SYS_DISKPC98_H_ +#define _SYS_DISKPC98_H_ + +#include + +#define PC98_BBSECTOR 1 /* DOS boot block relative sector number */ +#define PC98_PARTOFF 0 +#define PC98_PARTSIZE 32 +#define PC98_NPARTS 16 +#define PC98_MAGICOFS 510 +#define PC98_MAGIC 0xAA55 + +#define PC98_MID_BOOTABLE 0x80 +#define PC98_MID_MASK 0x7f +#define PC98_MID_386BSD 0x14 + +#define PC98_SID_ACTIVE 0x80 +#define PC98_SID_MASK 0x7f +#define PC98_SID_386BSD 0x44 + +#define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE) +#define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE) +#define PC98_PTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD) + +struct pc98_partition { + unsigned char dp_mid; + unsigned char dp_sid; + unsigned char dp_dum1; + unsigned char dp_dum2; + unsigned char dp_ipl_sct; + unsigned char dp_ipl_head; + unsigned short dp_ipl_cyl; + unsigned char dp_ssect; /* starting sector */ + unsigned char dp_shd; /* starting head */ + unsigned short dp_scyl; /* starting cylinder */ + unsigned char dp_esect; /* end sector */ + unsigned char dp_ehd; /* end head */ + unsigned short dp_ecyl; /* end cylinder */ + unsigned char dp_name[16]; +}; +#ifdef CTASSERT +CTASSERT(sizeof (struct pc98_partition) == PC98_PARTSIZE); +#endif + +void pc98_partition_dec(void const *pp, struct pc98_partition *d); +void pc98_partition_enc(void *pp, struct pc98_partition *d); + +#define DIOCSPC98 _IOW('M', 129, u_char[8192]) + +#endif /* !_SYS_DISKPC98_H_ */ Copied: head/sys/sys/gpt.h (from r306810, head/sys/sys/gpt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/gpt.h Sun Oct 16 02:05:22 2016 (r307385, copy of r306810, head/sys/sys/gpt.h) @@ -0,0 +1,210 @@ +/*- + * Copyright (c) 2002 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_GPT_H_ +#define _SYS_GPT_H_ + +#include + +struct gpt_hdr { + char hdr_sig[8]; +#define GPT_HDR_SIG "EFI PART" + uint32_t hdr_revision; +#define GPT_HDR_REVISION 0x00010000 + uint32_t hdr_size; + uint32_t hdr_crc_self; + uint32_t __reserved; + uint64_t hdr_lba_self; + uint64_t hdr_lba_alt; + uint64_t hdr_lba_start; + uint64_t hdr_lba_end; + struct uuid hdr_uuid; + uint64_t hdr_lba_table; + uint32_t hdr_entries; + uint32_t hdr_entsz; + uint32_t hdr_crc_table; + /* + * The header as defined in the EFI spec is not a multiple of 8 bytes + * and given that the alignment requirement is on an 8 byte boundary, + * padding will happen. We make the padding explicit so that we can + * correct the value returned by sizeof() when we put the size of the + * header in field hdr_size, or otherwise use offsetof(). + */ + uint32_t padding; +}; + +struct gpt_ent { + struct uuid ent_type; + struct uuid ent_uuid; + uint64_t ent_lba_start; + uint64_t ent_lba_end; + uint64_t ent_attr; +#define GPT_ENT_ATTR_PLATFORM (1ULL << 0) +#define GPT_ENT_ATTR_BOOTME (1ULL << 59) +#define GPT_ENT_ATTR_BOOTONCE (1ULL << 58) +#define GPT_ENT_ATTR_BOOTFAILED (1ULL << 57) + uint16_t ent_name[36]; /* UTF-16. */ +}; + +#define GPT_ENT_TYPE_UNUSED \ + {0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}} +#define GPT_ENT_TYPE_EFI \ + {0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}} +#define GPT_ENT_TYPE_MBR \ + {0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}} +#define GPT_ENT_TYPE_FREEBSD \ + {0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} +#define GPT_ENT_TYPE_FREEBSD_BOOT \ + {0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}} +#define GPT_ENT_TYPE_FREEBSD_NANDFS \ + {0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}} +#define GPT_ENT_TYPE_FREEBSD_SWAP \ + {0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} +#define GPT_ENT_TYPE_FREEBSD_UFS \ + {0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} +#define GPT_ENT_TYPE_FREEBSD_VINUM \ + {0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} +#define GPT_ENT_TYPE_FREEBSD_ZFS \ + {0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} +#define GPT_ENT_TYPE_PREP_BOOT \ + {0x9e1a2d38,0xc612,0x4316,0xaa,0x26,{0x8b,0x49,0x52,0x1e,0x5a,0x8b}} + +/* + * The following are unused but documented here to avoid reuse. + * + * GPT_ENT_TYPE_FREEBSD_UFS2 \ + * {0x516e7cb7,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} + */ + +/* + * Foreign partition types that we're likely to encounter. Note that Linux + * apparently choose to share data partitions with MS. I don't what the + * advantage might be. I can see how sharing swap partitions is advantageous + * though. + */ +#define GPT_ENT_TYPE_MS_BASIC_DATA \ + {0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}} +#define GPT_ENT_TYPE_MS_LDM_DATA \ + {0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}} +#define GPT_ENT_TYPE_MS_LDM_METADATA \ + {0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}} +#define GPT_ENT_TYPE_MS_RECOVERY \ + {0xde94bba4,0x06d1,0x4d40,0xa1,0x6a,{0xbf,0xd5,0x01,0x79,0xd6,0xac}} +#define GPT_ENT_TYPE_MS_RESERVED \ + {0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}} +#define GPT_ENT_TYPE_MS_SPACES \ + {0xe75caf8f,0xf680,0x4cee,0xaf,0xa3,{0xb0,0x01,0xe5,0x6e,0xfc,0x2d}} + +#define GPT_ENT_TYPE_LINUX_DATA \ + {0x0fc63daf,0x8483,0x4772,0x8e,0x79,{0x3d,0x69,0xd8,0x47,0x7d,0xe4}} +#define GPT_ENT_TYPE_LINUX_RAID \ + {0xa19d880f,0x05fc,0x4d3b,0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}} +#define GPT_ENT_TYPE_LINUX_SWAP \ + {0x0657fd6d,0xa4ab,0x43c4,0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}} +#define GPT_ENT_TYPE_LINUX_LVM \ + {0xe6d6d379,0xf507,0x44c2,0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}} + +#define GPT_ENT_TYPE_VMFS \ + {0xaa31e02a,0x400f,0x11db,0x95,0x90,{0x00,0x0c,0x29,0x11,0xd1,0xb8}} +#define GPT_ENT_TYPE_VMKDIAG \ + {0x9d275380,0x40ad,0x11db,0xbf,0x97,{0x00,0x0c,0x29,0x11,0xd1,0xb8}} +#define GPT_ENT_TYPE_VMRESERVED \ + {0x9198effc,0x31c0,0x11db,0x8f,0x78,{0x00,0x0c,0x29,0x11,0xd1,0xb8}} +#define GPT_ENT_TYPE_VMVSANHDR \ + {0x381cfccc,0x7288,0x11e0,0x92,0xee,{0x00,0x0c,0x29,0x11,0xd0,0xb2}} + +#define GPT_ENT_TYPE_APPLE_BOOT \ + {0x426F6F74,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}} +#define GPT_ENT_TYPE_APPLE_HFS \ + {0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}} +#define GPT_ENT_TYPE_APPLE_UFS \ + {0x55465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}} +#define GPT_ENT_TYPE_APPLE_ZFS \ + {0x6a898cc3,0x1dd2,0x11b2,0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}} +#define GPT_ENT_TYPE_APPLE_RAID \ + {0x52414944,0x0000,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}} +#define GPT_ENT_TYPE_APPLE_RAID_OFFLINE \ + {0x52414944,0x5f4f,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}} +#define GPT_ENT_TYPE_APPLE_LABEL \ + {0x4C616265,0x6c00,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}} +#define GPT_ENT_TYPE_APPLE_TV_RECOVERY \ + {0x5265636f,0x7665,0x11AA,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}} +#define GPT_ENT_TYPE_APPLE_CORE_STORAGE \ + {0x53746f72,0x6167,0x11AA,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}} + +#define GPT_ENT_TYPE_NETBSD_FFS \ + {0x49f48d5a,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}} +#define GPT_ENT_TYPE_NETBSD_LFS \ + {0x49f48d82,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}} +#define GPT_ENT_TYPE_NETBSD_SWAP \ + {0x49f48d32,0xb10e,0x11dc,0xB9,0x9B,{0x00,0x19,0xd1,0x87,0x96,0x48}} +#define GPT_ENT_TYPE_NETBSD_RAID \ + {0x49f48daa,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}} +#define GPT_ENT_TYPE_NETBSD_CCD \ + {0x2db519c4,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}} +#define GPT_ENT_TYPE_NETBSD_CGD \ + {0x2db519ec,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}} + +#define GPT_ENT_TYPE_DRAGONFLY_LABEL32 \ + {0x9d087404,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_SWAP \ + {0x9d58fdbd,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_UFS1 \ + {0x9d94ce7c,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_VINUM \ + {0x9dd4478f,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_CCD \ + {0xdbd5211b,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_LABEL64 \ + {0x3d48ce54,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_LEGACY \ + {0xbd215ab2,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_HAMMER \ + {0x61dc63ac,0x6e38,0x11dc,0x85,0x13,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} +#define GPT_ENT_TYPE_DRAGONFLY_HAMMER2 \ + {0x5cbb9ad1,0x862d,0x11dc,0xa9,0x4d,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}} + +#define GPT_ENT_TYPE_CHROMEOS_FIRMWARE \ + {0xcab6e88e,0xabf3,0x4102,0xa0,0x7a,{0xd4,0xbb,0x9b,0xe3,0xc1,0xd3}} +#define GPT_ENT_TYPE_CHROMEOS_KERNEL \ + {0xfe3a2a5d,0x4f32,0x41a7,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}} +#define GPT_ENT_TYPE_CHROMEOS_RESERVED \ + {0x2e0a753d,0x9e48,0x43b0,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}} +#define GPT_ENT_TYPE_CHROMEOS_ROOT \ + {0x3cb8e202,0x3b7e,0x47dd,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}} + +#define GPT_ENT_TYPE_OPENBSD_DATA \ + {0x824cc7a0,0x36a8,0x11e3,0x89,0x0a,{0x95,0x25,0x19,0xad,0x3f,0x61}} + +/* + * Boot partition used by GRUB 2. + */ +#define GPT_ENT_TYPE_BIOS_BOOT \ + {0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}} + +#endif /* _SYS_GPT_H_ */ Copied: head/sys/sys/vtoc.h (from r306810, head/sys/sys/vtoc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/vtoc.h Sun Oct 16 02:05:22 2016 (r307385, copy of r306810, head/sys/sys/vtoc.h) @@ -0,0 +1,108 @@ +/*- + * Copyright (c) 2008 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_VTOC_H_ +#define _SYS_VTOC_H_ + +#define VTOC_TAG_UNASSIGNED 0x00 +#define VTOC_TAG_BOOT 0x01 +#define VTOC_TAG_ROOT 0x02 +#define VTOC_TAG_SWAP 0x03 +#define VTOC_TAG_USR 0x04 +#define VTOC_TAG_BACKUP 0x05 /* "c" partition */ +#define VTOC_TAG_STAND 0x06 +#define VTOC_TAG_VAR 0x07 +#define VTOC_TAG_HOME 0x08 +#define VTOC_TAG_ALTSCTR 0x09 /* alternate sector partition */ +#define VTOC_TAG_CACHE 0x0a /* Solaris cachefs partition */ +#define VTOC_TAG_VXVM_PUB 0x0e /* VxVM public region */ +#define VTOC_TAG_VXVM_PRIV 0x0f /* VxVM private region */ + +/* NetBSD/mips defines this */ +#define VTOC_TAG_NETBSD_FFS 0xff + +/* FreeBSD tags: the high byte equals ELFOSABI_FREEBSD */ +#define VTOC_TAG_FREEBSD_SWAP 0x0901 +#define VTOC_TAG_FREEBSD_UFS 0x0902 +#define VTOC_TAG_FREEBSD_VINUM 0x0903 +#define VTOC_TAG_FREEBSD_ZFS 0x0904 +#define VTOC_TAG_FREEBSD_NANDFS 0x0905 + +#define VTOC_FLAG_UNMNT 0x01 /* unmountable partition */ +#define VTOC_FLAG_RDONLY 0x10 /* partition is read/only */ + +#define VTOC_ASCII_LEN 128 +#define VTOC_BOOTSIZE 8192 /* 16 sectors */ +#define VTOC_MAGIC 0xdabe +#define VTOC_RAW_PART 2 +#define VTOC_SANITY 0x600ddeee +#define VTOC_VERSION 1 +#define VTOC_VOLUME_LEN 8 + +#define VTOC8_NPARTS 8 + +struct vtoc8 { + char ascii[VTOC_ASCII_LEN]; + uint32_t version; + char volume[VTOC_VOLUME_LEN]; + uint16_t nparts; + struct { + uint16_t tag; + uint16_t flag; + } part[VTOC8_NPARTS] __packed; + uint16_t __alignment; + uint32_t bootinfo[3]; + uint32_t sanity; + uint32_t reserved[10]; + uint32_t timestamp[VTOC8_NPARTS]; + uint16_t wskip; + uint16_t rskip; + char padding[152]; + uint16_t rpm; + uint16_t physcyls; + uint16_t sparesecs; + uint16_t spare1[2]; + uint16_t interleave; + uint16_t ncyls; + uint16_t altcyls; + uint16_t nheads; + uint16_t nsecs; + uint16_t spare2[2]; + struct { + uint32_t cyl; + uint32_t nblks; + } map[VTOC8_NPARTS]; + uint16_t magic; + uint16_t cksum; +} __packed; + +#ifdef CTASSERT +CTASSERT(sizeof(struct vtoc8) == 512); +#endif + +#endif /* _SYS_VTOC_H_ */ From owner-svn-src-all@freebsd.org Sun Oct 16 02:43:54 2016 Return-Path: Delivered-To: svn-src-all@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 7D8AEC11702; Sun, 16 Oct 2016 02:43:54 +0000 (UTC) (envelope-from marcel@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 0E1CB80D; Sun, 16 Oct 2016 02:43:53 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9G2hrhn050591; Sun, 16 Oct 2016 02:43:53 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9G2hpJE050577; Sun, 16 Oct 2016 02:43:51 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610160243.u9G2hpJE050577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 16 Oct 2016 02:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307386 - in head: etc/mtree include sys/sys sys/sys/disk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 02:43:54 -0000 Author: marcel Date: Sun Oct 16 02:43:51 2016 New Revision: 307386 URL: https://svnweb.freebsd.org/changeset/base/307386 Log: Re-apply change 306811 or alternatively, revert change 307385. Added: head/sys/sys/disk/ head/sys/sys/disk/apm.h - copied, changed from r307385, head/sys/sys/apm.h head/sys/sys/disk/bsd.h - copied, changed from r307385, head/sys/sys/disklabel.h head/sys/sys/disk/gpt.h - copied, changed from r307385, head/sys/sys/gpt.h head/sys/sys/disk/mbr.h - copied, changed from r307385, head/sys/sys/diskmbr.h head/sys/sys/disk/pc98.h - copied, changed from r307385, head/sys/sys/diskpc98.h head/sys/sys/disk/vtoc.h - copied, changed from r307385, head/sys/sys/vtoc.h Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/sys/sys/apm.h head/sys/sys/disklabel.h head/sys/sys/diskmbr.h head/sys/sys/diskpc98.h head/sys/sys/gpt.h head/sys/sys/vtoc.h Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Sun Oct 16 02:05:22 2016 (r307385) +++ head/etc/mtree/BSD.include.dist Sun Oct 16 02:43:51 2016 (r307386) @@ -336,6 +336,8 @@ ssp .. sys + disk + .. .. teken .. Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Sun Oct 16 02:05:22 2016 (r307385) +++ head/include/Makefile Sun Oct 16 02:43:51 2016 (r307386) @@ -59,6 +59,7 @@ LSUBDIRS= cam/ata cam/nvme cam/scsi \ security/audit \ security/mac_biba security/mac_bsdextended security/mac_lomac \ security/mac_mls security/mac_partition \ + sys/disk \ ufs/ffs ufs/ufs LSUBSUBDIRS= dev/mpt/mpilib Modified: head/sys/sys/apm.h ============================================================================== --- head/sys/sys/apm.h Sun Oct 16 02:05:22 2016 (r307385) +++ head/sys/sys/apm.h Sun Oct 16 02:43:51 2016 (r307386) @@ -1,69 +1,5 @@ /*- - * Copyright (c) 2007 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ + * This file is in the public domain. */ - -#ifndef _SYS_APM_H_ -#define _SYS_APM_H_ - -/* Driver Descriptor Record. */ -struct apm_ddr { - uint16_t ddr_sig; -#define APM_DDR_SIG 0x4552 - uint16_t ddr_blksize; - uint32_t ddr_blkcount; -}; - -#define APM_ENT_NAMELEN 32 -#define APM_ENT_TYPELEN 32 - -/* Partition Map Entry Record. */ -struct apm_ent { - uint16_t ent_sig; -#define APM_ENT_SIG 0x504d - uint16_t _pad_; - uint32_t ent_pmblkcnt; - uint32_t ent_start; - uint32_t ent_size; - char ent_name[APM_ENT_NAMELEN]; - char ent_type[APM_ENT_TYPELEN]; -}; - -#define APM_ENT_TYPE_SELF "Apple_partition_map" -#define APM_ENT_TYPE_UNUSED "Apple_Free" - -#define APM_ENT_TYPE_FREEBSD "FreeBSD" -#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" -#define APM_ENT_TYPE_FREEBSD_SWAP "FreeBSD-swap" -#define APM_ENT_TYPE_FREEBSD_UFS "FreeBSD-UFS" -#define APM_ENT_TYPE_FREEBSD_VINUM "FreeBSD-Vinum" -#define APM_ENT_TYPE_FREEBSD_ZFS "FreeBSD-ZFS" - -#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" -#define APM_ENT_TYPE_APPLE_HFS "Apple_HFS" -#define APM_ENT_TYPE_APPLE_UFS "Apple_UNIX_SVR2" - -#endif /* _SYS_APM_H_ */ +/* $FreeBSD$ */ +#include Copied and modified: head/sys/sys/disk/apm.h (from r307385, head/sys/sys/apm.h) ============================================================================== --- head/sys/sys/apm.h Sun Oct 16 02:05:22 2016 (r307385, copy source) +++ head/sys/sys/disk/apm.h Sun Oct 16 02:43:51 2016 (r307386) @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _SYS_APM_H_ -#define _SYS_APM_H_ +#ifndef _SYS_DISK_APM_H_ +#define _SYS_DISK_APM_H_ /* Driver Descriptor Record. */ struct apm_ddr { @@ -66,4 +66,4 @@ struct apm_ent { #define APM_ENT_TYPE_APPLE_HFS "Apple_HFS" #define APM_ENT_TYPE_APPLE_UFS "Apple_UNIX_SVR2" -#endif /* _SYS_APM_H_ */ +#endif /* _SYS_DISK_APM_H_ */ Copied and modified: head/sys/sys/disk/bsd.h (from r307385, head/sys/sys/disklabel.h) ============================================================================== --- head/sys/sys/disklabel.h Sun Oct 16 02:05:22 2016 (r307385, copy source) +++ head/sys/sys/disk/bsd.h Sun Oct 16 02:43:51 2016 (r307386) @@ -30,60 +30,45 @@ * $FreeBSD$ */ -#ifndef _SYS_DISKLABEL_H_ -#define _SYS_DISKLABEL_H_ +#ifndef _SYS_DISK_BSD_H_ +#define _SYS_DISK_BSD_H_ -#ifndef _KERNEL -#include -#endif -#include +/* The disk magic number */ +#define BSD_MAGIC 0x82564557U -/* - * Disk description table, see disktab(5) - */ -#define _PATH_DISKTAB "/etc/disktab" +#define BSD_NPARTS_MIN 8 +#define BSD_NPARTS_MAX 20 -/* - * Each disk has a label which includes information about the hardware - * disk geometry, filesystem partitions, and drive specific information. - * The label is in block 0 or 1, possibly offset from the beginning - * to leave room for a bootstrap, etc. - */ +/* Size of bootblock area in sector-size neutral bytes */ +#define BSD_BOOTBLOCK_SIZE 8192 -/* XXX these should be defined per controller (or drive) elsewhere, not here! */ -#if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \ - defined(__powerpc__) || defined(__mips__) -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#endif +/* partition containing whole disk */ +#define BSD_PART_RAW 2 -#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ -#ifndef MAXPARTITIONS -#define MAXPARTITIONS 8 -#endif +/* partition normally containing swap */ +#define BSD_PART_SWAP 1 -/* Size of bootblock area in sector-size neutral bytes */ -#define BBSIZE 8192 +/* Drive-type specific data size (in number of 32-bit inegrals) */ +#define BSD_NDRIVEDATA 5 -#define LABEL_PART 2 /* partition containing label */ -#define RAW_PART 2 /* partition containing whole disk */ -#define SWAP_PART 1 /* partition normally containing swap */ +/* Number of spare 32-bit integrals following drive-type data */ +#define BSD_NSPARE 5 struct disklabel { - u_int32_t d_magic; /* the magic number */ - u_int16_t d_type; /* drive type */ - u_int16_t d_subtype; /* controller/d_type specific */ - char d_typename[16]; /* type name, e.g. "eagle" */ + uint32_t d_magic; /* the magic number */ + uint16_t d_type; /* drive type */ + uint16_t d_subtype; /* controller/d_type specific */ + char d_typename[16]; /* type name, e.g. "eagle" */ - char d_packname[16]; /* pack identifier */ + char d_packname[16]; /* pack identifier */ /* disk geometry: */ - u_int32_t d_secsize; /* # of bytes per sector */ - u_int32_t d_nsectors; /* # of data sectors per track */ - u_int32_t d_ntracks; /* # of tracks per cylinder */ - u_int32_t d_ncylinders; /* # of data cylinders per unit */ - u_int32_t d_secpercyl; /* # of data sectors per cylinder */ - u_int32_t d_secperunit; /* # of data sectors per unit */ + uint32_t d_secsize; /* # of bytes per sector */ + uint32_t d_nsectors; /* # of data sectors per track */ + uint32_t d_ntracks; /* # of tracks per cylinder */ + uint32_t d_ncylinders; /* # of data cylinders per unit */ + uint32_t d_secpercyl; /* # of data sectors per cylinder */ + uint32_t d_secperunit; /* # of data sectors per unit */ /* * Spares (bad sector replacements) below are not counted in @@ -91,13 +76,13 @@ struct disklabel { * be physical sectors which occupy space at the end of each * track and/or cylinder. */ - u_int16_t d_sparespertrack; /* # of spare sectors per track */ - u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ + uint16_t d_sparespertrack; /* # of spare sectors per track */ + uint16_t d_sparespercyl; /* # of spare sectors per cylinder */ /* * Alternate cylinders include maintenance, replacement, configuration * description areas, etc. */ - u_int32_t d_acylinders; /* # of alt. cylinders per unit */ + uint32_t d_acylinders; /* # of alt. cylinders per unit */ /* hardware characteristics: */ /* @@ -116,53 +101,35 @@ struct disklabel { * is the offset of sector 0 on cylinder N relative to sector 0 * on cylinder N-1. */ - u_int16_t d_rpm; /* rotational speed */ - u_int16_t d_interleave; /* hardware sector interleave */ - u_int16_t d_trackskew; /* sector 0 skew, per track */ - u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ - u_int32_t d_headswitch; /* head switch time, usec */ - u_int32_t d_trkseek; /* track-to-track seek, usec */ - u_int32_t d_flags; /* generic flags */ -#define NDDATA 5 - u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ -#define NSPARE 5 - u_int32_t d_spare[NSPARE]; /* reserved for future use */ - u_int32_t d_magic2; /* the magic number (again) */ - u_int16_t d_checksum; /* xor of data incl. partitions */ + uint16_t d_rpm; /* rotational speed */ + uint16_t d_interleave; /* hardware sector interleave */ + uint16_t d_trackskew; /* sector 0 skew, per track */ + uint16_t d_cylskew; /* sector 0 skew, per cylinder */ + uint32_t d_headswitch; /* head switch time, usec */ + uint32_t d_trkseek; /* track-to-track seek, usec */ + uint32_t d_flags; /* generic flags */ + uint32_t d_drivedata[BSD_NDRIVEDATA]; /* drive-type specific data */ + uint32_t d_spare[BSD_NSPARE]; /* reserved for future use */ + uint32_t d_magic2; /* the magic number (again) */ + uint16_t d_checksum; /* xor of data incl. partitions */ /* filesystem and partition information: */ - u_int16_t d_npartitions; /* number of partitions in following */ - u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ - u_int32_t d_sbsize; /* max size of fs superblock, bytes */ + uint16_t d_npartitions; /* number of partitions in following */ + uint32_t d_bbsize; /* size of boot area at sn0, bytes */ + uint32_t d_sbsize; /* max size of fs superblock, bytes */ struct partition { /* the partition table */ - u_int32_t p_size; /* number of sectors in partition */ - u_int32_t p_offset; /* starting sector */ - u_int32_t p_fsize; /* filesystem basic fragment size */ - u_int8_t p_fstype; /* filesystem type, see below */ - u_int8_t p_frag; /* filesystem fragments per block */ - u_int16_t p_cpg; /* filesystem cylinders per group */ - } d_partitions[MAXPARTITIONS]; /* actually may be more */ + uint32_t p_size; /* number of sectors in partition */ + uint32_t p_offset; /* starting sector */ + uint32_t p_fsize; /* filesystem basic fragment size */ + uint8_t p_fstype; /* filesystem type, see below */ + uint8_t p_frag; /* filesystem fragments per block */ + uint16_t p_cpg; /* filesystem cylinders per group */ + } d_partitions[BSD_NPARTS_MIN]; /* actually may be more */ }; - #ifdef CTASSERT -CTASSERT(sizeof(struct disklabel) == 148 + MAXPARTITIONS * 16); +CTASSERT(sizeof(struct disklabel) == 148 + BSD_NPARTS_MIN * 16); #endif -static __inline u_int16_t dkcksum(struct disklabel *lp); -static __inline u_int16_t -dkcksum(struct disklabel *lp) -{ - u_int16_t *start, *end; - u_int16_t sum = 0; - - start = (u_int16_t *)lp; - end = (u_int16_t *)&lp->d_partitions[lp->d_npartitions]; - while (start < end) - sum ^= *start++; - return (sum); -} - - /* d_type values: */ #define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ #define DTYPE_MSCP 2 /* MSCP */ @@ -179,30 +146,6 @@ dkcksum(struct disklabel *lp) #define DTYPE_RAID 14 /* CMU RAIDFrame */ #define DTYPE_JFS2 16 /* IBM JFS 2 */ -#ifdef DKTYPENAMES -static const char *dktypenames[] = { - "unknown", - "SMD", - "MSCP", - "old DEC", - "SCSI", - "ESDI", - "ST506", - "HP-IB", - "HP-FL", - "type 9", - "floppy", - "CCD", - "Vinum", - "DOC2K", - "Raid", - "?", - "jfs", - NULL -}; -#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) -#endif - /* * Filesystem type and version. * Used to interpret other filesystem-specific @@ -236,44 +179,6 @@ static const char *dktypenames[] = { #define FS_ZFS 27 /* Sun's ZFS */ #define FS_NANDFS 30 /* FreeBSD nandfs (NiLFS derived) */ -#ifdef FSTYPENAMES -static const char *fstypenames[] = { - "unused", - "swap", - "Version 6", - "Version 7", - "System V", - "4.1BSD", - "Eighth Edition", - "4.2BSD", - "MSDOS", - "4.4LFS", - "unknown", - "HPFS", - "ISO9660", - "boot", - "vinum", - "raid", - "Filecore", - "EXT2FS", - "NTFS", - "?", - "ccd", - "jfs", - "HAMMER", - "HAMMER2", - "UDF", - "?", - "EFS", - "ZFS", - "?", - "?", - "nandfs", - NULL -}; -#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) -#endif - /* * flags shared by various drives: */ @@ -283,23 +188,4 @@ static const char *fstypenames[] = { #define D_RAMDISK 0x08 /* disk emulator */ #define D_CHAIN 0x10 /* can do back-back transfers */ -/* - * NB: defines ioctls from 'd'/128 and up. - */ - -/* - * Functions for proper encoding/decoding of struct disklabel into/from - * bytestring. - */ -void bsd_partition_le_dec(u_char *ptr, struct partition *d); -int bsd_disklabel_le_dec(u_char *ptr, struct disklabel *d, int maxpart); -void bsd_partition_le_enc(u_char *ptr, struct partition *d); -void bsd_disklabel_le_enc(u_char *ptr, struct disklabel *d); - -#ifndef _KERNEL -__BEGIN_DECLS -struct disklabel *getdiskbyname(const char *); -__END_DECLS -#endif - -#endif /* !_SYS_DISKLABEL_H_ */ +#endif /* !_SYS_DISK_BSD_H_ */ Copied and modified: head/sys/sys/disk/gpt.h (from r307385, head/sys/sys/gpt.h) ============================================================================== --- head/sys/sys/gpt.h Sun Oct 16 02:05:22 2016 (r307385, copy source) +++ head/sys/sys/disk/gpt.h Sun Oct 16 02:43:51 2016 (r307386) @@ -26,10 +26,31 @@ * $FreeBSD$ */ -#ifndef _SYS_GPT_H_ -#define _SYS_GPT_H_ +#ifndef _SYS_DISK_GPT_H_ +#define _SYS_DISK_GPT_H_ -#include +/* + * Applications can define GPT_UUID_TYPE if they want the GPT structures + * to use a particular type definition for UUIDs/GUIDs. This header uses + * a generic (DCE 1.1 compatible) definition otherwise. + */ +#ifndef GPT_UUID_TYPE +struct gpt_uuid { + uint32_t time_low; + uint16_t time_mid; + uint16_t time_hi_and_version; + uint8_t clock_seq_hi_and_reserved; + uint8_t clock_seq_low; + uint8_t node[6]; +}; +#define GPT_UUID_TYPE struct gpt_uuid +#endif /* !GPT_UUID_TYPE */ + +typedef GPT_UUID_TYPE gpt_uuid_t; + +#ifdef CTASSERT +CTASSERT(sizeof(gpt_uuid_t) == 16); +#endif struct gpt_hdr { char hdr_sig[8]; @@ -43,7 +64,7 @@ struct gpt_hdr { uint64_t hdr_lba_alt; uint64_t hdr_lba_start; uint64_t hdr_lba_end; - struct uuid hdr_uuid; + gpt_uuid_t hdr_uuid; uint64_t hdr_lba_table; uint32_t hdr_entries; uint32_t hdr_entsz; @@ -57,10 +78,13 @@ struct gpt_hdr { */ uint32_t padding; }; +#ifdef CTASSERT +CTASSERT(offsetof(struct gpt_hdr, padding) == 92); +#endif struct gpt_ent { - struct uuid ent_type; - struct uuid ent_uuid; + gpt_uuid_t ent_type; + gpt_uuid_t ent_uuid; uint64_t ent_lba_start; uint64_t ent_lba_end; uint64_t ent_attr; @@ -70,6 +94,9 @@ struct gpt_ent { #define GPT_ENT_ATTR_BOOTFAILED (1ULL << 57) uint16_t ent_name[36]; /* UTF-16. */ }; +#ifdef CTASSERT +CTASSERT(sizeof(struct gpt_ent) == 128); +#endif /* CTASSERT */ #define GPT_ENT_TYPE_UNUSED \ {0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}} @@ -207,4 +234,4 @@ struct gpt_ent { #define GPT_ENT_TYPE_BIOS_BOOT \ {0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}} -#endif /* _SYS_GPT_H_ */ +#endif /* _SYS_DISK_GPT_H_ */ Copied and modified: head/sys/sys/disk/mbr.h (from r307385, head/sys/sys/diskmbr.h) ============================================================================== --- head/sys/sys/diskmbr.h Sun Oct 16 02:05:22 2016 (r307385, copy source) +++ head/sys/sys/disk/mbr.h Sun Oct 16 02:43:51 2016 (r307386) @@ -30,10 +30,8 @@ * $FreeBSD$ */ -#ifndef _SYS_DISKMBR_H_ -#define _SYS_DISKMBR_H_ - -#include +#ifndef _SYS_DISK_MBR_H_ +#define _SYS_DISK_MBR_H_ #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ #define DOSDSNOFF 440 /* WinNT/2K/XP Drive Serial Number offset */ @@ -73,19 +71,14 @@ struct dos_partition { unsigned char dp_ehd; /* end head */ unsigned char dp_esect; /* end sector */ unsigned char dp_ecyl; /* end cylinder */ - u_int32_t dp_start; /* absolute starting sector number */ - u_int32_t dp_size; /* partition size in sectors */ + uint32_t dp_start; /* absolute starting sector number */ + uint32_t dp_size; /* partition size in sectors */ }; #ifdef CTASSERT CTASSERT(sizeof (struct dos_partition) == DOSPARTSIZE); #endif -void dos_partition_dec(void const *pp, struct dos_partition *d); -void dos_partition_enc(void *pp, struct dos_partition *d); - #define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ #define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ -#define DIOCSMBR _IOW('M', 129, u_char[512]) - -#endif /* !_SYS_DISKMBR_H_ */ +#endif /* !_SYS_DISK_MBR_H_ */ Copied and modified: head/sys/sys/disk/pc98.h (from r307385, head/sys/sys/diskpc98.h) ============================================================================== --- head/sys/sys/diskpc98.h Sun Oct 16 02:05:22 2016 (r307385, copy source) +++ head/sys/sys/disk/pc98.h Sun Oct 16 02:43:51 2016 (r307386) @@ -30,10 +30,8 @@ * $FreeBSD$ */ -#ifndef _SYS_DISKPC98_H_ -#define _SYS_DISKPC98_H_ - -#include +#ifndef _SYS_DISK_PC98_H_ +#define _SYS_DISK_PC98_H_ #define PC98_BBSECTOR 1 /* DOS boot block relative sector number */ #define PC98_PARTOFF 0 @@ -50,12 +48,12 @@ #define PC98_SID_MASK 0x7f #define PC98_SID_386BSD 0x44 -#define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE) -#define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE) -#define PC98_PTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD) +#define __DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE) +#define __DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE) +#define PC98_PTYP_386BSD (__DOSSID_386BSD << 8 | __DOSMID_386BSD) struct pc98_partition { - unsigned char dp_mid; + unsigned char dp_mid; unsigned char dp_sid; unsigned char dp_dum1; unsigned char dp_dum2; @@ -74,9 +72,4 @@ struct pc98_partition { CTASSERT(sizeof (struct pc98_partition) == PC98_PARTSIZE); #endif -void pc98_partition_dec(void const *pp, struct pc98_partition *d); -void pc98_partition_enc(void *pp, struct pc98_partition *d); - -#define DIOCSPC98 _IOW('M', 129, u_char[8192]) - -#endif /* !_SYS_DISKPC98_H_ */ +#endif /* !_SYS_DISK_PC98_H_ */ Copied and modified: head/sys/sys/disk/vtoc.h (from r307385, head/sys/sys/vtoc.h) ============================================================================== --- head/sys/sys/vtoc.h Sun Oct 16 02:05:22 2016 (r307385, copy source) +++ head/sys/sys/disk/vtoc.h Sun Oct 16 02:43:51 2016 (r307386) @@ -26,8 +26,8 @@ * $FreeBSD$ */ -#ifndef _SYS_VTOC_H_ -#define _SYS_VTOC_H_ +#ifndef _SYS_DISK_VTOC_H_ +#define _SYS_DISK_VTOC_H_ #define VTOC_TAG_UNASSIGNED 0x00 #define VTOC_TAG_BOOT 0x01 @@ -74,7 +74,7 @@ struct vtoc8 { struct { uint16_t tag; uint16_t flag; - } part[VTOC8_NPARTS] __packed; + } part[VTOC8_NPARTS]; uint16_t __alignment; uint32_t bootinfo[3]; uint32_t sanity; @@ -99,10 +99,10 @@ struct vtoc8 { } map[VTOC8_NPARTS]; uint16_t magic; uint16_t cksum; -} __packed; +}; #ifdef CTASSERT CTASSERT(sizeof(struct vtoc8) == 512); #endif -#endif /* _SYS_VTOC_H_ */ +#endif /* _SYS_DISK_VTOC_H_ */ Modified: head/sys/sys/disklabel.h ============================================================================== --- head/sys/sys/disklabel.h Sun Oct 16 02:05:22 2016 (r307385) +++ head/sys/sys/disklabel.h Sun Oct 16 02:43:51 2016 (r307386) @@ -38,115 +38,38 @@ #endif #include -/* - * Disk description table, see disktab(5) - */ +#include + +/* Disk description table, see disktab(5) */ #define _PATH_DISKTAB "/etc/disktab" /* - * Each disk has a label which includes information about the hardware - * disk geometry, filesystem partitions, and drive specific information. * The label is in block 0 or 1, possibly offset from the beginning * to leave room for a bootstrap, etc. + * XXX these should be defined per controller (or drive) elsewhere, not here! + * XXX in actuality it can't even be per controller or drive. It should be + * constant/fixed across storage hardware and CPU architectures. Disks can + * travel from one machine to another and a label created on one machine + * should be detectable and understood by the other. */ - -/* XXX these should be defined per controller (or drive) elsewhere, not here! */ -#if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \ - defined(__powerpc__) || defined(__mips__) #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ -#endif -#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ +#define DISKMAGIC BSD_MAGIC /* The disk magic number */ + #ifndef MAXPARTITIONS -#define MAXPARTITIONS 8 +#define MAXPARTITIONS BSD_NPARTS_MIN #endif /* Size of bootblock area in sector-size neutral bytes */ -#define BBSIZE 8192 +#define BBSIZE BSD_BOOTBLOCK_SIZE -#define LABEL_PART 2 /* partition containing label */ -#define RAW_PART 2 /* partition containing whole disk */ -#define SWAP_PART 1 /* partition normally containing swap */ - -struct disklabel { - u_int32_t d_magic; /* the magic number */ - u_int16_t d_type; /* drive type */ - u_int16_t d_subtype; /* controller/d_type specific */ - char d_typename[16]; /* type name, e.g. "eagle" */ - - char d_packname[16]; /* pack identifier */ - - /* disk geometry: */ - u_int32_t d_secsize; /* # of bytes per sector */ - u_int32_t d_nsectors; /* # of data sectors per track */ - u_int32_t d_ntracks; /* # of tracks per cylinder */ - u_int32_t d_ncylinders; /* # of data cylinders per unit */ - u_int32_t d_secpercyl; /* # of data sectors per cylinder */ - u_int32_t d_secperunit; /* # of data sectors per unit */ - - /* - * Spares (bad sector replacements) below are not counted in - * d_nsectors or d_secpercyl. Spare sectors are assumed to - * be physical sectors which occupy space at the end of each - * track and/or cylinder. - */ - u_int16_t d_sparespertrack; /* # of spare sectors per track */ - u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ - /* - * Alternate cylinders include maintenance, replacement, configuration - * description areas, etc. - */ - u_int32_t d_acylinders; /* # of alt. cylinders per unit */ - - /* hardware characteristics: */ - /* - * d_interleave, d_trackskew and d_cylskew describe perturbations - * in the media format used to compensate for a slow controller. - * Interleave is physical sector interleave, set up by the - * formatter or controller when formatting. When interleaving is - * in use, logically adjacent sectors are not physically - * contiguous, but instead are separated by some number of - * sectors. It is specified as the ratio of physical sectors - * traversed per logical sector. Thus an interleave of 1:1 - * implies contiguous layout, while 2:1 implies that logical - * sector 0 is separated by one sector from logical sector 1. - * d_trackskew is the offset of sector 0 on track N relative to - * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew - * is the offset of sector 0 on cylinder N relative to sector 0 - * on cylinder N-1. - */ - u_int16_t d_rpm; /* rotational speed */ - u_int16_t d_interleave; /* hardware sector interleave */ - u_int16_t d_trackskew; /* sector 0 skew, per track */ - u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ - u_int32_t d_headswitch; /* head switch time, usec */ - u_int32_t d_trkseek; /* track-to-track seek, usec */ - u_int32_t d_flags; /* generic flags */ -#define NDDATA 5 - u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ -#define NSPARE 5 - u_int32_t d_spare[NSPARE]; /* reserved for future use */ - u_int32_t d_magic2; /* the magic number (again) */ - u_int16_t d_checksum; /* xor of data incl. partitions */ - - /* filesystem and partition information: */ - u_int16_t d_npartitions; /* number of partitions in following */ - u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ - u_int32_t d_sbsize; /* max size of fs superblock, bytes */ - struct partition { /* the partition table */ - u_int32_t p_size; /* number of sectors in partition */ - u_int32_t p_offset; /* starting sector */ - u_int32_t p_fsize; /* filesystem basic fragment size */ - u_int8_t p_fstype; /* filesystem type, see below */ - u_int8_t p_frag; /* filesystem fragments per block */ - u_int16_t p_cpg; /* filesystem cylinders per group */ - } d_partitions[MAXPARTITIONS]; /* actually may be more */ -}; +#define LABEL_PART BSD_PART_RAW +#define RAW_PART BSD_PART_RAW +#define SWAP_PART BSD_PART_SWAP -#ifdef CTASSERT -CTASSERT(sizeof(struct disklabel) == 148 + MAXPARTITIONS * 16); -#endif +#define NDDATA BSD_NDRIVEDATA +#define NSPARE BSD_NSPARE static __inline u_int16_t dkcksum(struct disklabel *lp); static __inline u_int16_t @@ -162,23 +85,6 @@ dkcksum(struct disklabel *lp) return (sum); } - -/* d_type values: */ -#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ -#define DTYPE_MSCP 2 /* MSCP */ -#define DTYPE_DEC 3 /* other DEC (rk, rl) */ -#define DTYPE_SCSI 4 /* SCSI */ -#define DTYPE_ESDI 5 /* ESDI interface */ -#define DTYPE_ST506 6 /* ST506 etc. */ -#define DTYPE_HPIB 7 /* CS/80 on HP-IB */ -#define DTYPE_HPFL 8 /* HP Fiber-link */ -#define DTYPE_FLOPPY 10 /* floppy */ -#define DTYPE_CCD 11 /* concatenated disk */ -#define DTYPE_VINUM 12 /* vinum volume */ -#define DTYPE_DOC2K 13 /* Msys DiskOnChip */ -#define DTYPE_RAID 14 /* CMU RAIDFrame */ -#define DTYPE_JFS2 16 /* IBM JFS 2 */ - #ifdef DKTYPENAMES static const char *dktypenames[] = { "unknown", @@ -203,39 +109,6 @@ static const char *dktypenames[] = { #define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) #endif -/* - * Filesystem type and version. - * Used to interpret other filesystem-specific - * per-partition information. - */ -#define FS_UNUSED 0 /* unused */ -#define FS_SWAP 1 /* swap */ -#define FS_V6 2 /* Sixth Edition */ -#define FS_V7 3 /* Seventh Edition */ -#define FS_SYSV 4 /* System V */ -#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ -#define FS_V8 6 /* Eighth Edition, 4K blocks */ -#define FS_BSDFFS 7 /* 4.2BSD fast filesystem */ -#define FS_MSDOS 8 /* MSDOS filesystem */ -#define FS_BSDLFS 9 /* 4.4BSD log-structured filesystem */ -#define FS_OTHER 10 /* in use, but unknown/unsupported */ -#define FS_HPFS 11 /* OS/2 high-performance filesystem */ -#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ -#define FS_BOOT 13 /* partition contains bootstrap */ -#define FS_VINUM 14 /* Vinum drive */ -#define FS_RAID 15 /* RAIDFrame drive */ -#define FS_FILECORE 16 /* Acorn Filecore Filing System */ -#define FS_EXT2FS 17 /* ext2fs */ -#define FS_NTFS 18 /* Windows/NT file system */ -#define FS_CCD 20 /* concatenated disk component */ -#define FS_JFS2 21 /* IBM JFS2 */ -#define FS_HAMMER 22 /* DragonFlyBSD Hammer FS */ -#define FS_HAMMER2 23 /* DragonFlyBSD Hammer2 FS */ -#define FS_UDF 24 /* UDF */ -#define FS_EFS 26 /* SGI's Extent File system */ -#define FS_ZFS 27 /* Sun's ZFS */ -#define FS_NANDFS 30 /* FreeBSD nandfs (NiLFS derived) */ - #ifdef FSTYPENAMES static const char *fstypenames[] = { "unused", @@ -275,15 +148,6 @@ static const char *fstypenames[] = { #endif /* - * flags shared by various drives: - */ -#define D_REMOVABLE 0x01 /* removable media */ -#define D_ECC 0x02 /* supports ECC */ -#define D_BADSECT 0x04 /* supports bad sector forw. */ -#define D_RAMDISK 0x08 /* disk emulator */ -#define D_CHAIN 0x10 /* can do back-back transfers */ - -/* * NB: defines ioctls from 'd'/128 and up. */ Modified: head/sys/sys/diskmbr.h ============================================================================== --- head/sys/sys/diskmbr.h Sun Oct 16 02:05:22 2016 (r307385) +++ head/sys/sys/diskmbr.h Sun Oct 16 02:43:51 2016 (r307386) @@ -33,59 +33,12 @@ #ifndef _SYS_DISKMBR_H_ #define _SYS_DISKMBR_H_ +#include #include -#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ -#define DOSDSNOFF 440 /* WinNT/2K/XP Drive Serial Number offset */ -#define DOSPARTOFF 446 -#define DOSPARTSIZE 16 -#define NDOSPART 4 -#define NEXTDOSPART 32 -#define DOSMAGICOFFSET 510 -#define DOSMAGIC 0xAA55 - -#define DOSPTYP_EXT 0x05 /* DOS extended partition */ -#define DOSPTYP_FAT16 0x06 /* FAT16 partition */ -#define DOSPTYP_NTFS 0x07 /* NTFS partition */ -#define DOSPTYP_FAT32 0x0b /* FAT32 partition */ -#define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */ -#define DOSPTYP_PPCBOOT 0x41 /* PReP/CHRP boot partition */ -#define DOSPTYP_LDM 0x42 /* Win2k dynamic extended partition */ -#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ -#define DOSPTYP_LINUX 0x83 /* Linux partition */ -#define DOSPTYP_LINLVM 0x8e /* Linux LVM partition */ -#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ -#define DOSPTYP_APPLE_UFS 0xa8 /* Apple Mac OS X boot */ -#define DOSPTYP_APPLE_BOOT 0xab /* Apple Mac OS X UFS */ -#define DOSPTYP_HFS 0xaf /* HFS/HFS+ partition type */ -#define DOSPTYP_PMBR 0xee /* GPT Protective MBR */ -#define DOSPTYP_EFI 0xef /* EFI FAT parition */ -#define DOSPTYP_VMFS 0xfb /* VMware VMFS partition */ -#define DOSPTYP_VMKDIAG 0xfc /* VMware vmkDiagnostic partition */ -#define DOSPTYP_LINRAID 0xfd /* Linux raid partition */ - -struct dos_partition { - unsigned char dp_flag; /* bootstrap flags */ - unsigned char dp_shd; /* starting head */ - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_scyl; /* starting cylinder */ - unsigned char dp_typ; /* partition type */ - unsigned char dp_ehd; /* end head */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ecyl; /* end cylinder */ - u_int32_t dp_start; /* absolute starting sector number */ - u_int32_t dp_size; /* partition size in sectors */ -}; -#ifdef CTASSERT -CTASSERT(sizeof (struct dos_partition) == DOSPARTSIZE); -#endif - void dos_partition_dec(void const *pp, struct dos_partition *d); void dos_partition_enc(void *pp, struct dos_partition *d); -#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ -#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ - #define DIOCSMBR _IOW('M', 129, u_char[512]) #endif /* !_SYS_DISKMBR_H_ */ Modified: head/sys/sys/diskpc98.h ============================================================================== --- head/sys/sys/diskpc98.h Sun Oct 16 02:05:22 2016 (r307385) +++ head/sys/sys/diskpc98.h Sun Oct 16 02:43:51 2016 (r307386) @@ -33,46 +33,11 @@ #ifndef _SYS_DISKPC98_H_ #define _SYS_DISKPC98_H_ +#include #include -#define PC98_BBSECTOR 1 /* DOS boot block relative sector number */ -#define PC98_PARTOFF 0 -#define PC98_PARTSIZE 32 -#define PC98_NPARTS 16 -#define PC98_MAGICOFS 510 -#define PC98_MAGIC 0xAA55 - -#define PC98_MID_BOOTABLE 0x80 -#define PC98_MID_MASK 0x7f -#define PC98_MID_386BSD 0x14 - -#define PC98_SID_ACTIVE 0x80 -#define PC98_SID_MASK 0x7f -#define PC98_SID_386BSD 0x44 - -#define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE) -#define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE) -#define PC98_PTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD) - -struct pc98_partition { - unsigned char dp_mid; - unsigned char dp_sid; - unsigned char dp_dum1; - unsigned char dp_dum2; - unsigned char dp_ipl_sct; - unsigned char dp_ipl_head; - unsigned short dp_ipl_cyl; - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_shd; /* starting head */ - unsigned short dp_scyl; /* starting cylinder */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ehd; /* end head */ - unsigned short dp_ecyl; /* end cylinder */ - unsigned char dp_name[16]; -}; -#ifdef CTASSERT -CTASSERT(sizeof (struct pc98_partition) == PC98_PARTSIZE); -#endif +#define DOSMID_386BSD __DOSMID_386BSD +#define DOSSID_386BSD __DOSSID_386BSD void pc98_partition_dec(void const *pp, struct pc98_partition *d); void pc98_partition_enc(void *pp, struct pc98_partition *d); Modified: head/sys/sys/gpt.h ============================================================================== --- head/sys/sys/gpt.h Sun Oct 16 02:05:22 2016 (r307385) +++ head/sys/sys/gpt.h Sun Oct 16 02:43:51 2016 (r307386) @@ -31,180 +31,7 @@ #include -struct gpt_hdr { - char hdr_sig[8]; -#define GPT_HDR_SIG "EFI PART" - uint32_t hdr_revision; -#define GPT_HDR_REVISION 0x00010000 - uint32_t hdr_size; - uint32_t hdr_crc_self; - uint32_t __reserved; - uint64_t hdr_lba_self; - uint64_t hdr_lba_alt; - uint64_t hdr_lba_start; - uint64_t hdr_lba_end; - struct uuid hdr_uuid; - uint64_t hdr_lba_table; - uint32_t hdr_entries; - uint32_t hdr_entsz; - uint32_t hdr_crc_table; - /* - * The header as defined in the EFI spec is not a multiple of 8 bytes - * and given that the alignment requirement is on an 8 byte boundary, - * padding will happen. We make the padding explicit so that we can - * correct the value returned by sizeof() when we put the size of the - * header in field hdr_size, or otherwise use offsetof(). - */ - uint32_t padding; -}; - -struct gpt_ent { - struct uuid ent_type; - struct uuid ent_uuid; - uint64_t ent_lba_start; - uint64_t ent_lba_end; - uint64_t ent_attr; -#define GPT_ENT_ATTR_PLATFORM (1ULL << 0) -#define GPT_ENT_ATTR_BOOTME (1ULL << 59) -#define GPT_ENT_ATTR_BOOTONCE (1ULL << 58) -#define GPT_ENT_ATTR_BOOTFAILED (1ULL << 57) - uint16_t ent_name[36]; /* UTF-16. */ -}; - -#define GPT_ENT_TYPE_UNUSED \ - {0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}} -#define GPT_ENT_TYPE_EFI \ - {0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}} -#define GPT_ENT_TYPE_MBR \ - {0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}} -#define GPT_ENT_TYPE_FREEBSD \ - {0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} -#define GPT_ENT_TYPE_FREEBSD_BOOT \ - {0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}} -#define GPT_ENT_TYPE_FREEBSD_NANDFS \ - {0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}} -#define GPT_ENT_TYPE_FREEBSD_SWAP \ - {0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} -#define GPT_ENT_TYPE_FREEBSD_UFS \ - {0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} -#define GPT_ENT_TYPE_FREEBSD_VINUM \ - {0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} -#define GPT_ENT_TYPE_FREEBSD_ZFS \ - {0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} -#define GPT_ENT_TYPE_PREP_BOOT \ - {0x9e1a2d38,0xc612,0x4316,0xaa,0x26,{0x8b,0x49,0x52,0x1e,0x5a,0x8b}} - -/* - * The following are unused but documented here to avoid reuse. - * - * GPT_ENT_TYPE_FREEBSD_UFS2 \ - * {0x516e7cb7,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}} - */ - -/* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Oct 16 02:55:54 2016 Return-Path: Delivered-To: svn-src-all@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 C50D6C11937; Sun, 16 Oct 2016 02:55:54 +0000 (UTC) (envelope-from marcel@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 9F2E9C92; Sun, 16 Oct 2016 02:55:54 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9G2trKD054359; Sun, 16 Oct 2016 02:55:53 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9G2trba054350; Sun, 16 Oct 2016 02:55:53 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610160255.u9G2trba054350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 16 Oct 2016 02:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307387 - head/usr.bin/mkimg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 02:55:54 -0000 Author: marcel Date: Sun Oct 16 02:55:52 2016 New Revision: 307387 URL: https://svnweb.freebsd.org/changeset/base/307387 Log: Switch to using the portable partition scheme headers. Modified: head/usr.bin/mkimg/Makefile head/usr.bin/mkimg/apm.c head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/Makefile ============================================================================== --- head/usr.bin/mkimg/Makefile Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/Makefile Sun Oct 16 02:55:52 2016 (r307387) @@ -11,6 +11,7 @@ mkimg.o: Makefile CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION} CFLAGS+=-DSPARSE_WRITE +CFLAGS+=-I${.CURDIR:H:H}/sys # List of formats to support SRCS+= \ Modified: head/usr.bin/mkimg/apm.c ============================================================================== --- head/usr.bin/mkimg/apm.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/apm.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,20 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef APM_ENT_TYPE_APPLE_BOOT -#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" -#endif -#ifndef APM_ENT_TYPE_FREEBSD_NANDFS -#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" -#endif - static struct mkimg_alias apm_aliases[] = { { ALIAS_FREEBSD, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD) }, { ALIAS_FREEBSD_BOOT, ALIAS_PTR2TYPE(APM_ENT_TYPE_APPLE_BOOT) }, Modified: head/usr.bin/mkimg/bsd.c ============================================================================== --- head/usr.bin/mkimg/bsd.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/bsd.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,17 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef FS_NANDFS -#define FS_NANDFS 30 -#endif - static struct mkimg_alias bsd_aliases[] = { { ALIAS_FREEBSD_NANDFS, ALIAS_INT2TYPE(FS_NANDFS) }, { ALIAS_FREEBSD_SWAP, ALIAS_INT2TYPE(FS_SWAP) }, @@ -58,7 +54,7 @@ bsd_metadata(u_int where, lba_t blk) { if (where == SCHEME_META_IMG_START) - blk += BBSIZE / secsz; + blk += BSD_BOOTBLOCK_SIZE / secsz; else if (where == SCHEME_META_IMG_END) blk = round_cylinder(blk); else @@ -76,21 +72,21 @@ bsd_write(lba_t imgsz, void *bootcode) int bsdparts, error, n; uint16_t checksum; - buf = malloc(BBSIZE); + buf = malloc(BSD_BOOTBLOCK_SIZE); if (buf == NULL) return (ENOMEM); if (bootcode != NULL) { - memcpy(buf, bootcode, BBSIZE); + memcpy(buf, bootcode, BSD_BOOTBLOCK_SIZE); memset(buf + secsz, 0, sizeof(struct disklabel)); } else - memset(buf, 0, BBSIZE); + memset(buf, 0, BSD_BOOTBLOCK_SIZE); bsdparts = nparts + 1; /* Account for c partition */ - if (bsdparts < MAXPARTITIONS) - bsdparts = MAXPARTITIONS; + if (bsdparts < BSD_NPARTS_MIN) + bsdparts = BSD_NPARTS_MIN; d = (void *)(buf + secsz); - le32enc(&d->d_magic, DISKMAGIC); + le32enc(&d->d_magic, BSD_MAGIC); le32enc(&d->d_secsize, secsz); le32enc(&d->d_nsectors, nsecs); le32enc(&d->d_ntracks, nheads); @@ -98,14 +94,14 @@ bsd_write(lba_t imgsz, void *bootcode) le32enc(&d->d_secpercyl, nsecs * nheads); le32enc(&d->d_secperunit, imgsz); le16enc(&d->d_rpm, 3600); - le32enc(&d->d_magic2, DISKMAGIC); + le32enc(&d->d_magic2, BSD_MAGIC); le16enc(&d->d_npartitions, bsdparts); - le32enc(&d->d_bbsize, BBSIZE); + le32enc(&d->d_bbsize, BSD_BOOTBLOCK_SIZE); - dp = &d->d_partitions[RAW_PART]; + dp = &d->d_partitions[BSD_PART_RAW]; le32enc(&dp->p_size, imgsz); TAILQ_FOREACH(part, &partlist, link) { - n = part->index + ((part->index >= RAW_PART) ? 1 : 0); + n = part->index + ((part->index >= BSD_PART_RAW) ? 1 : 0); dp = &d->d_partitions[n]; le32enc(&dp->p_size, part->size); le32enc(&dp->p_offset, part->block); @@ -121,7 +117,7 @@ bsd_write(lba_t imgsz, void *bootcode) checksum ^= le16dec(p); le16enc(&d->d_checksum, checksum); - error = image_write(0, buf, BBSIZE / secsz); + error = image_write(0, buf, BSD_BOOTBLOCK_SIZE / secsz); free(buf); return (error); } @@ -132,8 +128,8 @@ static struct mkimg_scheme bsd_scheme = .aliases = bsd_aliases, .metadata = bsd_metadata, .write = bsd_write, - .nparts = 19, - .bootcode = BBSIZE, + .nparts = BSD_NPARTS_MAX - 1, + .bootcode = BSD_BOOTBLOCK_SIZE, .maxsecsz = 512 }; Modified: head/usr.bin/mkimg/ebr.c ============================================================================== --- head/usr.bin/mkimg/ebr.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/ebr.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,22 +33,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef DOSPTYP_FAT16B -#define DOSPTYP_FAT16B 0x06 -#endif -#ifndef DOSPTYP_FAT32 -#define DOSPTYP_FAT32 0x0b -#endif - static struct mkimg_alias ebr_aliases[] = { - { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16B) }, + { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16) }, { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) }, { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) }, { ALIAS_NONE, 0 } Modified: head/usr.bin/mkimg/gpt.c ============================================================================== --- head/usr.bin/mkimg/gpt.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/gpt.c Sun Oct 16 02:55:52 2016 (r307387) @@ -35,19 +35,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef GPT_ENT_TYPE_FREEBSD_NANDFS -#define GPT_ENT_TYPE_FREEBSD_NANDFS \ - {0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}} -#endif - static uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; static uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; static uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; Modified: head/usr.bin/mkimg/mbr.c ============================================================================== --- head/usr.bin/mkimg/mbr.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/mbr.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,30 +33,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef DOSPTYP_FAT16B -#define DOSPTYP_FAT16B 0x06 -#endif -#ifndef DOSPTYP_FAT32 -#define DOSPTYP_FAT32 0x0b -#endif -#ifndef DOSPTYP_PPCBOOT -#define DOSPTYP_PPCBOOT 0x41 -#endif -#ifndef DOSPTYP_EFI -#define DOSPTYP_EFI 0xef -#endif - static struct mkimg_alias mbr_aliases[] = { { ALIAS_EBR, ALIAS_INT2TYPE(DOSPTYP_EXT) }, { ALIAS_EFI, ALIAS_INT2TYPE(DOSPTYP_EFI) }, - { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16B) }, + { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16) }, { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) }, { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) }, { ALIAS_NTFS, ALIAS_INT2TYPE(DOSPTYP_NTFS) }, Modified: head/usr.bin/mkimg/pc98.c ============================================================================== --- head/usr.bin/mkimg/pc98.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/pc98.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,26 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef PC98_MAGIC -#define PC98_MAGIC 0xaa55 -#endif -#ifndef PC98_MAGICOFS -#define PC98_MAGICOFS 510 -#endif -#ifndef PC98_NPARTS -#define PC98_NPARTS 16 -#endif -#ifndef PC98_PTYP_386BSD -#define PC98_PTYP_386BSD 0xc494 -#endif - #define PC98_BOOTCODESZ 8192 static struct mkimg_alias pc98_aliases[] = { Modified: head/usr.bin/mkimg/vtoc8.c ============================================================================== --- head/usr.bin/mkimg/vtoc8.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/vtoc8.c Sun Oct 16 02:55:52 2016 (r307387) @@ -34,17 +34,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef VTOC_TAG_FREEBSD_NANDFS -#define VTOC_TAG_FREEBSD_NANDFS 0x0905 -#endif - static struct mkimg_alias vtoc8_aliases[] = { { ALIAS_FREEBSD_NANDFS, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_NANDFS) }, { ALIAS_FREEBSD_SWAP, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_SWAP) }, From owner-svn-src-all@freebsd.org Sun Oct 16 04:22:06 2016 Return-Path: Delivered-To: svn-src-all@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 4181DC13048; Sun, 16 Oct 2016 04:22:06 +0000 (UTC) (envelope-from jhibbits@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 0DEEC942; Sun, 16 Oct 2016 04:22:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9G4M5DX089539; Sun, 16 Oct 2016 04:22:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9G4M52R089538; Sun, 16 Oct 2016 04:22:05 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610160422.u9G4M52R089538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 16 Oct 2016 04:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307388 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 04:22:06 -0000 Author: jhibbits Date: Sun Oct 16 04:22:04 2016 New Revision: 307388 URL: https://svnweb.freebsd.org/changeset/base/307388 Log: Fix booting on systems that use loader(8) (most of them). r306065/r306067 introduced ofw_parse_bootargs(), setting environment variables from Open Firmware's /chosen/bootargs property. On systems booting with loader(8) (meaning, most systems), the initial static kenv is created with no extra space, causing kern_setenv() to panic. Since these already have the environment set directly, there is no need to parse bootargs anyway. Found by: swills Modified: head/sys/powerpc/powerpc/machdep.c Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Sun Oct 16 02:55:52 2016 (r307387) +++ head/sys/powerpc/powerpc/machdep.c Sun Oct 16 04:22:04 2016 (r307388) @@ -238,6 +238,7 @@ powerpc_init(vm_offset_t fdt, vm_offset_ vm_offset_t startkernel, endkernel; void *kmdp; char *env; + bool ofw_bootargs = false; #ifdef DDB vm_offset_t ksym_start; vm_offset_t ksym_end; @@ -295,6 +296,7 @@ powerpc_init(vm_offset_t fdt, vm_offset_ bzero(__bss_start, _end - __bss_start); #endif init_static_kenv(init_kenv, sizeof(init_kenv)); + ofw_bootargs = true; } /* Store boot environment state */ OF_initial_setup((void *)fdt, NULL, (int (*)(void *))ofentry); @@ -337,7 +339,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_ OF_bootstrap(); - ofw_parse_bootargs(); + if (ofw_bootargs) + ofw_parse_bootargs(); /* * Initialize the console before printing anything. From owner-svn-src-all@freebsd.org Sun Oct 16 05:53:20 2016 Return-Path: Delivered-To: svn-src-all@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 1DA3FC13F99; Sun, 16 Oct 2016 05:53:20 +0000 (UTC) (envelope-from imp@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 E3F4D98F; Sun, 16 Oct 2016 05:53:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9G5rJjx023327; Sun, 16 Oct 2016 05:53:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9G5rJRh023326; Sun, 16 Oct 2016 05:53:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610160553.u9G5rJRh023326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 16 Oct 2016 05:53:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307390 - head/usr.sbin/efivar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 05:53:20 -0000 Author: imp Date: Sun Oct 16 05:53:18 2016 New Revision: 307390 URL: https://svnweb.freebsd.org/changeset/base/307390 Log: style(9) nit: space after |. Modified: head/usr.sbin/efivar/efivar.c Modified: head/usr.sbin/efivar/efivar.c ============================================================================== --- head/usr.sbin/efivar/efivar.c Sun Oct 16 05:32:28 2016 (r307389) +++ head/usr.sbin/efivar/efivar.c Sun Oct 16 05:53:18 2016 (r307390) @@ -62,7 +62,7 @@ static struct option longopts[] = { static int aflag, Aflag, bflag, dflag, Dflag, Hflag, Nflag, lflag, Lflag, Rflag, wflag, pflag; static char *varname; -static u_long attrib = EFI_VARIABLE_NON_VOLATILE |EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; +static u_long attrib = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; static void usage(void) From owner-svn-src-all@freebsd.org Sun Oct 16 06:07:44 2016 Return-Path: Delivered-To: svn-src-all@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 BD7B4C141A9; Sun, 16 Oct 2016 06:07:44 +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 95142E48; Sun, 16 Oct 2016 06:07:44 +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 u9G67hiE027351; Sun, 16 Oct 2016 06:07:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9G67hkd027348; Sun, 16 Oct 2016 06:07:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610160607.u9G67hkd027348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 16 Oct 2016 06:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307391 - in head/sys: amd64/amd64 dev/efidev sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 06:07:44 -0000 Author: kib Date: Sun Oct 16 06:07:43 2016 New Revision: 307391 URL: https://svnweb.freebsd.org/changeset/base/307391 Log: Do not try to create /dev/efi device node before devfs is initialized. Split efirt.ko initialization into early stage where runtime services KPI environment is created, to be used e.g. for RTC, and the later devfs node creation stage, per module. Switch the efi device to use make_dev_s(9) instead of make_dev(9). At least, this gracefully handles the duplicated device name issue. Remove ARGSUSED comment from efidev_ioctl(), all unused arguments are annotated with __unused attribute. Reported by: ambrisko, O. Hartmann Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/amd64/amd64/efirt.c head/sys/dev/efidev/efidev.c head/sys/sys/efi.h Modified: head/sys/amd64/amd64/efirt.c ============================================================================== --- head/sys/amd64/amd64/efirt.c Sun Oct 16 05:53:18 2016 (r307390) +++ head/sys/amd64/amd64/efirt.c Sun Oct 16 06:07:43 2016 (r307391) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); static struct efi_systbl *efi_systbl; static struct efi_cfgtbl *efi_cfgtbl; static struct efi_rt *efi_runtime; -static struct cdev *efi_cdev; static int efi_status2err[25] = { 0, /* EFI_SUCCESS */ @@ -403,15 +402,13 @@ efi_init(void) return (ENXIO); } - return (efidev_init(&efi_cdev)); + return (0); } static void efi_uninit(void) { - efidev_uninit(efi_cdev); - efi_destroy_1t1_map(); efi_systbl = NULL; @@ -566,7 +563,6 @@ efirt_modevents(module_t m, int event, v switch (event) { case MOD_LOAD: return (efi_init()); - break; case MOD_UNLOAD: efi_uninit(); Modified: head/sys/dev/efidev/efidev.c ============================================================================== --- head/sys/dev/efidev/efidev.c Sun Oct 16 05:53:18 2016 (r307390) +++ head/sys/dev/efidev/efidev.c Sun Oct 16 06:07:43 2016 (r307391) @@ -47,7 +47,6 @@ static struct cdevsw efi_cdevsw = { .d_ioctl = efidev_ioctl, }; -/* ARGSUSED */ static int efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr, int flags __unused, struct thread *td __unused) @@ -173,21 +172,45 @@ vs_out: return (error); } -int -efidev_init(struct cdev **cdev) +static struct cdev *efidev; + +static int +efidev_modevents(module_t m, int event, void *arg __unused) { - - *cdev = make_dev(&efi_cdevsw, 0, UID_ROOT, GID_WHEEL, 0700, - "efi"); + struct make_dev_args mda; + int error; - return (0); -} + switch (event) { + case MOD_LOAD: + make_dev_args_init(&mda); + mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME; + mda.mda_devsw = &efi_cdevsw; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_WHEEL; + mda.mda_mode = 0700; + error = make_dev_s(&mda, &efidev, "efi"); + return (error); + + case MOD_UNLOAD: + if (efidev != NULL) + destroy_dev(efidev); + efidev = NULL; + return (0); -int -efidev_uninit(struct cdev *cdev) -{ - - destroy_dev(cdev); + case MOD_SHUTDOWN: + return (0); - return (0); + default: + return (EOPNOTSUPP); + } } + +static moduledata_t efidev_moddata = { + .name = "efidev", + .evhand = efidev_modevents, + .priv = NULL, +}; + +DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DEVFS, SI_ORDER_ANY); +MODULE_VERSION(efidev, 1); +MODULE_DEPEND(efidev, efirt, 1, 1, 1); Modified: head/sys/sys/efi.h ============================================================================== --- head/sys/sys/efi.h Sun Oct 16 05:53:18 2016 (r307390) +++ head/sys/sys/efi.h Sun Oct 16 06:07:43 2016 (r307391) @@ -165,9 +165,6 @@ struct efi_systbl { #ifdef _KERNEL extern vm_paddr_t efi_systbl_phys; -struct cdev; -int efidev_init(struct cdev **); -int efidev_uninit(struct cdev *); #endif /* _KERNEL */ #endif /* _SYS_EFI_H_ */ From owner-svn-src-all@freebsd.org Sun Oct 16 10:43:14 2016 Return-Path: Delivered-To: svn-src-all@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 11D45BED2E8; Sun, 16 Oct 2016 10:43:14 +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 C15AA1623; Sun, 16 Oct 2016 10:43:13 +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 u9GAhCi5033323; Sun, 16 Oct 2016 10:43:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GAhCiM033322; Sun, 16 Oct 2016 10:43:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610161043.u9GAhCiM033322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 16 Oct 2016 10:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307392 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 10:43:14 -0000 Author: mav Date: Sun Oct 16 10:43:12 2016 New Revision: 307392 URL: https://svnweb.freebsd.org/changeset/base/307392 Log: Optimize ZIL itx memory allocation on FreeBSD. These allocations can reach up to 128KB, while FreeBSD kernel allocator can cache allocations only up to 64KB. To avoid expensive allocations for each large ZIL write use caching zio_buf_alloc() allocator instead. To make it possible de-inline few instances of zil_itx_destroy(). Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 16 06:07:43 2016 (r307391) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 16 10:43:12 2016 (r307392) @@ -1142,6 +1142,11 @@ zil_itx_create(uint64_t txtype, size_t l lrsize = P2ROUNDUP_TYPED(lrsize, sizeof (uint64_t), size_t); +#ifdef __FreeBSD__ + if (offsetof(itx_t, itx_lr) + lrsize > PAGE_SIZE) + itx = zio_buf_alloc(offsetof(itx_t, itx_lr) + lrsize); + else +#endif itx = kmem_alloc(offsetof(itx_t, itx_lr) + lrsize, KM_SLEEP); itx->itx_lr.lrc_txtype = txtype; itx->itx_lr.lrc_reclen = lrsize; @@ -1155,6 +1160,11 @@ zil_itx_create(uint64_t txtype, size_t l void zil_itx_destroy(itx_t *itx) { +#ifdef __FreeBSD__ + if (offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen > PAGE_SIZE) + zio_buf_free(itx, offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen); + else +#endif kmem_free(itx, offsetof(itx_t, itx_lr) + itx->itx_lr.lrc_reclen); } @@ -1174,8 +1184,7 @@ zil_itxg_clean(itxs_t *itxs) list = &itxs->i_sync_list; while ((itx = list_head(list)) != NULL) { list_remove(list, itx); - kmem_free(itx, offsetof(itx_t, itx_lr) + - itx->itx_lr.lrc_reclen); + zil_itx_destroy(itx); } cookie = NULL; @@ -1184,8 +1193,7 @@ zil_itxg_clean(itxs_t *itxs) list = &ian->ia_list; while ((itx = list_head(list)) != NULL) { list_remove(list, itx); - kmem_free(itx, offsetof(itx_t, itx_lr) + - itx->itx_lr.lrc_reclen); + zil_itx_destroy(itx); } list_destroy(list); kmem_free(ian, sizeof (itx_async_node_t)); @@ -1250,8 +1258,7 @@ zil_remove_async(zilog_t *zilog, uint64_ } while ((itx = list_head(&clean_list)) != NULL) { list_remove(&clean_list, itx); - kmem_free(itx, offsetof(itx_t, itx_lr) + - itx->itx_lr.lrc_reclen); + zil_itx_destroy(itx); } list_destroy(&clean_list); } @@ -1501,8 +1508,7 @@ zil_commit_writer(zilog_t *zilog) if (txg > spa_last_synced_txg(spa) || txg > spa_freeze_txg(spa)) lwb = zil_lwb_commit(zilog, itx, lwb); list_remove(&zilog->zl_itx_commit_list, itx); - kmem_free(itx, offsetof(itx_t, itx_lr) - + itx->itx_lr.lrc_reclen); + zil_itx_destroy(itx); } DTRACE_PROBE1(zil__cw2, zilog_t *, zilog); From owner-svn-src-all@freebsd.org Sun Oct 16 12:55:33 2016 Return-Path: Delivered-To: svn-src-all@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 490A8C11E1B; Sun, 16 Oct 2016 12:55:33 +0000 (UTC) (envelope-from jmcneill@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 156EA1AE1; Sun, 16 Oct 2016 12:55:33 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GCtWcc082676; Sun, 16 Oct 2016 12:55:32 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GCtWCZ082675; Sun, 16 Oct 2016 12:55:32 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201610161255.u9GCtWCZ082675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 16 Oct 2016 12:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307393 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 12:55:33 -0000 Author: jmcneill Date: Sun Oct 16 12:55:31 2016 New Revision: 307393 URL: https://svnweb.freebsd.org/changeset/base/307393 Log: aw_ccu on H3 needs access to PRCM space. The r_pio controller works now. Modified: head/sys/arm/allwinner/aw_ccu.c Modified: head/sys/arm/allwinner/aw_ccu.c ============================================================================== --- head/sys/arm/allwinner/aw_ccu.c Sun Oct 16 10:43:12 2016 (r307392) +++ head/sys/arm/allwinner/aw_ccu.c Sun Oct 16 12:55:31 2016 (r307393) @@ -82,7 +82,7 @@ static struct ofw_compat_data compat_dat { "allwinner,sun6i-a31s", CLOCK_CCU }, { "allwinner,sun50i-a64", CLOCK_CCU }, { "allwinner,sun8i-a83t", CLOCK_CCU|CLOCK_PRCM|CLOCK_SYSCTRL }, - { "allwinner,sun8i-h3", CLOCK_CCU }, + { "allwinner,sun8i-h3", CLOCK_CCU|CLOCK_PRCM }, { NULL, 0 } }; From owner-svn-src-all@freebsd.org Sun Oct 16 14:13:34 2016 Return-Path: Delivered-To: svn-src-all@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 28475C12FD9; Sun, 16 Oct 2016 14:13:34 +0000 (UTC) (envelope-from luigi@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 BDAC0177D; Sun, 16 Oct 2016 14:13:33 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GEDXll013529; Sun, 16 Oct 2016 14:13:33 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GEDW91013522; Sun, 16 Oct 2016 14:13:32 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610161413.u9GEDW91013522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Sun, 16 Oct 2016 14:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 14:13:34 -0000 Author: luigi Date: Sun Oct 16 14:13:32 2016 New Revision: 307394 URL: https://svnweb.freebsd.org/changeset/base/307394 Log: Import the current version of netmap, aligned with the one on github. This commit, long overdue, contains contributions in the last 2 years from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including: + fixes on monitor ports + the 'ptnet' virtual device driver, and ptnetmap backend, for high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit) + improved emulated netmap mode + more robust error handling + removal of stale code + various fixes to code and documentation (some mixup between RX and TX parameters, and private and public variables) We also include an additional tool, nmreplay, which is functionally equivalent to tcpreplay but operating on netmap ports. Added: head/tools/tools/netmap/ctrs.h (contents, props changed) head/tools/tools/netmap/nmreplay.8 (contents, props changed) head/tools/tools/netmap/nmreplay.c (contents, props changed) Modified: head/share/man/man4/netmap.4 head/sys/conf/files head/sys/dev/netmap/if_ixl_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mbq.c head/sys/dev/netmap/netmap_mbq.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_offloadings.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_vale.c head/sys/modules/netmap/Makefile head/sys/net/netmap.h head/sys/net/netmap_user.h head/tools/tools/netmap/Makefile head/tools/tools/netmap/bridge.c head/tools/tools/netmap/pkt-gen.c head/tools/tools/netmap/vale-ctl.c Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Sun Oct 16 12:55:31 2016 (r307393) +++ head/share/man/man4/netmap.4 Sun Oct 16 14:13:32 2016 (r307394) @@ -33,10 +33,10 @@ .Sh NAME .Nm netmap .Nd a framework for fast packet I/O -.Pp +.br .Nm VALE .Nd a fast VirtuAl Local Ethernet using the netmap API -.Pp +.br .Nm netmap pipes .Nd a shared memory packet transport channel .Sh SYNOPSIS @@ -44,28 +44,49 @@ .Sh DESCRIPTION .Nm is a framework for extremely fast and efficient packet I/O -for both userspace and kernel clients. +for userspace and kernel clients, and for Virtual Machines. It runs on .Fx -and Linux, and includes -.Nm VALE , -a very fast and modular in-kernel software switch/dataplane, -and -.Nm netmap pipes , -a shared memory packet transport channel. -All these are accessed interchangeably with the same API. +Linux and some versions of Windows, and supports a variety of +.Nm netmap ports , +including +.Bl -tag -width XXXX +.It Nm physical NIC ports +to access individual queues of network interfaces; +.It Nm host ports +to inject packets into the host stack; +.It Nm VALE ports +implementing a very fast and modular in-kernel software switch/dataplane; +.It Nm netmap pipes +a shared memory packet transport channel; +.It Nm netmap monitors +a mechanism similar to +.Xr bpf +to capture traffic +.El .Pp -.Nm , -.Nm VALE -and -.Nm netmap pipes -are at least one order of magnitude faster than +All these +.Nm netmap ports +are accessed interchangeably with the same API, +and are at least one order of magnitude faster than standard OS mechanisms -(sockets, bpf, tun/tap interfaces, native switches, pipes), -reaching 14.88 million packets per second (Mpps) -with much less than one core on a 10 Gbit NIC, -about 20 Mpps per core for VALE ports, -and over 100 Mpps for netmap pipes. +(sockets, bpf, tun/tap interfaces, native switches, pipes). +With suitably fast hardware (NICs, PCIe buses, CPUs), +packet I/O using +.Nm +on supported NICs +reaches 14.88 million packets per second (Mpps) +with much less than one core on 10 Gbit/s NICs; +35-40 Mpps on 40 Gbit/s NICs (limited by the hardware); +about 20 Mpps per core for VALE ports; +and over 100 Mpps for +.Nm netmap pipes. +NICs without native +.Nm +support can still use the API in emulated mode, +which uses unmodified device drivers and is 3-5 times faster than +.Xr bpf +or raw sockets. .Pp Userspace clients can dynamically switch NICs into .Nm @@ -73,8 +94,10 @@ mode and send and receive raw packets th memory mapped buffers. Similarly, .Nm VALE -switch instances and ports, and +switch instances and ports, .Nm netmap pipes +and +.Nm netmap monitors can be created dynamically, providing high speed packet I/O between processes, virtual machines, NICs and the host stack. @@ -89,17 +112,17 @@ and standard OS mechanisms such as .Xr epoll 2 , and .Xr kqueue 2 . -.Nm VALE -and -.Nm netmap pipes +All types of +.Nm netmap ports +and the +.Nm VALE switch are implemented by a single kernel module, which also emulates the .Nm -API over standard drivers for devices without native -.Nm -support. +API over standard drivers. For best performance, .Nm -requires explicit support in device drivers. +requires native support in device drivers. +A list of such devices is at the end of this document. .Pp In the rest of this (long) manual page we document various aspects of the @@ -116,7 +139,7 @@ which can be connected to a physical int to the host stack, or to a .Nm VALE -switch). +switch. Ports use preallocated circular queues of buffers .Em ( rings ) residing in an mmapped region. @@ -166,16 +189,18 @@ has multiple modes of operation controll .Vt struct nmreq argument. .Va arg.nr_name -specifies the port name, as follows: +specifies the netmap port name, as follows: .Bl -tag -width XXXX .It Dv OS network interface name (e.g. 'em0', 'eth1', ... ) the data path of the NIC is disconnected from the host stack, and the file descriptor is bound to the NIC (one or all queues), or to the host stack; -.It Dv valeXXX:YYY (arbitrary XXX and YYY) -the file descriptor is bound to port YYY of a VALE switch called XXX, -both dynamically created if necessary. -The string cannot exceed IFNAMSIZ characters, and YYY cannot +.It Dv valeSSS:PPP +the file descriptor is bound to port PPP of VALE switch SSS. +Switch instances and ports are dynamically created if necessary. +.br +Both SSS and PPP have the form [0-9a-zA-Z_]+ , the string +cannot exceed IFNAMSIZ characters, and PPP cannot be the name of any existing OS network interface. .El .Pp @@ -312,9 +337,6 @@ one slot is always kept empty. The ring size .Va ( num_slots ) should not be assumed to be a power of two. -.br -(NOTE: older versions of netmap used head/count format to indicate -the content of a ring). .Pp .Va head is the first slot available to userspace; @@ -585,6 +607,15 @@ it from the host stack. Multiple file descriptors can be bound to the same port, with proper synchronization left to the user. .Pp +The recommended way to bind a file descriptor to a port is +to use function +.Va nm_open(..) +(see +.Xr LIBRARIES ) +which parses names to access specific port types and +enable features. +In the following we document the main features. +.Pp .Dv NIOCREGIF can also bind a file descriptor to one endpoint of a .Em netmap pipe , consisting of two netmap ports with a crossover connection. @@ -734,7 +765,7 @@ similar to binds a file descriptor to a port. .Bl -tag -width XX .It Va ifname -is a port name, in the form "netmap:XXX" for a NIC and "valeXXX:YYY" for a +is a port name, in the form "netmap:PPP" for a NIC and "valeSSS:PPP" for a .Nm VALE port. .It Va req @@ -774,28 +805,39 @@ similar to pcap_next(), fetches the next natively supports the following devices: .Pp On FreeBSD: +.Xr cxgbe 4 , .Xr em 4 , .Xr igb 4 , .Xr ixgbe 4 , +.Xr ixl 4 , .Xr lem 4 , .Xr re 4 . .Pp On Linux .Xr e1000 4 , .Xr e1000e 4 , +.Xr i40e 4 , .Xr igb 4 , .Xr ixgbe 4 , -.Xr mlx4 4 , -.Xr forcedeth 4 , .Xr r8169 4 . .Pp NICs without native support can still be used in .Nm mode through emulation. Performance is inferior to native netmap -mode but still significantly higher than sockets, and approaching +mode but still significantly higher than various raw socket types +(bpf, PF_PACKET, etc.). +Note that for slow devices (such as 1 Gbit/s and slower NICs, +or several 10 Gbit/s NICs whose hardware is unable that of in-kernel solutions such as Linux's .Xr pktgen . +When emulation is in use, packet sniffer programs such as tcpdump +could see received packets before they are diverted by netmap. This behaviour +is not intentional, being just an artifact of the implementation of emulation. +Note that in case the netmap application subsequently moves packets received +from the emulated adapter onto the host RX ring, the sniffer will intercept +those packets again, since the packets are injected to the host stack as they +were received by the network interface. .Pp Emulation is also available for devices with native netmap support, which can be used for testing or performance comparison. @@ -812,8 +854,12 @@ and module parameters on Linux .Bl -tag -width indent .It Va dev.netmap.admode: 0 Controls the use of native or emulated adapter mode. -0 uses the best available option, 1 forces native and -fails if not available, 2 forces emulated hence never fails. +.br +0 uses the best available option; +.br +1 forces native mode and fails if not available; +.br +2 forces emulated hence never fails. .It Va dev.netmap.generic_ringsize: 1024 Ring size used for emulated netmap mode .It Va dev.netmap.generic_mit: 100000 @@ -861,9 +907,9 @@ performance. uses .Xr select 2 , .Xr poll 2 , -.Xr epoll +.Xr epoll 2 and -.Xr kqueue +.Xr kqueue 2 to wake up processes when significant events occur, and .Xr mmap 2 to map memory. @@ -1015,8 +1061,8 @@ e.g. running the following in two differ .Dl pkt-gen -i vale1:b -f tx # sender The same example can be used to test netmap pipes, by simply changing port names, e.g. -.Dl pkt-gen -i vale:x{3 -f rx # receiver on the master side -.Dl pkt-gen -i vale:x}3 -f tx # sender on the slave side +.Dl pkt-gen -i vale2:x{3 -f rx # receiver on the master side +.Dl pkt-gen -i vale2:x}3 -f tx # sender on the slave side .Pp The following command attaches an interface and the host stack to a switch: Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Oct 16 12:55:31 2016 (r307393) +++ head/sys/conf/files Sun Oct 16 14:13:32 2016 (r307394) @@ -2187,6 +2187,7 @@ dev/nand/nfc_if.m optional nand dev/ncr/ncr.c optional ncr pci dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard +dev/netmap/if_ptnet.c optional netmap dev/netmap/netmap.c optional netmap dev/netmap/netmap_freebsd.c optional netmap dev/netmap/netmap_generic.c optional netmap @@ -2195,6 +2196,7 @@ dev/netmap/netmap_mem2.c optional netmap dev/netmap/netmap_monitor.c optional netmap dev/netmap/netmap_offloadings.c optional netmap dev/netmap/netmap_pipe.c optional netmap +dev/netmap/netmap_pt.c optional netmap dev/netmap/netmap_vale.c optional netmap # compile-with "${NORMAL_C} -Wconversion -Wextra" dev/nfsmb/nfsmb.c optional nfsmb pci Modified: head/sys/dev/netmap/if_ixl_netmap.h ============================================================================== --- head/sys/dev/netmap/if_ixl_netmap.h Sun Oct 16 12:55:31 2016 (r307393) +++ head/sys/dev/netmap/if_ixl_netmap.h Sun Oct 16 14:13:32 2016 (r307394) @@ -59,7 +59,7 @@ extern int ixl_rx_miss, ixl_rx_miss_bufs /* * device-specific sysctl variables: * - * ixl_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * ixl_crcstrip: 0: NIC keeps CRC in rx frames, 1: NIC strips it (default). * During regular operations the CRC is stripped, but on some * hardware reception of frames not multiple of 64 is slower, * so using crcstrip=0 helps in benchmarks. @@ -73,7 +73,7 @@ SYSCTL_DECL(_dev_netmap); */ #if 0 SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_crcstrip, - CTLFLAG_RW, &ixl_crcstrip, 1, "strip CRC on rx frames"); + CTLFLAG_RW, &ixl_crcstrip, 1, "NIC strips CRC on rx frames"); #endif SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss, CTLFLAG_RW, &ixl_rx_miss, 0, "potentially missed rx intr"); Modified: head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- head/sys/dev/netmap/if_lem_netmap.h Sun Oct 16 12:55:31 2016 (r307393) +++ head/sys/dev/netmap/if_lem_netmap.h Sun Oct 16 14:13:32 2016 (r307394) @@ -81,6 +81,22 @@ lem_netmap_reg(struct netmap_adapter *na } +static void +lem_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + + EM_CORE_LOCK(adapter); + if (onoff) { + lem_enable_intr(adapter); + } else { + lem_disable_intr(adapter); + } + EM_CORE_UNLOCK(adapter); +} + + /* * Reconcile kernel and user view of the transmit ring. */ @@ -99,10 +115,6 @@ lem_netmap_txsync(struct netmap_kring *k /* device-specific */ struct adapter *adapter = ifp->if_softc; -#ifdef NIC_PARAVIRT - struct paravirt_csb *csb = adapter->csb; - uint64_t *csbd = (uint64_t *)(csb + 1); -#endif /* NIC_PARAVIRT */ bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_POSTREAD); @@ -113,19 +125,6 @@ lem_netmap_txsync(struct netmap_kring *k nm_i = kring->nr_hwcur; if (nm_i != head) { /* we have new packets to send */ -#ifdef NIC_PARAVIRT - int do_kick = 0; - uint64_t t = 0; // timestamp - int n = head - nm_i; - if (n < 0) - n += lim + 1; - if (csb) { - t = rdtsc(); /* last timestamp */ - csbd[16] += t - csbd[0]; /* total Wg */ - csbd[17] += n; /* Wg count */ - csbd[0] = t; - } -#endif /* NIC_PARAVIRT */ nic_i = netmap_idx_k2n(kring, nm_i); while (nm_i != head) { struct netmap_slot *slot = &ring->slot[nm_i]; @@ -166,38 +165,8 @@ lem_netmap_txsync(struct netmap_kring *k bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifdef NIC_PARAVIRT - /* set unconditionally, then also kick if needed */ - if (csb) { - t = rdtsc(); - if (csb->host_need_txkick == 2) { - /* can compute an update of delta */ - int64_t delta = t - csbd[3]; - if (delta < 0) - delta = -delta; - if (csbd[8] == 0 || delta < csbd[8]) { - csbd[8] = delta; - csbd[9]++; - } - csbd[10]++; - } - csb->guest_tdt = nic_i; - csbd[18] += t - csbd[0]; // total wp - csbd[19] += n; - } - if (!csb || !csb->guest_csb_on || (csb->host_need_txkick & 1)) - do_kick = 1; - if (do_kick) -#endif /* NIC_PARAVIRT */ /* (re)start the tx unit up to slot nic_i (excluded) */ E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), nic_i); -#ifdef NIC_PARAVIRT - if (do_kick) { - uint64_t t1 = rdtsc(); - csbd[20] += t1 - t; // total Np - csbd[21]++; - } -#endif /* NIC_PARAVIRT */ } /* @@ -206,93 +175,6 @@ lem_netmap_txsync(struct netmap_kring *k if (ticks != kring->last_reclaim || flags & NAF_FORCE_RECLAIM || nm_kr_txempty(kring)) { kring->last_reclaim = ticks; /* record completed transmissions using TDH */ -#ifdef NIC_PARAVIRT - /* host updates tdh unconditionally, and we have - * no side effects on reads, so we can read from there - * instead of exiting. - */ - if (csb) { - static int drain = 0, nodrain=0, good = 0, bad = 0, fail = 0; - u_int x = adapter->next_tx_to_clean; - csbd[19]++; // XXX count reclaims - nic_i = csb->host_tdh; - if (csb->guest_csb_on) { - if (nic_i == x) { - bad++; - csbd[24]++; // failed reclaims - /* no progress, request kick and retry */ - csb->guest_need_txkick = 1; - mb(); // XXX barrier - nic_i = csb->host_tdh; - } else { - good++; - } - if (nic_i != x) { - csb->guest_need_txkick = 2; - if (nic_i == csb->guest_tdt) - drain++; - else - nodrain++; -#if 1 - if (netmap_adaptive_io) { - /* new mechanism: last half ring (or so) - * released one slot at a time. - * This effectively makes the system spin. - * - * Take next_to_clean + 1 as a reference. - * tdh must be ahead or equal - * On entry, the logical order is - * x < tdh = nic_i - * We first push tdh up to avoid wraps. - * The limit is tdh-ll (half ring). - * if tdh-256 < x we report x; - * else we report tdh-256 - */ - u_int tdh = nic_i; - u_int ll = csbd[15]; - u_int delta = lim/8; - if (netmap_adaptive_io == 2 || ll > delta) - csbd[15] = ll = delta; - else if (netmap_adaptive_io == 1 && ll > 1) { - csbd[15]--; - } - - if (nic_i >= kring->nkr_num_slots) { - RD(5, "bad nic_i %d on input", nic_i); - } - x = nm_next(x, lim); - if (tdh < x) - tdh += lim + 1; - if (tdh <= x + ll) { - nic_i = x; - csbd[25]++; //report n + 1; - } else { - tdh = nic_i; - if (tdh < ll) - tdh += lim + 1; - nic_i = tdh - ll; - csbd[26]++; // report tdh - ll - } - } -#endif - } else { - /* we stop, count whether we are idle or not */ - int bh_active = csb->host_need_txkick & 2 ? 4 : 0; - csbd[27+ csb->host_need_txkick]++; - if (netmap_adaptive_io == 1) { - if (bh_active && csbd[15] > 1) - csbd[15]--; - else if (!bh_active && csbd[15] < lim/2) - csbd[15]++; - } - bad--; - fail++; - } - } - RD(1, "drain %d nodrain %d good %d retry %d fail %d", - drain, nodrain, good, bad, fail); - } else -#endif /* !NIC_PARAVIRT */ nic_i = E1000_READ_REG(&adapter->hw, E1000_TDH(0)); if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */ D("TDH wrap %d", nic_i); @@ -324,21 +206,10 @@ lem_netmap_rxsync(struct netmap_kring *k /* device-specific */ struct adapter *adapter = ifp->if_softc; -#ifdef NIC_PARAVIRT - struct paravirt_csb *csb = adapter->csb; - uint32_t csb_mode = csb && csb->guest_csb_on; - uint32_t do_host_rxkick = 0; -#endif /* NIC_PARAVIRT */ if (head > lim) return netmap_ring_reinit(kring); -#ifdef NIC_PARAVIRT - if (csb_mode) { - force_update = 1; - csb->guest_need_rxkick = 0; - } -#endif /* NIC_PARAVIRT */ /* XXX check sync modes */ bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -357,23 +228,6 @@ lem_netmap_rxsync(struct netmap_kring *k uint32_t staterr = le32toh(curr->status); int len; -#ifdef NIC_PARAVIRT - if (csb_mode) { - if ((staterr & E1000_RXD_STAT_DD) == 0) { - /* don't bother to retry if more than 1 pkt */ - if (n > 1) - break; - csb->guest_need_rxkick = 1; - wmb(); - staterr = le32toh(curr->status); - if ((staterr & E1000_RXD_STAT_DD) == 0) { - break; - } else { /* we are good */ - csb->guest_need_rxkick = 0; - } - } - } else -#endif /* NIC_PARAVIRT */ if ((staterr & E1000_RXD_STAT_DD) == 0) break; len = le16toh(curr->length) - 4; // CRC @@ -390,18 +244,6 @@ lem_netmap_rxsync(struct netmap_kring *k nic_i = nm_next(nic_i, lim); } if (n) { /* update the state variables */ -#ifdef NIC_PARAVIRT - if (csb_mode) { - if (n > 1) { - /* leave one spare buffer so we avoid rxkicks */ - nm_i = nm_prev(nm_i, lim); - nic_i = nm_prev(nic_i, lim); - n--; - } else { - csb->guest_need_rxkick = 1; - } - } -#endif /* NIC_PARAVIRT */ ND("%d new packets at nic %d nm %d tail %d", n, adapter->next_rx_desc_to_check, @@ -440,10 +282,6 @@ lem_netmap_rxsync(struct netmap_kring *k curr->status = 0; bus_dmamap_sync(adapter->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); -#ifdef NIC_PARAVIRT - if (csb_mode && csb->host_rxkick_at == nic_i) - do_host_rxkick = 1; -#endif /* NIC_PARAVIRT */ nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } @@ -455,12 +293,6 @@ lem_netmap_rxsync(struct netmap_kring *k * so move nic_i back by one unit */ nic_i = nm_prev(nic_i, lim); -#ifdef NIC_PARAVIRT - /* set unconditionally, then also kick if needed */ - if (csb) - csb->guest_rdt = nic_i; - if (!csb_mode || do_host_rxkick) -#endif /* NIC_PARAVIRT */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), nic_i); } @@ -486,6 +318,7 @@ lem_netmap_attach(struct adapter *adapte na.nm_rxsync = lem_netmap_rxsync; na.nm_register = lem_netmap_reg; na.num_tx_rings = na.num_rx_rings = 1; + na.nm_intr = lem_netmap_intr; netmap_attach(&na); } Modified: head/sys/dev/netmap/ixgbe_netmap.h ============================================================================== --- head/sys/dev/netmap/ixgbe_netmap.h Sun Oct 16 12:55:31 2016 (r307393) +++ head/sys/dev/netmap/ixgbe_netmap.h Sun Oct 16 14:13:32 2016 (r307394) @@ -53,7 +53,7 @@ void ixgbe_netmap_attach(struct adapter /* * device-specific sysctl variables: * - * ix_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * ix_crcstrip: 0: NIC keeps CRC in rx frames (default), 1: NIC strips it. * During regular operations the CRC is stripped, but on some * hardware reception of frames not multiple of 64 is slower, * so using crcstrip=0 helps in benchmarks. @@ -65,7 +65,7 @@ SYSCTL_DECL(_dev_netmap); static int ix_rx_miss, ix_rx_miss_bufs; int ix_crcstrip; SYSCTL_INT(_dev_netmap, OID_AUTO, ix_crcstrip, - CTLFLAG_RW, &ix_crcstrip, 0, "strip CRC on rx frames"); + CTLFLAG_RW, &ix_crcstrip, 0, "NIC strips CRC on rx frames"); SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss, CTLFLAG_RW, &ix_rx_miss, 0, "potentially missed rx intr"); SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss_bufs, @@ -109,6 +109,20 @@ set_crcstrip(struct ixgbe_hw *hw, int on IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rxc); } +static void +ixgbe_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + + IXGBE_CORE_LOCK(adapter); + if (onoff) { + ixgbe_enable_intr(adapter); // XXX maybe ixgbe_stop ? + } else { + ixgbe_disable_intr(adapter); // XXX maybe ixgbe_stop ? + } + IXGBE_CORE_UNLOCK(adapter); +} /* * Register/unregister. We are already under netmap lock. @@ -311,7 +325,7 @@ ixgbe_netmap_txsync(struct netmap_kring * good way. */ nic_i = IXGBE_READ_REG(&adapter->hw, IXGBE_IS_VF(adapter) ? - IXGBE_VFTDH(kring->ring_id) : IXGBE_TDH(kring->ring_id)); + IXGBE_VFTDH(kring->ring_id) : IXGBE_TDH(kring->ring_id)); if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */ D("TDH wrap %d", nic_i); nic_i -= kring->nkr_num_slots; @@ -486,6 +500,7 @@ ixgbe_netmap_attach(struct adapter *adap na.nm_rxsync = ixgbe_netmap_rxsync; na.nm_register = ixgbe_netmap_reg; na.num_tx_rings = na.num_rx_rings = adapter->num_queues; + na.nm_intr = ixgbe_netmap_intr; netmap_attach(&na); } Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Sun Oct 16 12:55:31 2016 (r307393) +++ head/sys/dev/netmap/netmap.c Sun Oct 16 14:13:32 2016 (r307394) @@ -1,5 +1,9 @@ /* - * Copyright (C) 2011-2014 Matteo Landi, Luigi Rizzo. All rights reserved. + * Copyright (C) 2011-2014 Matteo Landi + * Copyright (C) 2011-2016 Luigi Rizzo + * Copyright (C) 2011-2016 Giuseppe Lettieri + * Copyright (C) 2011-2016 Vincenzo Maffione + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -133,13 +137,12 @@ ports attached to the switch) * > select()able file descriptor on which events are reported. * * Internally, we allocate a netmap_priv_d structure, that will be - * initialized on ioctl(NIOCREGIF). + * initialized on ioctl(NIOCREGIF). There is one netmap_priv_d + * structure for each open(). * * os-specific: - * FreeBSD: netmap_open (netmap_freebsd.c). The priv is - * per-thread. - * linux: linux_netmap_open (netmap_linux.c). The priv is - * per-open. + * FreeBSD: see netmap_open() (netmap_freebsd.c) + * linux: see linux_netmap_open() (netmap_linux.c) * * > 2. on each descriptor, the process issues an ioctl() to identify * > the interface that should report events to the file descriptor. @@ -299,18 +302,17 @@ ports attached to the switch) * netmap_transmit() * na->nm_notify == netmap_notify() * 2) ioctl(NIOCRXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_rxsync_from_host_compat + * kring->nm_sync() == netmap_rxsync_from_host * netmap_rxsync_from_host(na, NULL, NULL) * - tx to host stack * ioctl(NIOCTXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_txsync_to_host_compat + * kring->nm_sync() == netmap_txsync_to_host * netmap_txsync_to_host(na) - * NM_SEND_UP() - * FreeBSD: na->if_input() == ?? XXX + * nm_os_send_up() + * FreeBSD: na->if_input() == ether_input() * linux: netif_rx() with NM_MAGIC_PRIORITY_RX * * - * * -= SYSTEM DEVICE WITH GENERIC SUPPORT =- * * na == NA(ifp) == generic_netmap_adapter created in generic_netmap_attach() @@ -319,10 +321,11 @@ ports attached to the switch) * concurrently: * 1) ioctl(NIOCTXSYNC)/netmap_poll() in process context * kring->nm_sync() == generic_netmap_txsync() - * linux: dev_queue_xmit() with NM_MAGIC_PRIORITY_TX - * generic_ndo_start_xmit() - * orig. dev. start_xmit - * FreeBSD: na->if_transmit() == orig. dev if_transmit + * nm_os_generic_xmit_frame() + * linux: dev_queue_xmit() with NM_MAGIC_PRIORITY_TX + * ifp->ndo_start_xmit == generic_ndo_start_xmit() + * gna->save_start_xmit == orig. dev. start_xmit + * FreeBSD: na->if_transmit() == orig. dev if_transmit * 2) generic_mbuf_destructor() * na->nm_notify() == netmap_notify() * - rx from netmap userspace: @@ -333,24 +336,15 @@ ports attached to the switch) * generic_rx_handler() * mbq_safe_enqueue() * na->nm_notify() == netmap_notify() - * - rx from host stack: - * concurrently: + * - rx from host stack + * FreeBSD: same as native + * Linux: same as native except: * 1) host stack - * linux: generic_ndo_start_xmit() - * netmap_transmit() - * FreeBSD: ifp->if_input() == netmap_transmit - * both: - * na->nm_notify() == netmap_notify() - * 2) ioctl(NIOCRXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_rxsync_from_host_compat - * netmap_rxsync_from_host(na, NULL, NULL) - * - tx to host stack: - * ioctl(NIOCTXSYNC)/netmap_poll() in process context - * kring->nm_sync() == netmap_txsync_to_host_compat - * netmap_txsync_to_host(na) - * NM_SEND_UP() - * FreeBSD: na->if_input() == ??? XXX - * linux: netif_rx() with NM_MAGIC_PRIORITY_RX + * dev_queue_xmit() without NM_MAGIC_PRIORITY_TX + * ifp->ndo_start_xmit == generic_ndo_start_xmit() + * netmap_transmit() + * na->nm_notify() == netmap_notify() + * - tx to host stack (same as native): * * * -= VALE =- @@ -371,7 +365,7 @@ ports attached to the switch) * from host stack: * netmap_transmit() * na->nm_notify() == netmap_bwrap_intr_notify(ring_nr == host ring) - * kring->nm_sync() == netmap_rxsync_from_host_compat() + * kring->nm_sync() == netmap_rxsync_from_host() * netmap_vp_txsync() * * - system device with generic support: @@ -384,7 +378,7 @@ ports attached to the switch) * from host stack: * netmap_transmit() * na->nm_notify() == netmap_bwrap_intr_notify(ring_nr == host ring) - * kring->nm_sync() == netmap_rxsync_from_host_compat() + * kring->nm_sync() == netmap_rxsync_from_host() * netmap_vp_txsync() * * (all cases) --> nm_bdg_flush() @@ -407,7 +401,7 @@ ports attached to the switch) * netmap_vp_rxsync() * to host stack: * netmap_vp_rxsync() - * kring->nm_sync() == netmap_txsync_to_host_compat + * kring->nm_sync() == netmap_txsync_to_host * netmap_vp_rxsync_locked() * * - system device with generic adapter: @@ -418,7 +412,7 @@ ports attached to the switch) * netmap_vp_rxsync() * to host stack: * netmap_vp_rxsync() - * kring->nm_sync() == netmap_txsync_to_host_compat + * kring->nm_sync() == netmap_txsync_to_host * netmap_vp_rxsync() * */ @@ -455,29 +449,19 @@ ports attached to the switch) #include -/* reduce conditional code */ -// linux API, use for the knlist in FreeBSD -/* use a private mutex for the knlist */ -#define init_waitqueue_head(x) do { \ - struct mtx *m = &(x)->m; \ - mtx_init(m, "nm_kn_lock", NULL, MTX_DEF); \ - knlist_init_mtx(&(x)->si.si_note, m); \ - } while (0) - -#define OS_selrecord(a, b) selrecord(a, &((b)->si)) -#define OS_selwakeup(a, b) freebsd_selwakeup(a, b) - #elif defined(linux) #include "bsd_glue.h" - - #elif defined(__APPLE__) #warning OSX support is only partial #include "osx_glue.h" +#elif defined (_WIN32) + +#include "win_glue.h" + #else #error Unsupported platform @@ -492,47 +476,72 @@ ports attached to the switch) #include -MALLOC_DEFINE(M_NETMAP, "netmap", "Network memory map"); - /* user-controlled variables */ int netmap_verbose; static int netmap_no_timestamp; /* don't timestamp on rxsync */ - -SYSCTL_NODE(_dev, OID_AUTO, netmap, CTLFLAG_RW, 0, "Netmap args"); -SYSCTL_INT(_dev_netmap, OID_AUTO, verbose, - CTLFLAG_RW, &netmap_verbose, 0, "Verbose mode"); -SYSCTL_INT(_dev_netmap, OID_AUTO, no_timestamp, - CTLFLAG_RW, &netmap_no_timestamp, 0, "no_timestamp"); int netmap_mitigate = 1; -SYSCTL_INT(_dev_netmap, OID_AUTO, mitigate, CTLFLAG_RW, &netmap_mitigate, 0, ""); int netmap_no_pendintr = 1; -SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr, - CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received packets."); int netmap_txsync_retry = 2; -SYSCTL_INT(_dev_netmap, OID_AUTO, txsync_retry, CTLFLAG_RW, - &netmap_txsync_retry, 0 , "Number of txsync loops in bridge's flush."); - int netmap_adaptive_io = 0; -SYSCTL_INT(_dev_netmap, OID_AUTO, adaptive_io, CTLFLAG_RW, - &netmap_adaptive_io, 0 , "Adaptive I/O on paravirt"); - int netmap_flags = 0; /* debug flags */ -int netmap_fwd = 0; /* force transparent mode */ +static int netmap_fwd = 0; /* force transparent mode */ /* * netmap_admode selects the netmap mode to use. * Invalid values are reset to NETMAP_ADMODE_BEST */ -enum { NETMAP_ADMODE_BEST = 0, /* use native, fallback to generic */ +enum { NETMAP_ADMODE_BEST = 0, /* use native, fallback to generic */ NETMAP_ADMODE_NATIVE, /* either native or none */ NETMAP_ADMODE_GENERIC, /* force generic */ NETMAP_ADMODE_LAST }; static int netmap_admode = NETMAP_ADMODE_BEST; -int netmap_generic_mit = 100*1000; /* Generic mitigation interval in nanoseconds. */ -int netmap_generic_ringsize = 1024; /* Generic ringsize. */ -int netmap_generic_rings = 1; /* number of queues in generic. */ +/* netmap_generic_mit controls mitigation of RX notifications for + * the generic netmap adapter. The value is a time interval in + * nanoseconds. */ +int netmap_generic_mit = 100*1000; + +/* We use by default netmap-aware qdiscs with generic netmap adapters, + * even if there can be a little performance hit with hardware NICs. + * However, using the qdisc is the safer approach, for two reasons: + * 1) it prevents non-fifo qdiscs to break the TX notification + * scheme, which is based on mbuf destructors when txqdisc is + * not used. + * 2) it makes it possible to transmit over software devices that + * change skb->dev, like bridge, veth, ... + * + * Anyway users looking for the best performance should + * use native adapters. + */ +int netmap_generic_txqdisc = 1; + +/* Default number of slots and queues for generic adapters. */ +int netmap_generic_ringsize = 1024; +int netmap_generic_rings = 1; + +/* Non-zero if ptnet devices are allowed to use virtio-net headers. */ +int ptnet_vnet_hdr = 1; + +/* + * SYSCTL calls are grouped between SYSBEGIN and SYSEND to be emulated + * in some other operating systems + */ +SYSBEGIN(main_init); + +SYSCTL_DECL(_dev_netmap); +SYSCTL_NODE(_dev, OID_AUTO, netmap, CTLFLAG_RW, 0, "Netmap args"); +SYSCTL_INT(_dev_netmap, OID_AUTO, verbose, + CTLFLAG_RW, &netmap_verbose, 0, "Verbose mode"); +SYSCTL_INT(_dev_netmap, OID_AUTO, no_timestamp, + CTLFLAG_RW, &netmap_no_timestamp, 0, "no_timestamp"); +SYSCTL_INT(_dev_netmap, OID_AUTO, mitigate, CTLFLAG_RW, &netmap_mitigate, 0, ""); +SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr, + CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received packets."); +SYSCTL_INT(_dev_netmap, OID_AUTO, txsync_retry, CTLFLAG_RW, + &netmap_txsync_retry, 0 , "Number of txsync loops in bridge's flush."); +SYSCTL_INT(_dev_netmap, OID_AUTO, adaptive_io, CTLFLAG_RW, + &netmap_adaptive_io, 0 , "Adaptive I/O on paravirt"); SYSCTL_INT(_dev_netmap, OID_AUTO, flags, CTLFLAG_RW, &netmap_flags, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &netmap_fwd, 0 , ""); @@ -540,19 +549,24 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, admode SYSCTL_INT(_dev_netmap, OID_AUTO, generic_mit, CTLFLAG_RW, &netmap_generic_mit, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, generic_ringsize, CTLFLAG_RW, &netmap_generic_ringsize, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, generic_rings, CTLFLAG_RW, &netmap_generic_rings, 0 , ""); +SYSCTL_INT(_dev_netmap, OID_AUTO, generic_txqdisc, CTLFLAG_RW, &netmap_generic_txqdisc, 0 , ""); +SYSCTL_INT(_dev_netmap, OID_AUTO, ptnet_vnet_hdr, CTLFLAG_RW, &ptnet_vnet_hdr, 0 , ""); + +SYSEND; NMG_LOCK_T netmap_global_lock; -int netmap_use_count = 0; /* number of active netmap instances */ /* * mark the ring as stopped, and run through the locks * to make sure other users get to see it. + * stopped must be either NR_KR_STOPPED (for unbounded stop) + * of NR_KR_LOCKED (brief stop for mutual exclusion purposes) */ static void -netmap_disable_ring(struct netmap_kring *kr) +netmap_disable_ring(struct netmap_kring *kr, int stopped) { - kr->nkr_stopped = 1; - nm_kr_get(kr); + nm_kr_stop(kr, stopped); + // XXX check if nm_kr_stop is sufficient mtx_lock(&kr->q_lock); mtx_unlock(&kr->q_lock); nm_kr_put(kr); @@ -563,7 +577,7 @@ void netmap_set_ring(struct netmap_adapter *na, u_int ring_id, enum txrx t, int stopped) { if (stopped) - netmap_disable_ring(NMR(na, t) + ring_id); + netmap_disable_ring(NMR(na, t) + ring_id, stopped); else NMR(na, t)[ring_id].nkr_stopped = 0; } @@ -590,13 +604,14 @@ netmap_set_all_rings(struct netmap_adapt * Convenience function used in drivers. Waits for current txsync()s/rxsync()s * to finish and prevents any new one from starting. Call this before turning * netmap mode off, or before removing the hardware rings (e.g., on module - * onload). As a rule of thumb for linux drivers, this should be placed near - * each napi_disable(). + * onload). */ void netmap_disable_all_rings(struct ifnet *ifp) { - netmap_set_all_rings(NA(ifp), 1 /* stopped */); + if (NM_NA_VALID(ifp)) { + netmap_set_all_rings(NA(ifp), NM_KR_STOPPED); + } } /* @@ -607,9 +622,34 @@ netmap_disable_all_rings(struct ifnet *i void netmap_enable_all_rings(struct ifnet *ifp) { - netmap_set_all_rings(NA(ifp), 0 /* enabled */); + if (NM_NA_VALID(ifp)) { + netmap_set_all_rings(NA(ifp), 0 /* enabled */); + } } +void +netmap_make_zombie(struct ifnet *ifp) +{ + if (NM_NA_VALID(ifp)) { + struct netmap_adapter *na = NA(ifp); + netmap_set_all_rings(na, NM_KR_LOCKED); + na->na_flags |= NAF_ZOMBIE; + netmap_set_all_rings(na, 0); + } +} + +void +netmap_undo_zombie(struct ifnet *ifp) +{ + if (NM_NA_VALID(ifp)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Oct 16 15:22:18 2016 Return-Path: Delivered-To: svn-src-all@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 EC96AC14C97; Sun, 16 Oct 2016 15:22:18 +0000 (UTC) (envelope-from luigi@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 BE0EC12DB; Sun, 16 Oct 2016 15:22:18 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GFMIAa039710; Sun, 16 Oct 2016 15:22:18 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GFMIV6039708; Sun, 16 Oct 2016 15:22:18 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610161522.u9GFMIV6039708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Sun, 16 Oct 2016 15:22:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307395 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 15:22:19 -0000 Author: luigi Date: Sun Oct 16 15:22:17 2016 New Revision: 307395 URL: https://svnweb.freebsd.org/changeset/base/307395 Log: add two missing files for the netmap import Added: head/sys/dev/netmap/if_ptnet.c (contents, props changed) head/sys/dev/netmap/netmap_pt.c (contents, props changed) Added: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/netmap/if_ptnet.c Sun Oct 16 15:22:17 2016 (r307395) @@ -0,0 +1,2277 @@ +/*- + * Copyright (c) 2016, Vincenzo Maffione + * 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 unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* Driver for ptnet paravirtualized network device. */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include + +#ifndef PTNET_CSB_ALLOC +#error "No support for on-device CSB" +#endif + +#ifndef INET +#error "INET not defined, cannot support offloadings" +#endif + +#if __FreeBSD_version >= 1100000 +static uint64_t ptnet_get_counter(if_t, ift_counter); +#else +typedef struct ifnet *if_t; +#define if_getsoftc(_ifp) (_ifp)->if_softc +#endif + +//#define PTNETMAP_STATS +//#define DEBUG +#ifdef DEBUG +#define DBG(x) x +#else /* !DEBUG */ +#define DBG(x) +#endif /* !DEBUG */ + +extern int ptnet_vnet_hdr; /* Tunable parameter */ + +struct ptnet_softc; + +struct ptnet_queue_stats { + uint64_t packets; /* if_[io]packets */ + uint64_t bytes; /* if_[io]bytes */ + uint64_t errors; /* if_[io]errors */ + uint64_t iqdrops; /* if_iqdrops */ + uint64_t mcasts; /* if_[io]mcasts */ +#ifdef PTNETMAP_STATS + uint64_t intrs; + uint64_t kicks; +#endif /* PTNETMAP_STATS */ +}; + +struct ptnet_queue { + struct ptnet_softc *sc; + struct resource *irq; + void *cookie; + int kring_id; + struct ptnet_ring *ptring; + unsigned int kick; + struct mtx lock; + struct buf_ring *bufring; /* for TX queues */ + struct ptnet_queue_stats stats; +#ifdef PTNETMAP_STATS + struct ptnet_queue_stats last_stats; +#endif /* PTNETMAP_STATS */ + struct taskqueue *taskq; + struct task task; + char lock_name[16]; +}; + +#define PTNET_Q_LOCK(_pq) mtx_lock(&(_pq)->lock) +#define PTNET_Q_TRYLOCK(_pq) mtx_trylock(&(_pq)->lock) +#define PTNET_Q_UNLOCK(_pq) mtx_unlock(&(_pq)->lock) + +struct ptnet_softc { + device_t dev; + if_t ifp; + struct ifmedia media; + struct mtx lock; + char lock_name[16]; + char hwaddr[ETHER_ADDR_LEN]; + + /* Mirror of PTFEAT register. */ + uint32_t ptfeatures; + unsigned int vnet_hdr_len; + + /* PCI BARs support. */ + struct resource *iomem; + struct resource *msix_mem; + + unsigned int num_rings; + unsigned int num_tx_rings; + struct ptnet_queue *queues; + struct ptnet_queue *rxqueues; + struct ptnet_csb *csb; + + unsigned int min_tx_space; + + struct netmap_pt_guest_adapter *ptna; + + struct callout tick; +#ifdef PTNETMAP_STATS + struct timeval last_ts; +#endif /* PTNETMAP_STATS */ +}; + +#define PTNET_CORE_LOCK(_sc) mtx_lock(&(_sc)->lock) +#define PTNET_CORE_UNLOCK(_sc) mtx_unlock(&(_sc)->lock) + +static int ptnet_probe(device_t); +static int ptnet_attach(device_t); +static int ptnet_detach(device_t); +static int ptnet_suspend(device_t); +static int ptnet_resume(device_t); +static int ptnet_shutdown(device_t); + +static void ptnet_init(void *opaque); +static int ptnet_ioctl(if_t ifp, u_long cmd, caddr_t data); +static int ptnet_init_locked(struct ptnet_softc *sc); +static int ptnet_stop(struct ptnet_softc *sc); +static int ptnet_transmit(if_t ifp, struct mbuf *m); +static int ptnet_drain_transmit_queue(struct ptnet_queue *pq, + unsigned int budget, + bool may_resched); +static void ptnet_qflush(if_t ifp); +static void ptnet_tx_task(void *context, int pending); + +static int ptnet_media_change(if_t ifp); +static void ptnet_media_status(if_t ifp, struct ifmediareq *ifmr); +#ifdef PTNETMAP_STATS +static void ptnet_tick(void *opaque); +#endif + +static int ptnet_irqs_init(struct ptnet_softc *sc); +static void ptnet_irqs_fini(struct ptnet_softc *sc); + +static uint32_t ptnet_nm_ptctl(if_t ifp, uint32_t cmd); +static int ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, + unsigned *txd, unsigned *rxr, unsigned *rxd); +static void ptnet_update_vnet_hdr(struct ptnet_softc *sc); +static int ptnet_nm_register(struct netmap_adapter *na, int onoff); +static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); +static int ptnet_nm_rxsync(struct netmap_kring *kring, int flags); + +static void ptnet_tx_intr(void *opaque); +static void ptnet_rx_intr(void *opaque); + +static unsigned ptnet_rx_discard(struct netmap_kring *kring, + unsigned int head); +static int ptnet_rx_eof(struct ptnet_queue *pq, unsigned int budget, + bool may_resched); +static void ptnet_rx_task(void *context, int pending); + +#ifdef DEVICE_POLLING +static poll_handler_t ptnet_poll; +#endif + +static device_method_t ptnet_methods[] = { + DEVMETHOD(device_probe, ptnet_probe), + DEVMETHOD(device_attach, ptnet_attach), + DEVMETHOD(device_detach, ptnet_detach), + DEVMETHOD(device_suspend, ptnet_suspend), + DEVMETHOD(device_resume, ptnet_resume), + DEVMETHOD(device_shutdown, ptnet_shutdown), + DEVMETHOD_END +}; + +static driver_t ptnet_driver = { + "ptnet", + ptnet_methods, + sizeof(struct ptnet_softc) +}; + +/* We use (SI_ORDER_MIDDLE+2) here, see DEV_MODULE_ORDERED() invocation. */ +static devclass_t ptnet_devclass; +DRIVER_MODULE_ORDERED(ptnet, pci, ptnet_driver, ptnet_devclass, + NULL, NULL, SI_ORDER_MIDDLE + 2); + +static int +ptnet_probe(device_t dev) +{ + if (pci_get_vendor(dev) != PTNETMAP_PCI_VENDOR_ID || + pci_get_device(dev) != PTNETMAP_PCI_NETIF_ID) { + return (ENXIO); + } + + device_set_desc(dev, "ptnet network adapter"); + + return (BUS_PROBE_DEFAULT); +} + +static inline void ptnet_kick(struct ptnet_queue *pq) +{ +#ifdef PTNETMAP_STATS + pq->stats.kicks ++; +#endif /* PTNETMAP_STATS */ + bus_write_4(pq->sc->iomem, pq->kick, 0); +} + +#define PTNET_BUF_RING_SIZE 4096 +#define PTNET_RX_BUDGET 512 +#define PTNET_RX_BATCH 1 +#define PTNET_TX_BUDGET 512 +#define PTNET_TX_BATCH 64 +#define PTNET_HDR_SIZE sizeof(struct virtio_net_hdr_mrg_rxbuf) +#define PTNET_MAX_PKT_SIZE 65536 + +#define PTNET_CSUM_OFFLOAD (CSUM_TCP | CSUM_UDP | CSUM_SCTP) +#define PTNET_CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 |\ + CSUM_SCTP_IPV6) +#define PTNET_ALL_OFFLOAD (CSUM_TSO | PTNET_CSUM_OFFLOAD |\ + PTNET_CSUM_OFFLOAD_IPV6) + +static int +ptnet_attach(device_t dev) +{ + uint32_t ptfeatures = PTNETMAP_F_BASE; + unsigned int num_rx_rings, num_tx_rings; + struct netmap_adapter na_arg; + unsigned int nifp_offset; + struct ptnet_softc *sc; + if_t ifp; + uint32_t macreg; + int err, rid; + int i; + + sc = device_get_softc(dev); + sc->dev = dev; + + /* Setup PCI resources. */ + pci_enable_busmaster(dev); + + rid = PCIR_BAR(PTNETMAP_IO_PCI_BAR); + sc->iomem = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, + RF_ACTIVE); + if (sc->iomem == NULL) { + device_printf(dev, "Failed to map I/O BAR\n"); + return (ENXIO); + } + + /* Check if we are supported by the hypervisor. If not, + * bail out immediately. */ + if (ptnet_vnet_hdr) { + ptfeatures |= PTNETMAP_F_VNET_HDR; + } + bus_write_4(sc->iomem, PTNET_IO_PTFEAT, ptfeatures); /* wanted */ + ptfeatures = bus_read_4(sc->iomem, PTNET_IO_PTFEAT); /* acked */ + if (!(ptfeatures & PTNETMAP_F_BASE)) { + device_printf(dev, "Hypervisor does not support netmap " + "passthorugh\n"); + err = ENXIO; + goto err_path; + } + sc->ptfeatures = ptfeatures; + + /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first, + * then CSBBAL). */ + sc->csb = malloc(sizeof(struct ptnet_csb), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (sc->csb == NULL) { + device_printf(dev, "Failed to allocate CSB\n"); + err = ENOMEM; + goto err_path; + } + + { + vm_paddr_t paddr = vtophys(sc->csb); + + bus_write_4(sc->iomem, PTNET_IO_CSBBAH, + (paddr >> 32) & 0xffffffff); + bus_write_4(sc->iomem, PTNET_IO_CSBBAL, paddr & 0xffffffff); + } + + num_tx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS); + num_rx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_RINGS); + sc->num_rings = num_tx_rings + num_rx_rings; + sc->num_tx_rings = num_tx_rings; + + /* Allocate and initialize per-queue data structures. */ + sc->queues = malloc(sizeof(struct ptnet_queue) * sc->num_rings, + M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc->queues == NULL) { + err = ENOMEM; + goto err_path; + } + sc->rxqueues = sc->queues + num_tx_rings; + + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + + pq->sc = sc; + pq->kring_id = i; + pq->kick = PTNET_IO_KICK_BASE + 4 * i; + pq->ptring = sc->csb->rings + i; + snprintf(pq->lock_name, sizeof(pq->lock_name), "%s-%d", + device_get_nameunit(dev), i); + mtx_init(&pq->lock, pq->lock_name, NULL, MTX_DEF); + if (i >= num_tx_rings) { + /* RX queue: fix kring_id. */ + pq->kring_id -= num_tx_rings; + } else { + /* TX queue: allocate buf_ring. */ + pq->bufring = buf_ring_alloc(PTNET_BUF_RING_SIZE, + M_DEVBUF, M_NOWAIT, &pq->lock); + if (pq->bufring == NULL) { + err = ENOMEM; + goto err_path; + } + } + } + + sc->min_tx_space = 64; /* Safe initial value. */ + + err = ptnet_irqs_init(sc); + if (err) { + goto err_path; + } + + /* Setup Ethernet interface. */ + sc->ifp = ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "Failed to allocate ifnet\n"); + err = ENOMEM; + goto err_path; + } + + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_baudrate = IF_Gbps(10); + ifp->if_softc = sc; + ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX; + ifp->if_init = ptnet_init; + ifp->if_ioctl = ptnet_ioctl; +#if __FreeBSD_version >= 1100000 + ifp->if_get_counter = ptnet_get_counter; +#endif + ifp->if_transmit = ptnet_transmit; + ifp->if_qflush = ptnet_qflush; + + ifmedia_init(&sc->media, IFM_IMASK, ptnet_media_change, + ptnet_media_status); + ifmedia_add(&sc->media, IFM_ETHER | IFM_10G_T | IFM_FDX, 0, NULL); + ifmedia_set(&sc->media, IFM_ETHER | IFM_10G_T | IFM_FDX); + + macreg = bus_read_4(sc->iomem, PTNET_IO_MAC_HI); + sc->hwaddr[0] = (macreg >> 8) & 0xff; + sc->hwaddr[1] = macreg & 0xff; + macreg = bus_read_4(sc->iomem, PTNET_IO_MAC_LO); + sc->hwaddr[2] = (macreg >> 24) & 0xff; + sc->hwaddr[3] = (macreg >> 16) & 0xff; + sc->hwaddr[4] = (macreg >> 8) & 0xff; + sc->hwaddr[5] = macreg & 0xff; + + ether_ifattach(ifp, sc->hwaddr); + + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU; + + if (sc->ptfeatures & PTNETMAP_F_VNET_HDR) { + /* Similarly to what the vtnet driver does, we can emulate + * VLAN offloadings by inserting and removing the 802.1Q + * header during transmit and receive. We are then able + * to do checksum offloading of VLAN frames. */ + ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 + | IFCAP_VLAN_HWCSUM + | IFCAP_TSO | IFCAP_LRO + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_HWTAGGING; + } + + ifp->if_capenable = ifp->if_capabilities; +#ifdef DEVICE_POLLING + /* Don't enable polling by default. */ + ifp->if_capabilities |= IFCAP_POLLING; +#endif + snprintf(sc->lock_name, sizeof(sc->lock_name), + "%s", device_get_nameunit(dev)); + mtx_init(&sc->lock, sc->lock_name, "ptnet core lock", MTX_DEF); + callout_init_mtx(&sc->tick, &sc->lock, 0); + + /* Prepare a netmap_adapter struct instance to do netmap_attach(). */ + nifp_offset = bus_read_4(sc->iomem, PTNET_IO_NIFP_OFS); + memset(&na_arg, 0, sizeof(na_arg)); + na_arg.ifp = ifp; + na_arg.num_tx_desc = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_SLOTS); + na_arg.num_rx_desc = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_SLOTS); + na_arg.num_tx_rings = num_tx_rings; + na_arg.num_rx_rings = num_rx_rings; + na_arg.nm_config = ptnet_nm_config; + na_arg.nm_krings_create = ptnet_nm_krings_create; + na_arg.nm_krings_delete = ptnet_nm_krings_delete; + na_arg.nm_dtor = ptnet_nm_dtor; + na_arg.nm_register = ptnet_nm_register; + na_arg.nm_txsync = ptnet_nm_txsync; + na_arg.nm_rxsync = ptnet_nm_rxsync; + + netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, ptnet_nm_ptctl); + + /* Now a netmap adapter for this ifp has been allocated, and it + * can be accessed through NA(ifp). We also have to initialize the CSB + * pointer. */ + sc->ptna = (struct netmap_pt_guest_adapter *)NA(ifp); + + /* If virtio-net header was negotiated, set the virt_hdr_len field in + * the netmap adapter, to inform users that this netmap adapter requires + * the application to deal with the headers. */ + ptnet_update_vnet_hdr(sc); + + device_printf(dev, "%s() completed\n", __func__); + + return (0); + +err_path: + ptnet_detach(dev); + return err; +} + +static int +ptnet_detach(device_t dev) +{ + struct ptnet_softc *sc = device_get_softc(dev); + int i; + +#ifdef DEVICE_POLLING + if (sc->ifp->if_capenable & IFCAP_POLLING) { + ether_poll_deregister(sc->ifp); + } +#endif + callout_drain(&sc->tick); + + if (sc->queues) { + /* Drain taskqueues before calling if_detach. */ + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + + if (pq->taskq) { + taskqueue_drain(pq->taskq, &pq->task); + } + } + } + + if (sc->ifp) { + ether_ifdetach(sc->ifp); + + /* Uninitialize netmap adapters for this device. */ + netmap_detach(sc->ifp); + + ifmedia_removeall(&sc->media); + if_free(sc->ifp); + sc->ifp = NULL; + } + + ptnet_irqs_fini(sc); + + if (sc->csb) { + bus_write_4(sc->iomem, PTNET_IO_CSBBAH, 0); + bus_write_4(sc->iomem, PTNET_IO_CSBBAL, 0); + free(sc->csb, M_DEVBUF); + sc->csb = NULL; + } + + if (sc->queues) { + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + + if (mtx_initialized(&pq->lock)) { + mtx_destroy(&pq->lock); + } + if (pq->bufring != NULL) { + buf_ring_free(pq->bufring, M_DEVBUF); + } + } + free(sc->queues, M_DEVBUF); + sc->queues = NULL; + } + + if (sc->iomem) { + bus_release_resource(dev, SYS_RES_IOPORT, + PCIR_BAR(PTNETMAP_IO_PCI_BAR), sc->iomem); + sc->iomem = NULL; + } + + mtx_destroy(&sc->lock); + + device_printf(dev, "%s() completed\n", __func__); + + return (0); +} + +static int +ptnet_suspend(device_t dev) +{ + struct ptnet_softc *sc; + + sc = device_get_softc(dev); + (void)sc; + + return (0); +} + +static int +ptnet_resume(device_t dev) +{ + struct ptnet_softc *sc; + + sc = device_get_softc(dev); + (void)sc; + + return (0); +} + +static int +ptnet_shutdown(device_t dev) +{ + /* + * Suspend already does all of what we need to + * do here; we just never expect to be resumed. + */ + return (ptnet_suspend(dev)); +} + +static int +ptnet_irqs_init(struct ptnet_softc *sc) +{ + int rid = PCIR_BAR(PTNETMAP_MSIX_PCI_BAR); + int nvecs = sc->num_rings; + device_t dev = sc->dev; + int err = ENOSPC; + int cpu_cur; + int i; + + if (pci_find_cap(dev, PCIY_MSIX, NULL) != 0) { + device_printf(dev, "Could not find MSI-X capability\n"); + return (ENXIO); + } + + sc->msix_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (sc->msix_mem == NULL) { + device_printf(dev, "Failed to allocate MSIX PCI BAR\n"); + return (ENXIO); + } + + if (pci_msix_count(dev) < nvecs) { + device_printf(dev, "Not enough MSI-X vectors\n"); + goto err_path; + } + + err = pci_alloc_msix(dev, &nvecs); + if (err) { + device_printf(dev, "Failed to allocate MSI-X vectors\n"); + goto err_path; + } + + for (i = 0; i < nvecs; i++) { + struct ptnet_queue *pq = sc->queues + i; + + rid = i + 1; + pq->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (pq->irq == NULL) { + device_printf(dev, "Failed to allocate interrupt " + "for queue #%d\n", i); + err = ENOSPC; + goto err_path; + } + } + + cpu_cur = CPU_FIRST(); + for (i = 0; i < nvecs; i++) { + struct ptnet_queue *pq = sc->queues + i; + void (*handler)(void *) = ptnet_tx_intr; + + if (i >= sc->num_tx_rings) { + handler = ptnet_rx_intr; + } + err = bus_setup_intr(dev, pq->irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL /* intr_filter */, handler, + pq, &pq->cookie); + if (err) { + device_printf(dev, "Failed to register intr handler " + "for queue #%d\n", i); + goto err_path; + } + + bus_describe_intr(dev, pq->irq, pq->cookie, "q%d", i); +#if 0 + bus_bind_intr(sc->dev, pq->irq, cpu_cur); +#endif + cpu_cur = CPU_NEXT(cpu_cur); + } + + device_printf(dev, "Allocated %d MSI-X vectors\n", nvecs); + + cpu_cur = CPU_FIRST(); + for (i = 0; i < nvecs; i++) { + struct ptnet_queue *pq = sc->queues + i; + static void (*handler)(void *context, int pending); + + handler = (i < sc->num_tx_rings) ? ptnet_tx_task : ptnet_rx_task; + + TASK_INIT(&pq->task, 0, handler, pq); + pq->taskq = taskqueue_create_fast("ptnet_queue", M_NOWAIT, + taskqueue_thread_enqueue, &pq->taskq); + taskqueue_start_threads(&pq->taskq, 1, PI_NET, "%s-pq-%d", + device_get_nameunit(sc->dev), cpu_cur); + cpu_cur = CPU_NEXT(cpu_cur); + } + + return 0; +err_path: + ptnet_irqs_fini(sc); + return err; +} + +static void +ptnet_irqs_fini(struct ptnet_softc *sc) +{ + device_t dev = sc->dev; + int i; + + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + + if (pq->taskq) { + taskqueue_free(pq->taskq); + pq->taskq = NULL; + } + + if (pq->cookie) { + bus_teardown_intr(dev, pq->irq, pq->cookie); + pq->cookie = NULL; + } + + if (pq->irq) { + bus_release_resource(dev, SYS_RES_IRQ, i + 1, pq->irq); + pq->irq = NULL; + } + } + + if (sc->msix_mem) { + pci_release_msi(dev); + + bus_release_resource(dev, SYS_RES_MEMORY, + PCIR_BAR(PTNETMAP_MSIX_PCI_BAR), + sc->msix_mem); + sc->msix_mem = NULL; + } +} + +static void +ptnet_init(void *opaque) +{ + struct ptnet_softc *sc = opaque; + + PTNET_CORE_LOCK(sc); + ptnet_init_locked(sc); + PTNET_CORE_UNLOCK(sc); +} + +static int +ptnet_ioctl(if_t ifp, u_long cmd, caddr_t data) +{ + struct ptnet_softc *sc = if_getsoftc(ifp); + device_t dev = sc->dev; + struct ifreq *ifr = (struct ifreq *)data; + int mask, err = 0; + + switch (cmd) { + case SIOCSIFFLAGS: + device_printf(dev, "SIOCSIFFLAGS %x\n", ifp->if_flags); + PTNET_CORE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + /* Network stack wants the iff to be up. */ + err = ptnet_init_locked(sc); + } else { + /* Network stack wants the iff to be down. */ + err = ptnet_stop(sc); + } + /* We don't need to do nothing to support IFF_PROMISC, + * since that is managed by the backend port. */ + PTNET_CORE_UNLOCK(sc); + break; + + case SIOCSIFCAP: + device_printf(dev, "SIOCSIFCAP %x %x\n", + ifr->ifr_reqcap, ifp->if_capenable); + mask = ifr->ifr_reqcap ^ ifp->if_capenable; +#ifdef DEVICE_POLLING + if (mask & IFCAP_POLLING) { + struct ptnet_queue *pq; + int i; + + if (ifr->ifr_reqcap & IFCAP_POLLING) { + err = ether_poll_register(ptnet_poll, ifp); + if (err) { + break; + } + /* Stop queues and sync with taskqueues. */ + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + for (i = 0; i < sc->num_rings; i++) { + pq = sc-> queues + i; + /* Make sure the worker sees the + * IFF_DRV_RUNNING down. */ + PTNET_Q_LOCK(pq); + pq->ptring->guest_need_kick = 0; + PTNET_Q_UNLOCK(pq); + /* Wait for rescheduling to finish. */ + if (pq->taskq) { + taskqueue_drain(pq->taskq, + &pq->task); + } + } + ifp->if_drv_flags |= IFF_DRV_RUNNING; + } else { + err = ether_poll_deregister(ifp); + for (i = 0; i < sc->num_rings; i++) { + pq = sc-> queues + i; + PTNET_Q_LOCK(pq); + pq->ptring->guest_need_kick = 1; + PTNET_Q_UNLOCK(pq); + } + } + } +#endif /* DEVICE_POLLING */ + ifp->if_capenable = ifr->ifr_reqcap; + break; + + case SIOCSIFMTU: + /* We support any reasonable MTU. */ + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > PTNET_MAX_PKT_SIZE) { + err = EINVAL; + } else { + PTNET_CORE_LOCK(sc); + ifp->if_mtu = ifr->ifr_mtu; + PTNET_CORE_UNLOCK(sc); + } + break; + + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + err = ifmedia_ioctl(ifp, ifr, &sc->media, cmd); + break; + + default: + err = ether_ioctl(ifp, cmd, data); + break; + } + + return err; +} + +static int +ptnet_init_locked(struct ptnet_softc *sc) +{ + if_t ifp = sc->ifp; + struct netmap_adapter *na_dr = &sc->ptna->dr.up; + struct netmap_adapter *na_nm = &sc->ptna->hwup.up; + unsigned int nm_buf_size; + int ret; + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + return 0; /* nothing to do */ + } + + device_printf(sc->dev, "%s\n", __func__); + + /* Translate offload capabilities according to if_capenable. */ + ifp->if_hwassist = 0; + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= PTNET_CSUM_OFFLOAD; + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + ifp->if_hwassist |= PTNET_CSUM_OFFLOAD_IPV6; + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + ifp->if_hwassist |= CSUM_IP6_TSO; + + /* + * Prepare the interface for netmap mode access. + */ + netmap_update_config(na_dr); + + ret = netmap_mem_finalize(na_dr->nm_mem, na_dr); + if (ret) { + device_printf(sc->dev, "netmap_mem_finalize() failed\n"); + return ret; + } + + if (sc->ptna->backend_regifs == 0) { + ret = ptnet_nm_krings_create(na_nm); + if (ret) { + device_printf(sc->dev, "ptnet_nm_krings_create() " + "failed\n"); + goto err_mem_finalize; + } + + ret = netmap_mem_rings_create(na_dr); + if (ret) { + device_printf(sc->dev, "netmap_mem_rings_create() " + "failed\n"); + goto err_rings_create; + } + + ret = netmap_mem_get_lut(na_dr->nm_mem, &na_dr->na_lut); + if (ret) { + device_printf(sc->dev, "netmap_mem_get_lut() " + "failed\n"); + goto err_get_lut; + } + } + + ret = ptnet_nm_register(na_dr, 1 /* on */); + if (ret) { + goto err_register; + } + + nm_buf_size = NETMAP_BUF_SIZE(na_dr); + + KASSERT(nm_buf_size > 0, ("Invalid netmap buffer size")); + sc->min_tx_space = PTNET_MAX_PKT_SIZE / nm_buf_size + 2; + device_printf(sc->dev, "%s: min_tx_space = %u\n", __func__, + sc->min_tx_space); +#ifdef PTNETMAP_STATS + callout_reset(&sc->tick, hz, ptnet_tick, sc); +#endif + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + + return 0; + +err_register: + memset(&na_dr->na_lut, 0, sizeof(na_dr->na_lut)); +err_get_lut: + netmap_mem_rings_delete(na_dr); +err_rings_create: + ptnet_nm_krings_delete(na_nm); +err_mem_finalize: + netmap_mem_deref(na_dr->nm_mem, na_dr); + + return ret; +} + +/* To be called under core lock. */ +static int +ptnet_stop(struct ptnet_softc *sc) +{ + if_t ifp = sc->ifp; + struct netmap_adapter *na_dr = &sc->ptna->dr.up; + struct netmap_adapter *na_nm = &sc->ptna->hwup.up; + int i; + + device_printf(sc->dev, "%s\n", __func__); + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + return 0; /* nothing to do */ + } + + /* Clear the driver-ready flag, and synchronize with all the queues, + * so that after this loop we are sure nobody is working anymore with + * the device. This scheme is taken from the vtnet driver. */ + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + callout_stop(&sc->tick); + for (i = 0; i < sc->num_rings; i++) { + PTNET_Q_LOCK(sc->queues + i); + PTNET_Q_UNLOCK(sc->queues + i); + } + + ptnet_nm_register(na_dr, 0 /* off */); + + if (sc->ptna->backend_regifs == 0) { + netmap_mem_rings_delete(na_dr); + ptnet_nm_krings_delete(na_nm); + } + netmap_mem_deref(na_dr->nm_mem, na_dr); + + return 0; +} + +static void +ptnet_qflush(if_t ifp) +{ + struct ptnet_softc *sc = if_getsoftc(ifp); + int i; + + /* Flush all the bufrings and do the interface flush. */ + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + struct mbuf *m; + + PTNET_Q_LOCK(pq); + if (pq->bufring) { + while ((m = buf_ring_dequeue_sc(pq->bufring))) { + m_freem(m); + } + } + PTNET_Q_UNLOCK(pq); + } + + if_qflush(ifp); +} + +static int +ptnet_media_change(if_t ifp) +{ + struct ptnet_softc *sc = if_getsoftc(ifp); + struct ifmedia *ifm = &sc->media; + + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) { + return EINVAL; + } + + return 0; +} + +#if __FreeBSD_version >= 1100000 +static uint64_t +ptnet_get_counter(if_t ifp, ift_counter cnt) +{ + struct ptnet_softc *sc = if_getsoftc(ifp); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Oct 16 18:27:42 2016 Return-Path: Delivered-To: svn-src-all@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 6ADF0C14E01; Sun, 16 Oct 2016 18:27:42 +0000 (UTC) (envelope-from luigi@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 47BF0173F; Sun, 16 Oct 2016 18:27:42 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GIRfOY008591; Sun, 16 Oct 2016 18:27:41 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GIRfXG008590; Sun, 16 Oct 2016 18:27:41 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610161827.u9GIRfXG008590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Sun, 16 Oct 2016 18:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307396 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 18:27:42 -0000 Author: luigi Date: Sun Oct 16 18:27:41 2016 New Revision: 307396 URL: https://svnweb.freebsd.org/changeset/base/307396 Log: add a missing header. Added: head/sys/net/netmap_virt.h (contents, props changed) Added: head/sys/net/netmap_virt.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/netmap_virt.h Sun Oct 16 18:27:41 2016 (r307396) @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2013-2016 Luigi Rizzo + * Copyright (C) 2013-2016 Giuseppe Lettieri + * Copyright (C) 2013-2016 Vincenzo Maffione + * Copyright (C) 2015 Stefano Garzarella + * 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 NETMAP_VIRT_H +#define NETMAP_VIRT_H + +#define NETMAP_VIRT_CSB_SIZE 4096 + +/* ptnetmap features */ +#define PTNETMAP_F_BASE 1 +#define PTNETMAP_F_FULL 2 /* not used */ +#define PTNETMAP_F_VNET_HDR 4 + +/* + * ptnetmap_memdev: device used to expose memory into the guest VM + * + * These macros are used in the hypervisor frontend (QEMU, bhyve) and in the + * guest device driver. + */ + +/* PCI identifiers and PCI BARs for the ptnetmap memdev + * and ptnetmap network interface. */ +#define PTNETMAP_MEMDEV_NAME "ptnetmap-memdev" +#define PTNETMAP_PCI_VENDOR_ID 0x3333 /* TODO change vendor_id */ +#define PTNETMAP_PCI_DEVICE_ID 0x0001 /* memory device */ +#define PTNETMAP_PCI_NETIF_ID 0x0002 /* ptnet network interface */ +#define PTNETMAP_IO_PCI_BAR 0 +#define PTNETMAP_MEM_PCI_BAR 1 +#define PTNETMAP_MSIX_PCI_BAR 2 + +/* Registers for the ptnetmap memdev */ +/* 32 bit r/o */ +#define PTNETMAP_IO_PCI_FEATURES 0 /* XXX should be removed */ +/* 32 bit r/o */ +#define PTNETMAP_IO_PCI_MEMSIZE 4 /* size of the netmap memory shared + * between guest and host */ +/* 16 bit r/o */ +#define PTNETMAP_IO_PCI_HOSTID 8 /* memory allocator ID in netmap host */ +#define PTNETMAP_IO_SIZE 10 + +/* + * ptnetmap configuration + * + * The hypervisor (QEMU or bhyve) sends this struct to the host netmap + * module through an ioctl() command when it wants to start the ptnetmap + * kthreads. + */ +struct ptnetmap_cfg { +#define PTNETMAP_CFG_FEAT_CSB 0x0001 +#define PTNETMAP_CFG_FEAT_EVENTFD 0x0002 +#define PTNETMAP_CFG_FEAT_IOCTL 0x0004 + uint32_t features; + void *ptrings; /* ptrings inside CSB */ + uint32_t num_rings; /* number of entries */ + struct ptnet_ring_cfg entries[0]; /* per-ptring configuration */ +}; + +/* + * Functions used to write ptnetmap_cfg from/to the nmreq. + * The user-space application writes the pointer of ptnetmap_cfg + * (user-space buffer) starting from nr_arg1 field, so that the kernel + * can read it with copyin (copy_from_user). + */ +static inline void +ptnetmap_write_cfg(struct nmreq *nmr, struct ptnetmap_cfg *cfg) +{ + uintptr_t *nmr_ptncfg = (uintptr_t *)&nmr->nr_arg1; + *nmr_ptncfg = (uintptr_t)cfg; +} + +/* ptnetmap control commands */ +#define PTNETMAP_PTCTL_CONFIG 1 +#define PTNETMAP_PTCTL_FINALIZE 2 +#define PTNETMAP_PTCTL_IFNEW 3 +#define PTNETMAP_PTCTL_IFDELETE 4 +#define PTNETMAP_PTCTL_RINGSCREATE 5 +#define PTNETMAP_PTCTL_RINGSDELETE 6 +#define PTNETMAP_PTCTL_DEREF 7 +#define PTNETMAP_PTCTL_TXSYNC 8 +#define PTNETMAP_PTCTL_RXSYNC 9 +#define PTNETMAP_PTCTL_REGIF 10 +#define PTNETMAP_PTCTL_UNREGIF 11 +#define PTNETMAP_PTCTL_HOSTMEMID 12 + + +/* I/O registers for the ptnet device. */ +#define PTNET_IO_PTFEAT 0 +#define PTNET_IO_PTCTL 4 +#define PTNET_IO_PTSTS 8 +/* hole */ +#define PTNET_IO_MAC_LO 16 +#define PTNET_IO_MAC_HI 20 +#define PTNET_IO_CSBBAH 24 +#define PTNET_IO_CSBBAL 28 +#define PTNET_IO_NIFP_OFS 32 +#define PTNET_IO_NUM_TX_RINGS 36 +#define PTNET_IO_NUM_RX_RINGS 40 +#define PTNET_IO_NUM_TX_SLOTS 44 +#define PTNET_IO_NUM_RX_SLOTS 48 +#define PTNET_IO_VNET_HDR_LEN 52 +#define PTNET_IO_END 56 +#define PTNET_IO_KICK_BASE 128 +#define PTNET_IO_MASK 0xff + +/* If defined, CSB is allocated by the guest, not by the host. */ +#define PTNET_CSB_ALLOC + +/* ptnetmap ring fields shared between guest and host */ +struct ptnet_ring { + /* XXX revise the layout to minimize cache bounces. */ + uint32_t head; /* GW+ HR+ the head of the guest netmap_ring */ + uint32_t cur; /* GW+ HR+ the cur of the guest netmap_ring */ + uint32_t guest_need_kick; /* GW+ HR+ host-->guest notification enable */ + char pad[4]; + uint32_t hwcur; /* GR+ HW+ the hwcur of the host netmap_kring */ + uint32_t hwtail; /* GR+ HW+ the hwtail of the host netmap_kring */ + uint32_t host_need_kick; /* GR+ HW+ guest-->host notification enable */ + uint32_t sync_flags; /* GW+ HR+ the flags of the guest [tx|rx]sync() */ +}; + +/* CSB for the ptnet device. */ +struct ptnet_csb { + struct ptnet_ring rings[NETMAP_VIRT_CSB_SIZE/sizeof(struct ptnet_ring)]; +}; + +#if defined (WITH_PTNETMAP_HOST) || defined (WITH_PTNETMAP_GUEST) + +/* return l_elem - r_elem with wraparound */ +static inline uint32_t +ptn_sub(uint32_t l_elem, uint32_t r_elem, uint32_t num_slots) +{ + int64_t res; + + res = (int64_t)(l_elem) - r_elem; + + return (res < 0) ? res + num_slots : res; +} +#endif /* WITH_PTNETMAP_HOST || WITH_PTNETMAP_GUEST */ + +#ifdef WITH_PTNETMAP_HOST +/* + * ptnetmap kernel thread routines + * */ + +/* Functions to read and write CSB fields in the host */ +#if defined (linux) +#define CSB_READ(csb, field, r) (get_user(r, &csb->field)) +#define CSB_WRITE(csb, field, v) (put_user(v, &csb->field)) +#else /* ! linux */ +#define CSB_READ(csb, field, r) (r = fuword32(&csb->field)) +#define CSB_WRITE(csb, field, v) (suword32(&csb->field, v)) +#endif /* ! linux */ + +/* + * HOST read/write kring pointers from/in CSB + */ + +/* Host: Read kring pointers (head, cur, sync_flags) from CSB */ +static inline void +ptnetmap_host_read_kring_csb(struct ptnet_ring __user *ptr, + struct netmap_ring *g_ring, + uint32_t num_slots) +{ + uint32_t old_head = g_ring->head, old_cur = g_ring->cur; + uint32_t d, inc_h, inc_c; + + //mb(); /* Force memory complete before read CSB */ + + /* + * We must first read head and then cur with a barrier in the + * middle, because cur can exceed head, but not vice versa. + * The guest must first write cur and then head with a barrier. + * + * head <= cur + * + * guest host + * + * STORE(cur) LOAD(head) + * mb() ----------- mb() + * STORE(head) LOAD(cur) + * + * This approach ensures that every head that we read is + * associated with the correct cur. In this way head can not exceed cur. + */ + CSB_READ(ptr, head, g_ring->head); + mb(); + CSB_READ(ptr, cur, g_ring->cur); + CSB_READ(ptr, sync_flags, g_ring->flags); + + /* + * Even with the previous barrier, it is still possible that we read an + * updated cur and an old head. + * To detect this situation, we can check if the new cur overtakes + * the (apparently) new head. + */ + d = ptn_sub(old_cur, old_head, num_slots); /* previous distance */ + inc_c = ptn_sub(g_ring->cur, old_cur, num_slots); /* increase of cur */ + inc_h = ptn_sub(g_ring->head, old_head, num_slots); /* increase of head */ + + if (unlikely(inc_c > num_slots - d + inc_h)) { /* cur overtakes head */ + ND(1,"ERROR cur overtakes head - old_cur: %u cur: %u old_head: %u head: %u", + old_cur, g_ring->cur, old_head, g_ring->head); + g_ring->cur = nm_prev(g_ring->head, num_slots - 1); + //*g_cur = *g_head; + } +} + +/* Host: Write kring pointers (hwcur, hwtail) into the CSB */ +static inline void +ptnetmap_host_write_kring_csb(struct ptnet_ring __user *ptr, uint32_t hwcur, + uint32_t hwtail) +{ + /* We must write hwtail before hwcur (see below). */ + CSB_WRITE(ptr, hwtail, hwtail); + mb(); + CSB_WRITE(ptr, hwcur, hwcur); + + //mb(); /* Force memory complete before send notification */ +} + +#endif /* WITH_PTNETMAP_HOST */ + +#ifdef WITH_PTNETMAP_GUEST +/* + * GUEST read/write kring pointers from/in CSB. + * To use into device driver. + */ + +/* Guest: Write kring pointers (cur, head) into the CSB */ +static inline void +ptnetmap_guest_write_kring_csb(struct ptnet_ring *ptr, uint32_t cur, + uint32_t head) +{ + /* We must write cur before head for sync reason (see above) */ + ptr->cur = cur; + mb(); + ptr->head = head; + + //mb(); /* Force memory complete before send notification */ +} + +/* Guest: Read kring pointers (hwcur, hwtail) from CSB */ +static inline void +ptnetmap_guest_read_kring_csb(struct ptnet_ring *ptr, struct netmap_kring *kring) +{ + uint32_t old_hwcur = kring->nr_hwcur, old_hwtail = kring->nr_hwtail; + uint32_t num_slots = kring->nkr_num_slots; + uint32_t d, inc_hc, inc_ht; + + //mb(); /* Force memory complete before read CSB */ + + /* + * We must first read hwcur and then hwtail with a barrier in the + * middle, because hwtail can exceed hwcur, but not vice versa. + * The host must first write hwtail and then hwcur with a barrier. + * + * hwcur <= hwtail + * + * host guest + * + * STORE(hwtail) LOAD(hwcur) + * mb() --------- mb() + * STORE(hwcur) LOAD(hwtail) + * + * This approach ensures that every hwcur that the guest reads is + * associated with the correct hwtail. In this way hwcur can not exceed + * hwtail. + */ + kring->nr_hwcur = ptr->hwcur; + mb(); + kring->nr_hwtail = ptr->hwtail; + + /* + * Even with the previous barrier, it is still possible that we read an + * updated hwtail and an old hwcur. + * To detect this situation, we can check if the new hwtail overtakes + * the (apparently) new hwcur. + */ + d = ptn_sub(old_hwtail, old_hwcur, num_slots); /* previous distance */ + inc_ht = ptn_sub(kring->nr_hwtail, old_hwtail, num_slots); /* increase of hwtail */ + inc_hc = ptn_sub(kring->nr_hwcur, old_hwcur, num_slots); /* increase of hwcur */ + + if (unlikely(inc_ht > num_slots - d + inc_hc)) { + ND(1, "ERROR hwtail overtakes hwcur - old_hwtail: %u hwtail: %u old_hwcur: %u hwcur: %u", + old_hwtail, kring->nr_hwtail, old_hwcur, kring->nr_hwcur); + kring->nr_hwtail = nm_prev(kring->nr_hwcur, num_slots - 1); + //kring->nr_hwtail = kring->nr_hwcur; + } +} + +/* ptnetmap_memdev routines used to talk with ptnetmap_memdev device driver */ +struct ptnetmap_memdev; +int nm_os_pt_memdev_iomap(struct ptnetmap_memdev *, vm_paddr_t *, void **); +void nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *); +#endif /* WITH_PTNETMAP_GUEST */ + +#endif /* NETMAP_VIRT_H */ From owner-svn-src-all@freebsd.org Sun Oct 16 18:49:16 2016 Return-Path: Delivered-To: svn-src-all@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 D0573C1470C; Sun, 16 Oct 2016 18:49:16 +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 A04CA184B; Sun, 16 Oct 2016 18:49:16 +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 u9GInFto016741; Sun, 16 Oct 2016 18:49:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GInFiY016740; Sun, 16 Oct 2016 18:49:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610161849.u9GInFiY016740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 16 Oct 2016 18:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307397 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 18:49:16 -0000 Author: mav Date: Sun Oct 16 18:49:15 2016 New Revision: 307397 URL: https://svnweb.freebsd.org/changeset/base/307397 Log: Add vfs.zfs.zil_log_limit sysctl. It is at least partially broken now, but that is another question. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 16 18:27:41 2016 (r307396) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 16 18:49:15 2016 (r307397) @@ -924,6 +924,8 @@ uint64_t zil_block_buckets[] = { * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. */ uint64_t zil_slog_limit = 1024 * 1024; +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, + &zil_slog_limit, 0, "Maximal commit size to use SLOG"); #define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \ (((zilog)->zl_cur_used < zil_slog_limit) || \ ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) From owner-svn-src-all@freebsd.org Sun Oct 16 19:12:23 2016 Return-Path: Delivered-To: svn-src-all@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 61C92C14CC4; Sun, 16 Oct 2016 19:12:23 +0000 (UTC) (envelope-from markj@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 2E9951349; Sun, 16 Oct 2016 19:12:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GJCMYh027571; Sun, 16 Oct 2016 19:12:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GJCMug027570; Sun, 16 Oct 2016 19:12:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610161912.u9GJCMug027570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 16 Oct 2016 19:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307398 - head/libexec/ypxfr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 19:12:23 -0000 Author: markj Date: Sun Oct 16 19:12:22 2016 New Revision: 307398 URL: https://svnweb.freebsd.org/changeset/base/307398 Log: Reference the libc symbols ypresp_{allfn,data} instead of local symbols. This fixes a regression introduced in r285926. PR: 213506 MFC after: 3 days Modified: head/libexec/ypxfr/ypxfr_getmap.c Modified: head/libexec/ypxfr/ypxfr_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfr_getmap.c Sun Oct 16 18:49:15 2016 (r307397) +++ head/libexec/ypxfr/ypxfr_getmap.c Sun Oct 16 19:12:22 2016 (r307398) @@ -43,8 +43,8 @@ __FBSDID("$FreeBSD$"); extern bool_t xdr_ypresp_all_seq(XDR *, unsigned long *); -static int (*ypresp_allfn)(); -static void *ypresp_data; +extern int (*ypresp_allfn)(); +extern void *ypresp_data; extern DB *specdbp; extern enum ypstat yp_errno; From owner-svn-src-all@freebsd.org Sun Oct 16 19:46:56 2016 Return-Path: Delivered-To: svn-src-all@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 D38CBC12595; Sun, 16 Oct 2016 19:46:56 +0000 (UTC) (envelope-from markj@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 A1C9210BE; Sun, 16 Oct 2016 19:46:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GJktKw038899; Sun, 16 Oct 2016 19:46:55 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GJkt5j038898; Sun, 16 Oct 2016 19:46:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610161946.u9GJkt5j038898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 16 Oct 2016 19:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307400 - head/cddl/usr.sbin/dtrace/tests/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 19:46:56 -0000 Author: markj Date: Sun Oct 16 19:46:55 2016 New Revision: 307400 URL: https://svnweb.freebsd.org/changeset/base/307400 Log: tst.kpriv.ksh fails because DTrace privilege levels are unimplemented. MFC after: 1 week Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Sun Oct 16 19:19:22 2016 (r307399) +++ head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Sun Oct 16 19:46:55 2016 (r307400) @@ -72,6 +72,7 @@ exclude EXFAIL common/mib/tst.udp.ksh exclude SKIP common/privs/tst.fds.ksh exclude SKIP common/privs/tst.func_access.ksh exclude SKIP common/privs/tst.getf.ksh +exclude SKIP common/privs/tst.kpriv.ksh exclude SKIP common/privs/tst.op_access.ksh exclude SKIP common/privs/tst.procpriv.ksh exclude SKIP common/privs/tst.providers.ksh From owner-svn-src-all@freebsd.org Sun Oct 16 19:48:19 2016 Return-Path: Delivered-To: svn-src-all@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 76897C12608; Sun, 16 Oct 2016 19:48:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-x244.google.com (mail-pa0-x244.google.com [IPv6:2607:f8b0:400e:c03::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46D8D1227; Sun, 16 Oct 2016 19:48:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pa0-x244.google.com with SMTP id hh10so8424401pac.0; Sun, 16 Oct 2016 12:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=I0tuZTVa5R5k/mZFyQBdAZ3rb17COaZzdeeDZFnw+Uc=; b=XlS6lKFctu44/dsQMjTghBUr0/9p5sCfH6BkGRBpff+q/jQrzQ8yrWjzzsQT4mfsET 2LenqHmf4BK2tepxL+ihokv1S2ZUo8OWATFMR/348RYkYfidfMGNUsRvvJ6/jra7ZGW/ dS6+J6rvTN7sF7X400jhtQBlM8LXh9GAUkE5CnVE+KvZOGSQdeBXRJrOcNKr+p1r7BYx d3AZXHJoG6fMxkvUC5MFus+mSTIz85hRjZhnCW9Su+kK9ju9ceooom00bGNUYYqxUIvq h6SRctyXu4SCmT7aQGxgk9oo/aUsoCbpYSwNJftndMA71uYfTJ5lGZFqJ/MDnkOFOZ2i 742w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=I0tuZTVa5R5k/mZFyQBdAZ3rb17COaZzdeeDZFnw+Uc=; b=ZW1G7cXAtlRq//RsvDQV4gooA7yoxzKo+TEFfQSDDI7Wodt0IPaLhhTFyBCf5yi73X LUXwRES0/YRlGTO/kRUdYXVKQ48Oe3jfaas+HRiz6OhVGb0LTQBfwwTC3wlHtub09Xn9 jj1Mi1L7fmdpd9lV4Zv2jT5cksLROCv22mV4n7rK6dtUp9kfMcUDH9mBzJ0QoxHRkq8K ez/BLJuDkFV7x8twTWoYn2NCZ8H6XdW5jEu/kQYLybI1V2Xmsjae1AMlRCwP+IxBKPGi f0ySmEuENLa0dNOY+uODx67pJG/RTopO0OJLkQ9H9LU++vGhTTStmorRobtjEvR5Wfhq Pn7A== X-Gm-Message-State: AA6/9RmVXUg7OeGpQ83SGwWi6UG/8gUHRCb12QsWhkoudsHbUxQt/Y++uJV8M2JCdcYUcQ== X-Received: by 10.66.15.134 with SMTP id x6mr27595157pac.171.1476647298669; Sun, 16 Oct 2016 12:48:18 -0700 (PDT) Received: from [192.168.20.13] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id k67sm42293124pfb.86.2016.10.16.12.48.17 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 16 Oct 2016 12:48:18 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r307397 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs From: Ngie Cooper X-Mailer: iPhone Mail (14A456) In-Reply-To: <201610161849.u9GInFiY016740@repo.freebsd.org> Date: Sun, 16 Oct 2016 12:48:17 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201610161849.u9GInFiY016740@repo.freebsd.org> To: Alexander Motin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 19:48:19 -0000 > On Oct 16, 2016, at 11:49, Alexander Motin wrote: >=20 > Author: mav > Date: Sun Oct 16 18:49:15 2016 > New Revision: 307397 > URL: https://svnweb.freebsd.org/changeset/base/307397 >=20 > Log: > Add vfs.zfs.zil_log_limit sysctl. >=20 > It is at least partially broken now, but that is another question. How is it broken? > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >=20 > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 1= 6 18:27:41 2016 (r307396) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 1= 6 18:49:15 2016 (r307397) > @@ -924,6 +924,8 @@ uint64_t zil_block_buckets[] =3D { > * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. > */ > uint64_t zil_slog_limit =3D 1024 * 1024; > +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, > + &zil_slog_limit, 0, "Maximal commit size to use SLOG"); > #define USE_SLOG(zilog) (((zilog)->zl_logbias =3D=3D ZFS_LOGBIAS_LATENC= Y) && \ > (((zilog)->zl_cur_used < zil_slog_limit) || \ > ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) >=20 From owner-svn-src-all@freebsd.org Sun Oct 16 19:50:11 2016 Return-Path: Delivered-To: svn-src-all@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 C098AC126FE; Sun, 16 Oct 2016 19:50:11 +0000 (UTC) (envelope-from markj@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 8AB3B14EB; Sun, 16 Oct 2016 19:50:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GJoA2c039063; Sun, 16 Oct 2016 19:50:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GJoATJ039062; Sun, 16 Oct 2016 19:50:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610161950.u9GJoATJ039062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 16 Oct 2016 19:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307401 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 19:50:11 -0000 Author: markj Date: Sun Oct 16 19:50:10 2016 New Revision: 307401 URL: https://svnweb.freebsd.org/changeset/base/307401 Log: Fix tst.args1.c on LP64 platforms. The untyped probe arguments have a width larger than int on such platforms, so printing their value without a cast can give unexpected results. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c Sun Oct 16 19:46:55 2016 (r307400) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c Sun Oct 16 19:50:10 2016 (r307401) @@ -31,8 +31,8 @@ #include int -go(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, - int arg7, int arg8, int arg9) +go(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6, + long arg7, long arg8, long arg9) { return (arg1); } From owner-svn-src-all@freebsd.org Sun Oct 16 19:52:01 2016 Return-Path: Delivered-To: svn-src-all@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 CEBBFC128CF for ; Sun, 16 Oct 2016 19:52:01 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 421C81895 for ; Sun, 16 Oct 2016 19:52:01 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-lf0-x230.google.com with SMTP id l131so206405350lfl.2 for ; Sun, 16 Oct 2016 12:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=g8LsBiLoe3hsq/ImqTtX6wdZ7P8PwaXKA2c1VuBw+1s=; b=BqlYTeqtZFOZYnQS0fxq2hgR99Bt4hsJ06PPcK44Wbd3RZ3YtqnIRwB65IzfVX3qR4 5oGAaK/X4W/bUeY9rbMm8d8sBIAt/5LnQHPg2fHNjSg1a9jTgpF9jOWlbMHoGilAYBi8 ZyGRBGADpmqolnk9sgPKS6ORgRJ0P4tmIXpdQWk/ki9qCLLHz3UXNPAqwzNxEy8BFzqc 5fqkBfKdD2WPWkj4zY1pJjId+DuwO92krFiI9U8Fi/PMDvGjIyvJR5AMI2zBhBgwrTMA VHTwPQbxtDCrSB6DOADcs8FiSIIMh6tD7dBp3XnFXFTCJh94lkOhIwxi+/pJSmUlHUod KbOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=g8LsBiLoe3hsq/ImqTtX6wdZ7P8PwaXKA2c1VuBw+1s=; b=HSdzpbhS7Jt+wxRk2CrKCCjOHHrdAV8MuY/WMpKNCZliJzA3TCdnS7rKAZz6D8xDih Dm6TtiB6bKp/MyShOaJps2Pel/b3O4mcPhbS46F8t4F4PFyEyo14aezP6IjKxuJdobx5 X1Q4LPXAuuAOJK8gLubv+7AT1N7egByq2+wp8kDoFip5gMZdywr2866JaKybKPQyZATb NsVG8+MrKuODR05pB5BV4Y7CdTyLIYPnEk+t3OXO0Ba+GnpJh1O7eBWNDaWsHrraDGQO /6K2CmAm5C8+cI0eZlPjvMi8S+mWT5fY8CZ4DKFOjky6Q5npckZ2UEjYbyYq5JFvlsou 5Cag== X-Gm-Message-State: AA6/9RmSeVzHe4jjBJ0lXUPL6bX/hvEcmdEAviLww5Rhm8PKBv8GjBx3G4LB3uQsBUkm3ZfnapW8maAHIAGWFcbX X-Received: by 10.28.149.209 with SMTP id x200mr6593177wmd.123.1476647519377; Sun, 16 Oct 2016 12:51:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.146.35 with HTTP; Sun, 16 Oct 2016 12:51:59 -0700 (PDT) In-Reply-To: <201610161827.u9GIRfXG008590@repo.freebsd.org> References: <201610161827.u9GIRfXG008590@repo.freebsd.org> From: Oliver Pinter Date: Sun, 16 Oct 2016 21:51:59 +0200 Message-ID: Subject: Re: svn commit: r307396 - head/sys/net To: Luigi Rizzo Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 19:52:01 -0000 On Sun, Oct 16, 2016 at 8:27 PM, Luigi Rizzo wrote: > Author: luigi > Date: Sun Oct 16 18:27:41 2016 > New Revision: 307396 > URL: https://svnweb.freebsd.org/changeset/base/307396 > > Log: > add a missing header. > > Added: > head/sys/net/netmap_virt.h (contents, props changed) > > Added: head/sys/net/netmap_virt.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/net/netmap_virt.h Sun Oct 16 18:27:41 2016 (r307396) > @@ -0,0 +1,325 @@ > +/* > + * Copyright (C) 2013-2016 Luigi Rizzo > + * Copyright (C) 2013-2016 Giuseppe Lettieri > + * Copyright (C) 2013-2016 Vincenzo Maffione > + * Copyright (C) 2015 Stefano Garzarella > + * 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 NETMAP_VIRT_H > +#define NETMAP_VIRT_H > + > +#define NETMAP_VIRT_CSB_SIZE 4096 > + > +/* ptnetmap features */ > +#define PTNETMAP_F_BASE 1 > +#define PTNETMAP_F_FULL 2 /* not used */ > +#define PTNETMAP_F_VNET_HDR 4 > + > +/* > + * ptnetmap_memdev: device used to expose memory into the guest VM > + * > + * These macros are used in the hypervisor frontend (QEMU, bhyve) and in the > + * guest device driver. > + */ > + > +/* PCI identifiers and PCI BARs for the ptnetmap memdev > + * and ptnetmap network interface. */ > +#define PTNETMAP_MEMDEV_NAME "ptnetmap-memdev" > +#define PTNETMAP_PCI_VENDOR_ID 0x3333 /* TODO change vendor_id */ This TODO is still valid? > +#define PTNETMAP_PCI_DEVICE_ID 0x0001 /* memory device */ > +#define PTNETMAP_PCI_NETIF_ID 0x0002 /* ptnet network interface */ > +#define PTNETMAP_IO_PCI_BAR 0 > +#define PTNETMAP_MEM_PCI_BAR 1 > +#define PTNETMAP_MSIX_PCI_BAR 2 > + > +/* Registers for the ptnetmap memdev */ > +/* 32 bit r/o */ > +#define PTNETMAP_IO_PCI_FEATURES 0 /* XXX should be removed */ And this? > +/* 32 bit r/o */ > +#define PTNETMAP_IO_PCI_MEMSIZE 4 /* size of the netmap memory shared > + * between guest and host */ > +/* 16 bit r/o */ > +#define PTNETMAP_IO_PCI_HOSTID 8 /* memory allocator ID in netmap host */ > +#define PTNETMAP_IO_SIZE 10 > + > +/* > + * ptnetmap configuration > + * > + * The hypervisor (QEMU or bhyve) sends this struct to the host netmap > + * module through an ioctl() command when it wants to start the ptnetmap > + * kthreads. > + */ > +struct ptnetmap_cfg { > +#define PTNETMAP_CFG_FEAT_CSB 0x0001 > +#define PTNETMAP_CFG_FEAT_EVENTFD 0x0002 > +#define PTNETMAP_CFG_FEAT_IOCTL 0x0004 > + uint32_t features; > + void *ptrings; /* ptrings inside CSB */ > + uint32_t num_rings; /* number of entries */ > + struct ptnet_ring_cfg entries[0]; /* per-ptring configuration */ > +}; > + > +/* > + * Functions used to write ptnetmap_cfg from/to the nmreq. > + * The user-space application writes the pointer of ptnetmap_cfg > + * (user-space buffer) starting from nr_arg1 field, so that the kernel > + * can read it with copyin (copy_from_user). > + */ > +static inline void > +ptnetmap_write_cfg(struct nmreq *nmr, struct ptnetmap_cfg *cfg) > +{ > + uintptr_t *nmr_ptncfg = (uintptr_t *)&nmr->nr_arg1; > + *nmr_ptncfg = (uintptr_t)cfg; > +} > + > +/* ptnetmap control commands */ > +#define PTNETMAP_PTCTL_CONFIG 1 > +#define PTNETMAP_PTCTL_FINALIZE 2 > +#define PTNETMAP_PTCTL_IFNEW 3 > +#define PTNETMAP_PTCTL_IFDELETE 4 > +#define PTNETMAP_PTCTL_RINGSCREATE 5 > +#define PTNETMAP_PTCTL_RINGSDELETE 6 > +#define PTNETMAP_PTCTL_DEREF 7 > +#define PTNETMAP_PTCTL_TXSYNC 8 > +#define PTNETMAP_PTCTL_RXSYNC 9 > +#define PTNETMAP_PTCTL_REGIF 10 > +#define PTNETMAP_PTCTL_UNREGIF 11 > +#define PTNETMAP_PTCTL_HOSTMEMID 12 > + > + > +/* I/O registers for the ptnet device. */ > +#define PTNET_IO_PTFEAT 0 > +#define PTNET_IO_PTCTL 4 > +#define PTNET_IO_PTSTS 8 > +/* hole */ Hole? > +#define PTNET_IO_MAC_LO 16 > +#define PTNET_IO_MAC_HI 20 > +#define PTNET_IO_CSBBAH 24 > +#define PTNET_IO_CSBBAL 28 > +#define PTNET_IO_NIFP_OFS 32 > +#define PTNET_IO_NUM_TX_RINGS 36 > +#define PTNET_IO_NUM_RX_RINGS 40 > +#define PTNET_IO_NUM_TX_SLOTS 44 > +#define PTNET_IO_NUM_RX_SLOTS 48 > +#define PTNET_IO_VNET_HDR_LEN 52 > +#define PTNET_IO_END 56 > +#define PTNET_IO_KICK_BASE 128 > +#define PTNET_IO_MASK 0xff > + > +/* If defined, CSB is allocated by the guest, not by the host. */ > +#define PTNET_CSB_ALLOC > + > +/* ptnetmap ring fields shared between guest and host */ > +struct ptnet_ring { > + /* XXX revise the layout to minimize cache bounces. */ > + uint32_t head; /* GW+ HR+ the head of the guest netmap_ring */ > + uint32_t cur; /* GW+ HR+ the cur of the guest netmap_ring */ > + uint32_t guest_need_kick; /* GW+ HR+ host-->guest notification enable */ > + char pad[4]; > + uint32_t hwcur; /* GR+ HW+ the hwcur of the host netmap_kring */ > + uint32_t hwtail; /* GR+ HW+ the hwtail of the host netmap_kring */ > + uint32_t host_need_kick; /* GR+ HW+ guest-->host notification enable */ > + uint32_t sync_flags; /* GW+ HR+ the flags of the guest [tx|rx]sync() */ > +}; > + > +/* CSB for the ptnet device. */ > +struct ptnet_csb { > + struct ptnet_ring rings[NETMAP_VIRT_CSB_SIZE/sizeof(struct ptnet_ring)]; > +}; > + > +#if defined (WITH_PTNETMAP_HOST) || defined (WITH_PTNETMAP_GUEST) > + > +/* return l_elem - r_elem with wraparound */ > +static inline uint32_t > +ptn_sub(uint32_t l_elem, uint32_t r_elem, uint32_t num_slots) > +{ > + int64_t res; > + > + res = (int64_t)(l_elem) - r_elem; > + > + return (res < 0) ? res + num_slots : res; > +} > +#endif /* WITH_PTNETMAP_HOST || WITH_PTNETMAP_GUEST */ > + > +#ifdef WITH_PTNETMAP_HOST > +/* > + * ptnetmap kernel thread routines > + * */ > + > +/* Functions to read and write CSB fields in the host */ > +#if defined (linux) > +#define CSB_READ(csb, field, r) (get_user(r, &csb->field)) > +#define CSB_WRITE(csb, field, v) (put_user(v, &csb->field)) > +#else /* ! linux */ > +#define CSB_READ(csb, field, r) (r = fuword32(&csb->field)) > +#define CSB_WRITE(csb, field, v) (suword32(&csb->field, v)) > +#endif /* ! linux */ > + > +/* > + * HOST read/write kring pointers from/in CSB > + */ > + > +/* Host: Read kring pointers (head, cur, sync_flags) from CSB */ > +static inline void > +ptnetmap_host_read_kring_csb(struct ptnet_ring __user *ptr, > + struct netmap_ring *g_ring, > + uint32_t num_slots) > +{ > + uint32_t old_head = g_ring->head, old_cur = g_ring->cur; > + uint32_t d, inc_h, inc_c; > + > + //mb(); /* Force memory complete before read CSB */ And all of these commented out mb() calls? > + > + /* > + * We must first read head and then cur with a barrier in the > + * middle, because cur can exceed head, but not vice versa. > + * The guest must first write cur and then head with a barrier. > + * > + * head <= cur > + * > + * guest host > + * > + * STORE(cur) LOAD(head) > + * mb() ----------- mb() > + * STORE(head) LOAD(cur) > + * > + * This approach ensures that every head that we read is > + * associated with the correct cur. In this way head can not exceed cur. > + */ > + CSB_READ(ptr, head, g_ring->head); > + mb(); > + CSB_READ(ptr, cur, g_ring->cur); > + CSB_READ(ptr, sync_flags, g_ring->flags); > + > + /* > + * Even with the previous barrier, it is still possible that we read an > + * updated cur and an old head. > + * To detect this situation, we can check if the new cur overtakes > + * the (apparently) new head. > + */ > + d = ptn_sub(old_cur, old_head, num_slots); /* previous distance */ > + inc_c = ptn_sub(g_ring->cur, old_cur, num_slots); /* increase of cur */ > + inc_h = ptn_sub(g_ring->head, old_head, num_slots); /* increase of head */ > + > + if (unlikely(inc_c > num_slots - d + inc_h)) { /* cur overtakes head */ > + ND(1,"ERROR cur overtakes head - old_cur: %u cur: %u old_head: %u head: %u", > + old_cur, g_ring->cur, old_head, g_ring->head); > + g_ring->cur = nm_prev(g_ring->head, num_slots - 1); > + //*g_cur = *g_head; Why is this commented out? And why not removed before the upstreaming? > + } > +} > + > +/* Host: Write kring pointers (hwcur, hwtail) into the CSB */ > +static inline void > +ptnetmap_host_write_kring_csb(struct ptnet_ring __user *ptr, uint32_t hwcur, > + uint32_t hwtail) > +{ > + /* We must write hwtail before hwcur (see below). */ > + CSB_WRITE(ptr, hwtail, hwtail); > + mb(); > + CSB_WRITE(ptr, hwcur, hwcur); > + > + //mb(); /* Force memory complete before send notification */ > +} > + > +#endif /* WITH_PTNETMAP_HOST */ > + > +#ifdef WITH_PTNETMAP_GUEST > +/* > + * GUEST read/write kring pointers from/in CSB. > + * To use into device driver. > + */ > + > +/* Guest: Write kring pointers (cur, head) into the CSB */ > +static inline void > +ptnetmap_guest_write_kring_csb(struct ptnet_ring *ptr, uint32_t cur, > + uint32_t head) > +{ > + /* We must write cur before head for sync reason (see above) */ > + ptr->cur = cur; > + mb(); > + ptr->head = head; > + > + //mb(); /* Force memory complete before send notification */ > +} > + > +/* Guest: Read kring pointers (hwcur, hwtail) from CSB */ > +static inline void > +ptnetmap_guest_read_kring_csb(struct ptnet_ring *ptr, struct netmap_kring *kring) > +{ > + uint32_t old_hwcur = kring->nr_hwcur, old_hwtail = kring->nr_hwtail; > + uint32_t num_slots = kring->nkr_num_slots; > + uint32_t d, inc_hc, inc_ht; > + > + //mb(); /* Force memory complete before read CSB */ > + > + /* > + * We must first read hwcur and then hwtail with a barrier in the > + * middle, because hwtail can exceed hwcur, but not vice versa. > + * The host must first write hwtail and then hwcur with a barrier. > + * > + * hwcur <= hwtail > + * > + * host guest > + * > + * STORE(hwtail) LOAD(hwcur) > + * mb() --------- mb() > + * STORE(hwcur) LOAD(hwtail) > + * > + * This approach ensures that every hwcur that the guest reads is > + * associated with the correct hwtail. In this way hwcur can not exceed > + * hwtail. > + */ > + kring->nr_hwcur = ptr->hwcur; > + mb(); > + kring->nr_hwtail = ptr->hwtail; > + > + /* > + * Even with the previous barrier, it is still possible that we read an > + * updated hwtail and an old hwcur. > + * To detect this situation, we can check if the new hwtail overtakes > + * the (apparently) new hwcur. > + */ > + d = ptn_sub(old_hwtail, old_hwcur, num_slots); /* previous distance */ > + inc_ht = ptn_sub(kring->nr_hwtail, old_hwtail, num_slots); /* increase of hwtail */ > + inc_hc = ptn_sub(kring->nr_hwcur, old_hwcur, num_slots); /* increase of hwcur */ > + > + if (unlikely(inc_ht > num_slots - d + inc_hc)) { > + ND(1, "ERROR hwtail overtakes hwcur - old_hwtail: %u hwtail: %u old_hwcur: %u hwcur: %u", > + old_hwtail, kring->nr_hwtail, old_hwcur, kring->nr_hwcur); > + kring->nr_hwtail = nm_prev(kring->nr_hwcur, num_slots - 1); > + //kring->nr_hwtail = kring->nr_hwcur; Uhm, which one is the good? And why exists the other one? > + } > +} > + > +/* ptnetmap_memdev routines used to talk with ptnetmap_memdev device driver */ > +struct ptnetmap_memdev; > +int nm_os_pt_memdev_iomap(struct ptnetmap_memdev *, vm_paddr_t *, void **); > +void nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *); > +#endif /* WITH_PTNETMAP_GUEST */ > + > +#endif /* NETMAP_VIRT_H */ > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Sun Oct 16 19:56:26 2016 Return-Path: Delivered-To: svn-src-all@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 743D7C12A33; Sun, 16 Oct 2016 19:56:26 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com [IPv6:2a00:1450:4010:c07::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E9C991B08; Sun, 16 Oct 2016 19:56:25 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-lf0-x229.google.com with SMTP id x79so254888899lff.0; Sun, 16 Oct 2016 12:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=jkEKD0J3w8l3K5pvhDljO680OUFcHe5cYx6HlXEwQwo=; b=toPEQkulWLRwf4Os4fe6MOhf57kZVmsseMnG7GGxDZ7ujDxu/2ocwchOaBkd9IJHD+ PQuLG7PV3b1nWVlWPPhL2scHpfl98wBn5jzGO5gf0Rtw0StnGTE6eLFXdKQ060Y8Zytd fsVRdbC+ytzkAcLPk35nk0+dOK9YrKtddqLDctVpq8k7JYqUrp8nsu17DJvGk7vOSwTV VF5+HRvUaKO55td+3l+QLicdtq4tlM2j+p7IHzjAv1Y5IK37/x7UZ5KMFH9IPRcLjopD G8oUrSXwxf3w8jOgvYETYp1Gyx6iBMXSkhtB4PDhSCcI2ZRDaQAx1KiiyGzdLFdfBSdl xzgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=jkEKD0J3w8l3K5pvhDljO680OUFcHe5cYx6HlXEwQwo=; b=kbZSR2bdsmlglnqM2rBqkdkkyIqXtB9dvO8pSgbimS83X4WKaWadQUiQRTvKLZPTgo Jw7MoqLsiZVGdtwc4rlMpFT0+gOq93BX22QqZfd0U7hSkXnxxGNtBfE50MsfhLnWK+XM VM/fqShjjJ3p9tbQvIsJ2rGtpgUC2GMOUeAUbXYakVlAI/V5uJL157zniUvvJRY0t6fS ZZiiJAlBPmXjRWvkl+cUCU6lCMPCqd8Qan4L7+4a1CnrB1fL6kkNThLhVyFpuFIrPaTs Ob66czRjQ5NDtuTOXPmrAKvdpfzylC0rhawkTcXqEgwmCT5/dcB3K1eFb23FryxD/hJm bhrg== X-Gm-Message-State: AA6/9Rlpd8xUK8a2xKto+fyB4qvXOF9GMOugJy8i2m6O6qvd8ZZGTDZnQn7op31zsqlgEA== X-Received: by 10.25.200.199 with SMTP id y190mr9084614lff.40.1476647783932; Sun, 16 Oct 2016 12:56:23 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by smtp.gmail.com with ESMTPSA id g7sm6842432ljg.44.2016.10.16.12.56.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Oct 2016 12:56:23 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r307397 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs To: Ngie Cooper References: <201610161849.u9GInFiY016740@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Alexander Motin Message-ID: <747353d9-06da-688c-2c4c-cc8ae5ade605@FreeBSD.org> Date: Sun, 16 Oct 2016 22:56:22 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 19:56:26 -0000 On 16.10.2016 22:48, Ngie Cooper wrote: > >> On Oct 16, 2016, at 11:49, Alexander Motin wrote: >> >> Author: mav >> Date: Sun Oct 16 18:49:15 2016 >> New Revision: 307397 >> URL: https://svnweb.freebsd.org/changeset/base/307397 >> >> Log: >> Add vfs.zfs.zil_log_limit sysctl. >> >> It is at least partially broken now, but that is another question. > > How is it broken? zl_itx_list_sz variable is not updated inside zil_async_to_sync(), that makes USE_SLOG() always return TRUE, ignoring value of zil_slog_limit. I am now trying to decide whether to fix that variable or rip it off. >> Modified: >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c >> ============================================================================== >> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 16 18:27:41 2016 (r307396) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sun Oct 16 18:49:15 2016 (r307397) >> @@ -924,6 +924,8 @@ uint64_t zil_block_buckets[] = { >> * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX. >> */ >> uint64_t zil_slog_limit = 1024 * 1024; >> +SYSCTL_QUAD(_vfs_zfs, OID_AUTO, zil_slog_limit, CTLFLAG_RWTUN, >> + &zil_slog_limit, 0, "Maximal commit size to use SLOG"); >> #define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \ >> (((zilog)->zl_cur_used < zil_slog_limit) || \ >> ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1)))) >> -- Alexander Motin From owner-svn-src-all@freebsd.org Sun Oct 16 20:59:29 2016 Return-Path: Delivered-To: svn-src-all@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 D9843C14AE0; Sun, 16 Oct 2016 20:59:29 +0000 (UTC) (envelope-from dteske@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 A8C5D13D1; Sun, 16 Oct 2016 20:59:29 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GKxS8d065028; Sun, 16 Oct 2016 20:59:28 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GKxSr2065027; Sun, 16 Oct 2016 20:59:28 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201610162059.u9GKxSr2065027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Sun, 16 Oct 2016 20:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307402 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 20:59:29 -0000 Author: dteske Date: Sun Oct 16 20:59:28 2016 New Revision: 307402 URL: https://svnweb.freebsd.org/changeset/base/307402 Log: Guard against bad service name argument(s) to load_rc_config() MFC after: 3 days X-MFC-to: stable/11 stable/10 Modified: head/usr.sbin/bsdconfig/share/sysrc.subr Modified: head/usr.sbin/bsdconfig/share/sysrc.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/sysrc.subr Sun Oct 16 19:50:10 2016 (r307401) +++ head/usr.sbin/bsdconfig/share/sysrc.subr Sun Oct 16 20:59:28 2016 (r307402) @@ -256,7 +256,9 @@ f_sysrc_service_configs() last_name= print_name() { local name="$1" - [ "$name" = "$last_name" ] && return + case "$name" in + ""|.|..|*/*|"$last_name") return ;; + esac echo "$name" >&9 last_name="$name" } From owner-svn-src-all@freebsd.org Sun Oct 16 22:02:59 2016 Return-Path: Delivered-To: svn-src-all@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 5F9FCC141EF; Sun, 16 Oct 2016 22:02:59 +0000 (UTC) (envelope-from sevan@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 1AC39159D; Sun, 16 Oct 2016 22:02:59 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GM2wkE091018; Sun, 16 Oct 2016 22:02:58 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GM2oaf090944; Sun, 16 Oct 2016 22:02:50 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162202.u9GM2oaf090944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307403 - in stable/10: bin/chio bin/freebsd-version bin/pkill bin/setfacl games/morse games/random sbin/adjkerntz sbin/atm/atmconfig sbin/camcontrol sbin/dhclient sbin/ffsinfo sbin/fsi... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:02:59 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:02:50 2016 New Revision: 307403 URL: https://svnweb.freebsd.org/changeset/base/307403 Log: MFC r267667: use .Mt to mark up email addresses consistently (part1) PR: 191174 Submitted by: Franco Fichtner Modified: stable/10/bin/chio/chio.1 stable/10/bin/freebsd-version/freebsd-version.1 stable/10/bin/pkill/pkill.1 stable/10/bin/setfacl/setfacl.1 stable/10/games/morse/morse.6 stable/10/games/random/random.6 stable/10/sbin/adjkerntz/adjkerntz.8 stable/10/sbin/atm/atmconfig/atmconfig.8 stable/10/sbin/camcontrol/camcontrol.8 stable/10/sbin/dhclient/dhclient-script.8 stable/10/sbin/dhclient/dhclient.8 stable/10/sbin/dhclient/dhclient.conf.5 stable/10/sbin/dhclient/dhclient.leases.5 stable/10/sbin/dhclient/dhcp-options.5 stable/10/sbin/ffsinfo/ffsinfo.8 stable/10/sbin/fsirand/fsirand.8 stable/10/sbin/gbde/gbde.8 stable/10/sbin/geom/class/cache/gcache.8 stable/10/sbin/geom/class/concat/gconcat.8 stable/10/sbin/geom/class/eli/geli.8 stable/10/sbin/geom/class/journal/gjournal.8 stable/10/sbin/geom/class/label/glabel.8 stable/10/sbin/geom/class/mirror/gmirror.8 stable/10/sbin/geom/class/mountver/gmountver.8 stable/10/sbin/geom/class/multipath/gmultipath.8 stable/10/sbin/geom/class/nop/gnop.8 stable/10/sbin/geom/class/part/gpart.8 stable/10/sbin/geom/class/raid/graid.8 stable/10/sbin/geom/class/raid3/graid3.8 stable/10/sbin/geom/class/sched/gsched.8 stable/10/sbin/geom/class/shsec/gshsec.8 stable/10/sbin/geom/class/stripe/gstripe.8 stable/10/sbin/geom/class/virstor/gvirstor.8 stable/10/sbin/geom/core/geom.8 stable/10/sbin/ggate/ggatec/ggatec.8 stable/10/sbin/ggate/ggated/ggated.8 stable/10/sbin/ggate/ggatel/ggatel.8 stable/10/sbin/growfs/growfs.8 stable/10/sbin/gvinum/gvinum.8 stable/10/sbin/hastctl/hastctl.8 stable/10/sbin/hastd/hast.conf.5 stable/10/sbin/hastd/hastd.8 stable/10/sbin/ipfw/ipfw.8 stable/10/sbin/kldconfig/kldconfig.8 stable/10/sbin/kldload/kldload.8 stable/10/sbin/kldstat/kldstat.8 stable/10/sbin/kldunload/kldunload.8 stable/10/sbin/md5/md5.1 stable/10/sbin/mdconfig/mdconfig.8 stable/10/sbin/mount/mount.conf.8 stable/10/sbin/mount_cd9660/mount_cd9660.8 stable/10/sbin/mount_msdosfs/mount_msdosfs.8 stable/10/sbin/mount_unionfs/mount_unionfs.8 stable/10/sbin/natd/natd.8 stable/10/sbin/newfs_msdos/newfs_msdos.8 stable/10/sbin/newfs_nandfs/newfs_nandfs.8 stable/10/sbin/nos-tun/nos-tun.8 stable/10/sbin/nvmecontrol/nvmecontrol.8 stable/10/sbin/rcorder/rcorder.8 stable/10/sbin/reboot/nextboot.8 stable/10/sbin/recoverdisk/recoverdisk.1 stable/10/sbin/sconfig/sconfig.8 stable/10/share/examples/mdoc/example.1 stable/10/share/examples/mdoc/example.3 stable/10/share/examples/mdoc/example.4 stable/10/share/examples/mdoc/example.9 stable/10/share/examples/scsi_target/scsi_target.8 stable/10/tools/tools/ether_reflect/ether_reflect.1 stable/10/tools/tools/fixwhite/fixwhite.1 stable/10/tools/tools/mcgrab/mcgrab.1 stable/10/tools/tools/mctest/mctest.1 stable/10/tools/tools/sysdoc/sysdoc.sh stable/10/tools/tools/vimage/vimage.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/chio/chio.1 ============================================================================== --- stable/10/bin/chio/chio.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/bin/chio/chio.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -302,13 +302,11 @@ first appeared in The .Nm program and SCSI changer driver were written by -.An Jason R. Thorpe Aq thorpej@and.com +.An Jason R. Thorpe Aq Mt thorpej@and.com for And Communications, .Pa http://www.and.com/ . .Pp Additional work by -.An Hans Huebner -.Aq hans@artcom.de +.An Hans Huebner Aq Mt hans@artcom.de and -.An Steve Gunn -.Aq csg@waterspout.com . +.An Steve Gunn Aq Mt csg@waterspout.com . Modified: stable/10/bin/freebsd-version/freebsd-version.1 ============================================================================== --- stable/10/bin/freebsd-version/freebsd-version.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/bin/freebsd-version/freebsd-version.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -121,4 +121,4 @@ command appeared in The .Nm utility and this manual page were written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . Modified: stable/10/bin/pkill/pkill.1 ============================================================================== --- stable/10/bin/pkill/pkill.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/bin/pkill/pkill.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -291,5 +291,4 @@ Solaris 7. They made their first appearance in .Fx 5.3 . .Sh AUTHORS -.An Andrew Doran -.Aq ad@NetBSD.org +.An Andrew Doran Aq Mt ad@NetBSD.org Modified: stable/10/bin/setfacl/setfacl.1 ============================================================================== --- stable/10/bin/setfacl/setfacl.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/bin/setfacl/setfacl.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -487,6 +487,6 @@ NFSv4 ACL support was introduced in The .Nm utility was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . +.An Chris D. Faulhaber Aq Mt jedgar@fxp.org . NFSv4 ACL support was implemented by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . Modified: stable/10/games/morse/morse.6 ============================================================================== --- stable/10/games/morse/morse.6 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/games/morse/morse.6 Sun Oct 16 22:02:50 2016 (r307403) @@ -177,7 +177,7 @@ device file Sound support for .Nm added by -.An Lyndon Nerenberg (VE6BBM) Aq lyndon@orthanc.ca . +.An Lyndon Nerenberg (VE6BBM) Aq Mt lyndon@orthanc.ca . .Pp Ability to key an external device added by .An J\(:org Wunsch Modified: stable/10/games/random/random.6 ============================================================================== --- stable/10/games/random/random.6 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/games/random/random.6 Sun Oct 16 22:02:50 2016 (r307403) @@ -117,7 +117,7 @@ instead of newlines. .Sh HISTORY The functionality to randomizing lines and words was added in 2003 by -.An "Sean Chittenden" Aq seanc@FreeBSD.org . +.An Sean Chittenden Aq Mt seanc@FreeBSD.org . .Sh BUGS No index is used when printing out tokens from the list which makes it rather slow for large files (10MB+). Modified: stable/10/sbin/adjkerntz/adjkerntz.8 ============================================================================== --- stable/10/sbin/adjkerntz/adjkerntz.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/adjkerntz/adjkerntz.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -190,4 +190,4 @@ The utility appeared in .Fx 1.0 . .Sh AUTHORS -.An Andrey A. Chernov Aq ache@astral.msk.su +.An Andrey A. Chernov Aq Mt ache@astral.msk.su Modified: stable/10/sbin/atm/atmconfig/atmconfig.8 ============================================================================== --- stable/10/sbin/atm/atmconfig/atmconfig.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/atm/atmconfig/atmconfig.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -316,4 +316,4 @@ List all NATM routes. .Xr natmip 4 , .Xr atm 8 .Sh AUTHORS -.An Hartmut Brandt Aq harti@FreeBSD.org +.An Hartmut Brandt Aq Mt harti@FreeBSD.org Modified: stable/10/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/10/sbin/camcontrol/camcontrol.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/camcontrol/camcontrol.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -2366,7 +2366,7 @@ and first appeared in in .Fx 2.0.5 . .Sh AUTHORS -.An Kenneth Merry Aq ken@FreeBSD.org +.An Kenneth Merry Aq Mt ken@FreeBSD.org .Sh BUGS The code that parses the generic command line arguments does not know that some of the subcommands take multiple arguments. Modified: stable/10/sbin/dhclient/dhclient-script.8 ============================================================================== --- stable/10/sbin/dhclient/dhclient-script.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/dhclient/dhclient-script.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -273,7 +273,7 @@ but current scripts do not do this. The original version of .Nm was written for the Internet Software Consortium by -.An Ted Lemon Aq mellon@fugue.com +.An Ted Lemon Aq Mt mellon@fugue.com in cooperation with Vixie Enterprises. .Pp The @@ -281,7 +281,7 @@ The implementation of .Nm was written by -.An Kenneth R. Westerback Aq krw@openbsd.org . +.An Kenneth R. Westerback Aq Mt krw@openbsd.org . .Sh BUGS If more than one interface is being used, there is no obvious way to avoid clashes between server-supplied configuration parameters - for Modified: stable/10/sbin/dhclient/dhclient.8 ============================================================================== --- stable/10/sbin/dhclient/dhclient.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/dhclient/dhclient.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -188,9 +188,9 @@ The .Nm utility was written by -.An Ted Lemon Aq mellon@fugue.com +.An Ted Lemon Aq Mt mellon@fugue.com and -.An Elliot Poger Aq elliot@poger.com . +.An Elliot Poger Aq Mt elliot@poger.com . .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . Modified: stable/10/sbin/dhclient/dhclient.conf.5 ============================================================================== --- stable/10/sbin/dhclient/dhclient.conf.5 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/dhclient/dhclient.conf.5 Sun Oct 16 22:02:50 2016 (r307403) @@ -537,8 +537,8 @@ The .Xr dhclient 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . Modified: stable/10/sbin/dhclient/dhclient.leases.5 ============================================================================== --- stable/10/sbin/dhclient/dhclient.leases.5 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/dhclient/dhclient.leases.5 Sun Oct 16 22:02:50 2016 (r307403) @@ -88,8 +88,8 @@ The .Xr dhclient 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . Modified: stable/10/sbin/dhclient/dhcp-options.5 ============================================================================== --- stable/10/sbin/dhclient/dhcp-options.5 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/dhclient/dhcp-options.5 Sun Oct 16 22:02:50 2016 (r307403) @@ -603,8 +603,8 @@ The .Xr dhcpd 8 utility was written by -.An Ted Lemon Aq mellon@vix.com +.An Ted Lemon Aq Mt mellon@vix.com under a contract with Vixie Labs. .Pp The current implementation was reworked by -.An Henning Brauer Aq henning@openbsd.org . +.An Henning Brauer Aq Mt henning@openbsd.org . Modified: stable/10/sbin/ffsinfo/ffsinfo.8 ============================================================================== --- stable/10/sbin/ffsinfo/ffsinfo.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/ffsinfo/ffsinfo.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -134,9 +134,9 @@ The utility first appeared in .Fx 4.4 . .Sh AUTHORS -.An Christoph Herrmann Aq chm@FreeBSD.org -.An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org -.An The GROWFS team Aq growfs@Tomsoft.COM +.An Christoph Herrmann Aq Mt chm@FreeBSD.org +.An Thomas-Henning von Kamptz Aq Mt tomsoft@FreeBSD.org +.An The GROWFS team Aq Mt growfs@Tomsoft.COM .Sh BUGS Snapshots are handled like plain files. They should get their own level to provide for independent control of the Modified: stable/10/sbin/fsirand/fsirand.8 ============================================================================== --- stable/10/sbin/fsirand/fsirand.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/fsirand/fsirand.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -107,7 +107,7 @@ A version first appeared in .Fx 2.2.5 . .Sh AUTHORS -.An Todd C. Miller Aq Todd.Miller@courtesan.com +.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com .Sh CAVEATS Since .Nm Modified: stable/10/sbin/gbde/gbde.8 ============================================================================== --- stable/10/sbin/gbde/gbde.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/gbde/gbde.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -243,7 +243,7 @@ To destroy all copies of the masterkey: This software was developed for the .Fx Project by -.An "Poul-Henning Kamp" +.An Poul-Henning Kamp and NAI Labs, the Security Research Division of Network Associates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035 .Pq Dq CBOSS , @@ -253,7 +253,7 @@ DARPA CHATS research program. first appeared in .Fx 5.0 . .Sh AUTHORS -.An "Poul-Henning Kamp" Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .Sh BUGS The cryptographic algorithms and the overall design have not been attacked mercilessly for over 10 years by a gang of cryptoanalysts. Modified: stable/10/sbin/geom/class/cache/gcache.8 ============================================================================== --- stable/10/sbin/geom/class/cache/gcache.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/cache/gcache.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -189,4 +189,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org Modified: stable/10/sbin/geom/class/concat/gconcat.8 ============================================================================== --- stable/10/sbin/geom/class/concat/gconcat.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/concat/gconcat.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -194,4 +194,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/geom/class/eli/geli.8 ============================================================================== --- stable/10/sbin/geom/class/eli/geli.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/eli/geli.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -1057,4 +1057,4 @@ metadata version supported by the given .It Li 10.0 Ta 7 .El .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/geom/class/journal/gjournal.8 ============================================================================== --- stable/10/sbin/geom/class/journal/gjournal.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/journal/gjournal.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -343,4 +343,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/geom/class/label/glabel.8 ============================================================================== --- stable/10/sbin/geom/class/label/glabel.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/label/glabel.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -241,4 +241,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- stable/10/sbin/geom/class/mirror/gmirror.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/mirror/gmirror.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -378,7 +378,7 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .Sh BUGS There should be a way to change a component's priority inside a running mirror. .Pp Modified: stable/10/sbin/geom/class/mountver/gmountver.8 ============================================================================== --- stable/10/sbin/geom/class/mountver/gmountver.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/mountver/gmountver.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -127,4 +127,4 @@ The utility appeared in .Fx 9.0 . .Sh AUTHORS -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org Modified: stable/10/sbin/geom/class/multipath/gmultipath.8 ============================================================================== --- stable/10/sbin/geom/class/multipath/gmultipath.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/multipath/gmultipath.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -360,6 +360,6 @@ GEOM_MULTIPATH: da2 added to FRED .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 -.Sh AUTHOR -.An Matthew Jacob Aq mjacob@FreeBSD.org -.An Alexander Motin Aq mav@FreeBSD.org +.Sh AUTHORS +.An Matthew Jacob Aq Mt mjacob@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org Modified: stable/10/sbin/geom/class/nop/gnop.8 ============================================================================== --- stable/10/sbin/geom/class/nop/gnop.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/nop/gnop.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -183,4 +183,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/10/sbin/geom/class/part/gpart.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/part/gpart.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -1331,4 +1331,4 @@ The utility appeared in .Fx 7.0 . .Sh AUTHORS -.An Marcel Moolenaar Aq marcel@FreeBSD.org +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org Modified: stable/10/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/10/sbin/geom/class/raid/graid.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/raid/graid.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -320,5 +320,5 @@ The utility appeared in .Fx 9.0 . .Sh AUTHORS -.An Alexander Motin Aq mav@FreeBSD.org -.An M. Warner Losh Aq imp@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org +.An M. Warner Losh Aq Mt imp@FreeBSD.org Modified: stable/10/sbin/geom/class/raid3/graid3.8 ============================================================================== --- stable/10/sbin/geom/class/raid3/graid3.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/raid3/graid3.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -248,7 +248,7 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org .Sh BUGS There should be a section with an implementation description. .Pp Modified: stable/10/sbin/geom/class/sched/gsched.8 ============================================================================== --- stable/10/sbin/geom/class/sched/gsched.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/sched/gsched.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -158,5 +158,5 @@ The utility first appeared in .Fx 8.1 . .Sh AUTHORS -.An Fabio Checconi Aq fabio@FreeBSD.org -.An Luigi Rizzo Aq luigi@FreeBSD.org +.An Fabio Checconi Aq Mt fabio@FreeBSD.org +.An Luigi Rizzo Aq Mt luigi@FreeBSD.org Modified: stable/10/sbin/geom/class/shsec/gshsec.8 ============================================================================== --- stable/10/sbin/geom/class/shsec/gshsec.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/shsec/gshsec.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -127,4 +127,4 @@ The utility appeared in .Fx 5.4 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/geom/class/stripe/gstripe.8 ============================================================================== --- stable/10/sbin/geom/class/stripe/gstripe.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/stripe/gstripe.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -240,4 +240,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/geom/class/virstor/gvirstor.8 ============================================================================== --- stable/10/sbin/geom/class/virstor/gvirstor.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/class/virstor/gvirstor.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -293,7 +293,7 @@ and all their structures will be physica of the first virstor component. This could have a significant impact on file system performance .Pq which can in some rare cases be even positive . -.Sh AUTHOR -.An Ivan Voras Aq ivoras@FreeBSD.org +.Sh AUTHORS +.An Ivan Voras Aq Mt ivoras@FreeBSD.org .Pp Sponsored by Google Summer of Code 2006. Modified: stable/10/sbin/geom/core/geom.8 ============================================================================== --- stable/10/sbin/geom/core/geom.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/geom/core/geom.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -203,4 +203,4 @@ The utility appeared in .Fx 5.3 . .Sh AUTHORS -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org Modified: stable/10/sbin/ggate/ggatec/ggatec.8 ============================================================================== --- stable/10/sbin/ggate/ggatec/ggatec.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/ggate/ggatec/ggatec.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -177,4 +177,4 @@ client# mount_cd9660 /dev/ggate0 /cdrom The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . Modified: stable/10/sbin/ggate/ggated/ggated.8 ============================================================================== --- stable/10/sbin/ggate/ggated/ggated.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/ggate/ggated/ggated.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -120,4 +120,4 @@ Export CD-ROM device and a file: The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . Modified: stable/10/sbin/ggate/ggatel/ggatel.8 ============================================================================== --- stable/10/sbin/ggate/ggatel/ggatel.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/ggate/ggatel/ggatel.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -154,4 +154,4 @@ ggatel destroy -u 5 The .Nm utility as well as this manual page was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org . +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org . Modified: stable/10/sbin/growfs/growfs.8 ============================================================================== --- stable/10/sbin/growfs/growfs.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/growfs/growfs.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -120,10 +120,10 @@ utility first appeared in The ability to resize mounted file systems was added in .Fx 10.0 . .Sh AUTHORS -.An Christoph Herrmann Aq chm@FreeBSD.org -.An Thomas-Henning von Kamptz Aq tomsoft@FreeBSD.org -.An The GROWFS team Aq growfs@Tomsoft.COM -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org +.An Christoph Herrmann Aq Mt chm@FreeBSD.org +.An Thomas-Henning von Kamptz Aq Mt tomsoft@FreeBSD.org +.An The GROWFS team Aq Mt growfs@Tomsoft.COM +.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .Sh CAVEATS When expanding a file system mounted read-write, any writes to that file system will be temporarily suspended until the expansion is finished. Modified: stable/10/sbin/gvinum/gvinum.8 ============================================================================== --- stable/10/sbin/gvinum/gvinum.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/gvinum/gvinum.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -395,9 +395,9 @@ and through the 2007 Google Summer of Code program. The documentation have been updated to reflect the new functionality. .Sh AUTHORS -.An Lukas Ertl Aq le@FreeBSD.org -.An Chris Jones Aq soc-cjones@FreeBSD.org -.An Ulf Lilleengen Aq lulf@FreeBSD.org +.An Lukas Ertl Aq Mt le@FreeBSD.org +.An Chris Jones Aq Mt soc-cjones@FreeBSD.org +.An Ulf Lilleengen Aq Mt lulf@FreeBSD.org .Sh BUGS Currently, .Nm Modified: stable/10/sbin/hastctl/hastctl.8 ============================================================================== --- stable/10/sbin/hastctl/hastctl.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/hastctl/hastctl.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -224,5 +224,5 @@ nodeB# application_start The .Nm was developed by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. Modified: stable/10/sbin/hastd/hast.conf.5 ============================================================================== --- stable/10/sbin/hastd/hast.conf.5 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/hastd/hast.conf.5 Sun Oct 16 22:02:50 2016 (r307403) @@ -445,5 +445,5 @@ resource tank { The .Nm was written by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. Modified: stable/10/sbin/hastd/hastd.8 ============================================================================== --- stable/10/sbin/hastd/hastd.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/hastd/hastd.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -228,5 +228,5 @@ nodeA# mount -o noatime /dev/hast/shared The .Nm was developed by -.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org +.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org under sponsorship of the FreeBSD Foundation. Modified: stable/10/sbin/ipfw/ipfw.8 ============================================================================== --- stable/10/sbin/ipfw/ipfw.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/ipfw/ipfw.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -3381,7 +3381,7 @@ options have been added by various devel .Pp .An -nosplit In-kernel NAT support written by -.An Paolo Pisati Aq piso@FreeBSD.org +.An Paolo Pisati Aq Mt piso@FreeBSD.org as part of a Summer of Code 2005 project. .Pp SCTP Modified: stable/10/sbin/kldconfig/kldconfig.8 ============================================================================== --- stable/10/sbin/kldconfig/kldconfig.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/kldconfig/kldconfig.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -105,4 +105,4 @@ The utility first appeared in .Fx 4.4 . .Sh AUTHORS -.An Peter Pentchev Aq roam@FreeBSD.org +.An Peter Pentchev Aq Mt roam@FreeBSD.org Modified: stable/10/sbin/kldload/kldload.8 ============================================================================== --- stable/10/sbin/kldload/kldload.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/kldload/kldload.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -126,4 +126,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org Modified: stable/10/sbin/kldstat/kldstat.8 ============================================================================== --- stable/10/sbin/kldstat/kldstat.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/kldstat/kldstat.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -78,4 +78,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org Modified: stable/10/sbin/kldunload/kldunload.8 ============================================================================== --- stable/10/sbin/kldunload/kldunload.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/kldunload/kldunload.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -78,4 +78,4 @@ replacing the .Nm lkm interface. .Sh AUTHORS -.An Doug Rabson Aq dfr@FreeBSD.org +.An Doug Rabson Aq Mt dfr@FreeBSD.org Modified: stable/10/sbin/md5/md5.1 ============================================================================== --- stable/10/sbin/md5/md5.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/md5/md5.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -154,4 +154,4 @@ This program is placed in the public dom RSA Data Security. .Pp Support for SHA-1 and RIPEMD-160 has been added by -.An Oliver Eikemeier Aq eik@FreeBSD.org . +.An Oliver Eikemeier Aq Mt eik@FreeBSD.org . Modified: stable/10/sbin/mdconfig/mdconfig.8 ============================================================================== --- stable/10/sbin/mdconfig/mdconfig.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/mdconfig/mdconfig.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -321,5 +321,4 @@ combo. The .Nm utility was written by -.An Poul-Henning Kamp -.Aq phk@FreeBSD.org . +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . Modified: stable/10/sbin/mount/mount.conf.8 ============================================================================== --- stable/10/sbin/mount/mount.conf.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/mount/mount.conf.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -247,6 +247,6 @@ The root mount logic in the kernel which parses .Pa /.mount.conf was written by -.An Marcel Moolenaar Aq marcel@FreeBSD.org . +.An Marcel Moolenaar Aq Mt marcel@FreeBSD.org . This man page was written by -.An Craig Rodrigues Aq rodrigc@FreeBSD.org . +.An Craig Rodrigues Aq Mt rodrigc@FreeBSD.org . Modified: stable/10/sbin/mount_cd9660/mount_cd9660.8 ============================================================================== --- stable/10/sbin/mount_cd9660/mount_cd9660.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/mount_cd9660/mount_cd9660.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -147,7 +147,7 @@ utility first appeared in .Bx 4.4 . .Pp The Unicode conversion routine was added by -.An Ryuichiro Imura Aq imura@ryu16.org +.An Ryuichiro Imura Aq Mt imura@ryu16.org in 2003. .Sh BUGS POSIX device node mapping is currently not supported. Modified: stable/10/sbin/mount_msdosfs/mount_msdosfs.8 ============================================================================== --- stable/10/sbin/mount_msdosfs/mount_msdosfs.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/mount_msdosfs/mount_msdosfs.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -213,8 +213,8 @@ of the more aptly-named .Nm . .Pp The character code conversion routine was added by -.An Ryuichiro Imura Aq imura@ryu16.org -at 2003. +.An Ryuichiro Imura Aq Mt imura@ryu16.org +in 2003. .Sh CAVEATS The use of the .Fl 9 Modified: stable/10/sbin/mount_unionfs/mount_unionfs.8 ============================================================================== --- stable/10/sbin/mount_unionfs/mount_unionfs.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/mount_unionfs/mount_unionfs.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -342,9 +342,9 @@ because this is identical to using .An -nosplit In .Fx 7.0 , -.An Masanori OZAWA Aq ozawa@ongs.co.jp +.An Masanori OZAWA Aq Mt ozawa@ongs.co.jp reimplemented handling of locking, whiteout, and file mode bits, and -.An Hiroki Sato Aq hrs@FreeBSD.org +.An Hiroki Sato Aq Mt hrs@FreeBSD.org wrote about the changes in this manual page. .Sh BUGS THIS FILE SYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK) @@ -357,7 +357,7 @@ BATTERIES NOT INCLUDED. .Pp This code also needs an owner in order to be less dangerous - serious hackers can apply by sending mail to -.Aq freebsd-fs@FreeBSD.org +.Aq Mt freebsd-fs@FreeBSD.org and announcing their intent to take it over. .Pp Modified: stable/10/sbin/natd/natd.8 ============================================================================== --- stable/10/sbin/natd/natd.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/natd/natd.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -813,19 +813,19 @@ are forwarded to the appropriate router This program is the result of the efforts of many people at different times: .Pp -.An Archie Cobbs Aq archie@FreeBSD.org +.An Archie Cobbs Aq Mt archie@FreeBSD.org (divert sockets) -.An Charles Mott Aq cm@linktel.net +.An Charles Mott Aq Mt cm@linktel.net (packet aliasing) -.An Eivind Eklund Aq perhaps@yes.no +.An Eivind Eklund Aq Mt perhaps@yes.no (IRC support & misc additions) -.An Ari Suutari Aq suutari@iki.fi +.An Ari Suutari Aq Mt suutari@iki.fi (natd) -.An Dru Nelson Aq dnelson@redwoodsoft.com +.An Dru Nelson Aq Mt dnelson@redwoodsoft.com (early PPTP support) -.An Brian Somers Aq brian@awfulhak.org +.An Brian Somers Aq Mt brian@awfulhak.org (glue) -.An Ruslan Ermilov Aq ru@FreeBSD.org +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org (natd, packet aliasing, glue) -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org (multiple instances) Modified: stable/10/sbin/newfs_msdos/newfs_msdos.8 ============================================================================== --- stable/10/sbin/newfs_msdos/newfs_msdos.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/newfs_msdos/newfs_msdos.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -236,4 +236,4 @@ The utility first appeared in .Fx 3.0 . .Sh AUTHORS -.An Robert Nordier Aq rnordier@FreeBSD.org . +.An Robert Nordier Aq Mt rnordier@FreeBSD.org Modified: stable/10/sbin/newfs_nandfs/newfs_nandfs.8 ============================================================================== --- stable/10/sbin/newfs_nandfs/newfs_nandfs.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/newfs_nandfs/newfs_nandfs.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -70,5 +70,5 @@ The .Nm utility first appeared in .Fx 10.0 . -.Sh AUTHOR +.Sh AUTHORS .An Grzegorz Bernacki Modified: stable/10/sbin/nos-tun/nos-tun.8 ============================================================================== --- stable/10/sbin/nos-tun/nos-tun.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/nos-tun/nos-tun.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -82,11 +82,11 @@ tunnel source 192.168.56.45 .Ed .Sh AUTHORS .An -nosplit -.An Nickolay N. Dudorov Aq nnd@itfs.nsk.su +.An Nickolay N. Dudorov Aq Mt nnd@itfs.nsk.su wrote the program, -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org wrote the man-page. -.An Isao SEKI Aq iseki@gongon.com +.An Isao SEKI Aq Mt iseki@gongon.com added a new flag, IP protocol number. .Sh BUGS We do not allow for setting our source address for multihomed machines. Modified: stable/10/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- stable/10/sbin/nvmecontrol/nvmecontrol.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/nvmecontrol/nvmecontrol.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -124,7 +124,7 @@ nvme0 controller and activate it on the .An -nosplit .Nm was developed by Intel and originally written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . .Pp This man page was written by -.An Jim Harris Aq jimharris@FreeBSD.org . +.An Jim Harris Aq Mt jimharris@FreeBSD.org . Modified: stable/10/sbin/rcorder/rcorder.8 ============================================================================== --- stable/10/sbin/rcorder/rcorder.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/rcorder/rcorder.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -165,9 +165,9 @@ utility first appeared in .Sh AUTHORS .An -nosplit Written by -.An Perry E. Metzger Aq perry@piermont.com +.An Perry E. Metzger Aq Mt perry@piermont.com and -.An Matthew R. Green Aq mrg@eterna.com.au . +.An Matthew R. Green Aq Mt mrg@eterna.com.au . .Sh BUGS The .Dq Li REQUIRE Modified: stable/10/sbin/reboot/nextboot.8 ============================================================================== --- stable/10/sbin/reboot/nextboot.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/reboot/nextboot.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -118,7 +118,7 @@ appeared in .Fx 5.0 . .Sh AUTHORS This manual page was written by -.An Gordon Tetlow Aq gordon@FreeBSD.org . +.An Gordon Tetlow Aq Mt gordon@FreeBSD.org . .Sh BUGS The .Nm Modified: stable/10/sbin/recoverdisk/recoverdisk.1 ============================================================================== --- stable/10/sbin/recoverdisk/recoverdisk.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/recoverdisk/recoverdisk.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -137,9 +137,9 @@ utility first appeared in .Sh AUTHORS .An -nosplit The original implementation was done by -.An Poul-Henning Kamp Aq phk@FreeBSD.org +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org with minor improvements from -.An Ulrich Sp\(:orlein Aq uqs@FreeBSD.org . +.An Ulrich Sp\(:orlein Aq Mt uqs@FreeBSD.org . .Pp This manual page was written by .An Ulrich Sp\(:orlein . Modified: stable/10/sbin/sconfig/sconfig.8 ============================================================================== --- stable/10/sbin/sconfig/sconfig.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/sbin/sconfig/sconfig.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -595,7 +595,7 @@ versions of the utility are not fully compatible. .\"-------------------------------------------------------------- .Sh AUTHORS -.An Cronyx Engineering Aq info@cronyx.ru +.An Cronyx Engineering Aq Mt info@cronyx.ru .Pp .Pa http://www.cronyx.ru .\"-------------------------------------------------------------- Modified: stable/10/share/examples/mdoc/example.1 ============================================================================== --- stable/10/share/examples/mdoc/example.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/share/examples/mdoc/example.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -150,6 +150,6 @@ manual page example first appeared in .Sh AUTHORS This manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org . +.An Mike Pritchard Aq Mt mpp@FreeBSD.org . .Sh BUGS The actual code for this command is vaporware. Modified: stable/10/share/examples/mdoc/example.3 ============================================================================== --- stable/10/share/examples/mdoc/example.3 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/share/examples/mdoc/example.3 Sun Oct 16 22:02:50 2016 (r307403) @@ -330,6 +330,6 @@ manual page example first appeared in .Sh AUTHORS This manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org . +.An Mike Pritchard Aq Mt mpp@FreeBSD.org . .Sh BUGS The actual code for this function is vaporware. Modified: stable/10/share/examples/mdoc/example.4 ============================================================================== --- stable/10/share/examples/mdoc/example.4 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/share/examples/mdoc/example.4 Sun Oct 16 22:02:50 2016 (r307403) @@ -118,6 +118,6 @@ manual page example first appeared in .At v6 . .Sh AUTHORS This manual page was written by -.An Mike Pritchard Aq mpp@FreeBSD.org . +.An Mike Pritchard Aq Mt mpp@FreeBSD.org . .Sh BUGS The actual code for this device driver is vaporware. Modified: stable/10/share/examples/mdoc/example.9 ============================================================================== --- stable/10/share/examples/mdoc/example.9 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/share/examples/mdoc/example.9 Sun Oct 16 22:02:50 2016 (r307403) @@ -338,6 +338,6 @@ manual page example first appeared in .Sh AUTHORS This manual page was written by -.An Giorgos Keramidas Aq keramida@FreeBSD.org . +.An Giorgos Keramidas Aq Mt keramida@FreeBSD.org . .Sh BUGS The actual code for this function is vaporware. Modified: stable/10/share/examples/scsi_target/scsi_target.8 ============================================================================== --- stable/10/share/examples/scsi_target/scsi_target.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/share/examples/scsi_target/scsi_target.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -155,4 +155,4 @@ and was written by It was rewritten for .Fx 5.0 by -.An Nate Lawson Aq nate@root.org . +.An Nate Lawson Aq Mt nate@root.org . Modified: stable/10/tools/tools/ether_reflect/ether_reflect.1 ============================================================================== --- stable/10/tools/tools/ether_reflect/ether_reflect.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/tools/tools/ether_reflect/ether_reflect.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -103,6 +103,7 @@ program first appeared in .Sh AUTHORS This manual page was written by -.An George V. Neville-Neil Aq gnn@FreeBSD.org . +.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org . .Sh BUGS -Should be reported to the author or to net@FreeBSD.org. +Should be reported to the author or to +.Aq Mt net@FreeBSD.org . Modified: stable/10/tools/tools/fixwhite/fixwhite.1 ============================================================================== --- stable/10/tools/tools/fixwhite/fixwhite.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/tools/tools/fixwhite/fixwhite.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -45,4 +45,4 @@ If the whitespace at the beginning of a of eight spaces, the whitespace is replaced by tabs. Also, spaces preceding tabs will be merged into the tab character. .Sh AUTHORS -.An Ed Schouten Aq ed@FreeBSD.org +.An Ed Schouten Aq Mt ed@FreeBSD.org Modified: stable/10/tools/tools/mcgrab/mcgrab.1 ============================================================================== --- stable/10/tools/tools/mcgrab/mcgrab.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/tools/tools/mcgrab/mcgrab.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -77,7 +77,7 @@ program first appeared in .Sh AUTHORS This manual page was written by -.An George V. Neville-Neil Aq gnn@FreeBSD.org . +.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org . .Sh BUGS Should be reported to the author or to -.Aq net@FreeBSD.org . +.Aq Mt net@FreeBSD.org . Modified: stable/10/tools/tools/mctest/mctest.1 ============================================================================== --- stable/10/tools/tools/mctest/mctest.1 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/tools/tools/mctest/mctest.1 Sun Oct 16 22:02:50 2016 (r307403) @@ -115,7 +115,7 @@ program first appeared in .Sh AUTHORS This manual page was written by -.An George V. Neville-Neil Aq gnn@FreeBSD.org . +.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org . .Sh BUGS Should be reported to the author or to -.Aq net@FreeBSD.org . +.Aq Mt net@FreeBSD.org . Modified: stable/10/tools/tools/sysdoc/sysdoc.sh ============================================================================== --- stable/10/tools/tools/sysdoc/sysdoc.sh Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/tools/tools/sysdoc/sysdoc.sh Sun Oct 16 22:02:50 2016 (r307403) @@ -59,12 +59,12 @@ implementation, see the respecting manua This manual page is automatically generated by a set of scripts written by .An -nosplit -.An Tom Rhodes Aq trhodes@FreeBSD.org , +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org , with significant contributions from -.An Giorgos Keramidas Aq keramida@FreeBSD.org , -.An Ruslan Ermilov Aq ru@FreeBSD.org , +.An Giorgos Keramidas Aq Mt keramida@FreeBSD.org , +.An Ruslan Ermilov Aq Mt ru@FreeBSD.org , and -.An Marc Silver Aq marcs@draenor.org . +.An Marc Silver Aq Mt marcs@draenor.org . .Sh BUGS Sometimes .Fx Modified: stable/10/tools/tools/vimage/vimage.8 ============================================================================== --- stable/10/tools/tools/vimage/vimage.8 Sun Oct 16 20:59:28 2016 (r307402) +++ stable/10/tools/tools/vimage/vimage.8 Sun Oct 16 22:02:50 2016 (r307403) @@ -188,8 +188,8 @@ of the main FreeBSD tree. As a result of a project sponsored by the FreeBSD Foundation and Stiching NLNet, integrated virtualized network stack first appeared in FreeBSD 8.0. +.Sh AUTHORS +.An Marko Zec Aq Mt zec@fer.hr .Sh BUGS Deletion of vimages / vnets is known to leak kernel memory and fail at stopping various timers, hence may lead to system crashes. -.Sh AUTHOR -.An "Marko Zec" Aq zec@fer.hr From owner-svn-src-all@freebsd.org Sun Oct 16 22:22:47 2016 Return-Path: Delivered-To: svn-src-all@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 845FDC1469C; Sun, 16 Oct 2016 22:22:47 +0000 (UTC) (envelope-from sevan@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 396751E22; Sun, 16 Oct 2016 22:22:47 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMMk0Y098741; Sun, 16 Oct 2016 22:22:46 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMMkAU098740; Sun, 16 Oct 2016 22:22:46 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162222.u9GMMkAU098740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307404 - stable/10/sbin/mount_msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:22:47 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:22:46 2016 New Revision: 307404 URL: https://svnweb.freebsd.org/changeset/base/307404 Log: MFC r306611: Amend history to mention predecessor originated from 386BSD[1] & current implementation from NetBSD[2]. Reword history since the utility was renamed once more in FreeBSD 5.0. Separate out author & historical information regarding character code conversion. Add AUTHORS section. [1] https://groups.google.com/forum/#!search/mount_pcfs.c/comp.unix.bsd/9qhH0v1tZm0/inlPnXZj_2sJ [2] http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/mount_msdos/mount_msdos.c?rev=1.6&content-type=text/x-cvsweb-markup PR: 212536 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/10/sbin/mount_msdosfs/mount_msdosfs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_msdosfs/mount_msdosfs.8 ============================================================================== --- stable/10/sbin/mount_msdosfs/mount_msdosfs.8 Sun Oct 16 22:02:50 2016 (r307403) +++ stable/10/sbin/mount_msdosfs/mount_msdosfs.8 Sun Oct 16 22:22:46 2016 (r307404) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 3, 2016 .Dt MOUNT_MSDOSFS 8 .Os .Sh NAME @@ -200,21 +200,32 @@ To mount a Japanese MS-DOS file system l List of Localized MS Operating Systems: .Pa http://www.microsoft.com/globaldev/reference/oslocversion.mspx . .Sh HISTORY -The -.Nm -utility first appeared in +The predecessor to +.Nm mount_msdos +utility named +.Nm mount_pcfs +appeared in +.Bx 386 . +It was rewritten in +.Nx 1.0 +and first appeared in .Fx 2.0 . -Its predecessor, the +.Nm mount_msdos +was renamed to the more aptly-named +.Nm +in +.Fx 5.0. +The character code conversion routine was added in 2003. +.Sh AUTHORS +Initial implementation as .Nm mount_pcfs -utility appeared in -.Fx 1.0 , -and was abandoned in favor -of the more aptly-named -.Nm . -.Pp +was written by +.An -nosplit +.An Paul Popelka Aq Mt paulp@uts.amdahl.com . +It was rewritten by +.An Christopher G. Demetriou Aq Mt cgd@NetBSD.org . The character code conversion routine was added by -.An Ryuichiro Imura Aq Mt imura@ryu16.org -in 2003. +.An Ryuichiro Imura Aq Mt imura@ryu16.org . .Sh CAVEATS The use of the .Fl 9 From owner-svn-src-all@freebsd.org Sun Oct 16 22:26:41 2016 Return-Path: Delivered-To: svn-src-all@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 141DFC147DF; Sun, 16 Oct 2016 22:26:41 +0000 (UTC) (envelope-from sevan@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 D7F571001; Sun, 16 Oct 2016 22:26:40 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMQd51098953; Sun, 16 Oct 2016 22:26:39 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMQdeI098952; Sun, 16 Oct 2016 22:26:39 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162226.u9GMQdeI098952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:26: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: r307405 - stable/11/sbin/mount_nullfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:26:41 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:26:39 2016 New Revision: 307405 URL: https://svnweb.freebsd.org/changeset/base/307405 Log: MFC r306612: Note the name change from mount_null to mount_nullfs in FreeBSD 5.0. PR: 212541 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/mount_nullfs/mount_nullfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount_nullfs/mount_nullfs.8 ============================================================================== --- stable/11/sbin/mount_nullfs/mount_nullfs.8 Sun Oct 16 22:22:46 2016 (r307404) +++ stable/11/sbin/mount_nullfs/mount_nullfs.8 Sun Oct 16 22:26:39 2016 (r307405) @@ -33,7 +33,7 @@ .\" @(#)mount_null.8 8.6 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd May 1, 1995 +.Dd October 3, 2016 .Dt MOUNT_NULLFS 8 .Os .Sh NAME @@ -240,6 +240,10 @@ UCLA Technical Report CSD-910056, .Em "Stackable Layers: an Architecture for File System Development" . .Sh HISTORY The -.Nm +.Nm mount_null utility first appeared in .Bx 4.4 . +It was renamed to +.Nm +in +.Fx 5.0 . From owner-svn-src-all@freebsd.org Sun Oct 16 22:27:17 2016 Return-Path: Delivered-To: svn-src-all@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 A19B5C14845; Sun, 16 Oct 2016 22:27:17 +0000 (UTC) (envelope-from sevan@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 7317B115B; Sun, 16 Oct 2016 22:27:17 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMRG86099040; Sun, 16 Oct 2016 22:27:16 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMRGG8099039; Sun, 16 Oct 2016 22:27:16 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162227.u9GMRGG8099039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307406 - stable/10/sbin/mount_nullfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:27:17 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:27:16 2016 New Revision: 307406 URL: https://svnweb.freebsd.org/changeset/base/307406 Log: MFC r306612: Note the name change from mount_null to mount_nullfs in FreeBSD 5.0. PR: 212541 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/10/sbin/mount_nullfs/mount_nullfs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_nullfs/mount_nullfs.8 ============================================================================== --- stable/10/sbin/mount_nullfs/mount_nullfs.8 Sun Oct 16 22:26:39 2016 (r307405) +++ stable/10/sbin/mount_nullfs/mount_nullfs.8 Sun Oct 16 22:27:16 2016 (r307406) @@ -33,7 +33,7 @@ .\" @(#)mount_null.8 8.6 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd May 1, 1995 +.Dd October 3, 2016 .Dt MOUNT_NULLFS 8 .Os .Sh NAME @@ -240,6 +240,10 @@ UCLA Technical Report CSD-910056, .Em "Stackable Layers: an Architecture for File System Development" . .Sh HISTORY The -.Nm +.Nm mount_null utility first appeared in .Bx 4.4 . +It was renamed to +.Nm +in +.Fx 5.0 . From owner-svn-src-all@freebsd.org Sun Oct 16 22:31:11 2016 Return-Path: Delivered-To: svn-src-all@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 95FDCC14A21; Sun, 16 Oct 2016 22:31:11 +0000 (UTC) (envelope-from sevan@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 640A116FC; Sun, 16 Oct 2016 22:31:11 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMVAfH099941; Sun, 16 Oct 2016 22:31:10 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMVA6T099940; Sun, 16 Oct 2016 22:31:10 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162231.u9GMVA6T099940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:31: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: r307407 - stable/11/sbin/mount_unionfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:31:11 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:31:10 2016 New Revision: 307407 URL: https://svnweb.freebsd.org/changeset/base/307407 Log: MFC r306613: Note the change of name in FreeBSD 5.0. PR: 212542 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/mount_unionfs/mount_unionfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount_unionfs/mount_unionfs.8 ============================================================================== --- stable/11/sbin/mount_unionfs/mount_unionfs.8 Sun Oct 16 22:27:16 2016 (r307406) +++ stable/11/sbin/mount_unionfs/mount_unionfs.8 Sun Oct 16 22:31:10 2016 (r307407) @@ -31,7 +31,7 @@ .\" @(#)mount_union.8 8.6 (Berkeley) 3/27/94 .\" $FreeBSD$ .\" -.Dd November 30, 2006 +.Dd October 3, 2016 .Dt MOUNT_UNIONFS 8 .Os .Sh NAME @@ -328,9 +328,13 @@ accessible via .Xr mount_nullfs 8 .Sh HISTORY The -.Nm +.Nm mount_null utility first appeared in .Bx 4.4 . +It was renamed to +.Nm +in +.Fx 5.0 . .Pp The .Fl r From owner-svn-src-all@freebsd.org Sun Oct 16 22:31:52 2016 Return-Path: Delivered-To: svn-src-all@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 C64D7C14CB9; Sun, 16 Oct 2016 22:31:52 +0000 (UTC) (envelope-from sevan@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 94AF91A8B; Sun, 16 Oct 2016 22:31:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMVphF000126; Sun, 16 Oct 2016 22:31:51 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMVp0q000125; Sun, 16 Oct 2016 22:31:51 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162231.u9GMVp0q000125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307408 - stable/10/sbin/mount_unionfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:31:52 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:31:51 2016 New Revision: 307408 URL: https://svnweb.freebsd.org/changeset/base/307408 Log: MFC r306613: Note the change of name in FreeBSD 5.0. PR: 212542 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/10/sbin/mount_unionfs/mount_unionfs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_unionfs/mount_unionfs.8 ============================================================================== --- stable/10/sbin/mount_unionfs/mount_unionfs.8 Sun Oct 16 22:31:10 2016 (r307407) +++ stable/10/sbin/mount_unionfs/mount_unionfs.8 Sun Oct 16 22:31:51 2016 (r307408) @@ -31,7 +31,7 @@ .\" @(#)mount_union.8 8.6 (Berkeley) 3/27/94 .\" $FreeBSD$ .\" -.Dd November 30, 2006 +.Dd October 3, 2016 .Dt MOUNT_UNIONFS 8 .Os .Sh NAME @@ -328,9 +328,13 @@ accessible via .Xr mount_nullfs 8 .Sh HISTORY The -.Nm +.Nm mount_null utility first appeared in .Bx 4.4 . +It was renamed to +.Nm +in +.Fx 5.0 . .Pp The .Fl r From owner-svn-src-all@freebsd.org Sun Oct 16 22:33:05 2016 Return-Path: Delivered-To: svn-src-all@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 28A33C14D88; Sun, 16 Oct 2016 22:33:05 +0000 (UTC) (envelope-from sevan@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 CF5361CB6; Sun, 16 Oct 2016 22:33:04 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMX3W6002881; Sun, 16 Oct 2016 22:33:03 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMX3BU002880; Sun, 16 Oct 2016 22:33:03 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162233.u9GMX3BU002880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307409 - stable/10/sbin/pfctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:33:05 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:33:03 2016 New Revision: 307409 URL: https://svnweb.freebsd.org/changeset/base/307409 Log: MFC r306614: Note the version PF first appeared in FreeBSD & from which version it was ported from. Address the contractions raised by igor. PR: 212574 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/10/sbin/pfctl/pfctl.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/pfctl/pfctl.8 ============================================================================== --- stable/10/sbin/pfctl/pfctl.8 Sun Oct 16 22:31:51 2016 (r307408) +++ stable/10/sbin/pfctl/pfctl.8 Sun Oct 16 22:33:03 2016 (r307409) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2011 +.Dd October 3, 2016 .Dt PFCTL 8 .Os .Sh NAME @@ -391,7 +391,7 @@ Note that the optimization done automatically by the kernel will skip evaluation of rules where possible. Packets passed statefully are counted in the rule that created the state -(even though the rule isn't evaluated more than once for the entire +(even though the rule is not evaluated more than once for the entire connection). .It Fl s Cm Anchors Show the currently loaded anchors directly attached to the main ruleset. @@ -594,7 +594,7 @@ counters are incremented instead of the .Dq Pass counters when a .Dq stateful -packet is passed but doesn't match the table anymore. +packet is passed but does not match the table anymore. This will happen in our example if someone flushes the table while the .Xr ping 8 command is running. @@ -610,7 +610,7 @@ The flags are defined as follows: For constant tables, which cannot be altered outside .Xr pf.conf 5 . .It p -For persistent tables, which don't get automatically killed when no rules +For persistent tables, which do not get automatically killed when no rules refer to them. .It a For tables which are part of the @@ -649,7 +649,7 @@ Set the debug .Pp .Bl -tag -width xxxxxxxxxxxx -compact .It Fl x Cm none -Don't generate debug messages. +Do not generate debug messages. .It Fl x Cm urgent Generate debug messages only for serious errors. .It Fl x Cm misc @@ -683,5 +683,9 @@ The .Nm program and the .Xr pf 4 -filter mechanism first appeared in +filter mechanism appeared in .Ox 3.0 . +They first appeared in +.Fx 5.3 +ported from the version in +.Ox 3.5 From owner-svn-src-all@freebsd.org Sun Oct 16 22:33:53 2016 Return-Path: Delivered-To: svn-src-all@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 5B728C14E2C; Sun, 16 Oct 2016 22:33:53 +0000 (UTC) (envelope-from sevan@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 0FB311E18; Sun, 16 Oct 2016 22:33:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMXq1S002983; Sun, 16 Oct 2016 22:33:52 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMXqN4002982; Sun, 16 Oct 2016 22:33:52 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162233.u9GMXqN4002982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:33: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: r307410 - stable/11/sbin/pfctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:33:53 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:33:51 2016 New Revision: 307410 URL: https://svnweb.freebsd.org/changeset/base/307410 Log: MFC r306614: Note the version PF first appeared in FreeBSD & from which version it was ported from. Address the contractions raised by igor. PR: 212574 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/pfctl/pfctl.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/pfctl/pfctl.8 ============================================================================== --- stable/11/sbin/pfctl/pfctl.8 Sun Oct 16 22:33:03 2016 (r307409) +++ stable/11/sbin/pfctl/pfctl.8 Sun Oct 16 22:33:51 2016 (r307410) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2011 +.Dd October 3, 2016 .Dt PFCTL 8 .Os .Sh NAME @@ -390,7 +390,7 @@ Note that the optimization done automatically by the kernel will skip evaluation of rules where possible. Packets passed statefully are counted in the rule that created the state -(even though the rule isn't evaluated more than once for the entire +(even though the rule is not evaluated more than once for the entire connection). .It Fl s Cm Anchors Show the currently loaded anchors directly attached to the main ruleset. @@ -593,7 +593,7 @@ counters are incremented instead of the .Dq Pass counters when a .Dq stateful -packet is passed but doesn't match the table anymore. +packet is passed but does not match the table anymore. This will happen in our example if someone flushes the table while the .Xr ping 8 command is running. @@ -609,7 +609,7 @@ The flags are defined as follows: For constant tables, which cannot be altered outside .Xr pf.conf 5 . .It p -For persistent tables, which don't get automatically killed when no rules +For persistent tables, which do not get automatically killed when no rules refer to them. .It a For tables which are part of the @@ -648,7 +648,7 @@ Set the debug .Pp .Bl -tag -width xxxxxxxxxxxx -compact .It Fl x Cm none -Don't generate debug messages. +Do not generate debug messages. .It Fl x Cm urgent Generate debug messages only for serious errors. .It Fl x Cm misc @@ -682,5 +682,9 @@ The .Nm program and the .Xr pf 4 -filter mechanism first appeared in +filter mechanism appeared in .Ox 3.0 . +They first appeared in +.Fx 5.3 +ported from the version in +.Ox 3.5 From owner-svn-src-all@freebsd.org Sun Oct 16 22:51:26 2016 Return-Path: Delivered-To: svn-src-all@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 DD0BFC14563; Sun, 16 Oct 2016 22:51:26 +0000 (UTC) (envelope-from sevan@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 AC3171942; Sun, 16 Oct 2016 22:51:26 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMpPic008450; Sun, 16 Oct 2016 22:51:25 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMpPxb008449; Sun, 16 Oct 2016 22:51:25 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162251.u9GMpPxb008449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:51:25 +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: r307411 - stable/11/sbin/sconfig X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:51:27 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:51:25 2016 New Revision: 307411 URL: https://svnweb.freebsd.org/changeset/base/307411 Log: MFC r306615: sconfig appeared in FreeBSD 5.2. PR: 212550 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/sconfig/sconfig.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/sconfig/sconfig.8 ============================================================================== --- stable/11/sbin/sconfig/sconfig.8 Sun Oct 16 22:33:51 2016 (r307410) +++ stable/11/sbin/sconfig/sconfig.8 Sun Oct 16 22:51:25 2016 (r307411) @@ -11,7 +11,7 @@ .\" works or modified versions. .\" .\" $FreeBSD$ -.Dd May 19, 2004 +.Dd October 3, 2016 .Dt SCONFIG 8 i386 .Os .Sh NAME @@ -575,7 +575,13 @@ Test error (G.703 only). .Xr spppcontrol 8 .\"-------------------------------------------------------------- .Sh HISTORY -This utility is a replacement for the +The +.Nm +utility appeared in +.Fx 5.2 . +The +.Nm +utility is a replacement for the .Nm cxconfig and .Nm ctconfig From owner-svn-src-all@freebsd.org Sun Oct 16 22:52:06 2016 Return-Path: Delivered-To: svn-src-all@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 5583EC145C4; Sun, 16 Oct 2016 22:52:06 +0000 (UTC) (envelope-from sevan@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 26F661BF9; Sun, 16 Oct 2016 22:52:06 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMq5wE010747; Sun, 16 Oct 2016 22:52:05 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMq50x010746; Sun, 16 Oct 2016 22:52:05 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162252.u9GMq50x010746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:52:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307412 - stable/10/sbin/sconfig X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:52:06 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:52:05 2016 New Revision: 307412 URL: https://svnweb.freebsd.org/changeset/base/307412 Log: MFC r306615: sconfig appeared in FreeBSD 5.2. PR: 212550 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/10/sbin/sconfig/sconfig.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/sconfig/sconfig.8 ============================================================================== --- stable/10/sbin/sconfig/sconfig.8 Sun Oct 16 22:51:25 2016 (r307411) +++ stable/10/sbin/sconfig/sconfig.8 Sun Oct 16 22:52:05 2016 (r307412) @@ -11,7 +11,7 @@ .\" works or modified versions. .\" .\" $FreeBSD$ -.Dd May 19, 2004 +.Dd October 3, 2016 .Dt SCONFIG 8 i386 .Os .Sh NAME @@ -575,7 +575,13 @@ Test error (G.703 only). .Xr spppcontrol 8 .\"-------------------------------------------------------------- .Sh HISTORY -This utility is a replacement for the +The +.Nm +utility appeared in +.Fx 5.2 . +The +.Nm +utility is a replacement for the .Nm cxconfig and .Nm ctconfig From owner-svn-src-all@freebsd.org Sun Oct 16 22:54:25 2016 Return-Path: Delivered-To: svn-src-all@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 26DD2C1473C; Sun, 16 Oct 2016 22:54:25 +0000 (UTC) (envelope-from sevan@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 E78EC1E88; Sun, 16 Oct 2016 22:54:24 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GMsNMo010997; Sun, 16 Oct 2016 22:54:23 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GMsNn4010996; Sun, 16 Oct 2016 22:54:23 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162254.u9GMsNn4010996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 22:54:23 +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: r307413 - stable/11/sbin/setkey X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 22:54:25 -0000 Author: sevan (doc committer) Date: Sun Oct 16 22:54:23 2016 New Revision: 307413 URL: https://svnweb.freebsd.org/changeset/base/307413 Log: MFC r306616: setkey appeared in FreeBSD 4.0 PR: 212551 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/setkey/setkey.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/setkey/setkey.8 ============================================================================== --- stable/11/sbin/setkey/setkey.8 Sun Oct 16 22:52:05 2016 (r307412) +++ stable/11/sbin/setkey/setkey.8 Sun Oct 16 22:54:23 2016 (r307413) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2015 +.Dd October 3, 2016 .Dt SETKEY 8 .Os .\" @@ -713,6 +713,8 @@ The .Nm utility first appeared in WIDE Hydrangea IPv6 protocol stack kit. The utility was completely re-designed in June 1998. +It first appeared in +.Fx 4.0 . .\" .Sh BUGS The From owner-svn-src-all@freebsd.org Sun Oct 16 23:03:49 2016 Return-Path: Delivered-To: svn-src-all@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 0DB7AC14974; Sun, 16 Oct 2016 23:03:49 +0000 (UTC) (envelope-from sevan@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 C38DE12F4; Sun, 16 Oct 2016 23:03:48 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GN3l94014714; Sun, 16 Oct 2016 23:03:47 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GN3lsp014713; Sun, 16 Oct 2016 23:03:47 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162303.u9GN3lsp014713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:03: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: r307414 - stable/11/sbin/shutdown X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:03:49 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:03:47 2016 New Revision: 307414 URL: https://svnweb.freebsd.org/changeset/base/307414 Log: MFC r306617: shutdown appeared as a standalone utility in 4.1BSD. http://mail-index.netbsd.org/source-changes-d/2016/09/13/msg008686.html http://mail-index.netbsd.org/source-changes-d/2016/09/14/msg008691.html PR: 212552 Approved by: bcr (mentor) Obtained from: NetBSD Differential Revision: https://reviews.freebsd.org/D8105 Modified: stable/11/sbin/shutdown/shutdown.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/shutdown/shutdown.8 ============================================================================== --- stable/11/sbin/shutdown/shutdown.8 Sun Oct 16 22:54:23 2016 (r307413) +++ stable/11/sbin/shutdown/shutdown.8 Sun Oct 16 23:03:47 2016 (r307414) @@ -28,7 +28,7 @@ .\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd December 15, 2014 +.Dd September 21, 2016 .Dt SHUTDOWN 8 .Os .Sh NAME @@ -215,7 +215,9 @@ a colon (``:'') for backward compatibili .Xr init 8 , .Xr reboot 8 .Sh HISTORY -The +A .Nm -utility appeared in -.Bx 4.0 . +command was originally written by Ian Johnstone for UNSW's modified +.At "6th Edn" . +It was modified and then incorporated in +.Bx 4.1 . From owner-svn-src-all@freebsd.org Sun Oct 16 23:09:06 2016 Return-Path: Delivered-To: svn-src-all@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 20C66C149E5; Sun, 16 Oct 2016 23:09:06 +0000 (UTC) (envelope-from sevan@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 D32B714AC; Sun, 16 Oct 2016 23:09:05 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GN94Li014987; Sun, 16 Oct 2016 23:09:04 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GN94BF014986; Sun, 16 Oct 2016 23:09:04 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162309.u9GN94BF014986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307415 - stable/10/bin/echo X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:09:06 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:09:04 2016 New Revision: 307415 URL: https://svnweb.freebsd.org/changeset/base/307415 Log: MFC r306718: Add history section for echo(1) Sourced using the draft copy of the second edition manual http://www.tuhs.org/Archive/PDP-11/Distributions/research/1972_stuff/unix_2nd_edition_manual.pdf PR: 211785 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/bin/echo/echo.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/echo/echo.1 ============================================================================== --- stable/10/bin/echo/echo.1 Sun Oct 16 23:03:47 2016 (r307414) +++ stable/10/bin/echo/echo.1 Sun Oct 16 23:09:04 2016 (r307415) @@ -32,7 +32,7 @@ .\" @(#)echo.1 8.1 (Berkeley) 7/22/93 .\" $FreeBSD$ .\" -.Dd November 12, 2010 +.Dd October 5, 2016 .Dt ECHO 1 .Os .Sh NAME @@ -103,3 +103,8 @@ The utility conforms to .St -p1003.1-2001 as amended by Cor.\& 1-2002. +.Sh HISTORY +The +.Nm +command appeared in +.At v2 . From owner-svn-src-all@freebsd.org Sun Oct 16 23:09:56 2016 Return-Path: Delivered-To: svn-src-all@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 C267BC14A45; Sun, 16 Oct 2016 23:09:56 +0000 (UTC) (envelope-from sevan@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 93F05163F; Sun, 16 Oct 2016 23:09:56 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GN9tpp015083; Sun, 16 Oct 2016 23:09:55 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GN9tYs015082; Sun, 16 Oct 2016 23:09:55 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162309.u9GN9tYs015082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:09: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: r307416 - stable/11/bin/echo X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:09:56 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:09:55 2016 New Revision: 307416 URL: https://svnweb.freebsd.org/changeset/base/307416 Log: MFC r306718: Add history section for echo(1) Sourced using the draft copy of the second edition manual http://www.tuhs.org/Archive/PDP-11/Distributions/research/1972_stuff/unix_2nd_edition_manual.pdf PR: 211785 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/bin/echo/echo.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/echo/echo.1 ============================================================================== --- stable/11/bin/echo/echo.1 Sun Oct 16 23:09:04 2016 (r307415) +++ stable/11/bin/echo/echo.1 Sun Oct 16 23:09:55 2016 (r307416) @@ -32,7 +32,7 @@ .\" @(#)echo.1 8.1 (Berkeley) 7/22/93 .\" $FreeBSD$ .\" -.Dd November 12, 2010 +.Dd October 5, 2016 .Dt ECHO 1 .Os .Sh NAME @@ -103,3 +103,8 @@ The utility conforms to .St -p1003.1-2001 as amended by Cor.\& 1-2002. +.Sh HISTORY +The +.Nm +command appeared in +.At v2 . From owner-svn-src-all@freebsd.org Sun Oct 16 23:11:35 2016 Return-Path: Delivered-To: svn-src-all@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 03D3AC14AC2; Sun, 16 Oct 2016 23:11:35 +0000 (UTC) (envelope-from sevan@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 C6975186C; Sun, 16 Oct 2016 23:11:34 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNBXUU017257; Sun, 16 Oct 2016 23:11:33 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNBX56017256; Sun, 16 Oct 2016 23:11:33 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162311.u9GNBX56017256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:11: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: r307417 - stable/11/bin/expr X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:11:35 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:11:33 2016 New Revision: 307417 URL: https://svnweb.freebsd.org/changeset/base/307417 Log: MFC r306719: Document origins of expr & authors http://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/usr/man/man1/expr.1 PR: 173979 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/bin/expr/expr.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/expr/expr.1 ============================================================================== --- stable/11/bin/expr/expr.1 Sun Oct 16 23:09:55 2016 (r307416) +++ stable/11/bin/expr/expr.1 Sun Oct 16 23:11:33 2016 (r307417) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd October 5, 2016 .Dt EXPR 1 .Os .Sh NAME @@ -309,3 +309,19 @@ these arguments are treated just as thei The .Fl e flag is an extension. +.Sh HISTORY +An +.Nm +utility first appeared in the Programmer's Workbench (PWB/UNIX). +A public domain version of +.Nm +written by +.An Pace Willisson Aq Mt pace@blitz.com +appeared in +.Bx 386 0.1 . +.Sh AUTHORS +Initial implementation by +.An Pace Willisson Aq Mt pace@blitz.com +was largely rewritten by +.An -nosplit +.An J.T. Conklin Aq Mt jtc@FreeBSD.org . From owner-svn-src-all@freebsd.org Sun Oct 16 23:12:08 2016 Return-Path: Delivered-To: svn-src-all@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 6DF8CC14BEF; Sun, 16 Oct 2016 23:12:08 +0000 (UTC) (envelope-from sevan@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 3CF301A29; Sun, 16 Oct 2016 23:12:08 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNC7kr017341; Sun, 16 Oct 2016 23:12:07 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNC7CG017340; Sun, 16 Oct 2016 23:12:07 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162312.u9GNC7CG017340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307418 - stable/10/bin/expr X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:12:08 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:12:07 2016 New Revision: 307418 URL: https://svnweb.freebsd.org/changeset/base/307418 Log: MFC r306719: Document origins of expr & authors http://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/usr/man/man1/expr.1 PR: 173979 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/bin/expr/expr.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/expr/expr.1 ============================================================================== --- stable/10/bin/expr/expr.1 Sun Oct 16 23:11:33 2016 (r307417) +++ stable/10/bin/expr/expr.1 Sun Oct 16 23:12:07 2016 (r307418) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd October 5, 2016 .Dt EXPR 1 .Os .Sh NAME @@ -309,3 +309,19 @@ these arguments are treated just as thei The .Fl e flag is an extension. +.Sh HISTORY +An +.Nm +utility first appeared in the Programmer's Workbench (PWB/UNIX). +A public domain version of +.Nm +written by +.An Pace Willisson Aq Mt pace@blitz.com +appeared in +.Bx 386 0.1 . +.Sh AUTHORS +Initial implementation by +.An Pace Willisson Aq Mt pace@blitz.com +was largely rewritten by +.An -nosplit +.An J.T. Conklin Aq Mt jtc@FreeBSD.org . From owner-svn-src-all@freebsd.org Sun Oct 16 23:13:29 2016 Return-Path: Delivered-To: svn-src-all@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 2C1D9C14C5A; Sun, 16 Oct 2016 23:13:29 +0000 (UTC) (envelope-from sevan@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 F1C4E1CA7; Sun, 16 Oct 2016 23:13:28 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNDSJg018721; Sun, 16 Oct 2016 23:13:28 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNDSTS018720; Sun, 16 Oct 2016 23:13:28 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162313.u9GNDSTS018720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307419 - stable/10/bin/pwd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:13:29 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:13:27 2016 New Revision: 307419 URL: https://svnweb.freebsd.org/changeset/base/307419 Log: MFC r306720: Add history section of pwd(1) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s2/pwd.c PR: 211787 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/bin/pwd/pwd.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/pwd/pwd.1 ============================================================================== --- stable/10/bin/pwd/pwd.1 Sun Oct 16 23:12:07 2016 (r307418) +++ stable/10/bin/pwd/pwd.1 Sun Oct 16 23:13:27 2016 (r307419) @@ -32,7 +32,7 @@ .\" @(#)pwd.1 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd April 12, 2003 +.Dd October 5, 2016 .Dt PWD 1 .Os .Sh NAME @@ -85,6 +85,11 @@ The .Nm utility conforms to .St -p1003.1-2001 . +.Sh HISTORY +The +.Nm +command appeared in +.At v5 . .Sh BUGS In .Xr csh 1 From owner-svn-src-all@freebsd.org Sun Oct 16 23:14:28 2016 Return-Path: Delivered-To: svn-src-all@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 C3031C14CCC; Sun, 16 Oct 2016 23:14:28 +0000 (UTC) (envelope-from sevan@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 910981E06; Sun, 16 Oct 2016 23:14:28 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNERwC018827; Sun, 16 Oct 2016 23:14:27 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNERI5018826; Sun, 16 Oct 2016 23:14:27 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162314.u9GNERI5018826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:14:27 +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: r307420 - stable/11/bin/pwd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:14:28 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:14:27 2016 New Revision: 307420 URL: https://svnweb.freebsd.org/changeset/base/307420 Log: MFC r306720: Add history section of pwd(1) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s2/pwd.c PR: 211787 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/bin/pwd/pwd.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/pwd/pwd.1 ============================================================================== --- stable/11/bin/pwd/pwd.1 Sun Oct 16 23:13:27 2016 (r307419) +++ stable/11/bin/pwd/pwd.1 Sun Oct 16 23:14:27 2016 (r307420) @@ -32,7 +32,7 @@ .\" @(#)pwd.1 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd April 12, 2003 +.Dd October 5, 2016 .Dt PWD 1 .Os .Sh NAME @@ -85,6 +85,11 @@ The .Nm utility conforms to .St -p1003.1-2001 . +.Sh HISTORY +The +.Nm +command appeared in +.At v5 . .Sh BUGS In .Xr csh 1 From owner-svn-src-all@freebsd.org Sun Oct 16 23:15:34 2016 Return-Path: Delivered-To: svn-src-all@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 C48CFC14D4A; Sun, 16 Oct 2016 23:15:34 +0000 (UTC) (envelope-from sevan@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 938BF1F67; Sun, 16 Oct 2016 23:15:34 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNFX2F018933; Sun, 16 Oct 2016 23:15:33 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNFXXq018932; Sun, 16 Oct 2016 23:15:33 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162315.u9GNFXXq018932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:15: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: r307421 - stable/11/bin/stty X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:15:34 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:15:33 2016 New Revision: 307421 URL: https://svnweb.freebsd.org/changeset/base/307421 Log: MFC r306721: Add history section for stty(1) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/stty.1 PR: 211788 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/bin/stty/stty.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/stty/stty.1 ============================================================================== --- stable/11/bin/stty/stty.1 Sun Oct 16 23:14:27 2016 (r307420) +++ stable/11/bin/stty/stty.1 Sun Oct 16 23:15:33 2016 (r307421) @@ -32,7 +32,7 @@ .\" @(#)stty.1 8.4 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd August 23, 2008 +.Dd October 5, 2016 .Dt STTY 1 .Os .Sh NAME @@ -601,3 +601,8 @@ and .Fl f are extensions to the standard. +.Sh HISTORY +A +.Nm +command appeared in +.At v2 . From owner-svn-src-all@freebsd.org Sun Oct 16 23:16:06 2016 Return-Path: Delivered-To: svn-src-all@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 497F7C14DB8; Sun, 16 Oct 2016 23:16:06 +0000 (UTC) (envelope-from sevan@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 1938C10BF; Sun, 16 Oct 2016 23:16:06 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNG5na019018; Sun, 16 Oct 2016 23:16:05 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNG5fQ019017; Sun, 16 Oct 2016 23:16:05 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162316.u9GNG5fQ019017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:16:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307422 - stable/10/bin/stty X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:16:06 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:16:05 2016 New Revision: 307422 URL: https://svnweb.freebsd.org/changeset/base/307422 Log: MFC r306721: Add history section for stty(1) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/stty.1 PR: 211788 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/bin/stty/stty.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/stty/stty.1 ============================================================================== --- stable/10/bin/stty/stty.1 Sun Oct 16 23:15:33 2016 (r307421) +++ stable/10/bin/stty/stty.1 Sun Oct 16 23:16:05 2016 (r307422) @@ -32,7 +32,7 @@ .\" @(#)stty.1 8.4 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd August 23, 2008 +.Dd October 5, 2016 .Dt STTY 1 .Os .Sh NAME @@ -601,3 +601,8 @@ and .Fl f are extensions to the standard. +.Sh HISTORY +A +.Nm +command appeared in +.At v2 . From owner-svn-src-all@freebsd.org Sun Oct 16 23:18:37 2016 Return-Path: Delivered-To: svn-src-all@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 054EEC14E71; Sun, 16 Oct 2016 23:18:37 +0000 (UTC) (envelope-from sevan@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 C2B4F122F; Sun, 16 Oct 2016 23:18:36 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNIZuB019161; Sun, 16 Oct 2016 23:18:35 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNIZ2p019160; Sun, 16 Oct 2016 23:18:35 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162318.u9GNIZ2p019160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307423 - stable/10/bin/test X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:18:37 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:18:35 2016 New Revision: 307423 URL: https://svnweb.freebsd.org/changeset/base/307423 Log: MFC r306722: Add history section for test(1) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/test.c PR: 211789 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/bin/test/test.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/test/test.1 ============================================================================== --- stable/10/bin/test/test.1 Sun Oct 16 23:16:05 2016 (r307422) +++ stable/10/bin/test/test.1 Sun Oct 16 23:18:35 2016 (r307423) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd June 1, 2013 +.Dd October 5, 2016 .Dt TEST 1 .Os .Sh NAME @@ -376,6 +376,11 @@ The primaries and .Fl O are extensions. +.Sh HISTORY +A +.Nm +utility appeared in +.At v7 . .Sh BUGS Both sides are always evaluated in .Fl a From owner-svn-src-all@freebsd.org Sun Oct 16 23:19:16 2016 Return-Path: Delivered-To: svn-src-all@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 2B722C14ED6; Sun, 16 Oct 2016 23:19:16 +0000 (UTC) (envelope-from sevan@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 EC2521393; Sun, 16 Oct 2016 23:19:15 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNJFv8019254; Sun, 16 Oct 2016 23:19:15 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNJFwo019253; Sun, 16 Oct 2016 23:19:15 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162319.u9GNJFwo019253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:19: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: r307424 - stable/11/bin/test X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:19:16 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:19:14 2016 New Revision: 307424 URL: https://svnweb.freebsd.org/changeset/base/307424 Log: MFC r306722: Add history section for test(1) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/test.c PR: 211789 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/bin/test/test.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/test/test.1 ============================================================================== --- stable/11/bin/test/test.1 Sun Oct 16 23:18:35 2016 (r307423) +++ stable/11/bin/test/test.1 Sun Oct 16 23:19:14 2016 (r307424) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd June 1, 2013 +.Dd October 5, 2016 .Dt TEST 1 .Os .Sh NAME @@ -376,6 +376,11 @@ The primaries and .Fl O are extensions. +.Sh HISTORY +A +.Nm +utility appeared in +.At v7 . .Sh BUGS Both sides are always evaluated in .Fl a From owner-svn-src-all@freebsd.org Sun Oct 16 23:26:13 2016 Return-Path: Delivered-To: svn-src-all@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 F4013C1411D; Sun, 16 Oct 2016 23:26:12 +0000 (UTC) (envelope-from sevan@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 C007F180E; Sun, 16 Oct 2016 23:26:12 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNQBZI022945; Sun, 16 Oct 2016 23:26:11 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNQBOY022944; Sun, 16 Oct 2016 23:26:11 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162326.u9GNQBOY022944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:26: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: r307425 - stable/11/sbin/atm/atmconfig X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:26:13 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:26:11 2016 New Revision: 307425 URL: https://svnweb.freebsd.org/changeset/base/307425 Log: MFC r306723: Add history section for atmconfig(8) PR: 212415 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/atm/atmconfig/atmconfig.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/atm/atmconfig/atmconfig.8 ============================================================================== --- stable/11/sbin/atm/atmconfig/atmconfig.8 Sun Oct 16 23:19:14 2016 (r307424) +++ stable/11/sbin/atm/atmconfig/atmconfig.8 Sun Oct 16 23:26:11 2016 (r307425) @@ -1,7 +1,7 @@ .\" .\" Copyright (c) 2001-2003 .\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" All rights reserved. +.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 11, 2003 +.Dd October 5, 2016 .Dt ATMCONFIG 8 .Os .Sh NAME @@ -314,5 +314,10 @@ List all NATM routes. .Sh SEE ALSO .Xr natm 4 , .Xr natmip 4 +.Sh HISTORY +An +.Nm +command appeared in +.Fx 3.0 . .Sh AUTHORS .An Hartmut Brandt Aq Mt harti@FreeBSD.org From owner-svn-src-all@freebsd.org Sun Oct 16 23:27:05 2016 Return-Path: Delivered-To: svn-src-all@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 09A30C14190; Sun, 16 Oct 2016 23:27:05 +0000 (UTC) (envelope-from sevan@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 CC83E1979; Sun, 16 Oct 2016 23:27:04 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNR3SW023046; Sun, 16 Oct 2016 23:27:03 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNR3Cd023045; Sun, 16 Oct 2016 23:27:03 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162327.u9GNR3Cd023045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307426 - stable/10/sbin/atm/atmconfig X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:27:05 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:27:03 2016 New Revision: 307426 URL: https://svnweb.freebsd.org/changeset/base/307426 Log: MFC r306723: Add history section for atmconfig(8) PR: 212415 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/atm/atmconfig/atmconfig.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/atm/atmconfig/atmconfig.8 ============================================================================== --- stable/10/sbin/atm/atmconfig/atmconfig.8 Sun Oct 16 23:26:11 2016 (r307425) +++ stable/10/sbin/atm/atmconfig/atmconfig.8 Sun Oct 16 23:27:03 2016 (r307426) @@ -1,7 +1,7 @@ .\" .\" Copyright (c) 2001-2003 .\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" All rights reserved. +.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 11, 2003 +.Dd October 5, 2016 .Dt ATMCONFIG 8 .Os .Sh NAME @@ -315,5 +315,10 @@ List all NATM routes. .Xr natm 4 , .Xr natmip 4 , .Xr atm 8 +.Sh HISTORY +An +.Nm +command appeared in +.Fx 3.0 . .Sh AUTHORS .An Hartmut Brandt Aq Mt harti@FreeBSD.org From owner-svn-src-all@freebsd.org Sun Oct 16 23:29:00 2016 Return-Path: Delivered-To: svn-src-all@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 108A6C14214; Sun, 16 Oct 2016 23:29:00 +0000 (UTC) (envelope-from sevan@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 D61E01ADF; Sun, 16 Oct 2016 23:28:59 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNSxlk023171; Sun, 16 Oct 2016 23:28:59 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNSxsl023170; Sun, 16 Oct 2016 23:28:59 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162328.u9GNSxsl023170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307427 - stable/10/sbin/bsdlabel X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:29:00 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:28:58 2016 New Revision: 307427 URL: https://svnweb.freebsd.org/changeset/base/307427 Log: MFC r306724: Add history section for bsdlabel(8) http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Tahoe/usr/man/cat8/disklabel.0 Remove tab after space, highlighted by igor PR: 212436 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/bsdlabel/bsdlabel.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/bsdlabel/bsdlabel.8 ============================================================================== --- stable/10/sbin/bsdlabel/bsdlabel.8 Sun Oct 16 23:27:03 2016 (r307426) +++ stable/10/sbin/bsdlabel/bsdlabel.8 Sun Oct 16 23:28:58 2016 (r307427) @@ -31,7 +31,7 @@ .\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 5, 2016 .Dt BSDLABEL 8 .Os .Sh NAME @@ -466,7 +466,7 @@ which could be used as a source file for 8 partitions: # size offset fstype [fsize bsize bps/cpg] - a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) + a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) b: 1G * swap c: * * unused e: 204800 * 4.2BSD @@ -500,3 +500,8 @@ are not generally compatible. .Xr boot0cfg 8 , .Xr gpart 8 , .Xr newfs 8 +.Sh HISTORY +The +.Nm disklabel +utility appeared in +.Bx 4.3 Tahoe . From owner-svn-src-all@freebsd.org Sun Oct 16 23:29:41 2016 Return-Path: Delivered-To: svn-src-all@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 D53EEC14275; Sun, 16 Oct 2016 23:29:41 +0000 (UTC) (envelope-from sevan@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 A66401C56; Sun, 16 Oct 2016 23:29:41 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNTe5s023262; Sun, 16 Oct 2016 23:29:40 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNTeHq023261; Sun, 16 Oct 2016 23:29:40 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162329.u9GNTeHq023261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:29: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: r307428 - stable/11/sbin/bsdlabel X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:29:41 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:29:40 2016 New Revision: 307428 URL: https://svnweb.freebsd.org/changeset/base/307428 Log: MFC r306724: Add history section for bsdlabel(8) http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Tahoe/usr/man/cat8/disklabel.0 Remove tab after space, highlighted by igor PR: 212436 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/bsdlabel/bsdlabel.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/bsdlabel/bsdlabel.8 ============================================================================== --- stable/11/sbin/bsdlabel/bsdlabel.8 Sun Oct 16 23:28:58 2016 (r307427) +++ stable/11/sbin/bsdlabel/bsdlabel.8 Sun Oct 16 23:29:40 2016 (r307428) @@ -31,7 +31,7 @@ .\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 5, 2016 .Dt BSDLABEL 8 .Os .Sh NAME @@ -466,7 +466,7 @@ which could be used as a source file for 8 partitions: # size offset fstype [fsize bsize bps/cpg] - a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) + a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) b: 1G * swap c: * * unused e: 204800 * 4.2BSD @@ -500,3 +500,8 @@ are not generally compatible. .Xr boot0cfg 8 , .Xr gpart 8 , .Xr newfs 8 +.Sh HISTORY +The +.Nm disklabel +utility appeared in +.Bx 4.3 Tahoe . From owner-svn-src-all@freebsd.org Sun Oct 16 23:31:17 2016 Return-Path: Delivered-To: svn-src-all@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 590B2C142F5; Sun, 16 Oct 2016 23:31:17 +0000 (UTC) (envelope-from sevan@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 24F881E30; Sun, 16 Oct 2016 23:31:17 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNVGlo024781; Sun, 16 Oct 2016 23:31:16 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNVGSp024780; Sun, 16 Oct 2016 23:31:16 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162331.u9GNVGSp024780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:31: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: r307429 - stable/11/sbin/clri X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:31:17 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:31:15 2016 New Revision: 307429 URL: https://svnweb.freebsd.org/changeset/base/307429 Log: MFC r306725: Add history section for clri(8) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/man/man8/clri.8 PR: 212438 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/clri/clri.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/clri/clri.8 ============================================================================== --- stable/11/sbin/clri/clri.8 Sun Oct 16 23:29:40 2016 (r307428) +++ stable/11/sbin/clri/clri.8 Sun Oct 16 23:31:15 2016 (r307429) @@ -28,7 +28,7 @@ .\" @(#)clri.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 19, 1994 +.Dd October 5, 2016 .Dt CLRI 8 .Os .Sh NAME @@ -70,6 +70,11 @@ will be able to clean up the resulting m .Sh SEE ALSO .Xr fsck 8 , .Xr fsdb 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.At v6 . .Sh BUGS If the file is open, the work of .Nm From owner-svn-src-all@freebsd.org Sun Oct 16 23:32:36 2016 Return-Path: Delivered-To: svn-src-all@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 63818C1442F; Sun, 16 Oct 2016 23:32:36 +0000 (UTC) (envelope-from sevan@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 327CD1121; Sun, 16 Oct 2016 23:32:36 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNWZdf027094; Sun, 16 Oct 2016 23:32:35 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNWZ7U027093; Sun, 16 Oct 2016 23:32:35 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162332.u9GNWZ7U027093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307430 - stable/10/sbin/clri X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:32:36 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:32:35 2016 New Revision: 307430 URL: https://svnweb.freebsd.org/changeset/base/307430 Log: MFC r306725: Add history section for clri(8) http://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/man/man8/clri.8 PR: 212438 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/clri/clri.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/clri/clri.8 ============================================================================== --- stable/10/sbin/clri/clri.8 Sun Oct 16 23:31:15 2016 (r307429) +++ stable/10/sbin/clri/clri.8 Sun Oct 16 23:32:35 2016 (r307430) @@ -28,7 +28,7 @@ .\" @(#)clri.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 19, 1994 +.Dd October 5, 2016 .Dt CLRI 8 .Os .Sh NAME @@ -70,6 +70,11 @@ will be able to clean up the resulting m .Sh SEE ALSO .Xr fsck 8 , .Xr fsdb 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.At v6 . .Sh BUGS If the file is open, the work of .Nm From owner-svn-src-all@freebsd.org Sun Oct 16 23:34:22 2016 Return-Path: Delivered-To: svn-src-all@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 8C929C144D2; Sun, 16 Oct 2016 23:34:22 +0000 (UTC) (envelope-from sevan@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 5A97612E9; Sun, 16 Oct 2016 23:34:22 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNYLJU027239; Sun, 16 Oct 2016 23:34:21 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNYLiP027238; Sun, 16 Oct 2016 23:34:21 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162334.u9GNYLiP027238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307431 - stable/10/sbin/devd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:34:22 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:34:21 2016 New Revision: 307431 URL: https://svnweb.freebsd.org/changeset/base/307431 Log: MFC r306727: Add history section for devd(8) Move sentence to a new line as advised by igor PR: 212439 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/devd/devd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/devd/devd.8 ============================================================================== --- stable/10/sbin/devd/devd.8 Sun Oct 16 23:32:35 2016 (r307430) +++ stable/10/sbin/devd/devd.8 Sun Oct 16 23:34:21 2016 (r307431) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2014 +.Dd October 5, 2016 .Dt DEVD 8 .Os .Sh NAME @@ -62,7 +62,8 @@ The default connection limit is 10. Do not process all pending events before becoming a daemon. Instead, call daemon right away. .It Fl q -Quiet mode. Only log messages at priority LOG_WARNING or above. +Quiet mode. +Only log messages at priority LOG_WARNING or above. .El .Sh IMPLEMENTATION NOTES The @@ -153,5 +154,10 @@ A deprecated socket retained for use wit .Sh SEE ALSO .Xr devctl 4 , .Xr devd.conf 5 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 5.0 . .Sh AUTHORS .An M. Warner Losh From owner-svn-src-all@freebsd.org Sun Oct 16 23:35:05 2016 Return-Path: Delivered-To: svn-src-all@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 EB74DC1453D; Sun, 16 Oct 2016 23:35:05 +0000 (UTC) (envelope-from sevan@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 BD2281488; Sun, 16 Oct 2016 23:35:05 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNZ4r1027344; Sun, 16 Oct 2016 23:35:04 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNZ4VY027343; Sun, 16 Oct 2016 23:35:04 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162335.u9GNZ4VY027343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:35: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: r307432 - stable/11/sbin/devd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:35:06 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:35:04 2016 New Revision: 307432 URL: https://svnweb.freebsd.org/changeset/base/307432 Log: MFC r306727: Add history section for devd(8) Move sentence to a new line as advised by igor PR: 212439 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/devd/devd.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/devd/devd.8 ============================================================================== --- stable/11/sbin/devd/devd.8 Sun Oct 16 23:34:21 2016 (r307431) +++ stable/11/sbin/devd/devd.8 Sun Oct 16 23:35:04 2016 (r307432) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2014 +.Dd October 5, 2016 .Dt DEVD 8 .Os .Sh NAME @@ -62,7 +62,8 @@ The default connection limit is 10. Do not process all pending events before becoming a daemon. Instead, call daemon right away. .It Fl q -Quiet mode. Only log messages at priority LOG_WARNING or above. +Quiet mode. +Only log messages at priority LOG_WARNING or above. .El .Sh IMPLEMENTATION NOTES The @@ -153,5 +154,10 @@ A deprecated socket retained for use wit .Sh SEE ALSO .Xr devctl 4 , .Xr devd.conf 5 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 5.0 . .Sh AUTHORS .An M. Warner Losh From owner-svn-src-all@freebsd.org Sun Oct 16 23:36:53 2016 Return-Path: Delivered-To: svn-src-all@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 783BEC145BC; Sun, 16 Oct 2016 23:36:53 +0000 (UTC) (envelope-from sevan@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 4728C1652; Sun, 16 Oct 2016 23:36:53 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNaqda027472; Sun, 16 Oct 2016 23:36:52 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNaqK9027471; Sun, 16 Oct 2016 23:36:52 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162336.u9GNaqK9027471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:36: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: r307433 - stable/11/sbin/devfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:36:53 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:36:52 2016 New Revision: 307433 URL: https://svnweb.freebsd.org/changeset/base/307433 Log: MFC r306728: Add history section for devfs(8) Move sentence to a new line as advised by igor. PR: 212441 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/devfs/devfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/devfs/devfs.8 ============================================================================== --- stable/11/sbin/devfs/devfs.8 Sun Oct 16 23:35:04 2016 (r307432) +++ stable/11/sbin/devfs/devfs.8 Sun Oct 16 23:36:52 2016 (r307433) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2013 +.Dd October 5, 2016 .Dt DEVFS 8 .Os .Sh NAME @@ -249,7 +249,8 @@ configuration file. .It Pa /etc/devfs.rules Local .Nm -configuration file. Rulesets in here override those in +configuration file. +Rulesets in here override those in .Pa /etc/defaults/devfs.rules with the same ruleset number, otherwise the two files are effectively merged. .It Pa /etc/devfs.conf @@ -374,5 +375,10 @@ this feature can be used to copy ruleset .Xr chown 8 , .Xr jail 8 , .Xr mknod 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 5.0 . .Sh AUTHORS .An Dima Dorfman From owner-svn-src-all@freebsd.org Sun Oct 16 23:37:16 2016 Return-Path: Delivered-To: svn-src-all@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 F0D0FC14626; Sun, 16 Oct 2016 23:37:16 +0000 (UTC) (envelope-from sevan@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 BFDAB17B5; Sun, 16 Oct 2016 23:37:16 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNbFMP027553; Sun, 16 Oct 2016 23:37:15 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNbFvM027552; Sun, 16 Oct 2016 23:37:15 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162337.u9GNbFvM027552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:37:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307434 - stable/10/sbin/devfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:37:17 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:37:15 2016 New Revision: 307434 URL: https://svnweb.freebsd.org/changeset/base/307434 Log: MFC r306728: Add history section for devfs(8) Move sentence to a new line as advised by igor. PR: 212441 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/devfs/devfs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/devfs/devfs.8 ============================================================================== --- stable/10/sbin/devfs/devfs.8 Sun Oct 16 23:36:52 2016 (r307433) +++ stable/10/sbin/devfs/devfs.8 Sun Oct 16 23:37:15 2016 (r307434) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2013 +.Dd October 5, 2016 .Dt DEVFS 8 .Os .Sh NAME @@ -249,7 +249,8 @@ configuration file. .It Pa /etc/devfs.rules Local .Nm -configuration file. Rulesets in here override those in +configuration file. +Rulesets in here override those in .Pa /etc/defaults/devfs.rules with the same ruleset number, otherwise the two files are effectively merged. .It Pa /etc/devfs.conf @@ -374,5 +375,10 @@ this feature can be used to copy ruleset .Xr chown 8 , .Xr jail 8 , .Xr mknod 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 5.0 . .Sh AUTHORS .An Dima Dorfman From owner-svn-src-all@freebsd.org Sun Oct 16 23:39:16 2016 Return-Path: Delivered-To: svn-src-all@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 98C1FC146D4; Sun, 16 Oct 2016 23:39:16 +0000 (UTC) (envelope-from sevan@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 5BA431967; Sun, 16 Oct 2016 23:39:16 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNdFki027680; Sun, 16 Oct 2016 23:39:15 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNdFOl027679; Sun, 16 Oct 2016 23:39:15 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162339.u9GNdFOl027679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307435 - stable/10/sbin/fdisk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:39:16 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:39:15 2016 New Revision: 307435 URL: https://svnweb.freebsd.org/changeset/base/307435 Log: MFC r306731: Document the history of fdisk based on the original post to comp.unix.bsd by Julian Elischer [1] and the Mach 2.5 Installation notes [2]. I was unable to pin point the exact version of Mach the fdisk utility appeared as I could not find documentation older than version 2.5 & no source code or repo history. fdisk utility appears as a separate utility[3] in v2.5. Due to this, I have avoided stating the exact version fdisk first appeared in Mach. Add authors section. Make correction pointed by igor [1] https://groups.google.com/d/topic/comp.unix.bsd/Hhi45vAHxDg/discussion [2] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_install.ps [3] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_manpages.ps PR: 212469 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/fdisk/fdisk.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fdisk/fdisk.8 ============================================================================== --- stable/10/sbin/fdisk/fdisk.8 Sun Oct 16 23:37:15 2016 (r307434) +++ stable/10/sbin/fdisk/fdisk.8 Sun Oct 16 23:39:15 2016 (r307435) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 5, 2016 .Dt FDISK 8 .Os .Sh NAME @@ -177,19 +177,19 @@ An example follows: Information from DOS bootblock is: The data for partition 1 is: sysid 165,(FreeBSD/NetBSD/386BSD) - start 495, size 380160 (185 Meg), flag 0 + start 495, size 380160 (185 Meg), flag 0 beg: cyl 1/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 2 is: sysid 164,(unknown) - start 378180, size 2475 (1 Meg), flag 0 + start 378180, size 2475 (1 Meg), flag 0 beg: cyl 764/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 3 is: The data for partition 4 is: sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach) - start 380656, size 224234 (109 Meg), flag 80 + start 380656, size 224234 (109 Meg), flag 80 beg: cyl 769/ sector 2/ head 0; end: cyl 197/ sector 33/ head 14 .Ed @@ -485,6 +485,21 @@ The default boot code. .Xr bsdlabel 8 , .Xr gpart 8 , .Xr newfs 8 +.Sh HISTORY +A version of +.Nm +first appeared in the Mach Operating System. +It was subsequently ported to +.Bx 386 . +.Sh AUTHORS +.An -nosplit +.Nm +for Mach Operating System was written by +.An Robert Baron Aq Mt rvb@cs.cmu.edu . +It was ported to +.Bx 386 +by +.An Julian Elischer Aq Mt julian@tfs.com . .Sh BUGS The default boot code will not necessarily handle all slice types correctly, in particular those introduced since From owner-svn-src-all@freebsd.org Sun Oct 16 23:40:18 2016 Return-Path: Delivered-To: svn-src-all@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 79D9FC1475B; Sun, 16 Oct 2016 23:40:18 +0000 (UTC) (envelope-from sevan@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 3A58C1ACB; Sun, 16 Oct 2016 23:40:18 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNeHrB027803; Sun, 16 Oct 2016 23:40:17 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNeHrR027802; Sun, 16 Oct 2016 23:40:17 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162340.u9GNeHrR027802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:40:17 +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: r307436 - stable/11/sbin/fdisk X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:40:18 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:40:17 2016 New Revision: 307436 URL: https://svnweb.freebsd.org/changeset/base/307436 Log: MFC r306731: Document the history of fdisk based on the original post to comp.unix.bsd by Julian Elischer [1] and the Mach 2. 5 Installation notes [2]. I was unable to pin point the exact version of Mach the fdisk utility appeared as I could not find documentation older than version 2.5 & no source code or repo history. fdisk utility appears as a separate utility[3] in v2.5. Due to this, I have avoided stating the exact version fd isk first appeared in Mach. Add authors section. Make correction pointed by igor [1] https://groups.google.com/d/topic/comp.unix.bsd/Hhi45vAHxDg/discussion [2] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_install.ps [3] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_manpages.ps PR: 212469 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/fdisk/fdisk.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fdisk/fdisk.8 ============================================================================== --- stable/11/sbin/fdisk/fdisk.8 Sun Oct 16 23:39:15 2016 (r307435) +++ stable/11/sbin/fdisk/fdisk.8 Sun Oct 16 23:40:17 2016 (r307436) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 5, 2016 .Dt FDISK 8 .Os .Sh NAME @@ -177,19 +177,19 @@ An example follows: Information from DOS bootblock is: The data for partition 1 is: sysid 165,(FreeBSD/NetBSD/386BSD) - start 495, size 380160 (185 Meg), flag 0 + start 495, size 380160 (185 Meg), flag 0 beg: cyl 1/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 2 is: sysid 164,(unknown) - start 378180, size 2475 (1 Meg), flag 0 + start 378180, size 2475 (1 Meg), flag 0 beg: cyl 764/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 3 is: The data for partition 4 is: sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach) - start 380656, size 224234 (109 Meg), flag 80 + start 380656, size 224234 (109 Meg), flag 80 beg: cyl 769/ sector 2/ head 0; end: cyl 197/ sector 33/ head 14 .Ed @@ -485,6 +485,21 @@ The default boot code. .Xr bsdlabel 8 , .Xr gpart 8 , .Xr newfs 8 +.Sh HISTORY +A version of +.Nm +first appeared in the Mach Operating System. +It was subsequently ported to +.Bx 386 . +.Sh AUTHORS +.An -nosplit +.Nm +for Mach Operating System was written by +.An Robert Baron Aq Mt rvb@cs.cmu.edu . +It was ported to +.Bx 386 +by +.An Julian Elischer Aq Mt julian@tfs.com . .Sh BUGS The default boot code will not necessarily handle all slice types correctly, in particular those introduced since From owner-svn-src-all@freebsd.org Sun Oct 16 23:42:20 2016 Return-Path: Delivered-To: svn-src-all@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 6B6EEC14950; Sun, 16 Oct 2016 23:42:20 +0000 (UTC) (envelope-from sevan@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 1F3681E9B; Sun, 16 Oct 2016 23:42:20 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNgJZE030543; Sun, 16 Oct 2016 23:42:19 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNgJpN030542; Sun, 16 Oct 2016 23:42:19 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162342.u9GNgJpN030542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:42: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: r307437 - stable/11/sbin/fdisk_pc98 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:42:20 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:42:19 2016 New Revision: 307437 URL: https://svnweb.freebsd.org/changeset/base/307437 Log: MFC r306732: Document the history of fdisk based on the original post to comp.unix.bsd by Julian Elischer [1] and the Mach 2.5 Installation notes [2]. I was unable to pin point the exact version of Mach the fdisk utility appeared as I could not find documentation older than version 2.5 & no source code or repo history. fdisk utility appears as a separate utility[3] in v2.5. Due to this, I have avoided stating the exact version fdisk first appeared in Mach. Add authors section. [1] https://groups.google.com/d/topic/comp.unix.bsd/Hhi45vAHxDg/discussion [2] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_install.ps [3] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_manpages.ps PR: 212470 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/fdisk_pc98/fdisk.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fdisk_pc98/fdisk.8 ============================================================================== --- stable/11/sbin/fdisk_pc98/fdisk.8 Sun Oct 16 23:40:17 2016 (r307436) +++ stable/11/sbin/fdisk_pc98/fdisk.8 Sun Oct 16 23:42:19 2016 (r307437) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd April 30, 2007 +.Dd October 5, 2016 .Dt FDISK 8 .Os .Sh NAME @@ -448,6 +448,21 @@ Example: to make slice 1 the active slic .Xr bsdlabel 8 , .Xr gpart 8 , .Xr newfs 8 +.Sh HISTORY +A version of +.Nm +first appeared in the Mach Operating System. +It was subsequently ported to +.Bx 386 . +.Sh AUTHORS +.An -nosplit +.Nm +for Mach Operating System was written by +.An Robert Baron Aq Mt rvb@cs.cmu.edu . +It was ported to +.Bx 386 +by +.An Julian Elischer Aq Mt julian@tfs.com . .Sh BUGS The default boot code will not necessarily handle all slice types correctly, in particular those introduced since From owner-svn-src-all@freebsd.org Sun Oct 16 23:44:03 2016 Return-Path: Delivered-To: svn-src-all@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 856C7C149F3; Sun, 16 Oct 2016 23:44:03 +0000 (UTC) (envelope-from sevan@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 3E0981030; Sun, 16 Oct 2016 23:44:03 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNi2MP031359; Sun, 16 Oct 2016 23:44:02 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNi2iY031358; Sun, 16 Oct 2016 23:44:02 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162344.u9GNi2iY031358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:44:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307438 - stable/10/sbin/fdisk_pc98 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:44:03 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:44:02 2016 New Revision: 307438 URL: https://svnweb.freebsd.org/changeset/base/307438 Log: MFC r306732: Document the history of fdisk based on the original post to comp.unix.bsd by Julian Elischer [1] and the Mach 2. 5 Installation notes [2]. I was unable to pin point the exact version of Mach the fdisk utility appeared as I could not find documentation older than version 2.5 & no source code or repo history. fdisk utility appears as a separate utility[3] in v2.5. Due to this, I have avoided stating the exact version fd isk first appeared in Mach. Add authors section. [1] https://groups.google.com/d/topic/comp.unix.bsd/Hhi45vAHxDg/discussion [2] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_install.ps [3] ftp://ftp.mcs.vuw.ac.nz/doc/misc/mach-i386-doc/i386_manpages.ps PR: 212470 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/fdisk_pc98/fdisk.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fdisk_pc98/fdisk.8 ============================================================================== --- stable/10/sbin/fdisk_pc98/fdisk.8 Sun Oct 16 23:42:19 2016 (r307437) +++ stable/10/sbin/fdisk_pc98/fdisk.8 Sun Oct 16 23:44:02 2016 (r307438) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd April 30, 2007 +.Dd October 5, 2016 .Dt FDISK 8 .Os .Sh NAME @@ -448,6 +448,21 @@ Example: to make slice 1 the active slic .Xr bsdlabel 8 , .Xr gpart 8 , .Xr newfs 8 +.Sh HISTORY +A version of +.Nm +first appeared in the Mach Operating System. +It was subsequently ported to +.Bx 386 . +.Sh AUTHORS +.An -nosplit +.Nm +for Mach Operating System was written by +.An Robert Baron Aq Mt rvb@cs.cmu.edu . +It was ported to +.Bx 386 +by +.An Julian Elischer Aq Mt julian@tfs.com . .Sh BUGS The default boot code will not necessarily handle all slice types correctly, in particular those introduced since From owner-svn-src-all@freebsd.org Sun Oct 16 23:47:01 2016 Return-Path: Delivered-To: svn-src-all@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 B17B6C14A96; Sun, 16 Oct 2016 23:47:01 +0000 (UTC) (envelope-from sevan@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 82FEE11B1; Sun, 16 Oct 2016 23:47:01 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNl0UT031540; Sun, 16 Oct 2016 23:47:00 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNl0JD031539; Sun, 16 Oct 2016 23:47:00 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162347.u9GNl0JD031539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:47: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: r307439 - stable/11/sbin/fsck X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:47:01 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:47:00 2016 New Revision: 307439 URL: https://svnweb.freebsd.org/changeset/base/307439 Log: MFC r306733: Add history section to fsck(8) PR: 212472 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/fsck/fsck.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck/fsck.8 ============================================================================== --- stable/11/sbin/fsck/fsck.8 Sun Oct 16 23:44:02 2016 (r307438) +++ stable/11/sbin/fsck/fsck.8 Sun Oct 16 23:47:00 2016 (r307439) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 23, 2014 +.Dd October 5, 2016 .Dt FSCK 8 .Os .Sh NAME @@ -229,3 +229,15 @@ file system table .Xr fsck_ffs 8 , .Xr fsck_msdosfs 8 , .Xr mount 8 +.Sh HISTORY +A +.Nm +utility appeared in +.Bx 4.0 . +It was reimplemented as a filesystem independent wrapper in +.Nx 1.3 +and first appeared in +.Fx 5.0 . +The original filesystem specific utility became +.Xr fsck_ffs 8 +at this point. From owner-svn-src-all@freebsd.org Sun Oct 16 23:48:25 2016 Return-Path: Delivered-To: svn-src-all@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 1EBD3C14B1D; Sun, 16 Oct 2016 23:48:25 +0000 (UTC) (envelope-from sevan@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 DF0021321; Sun, 16 Oct 2016 23:48:24 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNmNQr031651; Sun, 16 Oct 2016 23:48:23 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNmNhZ031650; Sun, 16 Oct 2016 23:48:23 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162348.u9GNmNhZ031650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:48:23 +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: r307440 - stable/11/sbin/fsck_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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:48:25 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:48:23 2016 New Revision: 307440 URL: https://svnweb.freebsd.org/changeset/base/307440 Log: MFC r306734: Add history section to fsck_ffs(8) Move sentence to a new line as advised by igor. PR: 212474 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/fsck_ffs/fsck_ffs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/fsck_ffs.8 ============================================================================== --- stable/11/sbin/fsck_ffs/fsck_ffs.8 Sun Oct 16 23:47:00 2016 (r307439) +++ stable/11/sbin/fsck_ffs/fsck_ffs.8 Sun Oct 16 23:48:23 2016 (r307440) @@ -29,7 +29,7 @@ .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd July 30, 2013 +.Dd October 5, 2016 .Dt FSCK_FFS 8 .Os .Sh NAME @@ -268,9 +268,9 @@ do not open the file system for writing. Preen file systems (see above). .It Fl R Instruct fsck_ffs to restart itself if it encounters certain errors that -warrant another run. It will limit itself to a maximum of 10 restarts -in a given run in order to avoid an endless loop with extremely corrupted -filesystems. +warrant another run. +It will limit itself to a maximum of 10 restarts in a given run in order +to avoid an endless loop with extremely corrupted filesystems. .It Fl r Free up excess unused inodes. Decreasing the number of preallocated inodes reduces the @@ -393,3 +393,14 @@ are fully enumerated and explained in Ap .Xr fsdb 8 , .Xr newfs 8 , .Xr reboot 8 +.Sh HISTORY +A +.Nm fsck +utility appeared in +.Bx 4.0 . +It became +.Nm +in +.Fx 5.0 +with the introduction of the filesystem independent wrapper as +.Nm fsck . From owner-svn-src-all@freebsd.org Sun Oct 16 23:49:10 2016 Return-Path: Delivered-To: svn-src-all@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 55FD2C14B7A; Sun, 16 Oct 2016 23:49:10 +0000 (UTC) (envelope-from sevan@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 230FF14CD; Sun, 16 Oct 2016 23:49:10 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNn9Qj031745; Sun, 16 Oct 2016 23:49:09 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNn96d031744; Sun, 16 Oct 2016 23:49:09 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162349.u9GNn96d031744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307441 - stable/10/sbin/fsck_ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:49:10 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:49:09 2016 New Revision: 307441 URL: https://svnweb.freebsd.org/changeset/base/307441 Log: MFC r306734: Add history section to fsck_ffs(8) Move sentence to a new line as advised by igor. PR: 212474 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/fsck_ffs/fsck_ffs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_ffs/fsck_ffs.8 ============================================================================== --- stable/10/sbin/fsck_ffs/fsck_ffs.8 Sun Oct 16 23:48:23 2016 (r307440) +++ stable/10/sbin/fsck_ffs/fsck_ffs.8 Sun Oct 16 23:49:09 2016 (r307441) @@ -29,7 +29,7 @@ .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd July 30, 2013 +.Dd October 5, 2016 .Dt FSCK_FFS 8 .Os .Sh NAME @@ -268,9 +268,9 @@ do not open the file system for writing. Preen file systems (see above). .It Fl R Instruct fsck_ffs to restart itself if it encounters certain errors that -warrant another run. It will limit itself to a maximum of 10 restarts -in a given run in order to avoid an endless loop with extremely corrupted -filesystems. +warrant another run. +It will limit itself to a maximum of 10 restarts in a given run in order +to avoid an endless loop with extremely corrupted filesystems. .It Fl r Free up excess unused inodes. Decreasing the number of preallocated inodes reduces the @@ -393,3 +393,14 @@ are fully enumerated and explained in Ap .Xr fsdb 8 , .Xr newfs 8 , .Xr reboot 8 +.Sh HISTORY +A +.Nm fsck +utility appeared in +.Bx 4.0 . +It became +.Nm +in +.Fx 5.0 +with the introduction of the filesystem independent wrapper as +.Nm fsck . From owner-svn-src-all@freebsd.org Sun Oct 16 23:50:11 2016 Return-Path: Delivered-To: svn-src-all@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 06B0FC14C86; Sun, 16 Oct 2016 23:50:11 +0000 (UTC) (envelope-from sevan@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 C6EDA177E; Sun, 16 Oct 2016 23:50:10 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNo9tY031868; Sun, 16 Oct 2016 23:50:09 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNo92I031867; Sun, 16 Oct 2016 23:50:09 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162350.u9GNo92I031867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307442 - stable/10/sbin/natd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:50:11 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:50:09 2016 New Revision: 307442 URL: https://svnweb.freebsd.org/changeset/base/307442 Log: MFC r306735: Add history section to natd(8) Fix back sentence raised by igor. PR: 212544 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/natd/natd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/natd/natd.8 ============================================================================== --- stable/10/sbin/natd/natd.8 Sun Oct 16 23:49:09 2016 (r307441) +++ stable/10/sbin/natd/natd.8 Sun Oct 16 23:50:09 2016 (r307442) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd June 23, 2008 +.Dd October 5, 2016 .Dt NATD 8 .Os .Sh NAME @@ -426,7 +426,7 @@ Options can be divided to several sectio Each section applies to own .Nm instance. -This ability allows to configure one +This ability allows the configuration of one .Nm process for several NAT instances. The first instance that always exists is a "default" instance. @@ -809,6 +809,11 @@ are forwarded to the appropriate router .Xr init 8 , .Xr ipfw 8 , .Xr ppp 8 +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 3.0 . .Sh AUTHORS This program is the result of the efforts of many people at different times: From owner-svn-src-all@freebsd.org Sun Oct 16 23:51:16 2016 Return-Path: Delivered-To: svn-src-all@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 BD0F6C14E65; Sun, 16 Oct 2016 23:51:16 +0000 (UTC) (envelope-from sevan@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 898FA1A5B; Sun, 16 Oct 2016 23:51:16 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNpFvM031968; Sun, 16 Oct 2016 23:51:15 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNpFLl031967; Sun, 16 Oct 2016 23:51:15 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162351.u9GNpFLl031967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:51: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: r307443 - stable/11/sbin/natd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:51:16 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:51:15 2016 New Revision: 307443 URL: https://svnweb.freebsd.org/changeset/base/307443 Log: MFC r306735: Add history section to natd(8) Fix back sentence raised by igor. PR: 212544 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/natd/natd.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/natd/natd.8 ============================================================================== --- stable/11/sbin/natd/natd.8 Sun Oct 16 23:50:09 2016 (r307442) +++ stable/11/sbin/natd/natd.8 Sun Oct 16 23:51:15 2016 (r307443) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd June 23, 2008 +.Dd October 5, 2016 .Dt NATD 8 .Os .Sh NAME @@ -426,7 +426,7 @@ Options can be divided to several sectio Each section applies to own .Nm instance. -This ability allows to configure one +This ability allows the configuration of one .Nm process for several NAT instances. The first instance that always exists is a "default" instance. @@ -808,6 +808,11 @@ are forwarded to the appropriate router .Xr init 8 , .Xr ipfw 8 , .Xr ppp 8 +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 3.0 . .Sh AUTHORS This program is the result of the efforts of many people at different times: From owner-svn-src-all@freebsd.org Sun Oct 16 23:52:28 2016 Return-Path: Delivered-To: svn-src-all@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 7E970C14EE1; Sun, 16 Oct 2016 23:52:28 +0000 (UTC) (envelope-from sevan@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 4AD721CAD; Sun, 16 Oct 2016 23:52:28 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNqRtw035565; Sun, 16 Oct 2016 23:52:27 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNqRF3035564; Sun, 16 Oct 2016 23:52:27 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162352.u9GNqRF3035564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:52:27 +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: r307444 - stable/11/sbin/nos-tun X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:52:28 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:52:27 2016 New Revision: 307444 URL: https://svnweb.freebsd.org/changeset/base/307444 Log: MFC r306736: Add history section to nos-tun(8) PR: 212545 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/11/sbin/nos-tun/nos-tun.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/nos-tun/nos-tun.8 ============================================================================== --- stable/11/sbin/nos-tun/nos-tun.8 Sun Oct 16 23:51:15 2016 (r307443) +++ stable/11/sbin/nos-tun/nos-tun.8 Sun Oct 16 23:52:27 2016 (r307444) @@ -8,7 +8,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 11, 1998 +.Dd October 5, 2016 .Dt NOS-TUN 8 .Os .Sh NAME @@ -80,6 +80,11 @@ tunnel mode nos tunnel destination 192.168.59.34 tunnel source 192.168.56.45 .Ed +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 3.0 . .Sh AUTHORS .An -nosplit .An Nickolay N. Dudorov Aq Mt nnd@itfs.nsk.su From owner-svn-src-all@freebsd.org Sun Oct 16 23:53:11 2016 Return-Path: Delivered-To: svn-src-all@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 E362FC14F79; Sun, 16 Oct 2016 23:53:11 +0000 (UTC) (envelope-from sevan@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 B4F771E11; Sun, 16 Oct 2016 23:53:11 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNrAqR035660; Sun, 16 Oct 2016 23:53:10 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNrADS035659; Sun, 16 Oct 2016 23:53:10 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162353.u9GNrADS035659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307445 - stable/10/sbin/nos-tun X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:53:12 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:53:10 2016 New Revision: 307445 URL: https://svnweb.freebsd.org/changeset/base/307445 Log: MFC r306736: Add history section to nos-tun(8) PR: 212545 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104 Modified: stable/10/sbin/nos-tun/nos-tun.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/nos-tun/nos-tun.8 ============================================================================== --- stable/10/sbin/nos-tun/nos-tun.8 Sun Oct 16 23:52:27 2016 (r307444) +++ stable/10/sbin/nos-tun/nos-tun.8 Sun Oct 16 23:53:10 2016 (r307445) @@ -8,7 +8,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 11, 1998 +.Dd October 5, 2016 .Dt NOS-TUN 8 .Os .Sh NAME @@ -80,6 +80,11 @@ tunnel mode nos tunnel destination 192.168.59.34 tunnel source 192.168.56.45 .Ed +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 3.0 . .Sh AUTHORS .An -nosplit .An Nickolay N. Dudorov Aq Mt nnd@itfs.nsk.su From owner-svn-src-all@freebsd.org Sun Oct 16 23:54:41 2016 Return-Path: Delivered-To: svn-src-all@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 55A6EC14051; Sun, 16 Oct 2016 23:54:41 +0000 (UTC) (envelope-from sevan@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 272EE1FD1; Sun, 16 Oct 2016 23:54:41 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNseos035789; Sun, 16 Oct 2016 23:54:40 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNse7k035788; Sun, 16 Oct 2016 23:54:40 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162354.u9GNse7k035788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:54:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307446 - stable/10/sbin/devd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:54:41 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:54:40 2016 New Revision: 307446 URL: https://svnweb.freebsd.org/changeset/base/307446 Log: MFC r306840: Sort SEE ALSO section sequentially. Highlighted by mandoc -Tlint PR: 212440 Approved by: imp Differential Revision: https://reviews.freebsd.org/D8192 Modified: stable/10/sbin/devd/devd.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/devd/devd.conf.5 ============================================================================== --- stable/10/sbin/devd/devd.conf.5 Sun Oct 16 23:53:10 2016 (r307445) +++ stable/10/sbin/devd/devd.conf.5 Sun Oct 16 23:54:40 2016 (r307446) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd April 14, 2016 +.Dd October 8, 2016 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -637,8 +637,8 @@ The installed .Pa /etc/devd.conf has many additional examples. .Sh SEE ALSO +.Xr cam 4 , .Xr coretemp 4 , .Xr devfs 5 , .Xr re_format 7 , -.Xr devd 8 , -.Xr cam 4 +.Xr devd 8 From owner-svn-src-all@freebsd.org Sun Oct 16 23:55:21 2016 Return-Path: Delivered-To: svn-src-all@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 BF10CC140CB; Sun, 16 Oct 2016 23:55:21 +0000 (UTC) (envelope-from sevan@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 908E5112F; Sun, 16 Oct 2016 23:55:21 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9GNtK7i035904; Sun, 16 Oct 2016 23:55:20 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9GNtKtv035903; Sun, 16 Oct 2016 23:55:20 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201610162355.u9GNtKtv035903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sun, 16 Oct 2016 23:55:20 +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: r307447 - stable/11/sbin/devd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 23:55:21 -0000 Author: sevan (doc committer) Date: Sun Oct 16 23:55:20 2016 New Revision: 307447 URL: https://svnweb.freebsd.org/changeset/base/307447 Log: MFC r306840: Sort SEE ALSO section sequentially. Highlighted by mandoc -Tlint PR: 212440 Approved by: imp Differential Revision: https://reviews.freebsd.org/D8192 Modified: stable/11/sbin/devd/devd.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/devd/devd.conf.5 ============================================================================== --- stable/11/sbin/devd/devd.conf.5 Sun Oct 16 23:54:40 2016 (r307446) +++ stable/11/sbin/devd/devd.conf.5 Sun Oct 16 23:55:20 2016 (r307447) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd April 14, 2016 +.Dd October 8, 2016 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -646,8 +646,8 @@ The installed .Pa /etc/devd.conf has many additional examples. .Sh SEE ALSO +.Xr cam 4 , .Xr coretemp 4 , .Xr devfs 5 , .Xr re_format 7 , -.Xr devd 8 , -.Xr cam 4 +.Xr devd 8 From owner-svn-src-all@freebsd.org Mon Oct 17 01:47:52 2016 Return-Path: Delivered-To: svn-src-all@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 37DD4C12B8C; Mon, 17 Oct 2016 01:47:52 +0000 (UTC) (envelope-from sephe@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 C7C1A1805; Mon, 17 Oct 2016 01:47:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H1lpQ6077119; Mon, 17 Oct 2016 01:47:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H1ln5K077104; Mon, 17 Oct 2016 01:47:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170147.u9H1ln5K077104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 01:47: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: r307448 - in stable/11/sys/dev/hyperv: include netvsc storvsc utilities 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 01:47:52 -0000 Author: sephe Date: Mon Oct 17 01:47:49 2016 New Revision: 307448 URL: https://svnweb.freebsd.org/changeset/base/307448 Log: MFC 302733,302737,302801-302806 302733 hyperv/vmbus: Remove unused code Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7089 302737 hyperv/vmbus: Cleanup channel rescind Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7090 302801 hyperv/vmbus: Remove unused bits Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7091 302802 hyperv: hv_guid -> struct hyperv_guid. This paves way for the further cleanup/disentangle. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7092 302803 hyperv/vmbus: Move channel offer message definition to vmbus_reg.h - Avoid bit fields. - Avoid unnecessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7093 302804 hyperv/vmbus: Switch to vmbus channel message macros Prepare for more cleanup. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7094 302805 hyperv/vmbus: Remove unused bits Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7095 302806 hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7100 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_if.m stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 01:47:49 2016 (r307448) @@ -82,32 +82,6 @@ typedef uint8_t hv_bool_uint8_t; #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) -/* - * Make maximum size of pipe payload of 16K - */ - -#define HV_MAX_PIPE_DATA_PAYLOAD (sizeof(BYTE) * 16384) - -/* - * Define pipe_mode values - */ - -#define HV_VMBUS_PIPE_TYPE_BYTE 0x00000000 -#define HV_VMBUS_PIPE_TYPE_MESSAGE 0x00000004 - -/* - * The size of the user defined data buffer for non-pipe offers - */ - -#define HV_MAX_USER_DEFINED_BYTES 120 - -/* - * The size of the user defined data buffer for pipe offers - */ - -#define HV_MAX_PIPE_USER_DEFINED_BYTES 116 - - #define HV_MAX_PAGE_BUFFER_COUNT 32 #define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 @@ -121,68 +95,13 @@ typedef uint8_t hv_bool_uint8_t; ((HV_ALIGN_UP(addr+len, PAGE_SIZE) - \ HV_ALIGN_DOWN(addr, PAGE_SIZE)) >> PAGE_SHIFT ) -typedef struct hv_guid { - uint8_t data[16]; -} __packed hv_guid; +struct hyperv_guid { + uint8_t hv_guid[16]; +} __packed; #define HYPERV_GUID_STRLEN 40 -int hyperv_guid2str(const struct hv_guid *, char *, size_t); - -#define HV_NIC_GUID \ - .data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, \ - 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} - -#define HV_IDE_GUID \ - .data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, \ - 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5} - -#define HV_SCSI_GUID \ - .data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, \ - 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f} - -/* - * At the center of the Channel Management library is - * the Channel Offer. This struct contains the - * fundamental information about an offer. - */ - -typedef struct hv_vmbus_channel_offer { - hv_guid interface_type; - hv_guid interface_instance; - uint64_t interrupt_latency_in_100ns_units; - uint32_t interface_revision; - uint32_t server_context_area_size; /* in bytes */ - uint16_t channel_flags; - uint16_t mmio_megabytes; /* in bytes * 1024 * 1024 */ - union - { - /* - * Non-pipes: The user has HV_MAX_USER_DEFINED_BYTES bytes. - */ - struct { - uint8_t user_defined[HV_MAX_USER_DEFINED_BYTES]; - } __packed standard; - - /* - * Pipes: The following structure is an integrated pipe protocol, which - * is implemented on top of standard user-defined data. pipe - * clients have HV_MAX_PIPE_USER_DEFINED_BYTES left for their - * own use. - */ - struct { - uint32_t pipe_mode; - uint8_t user_defined[HV_MAX_PIPE_USER_DEFINED_BYTES]; - } __packed pipe; - } u; - - /* - * Sub_channel_index, newly added in Win8. - */ - uint16_t sub_channel_index; - uint16_t padding; - -} __packed hv_vmbus_channel_offer; +int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); typedef struct { uint16_t type; @@ -192,13 +111,6 @@ typedef struct { uint64_t transaction_id; } __packed hv_vm_packet_descriptor; -typedef uint32_t hv_previous_packet_offset; - -typedef struct { - hv_previous_packet_offset previous_packet_start_offset; - hv_vm_packet_descriptor descriptor; -} __packed hv_vm_packet_header; - typedef struct { uint32_t byte_count; uint32_t byte_offset; @@ -213,91 +125,6 @@ typedef struct { hv_vm_transfer_page ranges[1]; } __packed hv_vm_transfer_page_packet_header; -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - uint32_t reserved; -} __packed hv_vm_gpadl_packet_header; - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - uint16_t transfer_page_set_id; - uint16_t reserved; -} __packed hv_vm_add_remove_transfer_page_set; - -/* - * This structure defines a range in guest - * physical space that can be made - * to look virtually contiguous. - */ - -typedef struct { - uint32_t byte_count; - uint32_t byte_offset; - uint64_t pfn_array[0]; -} __packed hv_gpa_range; - -/* - * This is the format for an Establish Gpadl packet, which contains a handle - * by which this GPADL will be known and a set of GPA ranges associated with - * it. This can be converted to a MDL by the guest OS. If there are multiple - * GPA ranges, then the resulting MDL will be "chained," representing multiple - * VA ranges. - */ - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - uint32_t range_count; - hv_gpa_range range[1]; -} __packed hv_vm_establish_gpadl; - -/* - * This is the format for a Teardown Gpadl packet, which indicates that the - * GPADL handle in the Establish Gpadl packet will never be referenced again. - */ - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t gpadl; - /* for alignment to a 8-byte boundary */ - uint32_t reserved; -} __packed hv_vm_teardown_gpadl; - -/* - * This is the format for a GPA-Direct packet, which contains a set of GPA - * ranges, in addition to commands and/or data. - */ - -typedef struct { - hv_vm_packet_descriptor d; - uint32_t reserved; - uint32_t range_count; - hv_gpa_range range[1]; -} __packed hv_vm_data_gpa_direct; - -/* - * This is the format for a Additional data Packet. - */ -typedef struct { - hv_vm_packet_descriptor d; - uint64_t total_bytes; - uint32_t byte_offset; - uint32_t byte_count; - uint8_t data[1]; -} __packed hv_vm_additional_data; - -typedef union { - hv_vm_packet_descriptor simple_header; - hv_vm_transfer_page_packet_header transfer_page_header; - hv_vm_gpadl_packet_header gpadl_header; - hv_vm_add_remove_transfer_page_set add_remove_transfer_page_header; - hv_vm_establish_gpadl establish_gpadl_header; - hv_vm_teardown_gpadl teardown_gpadl_header; - hv_vm_data_gpa_direct data_gpa_direct_header; -} __packed hv_vm_packet_largest_possible_header; - typedef enum { HV_VMBUS_PACKET_TYPE_INVALID = 0x0, HV_VMBUS_PACKET_TYPES_SYNCH = 0x1, @@ -317,86 +144,6 @@ typedef enum { #define HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1 -/* - * Version 1 messages - */ -typedef enum { - HV_CHANNEL_MESSAGE_INVALID = 0, - HV_CHANNEL_MESSAGE_OFFER_CHANNEL = 1, - HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER = 2, - HV_CHANNEL_MESSAGE_REQUEST_OFFERS = 3, - HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED = 4, - HV_CHANNEL_MESSAGE_OPEN_CHANNEL = 5, - HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT = 6, - HV_CHANNEL_MESSAGE_CLOSE_CHANNEL = 7, - HV_CHANNEL_MESSAGEL_GPADL_HEADER = 8, - HV_CHANNEL_MESSAGE_GPADL_BODY = 9, - HV_CHANNEL_MESSAGE_GPADL_CREATED = 10, - HV_CHANNEL_MESSAGE_GPADL_TEARDOWN = 11, - HV_CHANNEL_MESSAGE_GPADL_TORNDOWN = 12, - HV_CHANNEL_MESSAGE_REL_ID_RELEASED = 13, - HV_CHANNEL_MESSAGE_INITIATED_CONTACT = 14, - HV_CHANNEL_MESSAGE_VERSION_RESPONSE = 15, - HV_CHANNEL_MESSAGE_UNLOAD = 16, - HV_CHANNEL_MESSAGE_COUNT -} hv_vmbus_channel_msg_type; - -typedef struct { - hv_vmbus_channel_msg_type message_type; - uint32_t padding; -} __packed hv_vmbus_channel_msg_header; - -/* - * Query VMBus Version parameters - */ -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t version; -} __packed hv_vmbus_channel_query_vmbus_version; - -/* - * Channel Offer parameters - */ -typedef struct { - hv_vmbus_channel_msg_header header; - hv_vmbus_channel_offer offer; - uint32_t child_rel_id; - uint8_t monitor_id; - /* - * This field has been split into a bit field on Win7 - * and higher. - */ - uint8_t monitor_allocated:1; - uint8_t reserved:7; - /* - * Following fields were added in win7 and higher. - * Make sure to check the version before accessing these fields. - * - * If "is_dedicated_interrupt" is set, we must not set the - * associated bit in the channel bitmap while sending the - * interrupt to the host. - * - * connection_id is used in signaling the host. - */ - uint16_t is_dedicated_interrupt:1; - uint16_t reserved1:15; - uint32_t connection_id; -} __packed hv_vmbus_channel_offer_channel; - -/* - * Rescind Offer parameters - */ -typedef struct -{ - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; -} __packed hv_vmbus_channel_rescind_offer; - -typedef struct { - hv_vmbus_channel_msg_header header; - uint32_t child_rel_id; -} __packed hv_vmbus_channel_relid_released; - #define HW_MACADDR_LEN 6 /* @@ -505,18 +252,6 @@ typedef enum { HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE, } hv_vmbus_channel_state; -/* - * Connection identifier type - */ -typedef union { - uint32_t as_uint32_t; - struct { - uint32_t id:24; - uint32_t reserved:8; - } u; - -} __packed hv_vmbus_connection_id; - typedef struct hv_vmbus_channel { device_t ch_dev; struct vmbus_softc *vmbus_sc; @@ -603,8 +338,8 @@ typedef struct hv_vmbus_channel { TAILQ_ENTRY(hv_vmbus_channel) ch_link; uint32_t ch_subidx; /* subchan index */ - struct hv_guid ch_guid_type; - struct hv_guid ch_guid_inst; + struct hyperv_guid ch_guid_type; + struct hyperv_guid ch_guid_inst; struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 01:47:49 2016 (r307448) @@ -399,8 +399,8 @@ hn_ifmedia_sts(struct ifnet *ifp, struct } /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ -static const hv_guid g_net_vsc_device_type = { - .data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, +static const struct hyperv_guid g_net_vsc_device_type = { + .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} }; Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 01:47:49 2016 (r307448) @@ -180,14 +180,14 @@ enum hv_storage_type { #define HV_STORAGE_SUPPORTS_MULTI_CHANNEL 0x1 /* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ -static const hv_guid gStorVscDeviceType={ - .data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, +static const struct hyperv_guid gStorVscDeviceType={ + .hv_guid = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f} }; /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ -static const hv_guid gBlkVscDeviceType={ - .data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, +static const struct hyperv_guid gBlkVscDeviceType={ + .hv_guid = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5} }; Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 01:47:49 2016 (r307448) @@ -39,7 +39,7 @@ #include "vmbus_if.h" /* Heartbeat Service */ -static const hv_guid service_guid = { .data = +static const struct hyperv_guid service_guid = { .hv_guid = {0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }; Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 01:47:49 2016 (r307448) @@ -90,7 +90,7 @@ static int hv_kvp_log = 0; log(LOG_INFO, "hv_kvp: " __VA_ARGS__); \ } while (0) -static const hv_guid service_guid = { .data = +static const struct hyperv_guid service_guid = { .hv_guid = {0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6} }; Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 01:47:49 2016 (r307448) @@ -43,7 +43,7 @@ #include "hv_util.h" #include "vmbus_if.h" -static const hv_guid service_guid = { .data = +static const struct hyperv_guid service_guid = { .hv_guid = {0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49, 0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB} }; Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 01:47:49 2016 (r307448) @@ -55,7 +55,7 @@ typedef struct { } time_sync_data; /* Time Synch Service */ -static const hv_guid service_guid = {.data = +static const struct hyperv_guid service_guid = {.hv_guid = {0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }; Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 01:47:49 2016 (r307448) @@ -897,25 +897,23 @@ vmbus_event_flags_proc(struct vmbus_soft int f; for (f = 0; f < flag_cnt; ++f) { - uint32_t rel_id_base; + uint32_t chid_base; u_long flags; - int bit; + int chid_ofs; if (event_flags[f] == 0) continue; flags = atomic_swap_long(&event_flags[f], 0); - rel_id_base = f << VMBUS_EVTFLAG_SHIFT; + chid_base = f << VMBUS_EVTFLAG_SHIFT; - while ((bit = ffsl(flags)) != 0) { + while ((chid_ofs = ffsl(flags)) != 0) { struct hv_vmbus_channel *channel; - uint32_t rel_id; - --bit; /* NOTE: ffsl is 1-based */ - flags &= ~(1UL << bit); + --chid_ofs; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << chid_ofs); - rel_id = rel_id_base + bit; - channel = sc->vmbus_chmap[rel_id]; + channel = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Oct 17 01:47:49 2016 (r307448) @@ -42,37 +42,40 @@ typedef void (*vmbus_chanmsg_proc_t) static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); static void vmbus_channel_on_offer_internal(struct vmbus_softc *, - const hv_vmbus_channel_offer_channel *offer); + const struct vmbus_chanmsg_choffer *); static void vmbus_chan_detach_task(void *, int); static void vmbus_channel_on_offer(struct vmbus_softc *, const struct vmbus_message *); -static void vmbus_channel_on_offer_rescind(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, const struct vmbus_message *); +static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, + const struct vmbus_message *); -/** - * Channel message dispatch table +/* + * Vmbus channel message processing. */ + +#define VMBUS_CHANMSG_PROC(name, func) \ + [VMBUS_CHANMSG_TYPE_##name] = func +#define VMBUS_CHANMSG_PROC_WAKEUP(name) \ + VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup) + static const vmbus_chanmsg_proc_t -vmbus_chanmsg_process[HV_CHANNEL_MESSAGE_COUNT] = { - [HV_CHANNEL_MESSAGE_OFFER_CHANNEL] = - vmbus_channel_on_offer, - [HV_CHANNEL_MESSAGE_RESCIND_CHANNEL_OFFER] = - vmbus_channel_on_offer_rescind, - [HV_CHANNEL_MESSAGE_ALL_OFFERS_DELIVERED] = - vmbus_channel_on_offers_delivered, - [HV_CHANNEL_MESSAGE_OPEN_CHANNEL_RESULT] = - vmbus_msghc_wakeup, - [HV_CHANNEL_MESSAGE_GPADL_CREATED] = - vmbus_msghc_wakeup, - [HV_CHANNEL_MESSAGE_GPADL_TORNDOWN] = - vmbus_msghc_wakeup, - [HV_CHANNEL_MESSAGE_VERSION_RESPONSE] = - vmbus_msghc_wakeup +vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_channel_on_offer), + VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), + VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered), + + VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) }; +#undef VMBUS_CHANMSG_PROC_WAKEUP +#undef VMBUS_CHANMSG_PROC + /** * @brief Allocate and initialize a vmbus channel object */ @@ -110,27 +113,25 @@ vmbus_channel_process_offer(hv_vmbus_cha { struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; - uint32_t relid; - relid = new_channel->ch_id; /* * Make sure this is a new offer */ mtx_lock(&sc->vmbus_chlist_lock); - if (relid == 0) { + if (new_channel->ch_id == 0) { /* * XXX channel0 will not be processed; skip it. */ printf("VMBUS: got channel0 offer\n"); } else { - sc->vmbus_chmap[relid] = new_channel; + sc->vmbus_chmap[new_channel->ch_id] = new_channel; } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, - sizeof(hv_guid)) == 0 && + sizeof(struct hyperv_guid)) == 0 && memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, - sizeof(hv_guid)) == 0) + sizeof(struct hyperv_guid)) == 0) break; } @@ -267,18 +268,16 @@ vmbus_channel_select_defcpu(struct hv_vm static void vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_offer_channel *offer; - /* New channel is offered by vmbus */ vmbus_scan_newchan(sc); - offer = (const hv_vmbus_channel_offer_channel *)msg->msg_data; - vmbus_channel_on_offer_internal(sc, offer); + vmbus_channel_on_offer_internal(sc, + (const struct vmbus_chanmsg_choffer *)msg->msg_data); } static void vmbus_channel_on_offer_internal(struct vmbus_softc *sc, - const hv_vmbus_channel_offer_channel *offer) + const struct vmbus_chanmsg_choffer *offer) { hv_vmbus_channel* new_channel; @@ -286,14 +285,14 @@ vmbus_channel_on_offer_internal(struct v * Allocate the channel object and save this offer */ new_channel = hv_vmbus_allocate_channel(sc); - new_channel->ch_id = offer->child_rel_id; - new_channel->ch_subidx = offer->offer.sub_channel_index; - new_channel->ch_guid_type = offer->offer.interface_type; - new_channel->ch_guid_inst = offer->offer.interface_instance; + new_channel->ch_id = offer->chm_chanid; + new_channel->ch_subidx = offer->chm_subidx; + new_channel->ch_guid_type = offer->chm_chtype; + new_channel->ch_guid_inst = offer->chm_chinst; /* Batch reading is on by default */ new_channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - if (offer->monitor_allocated) + if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; new_channel->ch_monprm = hyperv_dmamem_alloc( @@ -309,15 +308,15 @@ vmbus_channel_on_offer_internal(struct v } new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) - new_channel->ch_monprm->mp_connid = offer->connection_id; + new_channel->ch_monprm->mp_connid = offer->chm_connid; if (new_channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { new_channel->ch_montrig_idx = - offer->monitor_id / VMBUS_MONTRIG_LEN; + offer->chm_montrig / VMBUS_MONTRIG_LEN; if (new_channel->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) - panic("invalid monitor id %u", offer->monitor_id); + panic("invalid monitor trigger %u", offer->chm_montrig); new_channel->ch_montrig_mask = - 1 << (offer->monitor_id % VMBUS_MONTRIG_LEN); + 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } /* Select default cpu for this channel. */ @@ -326,33 +325,34 @@ vmbus_channel_on_offer_internal(struct v vmbus_channel_process_offer(new_channel); } -/** - * @brief Rescind offer handler. - * - * We queue a work item to process this offer - * synchronously. - * +/* * XXX pretty broken; need rework. */ static void -vmbus_channel_on_offer_rescind(struct vmbus_softc *sc, +vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc, const struct vmbus_message *msg) { - const hv_vmbus_channel_rescind_offer *rescind; - hv_vmbus_channel* channel; + const struct vmbus_chanmsg_chrescind *note; + struct hv_vmbus_channel *chan; + + note = (const struct vmbus_chanmsg_chrescind *)msg->msg_data; + if (note->chm_chanid > VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid rescinded chan%u\n", + note->chm_chanid); + return; + } - rescind = (const hv_vmbus_channel_rescind_offer *)msg->msg_data; if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u rescind\n", - rescind->child_rel_id); + device_printf(sc->vmbus_dev, "chan%u rescinded\n", + note->chm_chanid); } - channel = sc->vmbus_chmap[rescind->child_rel_id]; - if (channel == NULL) - return; - sc->vmbus_chmap[rescind->child_rel_id] = NULL; + chan = sc->vmbus_chmap[note->chm_chanid]; + if (chan == NULL) + return; + sc->vmbus_chmap[note->chm_chanid] = NULL; - taskqueue_enqueue(taskqueue_thread, &channel->ch_detach_task); + taskqueue_enqueue(taskqueue_thread, &chan->ch_detach_task); } static void @@ -563,7 +563,7 @@ vmbus_chan_msgproc(struct vmbus_softc *s uint32_t msg_type; msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; - if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) { + if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) { device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", msg_type); return; Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 01:47:49 2016 (r307448) @@ -56,8 +56,8 @@ typedef struct { typedef struct { uint32_t rel_id; hv_vmbus_channel_state state; - hv_guid interface_type; - hv_guid interface_instance; + struct hyperv_guid interface_type; + struct hyperv_guid interface_instance; uint32_t monitor_id; uint32_t server_monitor_pending; uint32_t server_monitor_latency; @@ -97,67 +97,6 @@ typedef struct hv_vmbus_channel_packet_m hv_vmbus_multipage_buffer range; } __packed hv_vmbus_channel_packet_multipage_buffer; -typedef union { - uint32_t as_uint32_t; - struct { - uint32_t group_enable :4; - uint32_t rsvd_z :28; - } u; -} hv_vmbus_monitor_trigger_state; - -typedef union { - uint64_t as_uint64_t; - struct { - uint32_t pending; - uint32_t armed; - } u; -} hv_vmbus_monitor_trigger_group; - -typedef struct { - hv_vmbus_connection_id connection_id; - uint16_t flag_number; - uint16_t rsvd_z; -} hv_vmbus_monitor_parameter; - -/* - * hv_vmbus_monitor_page Layout - * ------------------------------------------------------ - * | 0 | trigger_state (4 bytes) | Rsvd1 (4 bytes) | - * | 8 | trigger_group[0] | - * | 10 | trigger_group[1] | - * | 18 | trigger_group[2] | - * | 20 | trigger_group[3] | - * | 28 | Rsvd2[0] | - * | 30 | Rsvd2[1] | - * | 38 | Rsvd2[2] | - * | 40 | next_check_time[0][0] | next_check_time[0][1] | - * | ... | - * | 240 | latency[0][0..3] | - * | 340 | Rsvz3[0] | - * | 440 | parameter[0][0] | - * | 448 | parameter[0][1] | - * | ... | - * | 840 | Rsvd4[0] | - * ------------------------------------------------------ - */ - -typedef struct { - hv_vmbus_monitor_trigger_state trigger_state; - uint32_t rsvd_z1; - - hv_vmbus_monitor_trigger_group trigger_group[4]; - uint64_t rsvd_z2[3]; - - int32_t next_check_time[4][32]; - - uint16_t latency[4][32]; - uint64_t rsvd_z3[32]; - - hv_vmbus_monitor_parameter parameter[4][32]; - - uint8_t rsvd_z4[1984]; -} hv_vmbus_monitor_page; - /* * Private, VM Bus functions */ Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Mon Oct 17 01:47:49 2016 (r307448) @@ -116,9 +116,9 @@ hypercall_signal_event(bus_addr_t monprm } int -hyperv_guid2str(const struct hv_guid *guid, char *buf, size_t sz) +hyperv_guid2str(const struct hyperv_guid *guid, char *buf, size_t sz) { - const uint8_t *d = guid->data; + const uint8_t *d = guid->hv_guid; return snprintf(buf, sz, "%02x%02x%02x%02x-" "%02x%02x-%02x%02x-%02x%02x-" Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 01:47:49 2016 (r307448) @@ -1051,11 +1051,12 @@ vmbus_get_version_method(device_t bus, d } static int -vmbus_probe_guid_method(device_t bus, device_t dev, const struct hv_guid *guid) +vmbus_probe_guid_method(device_t bus, device_t dev, + const struct hyperv_guid *guid) { const struct hv_vmbus_channel *chan = vmbus_get_channel(dev); - if (memcmp(&chan->ch_guid_type, guid, sizeof(struct hv_guid)) == 0) + if (memcmp(&chan->ch_guid_type, guid, sizeof(struct hyperv_guid)) == 0) return 0; return ENXIO; } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_if.m ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_if.m Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_if.m Mon Oct 17 01:47:49 2016 (r307448) @@ -32,7 +32,7 @@ INTERFACE vmbus; HEADER { - struct hv_guid; + struct hyperv_guid; }; METHOD uint32_t get_version { @@ -43,5 +43,5 @@ METHOD uint32_t get_version { METHOD int probe_guid { device_t bus; device_t dev; - const struct hv_guid *guid; + const struct hyperv_guid *guid; }; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Sun Oct 16 23:55:20 2016 (r307447) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 01:47:49 2016 (r307448) @@ -31,6 +31,7 @@ #include #include +#include /* XXX for hyperv_guid */ /* * Hyper-V SynIC message format. @@ -117,11 +118,14 @@ struct vmbus_gpa_range { /* * Channel messages - * - Embedded in vmbus_message.msg_data, e.g. response. + * - Embedded in vmbus_message.msg_data, e.g. response and notification. * - Embedded in hypercall_postmsg_in.hc_data, e.g. request. */ +#define VMBUS_CHANMSG_TYPE_CHOFFER 1 /* NOTE */ +#define VMBUS_CHANMSG_TYPE_CHRESCIND 2 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHREQUEST 3 /* REQ */ +#define VMBUS_CHANMSG_TYPE_CHOFFER_DONE 4 /* NOTE */ #define VMBUS_CHANMSG_TYPE_CHOPEN 5 /* REQ */ #define VMBUS_CHANMSG_TYPE_CHOPEN_RESP 6 /* RESP */ #define VMBUS_CHANMSG_TYPE_CHCLOSE 7 /* REQ */ @@ -134,6 +138,7 @@ struct vmbus_gpa_range { #define VMBUS_CHANMSG_TYPE_CONNECT 14 /* REQ */ #define VMBUS_CHANMSG_TYPE_CONNECT_RESP 15 /* RESP */ #define VMBUS_CHANMSG_TYPE_DISCONNECT 16 /* REQ */ +#define VMBUS_CHANMSG_TYPE_MAX 22 struct vmbus_chanmsg_hdr { uint32_t chm_type; /* VMBUS_CHANMSG_TYPE_ */ @@ -241,4 +246,33 @@ struct vmbus_chanmsg_chfree { uint32_t chm_chanid; } __packed; +/* VMBUS_CHANMSG_TYPE_CHRESCIND */ +struct vmbus_chanmsg_chrescind { + struct vmbus_chanmsg_hdr chm_hdr; + uint32_t chm_chanid; +} __packed; + +/* VMBUS_CHANMSG_TYPE_CHOFFER */ +struct vmbus_chanmsg_choffer { + struct vmbus_chanmsg_hdr chm_hdr; + struct hyperv_guid chm_chtype; + struct hyperv_guid chm_chinst; + uint64_t chm_chlat; /* unit: 100ns */ + uint32_t chm_chrev; + uint32_t chm_svrctx_sz; + uint16_t chm_chflags; + uint16_t chm_mmio_sz; /* unit: MB */ + uint8_t chm_udata[120]; + uint16_t chm_subidx; + uint16_t chm_rsvd; + uint32_t chm_chanid; + uint8_t chm_montrig; + uint8_t chm_flags1; /* VMBUS_CHOFFER_FLAG1_ */ + uint16_t chm_flags2; + uint32_t chm_connid; +} __packed; +CTASSERT(sizeof(struct vmbus_chanmsg_choffer) <= VMBUS_MSG_DSIZE_MAX); + +#define VMBUS_CHOFFER_FLAG1_HASMNF 0x01 + #endif /* !_VMBUS_REG_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 01:59:44 2016 Return-Path: Delivered-To: svn-src-all@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 6E431C12E58; Mon, 17 Oct 2016 01:59:44 +0000 (UTC) (envelope-from sephe@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 3A2DD1D5E; Mon, 17 Oct 2016 01:59:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H1xhch081051; Mon, 17 Oct 2016 01:59:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H1xgoT081044; Mon, 17 Oct 2016 01:59:42 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170159.u9H1xgoT081044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 01:59:42 +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: r307449 - in stable/11/sys/dev/hyperv: include netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 01:59:44 -0000 Author: sephe Date: Mon Oct 17 01:59:42 2016 New Revision: 307449 URL: https://svnweb.freebsd.org/changeset/base/307449 Log: MFC 302808-302815 302808 hyperv/vmbus: Alloc/Free monitor param in vmbus channel alloc/free. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7101 302809 hyperv/vmbus: Move device register and channel free to the caller. This paves the way for more cleanup/disentangle. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7102 302810 hyperv/vmbus: Move new channel scan notification to device register And nuke now unnecessary function indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7103 302811 hyperv/vmbus: Cleanup vmbus_chan_msgproc_choffer Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7104 302812 hyperv/vmbus: Nuke the channel open state. Channel is either opened or not-opened. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7105 302813 hyperv/vmbus: Cleanup vmbus_chan_add() Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7106 302814 hyperv/vmbus: Use sub-channel index to detect primary channel In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of channel setup. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7108 302815 hyperv/vmbus: Only add primary channels to vmbus channel list - Make the vmbus_chan_add more straightforward. - Partially fix the hv_vmbus_release_unattached_channels(). Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7109 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 01:47:49 2016 (r307448) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 01:59:42 2016 (r307449) @@ -244,18 +244,9 @@ typedef struct { typedef void (*hv_vmbus_pfn_channel_callback)(void *context); -typedef enum { - HV_CHANNEL_OFFER_STATE, - HV_CHANNEL_OPENING_STATE, - HV_CHANNEL_OPEN_STATE, - HV_CHANNEL_OPENED_STATE, - HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE, -} hv_vmbus_channel_state; - typedef struct hv_vmbus_channel { device_t ch_dev; struct vmbus_softc *vmbus_sc; - hv_vmbus_channel_state state; uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ uint32_t ch_id; /* channel id */ @@ -337,14 +328,15 @@ typedef struct hv_vmbus_channel { struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_link; uint32_t ch_subidx; /* subchan index */ - + volatile uint32_t ch_stflags; /* atomic-op */ + /* VMBUS_CHAN_ST_ */ struct hyperv_guid ch_guid_type; struct hyperv_guid ch_guid_inst; struct sysctl_ctx_list ch_sysctl_ctx; } hv_vmbus_channel; -#define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL) +#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) #define VMBUS_CHAN_FLAG_HASMNF 0x0001 /* @@ -357,6 +349,9 @@ typedef struct hv_vmbus_channel { */ #define VMBUS_CHAN_FLAG_BATCHREAD 0x0002 +#define VMBUS_CHAN_ST_OPENED_SHIFT 0 +#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) + static inline void hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on) { Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 01:47:49 2016 (r307448) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 01:59:42 2016 (r307449) @@ -719,11 +719,6 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ - if (!destroy_channel) { - sc->hn_prichan->state = - HV_CHANNEL_CLOSING_NONDESTRUCTIVE_STATE; - } - free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); hv_vmbus_channel_close(sc->hn_prichan); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 01:47:49 2016 (r307448) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 01:59:42 2016 (r307449) @@ -2957,7 +2957,7 @@ static void hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) { - KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan), + KASSERT(!VMBUS_CHAN_ISPRIMARY(chan), ("subchannel callback on primary channel")); KASSERT(chan->ch_subidx > 0, ("invalid channel subidx %u", Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 01:47:49 2016 (r307448) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 01:59:42 2016 (r307449) @@ -191,17 +191,9 @@ hv_vmbus_channel_open( return EINVAL; } - mtx_lock(&new_channel->sc_lock); - if (new_channel->state == HV_CHANNEL_OPEN_STATE) { - new_channel->state = HV_CHANNEL_OPENING_STATE; - } else { - mtx_unlock(&new_channel->sc_lock); - if(bootverbose) - printf("VMBUS: Trying to open channel <%p> which in " - "%d state.\n", new_channel, new_channel->state); - return (EINVAL); - } - mtx_unlock(&new_channel->sc_lock); + if (atomic_testandset_int(&new_channel->ch_stflags, + VMBUS_CHAN_ST_OPENED_SHIFT)) + panic("double-open chan%u", new_channel->ch_id); new_channel->on_channel_callback = pfn_on_channel_callback; new_channel->channel_callback_context = context; @@ -223,8 +215,10 @@ hv_vmbus_channel_open( M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); KASSERT(out != NULL, ("Error VMBUS: contigmalloc failed to allocate Ring Buffer!")); - if (out == NULL) - return (ENOMEM); + if (out == NULL) { + ret = ENOMEM; + goto failed; + } in = ((uint8_t *) out + send_ring_buffer_size); @@ -265,7 +259,8 @@ hv_vmbus_channel_open( device_printf(sc->vmbus_dev, "can not get msg hypercall for chopen(chan%u)\n", new_channel->ch_id); - return ENXIO; + ret = ENXIO; + goto failed; } req = vmbus_msghc_dataptr(mh); @@ -284,7 +279,7 @@ hv_vmbus_channel_open( "chopen(chan%u) msg hypercall exec failed: %d\n", new_channel->ch_id, ret); vmbus_msghc_put(sc, mh); - return ret; + goto failed; } msg = vmbus_msghc_wait_result(sc, mh); @@ -294,17 +289,20 @@ hv_vmbus_channel_open( vmbus_msghc_put(sc, mh); if (status == 0) { - new_channel->state = HV_CHANNEL_OPENED_STATE; if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u opened\n", new_channel->ch_id); } - } else { - device_printf(sc->vmbus_dev, "failed to open chan%u\n", - new_channel->ch_id); - ret = ENXIO; + return 0; } - return (ret); + + device_printf(sc->vmbus_dev, "failed to open chan%u\n", + new_channel->ch_id); + ret = ENXIO; + +failed: + atomic_clear_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED); + return ret; } /** @@ -487,7 +485,9 @@ hv_vmbus_channel_close_internal(hv_vmbus struct taskqueue *rxq = channel->rxq; int error; - channel->state = HV_CHANNEL_OPEN_STATE; + /* TODO: stringent check */ + atomic_clear_int(&channel->ch_stflags, VMBUS_CHAN_ST_OPENED); + sysctl_ctx_free(&channel->ch_sysctl_ctx); /* @@ -563,7 +563,7 @@ hv_vmbus_channel_close(hv_vmbus_channel */ TAILQ_FOREACH(sub_channel, &channel->sc_list_anchor, sc_list_entry) { - if (sub_channel->state != HV_CHANNEL_OPENED_STATE) + if ((sub_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) continue; hv_vmbus_channel_close_internal(sub_channel); } Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Oct 17 01:47:49 2016 (r307448) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Oct 17 01:59:42 2016 (r307449) @@ -40,15 +40,12 @@ typedef void (*vmbus_chanmsg_proc_t) (struct vmbus_softc *, const struct vmbus_message *); -static struct hv_vmbus_channel *hv_vmbus_allocate_channel(struct vmbus_softc *); -static void vmbus_channel_on_offer_internal(struct vmbus_softc *, - const struct vmbus_chanmsg_choffer *); static void vmbus_chan_detach_task(void *, int); -static void vmbus_channel_on_offer(struct vmbus_softc *, - const struct vmbus_message *); static void vmbus_channel_on_offers_delivered(struct vmbus_softc *, const struct vmbus_message *); +static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, const struct vmbus_message *); @@ -63,7 +60,7 @@ static void vmbus_chan_msgproc_chrescind static const vmbus_chanmsg_proc_t vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = { - VMBUS_CHANMSG_PROC(CHOFFER, vmbus_channel_on_offer), + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered), @@ -76,146 +73,125 @@ vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE #undef VMBUS_CHANMSG_PROC_WAKEUP #undef VMBUS_CHANMSG_PROC -/** - * @brief Allocate and initialize a vmbus channel object - */ static struct hv_vmbus_channel * -hv_vmbus_allocate_channel(struct vmbus_softc *sc) +vmbus_chan_alloc(struct vmbus_softc *sc) { - struct hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; - channel = malloc(sizeof(*channel), M_DEVBUF, M_WAITOK | M_ZERO); - channel->vmbus_sc = sc; + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); - mtx_init(&channel->sc_lock, "vmbus multi channel", NULL, MTX_DEF); - TAILQ_INIT(&channel->sc_list_anchor); - TASK_INIT(&channel->ch_detach_task, 0, vmbus_chan_detach_task, channel); + chan->ch_monprm = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + &chan->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (chan->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); + free(chan, M_DEVBUF); + return NULL; + } - return (channel); + chan->vmbus_sc = sc; + mtx_init(&chan->sc_lock, "vmbus multi channel", NULL, MTX_DEF); + TAILQ_INIT(&chan->sc_list_anchor); + TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); + + return chan; } -/** - * @brief Release the resources used by the vmbus channel object - */ -void -hv_vmbus_free_vmbus_channel(hv_vmbus_channel* channel) +static void +vmbus_chan_free(struct hv_vmbus_channel *chan) { - mtx_destroy(&channel->sc_lock); - free(channel, M_DEVBUF); + /* TODO: assert sub-channel list is empty */ + /* TODO: asset no longer on the primary channel's sub-channel list */ + /* TODO: asset no longer on the vmbus channel list */ + hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); + mtx_destroy(&chan->sc_lock); + free(chan, M_DEVBUF); } -/** - * @brief Process the offer by creating a channel/device - * associated with this offer - */ -static void -vmbus_channel_process_offer(hv_vmbus_channel *new_channel) +static int +vmbus_chan_add(struct hv_vmbus_channel *newchan) { - struct vmbus_softc *sc = new_channel->vmbus_sc; - hv_vmbus_channel* channel; + struct vmbus_softc *sc = newchan->vmbus_sc; + struct hv_vmbus_channel *prichan; - /* - * Make sure this is a new offer - */ - mtx_lock(&sc->vmbus_chlist_lock); - if (new_channel->ch_id == 0) { + if (newchan->ch_id == 0) { /* - * XXX channel0 will not be processed; skip it. + * XXX + * Chan0 will neither be processed nor should be offered; + * skip it. */ - printf("VMBUS: got channel0 offer\n"); - } else { - sc->vmbus_chmap[new_channel->ch_id] = new_channel; + device_printf(sc->vmbus_dev, "got chan0 offer, discard\n"); + return EINVAL; + } else if (newchan->ch_id >= VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid chan%u offer\n", + newchan->ch_id); + return EINVAL; } + sc->vmbus_chmap[newchan->ch_id] = newchan; - TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { - if (memcmp(&channel->ch_guid_type, &new_channel->ch_guid_type, + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", + newchan->ch_id, newchan->ch_subidx); + } + + mtx_lock(&sc->vmbus_chlist_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_chlist, ch_link) { + if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, sizeof(struct hyperv_guid)) == 0 && - memcmp(&channel->ch_guid_inst, &new_channel->ch_guid_inst, + memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, sizeof(struct hyperv_guid)) == 0) break; } - - if (channel == NULL) { - /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, ch_link); - } - mtx_unlock(&sc->vmbus_chlist_lock); - - if (bootverbose) { - char logstr[64]; - - logstr[0] = '\0'; - if (channel != NULL) { - snprintf(logstr, sizeof(logstr), ", primary chan%u", - channel->ch_id); + if (VMBUS_CHAN_ISPRIMARY(newchan)) { + if (prichan == NULL) { + /* Install the new primary channel */ + TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); + mtx_unlock(&sc->vmbus_chlist_lock); + return 0; + } else { + mtx_unlock(&sc->vmbus_chlist_lock); + device_printf(sc->vmbus_dev, "duplicated primary " + "chan%u\n", newchan->ch_id); + return EINVAL; } - device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n", - new_channel->ch_id, - new_channel->ch_subidx, logstr); - } - - if (channel != NULL) { - /* - * Check if this is a sub channel. - */ - if (new_channel->ch_subidx != 0) { - /* - * It is a sub channel offer, process it. - */ - new_channel->primary_channel = channel; - new_channel->ch_dev = channel->ch_dev; - mtx_lock(&channel->sc_lock); - TAILQ_INSERT_TAIL(&channel->sc_list_anchor, - new_channel, sc_list_entry); - mtx_unlock(&channel->sc_lock); - - /* - * Insert the new channel to the end of the global - * channel list. - * - * NOTE: - * The new sub-channel MUST be inserted AFTER it's - * primary channel, so that the primary channel will - * be found in the above loop for its baby siblings. - */ - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, new_channel, - ch_link); + } else { /* Sub-channel */ + if (prichan == NULL) { mtx_unlock(&sc->vmbus_chlist_lock); - - new_channel->state = HV_CHANNEL_OPEN_STATE; - - /* - * Bump up sub-channel count and notify anyone that is - * interested in this sub-channel, after this sub-channel - * is setup. - */ - mtx_lock(&channel->sc_lock); - channel->subchan_cnt++; - mtx_unlock(&channel->sc_lock); - wakeup(channel); - - return; + device_printf(sc->vmbus_dev, "no primary chan for " + "chan%u\n", newchan->ch_id); + return EINVAL; } - - printf("VMBUS: duplicated primary channel%u\n", - new_channel->ch_id); - hv_vmbus_free_vmbus_channel(new_channel); - return; + /* + * Found the primary channel for this sub-channel and + * move on. + * + * XXX refcnt prichan + */ } + mtx_unlock(&sc->vmbus_chlist_lock); + + /* + * This is a sub-channel; link it with the primary channel. + */ + KASSERT(!VMBUS_CHAN_ISPRIMARY(newchan), + ("new channel is not sub-channel")); + KASSERT(prichan != NULL, ("no primary channel")); - new_channel->state = HV_CHANNEL_OPEN_STATE; + newchan->primary_channel = prichan; + newchan->ch_dev = prichan->ch_dev; + mtx_lock(&prichan->sc_lock); + TAILQ_INSERT_TAIL(&prichan->sc_list_anchor, newchan, sc_list_entry); /* - * Add the new device to the bus. This will kick off device-driver - * binding which eventually invokes the device driver's AddDevice() - * method. - * - * NOTE: - * Error is ignored here; don't have much to do if error really - * happens. + * Bump up sub-channel count and notify anyone that is + * interested in this sub-channel, after this sub-channel + * is setup. */ - hv_vmbus_child_device_register(new_channel); + prichan->subchan_cnt++; + mtx_unlock(&prichan->sc_lock); + wakeup(prichan); + + return 0; } void @@ -250,7 +226,7 @@ vmbus_channel_cpu_rr(struct hv_vmbus_cha } static void -vmbus_channel_select_defcpu(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_default(struct hv_vmbus_channel *chan) { /* * By default, pin the channel to cpu0. Devices having @@ -260,69 +236,68 @@ vmbus_channel_select_defcpu(struct hv_vm vmbus_channel_cpu_set(chan, 0); } -/** - * @brief Handler for channel offers from Hyper-V/Azure - * - * Handler for channel offers from vmbus in parent partition. - */ static void -vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg) +vmbus_chan_msgproc_choffer(struct vmbus_softc *sc, + const struct vmbus_message *msg) { - /* New channel is offered by vmbus */ - vmbus_scan_newchan(sc); + const struct vmbus_chanmsg_choffer *offer; + struct hv_vmbus_channel *chan; + int error; - vmbus_channel_on_offer_internal(sc, - (const struct vmbus_chanmsg_choffer *)msg->msg_data); -} + offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; -static void -vmbus_channel_on_offer_internal(struct vmbus_softc *sc, - const struct vmbus_chanmsg_choffer *offer) -{ - hv_vmbus_channel* new_channel; + chan = vmbus_chan_alloc(sc); + if (chan == NULL) { + device_printf(sc->vmbus_dev, "allocate chan%u failed\n", + offer->chm_chanid); + return; + } - /* - * Allocate the channel object and save this offer - */ - new_channel = hv_vmbus_allocate_channel(sc); - new_channel->ch_id = offer->chm_chanid; - new_channel->ch_subidx = offer->chm_subidx; - new_channel->ch_guid_type = offer->chm_chtype; - new_channel->ch_guid_inst = offer->chm_chinst; + chan->ch_id = offer->chm_chanid; + chan->ch_subidx = offer->chm_subidx; + chan->ch_guid_type = offer->chm_chtype; + chan->ch_guid_inst = offer->chm_chinst; /* Batch reading is on by default */ - new_channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) - new_channel->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; - new_channel->ch_monprm = hyperv_dmamem_alloc( - bus_get_dma_tag(sc->vmbus_dev), - HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), - &new_channel->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (new_channel->ch_monprm == NULL) { - device_printf(sc->vmbus_dev, "monprm alloc failed\n"); - /* XXX */ - mtx_destroy(&new_channel->sc_lock); - free(new_channel, M_DEVBUF); - return; - } - new_channel->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; + chan->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; if (sc->vmbus_version != VMBUS_VERSION_WS2008) - new_channel->ch_monprm->mp_connid = offer->chm_connid; + chan->ch_monprm->mp_connid = offer->chm_connid; - if (new_channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { - new_channel->ch_montrig_idx = - offer->chm_montrig / VMBUS_MONTRIG_LEN; - if (new_channel->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) + if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) { + /* + * Setup MNF stuffs. + */ + chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_montrig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN; + if (chan->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) panic("invalid monitor trigger %u", offer->chm_montrig); - new_channel->ch_montrig_mask = + chan->ch_montrig_mask = 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } /* Select default cpu for this channel. */ - vmbus_channel_select_defcpu(new_channel); + vmbus_chan_cpu_default(chan); - vmbus_channel_process_offer(new_channel); + error = vmbus_chan_add(chan); + if (error) { + device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", + chan->ch_id, error); + vmbus_chan_free(chan); + return; + } + + if (VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Add device for this primary channel. + * + * NOTE: + * Error is ignored here; don't have much to do if error + * really happens. + */ + hv_vmbus_child_device_register(chan); + } } /* @@ -360,7 +335,7 @@ vmbus_chan_detach_task(void *xchan, int { struct hv_vmbus_channel *chan = xchan; - if (HV_VMBUS_CHAN_ISPRIMARY(chan)) { + if (VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the device */ hv_vmbus_child_device_unregister(chan); /* NOTE: DO NOT free primary channel for now */ @@ -398,10 +373,6 @@ vmbus_chan_detach_task(void *xchan, int } } remove: - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); - mtx_lock(&pri_chan->sc_lock); TAILQ_REMOVE(&pri_chan->sc_list_anchor, chan, sc_list_entry); KASSERT(pri_chan->subchan_cnt > 0, @@ -410,7 +381,7 @@ remove: mtx_unlock(&pri_chan->sc_lock); wakeup(pri_chan); - hv_vmbus_free_vmbus_channel(chan); + vmbus_chan_free(chan); } } @@ -439,13 +410,11 @@ hv_vmbus_release_unattached_channels(str while (!TAILQ_EMPTY(&sc->vmbus_chlist)) { channel = TAILQ_FIRST(&sc->vmbus_chlist); + KASSERT(VMBUS_CHAN_ISPRIMARY(channel), ("not primary channel")); TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); - if (HV_VMBUS_CHAN_ISPRIMARY(channel)) { - /* Only primary channel owns the device */ - hv_vmbus_child_device_unregister(channel); - } - hv_vmbus_free_vmbus_channel(channel); + hv_vmbus_child_device_unregister(channel); + vmbus_chan_free(channel); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); @@ -483,7 +452,7 @@ vmbus_select_outgoing_channel(struct hv_ cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { - if (new_channel->state != HV_CHANNEL_OPENED_STATE){ + if ((new_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) { continue; } Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 01:47:49 2016 (r307448) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 01:59:42 2016 (r307449) @@ -55,7 +55,6 @@ typedef struct { typedef struct { uint32_t rel_id; - hv_vmbus_channel_state state; struct hyperv_guid interface_type; struct hyperv_guid interface_instance; uint32_t monitor_id; @@ -147,7 +146,6 @@ void hv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel); void hv_vmbus_release_unattached_channels( struct vmbus_softc *); Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 01:47:49 2016 (r307448) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 01:59:42 2016 (r307449) @@ -994,6 +994,9 @@ hv_vmbus_child_device_register(struct hv device_t parent = sc->vmbus_dev; int error = 0; + /* New channel has been offered */ + vmbus_scan_newchan(sc); + chan->ch_dev = device_add_child(parent, NULL, -1); if (chan->ch_dev == NULL) { device_printf(parent, "device_add_child for chan%u failed\n", From owner-svn-src-all@freebsd.org Mon Oct 17 02:02:46 2016 Return-Path: Delivered-To: svn-src-all@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 99D50C13016; Mon, 17 Oct 2016 02:02:46 +0000 (UTC) (envelope-from sephe@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 6E07510F4; Mon, 17 Oct 2016 02:02:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H22jOM084551; Mon, 17 Oct 2016 02:02:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H22j0L084545; Mon, 17 Oct 2016 02:02:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170202.u9H22j0L084545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:02: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: r307450 - in stable/11/sys/dev/hyperv: include 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:02:46 -0000 Author: sephe Date: Mon Oct 17 02:02:44 2016 New Revision: 307450 URL: https://svnweb.freebsd.org/changeset/base/307450 Log: MFC 302816-302818 302816 hyperv/vmbus: Release vmbus channel lock before detach devices Device detach method may sleep. While I'm here, rename the function, fix indentation and function comment. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7110 302817 hyperv/vmbus: Field renaming to reflect reality Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7111 302818 hyperv/vmbus: Fix the racy channel close. It is not safe to iterate the sub-channel list w/o lock on the close path, while it's even more difficult to hold the lock and iterate the sub-channel list. We leverage the vmbua_{get,rel}_subchan() functions to solve this dilemma. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7112 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 01:59:42 2016 (r307449) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:02:44 2016 (r307450) @@ -326,7 +326,7 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv3; struct task ch_detach_task; - TAILQ_ENTRY(hv_vmbus_channel) ch_link; + TAILQ_ENTRY(hv_vmbus_channel) ch_prilink; /* primary chan link */ uint32_t ch_subidx; /* subchan index */ volatile uint32_t ch_stflags; /* atomic-op */ /* VMBUS_CHAN_ST_ */ Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 01:59:42 2016 (r307449) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:02:44 2016 (r307450) @@ -542,35 +542,40 @@ hv_vmbus_channel_close_internal(hv_vmbus M_DEVBUF); } -/** - * @brief Close the specified channel +/* + * Caller should make sure that all sub-channels have + * been added to 'chan' and all to-be-closed channels + * are not being opened. */ void -hv_vmbus_channel_close(hv_vmbus_channel *channel) +hv_vmbus_channel_close(struct hv_vmbus_channel *chan) { - hv_vmbus_channel* sub_channel; + int subchan_cnt; - if (channel->primary_channel != NULL) { + if (!VMBUS_CHAN_ISPRIMARY(chan)) { /* - * We only close multi-channels when the primary is - * closed. + * Sub-channel is closed when its primary channel + * is closed; done. */ return; } /* - * Close all multi-channels first. + * Close all sub-channels, if any. */ - TAILQ_FOREACH(sub_channel, &channel->sc_list_anchor, - sc_list_entry) { - if ((sub_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) - continue; - hv_vmbus_channel_close_internal(sub_channel); + subchan_cnt = chan->subchan_cnt; + if (subchan_cnt > 0) { + struct hv_vmbus_channel **subchan; + int i; + + subchan = vmbus_get_subchan(chan, subchan_cnt); + for (i = 0; i < subchan_cnt; ++i) + hv_vmbus_channel_close_internal(subchan[i]); + vmbus_rel_subchan(subchan, subchan_cnt); } - /* - * Then close the primary channel. - */ - hv_vmbus_channel_close_internal(channel); + + /* Then close the primary channel. */ + hv_vmbus_channel_close_internal(chan); } /** Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Oct 17 01:59:42 2016 (r307449) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Oct 17 02:02:44 2016 (r307450) @@ -134,8 +134,8 @@ vmbus_chan_add(struct hv_vmbus_channel * newchan->ch_id, newchan->ch_subidx); } - mtx_lock(&sc->vmbus_chlist_lock); - TAILQ_FOREACH(prichan, &sc->vmbus_chlist, ch_link) { + mtx_lock(&sc->vmbus_prichan_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, sizeof(struct hyperv_guid)) == 0 && memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, @@ -145,18 +145,19 @@ vmbus_chan_add(struct hv_vmbus_channel * if (VMBUS_CHAN_ISPRIMARY(newchan)) { if (prichan == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link); - mtx_unlock(&sc->vmbus_chlist_lock); + TAILQ_INSERT_TAIL(&sc->vmbus_prichans, newchan, + ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); return 0; } else { - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); device_printf(sc->vmbus_dev, "duplicated primary " "chan%u\n", newchan->ch_id); return EINVAL; } } else { /* Sub-channel */ if (prichan == NULL) { - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); device_printf(sc->vmbus_dev, "no primary chan for " "chan%u\n", newchan->ch_id); return EINVAL; @@ -168,7 +169,7 @@ vmbus_chan_add(struct hv_vmbus_channel * * XXX refcnt prichan */ } - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); /* * This is a sub-channel; link it with the primary channel. @@ -398,28 +399,28 @@ vmbus_channel_on_offers_delivered(struct vmbus_scan_done(sc); } -/** - * @brief Release channels that are unattached/unconnected (i.e., no drivers associated) +/* + * Detach all devices and destroy the corresponding primary channels. */ void -hv_vmbus_release_unattached_channels(struct vmbus_softc *sc) +vmbus_chan_destroy_all(struct vmbus_softc *sc) { - hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; - mtx_lock(&sc->vmbus_chlist_lock); + mtx_lock(&sc->vmbus_prichan_lock); + while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) { + KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); + TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); - while (!TAILQ_EMPTY(&sc->vmbus_chlist)) { - channel = TAILQ_FIRST(&sc->vmbus_chlist); - KASSERT(VMBUS_CHAN_ISPRIMARY(channel), ("not primary channel")); - TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link); + hv_vmbus_child_device_unregister(chan); + vmbus_chan_free(chan); - hv_vmbus_child_device_unregister(channel); - vmbus_chan_free(channel); + mtx_lock(&sc->vmbus_prichan_lock); } bzero(sc->vmbus_chmap, sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); - - mtx_unlock(&sc->vmbus_chlist_lock); + mtx_unlock(&sc->vmbus_prichan_lock); } /** Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 01:59:42 2016 (r307449) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 02:02:44 2016 (r307450) @@ -146,9 +146,6 @@ void hv_ring_buffer_read_begin( uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -void hv_vmbus_release_unattached_channels( - struct vmbus_softc *); - int hv_vmbus_child_device_register( struct hv_vmbus_channel *chan); int hv_vmbus_child_device_unregister( Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 01:59:42 2016 (r307449) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 02:02:44 2016 (r307450) @@ -1104,8 +1104,8 @@ vmbus_doattach(struct vmbus_softc *sc) mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); sc->vmbus_gpadl = VMBUS_GPADL_START; - mtx_init(&sc->vmbus_chlist_lock, "vmbus chlist", NULL, MTX_DEF); - TAILQ_INIT(&sc->vmbus_chlist); + mtx_init(&sc->vmbus_prichan_lock, "vmbus prichan", NULL, MTX_DEF); + TAILQ_INIT(&sc->vmbus_prichans); sc->vmbus_chmap = malloc( sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); @@ -1176,7 +1176,7 @@ cleanup: } free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); - mtx_destroy(&sc->vmbus_chlist_lock); + mtx_destroy(&sc->vmbus_prichan_lock); return (ret); } @@ -1239,7 +1239,7 @@ vmbus_detach(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); - hv_vmbus_release_unattached_channels(sc); + vmbus_chan_destroy_all(sc); vmbus_disconnect(sc); @@ -1258,7 +1258,7 @@ vmbus_detach(device_t dev) free(sc->vmbus_chmap, M_DEVBUF); mtx_destroy(&sc->vmbus_scan_lock); - mtx_destroy(&sc->vmbus_chlist_lock); + mtx_destroy(&sc->vmbus_prichan_lock); return (0); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 01:59:42 2016 (r307449) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 02:02:44 2016 (r307450) @@ -102,8 +102,9 @@ struct vmbus_softc { #define VMBUS_SCAN_CHCNT_DONE 0x80000000 uint32_t vmbus_scan_devcnt; - struct mtx vmbus_chlist_lock; - TAILQ_HEAD(, hv_vmbus_channel) vmbus_chlist; + /* Primary channels */ + struct mtx vmbus_prichan_lock; + TAILQ_HEAD(, hv_vmbus_channel) vmbus_prichans; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ @@ -138,6 +139,7 @@ void vmbus_handle_intr(struct trapframe void vmbus_et_intr(struct trapframe *); void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *); +void vmbus_chan_destroy_all(struct vmbus_softc *); struct vmbus_msghc *vmbus_msghc_get(struct vmbus_softc *, size_t); void vmbus_msghc_put(struct vmbus_softc *, struct vmbus_msghc *); From owner-svn-src-all@freebsd.org Mon Oct 17 02:12:51 2016 Return-Path: Delivered-To: svn-src-all@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 6925AC13224; Mon, 17 Oct 2016 02:12:51 +0000 (UTC) (envelope-from sephe@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 313EB160D; Mon, 17 Oct 2016 02:12:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2CoZA088455; Mon, 17 Oct 2016 02:12:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2Cn14088447; Mon, 17 Oct 2016 02:12:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170212.u9H2Cn14088447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:12: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: r307451 - in stable/11/sys: conf dev/hyperv/include dev/hyperv/vmbus 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:12:51 -0000 Author: sephe Date: Mon Oct 17 02:12:49 2016 New Revision: 307451 URL: https://svnweb.freebsd.org/changeset/base/307451 Log: MFC 302864 hyperv/vmbus: Merge hv_channel_mgmt.c into hv_channel.c Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7126 Deleted: stable/11/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h 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 Mon Oct 17 02:02:44 2016 (r307450) +++ stable/11/sys/conf/files.amd64 Mon Oct 17 02:12:49 2016 (r307451) @@ -302,7 +302,6 @@ dev/hyperv/utilities/hv_shutdown.c opt dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv -dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Mon Oct 17 02:02:44 2016 (r307450) +++ stable/11/sys/conf/files.i386 Mon Oct 17 02:12:49 2016 (r307451) @@ -259,7 +259,6 @@ dev/hyperv/utilities/hv_shutdown.c opt dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hv_channel.c optional hyperv -dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:02:44 2016 (r307450) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:12:49 2016 (r307451) @@ -293,30 +293,17 @@ typedef struct hv_vmbus_channel { uint32_t target_cpu; /* - * Support for multi-channels. - * The initial offer is considered the primary channel and this - * offer message will indicate if the host supports multi-channels. - * The guest is free to ask for multi-channels to be offerred and can - * open these multi-channels as a normal "primary" channel. However, - * all multi-channels will have the same type and instance guids as the - * primary channel. Requests sent on a given channel will result in a - * response on the same channel. + * If this is a primary channel, ch_subchan* fields + * contain sub-channels belonging to this primary + * channel. */ - - struct mtx sc_lock; - - /* - * Link list of all the multi-channels if this is a primary channel - */ - TAILQ_HEAD(, hv_vmbus_channel) sc_list_anchor; - TAILQ_ENTRY(hv_vmbus_channel) sc_list_entry; - int subchan_cnt; - - /* - * The primary channel this sub-channle belongs to. - * This will be NULL for the primary channel. - */ - struct hv_vmbus_channel *primary_channel; + struct mtx ch_subchan_lock; + TAILQ_HEAD(, hv_vmbus_channel) ch_subchans; + int ch_subchan_cnt; + + /* If this is a sub-channel */ + TAILQ_ENTRY(hv_vmbus_channel) ch_sublink; /* sub-channel link */ + struct hv_vmbus_channel *ch_prichan; /* owner primary chan */ /* * Driver private data Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:02:44 2016 (r307450) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:12:49 2016 (r307451) @@ -53,8 +53,28 @@ __FBSDID("$FreeBSD$"); static void vmbus_chan_send_event(hv_vmbus_channel* channel); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); + static void vmbus_chan_task(void *, int); static void vmbus_chan_task_nobatch(void *, int); +static void vmbus_chan_detach_task(void *, int); + +static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, + const struct vmbus_message *); + +/* + * Vmbus channel message processing. + */ +static const vmbus_chanmsg_proc_t +vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), + VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), + + VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) +}; /** * @brief Trigger an event notification on the specified channel @@ -100,7 +120,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha uint16_t sub_ch_id; char name[16]; - hv_vmbus_channel* primary_ch = channel->primary_channel; + hv_vmbus_channel* primary_ch = channel->ch_prichan; if (primary_ch == NULL) { dev = channel->ch_dev; @@ -563,7 +583,7 @@ hv_vmbus_channel_close(struct hv_vmbus_c /* * Close all sub-channels, if any. */ - subchan_cnt = chan->subchan_cnt; + subchan_cnt = chan->ch_subchan_cnt; if (subchan_cnt > 0) { struct hv_vmbus_channel **subchan; int i; @@ -984,3 +1004,463 @@ vmbus_chan_update_evtflagcnt(struct vmbu } } } + +static struct hv_vmbus_channel * +vmbus_chan_alloc(struct vmbus_softc *sc) +{ + struct hv_vmbus_channel *chan; + + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); + + chan->ch_monprm = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + &chan->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (chan->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); + free(chan, M_DEVBUF); + return NULL; + } + + chan->vmbus_sc = sc; + mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(&chan->ch_subchans); + TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); + + return chan; +} + +static void +vmbus_chan_free(struct hv_vmbus_channel *chan) +{ + /* TODO: assert sub-channel list is empty */ + /* TODO: asset no longer on the primary channel's sub-channel list */ + /* TODO: asset no longer on the vmbus channel list */ + hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); + mtx_destroy(&chan->ch_subchan_lock); + free(chan, M_DEVBUF); +} + +static int +vmbus_chan_add(struct hv_vmbus_channel *newchan) +{ + struct vmbus_softc *sc = newchan->vmbus_sc; + struct hv_vmbus_channel *prichan; + + if (newchan->ch_id == 0) { + /* + * XXX + * Chan0 will neither be processed nor should be offered; + * skip it. + */ + device_printf(sc->vmbus_dev, "got chan0 offer, discard\n"); + return EINVAL; + } else if (newchan->ch_id >= VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid chan%u offer\n", + newchan->ch_id); + return EINVAL; + } + sc->vmbus_chmap[newchan->ch_id] = newchan; + + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", + newchan->ch_id, newchan->ch_subidx); + } + + mtx_lock(&sc->vmbus_prichan_lock); + TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) { + /* + * Sub-channel will have the same type GUID and instance + * GUID as its primary channel. + */ + if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type, + sizeof(struct hyperv_guid)) == 0 && + memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst, + sizeof(struct hyperv_guid)) == 0) + break; + } + if (VMBUS_CHAN_ISPRIMARY(newchan)) { + if (prichan == NULL) { + /* Install the new primary channel */ + TAILQ_INSERT_TAIL(&sc->vmbus_prichans, newchan, + ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); + return 0; + } else { + mtx_unlock(&sc->vmbus_prichan_lock); + device_printf(sc->vmbus_dev, "duplicated primary " + "chan%u\n", newchan->ch_id); + return EINVAL; + } + } else { /* Sub-channel */ + if (prichan == NULL) { + mtx_unlock(&sc->vmbus_prichan_lock); + device_printf(sc->vmbus_dev, "no primary chan for " + "chan%u\n", newchan->ch_id); + return EINVAL; + } + /* + * Found the primary channel for this sub-channel and + * move on. + * + * XXX refcnt prichan + */ + } + mtx_unlock(&sc->vmbus_prichan_lock); + + /* + * This is a sub-channel; link it with the primary channel. + */ + KASSERT(!VMBUS_CHAN_ISPRIMARY(newchan), + ("new channel is not sub-channel")); + KASSERT(prichan != NULL, ("no primary channel")); + + newchan->ch_prichan = prichan; + newchan->ch_dev = prichan->ch_dev; + + mtx_lock(&prichan->ch_subchan_lock); + TAILQ_INSERT_TAIL(&prichan->ch_subchans, newchan, ch_sublink); + /* + * Bump up sub-channel count and notify anyone that is + * interested in this sub-channel, after this sub-channel + * is setup. + */ + prichan->ch_subchan_cnt++; + mtx_unlock(&prichan->ch_subchan_lock); + wakeup(prichan); + + return 0; +} + +void +vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu) +{ + KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); + + if (chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WS2008 || + chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WIN7) { + /* Only cpu0 is supported */ + cpu = 0; + } + + chan->target_cpu = cpu; + chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); + + if (bootverbose) { + printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", + chan->ch_id, + chan->target_cpu, chan->target_vcpu); + } +} + +void +vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) +{ + static uint32_t vmbus_chan_nextcpu; + int cpu; + + cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; + vmbus_channel_cpu_set(chan, cpu); +} + +static void +vmbus_chan_cpu_default(struct hv_vmbus_channel *chan) +{ + /* + * By default, pin the channel to cpu0. Devices having + * special channel-cpu mapping requirement should call + * vmbus_channel_cpu_{set,rr}(). + */ + vmbus_channel_cpu_set(chan, 0); +} + +static void +vmbus_chan_msgproc_choffer(struct vmbus_softc *sc, + const struct vmbus_message *msg) +{ + const struct vmbus_chanmsg_choffer *offer; + struct hv_vmbus_channel *chan; + int error; + + offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; + + chan = vmbus_chan_alloc(sc); + if (chan == NULL) { + device_printf(sc->vmbus_dev, "allocate chan%u failed\n", + offer->chm_chanid); + return; + } + + chan->ch_id = offer->chm_chanid; + chan->ch_subidx = offer->chm_subidx; + chan->ch_guid_type = offer->chm_chtype; + chan->ch_guid_inst = offer->chm_chinst; + + /* Batch reading is on by default */ + chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; + + chan->ch_monprm->mp_connid = VMBUS_CONNID_EVENT; + if (sc->vmbus_version != VMBUS_VERSION_WS2008) + chan->ch_monprm->mp_connid = offer->chm_connid; + + if (offer->chm_flags1 & VMBUS_CHOFFER_FLAG1_HASMNF) { + /* + * Setup MNF stuffs. + */ + chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF; + chan->ch_montrig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN; + if (chan->ch_montrig_idx >= VMBUS_MONTRIGS_MAX) + panic("invalid monitor trigger %u", offer->chm_montrig); + chan->ch_montrig_mask = + 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); + } + + /* Select default cpu for this channel. */ + vmbus_chan_cpu_default(chan); + + error = vmbus_chan_add(chan); + if (error) { + device_printf(sc->vmbus_dev, "add chan%u failed: %d\n", + chan->ch_id, error); + vmbus_chan_free(chan); + return; + } + + if (VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Add device for this primary channel. + * + * NOTE: + * Error is ignored here; don't have much to do if error + * really happens. + */ + hv_vmbus_child_device_register(chan); + } +} + +/* + * XXX pretty broken; need rework. + */ +static void +vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc, + const struct vmbus_message *msg) +{ + const struct vmbus_chanmsg_chrescind *note; + struct hv_vmbus_channel *chan; + + note = (const struct vmbus_chanmsg_chrescind *)msg->msg_data; + if (note->chm_chanid > VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid rescinded chan%u\n", + note->chm_chanid); + return; + } + + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u rescinded\n", + note->chm_chanid); + } + + chan = sc->vmbus_chmap[note->chm_chanid]; + if (chan == NULL) + return; + sc->vmbus_chmap[note->chm_chanid] = NULL; + + taskqueue_enqueue(taskqueue_thread, &chan->ch_detach_task); +} + +static void +vmbus_chan_detach_task(void *xchan, int pending __unused) +{ + struct hv_vmbus_channel *chan = xchan; + + if (VMBUS_CHAN_ISPRIMARY(chan)) { + /* Only primary channel owns the device */ + hv_vmbus_child_device_unregister(chan); + /* NOTE: DO NOT free primary channel for now */ + } else { + struct vmbus_softc *sc = chan->vmbus_sc; + struct hv_vmbus_channel *pri_chan = chan->ch_prichan; + struct vmbus_chanmsg_chfree *req; + struct vmbus_msghc *mh; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chfree(chan%u)\n", + chan->ch_id); + goto remove; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; + req->chm_chanid = chan->ch_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "chfree(chan%u) failed: %d", + chan->ch_id, error); + /* NOTE: Move on! */ + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u freed\n", + chan->ch_id); + } + } +remove: + mtx_lock(&pri_chan->ch_subchan_lock); + TAILQ_REMOVE(&pri_chan->ch_subchans, chan, ch_sublink); + KASSERT(pri_chan->ch_subchan_cnt > 0, + ("invalid subchan_cnt %d", pri_chan->ch_subchan_cnt)); + pri_chan->ch_subchan_cnt--; + mtx_unlock(&pri_chan->ch_subchan_lock); + wakeup(pri_chan); + + vmbus_chan_free(chan); + } +} + +/* + * Detach all devices and destroy the corresponding primary channels. + */ +void +vmbus_chan_destroy_all(struct vmbus_softc *sc) +{ + struct hv_vmbus_channel *chan; + + mtx_lock(&sc->vmbus_prichan_lock); + while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) { + KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); + TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); + mtx_unlock(&sc->vmbus_prichan_lock); + + hv_vmbus_child_device_unregister(chan); + vmbus_chan_free(chan); + + mtx_lock(&sc->vmbus_prichan_lock); + } + bzero(sc->vmbus_chmap, + sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX); + mtx_unlock(&sc->vmbus_prichan_lock); +} + +/** + * @brief Select the best outgoing channel + * + * The channel whose vcpu binding is closest to the currect vcpu will + * be selected. + * If no multi-channel, always select primary channel + * + * @param primary - primary channel + */ +struct hv_vmbus_channel * +vmbus_select_outgoing_channel(struct hv_vmbus_channel *primary) +{ + hv_vmbus_channel *new_channel = NULL; + hv_vmbus_channel *outgoing_channel = primary; + int old_cpu_distance = 0; + int new_cpu_distance = 0; + int cur_vcpu = 0; + int smp_pro_id = PCPU_GET(cpuid); + + if (TAILQ_EMPTY(&primary->ch_subchans)) { + return outgoing_channel; + } + + if (smp_pro_id >= MAXCPU) { + return outgoing_channel; + } + + cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); + + /* XXX need lock */ + TAILQ_FOREACH(new_channel, &primary->ch_subchans, ch_sublink) { + if ((new_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) { + continue; + } + + if (new_channel->target_vcpu == cur_vcpu){ + return new_channel; + } + + old_cpu_distance = ((outgoing_channel->target_vcpu > cur_vcpu) ? + (outgoing_channel->target_vcpu - cur_vcpu) : + (cur_vcpu - outgoing_channel->target_vcpu)); + + new_cpu_distance = ((new_channel->target_vcpu > cur_vcpu) ? + (new_channel->target_vcpu - cur_vcpu) : + (cur_vcpu - new_channel->target_vcpu)); + + if (old_cpu_distance < new_cpu_distance) { + continue; + } + + outgoing_channel = new_channel; + } + + return(outgoing_channel); +} + +struct hv_vmbus_channel ** +vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt) +{ + struct hv_vmbus_channel **ret, *chan; + int i; + + ret = malloc(subchan_cnt * sizeof(struct hv_vmbus_channel *), M_TEMP, + M_WAITOK); + + mtx_lock(&pri_chan->ch_subchan_lock); + + while (pri_chan->ch_subchan_cnt < subchan_cnt) + mtx_sleep(pri_chan, &pri_chan->ch_subchan_lock, 0, "subch", 0); + + i = 0; + TAILQ_FOREACH(chan, &pri_chan->ch_subchans, ch_sublink) { + /* TODO: refcnt chan */ + ret[i] = chan; + + ++i; + if (i == subchan_cnt) + break; + } + KASSERT(i == subchan_cnt, ("invalid subchan count %d, should be %d", + pri_chan->ch_subchan_cnt, subchan_cnt)); + + mtx_unlock(&pri_chan->ch_subchan_lock); + + return ret; +} + +void +vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt __unused) +{ + + free(subchan, M_TEMP); +} + +void +vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan) +{ + mtx_lock(&pri_chan->ch_subchan_lock); + while (pri_chan->ch_subchan_cnt > 0) + mtx_sleep(pri_chan, &pri_chan->ch_subchan_lock, 0, "dsubch", 0); + mtx_unlock(&pri_chan->ch_subchan_lock); +} + +void +vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg) +{ + vmbus_chanmsg_proc_t msg_proc; + uint32_t msg_type; + + msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; + KASSERT(msg_type < VMBUS_CHANMSG_TYPE_MAX, + ("invalid message type %u", msg_type)); + + msg_proc = vmbus_chan_msgprocs[msg_type]; + if (msg_proc != NULL) + msg_proc(sc, msg); +} Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 02:02:44 2016 (r307450) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 02:12:49 2016 (r307451) @@ -98,7 +98,12 @@ static int vmbus_req_channels(struct v static void vmbus_disconnect(struct vmbus_softc *); static int vmbus_scan(struct vmbus_softc *); static void vmbus_scan_wait(struct vmbus_softc *); +static void vmbus_scan_newchan(struct vmbus_softc *); static void vmbus_scan_newdev(struct vmbus_softc *); +static void vmbus_scan_done(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_chanmsg_handle(struct vmbus_softc *, + const struct vmbus_message *); static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); @@ -122,6 +127,12 @@ static const uint32_t vmbus_version[] = VMBUS_VERSION_WS2008 }; +static const vmbus_chanmsg_proc_t +vmbus_chanmsg_handlers[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER_DONE, vmbus_scan_done), + VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) +}; + static struct vmbus_msghc * vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) { @@ -480,7 +491,7 @@ vmbus_req_channels(struct vmbus_softc *s return error; } -void +static void vmbus_scan_newchan(struct vmbus_softc *sc) { mtx_lock(&sc->vmbus_scan_lock); @@ -489,8 +500,9 @@ vmbus_scan_newchan(struct vmbus_softc *s mtx_unlock(&sc->vmbus_scan_lock); } -void -vmbus_scan_done(struct vmbus_softc *sc) +static void +vmbus_scan_done(struct vmbus_softc *sc, + const struct vmbus_message *msg __unused) { mtx_lock(&sc->vmbus_scan_lock); sc->vmbus_scan_chcnt |= VMBUS_SCAN_CHCNT_DONE; @@ -560,6 +572,27 @@ vmbus_scan(struct vmbus_softc *sc) } static void +vmbus_chanmsg_handle(struct vmbus_softc *sc, const struct vmbus_message *msg) +{ + vmbus_chanmsg_proc_t msg_proc; + uint32_t msg_type; + + msg_type = ((const struct vmbus_chanmsg_hdr *)msg->msg_data)->chm_type; + if (msg_type >= VMBUS_CHANMSG_TYPE_MAX) { + device_printf(sc->vmbus_dev, "unknown message type 0x%x\n", + msg_type); + return; + } + + msg_proc = vmbus_chanmsg_handlers[msg_type]; + if (msg_proc != NULL) + msg_proc(sc, msg); + + /* Channel specific processing */ + vmbus_chan_msgproc(sc, msg); +} + +static void vmbus_msg_task(void *xsc, int pending __unused) { struct vmbus_softc *sc = xsc; @@ -572,7 +605,7 @@ vmbus_msg_task(void *xsc, int pending __ break; } else if (msg->msg_type == HYPERV_MSGTYPE_CHANNEL) { /* Channel message */ - vmbus_chan_msgproc(sc, + vmbus_chanmsg_handle(sc, __DEVOLATILE(const struct vmbus_message *, msg)); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 02:02:44 2016 (r307450) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 02:12:49 2016 (r307451) @@ -52,6 +52,17 @@ #define VMBUS_CONNID_MESSAGE 1 #define VMBUS_CONNID_EVENT 2 +struct vmbus_message; +struct vmbus_softc; + +typedef void (*vmbus_chanmsg_proc_t)(struct vmbus_softc *, + const struct vmbus_message *); + +#define VMBUS_CHANMSG_PROC(name, func) \ + [VMBUS_CHANMSG_TYPE_##name] = func +#define VMBUS_CHANMSG_PROC_WAKEUP(name) \ + VMBUS_CHANMSG_PROC(name, vmbus_msghc_wakeup) + struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ @@ -151,9 +162,6 @@ const struct vmbus_message *vmbus_msghc_ void vmbus_msghc_wakeup(struct vmbus_softc *, const struct vmbus_message *); void vmbus_msghc_reset(struct vmbus_msghc *, size_t); -void vmbus_scan_done(struct vmbus_softc *); -void vmbus_scan_newchan(struct vmbus_softc *); - uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); #endif /* !_VMBUS_VAR_H_ */ Modified: stable/11/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/11/sys/modules/hyperv/vmbus/Makefile Mon Oct 17 02:02:44 2016 (r307450) +++ stable/11/sys/modules/hyperv/vmbus/Makefile Mon Oct 17 02:12:49 2016 (r307451) @@ -5,7 +5,6 @@ KMOD= hv_vmbus SRCS= hv_channel.c \ - hv_channel_mgmt.c \ hv_ring_buffer.c \ hyperv.c \ hyperv_busdma.c \ From owner-svn-src-all@freebsd.org Mon Oct 17 02:19:56 2016 Return-Path: Delivered-To: svn-src-all@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 AF4FFC1348B; Mon, 17 Oct 2016 02:19:56 +0000 (UTC) (envelope-from sephe@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 821F01989; Mon, 17 Oct 2016 02:19:56 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2JtV8088889; Mon, 17 Oct 2016 02:19:55 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2JtW5088884; Mon, 17 Oct 2016 02:19:55 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170219.u9H2JtW5088884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:19: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: r307452 - stable/11/sys/dev/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:19:56 -0000 Author: sephe Date: Mon Oct 17 02:19:55 2016 New Revision: 307452 URL: https://svnweb.freebsd.org/changeset/base/307452 Log: MFC 302867-302870 302867 hyperv/vmbus: Remove unused struct Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7127 302868 hyperv/vmbus: Function rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7129 302869 hyperv/vmbus: Remove unused function definition/declaration. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7131 302870 hyperv/vmbus: Use iovec for bufring scatter/gather list. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7134 Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:12:49 2016 (r307451) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:19:55 2016 (r307452) @@ -616,7 +616,7 @@ hv_vmbus_channel_send_packet( uint64_t aligned_data; uint32_t packet_len_aligned; boolean_t need_sig; - hv_vmbus_sg_buffer_list buffer_list[3]; + struct iovec iov[3]; packet_len = sizeof(hv_vm_packet_descriptor) + buffer_len; packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); @@ -630,17 +630,16 @@ hv_vmbus_channel_send_packet( desc.length8 = (uint16_t) (packet_len_aligned >> 3); desc.transaction_id = request_id; - buffer_list[0].data = &desc; - buffer_list[0].length = sizeof(hv_vm_packet_descriptor); + iov[0].iov_base = &desc; + iov[0].iov_len = sizeof(hv_vm_packet_descriptor); - buffer_list[1].data = buffer; - buffer_list[1].length = buffer_len; + iov[1].iov_base = buffer; + iov[1].iov_len = buffer_len; - buffer_list[2].data = &aligned_data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = &aligned_data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) @@ -668,7 +667,7 @@ hv_vmbus_channel_send_packet_pagebuffer( uint32_t packet_len; uint32_t page_buflen; uint32_t packetLen_aligned; - hv_vmbus_sg_buffer_list buffer_list[4]; + struct iovec iov[4]; hv_vmbus_channel_packet_page_buffer desc; uint32_t descSize; uint64_t alignedData = 0; @@ -694,20 +693,19 @@ hv_vmbus_channel_send_packet_pagebuffer( desc.transaction_id = request_id; desc.range_count = page_count; - buffer_list[0].data = &desc; - buffer_list[0].length = descSize; + iov[0].iov_base = &desc; + iov[0].iov_len = descSize; - buffer_list[1].data = page_buffers; - buffer_list[1].length = page_buflen; + iov[1].iov_base = page_buffers; + iov[1].iov_len = page_buflen; - buffer_list[2].data = buffer; - buffer_list[2].length = buffer_len; + iov[2].iov_base = buffer; + iov[2].iov_len = buffer_len; - buffer_list[3].data = &alignedData; - buffer_list[3].length = packetLen_aligned - packet_len; + iov[3].iov_base = &alignedData; + iov[3].iov_len = packetLen_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 4, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 4, &need_sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) @@ -735,7 +733,7 @@ hv_vmbus_channel_send_packet_multipagebu uint32_t packet_len_aligned; uint32_t pfn_count; uint64_t aligned_data = 0; - hv_vmbus_sg_buffer_list buffer_list[3]; + struct iovec iov[3]; hv_vmbus_channel_packet_multipage_buffer desc; pfn_count = @@ -772,17 +770,16 @@ hv_vmbus_channel_send_packet_multipagebu memcpy(desc.range.pfn_array, multi_page_buffer->pfn_array, pfn_count * sizeof(uint64_t)); - buffer_list[0].data = &desc; - buffer_list[0].length = desc_size; + iov[0].iov_base = &desc; + iov[0].iov_len = desc_size; - buffer_list[1].data = buffer; - buffer_list[1].length = buffer_len; + iov[1].iov_base = buffer; + iov[1].iov_len = buffer_len; - buffer_list[2].data = &aligned_data; - buffer_list[2].length = packet_len_aligned - packet_len; + iov[2].iov_base = &aligned_data; + iov[2].iov_len = packet_len_aligned - packet_len; - ret = hv_ring_buffer_write(&channel->outbound, buffer_list, 3, - &need_sig); + ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig); /* TODO: We should determine if this is optional */ if (ret == 0 && need_sig) @@ -1233,7 +1230,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ * Error is ignored here; don't have much to do if error * really happens. */ - hv_vmbus_child_device_register(chan); + vmbus_add_child(chan); } } @@ -1274,7 +1271,7 @@ vmbus_chan_detach_task(void *xchan, int if (VMBUS_CHAN_ISPRIMARY(chan)) { /* Only primary channel owns the device */ - hv_vmbus_child_device_unregister(chan); + vmbus_delete_child(chan); /* NOTE: DO NOT free primary channel for now */ } else { struct vmbus_softc *sc = chan->vmbus_sc; @@ -1336,7 +1333,7 @@ vmbus_chan_destroy_all(struct vmbus_soft TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); mtx_unlock(&sc->vmbus_prichan_lock); - hv_vmbus_child_device_unregister(chan); + vmbus_delete_child(chan); vmbus_chan_free(chan); mtx_lock(&sc->vmbus_prichan_lock); Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 02:12:49 2016 (r307451) +++ stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 02:19:55 2016 (r307452) @@ -252,7 +252,7 @@ hv_ring_buffer_needsig_on_write( static uint32_t copy_to_ring_buffer( hv_vmbus_ring_buffer_info* ring_info, uint32_t start_write_offset, - char* src, + const uint8_t *src, uint32_t src_len); static uint32_t copy_from_ring_buffer( @@ -261,16 +261,6 @@ static uint32_t copy_from_ring_buffer( uint32_t dest_len, uint32_t start_read_offset); - -/** - * @brief Get the interrupt mask for the specified ring buffer. - */ -uint32_t -hv_vmbus_get_ring_buffer_interrupt_mask(hv_vmbus_ring_buffer_info *rbi) -{ - return rbi->ring_buffer->interrupt_mask; -} - /** * @brief Initialize the ring buffer. */ @@ -307,8 +297,8 @@ void hv_ring_buffer_cleanup(hv_vmbus_rin int hv_ring_buffer_write( hv_vmbus_ring_buffer_info* out_ring_info, - hv_vmbus_sg_buffer_list sg_buffers[], - uint32_t sg_buffer_count, + const struct iovec iov[], + uint32_t iovlen, boolean_t *need_sig) { int i = 0; @@ -320,8 +310,8 @@ hv_ring_buffer_write( volatile uint32_t next_write_location; uint64_t prev_indices = 0; - for (i = 0; i < sg_buffer_count; i++) { - total_bytes_to_write += sg_buffers[i].length; + for (i = 0; i < iovlen; i++) { + total_bytes_to_write += iov[i].iov_len; } total_bytes_to_write += sizeof(uint64_t); @@ -350,10 +340,9 @@ hv_ring_buffer_write( old_write_location = next_write_location; - for (i = 0; i < sg_buffer_count; i++) { + for (i = 0; i < iovlen; i++) { next_write_location = copy_to_ring_buffer(out_ring_info, - next_write_location, (char *) sg_buffers[i].data, - sg_buffers[i].length); + next_write_location, iov[i].iov_base, iov[i].iov_len); } /* @@ -492,11 +481,11 @@ hv_ring_buffer_read( * * Assume there is enough room. Handles wrap-around in dest case only! */ -uint32_t +static uint32_t copy_to_ring_buffer( hv_vmbus_ring_buffer_info* ring_info, uint32_t start_write_offset, - char* src, + const uint8_t *src, uint32_t src_len) { char *ring_buffer = get_ring_buffer(ring_info); Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 02:12:49 2016 (r307451) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 02:19:55 2016 (r307452) @@ -35,39 +35,12 @@ #include #include #include +#include #include struct vmbus_softc; -typedef struct { - void* data; - uint32_t length; -} hv_vmbus_sg_buffer_list; - -typedef struct { - uint32_t current_interrupt_mask; - uint32_t current_read_index; - uint32_t current_write_index; - uint32_t bytes_avail_to_read; - uint32_t bytes_avail_to_write; -} hv_vmbus_ring_buffer_debug_info; - -typedef struct { - uint32_t rel_id; - struct hyperv_guid interface_type; - struct hyperv_guid interface_instance; - uint32_t monitor_id; - uint32_t server_monitor_pending; - uint32_t server_monitor_latency; - uint32_t server_monitor_connection_id; - uint32_t client_monitor_pending; - uint32_t client_monitor_latency; - uint32_t client_monitor_connection_id; - hv_vmbus_ring_buffer_debug_info inbound; - hv_vmbus_ring_buffer_debug_info outbound; -} hv_vmbus_channel_debug_info; - /* * The format must be the same as hv_vm_data_gpa_direct */ @@ -118,8 +91,8 @@ void hv_ring_buffer_cleanup( int hv_ring_buffer_write( hv_vmbus_ring_buffer_info *ring_info, - hv_vmbus_sg_buffer_list sg_buffers[], - uint32_t sg_buff_count, + const struct iovec iov[], + uint32_t iovlen, boolean_t *need_sig); int hv_ring_buffer_peek( @@ -133,22 +106,10 @@ int hv_ring_buffer_read( uint32_t buffer_len, uint32_t offset); -uint32_t hv_vmbus_get_ring_buffer_interrupt_mask( - hv_vmbus_ring_buffer_info *ring_info); - -void hv_vmbus_dump_ring_info( - hv_vmbus_ring_buffer_info *ring_info, - char *prefix); - void hv_ring_buffer_read_begin( hv_vmbus_ring_buffer_info *ring_info); uint32_t hv_ring_buffer_read_end( hv_vmbus_ring_buffer_info *ring_info); -int hv_vmbus_child_device_register( - struct hv_vmbus_channel *chan); -int hv_vmbus_child_device_unregister( - struct hv_vmbus_channel *chan); - #endif /* __HYPERV_PRIV_H__ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 02:12:49 2016 (r307451) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 02:19:55 2016 (r307452) @@ -1021,7 +1021,7 @@ vmbus_child_pnpinfo_str(device_t dev, de } int -hv_vmbus_child_device_register(struct hv_vmbus_channel *chan) +vmbus_add_child(struct hv_vmbus_channel *chan) { struct vmbus_softc *sc = chan->vmbus_sc; device_t parent = sc->vmbus_dev; @@ -1046,7 +1046,7 @@ done: } int -hv_vmbus_child_device_unregister(struct hv_vmbus_channel *chan) +vmbus_delete_child(struct hv_vmbus_channel *chan) { int error; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 02:12:49 2016 (r307451) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 02:19:55 2016 (r307452) @@ -146,6 +146,8 @@ struct vmbus_msghc; void vmbus_event_proc(struct vmbus_softc *, int); void vmbus_event_proc_compat(struct vmbus_softc *, int); void vmbus_handle_intr(struct trapframe *); +int vmbus_add_child(struct hv_vmbus_channel *); +int vmbus_delete_child(struct hv_vmbus_channel *); void vmbus_et_intr(struct trapframe *); From owner-svn-src-all@freebsd.org Mon Oct 17 02:23:06 2016 Return-Path: Delivered-To: svn-src-all@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 D24D1C13759; Mon, 17 Oct 2016 02:23:06 +0000 (UTC) (envelope-from sephe@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 AEAF81D54; Mon, 17 Oct 2016 02:23:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2N5Zq092486; Mon, 17 Oct 2016 02:23:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2N5TW092484; Mon, 17 Oct 2016 02:23:05 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170223.u9H2N5TW092484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:23: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: r307453 - in stable/11/sys/dev/hyperv: include 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:23:06 -0000 Author: sephe Date: Mon Oct 17 02:23:05 2016 New Revision: 307453 URL: https://svnweb.freebsd.org/changeset/base/307453 Log: MFC 302871,302872 302871 hyperv/vmbus: Add vmbus_chan_gpadl_connect, which takes GPA physaddr Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7139 302872 hyperv/vmbus: Busdma-fy channel bufring. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7140 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:19:55 2016 (r307452) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:23:05 2016 (r307453) @@ -257,13 +257,6 @@ typedef struct hv_vmbus_channel { int ch_montrig_idx; /* MNF trig index */ uint32_t ch_montrig_mask;/* MNF trig mask */ - uint32_t ring_buffer_gpadl_handle; - /* - * Allocated memory for ring buffer - */ - void* ring_buffer_pages; - unsigned long ring_buffer_size; - uint32_t ring_buffer_page_count; /* * send to parent */ @@ -312,6 +305,10 @@ typedef struct hv_vmbus_channel { void *hv_chan_priv2; void *hv_chan_priv3; + void *ch_bufring; /* TX+RX bufrings */ + struct hyperv_dma ch_bufring_dma; + uint32_t ch_bufring_gpadl; + struct task ch_detach_task; TAILQ_ENTRY(hv_vmbus_channel) ch_prilink; /* primary chan link */ uint32_t ch_subidx; /* subchan index */ @@ -409,6 +406,9 @@ int hv_vmbus_channel_teardown_gpdal( hv_vmbus_channel* channel, uint32_t gpadl_handle); +int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); + struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:19:55 2016 (r307452) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:23:05 2016 (r307453) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -202,7 +203,7 @@ hv_vmbus_channel_open( struct vmbus_msghc *mh; uint32_t status; int ret = 0; - void *in, *out; + uint8_t *br; if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, @@ -210,6 +211,10 @@ hv_vmbus_channel_open( user_data_len, new_channel->ch_id); return EINVAL; } + KASSERT((send_ring_buffer_size & PAGE_MASK) == 0, + ("send bufring size is not multiple page")); + KASSERT((recv_ring_buffer_size & PAGE_MASK) == 0, + ("recv bufring size is not multiple page")); if (atomic_testandset_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED_SHIFT)) @@ -230,46 +235,43 @@ hv_vmbus_channel_open( vmbus_chan_task_nobatch, new_channel); } - /* Allocate the ring buffer */ - out = contigmalloc((send_ring_buffer_size + recv_ring_buffer_size), - M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); - KASSERT(out != NULL, - ("Error VMBUS: contigmalloc failed to allocate Ring Buffer!")); - if (out == NULL) { + /* + * Allocate the TX+RX bufrings. + * XXX should use ch_dev dtag + */ + br = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, send_ring_buffer_size + recv_ring_buffer_size, + &new_channel->ch_bufring_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (br == NULL) { + device_printf(sc->vmbus_dev, "bufring allocation failed\n"); ret = ENOMEM; goto failed; } + new_channel->ch_bufring = br; - in = ((uint8_t *) out + send_ring_buffer_size); - - new_channel->ring_buffer_pages = out; - new_channel->ring_buffer_page_count = (send_ring_buffer_size + - recv_ring_buffer_size) >> PAGE_SHIFT; - new_channel->ring_buffer_size = send_ring_buffer_size + - recv_ring_buffer_size; - - hv_vmbus_ring_buffer_init( - &new_channel->outbound, - out, - send_ring_buffer_size); - - hv_vmbus_ring_buffer_init( - &new_channel->inbound, - in, - recv_ring_buffer_size); + /* TX bufring comes first */ + hv_vmbus_ring_buffer_init(&new_channel->outbound, + br, send_ring_buffer_size); + /* RX bufring immediately follows TX bufring */ + hv_vmbus_ring_buffer_init(&new_channel->inbound, + br + send_ring_buffer_size, recv_ring_buffer_size); /* Create sysctl tree for this channel */ vmbus_channel_sysctl_create(new_channel); - /** - * Establish the gpadl for the ring buffer + /* + * Connect the bufrings, both RX and TX, to this channel. */ - new_channel->ring_buffer_gpadl_handle = 0; - - ret = hv_vmbus_channel_establish_gpadl(new_channel, - new_channel->outbound.ring_buffer, + ret = vmbus_chan_gpadl_connect(new_channel, + new_channel->ch_bufring_dma.hv_paddr, send_ring_buffer_size + recv_ring_buffer_size, - &new_channel->ring_buffer_gpadl_handle); + &new_channel->ch_bufring_gpadl); + if (ret != 0) { + device_printf(sc->vmbus_dev, + "failed to connect bufring GPADL to chan%u\n", + new_channel->ch_id); + goto failed; + } /* * Open channel w/ the bufring GPADL on the target CPU. @@ -287,7 +289,7 @@ hv_vmbus_channel_open( req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; req->chm_chanid = new_channel->ch_id; req->chm_openid = new_channel->ch_id; - req->chm_gpadl = new_channel->ring_buffer_gpadl_handle; + req->chm_gpadl = new_channel->ch_bufring_gpadl; req->chm_vcpuid = new_channel->target_vcpu; req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; if (user_data_len) @@ -321,6 +323,16 @@ hv_vmbus_channel_open( ret = ENXIO; failed: + if (new_channel->ch_bufring_gpadl) { + hv_vmbus_channel_teardown_gpdal(new_channel, + new_channel->ch_bufring_gpadl); + new_channel->ch_bufring_gpadl = 0; + } + if (new_channel->ch_bufring != NULL) { + hyperv_dmamem_free(&new_channel->ch_bufring_dma, + new_channel->ch_bufring); + new_channel->ch_bufring = NULL; + } atomic_clear_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED); return ret; } @@ -330,26 +342,33 @@ failed: */ int hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel, - void *contig_buffer, uint32_t size, uint32_t *gpadl0) + void *contig_buffer, uint32_t size, uint32_t *gpadl) { - struct vmbus_softc *sc = channel->vmbus_sc; + return vmbus_chan_gpadl_connect(channel, + hv_get_phys_addr(contig_buffer), size, gpadl); +} + +int +vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, + int size, uint32_t *gpadl0) +{ + struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_gpadl_conn *req; const struct vmbus_message *msg; size_t reqsz; uint32_t gpadl, status; int page_count, range_len, i, cnt, error; - uint64_t page_id, paddr; + uint64_t page_id; /* * Preliminary checks. */ KASSERT((size & PAGE_MASK) == 0, - ("invalid GPA size %u, not multiple page size", size)); + ("invalid GPA size %d, not multiple page size", size)); page_count = size >> PAGE_SHIFT; - paddr = hv_get_phys_addr(contig_buffer); KASSERT((paddr & PAGE_MASK) == 0, ("GPA is not page aligned %jx", (uintmax_t)paddr)); page_id = paddr >> PAGE_SHIFT; @@ -390,13 +409,13 @@ hv_vmbus_channel_establish_gpadl(struct if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for gpadl->chan%u\n", - channel->ch_id); + chan->ch_id); return EIO; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; - req->chm_chanid = channel->ch_id; + req->chm_chanid = chan->ch_id; req->chm_gpadl = gpadl; req->chm_range_len = range_len; req->chm_range_cnt = 1; @@ -409,7 +428,7 @@ hv_vmbus_channel_establish_gpadl(struct if (error) { device_printf(sc->vmbus_dev, "gpadl->chan%u msg hypercall exec failed: %d\n", - channel->ch_id, error); + chan->ch_id, error); vmbus_msghc_put(sc, mh); return error; } @@ -445,12 +464,12 @@ hv_vmbus_channel_establish_gpadl(struct if (status != 0) { device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " - "status %u\n", channel->ch_id, status); + "status %u\n", chan->ch_id, status); return EIO; } else { if (bootverbose) { device_printf(sc->vmbus_dev, "gpadl->chan%u " - "succeeded\n", channel->ch_id); + "succeeded\n", chan->ch_id); } } return 0; @@ -547,9 +566,10 @@ hv_vmbus_channel_close_internal(hv_vmbus } /* Tear down the gpadl for the channel's ring buffer */ - if (channel->ring_buffer_gpadl_handle) { + if (channel->ch_bufring_gpadl) { hv_vmbus_channel_teardown_gpdal(channel, - channel->ring_buffer_gpadl_handle); + channel->ch_bufring_gpadl); + channel->ch_bufring_gpadl = 0; } /* TODO: Send a msg to release the childRelId */ @@ -558,8 +578,11 @@ hv_vmbus_channel_close_internal(hv_vmbus hv_ring_buffer_cleanup(&channel->outbound); hv_ring_buffer_cleanup(&channel->inbound); - contigfree(channel->ring_buffer_pages, channel->ring_buffer_size, - M_DEVBUF); + if (channel->ch_bufring != NULL) { + hyperv_dmamem_free(&channel->ch_bufring_dma, + channel->ch_bufring); + channel->ch_bufring = NULL; + } } /* From owner-svn-src-all@freebsd.org Mon Oct 17 02:25:44 2016 Return-Path: Delivered-To: svn-src-all@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 A2B9FC137D7; Mon, 17 Oct 2016 02:25:44 +0000 (UTC) (envelope-from sephe@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 6303D1EE1; Mon, 17 Oct 2016 02:25:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2PhWT092630; Mon, 17 Oct 2016 02:25:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2PhvA092627; Mon, 17 Oct 2016 02:25:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170225.u9H2PhvA092627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:25:43 +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: r307454 - in stable/11/sys/dev/hyperv: include 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:25:44 -0000 Author: sephe Date: Mon Oct 17 02:25:43 2016 New Revision: 307454 URL: https://svnweb.freebsd.org/changeset/base/307454 Log: MFC 302873,302874 302873 hyperv/vmbus: Set vcpuid to 0, if MSR_HV_VP_INDEX does not exist. Mainly for compatibility. While I'm here, rename cpuid related fields in hv_vmbus_channel. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7141 302874 hyperv/vmbus: Field rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7146 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/vmbus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:23:05 2016 (r307453) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:25:43 2016 (r307454) @@ -242,7 +242,7 @@ typedef struct { uint32_t ring_data_size; /* ring_size */ } hv_vmbus_ring_buffer_info; -typedef void (*hv_vmbus_pfn_channel_callback)(void *context); +typedef void (*vmbus_chan_callback_t)(void *); typedef struct hv_vmbus_channel { device_t ch_dev; @@ -266,24 +266,21 @@ typedef struct hv_vmbus_channel { */ hv_vmbus_ring_buffer_info inbound; - struct taskqueue * rxq; - struct task channel_task; - hv_vmbus_pfn_channel_callback on_channel_callback; - void* channel_callback_context; + struct taskqueue *ch_tq; + struct task ch_task; + vmbus_chan_callback_t ch_cb; + void *ch_cbarg; struct hyperv_mon_param *ch_monprm; struct hyperv_dma ch_monprm_dma; + int ch_cpuid; /* owner cpu */ /* - * From Win8, this field specifies the target virtual process - * on which to deliver the interrupt from the host to guest. - * Before Win8, all channel interrupts would only be - * delivered on cpu 0. Setting this value to 0 would preserve - * the earlier behavior. - */ - uint32_t target_vcpu; - /* The corresponding CPUID in the guest */ - uint32_t target_cpu; + * Virtual cpuid for ch_cpuid; it is used to communicate cpuid + * related information w/ Hyper-V. If MSR_HV_VP_INDEX does not + * exist, ch_vcpuid will always be 0 for compatibility. + */ + uint32_t ch_vcpuid; /* * If this is a primary channel, ch_subchan* fields @@ -365,9 +362,8 @@ int hv_vmbus_channel_open( uint32_t recv_ring_buffer_size, void* user_data, uint32_t user_data_len, - hv_vmbus_pfn_channel_callback - pfn_on_channel_callback, - void* context); + vmbus_chan_callback_t cb, + void *cbarg); void hv_vmbus_channel_close(hv_vmbus_channel *channel); Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:23:05 2016 (r307453) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:25:43 2016 (r307454) @@ -157,7 +157,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha &channel->ch_id, 0, "channel id"); } SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "cpu", CTLFLAG_RD, &channel->target_cpu, 0, "owner CPU id"); + "cpu", CTLFLAG_RD, &channel->ch_cpuid, 0, "owner CPU id"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, "monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, channel, 0, vmbus_channel_sysctl_monalloc, "I", @@ -193,8 +193,8 @@ hv_vmbus_channel_open( uint32_t recv_ring_buffer_size, void* user_data, uint32_t user_data_len, - hv_vmbus_pfn_channel_callback pfn_on_channel_callback, - void* context) + vmbus_chan_callback_t cb, + void *cbarg) { struct vmbus_softc *sc = new_channel->vmbus_sc; const struct vmbus_chanmsg_chopen_resp *resp; @@ -220,19 +220,19 @@ hv_vmbus_channel_open( VMBUS_CHAN_ST_OPENED_SHIFT)) panic("double-open chan%u", new_channel->ch_id); - new_channel->on_channel_callback = pfn_on_channel_callback; - new_channel->channel_callback_context = context; + new_channel->ch_cb = cb; + new_channel->ch_cbarg = cbarg; vmbus_chan_update_evtflagcnt(sc, new_channel); - new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, - new_channel->target_cpu); + new_channel->ch_tq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, + new_channel->ch_cpuid); if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { - TASK_INIT(&new_channel->channel_task, 0, - vmbus_chan_task, new_channel); + TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task, + new_channel); } else { - TASK_INIT(&new_channel->channel_task, 0, - vmbus_chan_task_nobatch, new_channel); + TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task_nobatch, + new_channel); } /* @@ -290,7 +290,7 @@ hv_vmbus_channel_open( req->chm_chanid = new_channel->ch_id; req->chm_openid = new_channel->ch_id; req->chm_gpadl = new_channel->ch_bufring_gpadl; - req->chm_vcpuid = new_channel->target_vcpu; + req->chm_vcpuid = new_channel->ch_vcpuid; req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; if (user_data_len) memcpy(req->chm_udata, user_data, user_data_len); @@ -521,7 +521,7 @@ hv_vmbus_channel_close_internal(hv_vmbus struct vmbus_softc *sc = channel->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; - struct taskqueue *rxq = channel->rxq; + struct taskqueue *tq = channel->ch_tq; int error; /* TODO: stringent check */ @@ -530,11 +530,11 @@ hv_vmbus_channel_close_internal(hv_vmbus sysctl_ctx_free(&channel->ch_sysctl_ctx); /* - * set rxq to NULL to avoid more requests be scheduled + * Set ch_tq to NULL to avoid more requests be scheduled */ - channel->rxq = NULL; - taskqueue_drain(rxq, &channel->channel_task); - channel->on_channel_callback = NULL; + channel->ch_tq = NULL; + taskqueue_drain(tq, &channel->ch_task); + channel->ch_cb = NULL; /** * Send a closing message @@ -895,11 +895,8 @@ static void vmbus_chan_task(void *xchan, int pending __unused) { struct hv_vmbus_channel *chan = xchan; - void (*callback)(void *); - void *arg; - - arg = chan->channel_callback_context; - callback = chan->on_channel_callback; + vmbus_chan_callback_t cb = chan->ch_cb; + void *cbarg = chan->ch_cbarg; /* * Optimize host to guest signaling by ensuring: @@ -916,7 +913,7 @@ vmbus_chan_task(void *xchan, int pending for (;;) { uint32_t left; - callback(arg); + cb(cbarg); left = hv_ring_buffer_read_end(&chan->inbound); if (left == 0) { @@ -932,7 +929,7 @@ vmbus_chan_task_nobatch(void *xchan, int { struct hv_vmbus_channel *chan = xchan; - chan->on_channel_callback(chan->channel_callback_context); + chan->ch_cb(chan->ch_cbarg); } static __inline void @@ -961,12 +958,12 @@ vmbus_event_flags_proc(struct vmbus_soft channel = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ - if (channel == NULL || channel->rxq == NULL) + if (channel == NULL || channel->ch_tq == NULL) continue; if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) hv_ring_buffer_read_begin(&channel->inbound); - taskqueue_enqueue(channel->rxq, &channel->channel_task); + taskqueue_enqueue(channel->ch_tq, &channel->ch_task); } } } @@ -1005,7 +1002,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu int flag_cnt; flag_cnt = (chan->ch_id / VMBUS_EVTFLAG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->target_cpu); + flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->ch_cpuid); for (;;) { int old_flag_cnt; @@ -1017,8 +1014,7 @@ vmbus_chan_update_evtflagcnt(struct vmbu if (bootverbose) { device_printf(sc->vmbus_dev, "channel%u update cpu%d flag_cnt to %d\n", - chan->ch_id, - chan->target_cpu, flag_cnt); + chan->ch_id, chan->ch_cpuid, flag_cnt); } break; } @@ -1162,13 +1158,12 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch cpu = 0; } - chan->target_cpu = cpu; - chan->target_vcpu = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); + chan->ch_cpuid = cpu; + chan->ch_vcpuid = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", - chan->ch_id, - chan->target_cpu, chan->target_vcpu); + chan->ch_id, chan->ch_cpuid, chan->ch_vcpuid); } } @@ -1401,17 +1396,17 @@ vmbus_select_outgoing_channel(struct hv_ continue; } - if (new_channel->target_vcpu == cur_vcpu){ + if (new_channel->ch_vcpuid == cur_vcpu){ return new_channel; } - old_cpu_distance = ((outgoing_channel->target_vcpu > cur_vcpu) ? - (outgoing_channel->target_vcpu - cur_vcpu) : - (cur_vcpu - outgoing_channel->target_vcpu)); - - new_cpu_distance = ((new_channel->target_vcpu > cur_vcpu) ? - (new_channel->target_vcpu - cur_vcpu) : - (cur_vcpu - new_channel->target_vcpu)); + old_cpu_distance = ((outgoing_channel->ch_vcpuid > cur_vcpu) ? + (outgoing_channel->ch_vcpuid - cur_vcpu) : + (cur_vcpu - outgoing_channel->ch_vcpuid)); + + new_cpu_distance = ((new_channel->ch_vcpuid > cur_vcpu) ? + (new_channel->ch_vcpuid - cur_vcpu) : + (cur_vcpu - new_channel->ch_vcpuid)); if (old_cpu_distance < new_cpu_distance) { continue; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 02:23:05 2016 (r307453) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 02:25:43 2016 (r307454) @@ -726,19 +726,11 @@ vmbus_synic_setup(void *xsc) uint32_t sint; if (hyperv_features & CPUID_HV_MSR_VP_INDEX) { - /* - * Save virtual processor id. - */ + /* Save virtual processor id. */ VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(MSR_HV_VP_INDEX); } else { - /* - * XXX - * Virtual processoor id is only used by a pretty broken - * channel selection code from storvsc. It's nothing - * critical even if CPUID_HV_MSR_VP_INDEX is not set; keep - * moving on. - */ - VMBUS_PCPU_GET(sc, vcpuid, cpu) = cpu; + /* Set virtual processor id to 0 for compatibility. */ + VMBUS_PCPU_GET(sc, vcpuid, cpu) = 0; } /* From owner-svn-src-all@freebsd.org Mon Oct 17 02:30:48 2016 Return-Path: Delivered-To: svn-src-all@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 B5A4BC13863; Mon, 17 Oct 2016 02:30:48 +0000 (UTC) (envelope-from sephe@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 42C3C107B; Mon, 17 Oct 2016 02:30:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2UlPE092906; Mon, 17 Oct 2016 02:30:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2UkQb092892; Mon, 17 Oct 2016 02:30:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170230.u9H2UkQb092892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:30: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: r307455 - in stable/11/sys/dev/hyperv: include netvsc storvsc utilities 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:30:48 -0000 Author: sephe Date: Mon Oct 17 02:30:45 2016 New Revision: 307455 URL: https://svnweb.freebsd.org/changeset/base/307455 Log: MFC 302875,302876,302878-302881 302875 hyperv/vmbus: Redefine channel packet. The channel packet header will be shared w/ PRP (physical region page) list channel packet and SG (scatter gather) list channel packet. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7155 302876 hyperv/vmbus: Rework sglist sending. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7156 302878 hyeprv/vmbus: Rework prplist sending. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7175 302879 hyperv/vmbus: Move channel packet flags definition to vmbus.h Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7176 302880 hyperv/vmbus: Move channel packet types definition to vmbus.h Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7177 302881 hyperv/vmbus: Cleanup channel sending Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7178 Added: stable/11/sys/dev/hyperv/include/vmbus.h - copied, changed from r302876, head/sys/dev/hyperv/include/vmbus.h Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:30:45 2016 (r307455) @@ -82,19 +82,6 @@ typedef uint8_t hv_bool_uint8_t; #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) -#define HV_MAX_PAGE_BUFFER_COUNT 32 -#define HV_MAX_MULTIPAGE_BUFFER_COUNT 32 - -#define HV_ALIGN_UP(value, align) \ - (((value) & (align-1)) ? \ - (((value) + (align-1)) & ~(align-1) ) : (value)) - -#define HV_ALIGN_DOWN(value, align) ( (value) & ~(align-1) ) - -#define HV_NUM_PAGES_SPANNED(addr, len) \ - ((HV_ALIGN_UP(addr+len, PAGE_SIZE) - \ - HV_ALIGN_DOWN(addr, PAGE_SIZE)) >> PAGE_SHIFT ) - struct hyperv_guid { uint8_t hv_guid[16]; } __packed; @@ -125,25 +112,6 @@ typedef struct { hv_vm_transfer_page ranges[1]; } __packed hv_vm_transfer_page_packet_header; -typedef enum { - HV_VMBUS_PACKET_TYPE_INVALID = 0x0, - HV_VMBUS_PACKET_TYPES_SYNCH = 0x1, - HV_VMBUS_PACKET_TYPE_ADD_TRANSFER_PAGE_SET = 0x2, - HV_VMBUS_PACKET_TYPE_REMOVE_TRANSFER_PAGE_SET = 0x3, - HV_VMBUS_PACKET_TYPE_ESTABLISH_GPADL = 0x4, - HV_VMBUS_PACKET_TYPE_TEAR_DOWN_GPADL = 0x5, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND = 0x6, - HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES = 0x7, - HV_VMBUS_PACKET_TYPE_DATA_USING_GPADL = 0x8, - HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT = 0x9, - HV_VMBUS_PACKET_TYPE_CANCEL_REQUEST = 0xa, - HV_VMBUS_PACKET_TYPE_COMPLETION = 0xb, - HV_VMBUS_PACKET_TYPE_DATA_USING_ADDITIONAL_PACKETS = 0xc, - HV_VMBUS_PACKET_TYPE_ADDITIONAL_DATA = 0xd -} hv_vmbus_packet_type; - -#define HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1 - #define HW_MACADDR_LEN 6 /* @@ -225,18 +193,6 @@ typedef struct { } __packed hv_vmbus_ring_buffer; typedef struct { - int length; - int offset; - uint64_t pfn; -} __packed hv_vmbus_page_buffer; - -typedef struct { - int length; - int offset; - uint64_t pfn_array[HV_MAX_MULTIPAGE_BUFFER_COUNT]; -} __packed hv_vmbus_multipage_buffer; - -typedef struct { hv_vmbus_ring_buffer* ring_buffer; struct mtx ring_lock; uint32_t ring_data_size; /* ring_size */ @@ -372,23 +328,8 @@ int hv_vmbus_channel_send_packet( void* buffer, uint32_t buffer_len, uint64_t request_id, - hv_vmbus_packet_type type, - uint32_t flags); - -int hv_vmbus_channel_send_packet_pagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_page_buffer page_buffers[], - uint32_t page_count, - void* buffer, - uint32_t buffer_len, - uint64_t request_id); - -int hv_vmbus_channel_send_packet_multipagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_multipage_buffer* multi_page_buffer, - void* buffer, - uint32_t buffer_len, - uint64_t request_id); + uint16_t type, + uint16_t flags); int hv_vmbus_channel_establish_gpadl( hv_vmbus_channel* channel, Copied and modified: stable/11/sys/dev/hyperv/include/vmbus.h (from r302876, head/sys/dev/hyperv/include/vmbus.h) ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Fri Jul 15 06:29:19 2016 (r302876, copy source) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 02:30:45 2016 (r307455) @@ -31,6 +31,15 @@ #include +/* + * GPA stuffs. + */ +struct vmbus_gpa_range { + uint32_t gpa_len; + uint32_t gpa_ofs; + uint64_t gpa_page[0]; +} __packed; + /* This is actually vmbus_gpa_range.gpa_page[1] */ struct vmbus_gpa { uint32_t gpa_len; @@ -38,12 +47,23 @@ struct vmbus_gpa { uint64_t gpa_page; } __packed; -#define VMBUS_CHAN_SGLIST_MAX 32 +#define VMBUS_CHANPKT_TYPE_INBAND 0x0006 +#define VMBUS_CHANPKT_TYPE_RXBUF 0x0007 +#define VMBUS_CHANPKT_TYPE_GPA 0x0009 +#define VMBUS_CHANPKT_TYPE_COMP 0x000b + +#define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ + +#define VMBUS_CHAN_SGLIST_MAX 32 +#define VMBUS_CHAN_PRPLIST_MAX 32 struct hv_vmbus_channel; int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid); +int vmbus_chan_send_prplist(struct hv_vmbus_channel *chan, + struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, + uint64_t xactid); #endif /* !_VMBUS_H_ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:30:45 2016 (r307455) @@ -185,8 +185,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -279,8 +278,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; } @@ -340,7 +338,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); /* * If we failed here, we might as well return and have a leak @@ -408,7 +406,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, revoke_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)revoke_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); /* * If we failed here, we might as well return and have a leak * rather than continue and a bugchk @@ -474,8 +472,7 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ /* Send the init request */ ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) return (-1); @@ -518,7 +515,7 @@ hv_nv_send_ndis_config(struct hn_softc * /* Send the configuration packet */ ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); if (ret != 0) return (-EINVAL); @@ -597,15 +594,14 @@ hv_nv_connect_to_vsp(struct hn_softc *sc ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); if (ret != 0) { goto cleanup; } /* * TODO: BUGBUG - We have to wait for the above msg since the netvsp * uses KMCL which acknowledges packet (completion packet) - * since our Vmbus always set the - * HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag + * since our Vmbus always set the VMBUS_CHANPKT_FLAG_RC flag */ /* sema_wait(&NetVscChannel->channel_init_sema); */ @@ -816,15 +812,13 @@ hv_nv_on_send(struct hv_vmbus_channel *c send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_size = pkt->send_buf_section_size; - if (pkt->page_buf_count) { - ret = hv_vmbus_channel_send_packet_pagebuffer(chan, - pkt->page_buffers, pkt->page_buf_count, + if (pkt->gpa_cnt) { + ret = vmbus_chan_send_sglist(chan, pkt->gpa, pkt->gpa_cnt, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); } else { ret = hv_vmbus_channel_send_packet(chan, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); } return (ret); @@ -853,7 +847,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * All inbound packets other than send completion should be * xfer page packet. */ - if (pkt->type != HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES) { + if (pkt->type != VMBUS_CHANPKT_TYPE_RXBUF) { device_printf(dev, "packet type %d is invalid!\n", pkt->type); return; } @@ -924,7 +918,7 @@ hv_nv_on_receive_completion(struct hv_vm retry_send_cmplt: /* Send the completion */ ret = hv_vmbus_channel_send_packet(chan, &rx_comp_msg, - sizeof(nvsp_msg), tid, HV_VMBUS_PACKET_TYPE_COMPLETION, 0); + sizeof(nvsp_msg), tid, VMBUS_CHANPKT_TYPE_COMP, 0); if (ret == 0) { /* success */ /* no-op */ @@ -1009,14 +1003,14 @@ hv_nv_on_channel_callback(void *xchan) if (bytes_rxed > 0) { desc = (hv_vm_packet_descriptor *)buffer; switch (desc->type) { - case HV_VMBUS_PACKET_TYPE_COMPLETION: + case VMBUS_CHANPKT_TYPE_COMP: hv_nv_on_send_completion(net_dev, chan, desc); break; - case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: + case VMBUS_CHANPKT_TYPE_RXBUF: hv_nv_on_receive(net_dev, sc, chan, desc); break; - case HV_VMBUS_PACKET_TYPE_DATA_IN_BAND: + case VMBUS_CHANPKT_TYPE_INBAND: hv_nv_send_table(sc, desc); break; default: Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 02:30:45 2016 (r307455) @@ -57,6 +57,7 @@ #include #include +#include #define HN_USE_TXDESC_BUFRING @@ -1082,8 +1083,6 @@ struct hv_vmbus_channel; typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) -#define NETVSC_PACKET_MAXPAGE 32 - #define NETVSC_VLAN_PRIO_MASK 0xe000 #define NETVSC_VLAN_PRIO_SHIFT 13 @@ -1132,8 +1131,8 @@ typedef struct netvsc_packet_ { void *rndis_mesg; uint32_t tot_data_buf_len; void *data; - uint32_t page_buf_count; - hv_vmbus_page_buffer page_buffers[NETVSC_PACKET_MAXPAGE]; + uint32_t gpa_cnt; + struct vmbus_gpa gpa[VMBUS_CHAN_SGLIST_MAX]; } netvsc_packet; typedef struct { Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 02:30:45 2016 (r307455) @@ -154,7 +154,7 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE #define HN_TX_DATA_SEGCNT_MAX \ - (NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) + (VMBUS_CHAN_SGLIST_MAX - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) #define HN_DIRECT_TX_SIZE_DEF 128 @@ -998,7 +998,7 @@ hn_encap(struct hn_tx_ring *txr, struct packet->send_buf_section_idx = send_buf_section_idx; packet->send_buf_section_size = packet->tot_data_buf_len; - packet->page_buf_count = 0; + packet->gpa_cnt = 0; txr->hn_tx_chimney++; goto done; } @@ -1024,24 +1024,24 @@ hn_encap(struct hn_tx_ring *txr, struct } *m_head0 = m_head; - packet->page_buf_count = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; + packet->gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; /* send packet with page buffer */ - packet->page_buffers[0].pfn = atop(txd->rndis_msg_paddr); - packet->page_buffers[0].offset = txd->rndis_msg_paddr & PAGE_MASK; - packet->page_buffers[0].length = rndis_msg_size; + packet->gpa[0].gpa_page = atop(txd->rndis_msg_paddr); + packet->gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; + packet->gpa[0].gpa_len = rndis_msg_size; /* * Fill the page buffers with mbuf info starting at index * HV_RF_NUM_TX_RESERVED_PAGE_BUFS. */ for (i = 0; i < nsegs; ++i) { - hv_vmbus_page_buffer *pb = &packet->page_buffers[ + struct vmbus_gpa *gpa = &packet->gpa[ i + HV_RF_NUM_TX_RESERVED_PAGE_BUFS]; - pb->pfn = atop(segs[i].ds_addr); - pb->offset = segs[i].ds_addr & PAGE_MASK; - pb->length = segs[i].ds_len; + gpa->gpa_page = atop(segs[i].ds_addr); + gpa->gpa_ofs = segs[i].ds_addr & PAGE_MASK; + gpa->gpa_len = segs[i].ds_len; } packet->send_buf_section_idx = Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 02:30:45 2016 (r307455) @@ -248,26 +248,23 @@ hv_rf_send_request(rndis_device *device, packet->is_data_pkt = FALSE; packet->tot_data_buf_len = request->request_msg.msg_len; - packet->page_buf_count = 1; + packet->gpa_cnt = 1; - packet->page_buffers[0].pfn = + packet->gpa[0].gpa_page = hv_get_phys_addr(&request->request_msg) >> PAGE_SHIFT; - packet->page_buffers[0].length = request->request_msg.msg_len; - packet->page_buffers[0].offset = + packet->gpa[0].gpa_len = request->request_msg.msg_len; + packet->gpa[0].gpa_ofs = (unsigned long)&request->request_msg & (PAGE_SIZE - 1); - if (packet->page_buffers[0].offset + - packet->page_buffers[0].length > PAGE_SIZE) { - packet->page_buf_count = 2; - packet->page_buffers[0].length = - PAGE_SIZE - packet->page_buffers[0].offset; - packet->page_buffers[1].pfn = + if (packet->gpa[0].gpa_ofs + packet->gpa[0].gpa_len > PAGE_SIZE) { + packet->gpa_cnt = 2; + packet->gpa[0].gpa_len = PAGE_SIZE - packet->gpa[0].gpa_ofs; + packet->gpa[1].gpa_page = hv_get_phys_addr((char*)&request->request_msg + - packet->page_buffers[0].length) >> PAGE_SHIFT; - packet->page_buffers[1].offset = 0; - packet->page_buffers[1].length = - request->request_msg.msg_len - - packet->page_buffers[0].length; + packet->gpa[0].gpa_len) >> PAGE_SHIFT; + packet->gpa[1].gpa_ofs = 0; + packet->gpa[1].gpa_len = request->request_msg.msg_len - + packet->gpa[0].gpa_len; } packet->compl.send.send_completion_context = request; /* packet */ @@ -289,7 +286,7 @@ hv_rf_send_request(rndis_device *device, memcpy(dest, &request->request_msg, request->request_msg.msg_len); packet->send_buf_section_idx = send_buf_section_idx; packet->send_buf_section_size = packet->tot_data_buf_len; - packet->page_buf_count = 0; + packet->gpa_cnt = 0; goto sendit; } /* Failed to allocate chimney send buffer; move on */ @@ -1171,8 +1168,7 @@ hv_rf_on_device_add(struct hn_softc *sc, ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { device_printf(dev, "Fail to allocate subchannel\n"); goto out; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 02:30:45 2016 (r307455) @@ -74,7 +74,6 @@ typedef struct rndis_request_ { /* Simplify allocation by having a netvsc packet inline */ netvsc_packet pkt; - hv_vmbus_page_buffer buffer; /* * The max request size is sizeof(rndis_msg) + PAGE_SIZE. Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:30:45 2016 (r307455) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "hv_vstorage.h" #include "vmbus_if.h" @@ -100,7 +101,7 @@ struct hv_sgl_page_pool{ boolean_t is_init; } g_hv_sgl_page_pool; -#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * HV_MAX_MULTIPAGE_BUFFER_COUNT +#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * VMBUS_CHAN_PRPLIST_MAX enum storvsc_request_type { WRITE_TYPE, @@ -108,10 +109,16 @@ enum storvsc_request_type { UNKNOWN_TYPE }; +struct hvs_gpa_range { + struct vmbus_gpa_range gpa_range; + uint64_t gpa_page[VMBUS_CHAN_PRPLIST_MAX]; +} __packed; + struct hv_storvsc_request { LIST_ENTRY(hv_storvsc_request) link; struct vstor_packet vstor_packet; - hv_vmbus_multipage_buffer data_buf; + int prp_cnt; + struct hvs_gpa_range prp_list; void *sense_data; uint8_t sense_info_len; uint8_t retries; @@ -354,8 +361,8 @@ storvsc_send_multichannel_request(struct vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, + VMBUS_CHANPKT_FLAG_RC); /* wait for 5 seconds */ ret = sema_timedwait(&request->synch_sema, 5 * hz); @@ -425,8 +432,8 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) goto cleanup; @@ -459,8 +466,8 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) goto cleanup; @@ -502,8 +509,8 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, + VMBUS_CHANPKT_FLAG_RC); if ( ret != 0) goto cleanup; @@ -538,8 +545,8 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; @@ -628,8 +635,8 @@ hv_storvsc_host_reset(struct storvsc_sof vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)&sc->hs_reset_req, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, + VMBUS_CHANPKT_FLAG_RC); if (ret != 0) { goto cleanup; @@ -675,29 +682,26 @@ hv_storvsc_io_request(struct storvsc_sof vstor_packet->u.vm_srb.sense_info_len = sense_buffer_size; - vstor_packet->u.vm_srb.transfer_len = request->data_buf.length; + vstor_packet->u.vm_srb.transfer_len = + request->prp_list.gpa_range.gpa_len; vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; outgoing_channel = vmbus_select_outgoing_channel(sc->hs_chan); mtx_unlock(&request->softc->hs_lock); - if (request->data_buf.length) { - ret = hv_vmbus_channel_send_packet_multipagebuffer( - outgoing_channel, - &request->data_buf, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request); - + if (request->prp_list.gpa_range.gpa_len) { + ret = vmbus_chan_send_prplist(outgoing_channel, + &request->prp_list.gpa_range, request->prp_cnt, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); } else { ret = hv_vmbus_channel_send_packet( outgoing_channel, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, - HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + VMBUS_CHANPKT_TYPE_INBAND, + VMBUS_CHANPKT_FLAG_RC); } mtx_lock(&request->softc->hs_lock); @@ -956,7 +960,7 @@ storvsc_attach(device_t dev) /* * Pre-create SG list, each SG list with - * HV_MAX_MULTIPAGE_BUFFER_COUNT segments, each + * VMBUS_CHAN_PRPLIST_MAX segments, each * segment has one page buffer */ for (i = 0; i < STORVSC_MAX_IO_REQUESTS; i++) { @@ -964,10 +968,10 @@ storvsc_attach(device_t dev) M_DEVBUF, M_WAITOK|M_ZERO); sgl_node->sgl_data = - sglist_alloc(HV_MAX_MULTIPAGE_BUFFER_COUNT, + sglist_alloc(VMBUS_CHAN_PRPLIST_MAX, M_WAITOK|M_ZERO); - for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++) { + for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++) { tmp_buff = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK|M_ZERO); @@ -1054,7 +1058,7 @@ cleanup: while (!LIST_EMPTY(&g_hv_sgl_page_pool.free_sgl_list)) { sgl_node = LIST_FIRST(&g_hv_sgl_page_pool.free_sgl_list); LIST_REMOVE(sgl_node, link); - for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++) { + for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++) { if (NULL != (void*)sgl_node->sgl_data->sg_segs[j].ss_paddr) { free((void*)sgl_node->sgl_data->sg_segs[j].ss_paddr, M_DEVBUF); @@ -1117,7 +1121,7 @@ storvsc_detach(device_t dev) while (!LIST_EMPTY(&g_hv_sgl_page_pool.free_sgl_list)) { sgl_node = LIST_FIRST(&g_hv_sgl_page_pool.free_sgl_list); LIST_REMOVE(sgl_node, link); - for (j = 0; j < HV_MAX_MULTIPAGE_BUFFER_COUNT; j++){ + for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++){ if (NULL != (void*)sgl_node->sgl_data->sg_segs[j].ss_paddr) { free((void*)sgl_node->sgl_data->sg_segs[j].ss_paddr, M_DEVBUF); @@ -1668,6 +1672,7 @@ create_storvsc_request(union ccb *ccb, s uint32_t pfn_num = 0; uint32_t pfn; uint64_t not_aligned_seg_bits = 0; + struct hvs_gpa_range *prplist; /* refer to struct vmscsi_req for meanings of these two fields */ reqp->vstor_packet.u.vm_srb.port = @@ -1711,22 +1716,23 @@ create_storvsc_request(union ccb *ccb, s return (0); } - reqp->data_buf.length = csio->dxfer_len; + prplist = &reqp->prp_list; + prplist->gpa_range.gpa_len = csio->dxfer_len; switch (ccb->ccb_h.flags & CAM_DATA_MASK) { case CAM_DATA_VADDR: { bytes_to_copy = csio->dxfer_len; phys_addr = vtophys(csio->data_ptr); - reqp->data_buf.offset = phys_addr & PAGE_MASK; + prplist->gpa_range.gpa_ofs = phys_addr & PAGE_MASK; while (bytes_to_copy != 0) { int bytes, page_offset; phys_addr = - vtophys(&csio->data_ptr[reqp->data_buf.length - + vtophys(&csio->data_ptr[prplist->gpa_range.gpa_len - bytes_to_copy]); pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[pfn_num] = pfn; + prplist->gpa_page[pfn_num] = pfn; page_offset = phys_addr & PAGE_MASK; bytes = min(PAGE_SIZE - page_offset, bytes_to_copy); @@ -1734,6 +1740,7 @@ create_storvsc_request(union ccb *ccb, s bytes_to_copy -= bytes; pfn_num++; } + reqp->prp_cnt = pfn_num; break; } @@ -1750,10 +1757,10 @@ create_storvsc_request(union ccb *ccb, s printf("Storvsc: get SG I/O operation, %d\n", reqp->vstor_packet.u.vm_srb.data_in); - if (storvsc_sg_count > HV_MAX_MULTIPAGE_BUFFER_COUNT){ + if (storvsc_sg_count > VMBUS_CHAN_PRPLIST_MAX){ printf("Storvsc: %d segments is too much, " "only support %d segments\n", - storvsc_sg_count, HV_MAX_MULTIPAGE_BUFFER_COUNT); + storvsc_sg_count, VMBUS_CHAN_PRPLIST_MAX); return (EINVAL); } @@ -1806,10 +1813,10 @@ create_storvsc_request(union ccb *ccb, s phys_addr = vtophys(storvsc_sglist[0].ds_addr); } - reqp->data_buf.offset = phys_addr & PAGE_MASK; + prplist->gpa_range.gpa_ofs = phys_addr & PAGE_MASK; pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[0] = pfn; + prplist->gpa_page[0] = pfn; for (i = 1; i < storvsc_sg_count; i++) { if (reqp->not_aligned_seg_bits & (1 << i)) { @@ -1821,27 +1828,31 @@ create_storvsc_request(union ccb *ccb, s } pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[i] = pfn; + prplist->gpa_page[i] = pfn; } + reqp->prp_cnt = i; } else { phys_addr = vtophys(storvsc_sglist[0].ds_addr); - reqp->data_buf.offset = phys_addr & PAGE_MASK; + prplist->gpa_range.gpa_ofs = phys_addr & PAGE_MASK; for (i = 0; i < storvsc_sg_count; i++) { phys_addr = vtophys(storvsc_sglist[i].ds_addr); pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[i] = pfn; + prplist->gpa_page[i] = pfn; } + reqp->prp_cnt = i; /* check the last segment cross boundary or not */ offset = phys_addr & PAGE_MASK; if (offset) { + /* Add one more PRP entry */ phys_addr = vtophys(storvsc_sglist[i-1].ds_addr + PAGE_SIZE - offset); pfn = phys_addr >> PAGE_SHIFT; - reqp->data_buf.pfn_array[i] = pfn; + prplist->gpa_page[i] = pfn; + reqp->prp_cnt++; } reqp->bounce_sgl_count = 0; Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 02:30:45 2016 (r307455) @@ -35,6 +35,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" @@ -87,7 +88,7 @@ hv_heartbeat_cb(void *context) HV_ICMSGHDRFLAG_RESPONSE; hv_vmbus_channel_send_packet(channel, buf, recvlen, requestid, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); } } Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 02:30:45 2016 (r307455) @@ -578,7 +578,7 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e error = hv_vmbus_channel_send_packet(sc->util_sc.channel, sc->rcv_buf, sc->host_msg_len, sc->host_msg_id, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); if (error) hv_kvp_log_info("%s: hv_kvp_respond_host: sendpacket error:%d\n", Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 02:30:45 2016 (r307455) @@ -40,6 +40,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" @@ -106,7 +107,7 @@ hv_shutdown_cb(void *context) hv_vmbus_channel_send_packet(channel, buf, recv_len, request_id, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); } if (execute_shutdown) Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 02:30:45 2016 (r307455) @@ -40,6 +40,7 @@ #include #include +#include #include "hv_util.h" #include "vmbus_if.h" @@ -164,7 +165,7 @@ hv_timesync_cb(void *context) hv_vmbus_channel_send_packet(channel, time_buf, recvlen, requestId, - HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0); + VMBUS_CHANPKT_TYPE_INBAND, 0); } } Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:25:43 2016 (r307454) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:30:45 2016 (r307455) @@ -621,194 +621,119 @@ hv_vmbus_channel_close(struct hv_vmbus_c hv_vmbus_channel_close_internal(chan); } -/** - * @brief Send the specified buffer on the given channel - */ int -hv_vmbus_channel_send_packet( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint64_t request_id, - hv_vmbus_packet_type type, - uint32_t flags) +hv_vmbus_channel_send_packet(struct hv_vmbus_channel *chan, + void *data, uint32_t dlen, uint64_t xactid, uint16_t type, uint16_t flags) { - int ret = 0; - hv_vm_packet_descriptor desc; - uint32_t packet_len; - uint64_t aligned_data; - uint32_t packet_len_aligned; - boolean_t need_sig; - struct iovec iov[3]; - - packet_len = sizeof(hv_vm_packet_descriptor) + buffer_len; - packet_len_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); - aligned_data = 0; - - /* Setup the descriptor */ - desc.type = type; /* HV_VMBUS_PACKET_TYPE_DATA_IN_BAND; */ - desc.flags = flags; /* HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED */ - /* in 8-bytes granularity */ - desc.data_offset8 = sizeof(hv_vm_packet_descriptor) >> 3; - desc.length8 = (uint16_t) (packet_len_aligned >> 3); - desc.transaction_id = request_id; - - iov[0].iov_base = &desc; - iov[0].iov_len = sizeof(hv_vm_packet_descriptor); - - iov[1].iov_base = buffer; - iov[1].iov_len = buffer_len; - - iov[2].iov_base = &aligned_data; - iov[2].iov_len = packet_len_aligned - packet_len; - - ret = hv_ring_buffer_write(&channel->outbound, iov, 3, &need_sig); - - /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) - vmbus_chan_send_event(channel); - - return (ret); + struct vmbus_chanpkt pkt; + int pktlen, pad_pktlen, hlen, error; + uint64_t pad = 0; + struct iovec iov[3]; + boolean_t send_evt; + + hlen = sizeof(pkt); + pktlen = hlen + dlen; + pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + + pkt.cp_hdr.cph_type = type; + pkt.cp_hdr.cph_flags = flags; + pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_xactid = xactid; + + iov[0].iov_base = &pkt; + iov[0].iov_len = hlen; + iov[1].iov_base = data; + iov[1].iov_len = dlen; + iov[2].iov_base = &pad; + iov[2].iov_len = pad_pktlen - pktlen; + + error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt); + if (!error && send_evt) + vmbus_chan_send_event(chan); + return error; } -/** - * @brief Send a range of single-page buffer packets using - * a GPADL Direct packet type - */ int -hv_vmbus_channel_send_packet_pagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_page_buffer page_buffers[], - uint32_t page_count, - void* buffer, - uint32_t buffer_len, - uint64_t request_id) +vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, + struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid) { - - int ret = 0; - boolean_t need_sig; - uint32_t packet_len; - uint32_t page_buflen; - uint32_t packetLen_aligned; - struct iovec iov[4]; - hv_vmbus_channel_packet_page_buffer desc; - uint32_t descSize; - uint64_t alignedData = 0; - - if (page_count > HV_MAX_PAGE_BUFFER_COUNT) - return (EINVAL); - - /* - * Adjust the size down since hv_vmbus_channel_packet_page_buffer - * is the largest size we support - */ - descSize = __offsetof(hv_vmbus_channel_packet_page_buffer, range); - page_buflen = sizeof(hv_vmbus_page_buffer) * page_count; - packet_len = descSize + page_buflen + buffer_len; - packetLen_aligned = HV_ALIGN_UP(packet_len, sizeof(uint64_t)); - - /* Setup the descriptor */ - desc.type = HV_VMBUS_PACKET_TYPE_DATA_USING_GPA_DIRECT; - desc.flags = HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; - /* in 8-bytes granularity */ - desc.data_offset8 = (descSize + page_buflen) >> 3; - desc.length8 = (uint16_t) (packetLen_aligned >> 3); - desc.transaction_id = request_id; - desc.range_count = page_count; - - iov[0].iov_base = &desc; - iov[0].iov_len = descSize; - - iov[1].iov_base = page_buffers; - iov[1].iov_len = page_buflen; - - iov[2].iov_base = buffer; - iov[2].iov_len = buffer_len; - - iov[3].iov_base = &alignedData; - iov[3].iov_len = packetLen_aligned - packet_len; - - ret = hv_ring_buffer_write(&channel->outbound, iov, 4, &need_sig); - - /* TODO: We should determine if this is optional */ - if (ret == 0 && need_sig) - vmbus_chan_send_event(channel); - - return (ret); + struct vmbus_chanpkt_sglist pkt; + int pktlen, pad_pktlen, hlen, error; + struct iovec iov[4]; + boolean_t send_evt; + uint64_t pad = 0; + + KASSERT(sglen < VMBUS_CHAN_SGLIST_MAX, + ("invalid sglist len %d", sglen)); + + hlen = __offsetof(struct vmbus_chanpkt_sglist, cp_gpa[sglen]); + pktlen = hlen + dlen; + pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + + pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; + pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; + pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + pkt.cp_hdr.cph_xactid = xactid; + pkt.cp_rsvd = 0; + pkt.cp_gpa_cnt = sglen; + + iov[0].iov_base = &pkt; + iov[0].iov_len = sizeof(pkt); + iov[1].iov_base = sg; + iov[1].iov_len = sizeof(struct vmbus_gpa) * sglen; + iov[2].iov_base = data; + iov[2].iov_len = dlen; + iov[3].iov_base = &pad; + iov[3].iov_len = pad_pktlen - pktlen; + + error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); + if (!error && send_evt) + vmbus_chan_send_event(chan); + return error; } -/** - * @brief Send a multi-page buffer packet using a GPADL Direct packet type - */ int -hv_vmbus_channel_send_packet_multipagebuffer( - hv_vmbus_channel* channel, - hv_vmbus_multipage_buffer* multi_page_buffer, - void* buffer, - uint32_t buffer_len, - uint64_t request_id) -{ - - int ret = 0; - uint32_t desc_size; - boolean_t need_sig; - uint32_t packet_len; - uint32_t packet_len_aligned; - uint32_t pfn_count; - uint64_t aligned_data = 0; - struct iovec iov[3]; - hv_vmbus_channel_packet_multipage_buffer desc; - - pfn_count = - HV_NUM_PAGES_SPANNED( - multi_page_buffer->offset, - multi_page_buffer->length); - - if ((pfn_count == 0) || (pfn_count > HV_MAX_MULTIPAGE_BUFFER_COUNT)) - return (EINVAL); - /* - * Adjust the size down since hv_vmbus_channel_packet_multipage_buffer - * is the largest size we support - */ - desc_size = - sizeof(hv_vmbus_channel_packet_multipage_buffer) - - ((HV_MAX_MULTIPAGE_BUFFER_COUNT - pfn_count) * - sizeof(uint64_t)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 02:34:15 2016 Return-Path: Delivered-To: svn-src-all@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 79900C139DC; Mon, 17 Oct 2016 02:34:15 +0000 (UTC) (envelope-from sephe@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 3D28913C6; Mon, 17 Oct 2016 02:34:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2YEeD096393; Mon, 17 Oct 2016 02:34:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2YD9K096382; Mon, 17 Oct 2016 02:34:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170234.u9H2YD9K096382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:34: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: r307456 - in stable/11/sys/dev/hyperv: include netvsc storvsc utilities 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:34:15 -0000 Author: sephe Date: Mon Oct 17 02:34:13 2016 New Revision: 307456 URL: https://svnweb.freebsd.org/changeset/base/307456 Log: MFC 302882-302884 302882 hyperv/vmbus: Function rename And reorder the error prone parameters list. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7191 302883 hyperv/vmbus: Field rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7193 302884 hyperv/vmbus: Factor out macros to do channel packet length conversion. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7194 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:34:13 2016 (r307456) @@ -323,14 +323,6 @@ int hv_vmbus_channel_open( void hv_vmbus_channel_close(hv_vmbus_channel *channel); -int hv_vmbus_channel_send_packet( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint64_t request_id, - uint16_t type, - uint16_t flags); - int hv_vmbus_channel_establish_gpadl( hv_vmbus_channel* channel, /* must be phys and virt contiguous */ Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 02:34:13 2016 (r307456) @@ -59,6 +59,8 @@ struct vmbus_gpa { struct hv_vmbus_channel; +int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, + uint16_t flags, void *data, int dlen, uint64_t xactid); int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid); Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:34:13 2016 (r307456) @@ -183,9 +183,9 @@ hv_nv_init_rx_buffer_with_net_vsp(struct /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) { goto cleanup; } @@ -276,9 +276,9 @@ hv_nv_init_send_buffer_with_net_vsp(stru /* Send the gpadl notification request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt); if (ret != 0) { goto cleanup; } @@ -335,10 +335,9 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id = NETVSC_RECEIVE_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, - revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)revoke_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + ret = vmbus_chan_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), + (uint64_t)(uintptr_t)revoke_pkt); /* * If we failed here, we might as well return and have a leak @@ -403,10 +402,10 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne revoke_pkt->msgs.vers_1_msgs.revoke_send_buf.id = NETVSC_SEND_BUFFER_ID; - ret = hv_vmbus_channel_send_packet(net_dev->sc->hn_prichan, + ret = vmbus_chan_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)revoke_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + (uint64_t)(uintptr_t)revoke_pkt); /* * If we failed here, we might as well return and have a leak * rather than continue and a bugchk @@ -470,9 +469,9 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver; /* Send the init request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) return (-1); @@ -513,9 +512,8 @@ hv_nv_send_ndis_config(struct hn_softc * = 1; /* Send the configuration packet */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) return (-EINVAL); @@ -592,9 +590,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc /* Send the init request */ - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, 0); + ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) { goto cleanup; } @@ -816,9 +813,9 @@ hv_nv_on_send(struct hv_vmbus_channel *c ret = vmbus_chan_send_sglist(chan, pkt->gpa, pkt->gpa_cnt, &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); } else { - ret = hv_vmbus_channel_send_packet(chan, - &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); } return (ret); @@ -917,8 +914,8 @@ hv_nv_on_receive_completion(struct hv_vm retry_send_cmplt: /* Send the completion */ - ret = hv_vmbus_channel_send_packet(chan, &rx_comp_msg, - sizeof(nvsp_msg), tid, VMBUS_CHANPKT_TYPE_COMP, 0); + ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, 0, + &rx_comp_msg, sizeof(nvsp_msg), tid); if (ret == 0) { /* success */ /* no-op */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 02:34:13 2016 (r307456) @@ -1166,9 +1166,9 @@ hv_rf_on_device_add(struct hn_softc *sc, init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels = net_dev->num_channel - 1; - ret = hv_vmbus_channel_send_packet(sc->hn_prichan, init_pkt, - sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); if (ret != 0) { device_printf(dev, "Fail to allocate subchannel\n"); goto out; Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:34:13 2016 (r307456) @@ -356,13 +356,9 @@ storvsc_send_multichannel_request(struct vstor_packet->flags = REQUEST_COMPLETION_FLAG; vstor_packet->u.multi_channels_cnt = request_channels_cnt; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); /* wait for 5 seconds */ ret = sema_timedwait(&request->synch_sema, 5 * hz); @@ -427,13 +423,9 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if (ret != 0) goto cleanup; @@ -461,13 +453,9 @@ hv_storvsc_channel_init(struct storvsc_s /* revision is only significant for Windows guests */ vstor_packet->u.version.revision = 0; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if (ret != 0) goto cleanup; @@ -504,13 +492,9 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet->operation = VSTOR_OPERATION_QUERYPROPERTIES; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if ( ret != 0) goto cleanup; @@ -540,13 +524,9 @@ hv_storvsc_channel_init(struct storvsc_s vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet( - sc->hs_chan, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(sc->hs_chan, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); if (ret != 0) { goto cleanup; @@ -631,12 +611,10 @@ hv_storvsc_host_reset(struct storvsc_sof vstor_packet->operation = VSTOR_OPERATION_RESETBUS; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - ret = hv_vmbus_channel_send_packet(dev->channel, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)&sc->hs_reset_req, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(dev->channel, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, + (uint64_t)(uintptr_t)&sc->hs_reset_req); if (ret != 0) { goto cleanup; @@ -695,13 +673,9 @@ hv_storvsc_io_request(struct storvsc_sof &request->prp_list.gpa_range, request->prp_cnt, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); } else { - ret = hv_vmbus_channel_send_packet( - outgoing_channel, - vstor_packet, - VSTOR_PKT_SIZE, - (uint64_t)(uintptr_t)request, - VMBUS_CHANPKT_TYPE_INBAND, - VMBUS_CHANPKT_FLAG_RC); + ret = vmbus_chan_send(outgoing_channel, + VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, + vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); } mtx_lock(&request->softc->hs_lock); Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 02:34:13 2016 (r307456) @@ -87,8 +87,8 @@ hv_heartbeat_cb(void *context) icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - hv_vmbus_channel_send_packet(channel, buf, recvlen, requestid, - VMBUS_CHANPKT_TYPE_INBAND, 0); + vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, + buf, recvlen, requestid); } } Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 02:34:13 2016 (r307456) @@ -575,11 +575,9 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e hv_icmsg_hdrp->status = error; hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - error = hv_vmbus_channel_send_packet(sc->util_sc.channel, - sc->rcv_buf, - sc->host_msg_len, sc->host_msg_id, - VMBUS_CHANPKT_TYPE_INBAND, 0); - + error = vmbus_chan_send(sc->util_sc.channel, + VMBUS_CHANPKT_TYPE_INBAND, 0, sc->rcv_buf, sc->host_msg_len, + sc->host_msg_id); if (error) hv_kvp_log_info("%s: hv_kvp_respond_host: sendpacket error:%d\n", __func__, error); Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 02:34:13 2016 (r307456) @@ -105,9 +105,8 @@ hv_shutdown_cb(void *context) icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - hv_vmbus_channel_send_packet(channel, buf, - recv_len, request_id, - VMBUS_CHANPKT_TYPE_INBAND, 0); + vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, + buf, recv_len, request_id); } if (execute_shutdown) Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 02:34:13 2016 (r307456) @@ -163,9 +163,8 @@ hv_timesync_cb(void *context) icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | HV_ICMSGHDRFLAG_RESPONSE; - hv_vmbus_channel_send_packet(channel, time_buf, - recvlen, requestId, - VMBUS_CHANPKT_TYPE_INBAND, 0); + vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, + time_buf, recvlen, requestId); } } Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:34:13 2016 (r307456) @@ -622,8 +622,8 @@ hv_vmbus_channel_close(struct hv_vmbus_c } int -hv_vmbus_channel_send_packet(struct hv_vmbus_channel *chan, - void *data, uint32_t dlen, uint64_t xactid, uint16_t type, uint16_t flags) +vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags, + void *data, int dlen, uint64_t xactid) { struct vmbus_chanpkt pkt; int pktlen, pad_pktlen, hlen, error; @@ -633,12 +633,12 @@ hv_vmbus_channel_send_packet(struct hv_v hlen = sizeof(pkt); pktlen = hlen + dlen; - pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); pkt.cp_hdr.cph_type = type; pkt.cp_hdr.cph_flags = flags; - pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); pkt.cp_hdr.cph_xactid = xactid; iov[0].iov_base = &pkt; @@ -669,12 +669,12 @@ vmbus_chan_send_sglist(struct hv_vmbus_c hlen = __offsetof(struct vmbus_chanpkt_sglist, cp_gpa[sglen]); pktlen = hlen + dlen; - pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; - pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); pkt.cp_hdr.cph_xactid = xactid; pkt.cp_rsvd = 0; pkt.cp_gpa_cnt = sglen; @@ -711,12 +711,12 @@ vmbus_chan_send_prplist(struct hv_vmbus_ hlen = __offsetof(struct vmbus_chanpkt_prplist, cp_range[0].gpa_page[prp_cnt]); pktlen = hlen + dlen; - pad_pktlen = roundup2(pktlen, VMBUS_CHANPKT_SIZE_ALIGN); + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; - pkt.cp_hdr.cph_data_ofs = hlen >> VMBUS_CHANPKT_SIZE_SHIFT; - pkt.cp_hdr.cph_len = pad_pktlen >> VMBUS_CHANPKT_SIZE_SHIFT; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); pkt.cp_hdr.cph_xactid = xactid; pkt.cp_rsvd = 0; pkt.cp_range_cnt = 1; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 02:30:45 2016 (r307455) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 02:34:13 2016 (r307456) @@ -115,10 +115,18 @@ CTASSERT(sizeof(struct vmbus_mnf) == PAG #define VMBUS_CHANPKT_SIZE_SHIFT 3 #define VMBUS_CHANPKT_SIZE_ALIGN (1 << VMBUS_CHANPKT_SIZE_SHIFT) +#define VMBUS_CHANPKT_SETLEN(pktlen, len) \ +do { \ + (pktlen) = (len) >> VMBUS_CHANPKT_SIZE_SHIFT; \ +} while (0) + +#define VMBUS_CHANPKT_TOTLEN(tlen) \ + roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN) + struct vmbus_chanpkt_hdr { uint16_t cph_type; - uint16_t cph_data_ofs; /* in 8 bytes */ - uint16_t cph_len; /* in 8 bytes */ + uint16_t cph_hlen; /* header len, in 8 bytes */ + uint16_t cph_tlen; /* total len, in 8 bytes */ uint16_t cph_flags; uint64_t cph_xactid; } __packed; From owner-svn-src-all@freebsd.org Mon Oct 17 02:36:51 2016 Return-Path: Delivered-To: svn-src-all@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 50EEAC13B19; Mon, 17 Oct 2016 02:36:51 +0000 (UTC) (envelope-from sephe@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 15334165F; Mon, 17 Oct 2016 02:36:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2aofa096548; Mon, 17 Oct 2016 02:36:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2angm096538; Mon, 17 Oct 2016 02:36:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170236.u9H2angm096538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:36: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: r307457 - in stable/11/sys/dev/hyperv: include netvsc storvsc utilities 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:36:51 -0000 Author: sephe Date: Mon Oct 17 02:36:49 2016 New Revision: 307457 URL: https://svnweb.freebsd.org/changeset/base/307457 Log: MFC 302885,302886 302885 hyperv/vmbus: Cleanup channel receiving. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7202 302886 hyperv/vmbus: Cleanup channel packet receiving. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7204 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:36:49 2016 (r307457) @@ -90,28 +90,6 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -typedef struct { - uint16_t type; - uint16_t data_offset8; - uint16_t length8; - uint16_t flags; - uint64_t transaction_id; -} __packed hv_vm_packet_descriptor; - -typedef struct { - uint32_t byte_count; - uint32_t byte_offset; -} __packed hv_vm_transfer_page; - -typedef struct { - hv_vm_packet_descriptor d; - uint16_t transfer_page_set_id; - hv_bool_uint8_t sender_owns_set; - uint8_t reserved; - uint32_t range_count; - hv_vm_transfer_page ranges[1]; -} __packed hv_vm_transfer_page_packet_header; - #define HW_MACADDR_LEN 6 /* @@ -298,20 +276,6 @@ hv_set_channel_read_state(hv_vmbus_chann channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; } -int hv_vmbus_channel_recv_packet( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id); - -int hv_vmbus_channel_recv_packet_raw( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id); - int hv_vmbus_channel_open( hv_vmbus_channel* channel, uint32_t send_ring_buffer_size, Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 02:36:49 2016 (r307457) @@ -47,6 +47,19 @@ struct vmbus_gpa { uint64_t gpa_page; } __packed; +#define VMBUS_CHANPKT_SIZE_SHIFT 3 + +#define VMBUS_CHANPKT_GETLEN(pktlen) \ + (((int)(pktlen)) << VMBUS_CHANPKT_SIZE_SHIFT) + +struct vmbus_chanpkt_hdr { + uint16_t cph_type; /* VMBUS_CHANPKT_TYPE_ */ + uint16_t cph_hlen; /* header len, in 8 bytes */ + uint16_t cph_tlen; /* total len, in 8 bytes */ + uint16_t cph_flags; /* VMBUS_CHANPKT_FLAG_ */ + uint64_t cph_xactid; +} __packed; + #define VMBUS_CHANPKT_TYPE_INBAND 0x0006 #define VMBUS_CHANPKT_TYPE_RXBUF 0x0007 #define VMBUS_CHANPKT_TYPE_GPA 0x0009 @@ -54,11 +67,33 @@ struct vmbus_gpa { #define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ +#define VMBUS_CHANPKT_CONST_DATA(pkt) \ + (const void *)((const uint8_t *)(pkt) + \ + VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen)) + +struct vmbus_rxbuf_desc { + uint32_t rb_len; + uint32_t rb_ofs; +} __packed; + +struct vmbus_chanpkt_rxbuf { + struct vmbus_chanpkt_hdr cp_hdr; + uint16_t cp_rxbuf_id; + uint16_t cp_rsvd; + uint32_t cp_rxbuf_cnt; + struct vmbus_rxbuf_desc cp_rxbuf[]; +} __packed; + #define VMBUS_CHAN_SGLIST_MAX 32 #define VMBUS_CHAN_PRPLIST_MAX 32 struct hv_vmbus_channel; +int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, + uint64_t *xactid); +int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, + struct vmbus_chanpkt_hdr *pkt, int *pktlen); + int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags, void *data, int dlen, uint64_t xactid); int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:36:49 2016 (r307457) @@ -64,12 +64,12 @@ static int hv_nv_destroy_send_buffer(ne static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); static int hv_nv_connect_to_vsp(struct hn_softc *sc); static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); + struct hv_vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, struct hv_vmbus_channel *chan, - hv_vm_packet_descriptor *pkt); + const struct vmbus_chanpkt_hdr *pkt); /* * @@ -726,13 +726,12 @@ hv_nv_on_device_remove(struct hn_softc * */ static void hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, - hv_vm_packet_descriptor *pkt) + const struct vmbus_chanpkt_hdr *pkt) { - nvsp_msg *nvsp_msg_pkt; + const nvsp_msg *nvsp_msg_pkt; netvsc_packet *net_vsc_pkt; - nvsp_msg_pkt = - (nvsp_msg *)((unsigned long)pkt + (pkt->data_offset8 << 3)); + nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkt); if (nvsp_msg_pkt->hdr.msg_type == nvsp_msg_type_init_complete || nvsp_msg_pkt->hdr.msg_type @@ -749,7 +748,7 @@ hv_nv_on_send_completion(netvsc_dev *net nvsp_msg_1_type_send_rndis_pkt_complete) { /* Get the send context */ net_vsc_pkt = - (netvsc_packet *)(unsigned long)pkt->transaction_id; + (netvsc_packet *)(unsigned long)pkt->cph_xactid; if (NULL != net_vsc_pkt) { if (net_vsc_pkt->send_buf_section_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { @@ -829,10 +828,10 @@ hv_nv_on_send(struct hv_vmbus_channel *c */ static void hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, - struct hv_vmbus_channel *chan, hv_vm_packet_descriptor *pkt) + struct hv_vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { - hv_vm_transfer_page_packet_header *vm_xfer_page_pkt; - nvsp_msg *nvsp_msg_pkt; + const struct vmbus_chanpkt_rxbuf *pkt; + const nvsp_msg *nvsp_msg_pkt; netvsc_packet vsc_pkt; netvsc_packet *net_vsc_pkt = &vsc_pkt; device_t dev = sc->hn_dev; @@ -840,43 +839,31 @@ hv_nv_on_receive(netvsc_dev *net_dev, st int i = 0; int status = nvsp_status_success; - /* - * All inbound packets other than send completion should be - * xfer page packet. - */ - if (pkt->type != VMBUS_CHANPKT_TYPE_RXBUF) { - device_printf(dev, "packet type %d is invalid!\n", pkt->type); - return; - } - - nvsp_msg_pkt = (nvsp_msg *)((unsigned long)pkt - + (pkt->data_offset8 << 3)); + nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkthdr); /* Make sure this is a valid nvsp packet */ if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg_1_type_send_rndis_pkt) { - device_printf(dev, "packet hdr type %d is invalid!\n", - pkt->type); + device_printf(dev, "packet hdr type %u is invalid!\n", + nvsp_msg_pkt->hdr.msg_type); return; } - vm_xfer_page_pkt = (hv_vm_transfer_page_packet_header *)pkt; + pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - if (vm_xfer_page_pkt->transfer_page_set_id != - NETVSC_RECEIVE_BUFFER_ID) { - device_printf(dev, "transfer_page_set_id %d is invalid!\n", - vm_xfer_page_pkt->transfer_page_set_id); + if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { + device_printf(dev, "rxbuf_id %d is invalid!\n", + pkt->cp_rxbuf_id); return; } - count = vm_xfer_page_pkt->range_count; + count = pkt->cp_rxbuf_cnt; /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ for (i = 0; i < count; i++) { net_vsc_pkt->status = nvsp_status_success; - net_vsc_pkt->data = (void *)((unsigned long)net_dev->rx_buf + - vm_xfer_page_pkt->ranges[i].byte_offset); - net_vsc_pkt->tot_data_buf_len = - vm_xfer_page_pkt->ranges[i].byte_count; + net_vsc_pkt->data = ((uint8_t *)net_dev->rx_buf + + pkt->cp_rxbuf[i].rb_ofs); + net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len; hv_rf_on_receive(net_dev, chan, net_vsc_pkt); if (net_vsc_pkt->status != nvsp_status_success) { @@ -889,8 +876,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * messages (not just data messages) will trigger a response * message back to the host. */ - hv_nv_on_receive_completion(chan, vm_xfer_page_pkt->d.transaction_id, - status); + hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid, status); } /* @@ -934,19 +920,19 @@ retry_send_cmplt: * Net VSC receiving vRSS send table from VSP */ static void -hv_nv_send_table(struct hn_softc *sc, hv_vm_packet_descriptor *pkt) +hv_nv_send_table(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { netvsc_dev *net_dev; - nvsp_msg *nvsp_msg_pkt; + const nvsp_msg *nvsp_msg_pkt; int i; - uint32_t count, *table; + uint32_t count; + const uint32_t *table; net_dev = hv_nv_get_inbound_net_device(sc); if (!net_dev) return; - nvsp_msg_pkt = - (nvsp_msg *)((unsigned long)pkt + (pkt->data_offset8 << 3)); + nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkt); if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg5_type_send_indirection_table) { @@ -962,8 +948,8 @@ hv_nv_send_table(struct hn_softc *sc, hv return; } - table = (uint32_t *) - ((unsigned long)&nvsp_msg_pkt->msgs.vers_5_msgs.send_table + + table = (const uint32_t *) + ((const uint8_t *)&nvsp_msg_pkt->msgs.vers_5_msgs.send_table + nvsp_msg_pkt->msgs.vers_5_msgs.send_table.offset); for (i = 0; i < count; i++) @@ -980,44 +966,40 @@ hv_nv_on_channel_callback(void *xchan) device_t dev = chan->ch_dev; struct hn_softc *sc = device_get_softc(dev); netvsc_dev *net_dev; - uint32_t bytes_rxed; - uint64_t request_id; - hv_vm_packet_descriptor *desc; - uint8_t *buffer; + void *buffer; int bufferlen = NETVSC_PACKET_SIZE; - int ret = 0; net_dev = hv_nv_get_inbound_net_device(sc); if (net_dev == NULL) return; buffer = chan->hv_chan_rdbuf; - do { - ret = hv_vmbus_channel_recv_packet_raw(chan, - buffer, bufferlen, &bytes_rxed, &request_id); + struct vmbus_chanpkt_hdr *pkt = buffer; + uint32_t bytes_rxed; + int ret; + + bytes_rxed = bufferlen; + ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); if (ret == 0) { if (bytes_rxed > 0) { - desc = (hv_vm_packet_descriptor *)buffer; - switch (desc->type) { + switch (pkt->cph_type) { case VMBUS_CHANPKT_TYPE_COMP: hv_nv_on_send_completion(net_dev, chan, - desc); + pkt); break; case VMBUS_CHANPKT_TYPE_RXBUF: - hv_nv_on_receive(net_dev, sc, chan, desc); + hv_nv_on_receive(net_dev, sc, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: - hv_nv_send_table(sc, desc); + hv_nv_send_table(sc, pkt); break; default: device_printf(dev, - "hv_cb recv unknow type %d " - " packet\n", desc->type); + "unknown chan pkt %u\n", + pkt->cph_type); break; } - } else { - break; } } else if (ret == ENOBUFS) { /* Handle large packet */ @@ -1036,6 +1018,9 @@ hv_nv_on_channel_callback(void *xchan) break; } bufferlen = bytes_rxed; + } else { + /* No more packets */ + break; } } while (1); Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:36:49 2016 (r307457) @@ -780,12 +780,10 @@ hv_storvsc_on_channel_callback(void *xch struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - ret = hv_vmbus_channel_recv_packet( - channel, - packet, - roundup2(VSTOR_PKT_SIZE, 8), - &bytes_recvd, - &request_id); + bytes_recvd = roundup2(VSTOR_PKT_SIZE, 8); + ret = vmbus_chan_recv(channel, packet, &bytes_recvd, &request_id); + KASSERT(ret != ENOBUFS, ("storvsc recvbuf is not large enough")); + /* XXX check bytes_recvd to make sure that it contains enough data */ while ((ret == 0) && (bytes_recvd > 0)) { request = (struct hv_storvsc_request *)(uintptr_t)request_id; @@ -819,12 +817,16 @@ hv_storvsc_on_channel_callback(void *xch break; } } - ret = hv_vmbus_channel_recv_packet( - channel, - packet, - roundup2(VSTOR_PKT_SIZE, 8), - &bytes_recvd, - &request_id); + + bytes_recvd = roundup2(VSTOR_PKT_SIZE, 8), + ret = vmbus_chan_recv(channel, packet, &bytes_recvd, + &request_id); + KASSERT(ret != ENOBUFS, + ("storvsc recvbuf is not large enough")); + /* + * XXX check bytes_recvd to make sure that it contains + * enough data + */ } } Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 02:36:49 2016 (r307457) @@ -52,7 +52,7 @@ hv_heartbeat_cb(void *context) { uint8_t* buf; hv_vmbus_channel* channel; - uint32_t recvlen; + int recvlen; uint64_t requestid; int ret; @@ -64,8 +64,10 @@ hv_heartbeat_cb(void *context) buf = softc->receive_buffer; channel = softc->channel; - ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, &recvlen, - &requestid); + recvlen = PAGE_SIZE; + ret = vmbus_chan_recv(channel, buf, &recvlen, &requestid); + KASSERT(ret != ENOBUFS, ("hvheartbeat recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ if ((ret == 0) && recvlen > 0) { Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 02:36:49 2016 (r307457) @@ -626,8 +626,10 @@ hv_kvp_process_request(void *context, in kvp_buf = sc->util_sc.receive_buffer; channel = sc->util_sc.channel; - ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, - &recvlen, &requestid); + recvlen = 2 * PAGE_SIZE; + ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); + KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ while ((ret == 0) && (recvlen > 0)) { @@ -691,9 +693,11 @@ hv_kvp_process_request(void *context, in /* * Try reading next buffer */ - recvlen = 0; - ret = hv_vmbus_channel_recv_packet(channel, kvp_buf, 2 * PAGE_SIZE, - &recvlen, &requestid); + recvlen = 2 * PAGE_SIZE; + ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); + KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ + hv_kvp_log_info("%s: read: context %p, ret =%d, recvlen=%d\n", __func__, context, ret, recvlen); } Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 02:36:49 2016 (r307457) @@ -67,8 +67,11 @@ hv_shutdown_cb(void *context) softc = (hv_util_sc*)context; buf = softc->receive_buffer; channel = softc->channel; - ret = hv_vmbus_channel_recv_packet(channel, buf, PAGE_SIZE, - &recv_len, &request_id); + + recv_len = PAGE_SIZE; + ret = vmbus_chan_recv(channel, buf, &recv_len, &request_id); + KASSERT(ret != ENOBUFS, ("hvshutdown recvbuf is not large enough")); + /* XXX check recv_len to make sure that it contains enough data */ if ((ret == 0) && recv_len > 0) { Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 02:36:49 2016 (r307457) @@ -144,8 +144,10 @@ hv_timesync_cb(void *context) channel = softc->util_sc.channel; time_buf = softc->util_sc.receive_buffer; - ret = hv_vmbus_channel_recv_packet(channel, time_buf, - PAGE_SIZE, &recvlen, &requestId); + recvlen = PAGE_SIZE; + ret = vmbus_chan_recv(channel, time_buf, &recvlen, &requestId); + KASSERT(ret != ENOBUFS, ("hvtimesync recvbuf is not large enough")); + /* XXX check recvlen to make sure that it contains enough data */ if ((ret == 0) && recvlen > 0) { icmsghdrp = (struct hv_vmbus_icmsg_hdr *) &time_buf[ Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:36:49 2016 (r307457) @@ -736,84 +736,60 @@ vmbus_chan_send_prplist(struct hv_vmbus_ return error; } -/** - * @brief Retrieve the user packet on the specified channel - */ int -hv_vmbus_channel_recv_packet( - hv_vmbus_channel* channel, - void* Buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id) +vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen0, + uint64_t *xactid) { - int ret; - uint32_t user_len; - uint32_t packet_len; - hv_vm_packet_descriptor desc; - - *buffer_actual_len = 0; - *request_id = 0; - - ret = hv_ring_buffer_peek(&channel->inbound, &desc, - sizeof(hv_vm_packet_descriptor)); - if (ret != 0) - return (0); + struct vmbus_chanpkt_hdr pkt; + int error, dlen, hlen; - packet_len = desc.length8 << 3; - user_len = packet_len - (desc.data_offset8 << 3); + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; - *buffer_actual_len = user_len; + hlen = VMBUS_CHANPKT_GETLEN(pkt.cph_hlen); + dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen; - if (user_len > buffer_len) - return (EINVAL); + if (*dlen0 < dlen) { + /* Return the size of this packet's data. */ + *dlen0 = dlen; + return ENOBUFS; + } - *request_id = desc.transaction_id; + *xactid = pkt.cph_xactid; + *dlen0 = dlen; - /* Copy over the packet to the user buffer */ - ret = hv_ring_buffer_read(&channel->inbound, Buffer, user_len, - (desc.data_offset8 << 3)); + /* Skip packet header */ + error = hv_ring_buffer_read(&chan->inbound, data, dlen, hlen); + KASSERT(!error, ("hv_ring_buffer_read failed")); - return (0); + return 0; } -/** - * @brief Retrieve the raw packet on the specified channel - */ int -hv_vmbus_channel_recv_packet_raw( - hv_vmbus_channel* channel, - void* buffer, - uint32_t buffer_len, - uint32_t* buffer_actual_len, - uint64_t* request_id) +vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, + struct vmbus_chanpkt_hdr *pkt0, int *pktlen0) { - int ret; - uint32_t packetLen; - hv_vm_packet_descriptor desc; + struct vmbus_chanpkt_hdr pkt; + int error, pktlen; - *buffer_actual_len = 0; - *request_id = 0; + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; + + pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen); + if (*pktlen0 < pktlen) { + /* Return the size of this packet. */ + *pktlen0 = pktlen; + return ENOBUFS; + } + *pktlen0 = pktlen; + + /* Include packet header */ + error = hv_ring_buffer_read(&chan->inbound, pkt0, pktlen, 0); + KASSERT(!error, ("hv_ring_buffer_read failed")); - ret = hv_ring_buffer_peek( - &channel->inbound, &desc, - sizeof(hv_vm_packet_descriptor)); - - if (ret != 0) - return (0); - - packetLen = desc.length8 << 3; - *buffer_actual_len = packetLen; - - if (packetLen > buffer_len) - return (ENOBUFS); - - *request_id = desc.transaction_id; - - /* Copy over the entire packet to the user buffer */ - ret = hv_ring_buffer_read(&channel->inbound, buffer, packetLen, 0); - - return (0); + return 0; } static void Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 02:34:13 2016 (r307456) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 02:36:49 2016 (r307457) @@ -112,7 +112,6 @@ CTASSERT(sizeof(struct vmbus_mnf) == PAG * Channel packets */ -#define VMBUS_CHANPKT_SIZE_SHIFT 3 #define VMBUS_CHANPKT_SIZE_ALIGN (1 << VMBUS_CHANPKT_SIZE_SHIFT) #define VMBUS_CHANPKT_SETLEN(pktlen, len) \ @@ -123,14 +122,6 @@ do { \ #define VMBUS_CHANPKT_TOTLEN(tlen) \ roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN) -struct vmbus_chanpkt_hdr { - uint16_t cph_type; - uint16_t cph_hlen; /* header len, in 8 bytes */ - uint16_t cph_tlen; /* total len, in 8 bytes */ - uint16_t cph_flags; - uint64_t cph_xactid; -} __packed; - struct vmbus_chanpkt { struct vmbus_chanpkt_hdr cp_hdr; } __packed; From owner-svn-src-all@freebsd.org Mon Oct 17 02:38:45 2016 Return-Path: Delivered-To: svn-src-all@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 D74E9C13C7D; Mon, 17 Oct 2016 02:38:45 +0000 (UTC) (envelope-from sephe@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 B196417EB; Mon, 17 Oct 2016 02:38:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2cipI096665; Mon, 17 Oct 2016 02:38:44 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2ciOG096661; Mon, 17 Oct 2016 02:38:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170238.u9H2ciOG096661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:38: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: r307458 - in stable/11/sys/dev/hyperv: include netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:38:45 -0000 Author: sephe Date: Mon Oct 17 02:38:44 2016 New Revision: 307458 URL: https://svnweb.freebsd.org/changeset/base/307458 Log: MFC 302887 hyperv/hn: Busdma-fy rxbuf and chimney sending buffer Nuke unused channel GPADL API. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7211 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/vmbus/hv_channel.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:36:49 2016 (r307457) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:38:44 2016 (r307458) @@ -287,14 +287,6 @@ int hv_vmbus_channel_open( void hv_vmbus_channel_close(hv_vmbus_channel *channel); -int hv_vmbus_channel_establish_gpadl( - hv_vmbus_channel* channel, - /* must be phys and virt contiguous */ - void* contig_buffer, - /* page-size multiple */ - uint32_t size, - uint32_t* gpadl_handle); - int hv_vmbus_channel_teardown_gpdal( hv_vmbus_channel* channel, uint32_t gpadl_handle); Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:36:49 2016 (r307457) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:38:44 2016 (r307458) @@ -152,19 +152,27 @@ hv_nv_init_rx_buffer_with_net_vsp(struct return (ENODEV); } - net_dev->rx_buf = contigmalloc(net_dev->rx_buf_size, M_NETVSC, - M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); + net_dev->rx_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), + PAGE_SIZE, 0, net_dev->rx_buf_size, &net_dev->rxbuf_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (net_dev->rx_buf == NULL) { + device_printf(sc->hn_dev, "allocate rxbuf failed\n"); + return ENOMEM; + } /* - * Establish the GPADL handle for this buffer on this channel. - * Note: This call uses the vmbus connection rather than the - * channel to establish the gpadl handle. - * GPADL: Guest physical address descriptor list. - */ - ret = hv_vmbus_channel_establish_gpadl( - sc->hn_prichan, net_dev->rx_buf, - net_dev->rx_buf_size, &net_dev->rx_buf_gpadl_handle); + * Connect the RXBUF GPADL to the primary channel. + * + * NOTE: + * Only primary channel has RXBUF connected to it. Sub-channels + * just share this RXBUF. + */ + ret = vmbus_chan_gpadl_connect(sc->hn_prichan, + net_dev->rxbuf_dma.hv_paddr, net_dev->rx_buf_size, + &net_dev->rx_buf_gpadl_handle); if (ret != 0) { + device_printf(sc->hn_dev, "rxbuf gpadl connect failed: %d\n", + ret); goto cleanup; } @@ -243,22 +251,27 @@ hv_nv_init_send_buffer_with_net_vsp(stru return (ENODEV); } - net_dev->send_buf = contigmalloc(net_dev->send_buf_size, M_NETVSC, - M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); + net_dev->send_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), + PAGE_SIZE, 0, net_dev->send_buf_size, &net_dev->txbuf_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); if (net_dev->send_buf == NULL) { - ret = ENOMEM; - goto cleanup; + device_printf(sc->hn_dev, "allocate chimney txbuf failed\n"); + return ENOMEM; } /* - * Establish the gpadl handle for this buffer on this channel. - * Note: This call uses the vmbus connection rather than the - * channel to establish the gpadl handle. + * Connect chimney sending buffer GPADL to the primary channel. + * + * NOTE: + * Only primary channel has chimney sending buffer connected to it. + * Sub-channels just share this chimney sending buffer. */ - ret = hv_vmbus_channel_establish_gpadl(sc->hn_prichan, - net_dev->send_buf, net_dev->send_buf_size, + ret = vmbus_chan_gpadl_connect(sc->hn_prichan, + net_dev->txbuf_dma.hv_paddr, net_dev->send_buf_size, &net_dev->send_buf_gpadl_handle); if (ret != 0) { + device_printf(sc->hn_dev, "chimney sending buffer gpadl " + "connect failed: %d\n", ret); goto cleanup; } @@ -364,7 +377,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ if (net_dev->rx_buf) { /* Free up the receive buffer */ - contigfree(net_dev->rx_buf, net_dev->rx_buf_size, M_NETVSC); + hyperv_dmamem_free(&net_dev->rxbuf_dma, net_dev->rx_buf); net_dev->rx_buf = NULL; } @@ -432,7 +445,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne if (net_dev->send_buf) { /* Free up the receive buffer */ - contigfree(net_dev->send_buf, net_dev->send_buf_size, M_NETVSC); + hyperv_dmamem_free(&net_dev->txbuf_dma, net_dev->send_buf); net_dev->send_buf = NULL; } Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 02:36:49 2016 (r307457) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 02:38:44 2016 (r307458) @@ -57,6 +57,7 @@ #include #include +#include #include #define HN_USE_TXDESC_BUFRING @@ -1075,6 +1076,8 @@ typedef struct netvsc_dev_ { uint32_t num_channel; + struct hyperv_dma rxbuf_dma; + struct hyperv_dma txbuf_dma; uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE]; } netvsc_dev; Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:36:49 2016 (r307457) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:38:44 2016 (r307458) @@ -337,17 +337,6 @@ failed: return ret; } -/** - * @brief Establish a GPADL for the specified buffer - */ -int -hv_vmbus_channel_establish_gpadl(struct hv_vmbus_channel *channel, - void *contig_buffer, uint32_t size, uint32_t *gpadl) -{ - return vmbus_chan_gpadl_connect(channel, - hv_get_phys_addr(contig_buffer), size, gpadl); -} - int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl0) From owner-svn-src-all@freebsd.org Mon Oct 17 02:44:29 2016 Return-Path: Delivered-To: svn-src-all@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 D379DC13F13; Mon, 17 Oct 2016 02:44:29 +0000 (UTC) (envelope-from sephe@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 943FE1CBE; Mon, 17 Oct 2016 02:44:29 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H2iSMm000830; Mon, 17 Oct 2016 02:44:28 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H2iS9o000822; Mon, 17 Oct 2016 02:44:28 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170244.u9H2iS9o000822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 02:44:28 +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: r307459 - in stable/11/sys/dev/hyperv: include netvsc storvsc utilities 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 02:44:29 -0000 Author: sephe Date: Mon Oct 17 02:44:27 2016 New Revision: 307459 URL: https://svnweb.freebsd.org/changeset/base/307459 Log: MFC 302888-302892,302986,303020-303022 302888 hyperv/hn: Busdma-fy rxbuf and chimney sending buffer Nuke unused channel GPADL API. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7211 302889 hyperv/vmbus: Back out r302888 temporarily Committed by accident w/ duplicated commit log Sponsored by: Microsoft OSTC 302890 hyperv/vmbus: Function rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7212 302891 hyperv/vmbus: Cosmetic vmbus channel close cleanup Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7213 302892 hyperv/vmbus: Cleanup channel sysctl tree creation Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7214 302986 hyperv/vmbus: Cosmetic vmbus channel open cleanup Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7217 303020 hyperv/vmbus: Cleanup cpu based channel selection. And create cpu to channel map at device attach time for storvsc(4). Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7229 303021 hyperv/vmbus: Function rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7230 303022 hyperv/vmbus: Temp/internal variable/function rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7231 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/vmbus/hv_channel.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:38:44 2016 (r307458) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 02:44:27 2016 (r307459) @@ -267,42 +267,6 @@ typedef struct hv_vmbus_channel { #define VMBUS_CHAN_ST_OPENED_SHIFT 0 #define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) -static inline void -hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on) -{ - if (!on) - channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; - else - channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; -} - -int hv_vmbus_channel_open( - hv_vmbus_channel* channel, - uint32_t send_ring_buffer_size, - uint32_t recv_ring_buffer_size, - void* user_data, - uint32_t user_data_len, - vmbus_chan_callback_t cb, - void *cbarg); - -void hv_vmbus_channel_close(hv_vmbus_channel *channel); - -int hv_vmbus_channel_teardown_gpdal( - hv_vmbus_channel* channel, - uint32_t gpadl_handle); - -int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, - bus_addr_t paddr, int size, uint32_t *gpadl); - -struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); - -void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); -void vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan); -struct hv_vmbus_channel ** - vmbus_get_subchan(struct hv_vmbus_channel *pri_chan, int subchan_cnt); -void vmbus_rel_subchan(struct hv_vmbus_channel **subchan, int subchan_cnt); -void vmbus_drain_subchan(struct hv_vmbus_channel *pri_chan); - /** * @brief Get physical address from virtual */ Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 02:38:44 2016 (r307458) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 02:44:27 2016 (r307459) @@ -89,6 +89,27 @@ struct vmbus_chanpkt_rxbuf { struct hv_vmbus_channel; +int vmbus_chan_open(struct hv_vmbus_channel *chan, + int txbr_size, int rxbr_size, const void *udata, int udlen, + vmbus_chan_callback_t cb, void *cbarg); +void vmbus_chan_close(struct hv_vmbus_channel *chan); + +int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); +int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, + uint32_t gpadl); + +void vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu); +void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan); +struct hv_vmbus_channel * + vmbus_chan_cpu2chan(struct hv_vmbus_channel *chan, int cpu); +void vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on); + +struct hv_vmbus_channel ** + vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt); +void vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt); +void vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan); + int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, uint64_t *xactid); int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:38:44 2016 (r307458) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 02:44:27 2016 (r307459) @@ -363,7 +363,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ /* Tear down the gpadl on the vsp end */ if (net_dev->rx_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, + ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, net_dev->rx_buf_gpadl_handle); /* * If we failed here, we might as well return and have a leak @@ -430,7 +430,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne /* Tear down the gpadl on the vsp end */ if (net_dev->send_buf_gpadl_handle) { - ret = hv_vmbus_channel_teardown_gpdal(net_dev->sc->hn_prichan, + ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, net_dev->send_buf_gpadl_handle); /* @@ -645,7 +645,7 @@ hv_nv_subchan_attach(struct hv_vmbus_cha { chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); - hv_vmbus_channel_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, + vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); } @@ -675,7 +675,7 @@ hv_nv_on_device_add(struct hn_softc *sc, /* * Open the channel */ - ret = hv_vmbus_channel_open(chan, + ret = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); if (ret != 0) { @@ -695,7 +695,7 @@ hv_nv_on_device_add(struct hn_softc *sc, close: /* Now, we can close the channel safely */ free(chan->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(chan); + vmbus_chan_close(chan); cleanup: /* @@ -726,7 +726,7 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(sc->hn_prichan); + vmbus_chan_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); free(net_dev, M_NETVSC); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 02:38:44 2016 (r307458) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 02:44:27 2016 (r307459) @@ -1586,7 +1586,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } /* Wait for subchannels to be destroyed */ - vmbus_drain_subchan(sc->hn_prichan); + vmbus_subchan_drain(sc->hn_prichan); error = hv_rf_on_device_add(sc, &device_info, sc->hn_rx_ring_inuse); @@ -2950,7 +2950,7 @@ hn_channel_attach(struct hn_softc *sc, s } /* Bind channel to a proper CPU */ - vmbus_channel_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); + vmbus_chan_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); } static void @@ -2973,7 +2973,7 @@ hn_subchan_setup(struct hn_softc *sc) int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(sc->hn_prichan, subchan_cnt); + subchan = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { @@ -2983,7 +2983,7 @@ hn_subchan_setup(struct hn_softc *sc) } /* Release the sub-channels */ - vmbus_rel_subchan(subchan, subchan_cnt); + vmbus_subchan_rel(subchan, subchan_cnt); if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); } Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:38:44 2016 (r307458) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 02:44:27 2016 (r307459) @@ -147,6 +147,8 @@ struct storvsc_softc { struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; device_t hs_dev; + + struct hv_vmbus_channel *hs_cpu2chan[MAXCPU]; }; @@ -315,8 +317,8 @@ storvsc_subchan_attach(struct storvsc_so memset(&props, 0, sizeof(props)); new_channel->hv_chan_priv1 = sc; - vmbus_channel_cpu_rr(new_channel); - ret = hv_vmbus_channel_open(new_channel, + vmbus_chan_cpu_rr(new_channel); + ret = vmbus_chan_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, (void *)&props, @@ -377,14 +379,14 @@ storvsc_send_multichannel_request(struct } /* Wait for sub-channels setup to complete. */ - subchan = vmbus_get_subchan(sc->hs_chan, request_channels_cnt); + subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt); /* Attach the sub-channels. */ for (i = 0; i < request_channels_cnt; ++i) storvsc_subchan_attach(sc, subchan[i]); /* Release the sub-channels. */ - vmbus_rel_subchan(subchan, request_channels_cnt); + vmbus_subchan_rel(subchan, request_channels_cnt); if (bootverbose) printf("Storvsc create multi-channel success!\n"); @@ -574,8 +576,8 @@ hv_storvsc_connect_vsp(struct storvsc_so * Open the channel */ KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); - vmbus_channel_cpu_rr(sc->hs_chan); - ret = hv_vmbus_channel_open( + vmbus_chan_cpu_rr(sc->hs_chan); + ret = vmbus_chan_open( sc->hs_chan, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -665,7 +667,7 @@ hv_storvsc_io_request(struct storvsc_sof vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; - outgoing_channel = vmbus_select_outgoing_channel(sc->hs_chan); + outgoing_channel = sc->hs_cpu2chan[curcpu]; mtx_unlock(&request->softc->hs_lock); if (request->prp_list.gpa_range.gpa_len) { @@ -872,6 +874,20 @@ storvsc_probe(device_t dev) return (ret); } +static void +storvsc_create_cpu2chan(struct storvsc_softc *sc) +{ + int cpu; + + CPU_FOREACH(cpu) { + sc->hs_cpu2chan[cpu] = vmbus_chan_cpu2chan(sc->hs_chan, cpu); + if (bootverbose) { + device_printf(sc->hs_dev, "cpu%d -> chan%u\n", + cpu, sc->hs_cpu2chan[cpu]->ch_id); + } + } +} + /** * @brief StorVSC attach function * @@ -969,6 +985,9 @@ storvsc_attach(device_t dev) goto cleanup; } + /* Construct cpu to channel mapping */ + storvsc_create_cpu2chan(sc); + /* * Create the device queue. * Hyper-V maps each target to one SCSI HBA @@ -1083,7 +1102,7 @@ storvsc_detach(device_t dev) * under the protection of the incoming channel lock. */ - hv_vmbus_channel_close(sc->hs_chan); + vmbus_chan_close(sc->hs_chan); mtx_lock(&sc->hs_lock); while (!LIST_EMPTY(&sc->hs_free_list)) { Modified: stable/11/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 02:38:44 2016 (r307458) +++ stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 02:44:27 2016 (r307459) @@ -40,6 +40,7 @@ #include #include +#include #include "hv_util.h" void @@ -89,9 +90,9 @@ hv_util_attach(device_t dev) * Turn off batched reading for all util drivers before we open the * channel. */ - hv_set_channel_read_state(softc->channel, FALSE); + vmbus_chan_set_readbatch(softc->channel, false); - ret = hv_vmbus_channel_open(softc->channel, 4 * PAGE_SIZE, + ret = vmbus_chan_open(softc->channel, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0, softc->callback, softc); @@ -110,7 +111,7 @@ hv_util_detach(device_t dev) { struct hv_util_sc *sc = device_get_softc(dev); - hv_vmbus_channel_close(sc->channel); + vmbus_chan_close(sc->channel); free(sc->receive_buffer, M_DEVBUF); return (0); Modified: stable/11/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:38:44 2016 (r307458) +++ stable/11/sys/dev/hyperv/vmbus/hv_channel.c Mon Oct 17 02:44:27 2016 (r307459) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include -static void vmbus_chan_send_event(hv_vmbus_channel* channel); +static void vmbus_chan_signal_tx(struct hv_vmbus_channel *chan); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); @@ -81,195 +81,194 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_M * @brief Trigger an event notification on the specified channel */ static void -vmbus_chan_send_event(hv_vmbus_channel *channel) +vmbus_chan_signal_tx(struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = channel->vmbus_sc; - uint32_t chanid = channel->ch_id; + struct vmbus_softc *sc = chan->vmbus_sc; + uint32_t chanid = chan->ch_id; atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - if (channel->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { atomic_set_int( - &sc->vmbus_mnf2->mnf_trigs[channel->ch_montrig_idx].mt_pending, - channel->ch_montrig_mask); + &sc->vmbus_mnf2->mnf_trigs[chan->ch_montrig_idx].mt_pending, + chan->ch_montrig_mask); } else { - hypercall_signal_event(channel->ch_monprm_dma.hv_paddr); + hypercall_signal_event(chan->ch_monprm_dma.hv_paddr); } } static int -vmbus_channel_sysctl_monalloc(SYSCTL_HANDLER_ARGS) +vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS) { struct hv_vmbus_channel *chan = arg1; - int alloc = 0; + int mnf = 0; if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) - alloc = 1; - return sysctl_handle_int(oidp, &alloc, 0, req); + mnf = 1; + return sysctl_handle_int(oidp, &mnf, 0, req); } static void -vmbus_channel_sysctl_create(hv_vmbus_channel* channel) +vmbus_chan_sysctl_create(struct hv_vmbus_channel *chan) { - device_t dev; - struct sysctl_oid *devch_sysctl; - struct sysctl_oid *devch_id_sysctl, *devch_sub_sysctl; - struct sysctl_oid *devch_id_in_sysctl, *devch_id_out_sysctl; + struct sysctl_oid *ch_tree, *chid_tree, *br_tree; struct sysctl_ctx_list *ctx; uint32_t ch_id; - uint16_t sub_ch_id; char name[16]; - - hv_vmbus_channel* primary_ch = channel->ch_prichan; - if (primary_ch == NULL) { - dev = channel->ch_dev; - ch_id = channel->ch_id; - } else { - dev = primary_ch->ch_dev; - ch_id = primary_ch->ch_id; - sub_ch_id = channel->ch_subidx; - } - ctx = &channel->ch_sysctl_ctx; + /* + * Add sysctl nodes related to this channel to this + * channel's sysctl ctx, so that they can be destroyed + * independently upon close of this channel, which can + * happen even if the device is not detached. + */ + ctx = &chan->ch_sysctl_ctx; sysctl_ctx_init(ctx); - /* This creates dev.DEVNAME.DEVUNIT.channel tree */ - devch_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "channel", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - /* This creates dev.DEVNAME.DEVUNIT.channel.CHANID tree */ + + /* + * Create dev.NAME.UNIT.channel tree. + */ + ch_tree = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(chan->ch_dev)), + OID_AUTO, "channel", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (ch_tree == NULL) + return; + + /* + * Create dev.NAME.UNIT.channel.CHANID tree. + */ + if (VMBUS_CHAN_ISPRIMARY(chan)) + ch_id = chan->ch_id; + else + ch_id = chan->ch_prichan->ch_id; snprintf(name, sizeof(name), "%d", ch_id); - devch_id_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_sysctl), - OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - - if (primary_ch != NULL) { - devch_sub_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, "sub", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - snprintf(name, sizeof(name), "%d", sub_ch_id); - devch_id_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_sub_sysctl), - OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - - SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, "chanid", CTLFLAG_RD, - &channel->ch_id, 0, "channel id"); - } - SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "cpu", CTLFLAG_RD, &channel->ch_cpuid, 0, "owner CPU id"); - SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(devch_id_sysctl), OID_AUTO, - "monitor_allocated", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, - channel, 0, vmbus_channel_sysctl_monalloc, "I", - "is monitor allocated to this channel"); - - devch_id_in_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, - "in", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - devch_id_out_sysctl = SYSCTL_ADD_NODE(ctx, - SYSCTL_CHILDREN(devch_id_sysctl), - OID_AUTO, - "out", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - hv_ring_buffer_stat(ctx, - SYSCTL_CHILDREN(devch_id_in_sysctl), - &(channel->inbound), - "inbound ring buffer stats"); - hv_ring_buffer_stat(ctx, - SYSCTL_CHILDREN(devch_id_out_sysctl), - &(channel->outbound), - "outbound ring buffer stats"); + chid_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(ch_tree), + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (chid_tree == NULL) + return; + + if (!VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Create dev.NAME.UNIT.channel.CHANID.sub tree. + */ + ch_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), + OID_AUTO, "sub", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (ch_tree == NULL) + return; + + /* + * Create dev.NAME.UNIT.channel.CHANID.sub.SUBIDX tree. + * + * NOTE: + * chid_tree is changed to this new sysctl tree. + */ + snprintf(name, sizeof(name), "%d", chan->ch_subidx); + chid_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(ch_tree), + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (chid_tree == NULL) + return; + + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "chanid", CTLFLAG_RD, &chan->ch_id, 0, "channel id"); + } + + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "cpu", CTLFLAG_RD, &chan->ch_cpuid, 0, "owner CPU id"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "mnf", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + chan, 0, vmbus_chan_sysctl_mnf, "I", + "has monitor notification facilities"); + + /* + * Create sysctl tree for RX bufring. + */ + br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "in", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (br_tree != NULL) { + hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), + &chan->inbound, "inbound ring buffer stats"); + } + + /* + * Create sysctl tree for TX bufring. + */ + br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "out", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (br_tree != NULL) { + hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), + &chan->outbound, "outbound ring buffer stats"); + } } -/** - * @brief Open the specified channel - */ int -hv_vmbus_channel_open( - hv_vmbus_channel* new_channel, - uint32_t send_ring_buffer_size, - uint32_t recv_ring_buffer_size, - void* user_data, - uint32_t user_data_len, - vmbus_chan_callback_t cb, - void *cbarg) +vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, + const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) { - struct vmbus_softc *sc = new_channel->vmbus_sc; + struct vmbus_softc *sc = chan->vmbus_sc; const struct vmbus_chanmsg_chopen_resp *resp; const struct vmbus_message *msg; struct vmbus_chanmsg_chopen *req; struct vmbus_msghc *mh; uint32_t status; - int ret = 0; + int error; uint8_t *br; - if (user_data_len > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { + if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { device_printf(sc->vmbus_dev, - "invalid udata len %u for chan%u\n", - user_data_len, new_channel->ch_id); + "invalid udata len %d for chan%u\n", udlen, chan->ch_id); return EINVAL; } - KASSERT((send_ring_buffer_size & PAGE_MASK) == 0, + KASSERT((txbr_size & PAGE_MASK) == 0, ("send bufring size is not multiple page")); - KASSERT((recv_ring_buffer_size & PAGE_MASK) == 0, + KASSERT((rxbr_size & PAGE_MASK) == 0, ("recv bufring size is not multiple page")); - if (atomic_testandset_int(&new_channel->ch_stflags, + if (atomic_testandset_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED_SHIFT)) - panic("double-open chan%u", new_channel->ch_id); + panic("double-open chan%u", chan->ch_id); - new_channel->ch_cb = cb; - new_channel->ch_cbarg = cbarg; + chan->ch_cb = cb; + chan->ch_cbarg = cbarg; - vmbus_chan_update_evtflagcnt(sc, new_channel); + vmbus_chan_update_evtflagcnt(sc, chan); - new_channel->ch_tq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq, - new_channel->ch_cpuid); - if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) { - TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task, - new_channel); - } else { - TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task_nobatch, - new_channel); - } + chan->ch_tq = VMBUS_PCPU_GET(chan->vmbus_sc, event_tq, chan->ch_cpuid); + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan); + else + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task_nobatch, chan); /* * Allocate the TX+RX bufrings. * XXX should use ch_dev dtag */ br = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), - PAGE_SIZE, 0, send_ring_buffer_size + recv_ring_buffer_size, - &new_channel->ch_bufring_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + PAGE_SIZE, 0, txbr_size + rxbr_size, &chan->ch_bufring_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); if (br == NULL) { device_printf(sc->vmbus_dev, "bufring allocation failed\n"); - ret = ENOMEM; + error = ENOMEM; goto failed; } - new_channel->ch_bufring = br; + chan->ch_bufring = br; /* TX bufring comes first */ - hv_vmbus_ring_buffer_init(&new_channel->outbound, - br, send_ring_buffer_size); + hv_vmbus_ring_buffer_init(&chan->outbound, br, txbr_size); /* RX bufring immediately follows TX bufring */ - hv_vmbus_ring_buffer_init(&new_channel->inbound, - br + send_ring_buffer_size, recv_ring_buffer_size); + hv_vmbus_ring_buffer_init(&chan->inbound, br + txbr_size, rxbr_size); /* Create sysctl tree for this channel */ - vmbus_channel_sysctl_create(new_channel); + vmbus_chan_sysctl_create(chan); /* * Connect the bufrings, both RX and TX, to this channel. */ - ret = vmbus_chan_gpadl_connect(new_channel, - new_channel->ch_bufring_dma.hv_paddr, - send_ring_buffer_size + recv_ring_buffer_size, - &new_channel->ch_bufring_gpadl); - if (ret != 0) { + error = vmbus_chan_gpadl_connect(chan, chan->ch_bufring_dma.hv_paddr, + txbr_size + rxbr_size, &chan->ch_bufring_gpadl); + if (error) { device_printf(sc->vmbus_dev, - "failed to connect bufring GPADL to chan%u\n", - new_channel->ch_id); + "failed to connect bufring GPADL to chan%u\n", chan->ch_id); goto failed; } @@ -280,26 +279,26 @@ hv_vmbus_channel_open( if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chopen(chan%u)\n", - new_channel->ch_id); - ret = ENXIO; + chan->ch_id); + error = ENXIO; goto failed; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; - req->chm_chanid = new_channel->ch_id; - req->chm_openid = new_channel->ch_id; - req->chm_gpadl = new_channel->ch_bufring_gpadl; - req->chm_vcpuid = new_channel->ch_vcpuid; - req->chm_rxbr_pgofs = send_ring_buffer_size >> PAGE_SHIFT; - if (user_data_len) - memcpy(req->chm_udata, user_data, user_data_len); + req->chm_chanid = chan->ch_id; + req->chm_openid = chan->ch_id; + req->chm_gpadl = chan->ch_bufring_gpadl; + req->chm_vcpuid = chan->ch_vcpuid; + req->chm_txbr_pgcnt = txbr_size >> PAGE_SHIFT; + if (udlen > 0) + memcpy(req->chm_udata, udata, udlen); - ret = vmbus_msghc_exec(sc, mh); - if (ret != 0) { + error = vmbus_msghc_exec(sc, mh); + if (error) { device_printf(sc->vmbus_dev, "chopen(chan%u) msg hypercall exec failed: %d\n", - new_channel->ch_id, ret); + chan->ch_id, error); vmbus_msghc_put(sc, mh); goto failed; } @@ -313,28 +312,25 @@ hv_vmbus_channel_open( if (status == 0) { if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u opened\n", - new_channel->ch_id); + chan->ch_id); } return 0; } - device_printf(sc->vmbus_dev, "failed to open chan%u\n", - new_channel->ch_id); - ret = ENXIO; + device_printf(sc->vmbus_dev, "failed to open chan%u\n", chan->ch_id); + error = ENXIO; failed: - if (new_channel->ch_bufring_gpadl) { - hv_vmbus_channel_teardown_gpdal(new_channel, - new_channel->ch_bufring_gpadl); - new_channel->ch_bufring_gpadl = 0; - } - if (new_channel->ch_bufring != NULL) { - hyperv_dmamem_free(&new_channel->ch_bufring_dma, - new_channel->ch_bufring); - new_channel->ch_bufring = NULL; + if (chan->ch_bufring_gpadl) { + vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); + chan->ch_bufring_gpadl = 0; + } + if (chan->ch_bufring != NULL) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; } - atomic_clear_int(&new_channel->ch_stflags, VMBUS_CHAN_ST_OPENED); - return ret; + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); + return error; } int @@ -468,7 +464,7 @@ vmbus_chan_gpadl_connect(struct hv_vmbus * Disconnect the GPA from the target channel */ int -hv_vmbus_channel_teardown_gpdal(struct hv_vmbus_channel *chan, uint32_t gpadl) +vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl) { struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; @@ -505,41 +501,45 @@ hv_vmbus_channel_teardown_gpdal(struct h } static void -hv_vmbus_channel_close_internal(hv_vmbus_channel *channel) +vmbus_chan_close_internal(struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = channel->vmbus_sc; + struct vmbus_softc *sc = chan->vmbus_sc; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; - struct taskqueue *tq = channel->ch_tq; + struct taskqueue *tq = chan->ch_tq; int error; /* TODO: stringent check */ - atomic_clear_int(&channel->ch_stflags, VMBUS_CHAN_ST_OPENED); - - sysctl_ctx_free(&channel->ch_sysctl_ctx); + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); /* - * Set ch_tq to NULL to avoid more requests be scheduled + * Free this channel's sysctl tree attached to its device's + * sysctl tree. */ - channel->ch_tq = NULL; - taskqueue_drain(tq, &channel->ch_task); - channel->ch_cb = NULL; + sysctl_ctx_free(&chan->ch_sysctl_ctx); - /** - * Send a closing message + /* + * Set ch_tq to NULL to avoid more requests be scheduled. + * XXX pretty broken; need rework. */ + chan->ch_tq = NULL; + taskqueue_drain(tq, &chan->ch_task); + chan->ch_cb = NULL; + /* + * Close this channel. + */ mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { device_printf(sc->vmbus_dev, "can not get msg hypercall for chclose(chan%u)\n", - channel->ch_id); + chan->ch_id); return; } req = vmbus_msghc_dataptr(mh); req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; - req->chm_chanid = channel->ch_id; + req->chm_chanid = chan->ch_id; error = vmbus_msghc_exec_noresult(mh); vmbus_msghc_put(sc, mh); @@ -547,30 +547,28 @@ hv_vmbus_channel_close_internal(hv_vmbus if (error) { device_printf(sc->vmbus_dev, "chclose(chan%u) msg hypercall exec failed: %d\n", - channel->ch_id, error); + chan->ch_id, error); return; } else if (bootverbose) { - device_printf(sc->vmbus_dev, "close chan%u\n", - channel->ch_id); + device_printf(sc->vmbus_dev, "close chan%u\n", chan->ch_id); } - /* Tear down the gpadl for the channel's ring buffer */ - if (channel->ch_bufring_gpadl) { - hv_vmbus_channel_teardown_gpdal(channel, - channel->ch_bufring_gpadl); - channel->ch_bufring_gpadl = 0; + /* + * Disconnect the TX+RX bufrings from this channel. + */ + if (chan->ch_bufring_gpadl) { + vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); + chan->ch_bufring_gpadl = 0; } - /* TODO: Send a msg to release the childRelId */ - - /* cleanup the ring buffers for this channel */ - hv_ring_buffer_cleanup(&channel->outbound); - hv_ring_buffer_cleanup(&channel->inbound); - - if (channel->ch_bufring != NULL) { - hyperv_dmamem_free(&channel->ch_bufring_dma, - channel->ch_bufring); - channel->ch_bufring = NULL; + /* + * Destroy the TX+RX bufrings. + */ + hv_ring_buffer_cleanup(&chan->outbound); + hv_ring_buffer_cleanup(&chan->inbound); + if (chan->ch_bufring != NULL) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; } } @@ -580,7 +578,7 @@ hv_vmbus_channel_close_internal(hv_vmbus * are not being opened. */ void -hv_vmbus_channel_close(struct hv_vmbus_channel *chan) +vmbus_chan_close(struct hv_vmbus_channel *chan) { int subchan_cnt; @@ -600,14 +598,14 @@ hv_vmbus_channel_close(struct hv_vmbus_c struct hv_vmbus_channel **subchan; int i; - subchan = vmbus_get_subchan(chan, subchan_cnt); + subchan = vmbus_subchan_get(chan, subchan_cnt); for (i = 0; i < subchan_cnt; ++i) - hv_vmbus_channel_close_internal(subchan[i]); - vmbus_rel_subchan(subchan, subchan_cnt); + vmbus_chan_close_internal(subchan[i]); + vmbus_subchan_rel(subchan, subchan_cnt); } /* Then close the primary channel. */ - hv_vmbus_channel_close_internal(chan); + vmbus_chan_close_internal(chan); } int @@ -639,7 +637,7 @@ vmbus_chan_send(struct hv_vmbus_channel error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt); if (!error && send_evt) - vmbus_chan_send_event(chan); + vmbus_chan_signal_tx(chan); return error; } @@ -679,7 +677,7 @@ vmbus_chan_send_sglist(struct hv_vmbus_c error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); if (!error && send_evt) - vmbus_chan_send_event(chan); + vmbus_chan_signal_tx(chan); return error; } @@ -721,7 +719,7 @@ vmbus_chan_send_prplist(struct hv_vmbus_ error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); if (!error && send_evt) - vmbus_chan_send_event(chan); + vmbus_chan_signal_tx(chan); return error; } @@ -840,20 +838,20 @@ vmbus_event_flags_proc(struct vmbus_soft chid_base = f << VMBUS_EVTFLAG_SHIFT; while ((chid_ofs = ffsl(flags)) != 0) { - struct hv_vmbus_channel *channel; + struct hv_vmbus_channel *chan; --chid_ofs; /* NOTE: ffsl is 1-based */ flags &= ~(1UL << chid_ofs); - channel = sc->vmbus_chmap[chid_base + chid_ofs]; + chan = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ - if (channel == NULL || channel->ch_tq == NULL) + if (chan == NULL || chan->ch_tq == NULL) continue; - if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) - hv_ring_buffer_read_begin(&channel->inbound); - taskqueue_enqueue(channel->ch_tq, &channel->ch_task); + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + hv_ring_buffer_read_begin(&chan->inbound); + taskqueue_enqueue(chan->ch_tq, &chan->ch_task); } } } @@ -1038,7 +1036,7 @@ vmbus_chan_add(struct hv_vmbus_channel * } void -vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu) +vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu) { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); @@ -1058,13 +1056,13 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch } void -vmbus_channel_cpu_rr(struct hv_vmbus_channel *chan) +vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan) { static uint32_t vmbus_chan_nextcpu; int cpu; cpu = atomic_fetchadd_int(&vmbus_chan_nextcpu, 1) % mp_ncpus; - vmbus_channel_cpu_set(chan, cpu); + vmbus_chan_cpu_set(chan, cpu); } static void @@ -1073,9 +1071,9 @@ vmbus_chan_cpu_default(struct hv_vmbus_c /* * By default, pin the channel to cpu0. Devices having * special channel-cpu mapping requirement should call - * vmbus_channel_cpu_{set,rr}(). + * vmbus_chan_cpu_{set,rr}(). */ - vmbus_channel_cpu_set(chan, 0); + vmbus_chan_cpu_set(chan, 0); } static void @@ -1251,65 +1249,67 @@ vmbus_chan_destroy_all(struct vmbus_soft mtx_unlock(&sc->vmbus_prichan_lock); } -/** - * @brief Select the best outgoing channel - * +/* * The channel whose vcpu binding is closest to the currect vcpu will * be selected. - * If no multi-channel, always select primary channel - * - * @param primary - primary channel + * If no multi-channel, always select primary channel. */ struct hv_vmbus_channel * -vmbus_select_outgoing_channel(struct hv_vmbus_channel *primary) +vmbus_chan_cpu2chan(struct hv_vmbus_channel *prichan, int cpu) { - hv_vmbus_channel *new_channel = NULL; - hv_vmbus_channel *outgoing_channel = primary; - int old_cpu_distance = 0; - int new_cpu_distance = 0; - int cur_vcpu = 0; - int smp_pro_id = PCPU_GET(cpuid); + struct hv_vmbus_channel *sel, *chan; + uint32_t vcpu, sel_dist; - if (TAILQ_EMPTY(&primary->ch_subchans)) { - return outgoing_channel; - } + KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpuid %d", cpu)); + if (TAILQ_EMPTY(&prichan->ch_subchans)) + return prichan; - if (smp_pro_id >= MAXCPU) { - return outgoing_channel; - } + vcpu = VMBUS_PCPU_GET(prichan->vmbus_sc, vcpuid, cpu); - cur_vcpu = VMBUS_PCPU_GET(primary->vmbus_sc, vcpuid, smp_pro_id); - - /* XXX need lock */ - TAILQ_FOREACH(new_channel, &primary->ch_subchans, ch_sublink) { - if ((new_channel->ch_stflags & VMBUS_CHAN_ST_OPENED) == 0) { - continue; - } +#define CHAN_VCPU_DIST(ch, vcpu) \ + (((ch)->ch_vcpuid > (vcpu)) ? \ + ((ch)->ch_vcpuid - (vcpu)) : ((vcpu) - (ch)->ch_vcpuid)) - if (new_channel->ch_vcpuid == cur_vcpu){ - return new_channel; - } +#define CHAN_SELECT(ch) \ +do { \ + sel = ch; \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 03:07:07 2016 Return-Path: Delivered-To: svn-src-all@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 8FD5DC143E7; Mon, 17 Oct 2016 03:07:07 +0000 (UTC) (envelope-from sephe@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 579B4173A; Mon, 17 Oct 2016 03:07:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H376ER009357; Mon, 17 Oct 2016 03:07:06 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H376G3009353; Mon, 17 Oct 2016 03:07:06 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170307.u9H376G3009353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:07: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: r307460 - in stable/11/sys: conf dev/hyperv/vmbus 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:07:07 -0000 Author: sephe Date: Mon Oct 17 03:07:06 2016 New Revision: 307460 URL: https://svnweb.freebsd.org/changeset/base/307460 Log: MFC 303023 hyperv/vmbus: Rename laundered vmbus channel code Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7232 Added: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c - copied unchanged from r303023, head/sys/dev/hyperv/vmbus/vmbus_chan.c Deleted: stable/11/sys/dev/hyperv/vmbus/hv_channel.c Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 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 Mon Oct 17 02:44:27 2016 (r307459) +++ stable/11/sys/conf/files.amd64 Mon Oct 17 03:07:06 2016 (r307460) @@ -301,11 +301,11 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.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_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Mon Oct 17 02:44:27 2016 (r307459) +++ stable/11/sys/conf/files.i386 Mon Oct 17 03:07:06 2016 (r307460) @@ -258,11 +258,11 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_channel.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.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_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv Copied: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c (from r303023, head/sys/dev/hyperv/vmbus/vmbus_chan.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:07:06 2016 (r307460, copy of r303023, head/sys/dev/hyperv/vmbus/vmbus_chan.c) @@ -0,0 +1,1380 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +static void vmbus_chan_signal_tx(struct hv_vmbus_channel *chan); +static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, + const struct hv_vmbus_channel *); + +static void vmbus_chan_task(void *, int); +static void vmbus_chan_task_nobatch(void *, int); +static void vmbus_chan_detach_task(void *, int); + +static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, + const struct vmbus_message *); + +/* + * Vmbus channel message processing. + */ +static const vmbus_chanmsg_proc_t +vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = { + VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer), + VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind), + + VMBUS_CHANMSG_PROC_WAKEUP(CHOPEN_RESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_CONNRESP), + VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) +}; + +/** + * @brief Trigger an event notification on the specified channel + */ +static void +vmbus_chan_signal_tx(struct hv_vmbus_channel *chan) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + uint32_t chanid = chan->ch_id; + + atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], + 1UL << (chanid & VMBUS_EVTFLAG_MASK)); + + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) { + atomic_set_int( + &sc->vmbus_mnf2->mnf_trigs[chan->ch_montrig_idx].mt_pending, + chan->ch_montrig_mask); + } else { + hypercall_signal_event(chan->ch_monprm_dma.hv_paddr); + } +} + +static int +vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS) +{ + struct hv_vmbus_channel *chan = arg1; + int mnf = 0; + + if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) + mnf = 1; + return sysctl_handle_int(oidp, &mnf, 0, req); +} + +static void +vmbus_chan_sysctl_create(struct hv_vmbus_channel *chan) +{ + struct sysctl_oid *ch_tree, *chid_tree, *br_tree; + struct sysctl_ctx_list *ctx; + uint32_t ch_id; + char name[16]; + + /* + * Add sysctl nodes related to this channel to this + * channel's sysctl ctx, so that they can be destroyed + * independently upon close of this channel, which can + * happen even if the device is not detached. + */ + ctx = &chan->ch_sysctl_ctx; + sysctl_ctx_init(ctx); + + /* + * Create dev.NAME.UNIT.channel tree. + */ + ch_tree = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(chan->ch_dev)), + OID_AUTO, "channel", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (ch_tree == NULL) + return; + + /* + * Create dev.NAME.UNIT.channel.CHANID tree. + */ + if (VMBUS_CHAN_ISPRIMARY(chan)) + ch_id = chan->ch_id; + else + ch_id = chan->ch_prichan->ch_id; + snprintf(name, sizeof(name), "%d", ch_id); + chid_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(ch_tree), + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (chid_tree == NULL) + return; + + if (!VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Create dev.NAME.UNIT.channel.CHANID.sub tree. + */ + ch_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), + OID_AUTO, "sub", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (ch_tree == NULL) + return; + + /* + * Create dev.NAME.UNIT.channel.CHANID.sub.SUBIDX tree. + * + * NOTE: + * chid_tree is changed to this new sysctl tree. + */ + snprintf(name, sizeof(name), "%d", chan->ch_subidx); + chid_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(ch_tree), + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (chid_tree == NULL) + return; + + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "chanid", CTLFLAG_RD, &chan->ch_id, 0, "channel id"); + } + + SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "cpu", CTLFLAG_RD, &chan->ch_cpuid, 0, "owner CPU id"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "mnf", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + chan, 0, vmbus_chan_sysctl_mnf, "I", + "has monitor notification facilities"); + + /* + * Create sysctl tree for RX bufring. + */ + br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "in", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (br_tree != NULL) { + hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), + &chan->inbound, "inbound ring buffer stats"); + } + + /* + * Create sysctl tree for TX bufring. + */ + br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "out", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (br_tree != NULL) { + hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), + &chan->outbound, "outbound ring buffer stats"); + } +} + +int +vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, + const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + const struct vmbus_chanmsg_chopen_resp *resp; + const struct vmbus_message *msg; + struct vmbus_chanmsg_chopen *req; + struct vmbus_msghc *mh; + uint32_t status; + int error; + uint8_t *br; + + if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { + device_printf(sc->vmbus_dev, + "invalid udata len %d for chan%u\n", udlen, chan->ch_id); + return EINVAL; + } + KASSERT((txbr_size & PAGE_MASK) == 0, + ("send bufring size is not multiple page")); + KASSERT((rxbr_size & PAGE_MASK) == 0, + ("recv bufring size is not multiple page")); + + if (atomic_testandset_int(&chan->ch_stflags, + VMBUS_CHAN_ST_OPENED_SHIFT)) + panic("double-open chan%u", chan->ch_id); + + chan->ch_cb = cb; + chan->ch_cbarg = cbarg; + + vmbus_chan_update_evtflagcnt(sc, chan); + + chan->ch_tq = VMBUS_PCPU_GET(chan->vmbus_sc, event_tq, chan->ch_cpuid); + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan); + else + TASK_INIT(&chan->ch_task, 0, vmbus_chan_task_nobatch, chan); + + /* + * Allocate the TX+RX bufrings. + * XXX should use ch_dev dtag + */ + br = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + PAGE_SIZE, 0, txbr_size + rxbr_size, &chan->ch_bufring_dma, + BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (br == NULL) { + device_printf(sc->vmbus_dev, "bufring allocation failed\n"); + error = ENOMEM; + goto failed; + } + chan->ch_bufring = br; + + /* TX bufring comes first */ + hv_vmbus_ring_buffer_init(&chan->outbound, br, txbr_size); + /* RX bufring immediately follows TX bufring */ + hv_vmbus_ring_buffer_init(&chan->inbound, br + txbr_size, rxbr_size); + + /* Create sysctl tree for this channel */ + vmbus_chan_sysctl_create(chan); + + /* + * Connect the bufrings, both RX and TX, to this channel. + */ + error = vmbus_chan_gpadl_connect(chan, chan->ch_bufring_dma.hv_paddr, + txbr_size + rxbr_size, &chan->ch_bufring_gpadl); + if (error) { + device_printf(sc->vmbus_dev, + "failed to connect bufring GPADL to chan%u\n", chan->ch_id); + goto failed; + } + + /* + * Open channel w/ the bufring GPADL on the target CPU. + */ + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chopen(chan%u)\n", + chan->ch_id); + error = ENXIO; + goto failed; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHOPEN; + req->chm_chanid = chan->ch_id; + req->chm_openid = chan->ch_id; + req->chm_gpadl = chan->ch_bufring_gpadl; + req->chm_vcpuid = chan->ch_vcpuid; + req->chm_txbr_pgcnt = txbr_size >> PAGE_SHIFT; + if (udlen > 0) + memcpy(req->chm_udata, udata, udlen); + + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "chopen(chan%u) msg hypercall exec failed: %d\n", + chan->ch_id, error); + vmbus_msghc_put(sc, mh); + goto failed; + } + + msg = vmbus_msghc_wait_result(sc, mh); + resp = (const struct vmbus_chanmsg_chopen_resp *)msg->msg_data; + status = resp->chm_status; + + vmbus_msghc_put(sc, mh); + + if (status == 0) { + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u opened\n", + chan->ch_id); + } + return 0; + } + + device_printf(sc->vmbus_dev, "failed to open chan%u\n", chan->ch_id); + error = ENXIO; + +failed: + if (chan->ch_bufring_gpadl) { + vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); + chan->ch_bufring_gpadl = 0; + } + if (chan->ch_bufring != NULL) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; + } + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); + return error; +} + +int +vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, + int size, uint32_t *gpadl0) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_gpadl_conn *req; + const struct vmbus_message *msg; + size_t reqsz; + uint32_t gpadl, status; + int page_count, range_len, i, cnt, error; + uint64_t page_id; + + /* + * Preliminary checks. + */ + + KASSERT((size & PAGE_MASK) == 0, + ("invalid GPA size %d, not multiple page size", size)); + page_count = size >> PAGE_SHIFT; + + KASSERT((paddr & PAGE_MASK) == 0, + ("GPA is not page aligned %jx", (uintmax_t)paddr)); + page_id = paddr >> PAGE_SHIFT; + + range_len = __offsetof(struct vmbus_gpa_range, gpa_page[page_count]); + /* + * We don't support multiple GPA ranges. + */ + if (range_len > UINT16_MAX) { + device_printf(sc->vmbus_dev, "GPA too large, %d pages\n", + page_count); + return EOPNOTSUPP; + } + + /* + * Allocate GPADL id. + */ + gpadl = vmbus_gpadl_alloc(sc); + *gpadl0 = gpadl; + + /* + * Connect this GPADL to the target channel. + * + * NOTE: + * Since each message can only hold small set of page + * addresses, several messages may be required to + * complete the connection. + */ + if (page_count > VMBUS_CHANMSG_GPADL_CONN_PGMAX) + cnt = VMBUS_CHANMSG_GPADL_CONN_PGMAX; + else + cnt = page_count; + page_count -= cnt; + + reqsz = __offsetof(struct vmbus_chanmsg_gpadl_conn, + chm_range.gpa_page[cnt]); + mh = vmbus_msghc_get(sc, reqsz); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for gpadl->chan%u\n", + chan->ch_id); + return EIO; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_CONN; + req->chm_chanid = chan->ch_id; + req->chm_gpadl = gpadl; + req->chm_range_len = range_len; + req->chm_range_cnt = 1; + req->chm_range.gpa_len = size; + req->chm_range.gpa_ofs = 0; + for (i = 0; i < cnt; ++i) + req->chm_range.gpa_page[i] = page_id++; + + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "gpadl->chan%u msg hypercall exec failed: %d\n", + chan->ch_id, error); + vmbus_msghc_put(sc, mh); + return error; + } + + while (page_count > 0) { + struct vmbus_chanmsg_gpadl_subconn *subreq; + + if (page_count > VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX) + cnt = VMBUS_CHANMSG_GPADL_SUBCONN_PGMAX; + else + cnt = page_count; + page_count -= cnt; + + reqsz = __offsetof(struct vmbus_chanmsg_gpadl_subconn, + chm_gpa_page[cnt]); + vmbus_msghc_reset(mh, reqsz); + + subreq = vmbus_msghc_dataptr(mh); + subreq->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_SUBCONN; + subreq->chm_gpadl = gpadl; + for (i = 0; i < cnt; ++i) + subreq->chm_gpa_page[i] = page_id++; + + vmbus_msghc_exec_noresult(mh); + } + KASSERT(page_count == 0, ("invalid page count %d", page_count)); + + msg = vmbus_msghc_wait_result(sc, mh); + status = ((const struct vmbus_chanmsg_gpadl_connresp *) + msg->msg_data)->chm_status; + + vmbus_msghc_put(sc, mh); + + if (status != 0) { + device_printf(sc->vmbus_dev, "gpadl->chan%u failed: " + "status %u\n", chan->ch_id, status); + return EIO; + } else { + if (bootverbose) { + device_printf(sc->vmbus_dev, "gpadl->chan%u " + "succeeded\n", chan->ch_id); + } + } + return 0; +} + +/* + * Disconnect the GPA from the target channel + */ +int +vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_gpadl_disconn *req; + int error; + + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for gpa x->chan%u\n", + chan->ch_id); + return EBUSY; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_GPADL_DISCONN; + req->chm_chanid = chan->ch_id; + req->chm_gpadl = gpadl; + + error = vmbus_msghc_exec(sc, mh); + if (error) { + device_printf(sc->vmbus_dev, + "gpa x->chan%u msg hypercall exec failed: %d\n", + chan->ch_id, error); + vmbus_msghc_put(sc, mh); + return error; + } + + vmbus_msghc_wait_result(sc, mh); + /* Discard result; no useful information */ + vmbus_msghc_put(sc, mh); + + return 0; +} + +static void +vmbus_chan_close_internal(struct hv_vmbus_channel *chan) +{ + struct vmbus_softc *sc = chan->vmbus_sc; + struct vmbus_msghc *mh; + struct vmbus_chanmsg_chclose *req; + struct taskqueue *tq = chan->ch_tq; + int error; + + /* TODO: stringent check */ + atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); + + /* + * Free this channel's sysctl tree attached to its device's + * sysctl tree. + */ + sysctl_ctx_free(&chan->ch_sysctl_ctx); + + /* + * Set ch_tq to NULL to avoid more requests be scheduled. + * XXX pretty broken; need rework. + */ + chan->ch_tq = NULL; + taskqueue_drain(tq, &chan->ch_task); + chan->ch_cb = NULL; + + /* + * Close this channel. + */ + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, + "can not get msg hypercall for chclose(chan%u)\n", + chan->ch_id); + return; + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHCLOSE; + req->chm_chanid = chan->ch_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, + "chclose(chan%u) msg hypercall exec failed: %d\n", + chan->ch_id, error); + return; + } else if (bootverbose) { + device_printf(sc->vmbus_dev, "close chan%u\n", chan->ch_id); + } + + /* + * Disconnect the TX+RX bufrings from this channel. + */ + if (chan->ch_bufring_gpadl) { + vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); + chan->ch_bufring_gpadl = 0; + } + + /* + * Destroy the TX+RX bufrings. + */ + hv_ring_buffer_cleanup(&chan->outbound); + hv_ring_buffer_cleanup(&chan->inbound); + if (chan->ch_bufring != NULL) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; + } +} + +/* + * Caller should make sure that all sub-channels have + * been added to 'chan' and all to-be-closed channels + * are not being opened. + */ +void +vmbus_chan_close(struct hv_vmbus_channel *chan) +{ + int subchan_cnt; + + if (!VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * Sub-channel is closed when its primary channel + * is closed; done. + */ + return; + } + + /* + * Close all sub-channels, if any. + */ + subchan_cnt = chan->ch_subchan_cnt; + if (subchan_cnt > 0) { + struct hv_vmbus_channel **subchan; + int i; + + subchan = vmbus_subchan_get(chan, subchan_cnt); + for (i = 0; i < subchan_cnt; ++i) + vmbus_chan_close_internal(subchan[i]); + vmbus_subchan_rel(subchan, subchan_cnt); + } + + /* Then close the primary channel. */ + vmbus_chan_close_internal(chan); +} + +int +vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags, + void *data, int dlen, uint64_t xactid) +{ + struct vmbus_chanpkt pkt; + int pktlen, pad_pktlen, hlen, error; + uint64_t pad = 0; + struct iovec iov[3]; + boolean_t send_evt; + + hlen = sizeof(pkt); + pktlen = hlen + dlen; + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + + pkt.cp_hdr.cph_type = type; + pkt.cp_hdr.cph_flags = flags; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); + pkt.cp_hdr.cph_xactid = xactid; + + iov[0].iov_base = &pkt; + iov[0].iov_len = hlen; + iov[1].iov_base = data; + iov[1].iov_len = dlen; + iov[2].iov_base = &pad; + iov[2].iov_len = pad_pktlen - pktlen; + + error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt); + if (!error && send_evt) + vmbus_chan_signal_tx(chan); + return error; +} + +int +vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, + struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid) +{ + struct vmbus_chanpkt_sglist pkt; + int pktlen, pad_pktlen, hlen, error; + struct iovec iov[4]; + boolean_t send_evt; + uint64_t pad = 0; + + KASSERT(sglen < VMBUS_CHAN_SGLIST_MAX, + ("invalid sglist len %d", sglen)); + + hlen = __offsetof(struct vmbus_chanpkt_sglist, cp_gpa[sglen]); + pktlen = hlen + dlen; + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + + pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; + pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); + pkt.cp_hdr.cph_xactid = xactid; + pkt.cp_rsvd = 0; + pkt.cp_gpa_cnt = sglen; + + iov[0].iov_base = &pkt; + iov[0].iov_len = sizeof(pkt); + iov[1].iov_base = sg; + iov[1].iov_len = sizeof(struct vmbus_gpa) * sglen; + iov[2].iov_base = data; + iov[2].iov_len = dlen; + iov[3].iov_base = &pad; + iov[3].iov_len = pad_pktlen - pktlen; + + error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); + if (!error && send_evt) + vmbus_chan_signal_tx(chan); + return error; +} + +int +vmbus_chan_send_prplist(struct hv_vmbus_channel *chan, + struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, + uint64_t xactid) +{ + struct vmbus_chanpkt_prplist pkt; + int pktlen, pad_pktlen, hlen, error; + struct iovec iov[4]; + boolean_t send_evt; + uint64_t pad = 0; + + KASSERT(prp_cnt < VMBUS_CHAN_PRPLIST_MAX, + ("invalid prplist entry count %d", prp_cnt)); + + hlen = __offsetof(struct vmbus_chanpkt_prplist, + cp_range[0].gpa_page[prp_cnt]); + pktlen = hlen + dlen; + pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + + pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; + pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_hlen, hlen); + VMBUS_CHANPKT_SETLEN(pkt.cp_hdr.cph_tlen, pad_pktlen); + pkt.cp_hdr.cph_xactid = xactid; + pkt.cp_rsvd = 0; + pkt.cp_range_cnt = 1; + + iov[0].iov_base = &pkt; + iov[0].iov_len = sizeof(pkt); + iov[1].iov_base = prp; + iov[1].iov_len = __offsetof(struct vmbus_gpa_range, gpa_page[prp_cnt]); + iov[2].iov_base = data; + iov[2].iov_len = dlen; + iov[3].iov_base = &pad; + iov[3].iov_len = pad_pktlen - pktlen; + + error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt); + if (!error && send_evt) + vmbus_chan_signal_tx(chan); + return error; +} + +int +vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen0, + uint64_t *xactid) +{ + struct vmbus_chanpkt_hdr pkt; + int error, dlen, hlen; + + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; + + hlen = VMBUS_CHANPKT_GETLEN(pkt.cph_hlen); + dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen; + + if (*dlen0 < dlen) { + /* Return the size of this packet's data. */ + *dlen0 = dlen; + return ENOBUFS; + } + + *xactid = pkt.cph_xactid; + *dlen0 = dlen; + + /* Skip packet header */ + error = hv_ring_buffer_read(&chan->inbound, data, dlen, hlen); + KASSERT(!error, ("hv_ring_buffer_read failed")); + + return 0; +} + +int +vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, + struct vmbus_chanpkt_hdr *pkt0, int *pktlen0) +{ + struct vmbus_chanpkt_hdr pkt; + int error, pktlen; + + error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt)); + if (error) + return error; + + pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen); + if (*pktlen0 < pktlen) { + /* Return the size of this packet. */ + *pktlen0 = pktlen; + return ENOBUFS; + } + *pktlen0 = pktlen; + + /* Include packet header */ + error = hv_ring_buffer_read(&chan->inbound, pkt0, pktlen, 0); + KASSERT(!error, ("hv_ring_buffer_read failed")); + + return 0; +} + +static void +vmbus_chan_task(void *xchan, int pending __unused) +{ + struct hv_vmbus_channel *chan = xchan; + vmbus_chan_callback_t cb = chan->ch_cb; + void *cbarg = chan->ch_cbarg; + + /* + * Optimize host to guest signaling by ensuring: + * 1. While reading the channel, we disable interrupts from + * host. + * 2. Ensure that we process all posted messages from the host + * before returning from this callback. + * 3. Once we return, enable signaling from the host. Once this + * state is set we check to see if additional packets are + * available to read. In this case we repeat the process. + * + * NOTE: Interrupt has been disabled in the ISR. + */ + for (;;) { + uint32_t left; + + cb(cbarg); + + left = hv_ring_buffer_read_end(&chan->inbound); + if (left == 0) { + /* No more data in RX bufring; done */ + break; + } + hv_ring_buffer_read_begin(&chan->inbound); + } +} + +static void +vmbus_chan_task_nobatch(void *xchan, int pending __unused) +{ + struct hv_vmbus_channel *chan = xchan; + + chan->ch_cb(chan->ch_cbarg); +} + +static __inline void +vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags, + int flag_cnt) +{ + int f; + + for (f = 0; f < flag_cnt; ++f) { + uint32_t chid_base; + u_long flags; + int chid_ofs; + + if (event_flags[f] == 0) + continue; + + flags = atomic_swap_long(&event_flags[f], 0); + chid_base = f << VMBUS_EVTFLAG_SHIFT; + + while ((chid_ofs = ffsl(flags)) != 0) { + struct hv_vmbus_channel *chan; + + --chid_ofs; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << chid_ofs); + + chan = sc->vmbus_chmap[chid_base + chid_ofs]; + + /* if channel is closed or closing */ + if (chan == NULL || chan->ch_tq == NULL) + continue; + + if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) + hv_ring_buffer_read_begin(&chan->inbound); + taskqueue_enqueue(chan->ch_tq, &chan->ch_task); + } + } +} + +void +vmbus_event_proc(struct vmbus_softc *sc, int cpu) +{ + struct vmbus_evtflags *eventf; + + /* + * On Host with Win8 or above, the event page can be checked directly + * to get the id of the channel that has the pending interrupt. + */ + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + vmbus_event_flags_proc(sc, eventf->evt_flags, + VMBUS_PCPU_GET(sc, event_flags_cnt, cpu)); +} + +void +vmbus_event_proc_compat(struct vmbus_softc *sc, int cpu) +{ + struct vmbus_evtflags *eventf; + + eventf = VMBUS_PCPU_GET(sc, event_flags, cpu) + VMBUS_SINT_MESSAGE; + if (atomic_testandclear_long(&eventf->evt_flags[0], 0)) { + vmbus_event_flags_proc(sc, sc->vmbus_rx_evtflags, + VMBUS_CHAN_MAX_COMPAT >> VMBUS_EVTFLAG_SHIFT); + } +} + +static void +vmbus_chan_update_evtflagcnt(struct vmbus_softc *sc, + const struct hv_vmbus_channel *chan) +{ + volatile int *flag_cnt_ptr; + int flag_cnt; + + flag_cnt = (chan->ch_id / VMBUS_EVTFLAG_LEN) + 1; + flag_cnt_ptr = VMBUS_PCPU_PTR(sc, event_flags_cnt, chan->ch_cpuid); + + for (;;) { + int old_flag_cnt; + + old_flag_cnt = *flag_cnt_ptr; + if (old_flag_cnt >= flag_cnt) + break; + if (atomic_cmpset_int(flag_cnt_ptr, old_flag_cnt, flag_cnt)) { + if (bootverbose) { + device_printf(sc->vmbus_dev, + "channel%u update cpu%d flag_cnt to %d\n", + chan->ch_id, chan->ch_cpuid, flag_cnt); + } + break; + } + } +} + +static struct hv_vmbus_channel * +vmbus_chan_alloc(struct vmbus_softc *sc) +{ + struct hv_vmbus_channel *chan; + + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); + + chan->ch_monprm = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), + HYPERCALL_PARAM_ALIGN, 0, sizeof(struct hyperv_mon_param), + &chan->ch_monprm_dma, BUS_DMA_WAITOK | BUS_DMA_ZERO); + if (chan->ch_monprm == NULL) { + device_printf(sc->vmbus_dev, "monprm alloc failed\n"); + free(chan, M_DEVBUF); + return NULL; + } + + chan->vmbus_sc = sc; + mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); + TAILQ_INIT(&chan->ch_subchans); + TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); + + return chan; +} + +static void +vmbus_chan_free(struct hv_vmbus_channel *chan) +{ + /* TODO: assert sub-channel list is empty */ + /* TODO: asset no longer on the primary channel's sub-channel list */ + /* TODO: asset no longer on the vmbus channel list */ + hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); + mtx_destroy(&chan->ch_subchan_lock); + free(chan, M_DEVBUF); +} + +static int +vmbus_chan_add(struct hv_vmbus_channel *newchan) +{ + struct vmbus_softc *sc = newchan->vmbus_sc; + struct hv_vmbus_channel *prichan; + + if (newchan->ch_id == 0) { + /* + * XXX + * Chan0 will neither be processed nor should be offered; + * skip it. + */ + device_printf(sc->vmbus_dev, "got chan0 offer, discard\n"); + return EINVAL; + } else if (newchan->ch_id >= VMBUS_CHAN_MAX) { + device_printf(sc->vmbus_dev, "invalid chan%u offer\n", + newchan->ch_id); + return EINVAL; + } + sc->vmbus_chmap[newchan->ch_id] = newchan; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 03:24:05 2016 Return-Path: Delivered-To: svn-src-all@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 6F14BC1475E; Mon, 17 Oct 2016 03:24:05 +0000 (UTC) (envelope-from sephe@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 102401EC3; Mon, 17 Oct 2016 03:24:04 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H3O4wL016859; Mon, 17 Oct 2016 03:24:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H3O347016850; Mon, 17 Oct 2016 03:24:03 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170324.u9H3O347016850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:24: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: r307461 - in stable/11/sys/dev/hyperv: include netvsc storvsc utilities 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:24:05 -0000 Author: sephe Date: Mon Oct 17 03:24:03 2016 New Revision: 307461 URL: https://svnweb.freebsd.org/changeset/base/307461 Log: MFC 303066-303072,303127-303129,303131 303066 hyperv/vmbus: Get rid of unnecessary definition. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7240 303067 hyperv/vmbus: Move IC register definition to Hyper-V utilities Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7241 303068 hyperv/vmbus: Channel struct field rename Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7242 303069 hyperv/vmbus: Pass channel as the first argument for channel callback The prepares to kill device private fields in channel struct, which are not flexible and extensible. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7243 303070 hyperv/vmbus: Deprecate the device private data in channel struct They are neither flexible nor extensible. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7244 303071 hyperv/vmbus: Hide channel struct definition. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7245 303072 hyperv/vmbus: Save MNF trigger location instead of MNF trigger index. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7246 303127 hyperv/vmbus: Save event flag location and evet flag mask. This avoids unnecessary access to the vmbus_softc struct on sending path. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7257 303128 hyperv/vmbus: Reorder channel fields. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7258 303129 hyperv/vmbus: Shuffle function declaration and macro definition. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7259 303131 hyperv: hv_vmbus_channel -> vmbus_channel Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7260 Added: stable/11/sys/dev/hyperv/utilities/hv_utilreg.h - copied unchanged from r303067, head/sys/dev/hyperv/utilities/hv_utilreg.h stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h - copied, changed from r303071, head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis.h stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/utilities/hv_util.h stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 03:07:06 2016 (r307460) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 03:24:03 2016 (r307461) @@ -58,30 +58,6 @@ #include #include -typedef uint8_t hv_bool_uint8_t; - -#define HV_S_OK 0x00000000 -#define HV_E_FAIL 0x80004005 -#define HV_ERROR_NOT_SUPPORTED 0x80070032 -#define HV_ERROR_MACHINE_LOCKED 0x800704F7 - -/* - * VMBUS version is 32 bit, upper 16 bit for major_number and lower - * 16 bit for minor_number. - * - * 0.13 -- Windows Server 2008 - * 1.1 -- Windows 7 - * 2.4 -- Windows 8 - * 3.0 -- Windows 8.1 - */ -#define VMBUS_VERSION_WS2008 ((0 << 16) | (13)) -#define VMBUS_VERSION_WIN7 ((1 << 16) | (1)) -#define VMBUS_VERSION_WIN8 ((2 << 16) | (4)) -#define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) - -#define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) -#define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) - struct hyperv_guid { uint8_t hv_guid[16]; } __packed; @@ -90,183 +66,6 @@ struct hyperv_guid { int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); -#define HW_MACADDR_LEN 6 - -/* - * Common defines for Hyper-V ICs - */ -#define HV_ICMSGTYPE_NEGOTIATE 0 -#define HV_ICMSGTYPE_HEARTBEAT 1 -#define HV_ICMSGTYPE_KVPEXCHANGE 2 -#define HV_ICMSGTYPE_SHUTDOWN 3 -#define HV_ICMSGTYPE_TIMESYNC 4 -#define HV_ICMSGTYPE_VSS 5 - -#define HV_ICMSGHDRFLAG_TRANSACTION 1 -#define HV_ICMSGHDRFLAG_REQUEST 2 -#define HV_ICMSGHDRFLAG_RESPONSE 4 - -typedef struct hv_vmbus_pipe_hdr { - uint32_t flags; - uint32_t msgsize; -} __packed hv_vmbus_pipe_hdr; - -typedef struct hv_vmbus_ic_version { - uint16_t major; - uint16_t minor; -} __packed hv_vmbus_ic_version; - -typedef struct hv_vmbus_icmsg_hdr { - hv_vmbus_ic_version icverframe; - uint16_t icmsgtype; - hv_vmbus_ic_version icvermsg; - uint16_t icmsgsize; - uint32_t status; - uint8_t ictransaction_id; - uint8_t icflags; - uint8_t reserved[2]; -} __packed hv_vmbus_icmsg_hdr; - -typedef struct hv_vmbus_icmsg_negotiate { - uint16_t icframe_vercnt; - uint16_t icmsg_vercnt; - uint32_t reserved; - hv_vmbus_ic_version icversion_data[1]; /* any size array */ -} __packed hv_vmbus_icmsg_negotiate; - -typedef struct hv_vmbus_shutdown_msg_data { - uint32_t reason_code; - uint32_t timeout_seconds; - uint32_t flags; - uint8_t display_message[2048]; -} __packed hv_vmbus_shutdown_msg_data; - -typedef struct hv_vmbus_heartbeat_msg_data { - uint64_t seq_num; - uint32_t reserved[8]; -} __packed hv_vmbus_heartbeat_msg_data; - -typedef struct { - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t write_index; - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t read_index; - /* - * NOTE: The interrupt_mask field is used only for channels, but - * vmbus connection also uses this data structure - */ - volatile uint32_t interrupt_mask; - /* pad it to PAGE_SIZE so that data starts on a page */ - uint8_t reserved[4084]; - - /* - * WARNING: Ring data starts here - * !!! DO NOT place any fields below this !!! - */ - uint8_t buffer[0]; /* doubles as interrupt mask */ -} __packed hv_vmbus_ring_buffer; - -typedef struct { - hv_vmbus_ring_buffer* ring_buffer; - struct mtx ring_lock; - uint32_t ring_data_size; /* ring_size */ -} hv_vmbus_ring_buffer_info; - -typedef void (*vmbus_chan_callback_t)(void *); - -typedef struct hv_vmbus_channel { - device_t ch_dev; - struct vmbus_softc *vmbus_sc; - uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */ - uint32_t ch_id; /* channel id */ - - /* - * These are based on the offer_msg.monitor_id. - * Save it here for easy access. - */ - int ch_montrig_idx; /* MNF trig index */ - uint32_t ch_montrig_mask;/* MNF trig mask */ - - /* - * send to parent - */ - hv_vmbus_ring_buffer_info outbound; - /* - * receive from parent - */ - hv_vmbus_ring_buffer_info inbound; - - struct taskqueue *ch_tq; - struct task ch_task; - vmbus_chan_callback_t ch_cb; - void *ch_cbarg; - - struct hyperv_mon_param *ch_monprm; - struct hyperv_dma ch_monprm_dma; - - int ch_cpuid; /* owner cpu */ - /* - * Virtual cpuid for ch_cpuid; it is used to communicate cpuid - * related information w/ Hyper-V. If MSR_HV_VP_INDEX does not - * exist, ch_vcpuid will always be 0 for compatibility. - */ - uint32_t ch_vcpuid; - - /* - * If this is a primary channel, ch_subchan* fields - * contain sub-channels belonging to this primary - * channel. - */ - struct mtx ch_subchan_lock; - TAILQ_HEAD(, hv_vmbus_channel) ch_subchans; - int ch_subchan_cnt; - - /* If this is a sub-channel */ - TAILQ_ENTRY(hv_vmbus_channel) ch_sublink; /* sub-channel link */ - struct hv_vmbus_channel *ch_prichan; /* owner primary chan */ - - /* - * Driver private data - */ - void *hv_chan_priv1; - void *hv_chan_priv2; - void *hv_chan_priv3; - - void *ch_bufring; /* TX+RX bufrings */ - struct hyperv_dma ch_bufring_dma; - uint32_t ch_bufring_gpadl; - - struct task ch_detach_task; - TAILQ_ENTRY(hv_vmbus_channel) ch_prilink; /* primary chan link */ - uint32_t ch_subidx; /* subchan index */ - volatile uint32_t ch_stflags; /* atomic-op */ - /* VMBUS_CHAN_ST_ */ - struct hyperv_guid ch_guid_type; - struct hyperv_guid ch_guid_inst; - - struct sysctl_ctx_list ch_sysctl_ctx; -} hv_vmbus_channel; - -#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0) - -#define VMBUS_CHAN_FLAG_HASMNF 0x0001 -/* - * If this flag is set, this channel's interrupt will be masked in ISR, - * and the RX bufring will be drained before this channel's interrupt is - * unmasked. - * - * This flag is turned on by default. Drivers can turn it off according - * to their own requirement. - */ -#define VMBUS_CHAN_FLAG_BATCHREAD 0x0002 - -#define VMBUS_CHAN_ST_OPENED_SHIFT 0 -#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) - /** * @brief Get physical address from virtual */ @@ -278,10 +77,4 @@ hv_get_phys_addr(void *virt) return (ret); } -static __inline struct hv_vmbus_channel * -vmbus_get_channel(device_t dev) -{ - return device_get_ivars(dev); -} - #endif /* __HYPERV_H__ */ Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 03:07:06 2016 (r307460) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 03:24:03 2016 (r307461) @@ -32,6 +32,23 @@ #include /* + * VMBUS version is 32 bit, upper 16 bit for major_number and lower + * 16 bit for minor_number. + * + * 0.13 -- Windows Server 2008 + * 1.1 -- Windows 7 + * 2.4 -- Windows 8 + * 3.0 -- Windows 8.1 + */ +#define VMBUS_VERSION_WS2008 ((0 << 16) | (13)) +#define VMBUS_VERSION_WIN7 ((1 << 16) | (1)) +#define VMBUS_VERSION_WIN8 ((2 << 16) | (4)) +#define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) + +#define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) +#define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) + +/* * GPA stuffs. */ struct vmbus_gpa_range { @@ -87,41 +104,56 @@ struct vmbus_chanpkt_rxbuf { #define VMBUS_CHAN_SGLIST_MAX 32 #define VMBUS_CHAN_PRPLIST_MAX 32 -struct hv_vmbus_channel; +struct vmbus_channel; +struct hyperv_guid; -int vmbus_chan_open(struct hv_vmbus_channel *chan, +typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *); + +static __inline struct vmbus_channel * +vmbus_get_channel(device_t dev) +{ + return device_get_ivars(dev); +} + +int vmbus_chan_open(struct vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg); -void vmbus_chan_close(struct hv_vmbus_channel *chan); +void vmbus_chan_close(struct vmbus_channel *chan); -int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, +int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl); -int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, +int vmbus_chan_gpadl_disconnect(struct vmbus_channel *chan, uint32_t gpadl); -void vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu); -void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan); -struct hv_vmbus_channel * - vmbus_chan_cpu2chan(struct hv_vmbus_channel *chan, int cpu); -void vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on); - -struct hv_vmbus_channel ** - vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt); -void vmbus_subchan_rel(struct hv_vmbus_channel **subchan, int subchan_cnt); -void vmbus_subchan_drain(struct hv_vmbus_channel *pri_chan); +void vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu); +void vmbus_chan_cpu_rr(struct vmbus_channel *chan); +struct vmbus_channel * + vmbus_chan_cpu2chan(struct vmbus_channel *chan, int cpu); +void vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on); + +struct vmbus_channel ** + vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt); +void vmbus_subchan_rel(struct vmbus_channel **subchan, int subchan_cnt); +void vmbus_subchan_drain(struct vmbus_channel *pri_chan); -int vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen, +int vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen, uint64_t *xactid); -int vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan, +int vmbus_chan_recv_pkt(struct vmbus_channel *chan, struct vmbus_chanpkt_hdr *pkt, int *pktlen); -int vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, +int vmbus_chan_send(struct vmbus_channel *chan, uint16_t type, uint16_t flags, void *data, int dlen, uint64_t xactid); -int vmbus_chan_send_sglist(struct hv_vmbus_channel *chan, +int vmbus_chan_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, void *data, int dlen, uint64_t xactid); -int vmbus_chan_send_prplist(struct hv_vmbus_channel *chan, +int vmbus_chan_send_prplist(struct vmbus_channel *chan, struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, uint64_t xactid); +uint32_t vmbus_chan_id(const struct vmbus_channel *chan); +uint32_t vmbus_chan_subidx(const struct vmbus_channel *chan); +bool vmbus_chan_is_primary(const struct vmbus_channel *chan); +const struct hyperv_guid * + vmbus_chan_guid_inst(const struct vmbus_channel *chan); + #endif /* !_VMBUS_H_ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 03:07:06 2016 (r307460) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 03:24:03 2016 (r307461) @@ -49,26 +49,24 @@ #include "hv_rndis.h" #include "hv_rndis_filter.h" -/* priv1 and priv2 are consumed by the main driver */ -#define hv_chan_rdbuf hv_chan_priv3 - MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); /* * Forward declarations */ -static void hv_nv_on_channel_callback(void *xchan); +static void hv_nv_on_channel_callback(struct vmbus_channel *chan, + void *xrxr); static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev); static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); static int hv_nv_connect_to_vsp(struct hn_softc *sc); static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); -static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, + struct vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); +static void hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, - struct hn_softc *sc, struct hv_vmbus_channel *chan, + struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); /* @@ -641,13 +639,14 @@ hv_nv_disconnect_from_vsp(netvsc_dev *ne } void -hv_nv_subchan_attach(struct hv_vmbus_channel *chan) +hv_nv_subchan_attach(struct vmbus_channel *chan, struct hn_rx_ring *rxr) { - - chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); + KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), + ("chan%u subidx %u, rxr%d mismatch", + vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, - hv_nv_on_channel_callback, chan); + hv_nv_on_channel_callback, rxr); } /* @@ -656,9 +655,10 @@ hv_nv_subchan_attach(struct hv_vmbus_cha * Callback when the device belonging to this driver is added */ netvsc_dev * -hv_nv_on_device_add(struct hn_softc *sc, void *additional_info) +hv_nv_on_device_add(struct hn_softc *sc, void *additional_info, + struct hn_rx_ring *rxr) { - struct hv_vmbus_channel *chan = sc->hn_prichan; + struct vmbus_channel *chan = sc->hn_prichan; netvsc_dev *net_dev; int ret = 0; @@ -670,18 +670,17 @@ hv_nv_on_device_add(struct hn_softc *sc, sema_init(&net_dev->channel_init_sema, 0, "netdev_sema"); - chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); - /* * Open the channel */ + KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), + ("chan%u subidx %u, rxr%d mismatch", + vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); ret = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, - NULL, 0, hv_nv_on_channel_callback, chan); - if (ret != 0) { - free(chan->hv_chan_rdbuf, M_NETVSC); + NULL, 0, hv_nv_on_channel_callback, rxr); + if (ret != 0) goto cleanup; - } /* * Connect with the NetVsp @@ -694,7 +693,6 @@ hv_nv_on_device_add(struct hn_softc *sc, close: /* Now, we can close the channel safely */ - free(chan->hv_chan_rdbuf, M_NETVSC); vmbus_chan_close(chan); cleanup: @@ -725,7 +723,6 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ - free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); vmbus_chan_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); @@ -738,7 +735,7 @@ hv_nv_on_device_remove(struct hn_softc * * Net VSC on send completion */ static void -hv_nv_on_send_completion(netvsc_dev *net_dev, struct hv_vmbus_channel *chan, +hv_nv_on_send_completion(netvsc_dev *net_dev, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt) { const nvsp_msg *nvsp_msg_pkt; @@ -802,7 +799,7 @@ hv_nv_on_send_completion(netvsc_dev *net * Returns 0 on success, non-zero on failure. */ int -hv_nv_on_send(struct hv_vmbus_channel *chan, netvsc_packet *pkt) +hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt) { nvsp_msg send_msg; int ret; @@ -840,14 +837,13 @@ hv_nv_on_send(struct hv_vmbus_channel *c * with virtual addresses. */ static void -hv_nv_on_receive(netvsc_dev *net_dev, struct hn_softc *sc, - struct hv_vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) +hv_nv_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, + struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { const struct vmbus_chanpkt_rxbuf *pkt; const nvsp_msg *nvsp_msg_pkt; netvsc_packet vsc_pkt; netvsc_packet *net_vsc_pkt = &vsc_pkt; - device_t dev = sc->hn_dev; int count = 0; int i = 0; int status = nvsp_status_success; @@ -856,7 +852,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st /* Make sure this is a valid nvsp packet */ if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg_1_type_send_rndis_pkt) { - device_printf(dev, "packet hdr type %u is invalid!\n", + if_printf(rxr->hn_ifp, "packet hdr type %u is invalid!\n", nvsp_msg_pkt->hdr.msg_type); return; } @@ -864,7 +860,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { - device_printf(dev, "rxbuf_id %d is invalid!\n", + if_printf(rxr->hn_ifp, "rxbuf_id %d is invalid!\n", pkt->cp_rxbuf_id); return; } @@ -878,7 +874,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st pkt->cp_rxbuf[i].rb_ofs); net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len; - hv_rf_on_receive(net_dev, chan, net_vsc_pkt); + hv_rf_on_receive(net_dev, rxr, net_vsc_pkt); if (net_vsc_pkt->status != nvsp_status_success) { status = nvsp_status_failure; } @@ -898,7 +894,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * Send a receive completion packet to RNDIS device (ie NetVsp) */ static void -hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, +hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid, uint32_t status) { nvsp_msg rx_comp_msg; @@ -973,11 +969,10 @@ hv_nv_send_table(struct hn_softc *sc, co * Net VSC on channel callback */ static void -hv_nv_on_channel_callback(void *xchan) +hv_nv_on_channel_callback(struct vmbus_channel *chan, void *xrxr) { - struct hv_vmbus_channel *chan = xchan; - device_t dev = chan->ch_dev; - struct hn_softc *sc = device_get_softc(dev); + struct hn_rx_ring *rxr = xrxr; + struct hn_softc *sc = rxr->hn_ifp->if_softc; netvsc_dev *net_dev; void *buffer; int bufferlen = NETVSC_PACKET_SIZE; @@ -986,7 +981,7 @@ hv_nv_on_channel_callback(void *xchan) if (net_dev == NULL) return; - buffer = chan->hv_chan_rdbuf; + buffer = rxr->hn_rdbuf; do { struct vmbus_chanpkt_hdr *pkt = buffer; uint32_t bytes_rxed; @@ -1002,13 +997,13 @@ hv_nv_on_channel_callback(void *xchan) pkt); break; case VMBUS_CHANPKT_TYPE_RXBUF: - hv_nv_on_receive(net_dev, sc, chan, pkt); + hv_nv_on_receive(net_dev, rxr, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: hv_nv_send_table(sc, pkt); break; default: - device_printf(dev, + if_printf(rxr->hn_ifp, "unknown chan pkt %u\n", pkt->cph_type); break; @@ -1024,7 +1019,7 @@ hv_nv_on_channel_callback(void *xchan) /* alloc new buffer */ buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); if (buffer == NULL) { - device_printf(dev, + if_printf(rxr->hn_ifp, "hv_cb malloc buffer failed, len=%u\n", bytes_rxed); bufferlen = 0; @@ -1040,5 +1035,5 @@ hv_nv_on_channel_callback(void *xchan) if (bufferlen > NETVSC_PACKET_SIZE) free(buffer, M_NETVSC); - hv_rf_channel_rollup(chan); + hv_rf_channel_rollup(rxr, rxr->hn_txr); } Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 03:07:06 2016 (r307460) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 03:24:03 2016 (r307461) @@ -53,6 +53,7 @@ #include #include +#include #include #include @@ -1065,12 +1066,12 @@ typedef struct netvsc_dev_ { nvsp_msg channel_init_packet; nvsp_msg revoke_packet; - /*uint8_t hw_mac_addr[HW_MACADDR_LEN];*/ + /*uint8_t hw_mac_addr[ETHER_ADDR_LEN];*/ /* Holds rndis device info */ void *extension; - hv_bool_uint8_t destroy; + uint8_t destroy; /* Negotiated NVSP version */ uint32_t nvsp_version; @@ -1081,9 +1082,9 @@ typedef struct netvsc_dev_ { uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE]; } netvsc_dev; -struct hv_vmbus_channel; +struct vmbus_channel; -typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *); +typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) @@ -1109,7 +1110,7 @@ typedef void (*pfn_on_send_rx_completion #endif typedef struct netvsc_packet_ { - hv_bool_uint8_t is_data_pkt; /* One byte */ + uint8_t is_data_pkt; /* One byte */ uint16_t vlan_tci; uint32_t status; @@ -1140,7 +1141,7 @@ typedef struct netvsc_packet_ { typedef struct { uint8_t mac_addr[6]; /* Assumption unsigned long */ - hv_bool_uint8_t link_state; + uint8_t link_state; } netvsc_device_info; #ifndef HN_USE_TXDESC_BUFRING @@ -1150,8 +1151,12 @@ SLIST_HEAD(hn_txdesc_list, hn_txdesc); struct buf_ring; #endif +struct hn_tx_ring; + struct hn_rx_ring { struct ifnet *hn_ifp; + struct hn_tx_ring *hn_txr; + void *hn_rdbuf; int hn_rx_idx; /* Trust csum verification on host side */ @@ -1202,7 +1207,7 @@ struct hn_tx_ring { struct mtx hn_tx_lock; struct hn_softc *hn_sc; - struct hv_vmbus_channel *hn_chan; + struct vmbus_channel *hn_chan; int hn_direct_tx_size; int hn_tx_chimney_size; @@ -1241,7 +1246,7 @@ typedef struct hn_softc { /* See hv_netvsc_drv_freebsd.c for rules on how to use */ int temp_unusable; netvsc_dev *net_dev; - struct hv_vmbus_channel *hn_prichan; + struct vmbus_channel *hn_prichan; int hn_rx_ring_cnt; int hn_rx_ring_inuse; @@ -1265,12 +1270,13 @@ extern int hv_promisc_mode; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); netvsc_dev *hv_nv_on_device_add(struct hn_softc *sc, - void *additional_info); + void *additional_info, struct hn_rx_ring *rxr); int hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); -int hv_nv_on_send(struct hv_vmbus_channel *chan, netvsc_packet *pkt); +int hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt); int hv_nv_get_next_send_section(netvsc_dev *net_dev); -void hv_nv_subchan_attach(struct hv_vmbus_channel *chan); +void hv_nv_subchan_attach(struct vmbus_channel *chan, + struct hn_rx_ring *rxr); #endif /* __HV_NET_VSC_H__ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 03:07:06 2016 (r307460) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 03:24:03 2016 (r307461) @@ -120,9 +120,6 @@ __FBSDID("$FreeBSD$"); #include "hv_rndis_filter.h" #include "vmbus_if.h" -#define hv_chan_rxr hv_chan_priv1 -#define hv_chan_txr hv_chan_priv2 - /* Short for Hyper-V network interface */ #define NETVSC_DEVNAME "hn" @@ -343,8 +340,8 @@ static int hn_encap(struct hn_tx_ring *, static void hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_tx_chimney_size(struct hn_softc *, int); -static void hn_channel_attach(struct hn_softc *, struct hv_vmbus_channel *); -static void hn_subchan_attach(struct hn_softc *, struct hv_vmbus_channel *); +static void hn_channel_attach(struct hn_softc *, struct vmbus_channel *); +static void hn_subchan_attach(struct hn_softc *, struct vmbus_channel *); static void hn_subchan_setup(struct hn_softc *); static int hn_transmit(struct ifnet *, struct mbuf *); @@ -544,7 +541,8 @@ netvsc_attach(device_t dev) IFCAP_LRO; ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; - error = hv_rf_on_device_add(sc, &device_info, ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, ring_cnt, + &sc->hn_rx_ring[0]); if (error) goto failed; KASSERT(sc->net_dev->num_channel > 0 && @@ -782,7 +780,7 @@ hn_txeof(struct hn_tx_ring *txr) } static void -hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt) +hn_tx_done(struct vmbus_channel *chan, void *xpkt) { netvsc_packet *packet = xpkt; struct hn_txdesc *txd; @@ -793,9 +791,8 @@ hn_tx_done(struct hv_vmbus_channel *chan txr = txd->txr; KASSERT(txr->hn_chan == chan, - ("channel mismatch, on channel%u, should be channel%u", - chan->ch_subidx, - txr->hn_chan->ch_subidx)); + ("channel mismatch, on chan%u, should be chan%u", + vmbus_chan_subidx(chan), vmbus_chan_subidx(txr->hn_chan))); txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); @@ -809,12 +806,9 @@ hn_tx_done(struct hv_vmbus_channel *chan } void -netvsc_channel_rollup(struct hv_vmbus_channel *chan) +netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { - struct hn_tx_ring *txr = chan->hv_chan_txr; #if defined(INET) || defined(INET6) - struct hn_rx_ring *rxr = chan->hv_chan_rxr; - tcp_lro_flush_all(&rxr->hn_lro); #endif @@ -1279,12 +1273,11 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb * Note: This is no longer used as a callback */ int -netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, +netvsc_recv(struct hn_rx_ring *rxr, netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info, const struct rndis_hash_info *hash_info, const struct rndis_hash_value *hash_value) { - struct hn_rx_ring *rxr = chan->hv_chan_rxr; struct ifnet *ifp = rxr->hn_ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; @@ -1589,7 +1582,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, vmbus_subchan_drain(sc->hn_prichan); error = hv_rf_on_device_add(sc, &device_info, - sc->hn_rx_ring_inuse); + sc->hn_rx_ring_inuse, &sc->hn_rx_ring[0]); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; @@ -2223,6 +2216,9 @@ hn_create_rx_data(struct hn_softc *sc, i if (hn_trust_hostip) rxr->hn_trust_hcsum |= HN_TRUST_HCSUM_IP; rxr->hn_ifp = sc->hn_ifp; + if (i < sc->hn_tx_ring_cnt) + rxr->hn_txr = &sc->hn_tx_ring[i]; + rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); rxr->hn_rx_idx = i; /* @@ -2335,17 +2331,19 @@ hn_create_rx_data(struct hn_softc *sc, i static void hn_destroy_rx_data(struct hn_softc *sc) { -#if defined(INET) || defined(INET6) int i; -#endif if (sc->hn_rx_ring_cnt == 0) return; + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { + struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; + #if defined(INET) || defined(INET6) - for (i = 0; i < sc->hn_rx_ring_cnt; ++i) - tcp_lro_free(&sc->hn_rx_ring[i].hn_lro); + tcp_lro_free(&rxr->hn_lro); #endif + free(rxr->hn_rdbuf, M_NETVSC); + } free(sc->hn_rx_ring, M_NETVSC); sc->hn_rx_ring = NULL; @@ -2913,12 +2911,12 @@ hn_xmit_txeof_taskfunc(void *xtxr, int p } static void -hn_channel_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) +hn_channel_attach(struct hn_softc *sc, struct vmbus_channel *chan) { struct hn_rx_ring *rxr; int idx; - idx = chan->ch_subidx; + idx = vmbus_chan_subidx(chan); KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse, ("invalid channel index %d, should > 0 && < %d", @@ -2928,10 +2926,9 @@ hn_channel_attach(struct hn_softc *sc, s ("RX ring %d already attached", idx)); rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED; - chan->hv_chan_rxr = rxr; if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", - idx, chan->ch_id); + idx, vmbus_chan_id(chan)); } if (idx < sc->hn_tx_ring_inuse) { @@ -2941,11 +2938,10 @@ hn_channel_attach(struct hn_softc *sc, s ("TX ring %d already attached", idx)); txr->hn_tx_flags |= HN_TX_FLAG_ATTACHED; - chan->hv_chan_txr = txr; txr->hn_chan = chan; if (bootverbose) { if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", - idx, chan->ch_id); + idx, vmbus_chan_id(chan)); } } @@ -2954,36 +2950,36 @@ hn_channel_attach(struct hn_softc *sc, s } static void -hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan) +hn_subchan_attach(struct hn_softc *sc, struct vmbus_channel *chan) { - KASSERT(!VMBUS_CHAN_ISPRIMARY(chan), + KASSERT(!vmbus_chan_is_primary(chan), ("subchannel callback on primary channel")); - KASSERT(chan->ch_subidx > 0, - ("invalid channel subidx %u", - chan->ch_subidx)); hn_channel_attach(sc, chan); } static void hn_subchan_setup(struct hn_softc *sc) { - struct hv_vmbus_channel **subchan; + struct vmbus_channel **subchans; int subchan_cnt = sc->net_dev->num_channel - 1; int i; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); + subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { + struct vmbus_channel *subchan = subchans[i]; + /* NOTE: Calling order is critical. */ - hn_subchan_attach(sc, subchan[i]); - hv_nv_subchan_attach(subchan[i]); + hn_subchan_attach(sc, subchan); + hv_nv_subchan_attach(subchan, + &sc->hn_rx_ring[vmbus_chan_subidx(subchan)]); } /* Release the sub-channels */ - vmbus_subchan_rel(subchan, subchan_cnt); + vmbus_subchan_rel(subchans, subchan_cnt); if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); } Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 03:07:06 2016 (r307460) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 03:24:03 2016 (r307461) @@ -1082,13 +1082,14 @@ typedef struct rndismp_rx_bufs_info_ { /* * Externs */ -struct hv_vmbus_channel; +struct hn_rx_ring; +struct hn_tx_ring; -int netvsc_recv(struct hv_vmbus_channel *chan, +int netvsc_recv(struct hn_rx_ring *rxr, netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info, const struct rndis_hash_info *hash_info, const struct rndis_hash_value *hash_value); -void netvsc_channel_rollup(struct hv_vmbus_channel *chan); +void netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void* hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 03:07:06 2016 (r307460) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 03:24:03 2016 (r307461) @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -74,8 +76,7 @@ static int hv_rf_send_request(rndis_dev static void hv_rf_receive_response(rndis_device *device, rndis_msg *response); static void hv_rf_receive_indicate_status(rndis_device *device, rndis_msg *response); -static void hv_rf_receive_data(rndis_device *device, rndis_msg *message, - struct hv_vmbus_channel *chan, +static void hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, netvsc_packet *pkt); static int hv_rf_query_device(rndis_device *device, uint32_t oid, void *result, uint32_t *result_size); @@ -85,8 +86,8 @@ static int hv_rf_set_packet_filter(rndi static int hv_rf_init_device(rndis_device *device); static int hv_rf_open_device(rndis_device *device); static int hv_rf_close_device(rndis_device *device); -static void hv_rf_on_send_request_completion(struct hv_vmbus_channel *, void *context); -static void hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *, void *context); +static void hv_rf_on_send_request_completion(struct vmbus_channel *, void *context); +static void hv_rf_on_send_request_halt_completion(struct vmbus_channel *, void *context); int hv_rf_send_offload_request(struct hn_softc *sc, rndis_offload_params *offloads); @@ -527,12 +528,11 @@ skip: * RNDIS filter receive data */ static void -hv_rf_receive_data(rndis_device *device, rndis_msg *message, - struct hv_vmbus_channel *chan, netvsc_packet *pkt) +hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, + netvsc_packet *pkt) { rndis_packet *rndis_pkt; uint32_t data_offset; - device_t dev = device->net_dev->sc->hn_dev; struct hv_rf_recvinfo info; rndis_pkt = &message->msg.packet; @@ -548,7 +548,7 @@ hv_rf_receive_data(rndis_device *device, pkt->tot_data_buf_len -= data_offset; if (pkt->tot_data_buf_len < rndis_pkt->data_length) { pkt->status = nvsp_status_failure; - device_printf(dev, + if_printf(rxr->hn_ifp, "total length %u is less than data length %u\n", pkt->tot_data_buf_len, rndis_pkt->data_length); return; @@ -559,7 +559,7 @@ hv_rf_receive_data(rndis_device *device, if (hv_rf_find_recvinfo(rndis_pkt, &info)) { pkt->status = nvsp_status_failure; - device_printf(dev, "recvinfo parsing failed\n"); + if_printf(rxr->hn_ifp, "recvinfo parsing failed\n"); return; } @@ -568,7 +568,7 @@ hv_rf_receive_data(rndis_device *device, else pkt->vlan_tci = 0; - netvsc_recv(chan, pkt, info.csum_info, info.hash_info, info.hash_value); + netvsc_recv(rxr, pkt, info.csum_info, info.hash_info, info.hash_value); } /* @@ -576,7 +576,7 @@ hv_rf_receive_data(rndis_device *device, */ int hv_rf_on_receive(netvsc_dev *net_dev, - struct hv_vmbus_channel *chan, netvsc_packet *pkt) + struct hn_rx_ring *rxr, netvsc_packet *pkt) { rndis_device *rndis_dev; rndis_msg *rndis_hdr; @@ -599,7 +599,7 @@ hv_rf_on_receive(netvsc_dev *net_dev, /* data message */ case REMOTE_NDIS_PACKET_MSG: - hv_rf_receive_data(rndis_dev, rndis_hdr, chan, pkt); + hv_rf_receive_data(rxr, rndis_hdr, pkt); break; /* completion messages */ case REMOTE_NDIS_INITIALIZE_CMPLT: @@ -699,7 +699,7 @@ cleanup: static inline int hv_rf_query_device_mac(rndis_device *device) { - uint32_t size = HW_MACADDR_LEN; + uint32_t size = ETHER_ADDR_LEN; return (hv_rf_query_device(device, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 03:27:24 2016 Return-Path: Delivered-To: svn-src-all@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 DD966C148FC; Mon, 17 Oct 2016 03:27:24 +0000 (UTC) (envelope-from sephe@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 A6E31130F; Mon, 17 Oct 2016 03:27:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H3RN97017033; Mon, 17 Oct 2016 03:27:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H3RNHM017027; Mon, 17 Oct 2016 03:27:23 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170327.u9H3RNHM017027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:27:23 +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: r307462 - stable/11/sys/dev/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:27:25 -0000 Author: sephe Date: Mon Oct 17 03:27:23 2016 New Revision: 307462 URL: https://svnweb.freebsd.org/changeset/base/307462 Log: MFC 303178,303180,303182 303178 hyperv/vmbus: Cosmetic bufring cleanup. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7267 303180 hyperv/vmbus: Cleanup and augment bufring sysctl tree creation Binary state node is added, so that userland programs do not have to parse human readable state string. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7268 303182 hyperv/vmbus: Move vmbus bufring definition to vmbus_reg.h And add more comment about its fields. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7269 Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 03:24:03 2016 (r307461) +++ stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 03:27:23 2016 (r307462) @@ -26,123 +26,154 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include #include #include #include "hv_vmbus_priv.h" +#include /* Amount of space to write to */ -#define HV_BYTES_AVAIL_TO_WRITE(r, w, z) ((w) >= (r))? \ - ((z) - ((w) - (r))):((r) - (w)) +#define HV_BYTES_AVAIL_TO_WRITE(r, w, z) \ + ((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w)) + +static uint32_t copy_to_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, + uint32_t start_write_offset, const uint8_t *src, + uint32_t src_len); +static uint32_t copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, + char *dest, uint32_t dest_len, uint32_t start_read_offset); static int -hv_rbi_sysctl_stats(SYSCTL_HANDLER_ARGS) +vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS) +{ + const hv_vmbus_ring_buffer_info *br = arg1; + uint32_t rindex, windex, intr_mask, ravail, wavail; + char state[256]; + + rindex = br->ring_buffer->br_rindex; + windex = br->ring_buffer->br_windex; + intr_mask = br->ring_buffer->br_imask; + wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); + ravail = br->ring_data_size - wavail; + + snprintf(state, sizeof(state), + "rindex:%u windex:%u intr_mask:%u ravail:%u wavail:%u", + rindex, windex, intr_mask, ravail, wavail); + return sysctl_handle_string(oidp, state, sizeof(state), req); +} + +/* + * Binary bufring states. + */ +static int +vmbus_br_sysctl_state_bin(SYSCTL_HANDLER_ARGS) { - hv_vmbus_ring_buffer_info* rbi; - uint32_t read_index, write_index, interrupt_mask, sz; - uint32_t read_avail, write_avail; - char rbi_stats[256]; - - rbi = (hv_vmbus_ring_buffer_info*)arg1; - read_index = rbi->ring_buffer->read_index; - write_index = rbi->ring_buffer->write_index; - interrupt_mask = rbi->ring_buffer->interrupt_mask; - sz = rbi->ring_data_size; - write_avail = HV_BYTES_AVAIL_TO_WRITE(read_index, - write_index, sz); - read_avail = sz - write_avail; - snprintf(rbi_stats, sizeof(rbi_stats), - "r_idx:%d " - "w_idx:%d " - "int_mask:%d " - "r_avail:%d " - "w_avail:%d", - read_index, write_index, interrupt_mask, - read_avail, write_avail); +#define BR_STATE_RIDX 0 +#define BR_STATE_WIDX 1 +#define BR_STATE_IMSK 2 +#define BR_STATE_RSPC 3 +#define BR_STATE_WSPC 4 +#define BR_STATE_MAX 5 + + const hv_vmbus_ring_buffer_info *br = arg1; + uint32_t rindex, windex, wavail, state[BR_STATE_MAX]; + + rindex = br->ring_buffer->br_rindex; + windex = br->ring_buffer->br_windex; + wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); + + state[BR_STATE_RIDX] = rindex; + state[BR_STATE_WIDX] = windex; + state[BR_STATE_IMSK] = br->ring_buffer->br_imask; + state[BR_STATE_WSPC] = wavail; + state[BR_STATE_RSPC] = br->ring_data_size - wavail; - return (sysctl_handle_string(oidp, rbi_stats, - sizeof(rbi_stats), req)); + return sysctl_handle_opaque(oidp, state, sizeof(state), req); } void -hv_ring_buffer_stat( - struct sysctl_ctx_list *ctx, - struct sysctl_oid_list *tree_node, - hv_vmbus_ring_buffer_info *rbi, - const char *desc) -{ - SYSCTL_ADD_PROC(ctx, tree_node, OID_AUTO, - "ring_buffer_stats", - CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, rbi, 0, - hv_rbi_sysctl_stats, "A", desc); +vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, + hv_vmbus_ring_buffer_info *br, const char *name) +{ + struct sysctl_oid *tree; + char desc[64]; + + tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(br_tree), OID_AUTO, + name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (tree == NULL) + return; + + snprintf(desc, sizeof(desc), "%s state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state, "A", desc); + + snprintf(desc, sizeof(desc), "%s binary state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state_bin", + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state_bin, "IU", desc); } + /** * @brief Get number of bytes available to read and to write to * for the specified ring buffer */ -static inline void -get_ring_buffer_avail_bytes( - hv_vmbus_ring_buffer_info* rbi, - uint32_t* read, - uint32_t* write) +static __inline void +get_ring_buffer_avail_bytes(hv_vmbus_ring_buffer_info *rbi, uint32_t *read, + uint32_t *write) { uint32_t read_loc, write_loc; /* * Capture the read/write indices before they changed */ - read_loc = rbi->ring_buffer->read_index; - write_loc = rbi->ring_buffer->write_index; + read_loc = rbi->ring_buffer->br_rindex; + write_loc = rbi->ring_buffer->br_windex; - *write = HV_BYTES_AVAIL_TO_WRITE( - read_loc, write_loc, rbi->ring_data_size); + *write = HV_BYTES_AVAIL_TO_WRITE(read_loc, write_loc, + rbi->ring_data_size); *read = rbi->ring_data_size - *write; } /** * @brief Get the next write location for the specified ring buffer */ -static inline uint32_t -get_next_write_location(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint32_t +get_next_write_location(hv_vmbus_ring_buffer_info *ring_info) { - uint32_t next = ring_info->ring_buffer->write_index; - return (next); + return ring_info->ring_buffer->br_windex; } /** * @brief Set the next write location for the specified ring buffer */ -static inline void -set_next_write_location( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t next_write_location) +static __inline void +set_next_write_location(hv_vmbus_ring_buffer_info *ring_info, + uint32_t next_write_location) { - ring_info->ring_buffer->write_index = next_write_location; + ring_info->ring_buffer->br_windex = next_write_location; } /** * @brief Get the next read location for the specified ring buffer */ -static inline uint32_t -get_next_read_location(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint32_t +get_next_read_location(hv_vmbus_ring_buffer_info *ring_info) { - uint32_t next = ring_info->ring_buffer->read_index; - return (next); + return ring_info->ring_buffer->br_rindex; } /** * @brief Get the next read location + offset for the specified ring buffer. * This allows the caller to skip. */ -static inline uint32_t -get_next_read_location_with_offset( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t offset) +static __inline uint32_t +get_next_read_location_with_offset(hv_vmbus_ring_buffer_info *ring_info, + uint32_t offset) { - uint32_t next = ring_info->ring_buffer->read_index; + uint32_t next = ring_info->ring_buffer->br_rindex; + next += offset; next %= ring_info->ring_data_size; return (next); @@ -151,28 +182,27 @@ get_next_read_location_with_offset( /** * @brief Set the next read location for the specified ring buffer */ -static inline void -set_next_read_location( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t next_read_location) +static __inline void +set_next_read_location(hv_vmbus_ring_buffer_info *ring_info, + uint32_t next_read_location) { - ring_info->ring_buffer->read_index = next_read_location; + ring_info->ring_buffer->br_rindex = next_read_location; } /** * @brief Get the start of the ring buffer */ -static inline void * -get_ring_buffer(hv_vmbus_ring_buffer_info* ring_info) +static __inline void * +get_ring_buffer(hv_vmbus_ring_buffer_info *ring_info) { - return (void *) ring_info->ring_buffer->buffer; + return ring_info->ring_buffer->br_data; } /** * @brief Get the size of the ring buffer. */ -static inline uint32_t -get_ring_buffer_size(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint32_t +get_ring_buffer_size(hv_vmbus_ring_buffer_info *ring_info) { return ring_info->ring_data_size; } @@ -180,27 +210,25 @@ get_ring_buffer_size(hv_vmbus_ring_buffe /** * Get the read and write indices as uint64_t of the specified ring buffer. */ -static inline uint64_t -get_ring_buffer_indices(hv_vmbus_ring_buffer_info* ring_info) +static __inline uint64_t +get_ring_buffer_indices(hv_vmbus_ring_buffer_info *ring_info) { - return (uint64_t) ring_info->ring_buffer->write_index << 32; + return ((uint64_t)ring_info->ring_buffer->br_windex) << 32; } void -hv_ring_buffer_read_begin( - hv_vmbus_ring_buffer_info* ring_info) +hv_ring_buffer_read_begin(hv_vmbus_ring_buffer_info *ring_info) { - ring_info->ring_buffer->interrupt_mask = 1; + ring_info->ring_buffer->br_imask = 1; mb(); } uint32_t -hv_ring_buffer_read_end( - hv_vmbus_ring_buffer_info* ring_info) +hv_ring_buffer_read_end(hv_vmbus_ring_buffer_info *ring_info) { - uint32_t read, write; + uint32_t read, write; - ring_info->ring_buffer->interrupt_mask = 0; + ring_info->ring_buffer->br_imask = 0; mb(); /* @@ -209,7 +237,6 @@ hv_ring_buffer_read_end( * incoming messages. */ get_ring_buffer_avail_bytes(ring_info, &read, &write); - return (read); } @@ -229,12 +256,11 @@ hv_ring_buffer_read_end( * arrived. */ static boolean_t -hv_ring_buffer_needsig_on_write( - uint32_t old_write_location, - hv_vmbus_ring_buffer_info* rbi) +hv_ring_buffer_needsig_on_write(uint32_t old_write_location, + hv_vmbus_ring_buffer_info *rbi) { mb(); - if (rbi->ring_buffer->interrupt_mask) + if (rbi->ring_buffer->br_imask) return (FALSE); /* Read memory barrier */ @@ -243,41 +269,26 @@ hv_ring_buffer_needsig_on_write( * This is the only case we need to signal when the * ring transitions from being empty to non-empty. */ - if (old_write_location == rbi->ring_buffer->read_index) + if (old_write_location == rbi->ring_buffer->br_rindex) return (TRUE); return (FALSE); } -static uint32_t copy_to_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t start_write_offset, - const uint8_t *src, - uint32_t src_len); - -static uint32_t copy_from_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - char* dest, - uint32_t dest_len, - uint32_t start_read_offset); - /** * @brief Initialize the ring buffer. */ int -hv_vmbus_ring_buffer_init( - hv_vmbus_ring_buffer_info* ring_info, - void* buffer, - uint32_t buffer_len) +hv_vmbus_ring_buffer_init(hv_vmbus_ring_buffer_info *ring_info, void *buffer, + uint32_t buffer_len) { memset(ring_info, 0, sizeof(hv_vmbus_ring_buffer_info)); - ring_info->ring_buffer = (hv_vmbus_ring_buffer*) buffer; - ring_info->ring_buffer->read_index = - ring_info->ring_buffer->write_index = 0; - - ring_info->ring_data_size = buffer_len - sizeof(hv_vmbus_ring_buffer); + ring_info->ring_buffer = buffer; + ring_info->ring_buffer->br_rindex = 0; + ring_info->ring_buffer->br_windex = 0; + ring_info->ring_data_size = buffer_len - sizeof(struct vmbus_bufring); mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN); return (0); @@ -286,7 +297,8 @@ hv_vmbus_ring_buffer_init( /** * @brief Cleanup the ring buffer. */ -void hv_ring_buffer_cleanup(hv_vmbus_ring_buffer_info* ring_info) +void +hv_ring_buffer_cleanup(hv_vmbus_ring_buffer_info *ring_info) { mtx_destroy(&ring_info->ring_lock); } @@ -295,24 +307,19 @@ void hv_ring_buffer_cleanup(hv_vmbus_rin * @brief Write to the ring buffer. */ int -hv_ring_buffer_write( - hv_vmbus_ring_buffer_info* out_ring_info, - const struct iovec iov[], - uint32_t iovlen, - boolean_t *need_sig) +hv_ring_buffer_write(hv_vmbus_ring_buffer_info *out_ring_info, + const struct iovec iov[], uint32_t iovlen, boolean_t *need_sig) { int i = 0; uint32_t byte_avail_to_write; uint32_t byte_avail_to_read; uint32_t old_write_location; uint32_t total_bytes_to_write = 0; - volatile uint32_t next_write_location; uint64_t prev_indices = 0; - for (i = 0; i < iovlen; i++) { - total_bytes_to_write += iov[i].iov_len; - } + for (i = 0; i < iovlen; i++) + total_bytes_to_write += iov[i].iov_len; total_bytes_to_write += sizeof(uint64_t); @@ -326,11 +333,9 @@ hv_ring_buffer_write( * Otherwise, the next time around, we think the ring buffer * is empty since the read index == write index */ - if (byte_avail_to_write <= total_bytes_to_write) { - - mtx_unlock_spin(&out_ring_info->ring_lock); - return (EAGAIN); + mtx_unlock_spin(&out_ring_info->ring_lock); + return (EAGAIN); } /* @@ -341,8 +346,8 @@ hv_ring_buffer_write( old_write_location = next_write_location; for (i = 0; i < iovlen; i++) { - next_write_location = copy_to_ring_buffer(out_ring_info, - next_write_location, iov[i].iov_base, iov[i].iov_len); + next_write_location = copy_to_ring_buffer(out_ring_info, + next_write_location, iov[i].iov_base, iov[i].iov_len); } /* @@ -350,9 +355,8 @@ hv_ring_buffer_write( */ prev_indices = get_ring_buffer_indices(out_ring_info); - next_write_location = copy_to_ring_buffer( - out_ring_info, next_write_location, - (char *) &prev_indices, sizeof(uint64_t)); + next_write_location = copy_to_ring_buffer(out_ring_info, + next_write_location, (char *)&prev_indices, sizeof(uint64_t)); /* * Full memory barrier before upding the write index. @@ -376,10 +380,8 @@ hv_ring_buffer_write( * @brief Read without advancing the read index. */ int -hv_ring_buffer_peek( - hv_vmbus_ring_buffer_info* in_ring_info, - void* buffer, - uint32_t buffer_len) +hv_ring_buffer_peek(hv_vmbus_ring_buffer_info *in_ring_info, void *buffer, + uint32_t buffer_len) { uint32_t bytesAvailToWrite; uint32_t bytesAvailToRead; @@ -388,14 +390,14 @@ hv_ring_buffer_peek( mtx_lock_spin(&in_ring_info->ring_lock); get_ring_buffer_avail_bytes(in_ring_info, &bytesAvailToRead, - &bytesAvailToWrite); + &bytesAvailToWrite); /* * Make sure there is something to read */ if (bytesAvailToRead < buffer_len) { - mtx_unlock_spin(&in_ring_info->ring_lock); - return (EAGAIN); + mtx_unlock_spin(&in_ring_info->ring_lock); + return (EAGAIN); } /* @@ -403,8 +405,8 @@ hv_ring_buffer_peek( */ nextReadLocation = get_next_read_location(in_ring_info); - nextReadLocation = copy_from_ring_buffer( - in_ring_info, (char *)buffer, buffer_len, nextReadLocation); + nextReadLocation = copy_from_ring_buffer(in_ring_info, + (char *)buffer, buffer_len, nextReadLocation); mtx_unlock_spin(&in_ring_info->ring_lock); @@ -415,11 +417,8 @@ hv_ring_buffer_peek( * @brief Read and advance the read index. */ int -hv_ring_buffer_read( - hv_vmbus_ring_buffer_info* in_ring_info, - void* buffer, - uint32_t buffer_len, - uint32_t offset) +hv_ring_buffer_read(hv_vmbus_ring_buffer_info *in_ring_info, void *buffer, + uint32_t buffer_len, uint32_t offset) { uint32_t bytes_avail_to_write; uint32_t bytes_avail_to_read; @@ -427,37 +426,29 @@ hv_ring_buffer_read( uint64_t prev_indices = 0; if (buffer_len <= 0) - return (EINVAL); + return (EINVAL); mtx_lock_spin(&in_ring_info->ring_lock); - get_ring_buffer_avail_bytes( - in_ring_info, &bytes_avail_to_read, + get_ring_buffer_avail_bytes(in_ring_info, &bytes_avail_to_read, &bytes_avail_to_write); /* * Make sure there is something to read */ if (bytes_avail_to_read < buffer_len) { - mtx_unlock_spin(&in_ring_info->ring_lock); - return (EAGAIN); + mtx_unlock_spin(&in_ring_info->ring_lock); + return (EAGAIN); } - next_read_location = get_next_read_location_with_offset( - in_ring_info, + next_read_location = get_next_read_location_with_offset(in_ring_info, offset); - next_read_location = copy_from_ring_buffer( - in_ring_info, - (char *) buffer, - buffer_len, - next_read_location); - - next_read_location = copy_from_ring_buffer( - in_ring_info, - (char *) &prev_indices, - sizeof(uint64_t), - next_read_location); + next_read_location = copy_from_ring_buffer(in_ring_info, (char *)buffer, + buffer_len, next_read_location); + + next_read_location = copy_from_ring_buffer(in_ring_info, + (char *)&prev_indices, sizeof(uint64_t), next_read_location); /* * Make sure all reads are done before we update the read index since @@ -482,23 +473,20 @@ hv_ring_buffer_read( * Assume there is enough room. Handles wrap-around in dest case only! */ static uint32_t -copy_to_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - uint32_t start_write_offset, - const uint8_t *src, - uint32_t src_len) +copy_to_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, + uint32_t start_write_offset, const uint8_t *src, uint32_t src_len) { char *ring_buffer = get_ring_buffer(ring_info); uint32_t ring_buffer_size = get_ring_buffer_size(ring_info); uint32_t fragLen; - if (src_len > ring_buffer_size - start_write_offset) { - /* wrap-around detected! */ - fragLen = ring_buffer_size - start_write_offset; - memcpy(ring_buffer + start_write_offset, src, fragLen); - memcpy(ring_buffer, src + fragLen, src_len - fragLen); + if (src_len > ring_buffer_size - start_write_offset) { + /* wrap-around detected! */ + fragLen = ring_buffer_size - start_write_offset; + memcpy(ring_buffer + start_write_offset, src, fragLen); + memcpy(ring_buffer, src + fragLen, src_len - fragLen); } else { - memcpy(ring_buffer + start_write_offset, src, src_len); + memcpy(ring_buffer + start_write_offset, src, src_len); } start_write_offset += src_len; @@ -512,24 +500,21 @@ copy_to_ring_buffer( * * Assume there is enough room. Handles wrap-around in src case only! */ -uint32_t -copy_from_ring_buffer( - hv_vmbus_ring_buffer_info* ring_info, - char* dest, - uint32_t dest_len, - uint32_t start_read_offset) +static uint32_t +copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, char *dest, + uint32_t dest_len, uint32_t start_read_offset) { uint32_t fragLen; char *ring_buffer = get_ring_buffer(ring_info); uint32_t ring_buffer_size = get_ring_buffer_size(ring_info); if (dest_len > ring_buffer_size - start_read_offset) { - /* wrap-around detected at the src */ - fragLen = ring_buffer_size - start_read_offset; - memcpy(dest, ring_buffer + start_read_offset, fragLen); - memcpy(dest + fragLen, ring_buffer, dest_len - fragLen); + /* wrap-around detected at the src */ + fragLen = ring_buffer_size - start_read_offset; + memcpy(dest, ring_buffer + start_read_offset, fragLen); + memcpy(dest + fragLen, ring_buffer, dest_len - fragLen); } else { - memcpy(dest, ring_buffer + start_read_offset, dest_len); + memcpy(dest, ring_buffer + start_read_offset, dest_len); } start_read_offset += dest_len; @@ -537,4 +522,3 @@ copy_from_ring_buffer( return (start_read_offset); } - Modified: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 03:24:03 2016 (r307461) +++ stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon Oct 17 03:27:23 2016 (r307462) @@ -45,13 +45,11 @@ struct vmbus_softc; * Private, VM Bus functions */ struct sysctl_ctx_list; -struct sysctl_oid_list; +struct sysctl_oid; -void hv_ring_buffer_stat( - struct sysctl_ctx_list *ctx, - struct sysctl_oid_list *tree_node, - hv_vmbus_ring_buffer_info *rbi, - const char *desc); +void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, + struct sysctl_oid *br_tree, hv_vmbus_ring_buffer_info *br, + const char *name); int hv_vmbus_ring_buffer_init( hv_vmbus_ring_buffer_info *ring_info, Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:24:03 2016 (r307461) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:27:23 2016 (r307462) @@ -171,24 +171,17 @@ vmbus_chan_sysctl_create(struct vmbus_ch chan, 0, vmbus_chan_sysctl_mnf, "I", "has monitor notification facilities"); - /* - * Create sysctl tree for RX bufring. - */ - br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, - "in", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); - if (br_tree != NULL) { - hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), - &chan->ch_rxbr, "inbound ring buffer stats"); - } - - /* - * Create sysctl tree for TX bufring. - */ br_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, - "out", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + "br", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); if (br_tree != NULL) { - hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree), - &chan->ch_txbr, "outbound ring buffer stats"); + /* + * Create sysctl tree for RX bufring. + */ + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_rxbr, "rx"); + /* + * Create sysctl tree for TX bufring. + */ + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_txbr, "tx"); } } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Mon Oct 17 03:24:03 2016 (r307461) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Mon Oct 17 03:27:23 2016 (r307462) @@ -41,31 +41,7 @@ #include typedef struct { - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t write_index; - /* - * offset in bytes from the start of ring data below - */ - volatile uint32_t read_index; - /* - * NOTE: The interrupt_mask field is used only for channels, but - * vmbus connection also uses this data structure - */ - volatile uint32_t interrupt_mask; - /* pad it to PAGE_SIZE so that data starts on a page */ - uint8_t reserved[4084]; - - /* - * WARNING: Ring data starts here - * !!! DO NOT place any fields below this !!! - */ - uint8_t buffer[0]; /* doubles as interrupt mask */ -} __packed hv_vmbus_ring_buffer; - -typedef struct { - hv_vmbus_ring_buffer* ring_buffer; + struct vmbus_bufring *ring_buffer; struct mtx ring_lock; uint32_t ring_data_size; /* ring_size */ } hv_vmbus_ring_buffer_info; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 03:24:03 2016 (r307461) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 03:27:23 2016 (r307462) @@ -102,6 +102,37 @@ struct vmbus_mnf { CTASSERT(sizeof(struct vmbus_mnf) == PAGE_SIZE); /* + * Buffer ring + */ +struct vmbus_bufring { + /* + * If br_windex == br_rindex, this bufring is empty; this + * means we can _not_ write data to the bufring, if the + * write is going to make br_windex same as br_rindex. + */ + volatile uint32_t br_windex; + volatile uint32_t br_rindex; + + /* + * Interrupt mask {0,1} + * + * For TX bufring, host set this to 1, when it is processing + * the TX bufring, so that we can safely skip the TX event + * notification to host. + * + * For RX bufring, once this is set to 1 by us, host will not + * further dispatch interrupts to us, even if there are data + * pending on the RX bufring. This effectively disables the + * interrupt of the channel to which this RX bufring is attached. + */ + volatile uint32_t br_imask; + + uint8_t br_rsvd[4084]; + uint8_t br_data[]; +} __packed; +CTASSERT(sizeof(struct vmbus_bufring) == PAGE_SIZE); + +/* * Channel */ From owner-svn-src-all@freebsd.org Mon Oct 17 03:29:33 2016 Return-Path: Delivered-To: svn-src-all@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 5E9F5C14AA7; Mon, 17 Oct 2016 03:29:33 +0000 (UTC) (envelope-from sephe@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 215BF15B7; Mon, 17 Oct 2016 03:29:33 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H3TWQC017155; Mon, 17 Oct 2016 03:29:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H3TVXw017148; Mon, 17 Oct 2016 03:29:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170329.u9H3TVXw017148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:29:31 +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: r307463 - in stable/11/sys/dev/hyperv: netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:29:33 -0000 Author: sephe Date: Mon Oct 17 03:29:31 2016 New Revision: 307463 URL: https://svnweb.freebsd.org/changeset/base/307463 Log: MFC 303283 hyperv/vmbus: Rename hv_vmbus_priv.h to vmbus_brvar.h It only contains bufring related bits for a while. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7281 Added: stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h - copied unchanged from r303283, head/sys/dev/hyperv/vmbus/vmbus_brvar.h Deleted: stable/11/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 03:27:23 2016 (r307462) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 03:29:31 2016 (r307463) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "hv_net_vsc.h" #include "hv_rndis.h" #include "hv_rndis_filter.h" Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 03:27:23 2016 (r307462) +++ stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 03:29:31 2016 (r307463) @@ -31,8 +31,8 @@ #include #include -#include "hv_vmbus_priv.h" #include +#include /* Amount of space to write to */ #define HV_BYTES_AVAIL_TO_WRITE(r, w, z) \ Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Mon Oct 17 03:27:23 2016 (r307462) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Mon Oct 17 03:29:31 2016 (r307463) @@ -43,12 +43,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include #include #include #include +#if 0 #include +#endif #define HYPERV_FREEBSD_BUILD 0ULL #define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) Modified: stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Mon Oct 17 03:27:23 2016 (r307462) +++ stable/11/sys/dev/hyperv/vmbus/hyperv_reg.h Mon Oct 17 03:29:31 2016 (r307463) @@ -30,6 +30,7 @@ #define _HYPERV_REG_H_ #include +#include /* * Hyper-V Synthetic MSRs Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 03:27:23 2016 (r307462) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 03:29:31 2016 (r307463) @@ -60,11 +60,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include #include +#include #include #include "acpi_if.h" Copied: stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h (from r303283, head/sys/dev/hyperv/vmbus/vmbus_brvar.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Oct 17 03:29:31 2016 (r307463, copy of r303283, head/sys/dev/hyperv/vmbus/vmbus_brvar.h) @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __HYPERV_PRIV_H__ +#define __HYPERV_PRIV_H__ + +#include +#include +#include +#include +#include + +#include + +struct vmbus_softc; + +/* + * Private, VM Bus functions + */ +struct sysctl_ctx_list; +struct sysctl_oid; + +void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, + struct sysctl_oid *br_tree, hv_vmbus_ring_buffer_info *br, + const char *name); + +int hv_vmbus_ring_buffer_init( + hv_vmbus_ring_buffer_info *ring_info, + void *buffer, + uint32_t buffer_len); + +void hv_ring_buffer_cleanup( + hv_vmbus_ring_buffer_info *ring_info); + +int hv_ring_buffer_write( + hv_vmbus_ring_buffer_info *ring_info, + const struct iovec iov[], + uint32_t iovlen, + boolean_t *need_sig); + +int hv_ring_buffer_peek( + hv_vmbus_ring_buffer_info *ring_info, + void *buffer, + uint32_t buffer_len); + +int hv_ring_buffer_read( + hv_vmbus_ring_buffer_info *ring_info, + void *buffer, + uint32_t buffer_len, + uint32_t offset); + +void hv_ring_buffer_read_begin( + hv_vmbus_ring_buffer_info *ring_info); + +uint32_t hv_ring_buffer_read_end( + hv_vmbus_ring_buffer_info *ring_info); + +#endif /* __HYPERV_PRIV_H__ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:27:23 2016 (r307462) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:29:31 2016 (r307463) @@ -46,10 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include +#include static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct vmbus_channel *); From owner-svn-src-all@freebsd.org Mon Oct 17 03:35:22 2016 Return-Path: Delivered-To: svn-src-all@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 31884C14D2C; Mon, 17 Oct 2016 03:35:22 +0000 (UTC) (envelope-from sephe@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 C820D19FA; Mon, 17 Oct 2016 03:35:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H3ZLXg020792; Mon, 17 Oct 2016 03:35:21 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H3ZKFK020788; Mon, 17 Oct 2016 03:35:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170335.u9H3ZKFK020788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:35:20 +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: r307464 - stable/11/sys/dev/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:35:22 -0000 Author: sephe Date: Mon Oct 17 03:35:20 2016 New Revision: 307464 URL: https://svnweb.freebsd.org/changeset/base/307464 Log: MFC 303284,303329,303361,303362,303366,303368-303370 303284 hyperv/vmbus: Move bufring info definition to vmbus_brvar.h Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7282 303329 hyperv/vmbus: Nuke unnecessary accessor functions. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7303 303361 hyperv/vmbus: Initialize RX/TX bufring mutex at channel creation time Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7312 303362 hyperv/vmbus: Use different struct for RX/TX bufring. So that they can use suitable MP synchronization mechanism. While I'm here change the bufring init/read/write function names. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7313 303366 hyperv/vmbus: Update comment for bufring Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7314 303368 hyperv/vmbus: Cleanup TX bufring write process. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7315 303369 hyperv/vmbus: Stringent RX bufring data length checks. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7316 303370 hyperv/vmbus: Cleanup RX bufring read process. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7317 Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 03:29:31 2016 (r307463) +++ stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Mon Oct 17 03:35:20 2016 (r307464) @@ -34,32 +34,29 @@ #include #include -/* Amount of space to write to */ -#define HV_BYTES_AVAIL_TO_WRITE(r, w, z) \ - ((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w)) - -static uint32_t copy_to_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, - uint32_t start_write_offset, const uint8_t *src, - uint32_t src_len); -static uint32_t copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, - char *dest, uint32_t dest_len, uint32_t start_read_offset); +/* Amount of space available for write */ +#define VMBUS_BR_WAVAIL(r, w, z) \ + (((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))) + +/* Increase bufing index */ +#define VMBUS_BR_IDXINC(idx, inc, sz) (((idx) + (inc)) % (sz)) static int vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS) { - const hv_vmbus_ring_buffer_info *br = arg1; - uint32_t rindex, windex, intr_mask, ravail, wavail; + const struct vmbus_br *br = arg1; + uint32_t rindex, windex, imask, ravail, wavail; char state[256]; - rindex = br->ring_buffer->br_rindex; - windex = br->ring_buffer->br_windex; - intr_mask = br->ring_buffer->br_imask; - wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); - ravail = br->ring_data_size - wavail; + rindex = br->vbr_rindex; + windex = br->vbr_windex; + imask = br->vbr_imask; + wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize); + ravail = br->vbr_dsize - wavail; snprintf(state, sizeof(state), - "rindex:%u windex:%u intr_mask:%u ravail:%u wavail:%u", - rindex, windex, intr_mask, ravail, wavail); + "rindex:%u windex:%u imask:%u ravail:%u wavail:%u", + rindex, windex, imask, ravail, wavail); return sysctl_handle_string(oidp, state, sizeof(state), req); } @@ -76,25 +73,25 @@ vmbus_br_sysctl_state_bin(SYSCTL_HANDLER #define BR_STATE_WSPC 4 #define BR_STATE_MAX 5 - const hv_vmbus_ring_buffer_info *br = arg1; + const struct vmbus_br *br = arg1; uint32_t rindex, windex, wavail, state[BR_STATE_MAX]; - rindex = br->ring_buffer->br_rindex; - windex = br->ring_buffer->br_windex; - wavail = HV_BYTES_AVAIL_TO_WRITE(rindex, windex, br->ring_data_size); + rindex = br->vbr_rindex; + windex = br->vbr_windex; + wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize); state[BR_STATE_RIDX] = rindex; state[BR_STATE_WIDX] = windex; - state[BR_STATE_IMSK] = br->ring_buffer->br_imask; + state[BR_STATE_IMSK] = br->vbr_imask; state[BR_STATE_WSPC] = wavail; - state[BR_STATE_RSPC] = br->ring_data_size - wavail; + state[BR_STATE_RSPC] = br->vbr_dsize - wavail; return sysctl_handle_opaque(oidp, state, sizeof(state), req); } void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, - hv_vmbus_ring_buffer_info *br, const char *name) + struct vmbus_br *br, const char *name) { struct sysctl_oid *tree; char desc[64]; @@ -115,342 +112,291 @@ vmbus_br_sysctl_create(struct sysctl_ctx br, 0, vmbus_br_sysctl_state_bin, "IU", desc); } -/** - * @brief Get number of bytes available to read and to write to - * for the specified ring buffer - */ -static __inline void -get_ring_buffer_avail_bytes(hv_vmbus_ring_buffer_info *rbi, uint32_t *read, - uint32_t *write) +void +vmbus_rxbr_intr_mask(struct vmbus_rxbr *rbr) { - uint32_t read_loc, write_loc; - - /* - * Capture the read/write indices before they changed - */ - read_loc = rbi->ring_buffer->br_rindex; - write_loc = rbi->ring_buffer->br_windex; - - *write = HV_BYTES_AVAIL_TO_WRITE(read_loc, write_loc, - rbi->ring_data_size); - *read = rbi->ring_data_size - *write; + rbr->rxbr_imask = 1; + mb(); } -/** - * @brief Get the next write location for the specified ring buffer - */ static __inline uint32_t -get_next_write_location(hv_vmbus_ring_buffer_info *ring_info) +vmbus_rxbr_avail(const struct vmbus_rxbr *rbr) { - return ring_info->ring_buffer->br_windex; -} + uint32_t rindex, windex; -/** - * @brief Set the next write location for the specified ring buffer - */ -static __inline void -set_next_write_location(hv_vmbus_ring_buffer_info *ring_info, - uint32_t next_write_location) -{ - ring_info->ring_buffer->br_windex = next_write_location; -} + /* Get snapshot */ + rindex = rbr->rxbr_rindex; + windex = rbr->rxbr_windex; -/** - * @brief Get the next read location for the specified ring buffer - */ -static __inline uint32_t -get_next_read_location(hv_vmbus_ring_buffer_info *ring_info) -{ - return ring_info->ring_buffer->br_rindex; + return (rbr->rxbr_dsize - + VMBUS_BR_WAVAIL(rindex, windex, rbr->rxbr_dsize)); } -/** - * @brief Get the next read location + offset for the specified ring buffer. - * This allows the caller to skip. - */ -static __inline uint32_t -get_next_read_location_with_offset(hv_vmbus_ring_buffer_info *ring_info, - uint32_t offset) +uint32_t +vmbus_rxbr_intr_unmask(struct vmbus_rxbr *rbr) { - uint32_t next = ring_info->ring_buffer->br_rindex; + rbr->rxbr_imask = 0; + mb(); - next += offset; - next %= ring_info->ring_data_size; - return (next); + /* + * Now check to see if the ring buffer is still empty. + * If it is not, we raced and we need to process new + * incoming channel packets. + */ + return vmbus_rxbr_avail(rbr); } -/** - * @brief Set the next read location for the specified ring buffer - */ -static __inline void -set_next_read_location(hv_vmbus_ring_buffer_info *ring_info, - uint32_t next_read_location) +static void +vmbus_br_setup(struct vmbus_br *br, void *buf, int blen) { - ring_info->ring_buffer->br_rindex = next_read_location; + br->vbr = buf; + br->vbr_dsize = blen - sizeof(struct vmbus_bufring); } -/** - * @brief Get the start of the ring buffer - */ -static __inline void * -get_ring_buffer(hv_vmbus_ring_buffer_info *ring_info) +void +vmbus_rxbr_init(struct vmbus_rxbr *rbr) { - return ring_info->ring_buffer->br_data; + mtx_init(&rbr->rxbr_lock, "vmbus_rxbr", NULL, MTX_SPIN); } -/** - * @brief Get the size of the ring buffer. - */ -static __inline uint32_t -get_ring_buffer_size(hv_vmbus_ring_buffer_info *ring_info) +void +vmbus_rxbr_deinit(struct vmbus_rxbr *rbr) { - return ring_info->ring_data_size; + mtx_destroy(&rbr->rxbr_lock); } -/** - * Get the read and write indices as uint64_t of the specified ring buffer. - */ -static __inline uint64_t -get_ring_buffer_indices(hv_vmbus_ring_buffer_info *ring_info) +void +vmbus_rxbr_setup(struct vmbus_rxbr *rbr, void *buf, int blen) { - return ((uint64_t)ring_info->ring_buffer->br_windex) << 32; + vmbus_br_setup(&rbr->rxbr, buf, blen); } void -hv_ring_buffer_read_begin(hv_vmbus_ring_buffer_info *ring_info) +vmbus_txbr_init(struct vmbus_txbr *tbr) { - ring_info->ring_buffer->br_imask = 1; - mb(); + mtx_init(&tbr->txbr_lock, "vmbus_txbr", NULL, MTX_SPIN); } -uint32_t -hv_ring_buffer_read_end(hv_vmbus_ring_buffer_info *ring_info) +void +vmbus_txbr_deinit(struct vmbus_txbr *tbr) { - uint32_t read, write; - - ring_info->ring_buffer->br_imask = 0; - mb(); + mtx_destroy(&tbr->txbr_lock); +} - /* - * Now check to see if the ring buffer is still empty. - * If it is not, we raced and we need to process new - * incoming messages. - */ - get_ring_buffer_avail_bytes(ring_info, &read, &write); - return (read); +void +vmbus_txbr_setup(struct vmbus_txbr *tbr, void *buf, int blen) +{ + vmbus_br_setup(&tbr->txbr, buf, blen); } /* - * When we write to the ring buffer, check if the host needs to - * be signaled. Here is the details of this protocol: - * - * 1. The host guarantees that while it is draining the - * ring buffer, it will set the interrupt_mask to - * indicate it does not need to be interrupted when - * new data is placed. + * When we write to the ring buffer, check if the host needs to be + * signaled. * - * 2. The host guarantees that it will completely drain - * the ring buffer before exiting the read loop. Further, - * once the ring buffer is empty, it will clear the - * interrupt_mask and re-check to see if new data has - * arrived. + * The contract: + * - The host guarantees that while it is draining the TX bufring, + * it will set the br_imask to indicate it does not need to be + * interrupted when new data are added. + * - The host guarantees that it will completely drain the TX bufring + * before exiting the read loop. Further, once the TX bufring is + * empty, it will clear the br_imask and re-check to see if new + * data have arrived. */ -static boolean_t -hv_ring_buffer_needsig_on_write(uint32_t old_write_location, - hv_vmbus_ring_buffer_info *rbi) +static __inline boolean_t +vmbus_txbr_need_signal(const struct vmbus_txbr *tbr, uint32_t old_windex) { mb(); - if (rbi->ring_buffer->br_imask) + if (tbr->txbr_imask) return (FALSE); + /* XXX only compiler fence is needed */ /* Read memory barrier */ rmb(); + /* * This is the only case we need to signal when the * ring transitions from being empty to non-empty. */ - if (old_write_location == rbi->ring_buffer->br_rindex) + if (old_windex == tbr->txbr_rindex) return (TRUE); return (FALSE); } -/** - * @brief Initialize the ring buffer. - */ -int -hv_vmbus_ring_buffer_init(hv_vmbus_ring_buffer_info *ring_info, void *buffer, - uint32_t buffer_len) +static __inline uint32_t +vmbus_txbr_avail(const struct vmbus_txbr *tbr) { - memset(ring_info, 0, sizeof(hv_vmbus_ring_buffer_info)); - - ring_info->ring_buffer = buffer; - ring_info->ring_buffer->br_rindex = 0; - ring_info->ring_buffer->br_windex = 0; + uint32_t rindex, windex; - ring_info->ring_data_size = buffer_len - sizeof(struct vmbus_bufring); - mtx_init(&ring_info->ring_lock, "vmbus ring buffer", NULL, MTX_SPIN); + /* Get snapshot */ + rindex = tbr->txbr_rindex; + windex = tbr->txbr_windex; - return (0); + return VMBUS_BR_WAVAIL(rindex, windex, tbr->txbr_dsize); } -/** - * @brief Cleanup the ring buffer. - */ -void -hv_ring_buffer_cleanup(hv_vmbus_ring_buffer_info *ring_info) +static __inline uint32_t +vmbus_txbr_copyto(const struct vmbus_txbr *tbr, uint32_t windex, + const void *src0, uint32_t cplen) { - mtx_destroy(&ring_info->ring_lock); + const uint8_t *src = src0; + uint8_t *br_data = tbr->txbr_data; + uint32_t br_dsize = tbr->txbr_dsize; + + if (cplen > br_dsize - windex) { + uint32_t fraglen = br_dsize - windex; + + /* Wrap-around detected */ + memcpy(br_data + windex, src, fraglen); + memcpy(br_data, src + fraglen, cplen - fraglen); + } else { + memcpy(br_data + windex, src, cplen); + } + return VMBUS_BR_IDXINC(windex, cplen, br_dsize); } -/** - * @brief Write to the ring buffer. +/* + * Write scattered channel packet to TX bufring. + * + * The offset of this channel packet is written as a 64bits value + * immediately after this channel packet. */ int -hv_ring_buffer_write(hv_vmbus_ring_buffer_info *out_ring_info, - const struct iovec iov[], uint32_t iovlen, boolean_t *need_sig) +vmbus_txbr_write(struct vmbus_txbr *tbr, const struct iovec iov[], int iovlen, + boolean_t *need_sig) { - int i = 0; - uint32_t byte_avail_to_write; - uint32_t byte_avail_to_read; - uint32_t old_write_location; - uint32_t total_bytes_to_write = 0; - volatile uint32_t next_write_location; - uint64_t prev_indices = 0; + uint32_t old_windex, windex, total; + uint64_t save_windex; + int i; + total = 0; for (i = 0; i < iovlen; i++) - total_bytes_to_write += iov[i].iov_len; + total += iov[i].iov_len; + total += sizeof(save_windex); - total_bytes_to_write += sizeof(uint64_t); - - mtx_lock_spin(&out_ring_info->ring_lock); - - get_ring_buffer_avail_bytes(out_ring_info, &byte_avail_to_read, - &byte_avail_to_write); + mtx_lock_spin(&tbr->txbr_lock); /* - * If there is only room for the packet, assume it is full. - * Otherwise, the next time around, we think the ring buffer - * is empty since the read index == write index + * NOTE: + * If this write is going to make br_windex same as br_rindex, + * i.e. the available space for write is same as the write size, + * we can't do it then, since br_windex == br_rindex means that + * the bufring is empty. */ - if (byte_avail_to_write <= total_bytes_to_write) { - mtx_unlock_spin(&out_ring_info->ring_lock); + if (vmbus_txbr_avail(tbr) <= total) { + mtx_unlock_spin(&tbr->txbr_lock); return (EAGAIN); } + /* Save br_windex for later use */ + old_windex = tbr->txbr_windex; + /* - * Write to the ring buffer + * Copy the scattered channel packet to the TX bufring. */ - next_write_location = get_next_write_location(out_ring_info); - - old_write_location = next_write_location; - + windex = old_windex; for (i = 0; i < iovlen; i++) { - next_write_location = copy_to_ring_buffer(out_ring_info, - next_write_location, iov[i].iov_base, iov[i].iov_len); + windex = vmbus_txbr_copyto(tbr, windex, + iov[i].iov_base, iov[i].iov_len); } /* - * Set previous packet start + * Set the offset of the current channel packet. */ - prev_indices = get_ring_buffer_indices(out_ring_info); - - next_write_location = copy_to_ring_buffer(out_ring_info, - next_write_location, (char *)&prev_indices, sizeof(uint64_t)); + save_windex = ((uint64_t)old_windex) << 32; + windex = vmbus_txbr_copyto(tbr, windex, &save_windex, + sizeof(save_windex)); /* + * XXX only compiler fence is needed. * Full memory barrier before upding the write index. */ mb(); /* - * Now, update the write location + * Update the write index _after_ the channel packet + * is copied. */ - set_next_write_location(out_ring_info, next_write_location); + tbr->txbr_windex = windex; - mtx_unlock_spin(&out_ring_info->ring_lock); + mtx_unlock_spin(&tbr->txbr_lock); - *need_sig = hv_ring_buffer_needsig_on_write(old_write_location, - out_ring_info); + *need_sig = vmbus_txbr_need_signal(tbr, old_windex); return (0); } -/** - * @brief Read without advancing the read index. - */ -int -hv_ring_buffer_peek(hv_vmbus_ring_buffer_info *in_ring_info, void *buffer, - uint32_t buffer_len) +static __inline uint32_t +vmbus_rxbr_copyfrom(const struct vmbus_rxbr *rbr, uint32_t rindex, + void *dst0, int cplen) { - uint32_t bytesAvailToWrite; - uint32_t bytesAvailToRead; - uint32_t nextReadLocation = 0; - - mtx_lock_spin(&in_ring_info->ring_lock); + uint8_t *dst = dst0; + const uint8_t *br_data = rbr->rxbr_data; + uint32_t br_dsize = rbr->rxbr_dsize; + + if (cplen > br_dsize - rindex) { + uint32_t fraglen = br_dsize - rindex; + + /* Wrap-around detected. */ + memcpy(dst, br_data + rindex, fraglen); + memcpy(dst + fraglen, br_data, cplen - fraglen); + } else { + memcpy(dst, br_data + rindex, cplen); + } + return VMBUS_BR_IDXINC(rindex, cplen, br_dsize); +} - get_ring_buffer_avail_bytes(in_ring_info, &bytesAvailToRead, - &bytesAvailToWrite); +int +vmbus_rxbr_peek(struct vmbus_rxbr *rbr, void *data, int dlen) +{ + mtx_lock_spin(&rbr->rxbr_lock); /* - * Make sure there is something to read + * The requested data and the 64bits channel packet + * offset should be there at least. */ - if (bytesAvailToRead < buffer_len) { - mtx_unlock_spin(&in_ring_info->ring_lock); + if (vmbus_rxbr_avail(rbr) < dlen + sizeof(uint64_t)) { + mtx_unlock_spin(&rbr->rxbr_lock); return (EAGAIN); } + vmbus_rxbr_copyfrom(rbr, rbr->rxbr_rindex, data, dlen); - /* - * Convert to byte offset - */ - nextReadLocation = get_next_read_location(in_ring_info); - - nextReadLocation = copy_from_ring_buffer(in_ring_info, - (char *)buffer, buffer_len, nextReadLocation); - - mtx_unlock_spin(&in_ring_info->ring_lock); + mtx_unlock_spin(&rbr->rxbr_lock); return (0); } -/** - * @brief Read and advance the read index. +/* + * NOTE: + * We assume (dlen + skip) == sizeof(channel packet). */ int -hv_ring_buffer_read(hv_vmbus_ring_buffer_info *in_ring_info, void *buffer, - uint32_t buffer_len, uint32_t offset) +vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, uint32_t skip) { - uint32_t bytes_avail_to_write; - uint32_t bytes_avail_to_read; - uint32_t next_read_location = 0; - uint64_t prev_indices = 0; - - if (buffer_len <= 0) - return (EINVAL); + uint32_t rindex, br_dsize = rbr->rxbr_dsize; - mtx_lock_spin(&in_ring_info->ring_lock); + KASSERT(dlen + skip > 0, ("invalid dlen %d, offset %u", dlen, skip)); - get_ring_buffer_avail_bytes(in_ring_info, &bytes_avail_to_read, - &bytes_avail_to_write); + mtx_lock_spin(&rbr->rxbr_lock); - /* - * Make sure there is something to read - */ - if (bytes_avail_to_read < buffer_len) { - mtx_unlock_spin(&in_ring_info->ring_lock); + if (vmbus_rxbr_avail(rbr) < dlen + skip + sizeof(uint64_t)) { + mtx_unlock_spin(&rbr->rxbr_lock); return (EAGAIN); } - next_read_location = get_next_read_location_with_offset(in_ring_info, - offset); - - next_read_location = copy_from_ring_buffer(in_ring_info, (char *)buffer, - buffer_len, next_read_location); + /* + * Copy channel packet from RX bufring. + */ + rindex = VMBUS_BR_IDXINC(rbr->rxbr_rindex, skip, br_dsize); + rindex = vmbus_rxbr_copyfrom(rbr, rindex, data, dlen); - next_read_location = copy_from_ring_buffer(in_ring_info, - (char *)&prev_indices, sizeof(uint64_t), next_read_location); + /* + * Discard this channel packet's 64bits offset, which is useless to us. + */ + rindex = VMBUS_BR_IDXINC(rindex, sizeof(uint64_t), br_dsize); /* + * XXX only compiler fence is needed. * Make sure all reads are done before we update the read index since * the writer may start writing to the read area once the read index * is updated. @@ -458,67 +404,11 @@ hv_ring_buffer_read(hv_vmbus_ring_buffer wmb(); /* - * Update the read index + * Update the read index _after_ the channel packet is fetched. */ - set_next_read_location(in_ring_info, next_read_location); + rbr->rxbr_rindex = rindex; - mtx_unlock_spin(&in_ring_info->ring_lock); + mtx_unlock_spin(&rbr->rxbr_lock); return (0); } - -/** - * @brief Helper routine to copy from source to ring buffer. - * - * Assume there is enough room. Handles wrap-around in dest case only! - */ -static uint32_t -copy_to_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, - uint32_t start_write_offset, const uint8_t *src, uint32_t src_len) -{ - char *ring_buffer = get_ring_buffer(ring_info); - uint32_t ring_buffer_size = get_ring_buffer_size(ring_info); - uint32_t fragLen; - - if (src_len > ring_buffer_size - start_write_offset) { - /* wrap-around detected! */ - fragLen = ring_buffer_size - start_write_offset; - memcpy(ring_buffer + start_write_offset, src, fragLen); - memcpy(ring_buffer, src + fragLen, src_len - fragLen); - } else { - memcpy(ring_buffer + start_write_offset, src, src_len); - } - - start_write_offset += src_len; - start_write_offset %= ring_buffer_size; - - return (start_write_offset); -} - -/** - * @brief Helper routine to copy to source from ring buffer. - * - * Assume there is enough room. Handles wrap-around in src case only! - */ -static uint32_t -copy_from_ring_buffer(hv_vmbus_ring_buffer_info *ring_info, char *dest, - uint32_t dest_len, uint32_t start_read_offset) -{ - uint32_t fragLen; - char *ring_buffer = get_ring_buffer(ring_info); - uint32_t ring_buffer_size = get_ring_buffer_size(ring_info); - - if (dest_len > ring_buffer_size - start_read_offset) { - /* wrap-around detected at the src */ - fragLen = ring_buffer_size - start_read_offset; - memcpy(dest, ring_buffer + start_read_offset, fragLen); - memcpy(dest + fragLen, ring_buffer, dest_len - fragLen); - } else { - memcpy(dest, ring_buffer + start_read_offset, dest_len); - } - - start_read_offset += dest_len; - start_read_offset %= ring_buffer_size; - - return (start_read_offset); -} Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Oct 17 03:29:31 2016 (r307463) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Oct 17 03:35:20 2016 (r307464) @@ -28,58 +28,66 @@ * $FreeBSD$ */ -#ifndef __HYPERV_PRIV_H__ -#define __HYPERV_PRIV_H__ +#ifndef _VMBUS_BRVAR_H_ +#define _VMBUS_BRVAR_H_ #include #include #include -#include #include -#include +struct vmbus_br { + struct vmbus_bufring *vbr; + uint32_t vbr_dsize; /* total data size */ +}; + +#define vbr_windex vbr->br_windex +#define vbr_rindex vbr->br_rindex +#define vbr_imask vbr->br_imask +#define vbr_data vbr->br_data + +struct vmbus_rxbr { + struct mtx rxbr_lock; + struct vmbus_br rxbr; +}; + +#define rxbr_windex rxbr.vbr_windex +#define rxbr_rindex rxbr.vbr_rindex +#define rxbr_imask rxbr.vbr_imask +#define rxbr_data rxbr.vbr_data +#define rxbr_dsize rxbr.vbr_dsize + +struct vmbus_txbr { + struct mtx txbr_lock; + struct vmbus_br txbr; +}; + +#define txbr_windex txbr.vbr_windex +#define txbr_rindex txbr.vbr_rindex +#define txbr_imask txbr.vbr_imask +#define txbr_data txbr.vbr_data +#define txbr_dsize txbr.vbr_dsize -struct vmbus_softc; - -/* - * Private, VM Bus functions - */ struct sysctl_ctx_list; struct sysctl_oid; -void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, - struct sysctl_oid *br_tree, hv_vmbus_ring_buffer_info *br, - const char *name); - -int hv_vmbus_ring_buffer_init( - hv_vmbus_ring_buffer_info *ring_info, - void *buffer, - uint32_t buffer_len); - -void hv_ring_buffer_cleanup( - hv_vmbus_ring_buffer_info *ring_info); - -int hv_ring_buffer_write( - hv_vmbus_ring_buffer_info *ring_info, - const struct iovec iov[], - uint32_t iovlen, - boolean_t *need_sig); - -int hv_ring_buffer_peek( - hv_vmbus_ring_buffer_info *ring_info, - void *buffer, - uint32_t buffer_len); - -int hv_ring_buffer_read( - hv_vmbus_ring_buffer_info *ring_info, - void *buffer, - uint32_t buffer_len, - uint32_t offset); - -void hv_ring_buffer_read_begin( - hv_vmbus_ring_buffer_info *ring_info); - -uint32_t hv_ring_buffer_read_end( - hv_vmbus_ring_buffer_info *ring_info); +void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, + struct sysctl_oid *br_tree, struct vmbus_br *br, + const char *name); + +void vmbus_rxbr_init(struct vmbus_rxbr *rbr); +void vmbus_rxbr_deinit(struct vmbus_rxbr *rbr); +void vmbus_rxbr_setup(struct vmbus_rxbr *rbr, void *buf, int blen); +int vmbus_rxbr_peek(struct vmbus_rxbr *rbr, void *data, int dlen); +int vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, + uint32_t skip); +void vmbus_rxbr_intr_mask(struct vmbus_rxbr *rbr); +uint32_t vmbus_rxbr_intr_unmask(struct vmbus_rxbr *rbr); + +void vmbus_txbr_init(struct vmbus_txbr *tbr); +void vmbus_txbr_deinit(struct vmbus_txbr *tbr); +void vmbus_txbr_setup(struct vmbus_txbr *tbr, void *buf, int blen); +int vmbus_txbr_write(struct vmbus_txbr *tbr, + const struct iovec iov[], int iovlen, boolean_t *need_sig); -#endif /* __HYPERV_PRIV_H__ */ +#endif /* _VMBUS_BRVAR_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:29:31 2016 (r307463) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:35:20 2016 (r307464) @@ -178,11 +178,11 @@ vmbus_chan_sysctl_create(struct vmbus_ch /* * Create sysctl tree for RX bufring. */ - vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_rxbr, "rx"); + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_rxbr.rxbr, "rx"); /* * Create sysctl tree for TX bufring. */ - vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_txbr, "tx"); + vmbus_br_sysctl_create(ctx, br_tree, &chan->ch_txbr.txbr, "tx"); } } @@ -239,9 +239,9 @@ vmbus_chan_open(struct vmbus_channel *ch chan->ch_bufring = br; /* TX bufring comes first */ - hv_vmbus_ring_buffer_init(&chan->ch_txbr, br, txbr_size); + vmbus_txbr_setup(&chan->ch_txbr, br, txbr_size); /* RX bufring immediately follows TX bufring */ - hv_vmbus_ring_buffer_init(&chan->ch_rxbr, br + txbr_size, rxbr_size); + vmbus_rxbr_setup(&chan->ch_rxbr, br + txbr_size, rxbr_size); /* Create sysctl tree for this channel */ vmbus_chan_sysctl_create(chan); @@ -549,8 +549,6 @@ vmbus_chan_close_internal(struct vmbus_c /* * Destroy the TX+RX bufrings. */ - hv_ring_buffer_cleanup(&chan->ch_txbr); - hv_ring_buffer_cleanup(&chan->ch_rxbr); if (chan->ch_bufring != NULL) { hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); chan->ch_bufring = NULL; @@ -620,7 +618,7 @@ vmbus_chan_send(struct vmbus_channel *ch iov[2].iov_base = &pad; iov[2].iov_len = pad_pktlen - pktlen; - error = hv_ring_buffer_write(&chan->ch_txbr, iov, 3, &send_evt); + error = vmbus_txbr_write(&chan->ch_txbr, iov, 3, &send_evt); if (!error && send_evt) vmbus_chan_signal_tx(chan); return error; @@ -660,7 +658,7 @@ vmbus_chan_send_sglist(struct vmbus_chan iov[3].iov_base = &pad; iov[3].iov_len = pad_pktlen - pktlen; - error = hv_ring_buffer_write(&chan->ch_txbr, iov, 4, &send_evt); + error = vmbus_txbr_write(&chan->ch_txbr, iov, 4, &send_evt); if (!error && send_evt) vmbus_chan_signal_tx(chan); return error; @@ -702,7 +700,7 @@ vmbus_chan_send_prplist(struct vmbus_cha iov[3].iov_base = &pad; iov[3].iov_len = pad_pktlen - pktlen; - error = hv_ring_buffer_write(&chan->ch_txbr, iov, 4, &send_evt); + error = vmbus_txbr_write(&chan->ch_txbr, iov, 4, &send_evt); if (!error && send_evt) vmbus_chan_signal_tx(chan); return error; @@ -715,7 +713,7 @@ vmbus_chan_recv(struct vmbus_channel *ch struct vmbus_chanpkt_hdr pkt; int error, dlen, hlen; - error = hv_ring_buffer_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); + error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) return error; @@ -732,8 +730,8 @@ vmbus_chan_recv(struct vmbus_channel *ch *dlen0 = dlen; /* Skip packet header */ - error = hv_ring_buffer_read(&chan->ch_rxbr, data, dlen, hlen); - KASSERT(!error, ("hv_ring_buffer_read failed")); + error = vmbus_rxbr_read(&chan->ch_rxbr, data, dlen, hlen); + KASSERT(!error, ("vmbus_rxbr_read failed")); return 0; } @@ -745,7 +743,7 @@ vmbus_chan_recv_pkt(struct vmbus_channel struct vmbus_chanpkt_hdr pkt; int error, pktlen; - error = hv_ring_buffer_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); + error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) return error; @@ -758,8 +756,8 @@ vmbus_chan_recv_pkt(struct vmbus_channel *pktlen0 = pktlen; /* Include packet header */ - error = hv_ring_buffer_read(&chan->ch_rxbr, pkt0, pktlen, 0); - KASSERT(!error, ("hv_ring_buffer_read failed")); + error = vmbus_rxbr_read(&chan->ch_rxbr, pkt0, pktlen, 0); + KASSERT(!error, ("vmbus_rxbr_read failed")); return 0; } @@ -788,12 +786,12 @@ vmbus_chan_task(void *xchan, int pending cb(chan, cbarg); - left = hv_ring_buffer_read_end(&chan->ch_rxbr); + left = vmbus_rxbr_intr_unmask(&chan->ch_rxbr); if (left == 0) { /* No more data in RX bufring; done */ break; } - hv_ring_buffer_read_begin(&chan->ch_rxbr); + vmbus_rxbr_intr_mask(&chan->ch_rxbr); } } @@ -835,7 +833,7 @@ vmbus_event_flags_proc(struct vmbus_soft continue; if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) - hv_ring_buffer_read_begin(&chan->ch_rxbr); + vmbus_rxbr_intr_mask(&chan->ch_rxbr); taskqueue_enqueue(chan->ch_tq, &chan->ch_task); } } @@ -914,6 +912,8 @@ vmbus_chan_alloc(struct vmbus_softc *sc) mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); TAILQ_INIT(&chan->ch_subchans); TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); + vmbus_rxbr_init(&chan->ch_rxbr); + vmbus_txbr_init(&chan->ch_txbr); return chan; } @@ -926,6 +926,8 @@ vmbus_chan_free(struct vmbus_channel *ch /* TODO: asset no longer on the vmbus channel list */ hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); mtx_destroy(&chan->ch_subchan_lock); + vmbus_rxbr_deinit(&chan->ch_rxbr); + vmbus_txbr_deinit(&chan->ch_txbr); free(chan, M_DEVBUF); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Mon Oct 17 03:29:31 2016 (r307463) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Mon Oct 17 03:35:20 2016 (r307464) @@ -39,12 +39,7 @@ #include #include #include - -typedef struct { - struct vmbus_bufring *ring_buffer; - struct mtx ring_lock; - uint32_t ring_data_size; /* ring_size */ -} hv_vmbus_ring_buffer_info; +#include struct vmbus_channel { /* @@ -57,7 +52,7 @@ struct vmbus_channel { /* * RX bufring; immediately following ch_txbr. */ - hv_vmbus_ring_buffer_info ch_rxbr; + struct vmbus_rxbr ch_rxbr; struct taskqueue *ch_tq; struct task ch_task; @@ -76,7 +71,7 @@ struct vmbus_channel { * TX bufring and following MNF/evtflags do _not_ fit in * one 64B cacheline. */ - hv_vmbus_ring_buffer_info ch_txbr __aligned(CACHE_LINE_SIZE); + struct vmbus_txbr ch_txbr __aligned(CACHE_LINE_SIZE); uint32_t ch_txflags; /* VMBUS_CHAN_TXF_ */ /* From owner-svn-src-all@freebsd.org Mon Oct 17 03:42:13 2016 Return-Path: Delivered-To: svn-src-all@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 5382AC11097; Mon, 17 Oct 2016 03:42:13 +0000 (UTC) (envelope-from sephe@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 243971D80; Mon, 17 Oct 2016 03:42:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H3gC40022435; Mon, 17 Oct 2016 03:42:12 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H3gBLH022431; Mon, 17 Oct 2016 03:42:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170342.u9H3gBLH022431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:42: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: r307465 - in stable/11/sys: conf dev/hyperv/vmbus 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:42:13 -0000 Author: sephe Date: Mon Oct 17 03:42:11 2016 New Revision: 307465 URL: https://svnweb.freebsd.org/changeset/base/307465 Log: MFC 303379 hyperv/vmbus: Rename cleaned up bufring code Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7318 Added: stable/11/sys/dev/hyperv/vmbus/vmbus_br.c - copied unchanged from r303379, head/sys/dev/hyperv/vmbus/vmbus_br.c Deleted: stable/11/sys/dev/hyperv/vmbus/hv_ring_buffer.c Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 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 Mon Oct 17 03:35:20 2016 (r307464) +++ stable/11/sys/conf/files.amd64 Mon Oct 17 03:42:11 2016 (r307465) @@ -301,10 +301,10 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_ring_buffer.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_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Mon Oct 17 03:35:20 2016 (r307464) +++ stable/11/sys/conf/files.i386 Mon Oct 17 03:42:11 2016 (r307465) @@ -258,10 +258,10 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv dev/hyperv/utilities/hv_util.c optional hyperv -dev/hyperv/vmbus/hv_ring_buffer.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_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv Copied: stable/11/sys/dev/hyperv/vmbus/vmbus_br.c (from r303379, head/sys/dev/hyperv/vmbus/vmbus_br.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_br.c Mon Oct 17 03:42:11 2016 (r307465, copy of r303379, head/sys/dev/hyperv/vmbus/vmbus_br.c) @@ -0,0 +1,414 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include + +/* Amount of space available for write */ +#define VMBUS_BR_WAVAIL(r, w, z) \ + (((w) >= (r)) ? ((z) - ((w) - (r))) : ((r) - (w))) + +/* Increase bufing index */ +#define VMBUS_BR_IDXINC(idx, inc, sz) (((idx) + (inc)) % (sz)) + +static int +vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS) +{ + const struct vmbus_br *br = arg1; + uint32_t rindex, windex, imask, ravail, wavail; + char state[256]; + + rindex = br->vbr_rindex; + windex = br->vbr_windex; + imask = br->vbr_imask; + wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize); + ravail = br->vbr_dsize - wavail; + + snprintf(state, sizeof(state), + "rindex:%u windex:%u imask:%u ravail:%u wavail:%u", + rindex, windex, imask, ravail, wavail); + return sysctl_handle_string(oidp, state, sizeof(state), req); +} + +/* + * Binary bufring states. + */ +static int +vmbus_br_sysctl_state_bin(SYSCTL_HANDLER_ARGS) +{ +#define BR_STATE_RIDX 0 +#define BR_STATE_WIDX 1 +#define BR_STATE_IMSK 2 +#define BR_STATE_RSPC 3 +#define BR_STATE_WSPC 4 +#define BR_STATE_MAX 5 + + const struct vmbus_br *br = arg1; + uint32_t rindex, windex, wavail, state[BR_STATE_MAX]; + + rindex = br->vbr_rindex; + windex = br->vbr_windex; + wavail = VMBUS_BR_WAVAIL(rindex, windex, br->vbr_dsize); + + state[BR_STATE_RIDX] = rindex; + state[BR_STATE_WIDX] = windex; + state[BR_STATE_IMSK] = br->vbr_imask; + state[BR_STATE_WSPC] = wavail; + state[BR_STATE_RSPC] = br->vbr_dsize - wavail; + + return sysctl_handle_opaque(oidp, state, sizeof(state), req); +} + +void +vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, + struct vmbus_br *br, const char *name) +{ + struct sysctl_oid *tree; + char desc[64]; + + tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(br_tree), OID_AUTO, + name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (tree == NULL) + return; + + snprintf(desc, sizeof(desc), "%s state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state, "A", desc); + + snprintf(desc, sizeof(desc), "%s binary state", name); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "state_bin", + CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + br, 0, vmbus_br_sysctl_state_bin, "IU", desc); +} + +void +vmbus_rxbr_intr_mask(struct vmbus_rxbr *rbr) +{ + rbr->rxbr_imask = 1; + mb(); +} + +static __inline uint32_t +vmbus_rxbr_avail(const struct vmbus_rxbr *rbr) +{ + uint32_t rindex, windex; + + /* Get snapshot */ + rindex = rbr->rxbr_rindex; + windex = rbr->rxbr_windex; + + return (rbr->rxbr_dsize - + VMBUS_BR_WAVAIL(rindex, windex, rbr->rxbr_dsize)); +} + +uint32_t +vmbus_rxbr_intr_unmask(struct vmbus_rxbr *rbr) +{ + rbr->rxbr_imask = 0; + mb(); + + /* + * Now check to see if the ring buffer is still empty. + * If it is not, we raced and we need to process new + * incoming channel packets. + */ + return vmbus_rxbr_avail(rbr); +} + +static void +vmbus_br_setup(struct vmbus_br *br, void *buf, int blen) +{ + br->vbr = buf; + br->vbr_dsize = blen - sizeof(struct vmbus_bufring); +} + +void +vmbus_rxbr_init(struct vmbus_rxbr *rbr) +{ + mtx_init(&rbr->rxbr_lock, "vmbus_rxbr", NULL, MTX_SPIN); +} + +void +vmbus_rxbr_deinit(struct vmbus_rxbr *rbr) +{ + mtx_destroy(&rbr->rxbr_lock); +} + +void +vmbus_rxbr_setup(struct vmbus_rxbr *rbr, void *buf, int blen) +{ + vmbus_br_setup(&rbr->rxbr, buf, blen); +} + +void +vmbus_txbr_init(struct vmbus_txbr *tbr) +{ + mtx_init(&tbr->txbr_lock, "vmbus_txbr", NULL, MTX_SPIN); +} + +void +vmbus_txbr_deinit(struct vmbus_txbr *tbr) +{ + mtx_destroy(&tbr->txbr_lock); +} + +void +vmbus_txbr_setup(struct vmbus_txbr *tbr, void *buf, int blen) +{ + vmbus_br_setup(&tbr->txbr, buf, blen); +} + +/* + * When we write to the ring buffer, check if the host needs to be + * signaled. + * + * The contract: + * - The host guarantees that while it is draining the TX bufring, + * it will set the br_imask to indicate it does not need to be + * interrupted when new data are added. + * - The host guarantees that it will completely drain the TX bufring + * before exiting the read loop. Further, once the TX bufring is + * empty, it will clear the br_imask and re-check to see if new + * data have arrived. + */ +static __inline boolean_t +vmbus_txbr_need_signal(const struct vmbus_txbr *tbr, uint32_t old_windex) +{ + mb(); + if (tbr->txbr_imask) + return (FALSE); + + /* XXX only compiler fence is needed */ + /* Read memory barrier */ + rmb(); + + /* + * This is the only case we need to signal when the + * ring transitions from being empty to non-empty. + */ + if (old_windex == tbr->txbr_rindex) + return (TRUE); + + return (FALSE); +} + +static __inline uint32_t +vmbus_txbr_avail(const struct vmbus_txbr *tbr) +{ + uint32_t rindex, windex; + + /* Get snapshot */ + rindex = tbr->txbr_rindex; + windex = tbr->txbr_windex; + + return VMBUS_BR_WAVAIL(rindex, windex, tbr->txbr_dsize); +} + +static __inline uint32_t +vmbus_txbr_copyto(const struct vmbus_txbr *tbr, uint32_t windex, + const void *src0, uint32_t cplen) +{ + const uint8_t *src = src0; + uint8_t *br_data = tbr->txbr_data; + uint32_t br_dsize = tbr->txbr_dsize; + + if (cplen > br_dsize - windex) { + uint32_t fraglen = br_dsize - windex; + + /* Wrap-around detected */ + memcpy(br_data + windex, src, fraglen); + memcpy(br_data, src + fraglen, cplen - fraglen); + } else { + memcpy(br_data + windex, src, cplen); + } + return VMBUS_BR_IDXINC(windex, cplen, br_dsize); +} + +/* + * Write scattered channel packet to TX bufring. + * + * The offset of this channel packet is written as a 64bits value + * immediately after this channel packet. + */ +int +vmbus_txbr_write(struct vmbus_txbr *tbr, const struct iovec iov[], int iovlen, + boolean_t *need_sig) +{ + uint32_t old_windex, windex, total; + uint64_t save_windex; + int i; + + total = 0; + for (i = 0; i < iovlen; i++) + total += iov[i].iov_len; + total += sizeof(save_windex); + + mtx_lock_spin(&tbr->txbr_lock); + + /* + * NOTE: + * If this write is going to make br_windex same as br_rindex, + * i.e. the available space for write is same as the write size, + * we can't do it then, since br_windex == br_rindex means that + * the bufring is empty. + */ + if (vmbus_txbr_avail(tbr) <= total) { + mtx_unlock_spin(&tbr->txbr_lock); + return (EAGAIN); + } + + /* Save br_windex for later use */ + old_windex = tbr->txbr_windex; + + /* + * Copy the scattered channel packet to the TX bufring. + */ + windex = old_windex; + for (i = 0; i < iovlen; i++) { + windex = vmbus_txbr_copyto(tbr, windex, + iov[i].iov_base, iov[i].iov_len); + } + + /* + * Set the offset of the current channel packet. + */ + save_windex = ((uint64_t)old_windex) << 32; + windex = vmbus_txbr_copyto(tbr, windex, &save_windex, + sizeof(save_windex)); + + /* + * XXX only compiler fence is needed. + * Full memory barrier before upding the write index. + */ + mb(); + + /* + * Update the write index _after_ the channel packet + * is copied. + */ + tbr->txbr_windex = windex; + + mtx_unlock_spin(&tbr->txbr_lock); + + *need_sig = vmbus_txbr_need_signal(tbr, old_windex); + + return (0); +} + +static __inline uint32_t +vmbus_rxbr_copyfrom(const struct vmbus_rxbr *rbr, uint32_t rindex, + void *dst0, int cplen) +{ + uint8_t *dst = dst0; + const uint8_t *br_data = rbr->rxbr_data; + uint32_t br_dsize = rbr->rxbr_dsize; + + if (cplen > br_dsize - rindex) { + uint32_t fraglen = br_dsize - rindex; + + /* Wrap-around detected. */ + memcpy(dst, br_data + rindex, fraglen); + memcpy(dst + fraglen, br_data, cplen - fraglen); + } else { + memcpy(dst, br_data + rindex, cplen); + } + return VMBUS_BR_IDXINC(rindex, cplen, br_dsize); +} + +int +vmbus_rxbr_peek(struct vmbus_rxbr *rbr, void *data, int dlen) +{ + mtx_lock_spin(&rbr->rxbr_lock); + + /* + * The requested data and the 64bits channel packet + * offset should be there at least. + */ + if (vmbus_rxbr_avail(rbr) < dlen + sizeof(uint64_t)) { + mtx_unlock_spin(&rbr->rxbr_lock); + return (EAGAIN); + } + vmbus_rxbr_copyfrom(rbr, rbr->rxbr_rindex, data, dlen); + + mtx_unlock_spin(&rbr->rxbr_lock); + + return (0); +} + +/* + * NOTE: + * We assume (dlen + skip) == sizeof(channel packet). + */ +int +vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen, uint32_t skip) +{ + uint32_t rindex, br_dsize = rbr->rxbr_dsize; + + KASSERT(dlen + skip > 0, ("invalid dlen %d, offset %u", dlen, skip)); + + mtx_lock_spin(&rbr->rxbr_lock); + + if (vmbus_rxbr_avail(rbr) < dlen + skip + sizeof(uint64_t)) { + mtx_unlock_spin(&rbr->rxbr_lock); + return (EAGAIN); + } + + /* + * Copy channel packet from RX bufring. + */ + rindex = VMBUS_BR_IDXINC(rbr->rxbr_rindex, skip, br_dsize); + rindex = vmbus_rxbr_copyfrom(rbr, rindex, data, dlen); + + /* + * Discard this channel packet's 64bits offset, which is useless to us. + */ + rindex = VMBUS_BR_IDXINC(rindex, sizeof(uint64_t), br_dsize); + + /* + * XXX only compiler fence is needed. + * Make sure all reads are done before we update the read index since + * the writer may start writing to the read area once the read index + * is updated. + */ + wmb(); + + /* + * Update the read index _after_ the channel packet is fetched. + */ + rbr->rxbr_rindex = rindex; + + mtx_unlock_spin(&rbr->rxbr_lock); + + return (0); +} Modified: stable/11/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/11/sys/modules/hyperv/vmbus/Makefile Mon Oct 17 03:35:20 2016 (r307464) +++ stable/11/sys/modules/hyperv/vmbus/Makefile Mon Oct 17 03:42:11 2016 (r307465) @@ -4,11 +4,11 @@ ${.CURDIR}/../../../dev/hyperv/vmbus/${MACHINE_CPUARCH} KMOD= hv_vmbus -SRCS= hv_ring_buffer.c \ - hyperv.c \ +SRCS= hyperv.c \ hyperv_busdma.c \ hyperv_machdep.c \ vmbus.c \ + vmbus_br.c \ vmbus_chan.c \ vmbus_et.c SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h vmbus_if.h From owner-svn-src-all@freebsd.org Mon Oct 17 03:48:24 2016 Return-Path: Delivered-To: svn-src-all@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 E52A8C111B3; Mon, 17 Oct 2016 03:48:24 +0000 (UTC) (envelope-from sephe@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 B113A10A1; Mon, 17 Oct 2016 03:48:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H3mNP3025019; Mon, 17 Oct 2016 03:48:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H3mMh9025003; Mon, 17 Oct 2016 03:48:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170348.u9H3mMh9025003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:48: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: r307466 - in stable/11/sys/dev/hyperv: include netvsc storvsc utilities 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:48:25 -0000 Author: sephe Date: Mon Oct 17 03:48:22 2016 New Revision: 307466 URL: https://svnweb.freebsd.org/changeset/base/307466 Log: MFC 303421,303422,303470-303473 303421 hyperv/vmbus: Avoid unnecessary mb() Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7333 303422 hyperv/vmbus: Inclusion cleanup Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7334 303470 hyperv/vmbus: Reindent function declarations. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7344 303471 hyperv/vmbus: Forward declare static functions Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7346 303472 hyperv/vmbus: Move driver glue to the beginning of the files Just as most of other drivers do. And move sysinit function close to its SYSINIT. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7347 303473 hyperv/vmbus: Revoke unnecessary exposure of vmbus softc Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7348 Modified: stable/11/sys/dev/hyperv/include/hyperv.h stable/11/sys/dev/hyperv/include/hyperv_busdma.h stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/vmbus/hyperv.c stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_br.c stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_et.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/hyperv.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/include/hyperv.h Mon Oct 17 03:48:22 2016 (r307466) @@ -28,43 +28,21 @@ * $FreeBSD$ */ -/** - * HyperV definitions for messages that are sent between instances of the - * Channel Management Library in separate partitions, or in some cases, - * back to itself. - */ - -#ifndef __HYPERV_H__ -#define __HYPERV_H__ +#ifndef _HYPERV_H_ +#define _HYPERV_H_ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include -#include #include -#include -#include -#include - struct hyperv_guid { uint8_t hv_guid[16]; } __packed; #define HYPERV_GUID_STRLEN 40 -int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); +int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); /** * @brief Get physical address from virtual @@ -77,4 +55,4 @@ hv_get_phys_addr(void *virt) return (ret); } -#endif /* __HYPERV_H__ */ +#endif /* _HYPERV_H_ */ Modified: stable/11/sys/dev/hyperv/include/hyperv_busdma.h ============================================================================== --- stable/11/sys/dev/hyperv/include/hyperv_busdma.h Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/include/hyperv_busdma.h Mon Oct 17 03:48:22 2016 (r307466) @@ -39,11 +39,11 @@ struct hyperv_dma { bus_dmamap_t hv_dmap; }; -void hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, int nseg, - int error); -void *hyperv_dmamem_alloc(bus_dma_tag_t parent_dtag, bus_size_t alignment, - bus_addr_t boundary, bus_size_t size, struct hyperv_dma *dma, - int flags); -void hyperv_dmamem_free(struct hyperv_dma *dma, void *ptr); +void hyperv_dma_map_paddr(void *arg, bus_dma_segment_t *segs, + int nseg, int error); +void *hyperv_dmamem_alloc(bus_dma_tag_t parent_dtag, + bus_size_t alignment, bus_addr_t boundary, bus_size_t size, + struct hyperv_dma *dma, int flags); +void hyperv_dmamem_free(struct hyperv_dma *dma, void *ptr); #endif /* !_HYPERV_BUSDMA_H_ */ Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 03:48:22 2016 (r307466) @@ -30,6 +30,7 @@ #define _VMBUS_H_ #include +#include /* * VMBUS version is 32 bit, upper 16 bit for major_number and lower @@ -115,45 +116,47 @@ vmbus_get_channel(device_t dev) return device_get_ivars(dev); } -int vmbus_chan_open(struct vmbus_channel *chan, - int txbr_size, int rxbr_size, const void *udata, int udlen, - vmbus_chan_callback_t cb, void *cbarg); -void vmbus_chan_close(struct vmbus_channel *chan); - -int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, - bus_addr_t paddr, int size, uint32_t *gpadl); -int vmbus_chan_gpadl_disconnect(struct vmbus_channel *chan, - uint32_t gpadl); +int vmbus_chan_open(struct vmbus_channel *chan, + int txbr_size, int rxbr_size, const void *udata, int udlen, + vmbus_chan_callback_t cb, void *cbarg); +void vmbus_chan_close(struct vmbus_channel *chan); + +int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, + bus_addr_t paddr, int size, uint32_t *gpadl); +int vmbus_chan_gpadl_disconnect(struct vmbus_channel *chan, + uint32_t gpadl); -void vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu); -void vmbus_chan_cpu_rr(struct vmbus_channel *chan); +void vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu); +void vmbus_chan_cpu_rr(struct vmbus_channel *chan); struct vmbus_channel * - vmbus_chan_cpu2chan(struct vmbus_channel *chan, int cpu); -void vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on); + vmbus_chan_cpu2chan(struct vmbus_channel *chan, int cpu); +void vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on); struct vmbus_channel ** - vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt); -void vmbus_subchan_rel(struct vmbus_channel **subchan, int subchan_cnt); -void vmbus_subchan_drain(struct vmbus_channel *pri_chan); - -int vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen, - uint64_t *xactid); -int vmbus_chan_recv_pkt(struct vmbus_channel *chan, - struct vmbus_chanpkt_hdr *pkt, int *pktlen); - -int vmbus_chan_send(struct vmbus_channel *chan, uint16_t type, - uint16_t flags, void *data, int dlen, uint64_t xactid); -int vmbus_chan_send_sglist(struct vmbus_channel *chan, - struct vmbus_gpa sg[], int sglen, void *data, int dlen, - uint64_t xactid); -int vmbus_chan_send_prplist(struct vmbus_channel *chan, - struct vmbus_gpa_range *prp, int prp_cnt, void *data, int dlen, - uint64_t xactid); - -uint32_t vmbus_chan_id(const struct vmbus_channel *chan); -uint32_t vmbus_chan_subidx(const struct vmbus_channel *chan); -bool vmbus_chan_is_primary(const struct vmbus_channel *chan); + vmbus_subchan_get(struct vmbus_channel *pri_chan, + int subchan_cnt); +void vmbus_subchan_rel(struct vmbus_channel **subchan, + int subchan_cnt); +void vmbus_subchan_drain(struct vmbus_channel *pri_chan); + +int vmbus_chan_recv(struct vmbus_channel *chan, void *data, int *dlen, + uint64_t *xactid); +int vmbus_chan_recv_pkt(struct vmbus_channel *chan, + struct vmbus_chanpkt_hdr *pkt, int *pktlen); + +int vmbus_chan_send(struct vmbus_channel *chan, uint16_t type, + uint16_t flags, void *data, int dlen, uint64_t xactid); +int vmbus_chan_send_sglist(struct vmbus_channel *chan, + struct vmbus_gpa sg[], int sglen, void *data, int dlen, + uint64_t xactid); +int vmbus_chan_send_prplist(struct vmbus_channel *chan, + struct vmbus_gpa_range *prp, int prp_cnt, void *data, + int dlen, uint64_t xactid); + +uint32_t vmbus_chan_id(const struct vmbus_channel *chan); +uint32_t vmbus_chan_subidx(const struct vmbus_channel *chan); +bool vmbus_chan_is_primary(const struct vmbus_channel *chan); const struct hyperv_guid * - vmbus_chan_guid_inst(const struct vmbus_channel *chan); + vmbus_chan_guid_inst(const struct vmbus_channel *chan); #endif /* !_VMBUS_H_ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 03:48:22 2016 (r307466) @@ -44,6 +44,7 @@ #include #include #include +#include #include #include Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 03:48:22 2016 (r307466) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 03:48:22 2016 (r307466) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 03:48:22 2016 (r307466) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 03:48:22 2016 (r307466) @@ -38,6 +38,7 @@ #include #include #include +#include #include #include Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 03:48:22 2016 (r307466) @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include Modified: stable/11/sys/dev/hyperv/vmbus/hyperv.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/hyperv.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/vmbus/hyperv.c Mon Oct 17 03:48:22 2016 (r307466) @@ -34,23 +34,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include #include -#include -#include -#include -#include -#include #include #include #include #include #include -#if 0 -#include -#endif #define HYPERV_FREEBSD_BUILD 0ULL #define HYPERV_FREEBSD_VERSION ((uint64_t)__FreeBSD_version) @@ -76,13 +67,15 @@ struct hypercall_ctx { struct hyperv_dma hc_dma; }; -static u_int hyperv_get_timecount(struct timecounter *tc); +static u_int hyperv_get_timecount(struct timecounter *); +static bool hyperv_identify(void); +static void hypercall_memfree(void); -u_int hyperv_features; -u_int hyperv_recommends; +u_int hyperv_features; +u_int hyperv_recommends; -static u_int hyperv_pm_features; -static u_int hyperv_features3; +static u_int hyperv_pm_features; +static u_int hyperv_features3; static struct timecounter hyperv_timecounter = { .tc_get_timecount = hyperv_get_timecount, Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Oct 17 03:48:22 2016 (r307466) @@ -38,26 +38,16 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include +#include #include -#include #include -#include -#include -#include #include -#include -#include -#include -#include - -#include #include -#include -#include -#include -#include +#include + +#include #include #include @@ -66,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include "acpi_if.h" #include "vmbus_if.h" @@ -92,6 +81,17 @@ struct vmbus_msghc_ctx { #define VMBUS_MSGHC_CTXF_DESTROY 0x0001 +static int vmbus_probe(device_t); +static int vmbus_attach(device_t); +static int vmbus_detach(device_t); +static int vmbus_read_ivar(device_t, device_t, int, + uintptr_t *); +static int vmbus_child_pnpinfo_str(device_t, device_t, + char *, size_t); +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 int vmbus_init(struct vmbus_softc *); static int vmbus_connect(struct vmbus_softc *, uint32_t); static int vmbus_req_channels(struct vmbus_softc *sc); @@ -104,8 +104,17 @@ static void vmbus_scan_done(struct vmb const struct vmbus_message *); static void vmbus_chanmsg_handle(struct vmbus_softc *, const struct vmbus_message *); - +static void vmbus_msg_task(void *, int); +static void vmbus_synic_setup(void *); +static void vmbus_synic_teardown(void *); static int vmbus_sysctl_version(SYSCTL_HANDLER_ARGS); +static int vmbus_dma_alloc(struct vmbus_softc *); +static void vmbus_dma_free(struct vmbus_softc *); +static int vmbus_intr_setup(struct vmbus_softc *); +static void vmbus_intr_teardown(struct vmbus_softc *); +static int vmbus_doattach(struct vmbus_softc *); +static void vmbus_event_proc_dummy(struct vmbus_softc *, + int); static struct vmbus_msghc_ctx *vmbus_msghc_ctx_create(bus_dma_tag_t); static void vmbus_msghc_ctx_destroy( @@ -116,7 +125,7 @@ static void vmbus_msghc_free(struct vm static struct vmbus_msghc *vmbus_msghc_get1(struct vmbus_msghc_ctx *, uint32_t); -struct vmbus_softc *vmbus_sc; +static struct vmbus_softc *vmbus_sc; extern inthand_t IDTVEC(vmbus_isr); @@ -133,6 +142,46 @@ vmbus_chanmsg_handlers[VMBUS_CHANMSG_TYP VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) }; +static device_method_t vmbus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_probe), + DEVMETHOD(device_attach, vmbus_attach), + DEVMETHOD(device_detach, vmbus_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_read_ivar, vmbus_read_ivar), + DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), + + /* Vmbus interface */ + DEVMETHOD(vmbus_get_version, vmbus_get_version_method), + DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method), + + DEVMETHOD_END +}; + +static driver_t vmbus_driver = { + "vmbus", + vmbus_methods, + sizeof(struct vmbus_softc) +}; + +static devclass_t vmbus_devclass; + +DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); +MODULE_DEPEND(vmbus, acpi, 1, 1, 1); +MODULE_VERSION(vmbus, 1); + +static __inline struct vmbus_softc * +vmbus_get_softc(void) +{ + return vmbus_sc; +} + static struct vmbus_msghc * vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) { @@ -1239,26 +1288,6 @@ vmbus_attach(device_t dev) return (0); } -static void -vmbus_sysinit(void *arg __unused) -{ - struct vmbus_softc *sc = vmbus_get_softc(); - - if (vm_guest != VM_GUEST_HV || sc == NULL) - return; - -#ifndef EARLY_AP_STARTUP - /* - * If the system has already booted and thread - * scheduling is possible, as indicated by the - * global cold set to zero, we just call the driver - * initialization directly. - */ - if (!cold) -#endif - vmbus_doattach(sc); -} - static int vmbus_detach(device_t dev) { @@ -1288,45 +1317,30 @@ vmbus_detach(device_t dev) return (0); } -static device_method_t vmbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, vmbus_probe), - DEVMETHOD(device_attach, vmbus_attach), - DEVMETHOD(device_detach, vmbus_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, vmbus_read_ivar), - DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), - - /* Vmbus interface */ - DEVMETHOD(vmbus_get_version, vmbus_get_version_method), - DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method), - - DEVMETHOD_END -}; - -static driver_t vmbus_driver = { - "vmbus", - vmbus_methods, - sizeof(struct vmbus_softc) -}; +#ifndef EARLY_AP_STARTUP -static devclass_t vmbus_devclass; +static void +vmbus_sysinit(void *arg __unused) +{ + struct vmbus_softc *sc = vmbus_get_softc(); -DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); -MODULE_DEPEND(vmbus, acpi, 1, 1, 1); -MODULE_VERSION(vmbus, 1); + if (vm_guest != VM_GUEST_HV || sc == NULL) + return; -#ifndef EARLY_AP_STARTUP + /* + * If the system has already booted and thread + * scheduling is possible, as indicated by the + * global cold set to zero, we just call the driver + * initialization directly. + */ + if (!cold) + vmbus_doattach(sc); +} /* * NOTE: * We have to start as the last step of SI_SUB_SMP, i.e. after SMP is * initialized. */ SYSINIT(vmbus_initialize, SI_SUB_SMP, SI_ORDER_ANY, vmbus_sysinit, NULL); -#endif + +#endif /* !EARLY_AP_STARTUP */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_br.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_br.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_br.c Mon Oct 17 03:48:22 2016 (r307466) @@ -41,6 +41,10 @@ /* Increase bufing index */ #define VMBUS_BR_IDXINC(idx, inc, sz) (((idx) + (inc)) % (sz)) +static int vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS); +static int vmbus_br_sysctl_state_bin(SYSCTL_HANDLER_ARGS); +static void vmbus_br_setup(struct vmbus_br *, void *, int); + static int vmbus_br_sysctl_state(SYSCTL_HANDLER_ARGS) { @@ -209,9 +213,7 @@ vmbus_txbr_need_signal(const struct vmbu if (tbr->txbr_imask) return (FALSE); - /* XXX only compiler fence is needed */ - /* Read memory barrier */ - rmb(); + __compiler_membar(); /* * This is the only case we need to signal when the @@ -308,15 +310,10 @@ vmbus_txbr_write(struct vmbus_txbr *tbr, sizeof(save_windex)); /* - * XXX only compiler fence is needed. - * Full memory barrier before upding the write index. - */ - mb(); - - /* * Update the write index _after_ the channel packet * is copied. */ + __compiler_membar(); tbr->txbr_windex = windex; mtx_unlock_spin(&tbr->txbr_lock); @@ -396,16 +393,9 @@ vmbus_rxbr_read(struct vmbus_rxbr *rbr, rindex = VMBUS_BR_IDXINC(rindex, sizeof(uint64_t), br_dsize); /* - * XXX only compiler fence is needed. - * Make sure all reads are done before we update the read index since - * the writer may start writing to the read area once the read index - * is updated. - */ - wmb(); - - /* * Update the read index _after_ the channel packet is fetched. */ + __compiler_membar(); rbr->rxbr_rindex = rindex; mtx_unlock_spin(&rbr->rxbr_lock); Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 03:48:22 2016 (r307466) @@ -31,19 +31,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include #include +#include #include +#include #include +#include #include -#include - -#include -#include -#include #include #include @@ -52,17 +47,28 @@ __FBSDID("$FreeBSD$"); #include #include -static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, - const struct vmbus_channel *); - -static void vmbus_chan_task(void *, int); -static void vmbus_chan_task_nobatch(void *, int); -static void vmbus_chan_detach_task(void *, int); - -static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, - const struct vmbus_message *); -static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *, - const struct vmbus_message *); +static void vmbus_chan_update_evtflagcnt( + struct vmbus_softc *, + const struct vmbus_channel *); +static void vmbus_chan_close_internal( + struct vmbus_channel *); +static int vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS); +static void vmbus_chan_sysctl_create( + struct vmbus_channel *); +static struct vmbus_channel *vmbus_chan_alloc(struct vmbus_softc *); +static void vmbus_chan_free(struct vmbus_channel *); +static int vmbus_chan_add(struct vmbus_channel *); +static void vmbus_chan_cpu_default(struct vmbus_channel *); + +static void vmbus_chan_task(void *, int); +static void vmbus_chan_task_nobatch(void *, int); +static void vmbus_chan_detach_task(void *, int); + +static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, + const struct vmbus_message *); +static void vmbus_chan_msgproc_chrescind( + struct vmbus_softc *, + const struct vmbus_message *); /* * Vmbus channel message processing. Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Mon Oct 17 03:48:22 2016 (r307466) @@ -155,9 +155,10 @@ struct vmbus_channel { struct vmbus_softc; struct vmbus_message; -void vmbus_event_proc(struct vmbus_softc *, int); -void vmbus_event_proc_compat(struct vmbus_softc *, int); -void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *); -void vmbus_chan_destroy_all(struct vmbus_softc *); +void vmbus_event_proc(struct vmbus_softc *, int); +void vmbus_event_proc_compat(struct vmbus_softc *, int); +void vmbus_chan_msgproc(struct vmbus_softc *, + const struct vmbus_message *); +void vmbus_chan_destroy_all(struct vmbus_softc *); #endif /* !_VMBUS_CHANVAR_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_et.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_et.c Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_et.c Mon Oct 17 03:48:22 2016 (r307466) @@ -32,9 +32,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include +#include #include #include @@ -57,8 +56,35 @@ __FBSDID("$FreeBSD$"); CPUID_HV_MSR_SYNIC | \ CPUID_HV_MSR_SYNTIMER) +static void vmbus_et_identify(driver_t *, device_t); +static int vmbus_et_probe(device_t); +static int vmbus_et_attach(device_t); +static int vmbus_et_detach(device_t); +static int vmbus_et_start(struct eventtimer *, sbintime_t, + sbintime_t); + static struct eventtimer vmbus_et; +static device_method_t vmbus_et_methods[] = { + DEVMETHOD(device_identify, vmbus_et_identify), + DEVMETHOD(device_probe, vmbus_et_probe), + DEVMETHOD(device_attach, vmbus_et_attach), + DEVMETHOD(device_detach, vmbus_et_detach), + + DEVMETHOD_END +}; + +static driver_t vmbus_et_driver = { + VMBUS_ET_NAME, + vmbus_et_methods, + 0 +}; + +static devclass_t vmbus_et_devclass; + +DRIVER_MODULE(hv_et, vmbus, vmbus_et_driver, vmbus_et_devclass, NULL, NULL); +MODULE_VERSION(hv_et, 1); + static __inline uint64_t hyperv_sbintime2count(sbintime_t time) { @@ -175,22 +201,3 @@ vmbus_et_detach(device_t dev) { return (et_deregister(&vmbus_et)); } - -static device_method_t vmbus_et_methods[] = { - DEVMETHOD(device_identify, vmbus_et_identify), - DEVMETHOD(device_probe, vmbus_et_probe), - DEVMETHOD(device_attach, vmbus_et_attach), - DEVMETHOD(device_detach, vmbus_et_detach), - - DEVMETHOD_END -}; - -static driver_t vmbus_et_driver = { - VMBUS_ET_NAME, - vmbus_et_methods, - 0 -}; - -static devclass_t vmbus_et_devclass; -DRIVER_MODULE(hv_et, vmbus, vmbus_et_driver, vmbus_et_devclass, NULL, NULL); -MODULE_VERSION(hv_et, 1); Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 03:42:11 2016 (r307465) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Oct 17 03:48:22 2016 (r307466) @@ -30,7 +30,6 @@ #define _VMBUS_VAR_H_ #include -#include #include #include @@ -121,20 +120,6 @@ struct vmbus_softc { #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ #define VMBUS_FLAG_SYNIC 0x0002 /* SynIC was setup */ -extern struct vmbus_softc *vmbus_sc; - -static __inline struct vmbus_softc * -vmbus_get_softc(void) -{ - return vmbus_sc; -} - -static __inline device_t -vmbus_get_device(void) -{ - return vmbus_sc->vmbus_dev; -} - #define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field @@ -143,20 +128,23 @@ struct trapframe; struct vmbus_message; struct vmbus_msghc; -void vmbus_handle_intr(struct trapframe *); -int vmbus_add_child(struct vmbus_channel *); -int vmbus_delete_child(struct vmbus_channel *); -void vmbus_et_intr(struct trapframe *); -uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); - -struct vmbus_msghc *vmbus_msghc_get(struct vmbus_softc *, size_t); -void vmbus_msghc_put(struct vmbus_softc *, struct vmbus_msghc *); -void *vmbus_msghc_dataptr(struct vmbus_msghc *); -int vmbus_msghc_exec_noresult(struct vmbus_msghc *); -int vmbus_msghc_exec(struct vmbus_softc *, struct vmbus_msghc *); -const struct vmbus_message *vmbus_msghc_wait_result(struct vmbus_softc *, - struct vmbus_msghc *); -void vmbus_msghc_wakeup(struct vmbus_softc *, const struct vmbus_message *); -void vmbus_msghc_reset(struct vmbus_msghc *, size_t); +void vmbus_handle_intr(struct trapframe *); +int vmbus_add_child(struct vmbus_channel *); +int vmbus_delete_child(struct vmbus_channel *); +void vmbus_et_intr(struct trapframe *); +uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); + +struct vmbus_msghc * + vmbus_msghc_get(struct vmbus_softc *, size_t); +void vmbus_msghc_put(struct vmbus_softc *, struct vmbus_msghc *); +void *vmbus_msghc_dataptr(struct vmbus_msghc *); +int vmbus_msghc_exec_noresult(struct vmbus_msghc *); +int vmbus_msghc_exec(struct vmbus_softc *, struct vmbus_msghc *); +const struct vmbus_message * + vmbus_msghc_wait_result(struct vmbus_softc *, + struct vmbus_msghc *); +void vmbus_msghc_wakeup(struct vmbus_softc *, + const struct vmbus_message *); +void vmbus_msghc_reset(struct vmbus_msghc *, size_t); #endif /* !_VMBUS_VAR_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 03:51:57 2016 Return-Path: Delivered-To: svn-src-all@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 96D0DC114C1; Mon, 17 Oct 2016 03:51:57 +0000 (UTC) (envelope-from sephe@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 653F21505; Mon, 17 Oct 2016 03:51:57 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H3pu0E028691; Mon, 17 Oct 2016 03:51:56 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H3pu63028690; Mon, 17 Oct 2016 03:51:56 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170351.u9H3pu63028690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 03:51: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: r307467 - stable/11/sys/dev/hyperv/storvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 03:51:57 -0000 Author: sephe Date: Mon Oct 17 03:51:56 2016 New Revision: 307467 URL: https://svnweb.freebsd.org/changeset/base/307467 Log: MFC 303474 hyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default. The UNMAPPED I/O greatly improves userland direct disk I/O performance by 35% ~ 135%. Submitted by: Hongjiang Zhang Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7195 Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 03:48:22 2016 (r307466) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 03:51:56 2016 (r307467) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -87,7 +88,10 @@ __FBSDID("$FreeBSD$"); #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) -#define HV_ALIGN(x, a) roundup2(x, a) +#define STORVSC_DATA_SEGCNT_MAX VMBUS_CHAN_PRPLIST_MAX +#define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE +#define STORVSC_DATA_SIZE_MAX \ + (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) struct storvsc_softc; @@ -102,7 +106,7 @@ struct hv_sgl_page_pool{ boolean_t is_init; } g_hv_sgl_page_pool; -#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * VMBUS_CHAN_PRPLIST_MAX +#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * STORVSC_DATA_SEGCNT_MAX enum storvsc_request_type { WRITE_TYPE, @@ -110,26 +114,41 @@ enum storvsc_request_type { UNKNOWN_TYPE }; -struct hvs_gpa_range { +SYSCTL_NODE(_hw, OID_AUTO, storvsc, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, + "Hyper-V storage interface"); + +static u_int hv_storvsc_use_pim_unmapped = 1; +SYSCTL_INT(_hw_storvsc, OID_AUTO, use_pim_unmapped, CTLFLAG_RDTUN, + &hv_storvsc_use_pim_unmapped, 0, + "Optimize storvsc by using unmapped I/O"); + +struct hv_storvsc_sysctl { + u_long data_bio_cnt; + u_long data_vaddr_cnt; + u_long data_sg_cnt; +}; + +struct storvsc_gpa_range { struct vmbus_gpa_range gpa_range; - uint64_t gpa_page[VMBUS_CHAN_PRPLIST_MAX]; + uint64_t gpa_page[STORVSC_DATA_SEGCNT_MAX]; } __packed; struct hv_storvsc_request { - LIST_ENTRY(hv_storvsc_request) link; - struct vstor_packet vstor_packet; - int prp_cnt; - struct hvs_gpa_range prp_list; - void *sense_data; - uint8_t sense_info_len; - uint8_t retries; - union ccb *ccb; - struct storvsc_softc *softc; - struct callout callout; - struct sema synch_sema; /*Synchronize the request/response if needed */ - struct sglist *bounce_sgl; - unsigned int bounce_sgl_count; - uint64_t not_aligned_seg_bits; + LIST_ENTRY(hv_storvsc_request) link; + struct vstor_packet vstor_packet; + int prp_cnt; + struct storvsc_gpa_range prp_list; + void *sense_data; + uint8_t sense_info_len; + uint8_t retries; + union ccb *ccb; + struct storvsc_softc *softc; + struct callout callout; + struct sema synch_sema; /*Synchronize the request/response if needed */ + struct sglist *bounce_sgl; + unsigned int bounce_sgl_count; + uint64_t not_aligned_seg_bits; + bus_dmamap_t data_dmap; }; struct storvsc_softc { @@ -148,6 +167,8 @@ struct storvsc_softc { struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; device_t hs_dev; + bus_dma_tag_t storvsc_req_dtag; + struct hv_storvsc_sysctl sysctl_data; struct vmbus_channel *hs_cpu2chan[MAXCPU]; }; @@ -884,6 +905,77 @@ storvsc_create_cpu2chan(struct storvsc_s } } +static int +storvsc_init_requests(device_t dev) +{ + struct storvsc_softc *sc = device_get_softc(dev); + struct hv_storvsc_request *reqp; + int error, i; + + LIST_INIT(&sc->hs_free_list); + + error = bus_dma_tag_create( + bus_get_dma_tag(dev), /* parent */ + 1, /* alignment */ + PAGE_SIZE, /* boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + STORVSC_DATA_SIZE_MAX, /* maxsize */ + STORVSC_DATA_SEGCNT_MAX, /* nsegments */ + STORVSC_DATA_SEGSZ_MAX, /* maxsegsize */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &sc->storvsc_req_dtag); + if (error) { + device_printf(dev, "failed to create storvsc dma tag\n"); + return (error); + } + + for (i = 0; i < sc->hs_drv_props->drv_max_ios_per_target; ++i) { + reqp = malloc(sizeof(struct hv_storvsc_request), + M_DEVBUF, M_WAITOK|M_ZERO); + reqp->softc = sc; + error = bus_dmamap_create(sc->storvsc_req_dtag, 0, + &reqp->data_dmap); + if (error) { + device_printf(dev, "failed to allocate storvsc " + "data dmamap\n"); + goto cleanup; + } + LIST_INSERT_HEAD(&sc->hs_free_list, reqp, link); + } + return (0); + +cleanup: + while ((reqp = LIST_FIRST(&sc->hs_free_list)) != NULL) { + LIST_REMOVE(reqp, link); + bus_dmamap_destroy(sc->storvsc_req_dtag, reqp->data_dmap); + free(reqp, M_DEVBUF); + } + return (error); +} + +static void +storvsc_sysctl(device_t dev) +{ + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; + struct storvsc_softc *sc; + + sc = device_get_softc(dev); + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "data_bio_cnt", CTLFLAG_RW, + &sc->sysctl_data.data_bio_cnt, "# of bio data block"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "data_vaddr_cnt", CTLFLAG_RW, + &sc->sysctl_data.data_vaddr_cnt, "# of vaddr data block"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "data_sg_cnt", CTLFLAG_RW, + &sc->sysctl_data.data_sg_cnt, "# of sg data block"); +} + /** * @brief StorVSC attach function * @@ -928,16 +1020,11 @@ storvsc_attach(device_t dev) sc->hs_unit = device_get_unit(dev); sc->hs_dev = dev; - LIST_INIT(&sc->hs_free_list); mtx_init(&sc->hs_lock, "hvslck", NULL, MTX_DEF); - for (i = 0; i < sc->hs_drv_props->drv_max_ios_per_target; ++i) { - reqp = malloc(sizeof(struct hv_storvsc_request), - M_DEVBUF, M_WAITOK|M_ZERO); - reqp->softc = sc; - - LIST_INSERT_HEAD(&sc->hs_free_list, reqp, link); - } + ret = storvsc_init_requests(dev); + if (ret != 0) + goto cleanup; /* create sg-list page pool */ if (FALSE == g_hv_sgl_page_pool.is_init) { @@ -947,7 +1034,7 @@ storvsc_attach(device_t dev) /* * Pre-create SG list, each SG list with - * VMBUS_CHAN_PRPLIST_MAX segments, each + * STORVSC_DATA_SEGCNT_MAX segments, each * segment has one page buffer */ for (i = 0; i < STORVSC_MAX_IO_REQUESTS; i++) { @@ -955,10 +1042,10 @@ storvsc_attach(device_t dev) M_DEVBUF, M_WAITOK|M_ZERO); sgl_node->sgl_data = - sglist_alloc(VMBUS_CHAN_PRPLIST_MAX, + sglist_alloc(STORVSC_DATA_SEGCNT_MAX, M_WAITOK|M_ZERO); - for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++) { + for (j = 0; j < STORVSC_DATA_SEGCNT_MAX; j++) { tmp_buff = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK|M_ZERO); @@ -1033,6 +1120,8 @@ storvsc_attach(device_t dev) mtx_unlock(&sc->hs_lock); + storvsc_sysctl(dev); + root_mount_rel(root_mount_token); return (0); @@ -1042,13 +1131,14 @@ cleanup: while (!LIST_EMPTY(&sc->hs_free_list)) { reqp = LIST_FIRST(&sc->hs_free_list); LIST_REMOVE(reqp, link); + bus_dmamap_destroy(sc->storvsc_req_dtag, reqp->data_dmap); free(reqp, M_DEVBUF); } while (!LIST_EMPTY(&g_hv_sgl_page_pool.free_sgl_list)) { sgl_node = LIST_FIRST(&g_hv_sgl_page_pool.free_sgl_list); LIST_REMOVE(sgl_node, link); - for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++) { + for (j = 0; j < STORVSC_DATA_SEGCNT_MAX; j++) { if (NULL != (void*)sgl_node->sgl_data->sg_segs[j].ss_paddr) { free((void*)sgl_node->sgl_data->sg_segs[j].ss_paddr, M_DEVBUF); @@ -1103,7 +1193,7 @@ storvsc_detach(device_t dev) while (!LIST_EMPTY(&sc->hs_free_list)) { reqp = LIST_FIRST(&sc->hs_free_list); LIST_REMOVE(reqp, link); - + bus_dmamap_destroy(sc->storvsc_req_dtag, reqp->data_dmap); free(reqp, M_DEVBUF); } mtx_unlock(&sc->hs_lock); @@ -1111,7 +1201,7 @@ storvsc_detach(device_t dev) while (!LIST_EMPTY(&g_hv_sgl_page_pool.free_sgl_list)) { sgl_node = LIST_FIRST(&g_hv_sgl_page_pool.free_sgl_list); LIST_REMOVE(sgl_node, link); - for (j = 0; j < VMBUS_CHAN_PRPLIST_MAX; j++){ + for (j = 0; j < STORVSC_DATA_SEGCNT_MAX; j++){ if (NULL != (void*)sgl_node->sgl_data->sg_segs[j].ss_paddr) { free((void*)sgl_node->sgl_data->sg_segs[j].ss_paddr, M_DEVBUF); @@ -1296,6 +1386,8 @@ storvsc_action(struct cam_sim *sim, unio cpi->hba_inquiry = PI_TAG_ABLE|PI_SDTR_ABLE; cpi->target_sprt = 0; cpi->hba_misc = PIM_NOBUSRESET; + if (hv_storvsc_use_pim_unmapped) + cpi->hba_misc |= PIM_UNMAPPED; cpi->hba_eng_cnt = 0; cpi->max_target = STORVSC_MAX_TARGETS; cpi->max_lun = sc->hs_drv_props->drv_max_luns_per_target; @@ -1370,6 +1462,7 @@ storvsc_action(struct cam_sim *sim, unio case XPT_SCSI_IO: case XPT_IMMED_NOTIFY: { struct hv_storvsc_request *reqp = NULL; + bus_dmamap_t dmap_saved; if (ccb->csio.cdb_len == 0) { panic("cdl_len is 0\n"); @@ -1388,7 +1481,14 @@ storvsc_action(struct cam_sim *sim, unio reqp = LIST_FIRST(&sc->hs_free_list); LIST_REMOVE(reqp, link); + /* Save the data_dmap before reset request */ + dmap_saved = reqp->data_dmap; + + /* XXX this is ugly */ bzero(reqp, sizeof(struct hv_storvsc_request)); + + /* Restore necessary bits */ + reqp->data_dmap = dmap_saved; reqp->softc = sc; ccb->ccb_h.status |= CAM_SIM_QUEUED; @@ -1644,6 +1744,35 @@ storvsc_check_bounce_buffer_sgl(bus_dma_ } /** + * Copy bus_dma segments to multiple page buffer, which requires + * the pages are compact composed except for the 1st and last pages. + */ +static void +storvsc_xferbuf_prepare(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct hv_storvsc_request *reqp = arg; + union ccb *ccb = reqp->ccb; + struct ccb_scsiio *csio = &ccb->csio; + struct storvsc_gpa_range *prplist; + int i; + + prplist = &reqp->prp_list; + prplist->gpa_range.gpa_len = csio->dxfer_len; + prplist->gpa_range.gpa_ofs = segs[0].ds_addr & PAGE_MASK; + + for (i = 0; i < nsegs; i++) { + prplist->gpa_page[i] = atop(segs[i].ds_addr); +#ifdef INVARIANTS + if (i != 0 && i != nsegs - 1) { + KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && + segs[i].ds_len == PAGE_SIZE, ("not a full page")); + } +#endif + } + reqp->prp_cnt = nsegs; +} + +/** * @brief Fill in a request structure based on a CAM control block * * Fills in a request structure based on the contents of a CAM control @@ -1658,11 +1787,9 @@ create_storvsc_request(union ccb *ccb, s { struct ccb_scsiio *csio = &ccb->csio; uint64_t phys_addr; - uint32_t bytes_to_copy = 0; - uint32_t pfn_num = 0; uint32_t pfn; uint64_t not_aligned_seg_bits = 0; - struct hvs_gpa_range *prplist; + int error; /* refer to struct vmscsi_req for meanings of these two fields */ reqp->vstor_packet.u.vm_srb.port = @@ -1706,36 +1833,26 @@ create_storvsc_request(union ccb *ccb, s return (0); } - prplist = &reqp->prp_list; - prplist->gpa_range.gpa_len = csio->dxfer_len; - switch (ccb->ccb_h.flags & CAM_DATA_MASK) { + case CAM_DATA_BIO: case CAM_DATA_VADDR: - { - bytes_to_copy = csio->dxfer_len; - phys_addr = vtophys(csio->data_ptr); - prplist->gpa_range.gpa_ofs = phys_addr & PAGE_MASK; - - while (bytes_to_copy != 0) { - int bytes, page_offset; - phys_addr = - vtophys(&csio->data_ptr[prplist->gpa_range.gpa_len - - bytes_to_copy]); - pfn = phys_addr >> PAGE_SHIFT; - prplist->gpa_page[pfn_num] = pfn; - page_offset = phys_addr & PAGE_MASK; - - bytes = min(PAGE_SIZE - page_offset, bytes_to_copy); - - bytes_to_copy -= bytes; - pfn_num++; + error = bus_dmamap_load_ccb(reqp->softc->storvsc_req_dtag, + reqp->data_dmap, ccb, storvsc_xferbuf_prepare, reqp, + BUS_DMA_NOWAIT); + if (error) { + xpt_print(ccb->ccb_h.path, + "bus_dmamap_load_ccb failed: %d\n", error); + return (error); } - reqp->prp_cnt = pfn_num; + if ((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_BIO) + reqp->softc->sysctl_data.data_bio_cnt++; + else + reqp->softc->sysctl_data.data_vaddr_cnt++; break; - } case CAM_DATA_SG: { + struct storvsc_gpa_range *prplist; int i = 0; int offset = 0; int ret; @@ -1744,13 +1861,16 @@ create_storvsc_request(union ccb *ccb, s (bus_dma_segment_t *)ccb->csio.data_ptr; u_int16_t storvsc_sg_count = ccb->csio.sglist_cnt; + prplist = &reqp->prp_list; + prplist->gpa_range.gpa_len = csio->dxfer_len; + printf("Storvsc: get SG I/O operation, %d\n", reqp->vstor_packet.u.vm_srb.data_in); - if (storvsc_sg_count > VMBUS_CHAN_PRPLIST_MAX){ + if (storvsc_sg_count > STORVSC_DATA_SEGCNT_MAX){ printf("Storvsc: %d segments is too much, " "only support %d segments\n", - storvsc_sg_count, VMBUS_CHAN_PRPLIST_MAX); + storvsc_sg_count, STORVSC_DATA_SEGCNT_MAX); return (EINVAL); } @@ -1847,6 +1967,7 @@ create_storvsc_request(union ccb *ccb, s reqp->bounce_sgl_count = 0; } + reqp->softc->sysctl_data.data_sg_cnt++; break; } default: From owner-svn-src-all@freebsd.org Mon Oct 17 04:07:13 2016 Return-Path: Delivered-To: svn-src-all@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 C814FC11C60; Mon, 17 Oct 2016 04:07:13 +0000 (UTC) (envelope-from imp@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 8BAFD1C5D; Mon, 17 Oct 2016 04:07:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H47CLw032969; Mon, 17 Oct 2016 04:07:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H47CAv032968; Mon, 17 Oct 2016 04:07:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610170407.u9H47CAv032968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 17 Oct 2016 04:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307468 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 04:07:13 -0000 Author: imp Date: Mon Oct 17 04:07:12 2016 New Revision: 307468 URL: https://svnweb.freebsd.org/changeset/base/307468 Log: Assume all coreboot BIOSes have the need for these workarounds because coreboot implements the keyboard controller and it's common to all Chromebooks. The workaround won't hurt and may help. Modified: head/sys/dev/atkbdc/atkbdc.c Modified: head/sys/dev/atkbdc/atkbdc.c ============================================================================== --- head/sys/dev/atkbdc/atkbdc.c Mon Oct 17 03:51:56 2016 (r307467) +++ head/sys/dev/atkbdc/atkbdc.c Mon Oct 17 04:07:12 2016 (r307468) @@ -122,7 +122,7 @@ struct atkbdc_quirks { }; static struct atkbdc_quirks quirks[] = { - {"coreboot", "Acer", "Peppy", + {"coreboot", NULL, NULL, KBDC_QUIRK_KEEP_ACTIVATED | KBDC_QUIRK_IGNORE_PROBE_RESULT | KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT}, From owner-svn-src-all@freebsd.org Mon Oct 17 04:07:15 2016 Return-Path: Delivered-To: svn-src-all@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 263B4C11C6B; Mon, 17 Oct 2016 04:07:15 +0000 (UTC) (envelope-from imp@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 E7A141C5E; Mon, 17 Oct 2016 04:07:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H47D0O033012; Mon, 17 Oct 2016 04:07:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H47D5n033011; Mon, 17 Oct 2016 04:07:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610170407.u9H47D5n033011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 17 Oct 2016 04:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307469 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 04:07:15 -0000 Author: imp Date: Mon Oct 17 04:07:13 2016 New Revision: 307469 URL: https://svnweb.freebsd.org/changeset/base/307469 Log: Allow root_rw_mount to be both lower and upper case. Before, if it was upper case, you'd wind up with a read-only filesystem when you should sometimes. PR: 213549 Modified: head/etc/rc Modified: head/etc/rc ============================================================================== --- head/etc/rc Mon Oct 17 04:07:12 2016 (r307468) +++ head/etc/rc Mon Oct 17 04:07:13 2016 (r307469) @@ -135,16 +135,16 @@ done # Note: this assumes firstboot_sentinel is on / when we have # a read-only /, or that it is on media that's writable. if [ -e ${firstboot_sentinel} ]; then - [ ${root_rw_mount} = "yes" ] || mount -uw / + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -uw / chflags -R 0 ${firstboot_sentinel} rm -rf ${firstboot_sentinel} if [ -e ${firstboot_sentinel}-reboot ]; then chflags -R 0 ${firstboot_sentinel}-reboot rm -rf ${firstboot_sentinel}-reboot - [ ${root_rw_mount} = "yes" ] || mount -ur / + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / kill -INT 1 fi - [ ${root_rw_mount} = "yes" ] || mount -ur / + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / fi echo '' From owner-svn-src-all@freebsd.org Mon Oct 17 04:30:11 2016 Return-Path: Delivered-To: svn-src-all@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 889D8C0D203; Mon, 17 Oct 2016 04:30:11 +0000 (UTC) (envelope-from adrian@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 569C016C3; Mon, 17 Oct 2016 04:30:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H4UA6M040585; Mon, 17 Oct 2016 04:30:10 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H4UAhe040584; Mon, 17 Oct 2016 04:30:10 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610170430.u9H4UAhe040584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 17 Oct 2016 04:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307470 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 04:30:11 -0000 Author: adrian Date: Mon Oct 17 04:30:10 2016 New Revision: 307470 URL: https://svnweb.freebsd.org/changeset/base/307470 Log: [net80211] add some more RX flags. Modified: head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Mon Oct 17 04:07:13 2016 (r307469) +++ head/sys/net80211/ieee80211_freebsd.h Mon Oct 17 04:30:10 2016 (r307470) @@ -652,6 +652,12 @@ int ieee80211_get_xmit_params(struct mbu #define IEEE80211_RX_F_AMSDU_MORE 0x00000008 /* This is another decap AMSDU frame in the batch */ #define IEEE80211_RX_F_AMPDU 0x00000010 /* This is the start of an decap AMPDU list */ #define IEEE80211_RX_F_AMPDU_MORE 0x00000020 /* This is another decap AMPDU frame in the batch */ +#define IEEE80211_RX_F_FAIL_FCSCRC 0x00000040 /* Failed CRC/FCS */ +#define IEEE80211_RX_F_FAIL_MIC 0x00000080 /* Failed MIC check */ +#define IEEE80211_RX_F_DECRYPTED 0x00000100 /* Hardware decrypted */ +#define IEEE80211_RX_F_IV_STRIP 0x00000200 /* Decrypted; IV stripped */ +#define IEEE80211_RX_F_MMIC_STRIP 0x00000400 /* Decrypted; MMIC stripped */ +#define IEEE80211_RX_F_SHORTGI 0x00000800 /* This is a short-GI frame */ /* Channel width */ #define IEEE80211_RX_FW_20MHZ 1 From owner-svn-src-all@freebsd.org Mon Oct 17 05:28:08 2016 Return-Path: Delivered-To: svn-src-all@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 4D8B9C1214C; Mon, 17 Oct 2016 05:28:08 +0000 (UTC) (envelope-from sephe@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 108CC1DEA; Mon, 17 Oct 2016 05:28:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H5S7SD063292; Mon, 17 Oct 2016 05:28:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H5S6Qc063286; Mon, 17 Oct 2016 05:28:06 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170528.u9H5S6Qc063286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 05:28: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: r307471 - in stable/11/sys/dev/hyperv: include netvsc storvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 05:28:08 -0000 Author: sephe Date: Mon Oct 17 05:28:06 2016 New Revision: 307471 URL: https://svnweb.freebsd.org/changeset/base/307471 Log: MFC 303603-303605,303764 303603 hyperv/vmbus: Remove the artificial entry limit of SG and PRP list. Just make sure that the total channel packet size does not exceed 1/2 data size of the TX bufring. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7359 303604 hyperv/storvsc: Set maxio to 128KB. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7360 303605 hyperv/storvsc: Stringent PRP list assertions Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7361 303764 hyperv/vmbus: Only make sure the TX bufring will not be closed. KVP can write data, whose size is > 1/2 TX bufring size. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7414 Modified: stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 04:30:10 2016 (r307470) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 05:28:06 2016 (r307471) @@ -102,9 +102,6 @@ struct vmbus_chanpkt_rxbuf { struct vmbus_rxbuf_desc cp_rxbuf[]; } __packed; -#define VMBUS_CHAN_SGLIST_MAX 32 -#define VMBUS_CHAN_PRPLIST_MAX 32 - struct vmbus_channel; struct hyperv_guid; Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 04:30:10 2016 (r307470) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 05:28:06 2016 (r307471) @@ -1088,6 +1088,7 @@ struct vmbus_channel; typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) +#define NETVSC_PACKET_MAXPAGE 32 #define NETVSC_VLAN_PRIO_MASK 0xe000 #define NETVSC_VLAN_PRIO_SHIFT 13 @@ -1137,7 +1138,7 @@ typedef struct netvsc_packet_ { uint32_t tot_data_buf_len; void *data; uint32_t gpa_cnt; - struct vmbus_gpa gpa[VMBUS_CHAN_SGLIST_MAX]; + struct vmbus_gpa gpa[NETVSC_PACKET_MAXPAGE]; } netvsc_packet; typedef struct { Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 04:30:10 2016 (r307470) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 05:28:06 2016 (r307471) @@ -152,7 +152,7 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE #define HN_TX_DATA_SEGCNT_MAX \ - (VMBUS_CHAN_SGLIST_MAX - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) + (NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) #define HN_DIRECT_TX_SIZE_DEF 128 Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 04:30:10 2016 (r307470) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 05:28:06 2016 (r307471) @@ -88,10 +88,25 @@ __FBSDID("$FreeBSD$"); #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) -#define STORVSC_DATA_SEGCNT_MAX VMBUS_CHAN_PRPLIST_MAX +/* + * 33 segments are needed to allow 128KB maxio, in case the data + * in the first page is _not_ PAGE_SIZE aligned, e.g. + * + * |<----------- 128KB ----------->| + * | | + * 0 2K 4K 8K 16K 124K 128K 130K + * | | | | | | | | + * +--+--+-----+-----+.......+-----+--+--+ + * | | | | | | | | | DATA + * | | | | | | | | | + * +--+--+-----+-----+.......------+--+--+ + * | | | | + * | 1| 31 | 1| ...... # of segments + */ +#define STORVSC_DATA_SEGCNT_MAX 33 #define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE #define STORVSC_DATA_SIZE_MAX \ - (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) + ((STORVSC_DATA_SEGCNT_MAX - 1) * STORVSC_DATA_SEGSZ_MAX) struct storvsc_softc; @@ -1388,6 +1403,7 @@ storvsc_action(struct cam_sim *sim, unio cpi->hba_misc = PIM_NOBUSRESET; if (hv_storvsc_use_pim_unmapped) cpi->hba_misc |= PIM_UNMAPPED; + cpi->maxio = STORVSC_DATA_SIZE_MAX; cpi->hba_eng_cnt = 0; cpi->max_target = STORVSC_MAX_TARGETS; cpi->max_lun = sc->hs_drv_props->drv_max_luns_per_target; @@ -1761,13 +1777,28 @@ storvsc_xferbuf_prepare(void *arg, bus_d prplist->gpa_range.gpa_ofs = segs[0].ds_addr & PAGE_MASK; for (i = 0; i < nsegs; i++) { - prplist->gpa_page[i] = atop(segs[i].ds_addr); #ifdef INVARIANTS - if (i != 0 && i != nsegs - 1) { - KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && - segs[i].ds_len == PAGE_SIZE, ("not a full page")); + if (nsegs > 1) { + if (i == 0) { + KASSERT((segs[i].ds_addr & PAGE_MASK) + + segs[i].ds_len == PAGE_SIZE, + ("invalid 1st page, ofs 0x%jx, len %zu", + (uintmax_t)segs[i].ds_addr, + segs[i].ds_len)); + } else if (i == nsegs - 1) { + KASSERT((segs[i].ds_addr & PAGE_MASK) == 0, + ("invalid last page, ofs 0x%jx", + (uintmax_t)segs[i].ds_addr)); + } else { + KASSERT((segs[i].ds_addr & PAGE_MASK) == 0 && + segs[i].ds_len == PAGE_SIZE, + ("not a full page, ofs 0x%jx, len %zu", + (uintmax_t)segs[i].ds_addr, + segs[i].ds_len)); + } } #endif + prplist->gpa_page[i] = atop(segs[i].ds_addr); } reqp->prp_cnt = nsegs; } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Oct 17 04:30:10 2016 (r307470) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Oct 17 05:28:06 2016 (r307471) @@ -71,6 +71,17 @@ struct vmbus_txbr { struct sysctl_ctx_list; struct sysctl_oid; +static __inline int +vmbus_txbr_maxpktsz(const struct vmbus_txbr *tbr) +{ + /* + * - 64 bits for the trailing start index (- sizeof(uint64_t)). + * - The rindex and windex can't be same (- 1). See + * the comment near vmbus_bufring.br_{r,w}index. + */ + return (tbr->txbr_dsize - sizeof(uint64_t) - 1); +} + void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, struct vmbus_br *br, const char *name); Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 04:30:10 2016 (r307470) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 05:28:06 2016 (r307471) @@ -610,6 +610,8 @@ vmbus_chan_send(struct vmbus_channel *ch hlen = sizeof(pkt); pktlen = hlen + dlen; pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + KASSERT(pad_pktlen <= vmbus_txbr_maxpktsz(&chan->ch_txbr), + ("invalid packet size %d", pad_pktlen)); pkt.cp_hdr.cph_type = type; pkt.cp_hdr.cph_flags = flags; @@ -640,12 +642,11 @@ vmbus_chan_send_sglist(struct vmbus_chan boolean_t send_evt; uint64_t pad = 0; - KASSERT(sglen < VMBUS_CHAN_SGLIST_MAX, - ("invalid sglist len %d", sglen)); - hlen = __offsetof(struct vmbus_chanpkt_sglist, cp_gpa[sglen]); pktlen = hlen + dlen; pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + KASSERT(pad_pktlen <= vmbus_txbr_maxpktsz(&chan->ch_txbr), + ("invalid packet size %d", pad_pktlen)); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; @@ -681,13 +682,12 @@ vmbus_chan_send_prplist(struct vmbus_cha boolean_t send_evt; uint64_t pad = 0; - KASSERT(prp_cnt < VMBUS_CHAN_PRPLIST_MAX, - ("invalid prplist entry count %d", prp_cnt)); - hlen = __offsetof(struct vmbus_chanpkt_prplist, cp_range[0].gpa_page[prp_cnt]); pktlen = hlen + dlen; pad_pktlen = VMBUS_CHANPKT_TOTLEN(pktlen); + KASSERT(pad_pktlen <= vmbus_txbr_maxpktsz(&chan->ch_txbr), + ("invalid packet size %d", pad_pktlen)); pkt.cp_hdr.cph_type = VMBUS_CHANPKT_TYPE_GPA; pkt.cp_hdr.cph_flags = VMBUS_CHANPKT_FLAG_RC; From owner-svn-src-all@freebsd.org Mon Oct 17 05:33:43 2016 Return-Path: Delivered-To: svn-src-all@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 84D7CC1247B; Mon, 17 Oct 2016 05:33:43 +0000 (UTC) (envelope-from sephe@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 5E35D1309; Mon, 17 Oct 2016 05:33:43 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H5XgtL067190; Mon, 17 Oct 2016 05:33:42 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H5XgjC067184; Mon, 17 Oct 2016 05:33:42 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170533.u9H5XgjC067184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 05:33: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: r307472 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 05:33:43 -0000 Author: sephe Date: Mon Oct 17 05:33:41 2016 New Revision: 307472 URL: https://svnweb.freebsd.org/changeset/base/307472 Log: MFC 303822-303824 303822 hyperv/ic: Remove never used second parameter of hv_negotiate_version() Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7422 303823 hyperv/ic: Expose the receive buffer length for callers to use. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7423 303824 hyperv/ic: Pass the channel callback to hv_util_attach() The saved channel callback in util softc is actually never used. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7424 Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/utilities/hv_util.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 05:28:06 2016 (r307471) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 05:33:41 2016 (r307472) @@ -64,7 +64,7 @@ hv_heartbeat_cb(struct vmbus_channel *ch softc = (hv_util_sc*)context; buf = softc->receive_buffer; - recvlen = PAGE_SIZE; + recvlen = softc->ic_buflen; ret = vmbus_chan_recv(channel, buf, &recvlen, &requestid); KASSERT(ret != ENOBUFS, ("hvheartbeat recvbuf is not large enough")); /* XXX check recvlen to make sure that it contains enough data */ @@ -75,8 +75,7 @@ hv_heartbeat_cb(struct vmbus_channel *ch &buf[sizeof(struct hv_vmbus_pipe_hdr)]; if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_negotiate_version(icmsghdrp, NULL, buf); - + hv_negotiate_version(icmsghdrp, buf); } else { heartbeat_msg = (struct hv_vmbus_heartbeat_msg_data *) @@ -110,11 +109,7 @@ hv_heartbeat_probe(device_t dev) static int hv_heartbeat_attach(device_t dev) { - hv_util_sc *softc = (hv_util_sc*)device_get_softc(dev); - - softc->callback = hv_heartbeat_cb; - - return hv_util_attach(dev); + return hv_util_attach(dev, hv_heartbeat_cb); } static device_method_t heartbeat_methods[] = { Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 05:28:06 2016 (r307471) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 05:33:41 2016 (r307472) @@ -629,7 +629,7 @@ hv_kvp_process_request(void *context, in kvp_buf = sc->util_sc.receive_buffer; channel = vmbus_get_channel(sc->dev); - recvlen = 2 * PAGE_SIZE; + recvlen = sc->util_sc.ic_buflen; ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); /* XXX check recvlen to make sure that it contains enough data */ @@ -696,7 +696,7 @@ hv_kvp_process_request(void *context, in /* * Try reading next buffer */ - recvlen = 2 * PAGE_SIZE; + recvlen = sc->util_sc.ic_buflen; ret = vmbus_chan_recv(channel, kvp_buf, &recvlen, &requestid); KASSERT(ret != ENOBUFS, ("hvkvp recvbuf is not large enough")); /* XXX check recvlen to make sure that it contains enough data */ @@ -892,7 +892,6 @@ hv_kvp_attach(device_t dev) hv_kvp_sc *sc = (hv_kvp_sc*)device_get_softc(dev); - sc->util_sc.callback = hv_kvp_callback; sc->dev = dev; sema_init(&sc->dev_sema, 0, "hv_kvp device semaphore"); mtx_init(&sc->pending_mutex, "hv-kvp pending mutex", @@ -920,7 +919,7 @@ hv_kvp_attach(device_t dev) return (error); sc->hv_kvp_dev->si_drv1 = sc; - return hv_util_attach(dev); + return hv_util_attach(dev, hv_kvp_callback); } static int Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 05:28:06 2016 (r307471) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 05:33:41 2016 (r307472) @@ -68,7 +68,7 @@ hv_shutdown_cb(struct vmbus_channel *cha softc = (hv_util_sc*)context; buf = softc->receive_buffer; - recv_len = PAGE_SIZE; + recv_len = softc->ic_buflen; ret = vmbus_chan_recv(channel, buf, &recv_len, &request_id); KASSERT(ret != ENOBUFS, ("hvshutdown recvbuf is not large enough")); /* XXX check recv_len to make sure that it contains enough data */ @@ -79,8 +79,7 @@ hv_shutdown_cb(struct vmbus_channel *cha &buf[sizeof(struct hv_vmbus_pipe_hdr)]; if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_negotiate_version(icmsghdrp, NULL, buf); - + hv_negotiate_version(icmsghdrp, buf); } else { shutdown_msg = (struct hv_vmbus_shutdown_msg_data *) @@ -132,11 +131,7 @@ hv_shutdown_probe(device_t dev) static int hv_shutdown_attach(device_t dev) { - hv_util_sc *softc = (hv_util_sc*)device_get_softc(dev); - - softc->callback = hv_shutdown_cb; - - return hv_util_attach(dev); + return hv_util_attach(dev, hv_shutdown_cb); } static device_method_t shutdown_methods[] = { Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 05:28:06 2016 (r307471) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 05:33:41 2016 (r307472) @@ -145,7 +145,7 @@ hv_timesync_cb(struct vmbus_channel *cha softc = (hv_timesync_sc*)context; time_buf = softc->util_sc.receive_buffer; - recvlen = PAGE_SIZE; + recvlen = softc->util_sc.ic_buflen; ret = vmbus_chan_recv(channel, time_buf, &recvlen, &requestId); KASSERT(ret != ENOBUFS, ("hvtimesync recvbuf is not large enough")); /* XXX check recvlen to make sure that it contains enough data */ @@ -155,7 +155,7 @@ hv_timesync_cb(struct vmbus_channel *cha sizeof(struct hv_vmbus_pipe_hdr)]; if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_negotiate_version(icmsghdrp, NULL, time_buf); + hv_negotiate_version(icmsghdrp, time_buf); } else { timedatap = (struct hv_ictimesync_data *) &time_buf[ sizeof(struct hv_vmbus_pipe_hdr) + @@ -189,18 +189,16 @@ hv_timesync_attach(device_t dev) { hv_timesync_sc *softc = device_get_softc(dev); - softc->util_sc.callback = hv_timesync_cb; TASK_INIT(&softc->task, 1, hv_set_host_time, softc); - - return hv_util_attach(dev); + return hv_util_attach(dev, hv_timesync_cb); } static int hv_timesync_detach(device_t dev) { hv_timesync_sc *softc = device_get_softc(dev); - taskqueue_drain(taskqueue_thread, &softc->task); + taskqueue_drain(taskqueue_thread, &softc->task); return hv_util_detach(dev); } Modified: stable/11/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 05:28:06 2016 (r307471) +++ stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 05:33:41 2016 (r307472) @@ -44,12 +44,13 @@ #include #include "hv_util.h" +#define VMBUS_IC_BRSIZE (4 * PAGE_SIZE) + void -hv_negotiate_version( - struct hv_vmbus_icmsg_hdr* icmsghdrp, - struct hv_vmbus_icmsg_negotiate* negop, - uint8_t* buf) +hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf) { + struct hv_vmbus_icmsg_negotiate *negop; + icmsghdrp->icmsgsize = 0x10; negop = (struct hv_vmbus_icmsg_negotiate *)&buf[ @@ -74,16 +75,15 @@ hv_negotiate_version( } int -hv_util_attach(device_t dev) +hv_util_attach(device_t dev, vmbus_chan_callback_t cb) { - struct hv_util_sc* softc; - struct vmbus_channel *chan; - int ret; - - softc = device_get_softc(dev); - softc->receive_buffer = - malloc(4 * PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - chan = vmbus_get_channel(dev); + struct hv_util_sc *sc = device_get_softc(dev); + struct vmbus_channel *chan = vmbus_get_channel(dev); + int error; + + sc->ic_buflen = VMBUS_IC_BRSIZE; + sc->receive_buffer = malloc(VMBUS_IC_BRSIZE, M_DEVBUF, + M_WAITOK | M_ZERO); /* * These services are not performance critical and do not need @@ -94,17 +94,13 @@ hv_util_attach(device_t dev) */ vmbus_chan_set_readbatch(chan, false); - ret = vmbus_chan_open(chan, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0, - softc->callback, softc); - - if (ret) - goto error0; - + error = vmbus_chan_open(chan, VMBUS_IC_BRSIZE, VMBUS_IC_BRSIZE, NULL, 0, + cb, sc); + if (error) { + free(sc->receive_buffer, M_DEVBUF); + return (error); + } return (0); - -error0: - free(softc->receive_buffer, M_DEVBUF); - return (ret); } int Modified: stable/11/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 05:28:06 2016 (r307471) +++ stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 05:33:41 2016 (r307472) @@ -31,23 +31,20 @@ #ifndef _HVUTIL_H_ #define _HVUTIL_H_ +#include + /** * hv_util related structures * */ typedef struct hv_util_sc { - /* - * function to process Hyper-V messages - */ - void (*callback)(struct vmbus_channel *, void *); uint8_t *receive_buffer; + int ic_buflen; } hv_util_sc; -void hv_negotiate_version( - struct hv_vmbus_icmsg_hdr* icmsghdrp, - struct hv_vmbus_icmsg_negotiate* negop, - uint8_t* buf); +void hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf); -int hv_util_attach(device_t dev); +int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); int hv_util_detach(device_t dev); + #endif From owner-svn-src-all@freebsd.org Mon Oct 17 05:37:24 2016 Return-Path: Delivered-To: svn-src-all@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 82801C12501; Mon, 17 Oct 2016 05:37:24 +0000 (UTC) (envelope-from sephe@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 45D5A14BD; Mon, 17 Oct 2016 05:37:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H5bNBt067384; Mon, 17 Oct 2016 05:37:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H5bMsV067378; Mon, 17 Oct 2016 05:37:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170537.u9H5bMsV067378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 05:37: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: r307473 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 05:37:24 -0000 Author: sephe Date: Mon Oct 17 05:37:22 2016 New Revision: 307473 URL: https://svnweb.freebsd.org/changeset/base/307473 Log: MFC 303867,303901 303867 hyperv/hn: Move gpa array out of netvsc_packet. Prepare to deprecate the netvsc_packet. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7436 303901 hyperv/hn: Reorganize send done callback. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7450 Added: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h - copied unchanged from r303901, head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 05:33:41 2016 (r307472) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 05:37:22 2016 (r307473) @@ -68,6 +68,12 @@ static void hv_nv_on_receive_completion( static void hv_nv_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); +static void hn_nvs_sent_none(struct hn_send_ctx *sndc, + struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, + const struct nvsp_msg_ *msg); + +static struct hn_send_ctx hn_send_ctx_none = + HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); /* * @@ -141,6 +147,7 @@ hv_nv_get_next_send_section(netvsc_dev * static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) { + struct hn_send_ctx sndc; netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret = 0; @@ -189,9 +196,10 @@ hv_nv_init_rx_buffer_with_net_vsp(struct /* Send the gpadl notification request */ + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); if (ret != 0) { goto cleanup; } @@ -240,6 +248,7 @@ exit: static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc) { + struct hn_send_ctx sndc; netvsc_dev *net_dev; nvsp_msg *init_pkt; int ret = 0; @@ -287,9 +296,10 @@ hv_nv_init_send_buffer_with_net_vsp(stru /* Send the gpadl notification request */ + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)init_pkt); + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); if (ret != 0) { goto cleanup; } @@ -348,8 +358,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ ret = vmbus_chan_send(net_dev->sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)revoke_pkt); - + (uint64_t)(uintptr_t)&hn_send_ctx_none); /* * If we failed here, we might as well return and have a leak * rather than continue and a bugchk @@ -414,9 +423,8 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne NETVSC_SEND_BUFFER_ID; ret = vmbus_chan_send(net_dev->sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, 0, - revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)revoke_pkt); + VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), + (uint64_t)(uintptr_t)&hn_send_ctx_none); /* * If we failed here, we might as well return and have a leak * rather than continue and a bugchk @@ -466,6 +474,7 @@ static int hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, netvsc_dev *net_dev, uint32_t nvsp_ver) { + struct hn_send_ctx sndc; nvsp_msg *init_pkt; int ret; @@ -480,9 +489,10 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver; /* Send the init request */ + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); if (ret != 0) return (-1); @@ -524,7 +534,7 @@ hv_nv_send_ndis_config(struct hn_softc * /* Send the configuration packet */ ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&hn_send_ctx_none); if (ret != 0) return (-EINVAL); @@ -602,7 +612,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc /* Send the init request */ ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&hn_send_ctx_none); if (ret != 0) { goto cleanup; } @@ -731,6 +741,43 @@ hv_nv_on_device_remove(struct hn_softc * return (0); } +void +hn_nvs_sent_wakeup(struct hn_send_ctx *sndc __unused, + struct netvsc_dev_ *net_dev, struct vmbus_channel *chan __unused, + const struct nvsp_msg_ *msg) +{ + /* Copy the response back */ + memcpy(&net_dev->channel_init_packet, msg, sizeof(nvsp_msg)); + sema_post(&net_dev->channel_init_sema); +} + +static void +hn_nvs_sent_none(struct hn_send_ctx *sndc __unused, + struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused, + const struct nvsp_msg_ *msg __unused) +{ + /* EMPTY */ +} + +void +hn_chim_free(struct netvsc_dev_ *net_dev, uint32_t chim_idx) +{ + u_long mask; + uint32_t idx; + + idx = chim_idx / BITS_PER_LONG; + KASSERT(idx < net_dev->bitsmap_words, + ("invalid chimney index 0x%x", chim_idx)); + + mask = 1UL << (chim_idx % BITS_PER_LONG); + KASSERT(net_dev->send_section_bitsmap[idx] & mask, + ("index bitmap 0x%lx, chimney index %u, " + "bitmap idx %d, bitmask 0x%lx", + net_dev->send_section_bitsmap[idx], chim_idx, idx, mask)); + + atomic_clear_long(&net_dev->send_section_bitsmap[idx], mask); +} + /* * Net VSC on send completion */ @@ -738,59 +785,15 @@ static void hv_nv_on_send_completion(netvsc_dev *net_dev, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt) { - const nvsp_msg *nvsp_msg_pkt; - netvsc_packet *net_vsc_pkt; + struct hn_send_ctx *sndc; - nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkt); - - if (nvsp_msg_pkt->hdr.msg_type == nvsp_msg_type_init_complete - || nvsp_msg_pkt->hdr.msg_type - == nvsp_msg_1_type_send_rx_buf_complete - || nvsp_msg_pkt->hdr.msg_type - == nvsp_msg_1_type_send_send_buf_complete - || nvsp_msg_pkt->hdr.msg_type - == nvsp_msg5_type_subchannel) { - /* Copy the response back */ - memcpy(&net_dev->channel_init_packet, nvsp_msg_pkt, - sizeof(nvsp_msg)); - sema_post(&net_dev->channel_init_sema); - } else if (nvsp_msg_pkt->hdr.msg_type == - nvsp_msg_1_type_send_rndis_pkt_complete) { - /* Get the send context */ - net_vsc_pkt = - (netvsc_packet *)(unsigned long)pkt->cph_xactid; - if (NULL != net_vsc_pkt) { - if (net_vsc_pkt->send_buf_section_idx != - NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { - u_long mask; - int idx; - - idx = net_vsc_pkt->send_buf_section_idx / - BITS_PER_LONG; - KASSERT(idx < net_dev->bitsmap_words, - ("invalid section index %u", - net_vsc_pkt->send_buf_section_idx)); - mask = 1UL << - (net_vsc_pkt->send_buf_section_idx % - BITS_PER_LONG); - - KASSERT(net_dev->send_section_bitsmap[idx] & - mask, - ("index bitmap 0x%lx, section index %u, " - "bitmap idx %d, bitmask 0x%lx", - net_dev->send_section_bitsmap[idx], - net_vsc_pkt->send_buf_section_idx, - idx, mask)); - atomic_clear_long( - &net_dev->send_section_bitsmap[idx], mask); - } - - /* Notify the layer above us */ - net_vsc_pkt->compl.send.on_send_completion(chan, - net_vsc_pkt->compl.send.send_completion_context); - - } - } + sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; + sndc->hn_cb(sndc, net_dev, chan, VMBUS_CHANPKT_CONST_DATA(pkt)); + /* + * NOTE: + * 'sndc' CAN NOT be accessed anymore, since it can be freed by + * its callback. + */ } /* @@ -799,13 +802,14 @@ hv_nv_on_send_completion(netvsc_dev *net * Returns 0 on success, non-zero on failure. */ int -hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt) +hv_nv_on_send(struct vmbus_channel *chan, bool is_data_pkt, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) { nvsp_msg send_msg; int ret; send_msg.hdr.msg_type = nvsp_msg_1_type_send_rndis_pkt; - if (pkt->is_data_pkt) { + if (is_data_pkt) { /* 0 is RMC_DATA */ send_msg.msgs.vers_1_msgs.send_rndis_pkt.chan_type = 0; } else { @@ -814,17 +818,17 @@ hv_nv_on_send(struct vmbus_channel *chan } send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_idx = - pkt->send_buf_section_idx; + sndc->hn_chim_idx; send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_size = - pkt->send_buf_section_size; + sndc->hn_chim_sz; - if (pkt->gpa_cnt) { - ret = vmbus_chan_send_sglist(chan, pkt->gpa, pkt->gpa_cnt, - &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); + if (gpa_cnt) { + ret = vmbus_chan_send_sglist(chan, gpa, gpa_cnt, + &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)sndc); } else { ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt); + &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)sndc); } return (ret); Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 05:33:41 2016 (r307472) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 05:37:22 2016 (r307473) @@ -1112,33 +1112,10 @@ typedef void (*pfn_on_send_rx_completion #endif typedef struct netvsc_packet_ { - uint8_t is_data_pkt; /* One byte */ - uint16_t vlan_tci; - uint32_t status; - - /* Completion */ - union { - struct { - uint64_t rx_completion_tid; - void *rx_completion_context; - /* This is no longer used */ - pfn_on_send_rx_completion on_rx_completion; - } rx; - struct { - uint64_t send_completion_tid; - void *send_completion_context; - /* Still used in netvsc and filter code */ - pfn_on_send_rx_completion on_send_completion; - } send; - } compl; - uint32_t send_buf_section_idx; - uint32_t send_buf_section_size; - - void *rndis_mesg; + uint16_t vlan_tci; + uint32_t status; uint32_t tot_data_buf_len; void *data; - uint32_t gpa_cnt; - struct vmbus_gpa gpa[NETVSC_PACKET_MAXPAGE]; } netvsc_packet; typedef struct { @@ -1216,6 +1193,9 @@ struct hn_tx_ring { bus_dma_tag_t hn_tx_data_dtag; uint64_t hn_csum_assist; + int hn_gpa_cnt; + struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; + u_long hn_no_txdescs; u_long hn_send_failed; u_long hn_txdma_failed; @@ -1269,13 +1249,15 @@ typedef struct hn_softc { * Externs */ extern int hv_promisc_mode; +struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); netvsc_dev *hv_nv_on_device_add(struct hn_softc *sc, void *additional_info, struct hn_rx_ring *rxr); int hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); -int hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt); +int hv_nv_on_send(struct vmbus_channel *chan, bool is_data_pkt, + struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); int hv_nv_get_next_send_section(netvsc_dev *net_dev); void hv_nv_subchan_attach(struct vmbus_channel *chan, struct hn_rx_ring *rxr); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 05:33:41 2016 (r307472) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 05:37:22 2016 (r307473) @@ -166,7 +166,7 @@ struct hn_txdesc { struct hn_tx_ring *txr; int refs; uint32_t flags; /* HN_TXD_FLAG_ */ - netvsc_packet netvsc_pkt; /* XXX to be removed */ + struct hn_send_ctx send_ctx; bus_dmamap_t data_dmap; @@ -781,14 +781,14 @@ hn_txeof(struct hn_tx_ring *txr) } static void -hn_tx_done(struct vmbus_channel *chan, void *xpkt) +hn_tx_done(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, + struct vmbus_channel *chan, const struct nvsp_msg_ *msg __unused) { - netvsc_packet *packet = xpkt; - struct hn_txdesc *txd; + struct hn_txdesc *txd = sndc->hn_cbarg; struct hn_tx_ring *txr; - txd = (struct hn_txdesc *)(uintptr_t) - packet->compl.send.send_completion_tid; + if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) + hn_chim_free(net_dev, sndc->hn_chim_idx); txr = txd->txr; KASSERT(txr->hn_chan == chan, @@ -835,16 +835,14 @@ hn_encap(struct hn_tx_ring *txr, struct bus_dma_segment_t segs[HN_TX_DATA_SEGCNT_MAX]; int error, nsegs, i; struct mbuf *m_head = *m_head0; - netvsc_packet *packet; rndis_msg *rndis_mesg; rndis_packet *rndis_pkt; rndis_per_packet_info *rppi; struct rndis_hash_value *hash_value; - uint32_t rndis_msg_size; + uint32_t rndis_msg_size, tot_data_buf_len, send_buf_section_idx; + int send_buf_section_size; - packet = &txd->netvsc_pkt; - packet->is_data_pkt = TRUE; - packet->tot_data_buf_len = m_head->m_pkthdr.len; + tot_data_buf_len = m_head->m_pkthdr.len; /* * extension points to the area reserved for the @@ -859,7 +857,7 @@ hn_encap(struct hn_tx_ring *txr, struct rndis_pkt = &rndis_mesg->msg.packet; rndis_pkt->data_offset = sizeof(rndis_packet); - rndis_pkt->data_length = packet->tot_data_buf_len; + rndis_pkt->data_length = tot_data_buf_len; rndis_pkt->per_pkt_info_offset = sizeof(rndis_packet); rndis_msg_size = RNDIS_MESSAGE_SIZE(rndis_packet); @@ -967,15 +965,14 @@ hn_encap(struct hn_tx_ring *txr, struct } } - rndis_mesg->msg_len = packet->tot_data_buf_len + rndis_msg_size; - packet->tot_data_buf_len = rndis_mesg->msg_len; + rndis_mesg->msg_len = tot_data_buf_len + rndis_msg_size; + tot_data_buf_len = rndis_mesg->msg_len; /* * Chimney send, if the packet could fit into one chimney buffer. */ - if (packet->tot_data_buf_len < txr->hn_tx_chimney_size) { + if (tot_data_buf_len < txr->hn_tx_chimney_size) { netvsc_dev *net_dev = txr->hn_sc->net_dev; - uint32_t send_buf_section_idx; txr->hn_tx_chimney_tried++; send_buf_section_idx = @@ -990,10 +987,8 @@ hn_encap(struct hn_tx_ring *txr, struct dest += rndis_msg_size; m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); - packet->send_buf_section_idx = send_buf_section_idx; - packet->send_buf_section_size = - packet->tot_data_buf_len; - packet->gpa_cnt = 0; + send_buf_section_size = tot_data_buf_len; + txr->hn_gpa_cnt = 0; txr->hn_tx_chimney++; goto done; } @@ -1019,19 +1014,19 @@ hn_encap(struct hn_tx_ring *txr, struct } *m_head0 = m_head; - packet->gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; + txr->hn_gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; /* send packet with page buffer */ - packet->gpa[0].gpa_page = atop(txd->rndis_msg_paddr); - packet->gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; - packet->gpa[0].gpa_len = rndis_msg_size; + txr->hn_gpa[0].gpa_page = atop(txd->rndis_msg_paddr); + txr->hn_gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; + txr->hn_gpa[0].gpa_len = rndis_msg_size; /* * Fill the page buffers with mbuf info starting at index * HV_RF_NUM_TX_RESERVED_PAGE_BUFS. */ for (i = 0; i < nsegs; ++i) { - struct vmbus_gpa *gpa = &packet->gpa[ + struct vmbus_gpa *gpa = &txr->hn_gpa[ i + HV_RF_NUM_TX_RESERVED_PAGE_BUFS]; gpa->gpa_page = atop(segs[i].ds_addr); @@ -1039,16 +1034,14 @@ hn_encap(struct hn_tx_ring *txr, struct gpa->gpa_len = segs[i].ds_len; } - packet->send_buf_section_idx = - NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; - packet->send_buf_section_size = 0; + send_buf_section_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; + send_buf_section_size = 0; done: txd->m = m_head; /* Set the completion routine */ - packet->compl.send.on_send_completion = hn_tx_done; - packet->compl.send.send_completion_context = packet; - packet->compl.send.send_completion_tid = (uint64_t)(uintptr_t)txd; + hn_send_ctx_init(&txd->send_ctx, hn_tx_done, txd, + send_buf_section_idx, send_buf_section_size); return 0; } @@ -1068,7 +1061,8 @@ again: * Make sure that txd is not freed before ETHER_BPF_MTAP. */ hn_txdesc_hold(txd); - error = hv_nv_on_send(txr->hn_chan, &txd->netvsc_pkt); + error = hv_nv_on_send(txr->hn_chan, true, &txd->send_ctx, + txr->hn_gpa, txr->hn_gpa_cnt); if (!error) { ETHER_BPF_MTAP(ifp, txd->m); if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 05:33:41 2016 (r307472) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 05:37:22 2016 (r307473) @@ -85,11 +85,17 @@ static int hv_rf_set_packet_filter(rndi static int hv_rf_init_device(rndis_device *device); static int hv_rf_open_device(rndis_device *device); static int hv_rf_close_device(rndis_device *device); -static void hv_rf_on_send_request_completion(struct vmbus_channel *, void *context); -static void hv_rf_on_send_request_halt_completion(struct vmbus_channel *, void *context); int hv_rf_send_offload_request(struct hn_softc *sc, rndis_offload_params *offloads); + +static void hn_rndis_sent_halt(struct hn_send_ctx *sndc, + struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, + const struct nvsp_msg_ *msg); +static void hn_rndis_sent_cb(struct hn_send_ctx *sndc, + struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, + const struct nvsp_msg_ *msg); + /* * Set the Per-Packet-Info with the specified type */ @@ -238,45 +244,36 @@ static int hv_rf_send_request(rndis_device *device, rndis_request *request, uint32_t message_type) { - int ret; - netvsc_packet *packet; netvsc_dev *net_dev = device->net_dev; - int send_buf_section_idx; + uint32_t send_buf_section_idx, tot_data_buf_len; + struct vmbus_gpa gpa[2]; + int gpa_cnt, send_buf_section_size; + hn_sent_callback_t cb; /* Set up the packet to send it */ - packet = &request->pkt; - - packet->is_data_pkt = FALSE; - packet->tot_data_buf_len = request->request_msg.msg_len; - packet->gpa_cnt = 1; - - packet->gpa[0].gpa_page = - hv_get_phys_addr(&request->request_msg) >> PAGE_SHIFT; - packet->gpa[0].gpa_len = request->request_msg.msg_len; - packet->gpa[0].gpa_ofs = - (unsigned long)&request->request_msg & (PAGE_SIZE - 1); - - if (packet->gpa[0].gpa_ofs + packet->gpa[0].gpa_len > PAGE_SIZE) { - packet->gpa_cnt = 2; - packet->gpa[0].gpa_len = PAGE_SIZE - packet->gpa[0].gpa_ofs; - packet->gpa[1].gpa_page = - hv_get_phys_addr((char*)&request->request_msg + - packet->gpa[0].gpa_len) >> PAGE_SHIFT; - packet->gpa[1].gpa_ofs = 0; - packet->gpa[1].gpa_len = request->request_msg.msg_len - - packet->gpa[0].gpa_len; - } - - packet->compl.send.send_completion_context = request; /* packet */ - if (message_type != REMOTE_NDIS_HALT_MSG) { - packet->compl.send.on_send_completion = - hv_rf_on_send_request_completion; - } else { - packet->compl.send.on_send_completion = - hv_rf_on_send_request_halt_completion; + tot_data_buf_len = request->request_msg.msg_len; + + gpa_cnt = 1; + gpa[0].gpa_page = hv_get_phys_addr(&request->request_msg) >> PAGE_SHIFT; + gpa[0].gpa_len = request->request_msg.msg_len; + gpa[0].gpa_ofs = (unsigned long)&request->request_msg & (PAGE_SIZE - 1); + + if (gpa[0].gpa_ofs + gpa[0].gpa_len > PAGE_SIZE) { + gpa_cnt = 2; + gpa[0].gpa_len = PAGE_SIZE - gpa[0].gpa_ofs; + gpa[1].gpa_page = + hv_get_phys_addr((char*)&request->request_msg + + gpa[0].gpa_len) >> PAGE_SHIFT; + gpa[1].gpa_ofs = 0; + gpa[1].gpa_len = request->request_msg.msg_len - gpa[0].gpa_len; } - packet->compl.send.send_completion_tid = (unsigned long)device; - if (packet->tot_data_buf_len < net_dev->send_section_size) { + + if (message_type != REMOTE_NDIS_HALT_MSG) + cb = hn_rndis_sent_cb; + else + cb = hn_rndis_sent_halt; + + if (tot_data_buf_len < net_dev->send_section_size) { send_buf_section_idx = hv_nv_get_next_send_section(net_dev); if (send_buf_section_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { @@ -284,20 +281,20 @@ hv_rf_send_request(rndis_device *device, send_buf_section_idx * net_dev->send_section_size); memcpy(dest, &request->request_msg, request->request_msg.msg_len); - packet->send_buf_section_idx = send_buf_section_idx; - packet->send_buf_section_size = packet->tot_data_buf_len; - packet->gpa_cnt = 0; + send_buf_section_size = tot_data_buf_len; + gpa_cnt = 0; goto sendit; } /* Failed to allocate chimney send buffer; move on */ } - packet->send_buf_section_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; - packet->send_buf_section_size = 0; + send_buf_section_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; + send_buf_section_size = 0; sendit: - ret = hv_nv_on_send(device->net_dev->sc->hn_prichan, packet); - - return (ret); + hn_send_ctx_init(&request->send_ctx, cb, request, + send_buf_section_idx, send_buf_section_size); + return hv_nv_on_send(device->net_dev->sc->hn_prichan, false, + &request->send_ctx, gpa, gpa_cnt); } /* @@ -1059,6 +1056,7 @@ int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int nchan, struct hn_rx_ring *rxr) { + struct hn_send_ctx sndc; int ret; netvsc_dev *net_dev; rndis_device *rndis_dev; @@ -1165,9 +1163,10 @@ hv_rf_on_device_add(struct hn_softc *sc, init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels = net_dev->num_channel - 1; + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt); + init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); if (ret != 0) { device_printf(dev, "Fail to allocate subchannel\n"); goto out; @@ -1238,23 +1237,22 @@ hv_rf_on_close(struct hn_softc *sc) return (hv_rf_close_device((rndis_device *)net_dev->extension)); } -/* - * RNDIS filter on send request completion callback - */ -static void -hv_rf_on_send_request_completion(struct vmbus_channel *chan __unused, - void *context __unused) +static void +hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, + struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused) { + if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) + hn_chim_free(net_dev, sndc->hn_chim_idx); } -/* - * RNDIS filter on send request (halt only) completion callback - */ -static void -hv_rf_on_send_request_halt_completion(struct vmbus_channel *chan __unused, - void *context) +static void +hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, + struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused) { - rndis_request *request = context; + rndis_request *request = sndc->hn_cbarg; + + if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) + hn_chim_free(net_dev, sndc->hn_chim_idx); /* * Notify hv_rf_halt_device() about halt completion. Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 05:33:41 2016 (r307472) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 05:37:22 2016 (r307473) @@ -33,6 +33,7 @@ #include #include +#include /* * Defines @@ -75,7 +76,7 @@ typedef struct rndis_request_ { uint8_t buf_resp[PAGE_SIZE]; /* Simplify allocation by having a netvsc packet inline */ - netvsc_packet pkt; + struct hn_send_ctx send_ctx; /* * The max request size is sizeof(rndis_msg) + PAGE_SIZE. Copied: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h (from r303901, head/sys/dev/hyperv/netvsc/if_hnvar.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 05:37:22 2016 (r307473, copy of r303901, head/sys/dev/hyperv/netvsc/if_hnvar.h) @@ -0,0 +1,83 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _IF_HNVAR_H_ +#define _IF_HNVAR_H_ + +#include +#include + +struct netvsc_dev_; +struct nvsp_msg_; + +struct vmbus_channel; +struct hn_send_ctx; + +typedef void (*hn_sent_callback_t) + (struct hn_send_ctx *, struct netvsc_dev_ *, + struct vmbus_channel *, const struct nvsp_msg_ *); + +struct hn_send_ctx { + hn_sent_callback_t hn_cb; + void *hn_cbarg; + uint32_t hn_chim_idx; + int hn_chim_sz; +}; + +#define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ +{ \ + .hn_cb = cb, \ + .hn_cbarg = cbarg, \ + .hn_chim_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX, \ + .hn_chim_sz = 0 \ +} + +static __inline void +hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, + void *cbarg, uint32_t chim_idx, int chim_sz) +{ + sndc->hn_cb = cb; + sndc->hn_cbarg = cbarg; + sndc->hn_chim_idx = chim_idx; + sndc->hn_chim_sz = chim_sz; +} + +static __inline void +hn_send_ctx_init_simple(struct hn_send_ctx *sndc, hn_sent_callback_t cb, + void *cbarg) +{ + hn_send_ctx_init(sndc, cb, cbarg, + NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX, 0); +} + +void hn_nvs_sent_wakeup(struct hn_send_ctx *sndc, + struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, + const struct nvsp_msg_ *msg); +void hn_chim_free(struct netvsc_dev_ *net_dev, uint32_t chim_idx); + +#endif /* !_IF_HNVAR_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 05:39:46 2016 Return-Path: Delivered-To: svn-src-all@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 4C2D5C12574; Mon, 17 Oct 2016 05:39:46 +0000 (UTC) (envelope-from sephe@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 1BFD81643; Mon, 17 Oct 2016 05:39:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H5djQL067520; Mon, 17 Oct 2016 05:39:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H5djIi067519; Mon, 17 Oct 2016 05:39:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170539.u9H5djIi067519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 05:39: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: r307474 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 05:39:46 -0000 Author: sephe Date: Mon Oct 17 05:39:45 2016 New Revision: 307474 URL: https://svnweb.freebsd.org/changeset/base/307474 Log: MFC 303944 cam/da: Add quirk for I-O Data USB Flash Disk PR: 211716 Submitted by: Jun Su Reported by: Jun Su Sponsored by: Microsoft Modified: stable/11/sys/cam/scsi/scsi_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_da.c Mon Oct 17 05:37:22 2016 (r307473) +++ stable/11/sys/cam/scsi/scsi_da.c Mon Oct 17 05:39:45 2016 (r307474) @@ -814,6 +814,14 @@ static struct da_quirk_entry da_quirk_ta {T_DIRECT, SIP_MEDIA_REMOVABLE, "JetFlash", "Transcend*", "*"}, /*quirks*/ DA_Q_NO_RC16 }, + { + /* + * I-O Data USB Flash Disk + * PR: usb/211716 + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "I-O DATA", "USB Flash Disk*", + "*"}, /*quirks*/ DA_Q_NO_RC16 + }, /* ATA/SATA devices over SAS/USB/... */ { /* Hitachi Advanced Format (4k) drives */ From owner-svn-src-all@freebsd.org Mon Oct 17 05:53:40 2016 Return-Path: Delivered-To: svn-src-all@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 94305C128C3; Mon, 17 Oct 2016 05:53:40 +0000 (UTC) (envelope-from sephe@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 25F941CC4; Mon, 17 Oct 2016 05:53:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H5rdHr075055; Mon, 17 Oct 2016 05:53:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H5rcqb075044; Mon, 17 Oct 2016 05:53:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170553.u9H5rcqb075044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 05:53:38 +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: r307475 - in stable/11/sys: conf dev/hyperv/include dev/hyperv/netvsc dev/hyperv/vmbus 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 05:53:40 -0000 Author: sephe Date: Mon Oct 17 05:53:38 2016 New Revision: 307475 URL: https://svnweb.freebsd.org/changeset/base/307475 Log: MFC 303945,303947-303949,303989,303992,303998,304001,304002,304109,304111 303945 hyperv/vmbus: Add macro to get channel packet data length. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7455 303947 hyperv/vmbus: Add APIs for various types of transactions. Reviewed by: Jun Su Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7456 303948 hyperv/hn: Switch to vmbus xact APIs for NVS initialization Reviewed by: Jun Su Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7457 303949 hyperv/vmbus: Use xact APIs to implement post message Hypercall APIs Avoid code duplication. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7458 303989 hyperv/hn: Simplify NDIS configuration. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7466 303992 hyperv/hn: Simplify NDIS initialization. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7467 303998 hyperv/hn: Switch to vmbus xact APIs for NVS RXBUF connection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7469 304001 hyperv/hn: Switch to vmbus xact APIs for NVS chimney buffer connection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7470 304002 hyperv/hn: Simplify RXBUF disconnection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7472 304109 hyperv/hn: Simplify chimney sending buffer disconnection. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7479 304111 hyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7480 Added: stable/11/sys/dev/hyperv/include/vmbus_xact.h - copied, changed from r303947, head/sys/dev/hyperv/include/vmbus_xact.h stable/11/sys/dev/hyperv/netvsc/if_hnreg.h - copied, changed from r303948, head/sys/dev/hyperv/netvsc/if_hnreg.h stable/11/sys/dev/hyperv/vmbus/vmbus_xact.c - copied, changed from r303947, head/sys/dev/hyperv/vmbus/vmbus_xact.c Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis.h stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h 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 Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/conf/files.amd64 Mon Oct 17 05:53:38 2016 (r307475) @@ -308,6 +308,7 @@ dev/hyperv/vmbus/vmbus_br.c optional dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv +dev/hyperv/vmbus/vmbus_xact.c optional hyperv dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv dev/nfe/if_nfe.c optional nfe pci Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/conf/files.i386 Mon Oct 17 05:53:38 2016 (r307475) @@ -265,6 +265,7 @@ dev/hyperv/vmbus/vmbus_br.c optional dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv dev/hyperv/vmbus/vmbus_if.m optional hyperv +dev/hyperv/vmbus/vmbus_xact.c optional hyperv dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv dev/hyperv/vmbus/i386/vmbus_vector.S optional hyperv dev/ichwd/ichwd.c optional ichwd Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 05:53:38 2016 (r307475) @@ -89,6 +89,11 @@ struct vmbus_chanpkt_hdr { (const void *)((const uint8_t *)(pkt) + \ VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen)) +/* Include padding */ +#define VMBUS_CHANPKT_DATALEN(pkt) \ + (VMBUS_CHANPKT_GETLEN((pkt)->cph_tlen) -\ + VMBUS_CHANPKT_GETLEN((pkt)->cph_hlen)) + struct vmbus_rxbuf_desc { uint32_t rb_len; uint32_t rb_ofs; Copied and modified: stable/11/sys/dev/hyperv/include/vmbus_xact.h (from r303947, head/sys/dev/hyperv/include/vmbus_xact.h) ============================================================================== --- head/sys/dev/hyperv/include/vmbus_xact.h Thu Aug 11 05:49:49 2016 (r303947, copy source) +++ stable/11/sys/dev/hyperv/include/vmbus_xact.h Mon Oct 17 05:53:38 2016 (r307475) @@ -36,7 +36,8 @@ struct vmbus_xact; struct vmbus_xact_ctx; struct vmbus_xact_ctx *vmbus_xact_ctx_create(bus_dma_tag_t dtag, - size_t req_size, size_t resp_size); + size_t req_size, size_t resp_size, + size_t priv_size); void vmbus_xact_ctx_destroy(struct vmbus_xact_ctx *ctx); struct vmbus_xact *vmbus_xact_get(struct vmbus_xact_ctx *ctx, size_t req_len); @@ -44,11 +45,15 @@ void vmbus_xact_put(struct vmbus_xact void *vmbus_xact_req_data(const struct vmbus_xact *xact); bus_addr_t vmbus_xact_req_paddr(const struct vmbus_xact *xact); +void *vmbus_xact_priv(const struct vmbus_xact *xact, + size_t priv_len); void vmbus_xact_activate(struct vmbus_xact *xact); void vmbus_xact_deactivate(struct vmbus_xact *xact); const void *vmbus_xact_wait(struct vmbus_xact *xact, size_t *resp_len); void vmbus_xact_wakeup(struct vmbus_xact *xact, const void *data, size_t dlen); +void vmbus_xact_ctx_wakeup(struct vmbus_xact_ctx *ctx, + const void *data, size_t dlen); #endif /* !_VMBUS_XACT_H_ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 05:53:38 2016 (r307475) @@ -45,9 +45,11 @@ #include #include -#include "hv_net_vsc.h" -#include "hv_rndis.h" -#include "hv_rndis_filter.h" +#include +#include +#include +#include +#include MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); @@ -70,7 +72,7 @@ static void hv_nv_on_receive(netvsc_dev const struct vmbus_chanpkt_hdr *pkt); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, - const struct nvsp_msg_ *msg); + const struct nvsp_msg_ *msg, int); static struct hn_send_ctx hn_send_ctx_none = HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); @@ -147,10 +149,14 @@ hv_nv_get_next_send_section(netvsc_dev * static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) { + struct vmbus_xact *xact; + struct hn_nvs_rxbuf_conn *conn; + const struct hn_nvs_rxbuf_connresp *resp; + size_t resp_len; struct hn_send_ctx sndc; netvsc_dev *net_dev; - nvsp_msg *init_pkt; - int ret = 0; + uint32_t status; + int error; net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) { @@ -162,7 +168,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct BUS_DMA_WAITOK | BUS_DMA_ZERO); if (net_dev->rx_buf == NULL) { device_printf(sc->hn_dev, "allocate rxbuf failed\n"); - return ENOMEM; + return (ENOMEM); } /* @@ -172,74 +178,76 @@ hv_nv_init_rx_buffer_with_net_vsp(struct * Only primary channel has RXBUF connected to it. Sub-channels * just share this RXBUF. */ - ret = vmbus_chan_gpadl_connect(sc->hn_prichan, + error = vmbus_chan_gpadl_connect(sc->hn_prichan, net_dev->rxbuf_dma.hv_paddr, net_dev->rx_buf_size, &net_dev->rx_buf_gpadl_handle); - if (ret != 0) { - device_printf(sc->hn_dev, "rxbuf gpadl connect failed: %d\n", - ret); + if (error) { + if_printf(sc->hn_ifp, "rxbuf gpadl connect failed: %d\n", + error); goto cleanup; } - - /* sema_wait(&ext->channel_init_sema); KYS CHECK */ - /* Notify the NetVsp of the gpadl handle */ - init_pkt = &net_dev->channel_init_packet; + /* + * Connect RXBUF to NVS. + */ - memset(init_pkt, 0, sizeof(nvsp_msg)); + xact = vmbus_xact_get(sc->hn_xact, sizeof(*conn)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs rxbuf conn\n"); + error = ENXIO; + goto cleanup; + } - init_pkt->hdr.msg_type = nvsp_msg_1_type_send_rx_buf; - init_pkt->msgs.vers_1_msgs.send_rx_buf.gpadl_handle = - net_dev->rx_buf_gpadl_handle; - init_pkt->msgs.vers_1_msgs.send_rx_buf.id = - NETVSC_RECEIVE_BUFFER_ID; + conn = vmbus_xact_req_data(xact); + conn->nvs_type = HN_NVS_TYPE_RXBUF_CONN; + conn->nvs_gpadl = net_dev->rx_buf_gpadl_handle; + conn->nvs_sig = HN_NVS_RXBUF_SIG; - /* Send the gpadl notification request */ + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + vmbus_xact_activate(xact); - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); - ret = vmbus_chan_send(sc->hn_prichan, + error = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); - if (ret != 0) { + conn, sizeof(*conn), (uint64_t)(uintptr_t)&sndc); + if (error != 0) { + if_printf(sc->hn_ifp, "send nvs rxbuf conn failed: %d\n", + error); + vmbus_xact_deactivate(xact); + vmbus_xact_put(xact); goto cleanup; } - sema_wait(&net_dev->channel_init_sema); - - /* Check the response */ - if (init_pkt->msgs.vers_1_msgs.send_rx_buf_complete.status - != nvsp_status_success) { - ret = EINVAL; + resp = vmbus_xact_wait(xact, &resp_len); + if (resp_len < sizeof(*resp)) { + if_printf(sc->hn_ifp, "invalid rxbuf conn resp length %zu\n", + resp_len); + vmbus_xact_put(xact); + error = EINVAL; + goto cleanup; + } + if (resp->nvs_type != HN_NVS_TYPE_RXBUF_CONNRESP) { + if_printf(sc->hn_ifp, "not rxbuf conn resp, type %u\n", + resp->nvs_type); + vmbus_xact_put(xact); + error = EINVAL; goto cleanup; } - net_dev->rx_section_count = - init_pkt->msgs.vers_1_msgs.send_rx_buf_complete.num_sections; - - net_dev->rx_sections = malloc(net_dev->rx_section_count * - sizeof(nvsp_1_rx_buf_section), M_NETVSC, M_WAITOK); - memcpy(net_dev->rx_sections, - init_pkt->msgs.vers_1_msgs.send_rx_buf_complete.sections, - net_dev->rx_section_count * sizeof(nvsp_1_rx_buf_section)); - + status = resp->nvs_status; + vmbus_xact_put(xact); - /* - * For first release, there should only be 1 section that represents - * the entire receive buffer - */ - if (net_dev->rx_section_count != 1 - || net_dev->rx_sections->offset != 0) { - ret = EINVAL; + if (status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "rxbuf conn failed: %x\n", status); + error = EIO; goto cleanup; } + net_dev->rx_section_count = 1; - goto exit; + return (0); cleanup: hv_nv_destroy_rx_buffer(net_dev); - -exit: - return (ret); + return (error); } /* @@ -249,9 +257,13 @@ static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc) { struct hn_send_ctx sndc; + struct vmbus_xact *xact; + struct hn_nvs_chim_conn *chim; + const struct hn_nvs_chim_connresp *resp; + size_t resp_len; + uint32_t status, sectsz; netvsc_dev *net_dev; - nvsp_msg *init_pkt; - int ret = 0; + int error; net_dev = hv_nv_get_outbound_net_device(sc); if (!net_dev) { @@ -263,7 +275,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru BUS_DMA_WAITOK | BUS_DMA_ZERO); if (net_dev->send_buf == NULL) { device_printf(sc->hn_dev, "allocate chimney txbuf failed\n"); - return ENOMEM; + return (ENOMEM); } /* @@ -273,48 +285,77 @@ hv_nv_init_send_buffer_with_net_vsp(stru * Only primary channel has chimney sending buffer connected to it. * Sub-channels just share this chimney sending buffer. */ - ret = vmbus_chan_gpadl_connect(sc->hn_prichan, + error = vmbus_chan_gpadl_connect(sc->hn_prichan, net_dev->txbuf_dma.hv_paddr, net_dev->send_buf_size, &net_dev->send_buf_gpadl_handle); - if (ret != 0) { - device_printf(sc->hn_dev, "chimney sending buffer gpadl " - "connect failed: %d\n", ret); + if (error) { + if_printf(sc->hn_ifp, "chimney sending buffer gpadl " + "connect failed: %d\n", error); goto cleanup; } - /* Notify the NetVsp of the gpadl handle */ - - init_pkt = &net_dev->channel_init_packet; + /* + * Connect chimney sending buffer to NVS + */ - memset(init_pkt, 0, sizeof(nvsp_msg)); + xact = vmbus_xact_get(sc->hn_xact, sizeof(*chim)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs chim conn\n"); + error = ENXIO; + goto cleanup; + } - init_pkt->hdr.msg_type = nvsp_msg_1_type_send_send_buf; - init_pkt->msgs.vers_1_msgs.send_rx_buf.gpadl_handle = - net_dev->send_buf_gpadl_handle; - init_pkt->msgs.vers_1_msgs.send_rx_buf.id = - NETVSC_SEND_BUFFER_ID; + chim = vmbus_xact_req_data(xact); + chim->nvs_type = HN_NVS_TYPE_CHIM_CONN; + chim->nvs_gpadl = net_dev->send_buf_gpadl_handle; + chim->nvs_sig = HN_NVS_CHIM_SIG; - /* Send the gpadl notification request */ + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + vmbus_xact_activate(xact); - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); - ret = vmbus_chan_send(sc->hn_prichan, + error = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); - if (ret != 0) { + chim, sizeof(*chim), (uint64_t)(uintptr_t)&sndc); + if (error) { + if_printf(sc->hn_ifp, "send nvs chim conn failed: %d\n", + error); + vmbus_xact_deactivate(xact); + vmbus_xact_put(xact); goto cleanup; } - sema_wait(&net_dev->channel_init_sema); + resp = vmbus_xact_wait(xact, &resp_len); + if (resp_len < sizeof(*resp)) { + if_printf(sc->hn_ifp, "invalid chim conn resp length %zu\n", + resp_len); + vmbus_xact_put(xact); + error = EINVAL; + goto cleanup; + } + if (resp->nvs_type != HN_NVS_TYPE_CHIM_CONNRESP) { + if_printf(sc->hn_ifp, "not chim conn resp, type %u\n", + resp->nvs_type); + vmbus_xact_put(xact); + error = EINVAL; + goto cleanup; + } - /* Check the response */ - if (init_pkt->msgs.vers_1_msgs.send_send_buf_complete.status - != nvsp_status_success) { - ret = EINVAL; + status = resp->nvs_status; + sectsz = resp->nvs_sectsz; + vmbus_xact_put(xact); + + if (status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "chim conn failed: %x\n", status); + error = EIO; goto cleanup; } + if (sectsz == 0) { + if_printf(sc->hn_ifp, "zero chimney sending buffer " + "section size\n"); + return 0; + } - net_dev->send_section_size = - init_pkt->msgs.vers_1_msgs.send_send_buf_complete.section_size; + net_dev->send_section_size = sectsz; net_dev->send_section_count = net_dev->send_buf_size / net_dev->send_section_size; net_dev->bitsmap_words = howmany(net_dev->send_section_count, @@ -323,13 +364,15 @@ hv_nv_init_send_buffer_with_net_vsp(stru malloc(net_dev->bitsmap_words * sizeof(long), M_NETVSC, M_WAITOK | M_ZERO); - goto exit; + if (bootverbose) { + if_printf(sc->hn_ifp, "chimney sending buffer %u/%u\n", + net_dev->send_section_size, net_dev->send_section_count); + } + return 0; cleanup: hv_nv_destroy_send_buffer(net_dev); - -exit: - return (ret); + return (error); } /* @@ -338,34 +381,27 @@ exit: static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev) { - nvsp_msg *revoke_pkt; int ret = 0; - /* - * If we got a section count, it means we received a - * send_rx_buf_complete msg - * (ie sent nvsp_msg_1_type_send_rx_buf msg) therefore, - * we need to send a revoke msg here - */ if (net_dev->rx_section_count) { - /* Send the revoke receive buffer */ - revoke_pkt = &net_dev->revoke_packet; - memset(revoke_pkt, 0, sizeof(nvsp_msg)); - - revoke_pkt->hdr.msg_type = nvsp_msg_1_type_revoke_rx_buf; - revoke_pkt->msgs.vers_1_msgs.revoke_rx_buf.id = - NETVSC_RECEIVE_BUFFER_ID; + struct hn_nvs_rxbuf_disconn disconn; - ret = vmbus_chan_send(net_dev->sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)&hn_send_ctx_none); /* - * If we failed here, we might as well return and have a leak - * rather than continue and a bugchk + * Disconnect RXBUF from NVS. */ + memset(&disconn, 0, sizeof(disconn)); + disconn.nvs_type = HN_NVS_TYPE_RXBUF_DISCONN; + disconn.nvs_sig = HN_NVS_RXBUF_SIG; + + ret = vmbus_chan_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, 0, &disconn, sizeof(disconn), + (uint64_t)(uintptr_t)&hn_send_ctx_none); if (ret != 0) { + if_printf(net_dev->sc->hn_ifp, + "send rxbuf disconn failed: %d\n", ret); return (ret); } + net_dev->rx_section_count = 0; } /* Tear down the gpadl on the vsp end */ @@ -388,12 +424,6 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ net_dev->rx_buf = NULL; } - if (net_dev->rx_sections) { - free(net_dev->rx_sections, M_NETVSC); - net_dev->rx_sections = NULL; - net_dev->rx_section_count = 0; - } - return (ret); } @@ -403,33 +433,24 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev) { - nvsp_msg *revoke_pkt; int ret = 0; - /* - * If we got a section count, it means we received a - * send_rx_buf_complete msg - * (ie sent nvsp_msg_1_type_send_rx_buf msg) therefore, - * we need to send a revoke msg here - */ if (net_dev->send_section_size) { - /* Send the revoke send buffer */ - revoke_pkt = &net_dev->revoke_packet; - memset(revoke_pkt, 0, sizeof(nvsp_msg)); - - revoke_pkt->hdr.msg_type = - nvsp_msg_1_type_revoke_send_buf; - revoke_pkt->msgs.vers_1_msgs.revoke_send_buf.id = - NETVSC_SEND_BUFFER_ID; + struct hn_nvs_chim_disconn disconn; - ret = vmbus_chan_send(net_dev->sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, 0, revoke_pkt, sizeof(nvsp_msg), - (uint64_t)(uintptr_t)&hn_send_ctx_none); /* - * If we failed here, we might as well return and have a leak - * rather than continue and a bugchk + * Disconnect chimney sending buffer from NVS. */ + memset(&disconn, 0, sizeof(disconn)); + disconn.nvs_type = HN_NVS_TYPE_CHIM_DISCONN; + disconn.nvs_sig = HN_NVS_CHIM_SIG; + + ret = vmbus_chan_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_TYPE_INBAND, 0, &disconn, sizeof(disconn), + (uint64_t)(uintptr_t)&hn_send_ctx_none); if (ret != 0) { + if_printf(net_dev->sc->hn_ifp, + "send chim disconn failed: %d\n", ret); return (ret); } } @@ -462,45 +483,64 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne return (ret); } - -/* - * Attempt to negotiate the caller-specified NVSP version - * - * For NVSP v2, Server 2008 R2 does not set - * init_pkt->msgs.init_msgs.init_compl.negotiated_prot_vers - * to the negotiated version, so we cannot rely on that. - */ static int hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, netvsc_dev *net_dev, - uint32_t nvsp_ver) + uint32_t nvs_ver) { struct hn_send_ctx sndc; - nvsp_msg *init_pkt; - int ret; - - init_pkt = &net_dev->channel_init_packet; - memset(init_pkt, 0, sizeof(nvsp_msg)); - init_pkt->hdr.msg_type = nvsp_msg_type_init; + struct vmbus_xact *xact; + struct hn_nvs_init *init; + const struct hn_nvs_init_resp *resp; + size_t resp_len; + uint32_t status; + int error; + + xact = vmbus_xact_get(sc->hn_xact, sizeof(*init)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs init\n"); + return (ENXIO); + } + + init = vmbus_xact_req_data(xact); + init->nvs_type = HN_NVS_TYPE_INIT; + init->nvs_ver_min = nvs_ver; + init->nvs_ver_max = nvs_ver; - /* - * Specify parameter as the only acceptable protocol version - */ - init_pkt->msgs.init_msgs.init.p1.protocol_version = nvsp_ver; - init_pkt->msgs.init_msgs.init.protocol_version_2 = nvsp_ver; + vmbus_xact_activate(xact); + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); - /* Send the init request */ - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); - ret = vmbus_chan_send(sc->hn_prichan, + error = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); - if (ret != 0) - return (-1); - - sema_wait(&net_dev->channel_init_sema); + init, sizeof(*init), (uint64_t)(uintptr_t)&sndc); + if (error) { + if_printf(sc->hn_ifp, "send nvs init failed: %d\n", error); + vmbus_xact_deactivate(xact); + vmbus_xact_put(xact); + return (error); + } - if (init_pkt->msgs.init_msgs.init_compl.status != nvsp_status_success) + resp = vmbus_xact_wait(xact, &resp_len); + if (resp_len < sizeof(*resp)) { + if_printf(sc->hn_ifp, "invalid init resp length %zu\n", + resp_len); + vmbus_xact_put(xact); + return (EINVAL); + } + if (resp->nvs_type != HN_NVS_TYPE_INIT_RESP) { + if_printf(sc->hn_ifp, "not init resp, type %u\n", + resp->nvs_type); + vmbus_xact_put(xact); return (EINVAL); + } + + status = resp->nvs_status; + vmbus_xact_put(xact); + if (status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n", + nvs_ver); + return (EINVAL); + } return (0); } @@ -512,33 +552,19 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ static int hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu) { - netvsc_dev *net_dev; - nvsp_msg *init_pkt; - int ret; - - net_dev = hv_nv_get_outbound_net_device(sc); - if (!net_dev) - return (-ENODEV); - - /* - * Set up configuration packet, write MTU - * Indicate we are capable of handling VLAN tags - */ - init_pkt = &net_dev->channel_init_packet; - memset(init_pkt, 0, sizeof(nvsp_msg)); - init_pkt->hdr.msg_type = nvsp_msg_2_type_send_ndis_config; - init_pkt->msgs.vers_2_msgs.send_ndis_config.mtu = mtu; - init_pkt-> - msgs.vers_2_msgs.send_ndis_config.capabilities.u1.u2.ieee8021q - = 1; - - /* Send the configuration packet */ - ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&hn_send_ctx_none); - if (ret != 0) - return (-EINVAL); + struct hn_nvs_ndis_conf conf; + int error; - return (0); + memset(&conf, 0, sizeof(conf)); + conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; + conf.nvs_mtu = mtu; + conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; + + error = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, + &conf, sizeof(conf), (uint64_t)(uintptr_t)&hn_send_ctx_none); + if (error) + if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); + return (error); } /* @@ -548,8 +574,6 @@ static int hv_nv_connect_to_vsp(struct hn_softc *sc) { netvsc_dev *net_dev; - nvsp_msg *init_pkt; - uint32_t ndis_version; uint32_t protocol_list[] = { NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, NVSP_PROTOCOL_VERSION_4, @@ -559,6 +583,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc int ret = 0; device_t dev = sc->hn_dev; struct ifnet *ifp = sc->hn_ifp; + struct hn_nvs_ndis_init ndis; net_dev = hv_nv_get_outbound_net_device(sc); @@ -591,37 +616,23 @@ hv_nv_connect_to_vsp(struct hn_softc *sc ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); /* - * Send the NDIS version + * Initialize NDIS. */ - init_pkt = &net_dev->channel_init_packet; - - memset(init_pkt, 0, sizeof(nvsp_msg)); - - if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_4) { - ndis_version = NDIS_VERSION_6_1; - } else { - ndis_version = NDIS_VERSION_6_30; - } - - init_pkt->hdr.msg_type = nvsp_msg_1_type_send_ndis_vers; - init_pkt->msgs.vers_1_msgs.send_ndis_vers.ndis_major_vers = - (ndis_version & 0xFFFF0000) >> 16; - init_pkt->msgs.vers_1_msgs.send_ndis_vers.ndis_minor_vers = - ndis_version & 0xFFFF; - /* Send the init request */ + memset(&ndis, 0, sizeof(ndis)); + ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; + ndis.nvs_ndis_major = NDIS_VERSION_MAJOR_6; + if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_4) + ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_1; + else + ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30; ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&hn_send_ctx_none); + &ndis, sizeof(ndis), (uint64_t)(uintptr_t)&hn_send_ctx_none); if (ret != 0) { + if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret); goto cleanup; } - /* - * TODO: BUGBUG - We have to wait for the above msg since the netvsp - * uses KMCL which acknowledges packet (completion packet) - * since our Vmbus always set the VMBUS_CHANPKT_FLAG_RC flag - */ - /* sema_wait(&NetVscChannel->channel_init_sema); */ /* Post the big receive buffer to NetVSP */ if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_2) @@ -742,19 +753,18 @@ hv_nv_on_device_remove(struct hn_softc * } void -hn_nvs_sent_wakeup(struct hn_send_ctx *sndc __unused, - struct netvsc_dev_ *net_dev, struct vmbus_channel *chan __unused, - const struct nvsp_msg_ *msg) -{ - /* Copy the response back */ - memcpy(&net_dev->channel_init_packet, msg, sizeof(nvsp_msg)); - sema_post(&net_dev->channel_init_sema); +hn_nvs_sent_xact(struct hn_send_ctx *sndc, + struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused, + const struct nvsp_msg_ *msg, int dlen) +{ + + vmbus_xact_wakeup(sndc->hn_cbarg, msg, dlen); } static void hn_nvs_sent_none(struct hn_send_ctx *sndc __unused, struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused, - const struct nvsp_msg_ *msg __unused) + const struct nvsp_msg_ *msg __unused, int dlen __unused) { /* EMPTY */ } @@ -788,7 +798,8 @@ hv_nv_on_send_completion(netvsc_dev *net struct hn_send_ctx *sndc; sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; - sndc->hn_cb(sndc, net_dev, chan, VMBUS_CHANPKT_CONST_DATA(pkt)); + sndc->hn_cb(sndc, net_dev, chan, VMBUS_CHANPKT_CONST_DATA(pkt), + VMBUS_CHANPKT_DATALEN(pkt)); /* * NOTE: * 'sndc' CAN NOT be accessed anymore, since it can be freed by Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 05:53:38 2016 (r307475) @@ -1060,7 +1060,6 @@ typedef struct netvsc_dev_ { uint32_t rx_buf_size; uint32_t rx_buf_gpadl_handle; uint32_t rx_section_count; - nvsp_1_rx_buf_section *rx_sections; /* Used for NetVSP initialization protocol */ struct sema channel_init_sema; @@ -1243,6 +1242,7 @@ typedef struct hn_softc { struct taskqueue *hn_tx_taskq; struct sysctl_oid *hn_tx_sysctl_tree; struct sysctl_oid *hn_rx_sysctl_tree; + struct vmbus_xact_ctx *hn_xact; } hn_softc_t; /* Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 05:53:38 2016 (r307475) @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "hv_net_vsc.h" #include "hv_rndis.h" @@ -124,6 +125,9 @@ __FBSDID("$FreeBSD$"); /* Short for Hyper-V network interface */ #define NETVSC_DEVNAME "hn" +#define HN_XACT_REQ_SIZE (2 * PAGE_SIZE) +#define HN_XACT_RESP_SIZE (2 * PAGE_SIZE) + /* * It looks like offset 0 of buf is reserved to hold the softc pointer. * The sc pointer evidently not needed, and is not presently populated. @@ -542,6 +546,11 @@ netvsc_attach(device_t dev) IFCAP_LRO; ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; + sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), + HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); + if (sc->hn_xact == NULL) + goto failed; + error = hv_rf_on_device_add(sc, &device_info, ring_cnt, &sc->hn_rx_ring[0]); if (error) @@ -643,6 +652,7 @@ netvsc_detach(device_t dev) if (sc->hn_tx_taskq != hn_tx_taskq) taskqueue_free(sc->hn_tx_taskq); + vmbus_xact_ctx_destroy(sc->hn_xact); return (0); } @@ -782,7 +792,8 @@ hn_txeof(struct hn_tx_ring *txr) static void hn_tx_done(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, - struct vmbus_channel *chan, const struct nvsp_msg_ *msg __unused) + struct vmbus_channel *chan, const struct nvsp_msg_ *msg __unused, + int dlen __unused) { struct hn_txdesc *txd = sndc->hn_cbarg; struct hn_tx_ring *txr; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 05:53:38 2016 (r307475) @@ -41,6 +41,10 @@ #define NDIS_VERSION_6_1 0x00060001 #define NDIS_VERSION_6_30 0x0006001e +#define NDIS_VERSION_MAJOR_6 6 +#define NDIS_VERSION_MINOR_1 1 +#define NDIS_VERSION_MINOR_30 30 + #define NDIS_VERSION (NDIS_VERSION_5_1) /* Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 05:39:45 2016 (r307474) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 05:53:38 2016 (r307475) @@ -46,9 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include "hv_net_vsc.h" -#include "hv_rndis.h" -#include "hv_rndis_filter.h" +#include +#include +#include +#include +#include struct hv_rf_recvinfo { const ndis_8021q_info *vlan_info; @@ -91,10 +93,10 @@ hv_rf_send_offload_request(struct hn_sof static void hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, - const struct nvsp_msg_ *msg); + const struct nvsp_msg_ *msg, int dlen); static void hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, - const struct nvsp_msg_ *msg); + const struct nvsp_msg_ *msg, int dlen); /* * Set the Per-Packet-Info with the specified type @@ -1060,12 +1062,16 @@ hv_rf_on_device_add(struct hn_softc *sc, int ret; netvsc_dev *net_dev; rndis_device *rndis_dev; - nvsp_msg *init_pkt; rndis_offload_params offloads; struct rndis_recv_scale_cap rsscaps; uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap); netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; device_t dev = sc->hn_dev; + struct hn_nvs_subch_req *req; + const struct hn_nvs_subch_resp *resp; + size_t resp_len; + struct vmbus_xact *xact; + uint32_t status, nsubch; rndis_dev = hv_get_rndis_device(); if (rndis_dev == NULL) { @@ -1153,36 +1159,65 @@ hv_rf_on_device_add(struct hn_softc *sc, goto out; } - /* request host to create sub channels */ - init_pkt = &net_dev->channel_init_packet; - memset(init_pkt, 0, sizeof(nvsp_msg)); - - init_pkt->hdr.msg_type = nvsp_msg5_type_subchannel; - init_pkt->msgs.vers_5_msgs.subchannel_request.op = - NVSP_SUBCHANNE_ALLOCATE; - init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels = - net_dev->num_channel - 1; + /* + * Ask NVS to allocate sub-channels. + */ + xact = vmbus_xact_get(sc->hn_xact, sizeof(*req)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs subch req\n"); + ret = ENXIO; + goto out; + } + + req = vmbus_xact_req_data(xact); + req->nvs_type = HN_NVS_TYPE_SUBCH_REQ; + req->nvs_op = HN_NVS_SUBCH_OP_ALLOC; + req->nvs_nsubch = net_dev->num_channel - 1; + + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + vmbus_xact_activate(xact); - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_wakeup, NULL); ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&sndc); + req, sizeof(*req), (uint64_t)(uintptr_t)&sndc); if (ret != 0) { - device_printf(dev, "Fail to allocate subchannel\n"); + if_printf(sc->hn_ifp, "send nvs subch req failed: %d\n", ret); + vmbus_xact_deactivate(xact); + vmbus_xact_put(xact); goto out; } - sema_wait(&net_dev->channel_init_sema); - - if (init_pkt->msgs.vers_5_msgs.subchn_complete.status != - nvsp_status_success) { - ret = ENODEV; - device_printf(dev, "sub channel complete error\n"); + resp = vmbus_xact_wait(xact, &resp_len); + if (resp_len < sizeof(*resp)) { + if_printf(sc->hn_ifp, "invalid subch resp length %zu\n", + resp_len); + vmbus_xact_put(xact); + ret = EINVAL; + goto out; + } + if (resp->nvs_type != HN_NVS_TYPE_SUBCH_RESP) { + if_printf(sc->hn_ifp, "not subch resp, type %u\n", + resp->nvs_type); + vmbus_xact_put(xact); + ret = EINVAL; goto out; } - net_dev->num_channel = 1 + - init_pkt->msgs.vers_5_msgs.subchn_complete.num_subchannels; + status = resp->nvs_status; + nsubch = resp->nvs_nsubch; + vmbus_xact_put(xact); + + if (status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "subch req failed: %x\n", status); + ret = EIO; + goto out; + } + if (nsubch > net_dev->num_channel - 1) { + if_printf(sc->hn_ifp, "%u subchans are allocated, requested %u\n", + nsubch, net_dev->num_channel - 1); + nsubch = net_dev->num_channel - 1; + } + net_dev->num_channel = nsubch + 1; ret = hv_rf_set_rss_param(rndis_dev, net_dev->num_channel); @@ -1239,7 +1274,8 @@ hv_rf_on_close(struct hn_softc *sc) static void hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, - struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused) + struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused, + int dlen __unused) { if (sndc->hn_chim_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) hn_chim_free(net_dev, sndc->hn_chim_idx); @@ -1247,7 +1283,8 @@ hn_rndis_sent_cb(struct hn_send_ctx *snd static void hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, - struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused) + struct vmbus_channel *chan __unused, const struct nvsp_msg_ *msg __unused, + int dlen __unused) { rndis_request *request = sndc->hn_cbarg; Copied and modified: stable/11/sys/dev/hyperv/netvsc/if_hnreg.h (from r303948, head/sys/dev/hyperv/netvsc/if_hnreg.h) ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Thu Aug 11 06:14:54 2016 (r303948, copy source) +++ stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Mon Oct 17 05:53:38 2016 (r307475) @@ -32,10 +32,23 @@ #include #include +#define HN_NVS_RXBUF_SIG 0xcafe +#define HN_NVS_CHIM_SIG 0xface + #define HN_NVS_STATUS_OK 1 #define HN_NVS_TYPE_INIT 1 #define HN_NVS_TYPE_INIT_RESP 2 +#define HN_NVS_TYPE_NDIS_INIT 100 +#define HN_NVS_TYPE_RXBUF_CONN 101 +#define HN_NVS_TYPE_RXBUF_CONNRESP 102 +#define HN_NVS_TYPE_RXBUF_DISCONN 103 +#define HN_NVS_TYPE_CHIM_CONN 104 +#define HN_NVS_TYPE_CHIM_CONNRESP 105 +#define HN_NVS_TYPE_CHIM_DISCONN 106 +#define HN_NVS_TYPE_NDIS_CONF 125 +#define HN_NVS_TYPE_SUBCH_REQ 133 +#define HN_NVS_TYPE_SUBCH_RESP 133 /* same as SUBCH_REQ */ /* * Any size less than this one will _not_ work, e.g. hn_nvs_init @@ -59,4 +72,94 @@ struct hn_nvs_init_resp { uint32_t nvs_status; /* HN_NVS_STATUS_ */ } __packed; +/* No reponse */ +struct hn_nvs_ndis_conf { + uint32_t nvs_type; /* HN_NVS_TYPE_NDIS_CONF */ + uint32_t nvs_mtu; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 06:09:38 2016 Return-Path: Delivered-To: svn-src-all@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 214B4C12DF8; Mon, 17 Oct 2016 06:09:38 +0000 (UTC) (envelope-from sephe@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 B7B151308; Mon, 17 Oct 2016 06:09:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H69abM079118; Mon, 17 Oct 2016 06:09:36 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H69aUL079114; Mon, 17 Oct 2016 06:09:36 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170609.u9H69aUL079114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 06:09:36 +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: r307476 - in stable/11/sys/dev/hyperv: include netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 06:09:38 -0000 Author: sephe Date: Mon Oct 17 06:09:36 2016 New Revision: 307476 URL: https://svnweb.freebsd.org/changeset/base/307476 Log: MFC 304204-304206,304252-304256 304204 hyperv/hn: Factor out hn_nvs_send/hn_nvs_send_sglist Avoid unnecessary message type setting and centralize the send context to transaction id cast. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7500 304205 hyperv/hn: Simplify RNDIS NVS message sending. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7501 304206 hyperv/hn: Simplify RNDIS message checks on RX path. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7502 304252 hyperv/hn: Ignore the useless TX table. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7514 304253 hyperv/hn: Simplify RNDIS RX packets acknowledgement. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7515 304254 hyperv/hn: Remove reference to nvsp_msg Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7516 304255 hyperv/hn: Remove reference to nvsp_status Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7517 304256 hyperv/hn: Get rid of unused bits Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7518 Modified: stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnreg.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 05:53:38 2016 (r307475) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 06:09:36 2016 (r307476) @@ -83,6 +83,7 @@ struct vmbus_chanpkt_hdr { #define VMBUS_CHANPKT_TYPE_GPA 0x0009 #define VMBUS_CHANPKT_TYPE_COMP 0x000b +#define VMBUS_CHANPKT_FLAG_NONE 0 #define VMBUS_CHANPKT_FLAG_RC 0x0001 /* report completion */ #define VMBUS_CHANPKT_CONST_DATA(pkt) \ Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 05:53:38 2016 (r307475) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 06:09:36 2016 (r307476) @@ -72,7 +72,7 @@ static void hv_nv_on_receive(netvsc_dev const struct vmbus_chanpkt_hdr *pkt); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, - const struct nvsp_msg_ *msg, int); + const void *, int); static struct hn_send_ctx hn_send_ctx_none = HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); @@ -118,7 +118,7 @@ hv_nv_get_next_send_section(netvsc_dev * unsigned long bitsmap_words = net_dev->bitsmap_words; unsigned long *bitsmap = net_dev->send_section_bitsmap; unsigned long idx; - int ret = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; + int ret = HN_NVS_CHIM_IDX_INVALID; int i; for (i = 0; i < bitsmap_words; i++) { @@ -206,9 +206,8 @@ hv_nv_init_rx_buffer_with_net_vsp(struct hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); vmbus_xact_activate(xact); - error = vmbus_chan_send(sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - conn, sizeof(*conn), (uint64_t)(uintptr_t)&sndc); + error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, + conn, sizeof(*conn), &sndc); if (error != 0) { if_printf(sc->hn_ifp, "send nvs rxbuf conn failed: %d\n", error); @@ -313,9 +312,8 @@ hv_nv_init_send_buffer_with_net_vsp(stru hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); vmbus_xact_activate(xact); - error = vmbus_chan_send(sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - chim, sizeof(*chim), (uint64_t)(uintptr_t)&sndc); + error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, + chim, sizeof(*chim), &sndc); if (error) { if_printf(sc->hn_ifp, "send nvs chim conn failed: %d\n", error); @@ -393,9 +391,10 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ disconn.nvs_type = HN_NVS_TYPE_RXBUF_DISCONN; disconn.nvs_sig = HN_NVS_RXBUF_SIG; - ret = vmbus_chan_send(net_dev->sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, 0, &disconn, sizeof(disconn), - (uint64_t)(uintptr_t)&hn_send_ctx_none); + /* NOTE: No response. */ + ret = hn_nvs_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_FLAG_NONE, &disconn, sizeof(disconn), + &hn_send_ctx_none); if (ret != 0) { if_printf(net_dev->sc->hn_ifp, "send rxbuf disconn failed: %d\n", ret); @@ -445,9 +444,10 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne disconn.nvs_type = HN_NVS_TYPE_CHIM_DISCONN; disconn.nvs_sig = HN_NVS_CHIM_SIG; - ret = vmbus_chan_send(net_dev->sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, 0, &disconn, sizeof(disconn), - (uint64_t)(uintptr_t)&hn_send_ctx_none); + /* NOTE: No response. */ + ret = hn_nvs_send(net_dev->sc->hn_prichan, + VMBUS_CHANPKT_FLAG_NONE, &disconn, sizeof(disconn), + &hn_send_ctx_none); if (ret != 0) { if_printf(net_dev->sc->hn_ifp, "send chim disconn failed: %d\n", ret); @@ -509,9 +509,8 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ vmbus_xact_activate(xact); hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); - error = vmbus_chan_send(sc->hn_prichan, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - init, sizeof(*init), (uint64_t)(uintptr_t)&sndc); + error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, + init, sizeof(*init), &sndc); if (error) { if_printf(sc->hn_ifp, "send nvs init failed: %d\n", error); vmbus_xact_deactivate(xact); @@ -560,8 +559,9 @@ hv_nv_send_ndis_config(struct hn_softc * conf.nvs_mtu = mtu; conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; - error = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, - &conf, sizeof(conf), (uint64_t)(uintptr_t)&hn_send_ctx_none); + /* NOTE: No response. */ + error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, + &conf, sizeof(conf), &hn_send_ctx_none); if (error) if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); return (error); @@ -627,8 +627,9 @@ hv_nv_connect_to_vsp(struct hn_softc *sc else ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30; - ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, - &ndis, sizeof(ndis), (uint64_t)(uintptr_t)&hn_send_ctx_none); + /* NOTE: No response. */ + ret = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, + &ndis, sizeof(ndis), &hn_send_ctx_none); if (ret != 0) { if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret); goto cleanup; @@ -689,8 +690,6 @@ hv_nv_on_device_add(struct hn_softc *sc, /* Initialize the NetVSC channel extension */ - sema_init(&net_dev->channel_init_sema, 0, "netdev_sema"); - /* * Open the channel */ @@ -721,7 +720,6 @@ cleanup: * Free the packet buffers on the netvsc device packet queue. * Release other resources. */ - sema_destroy(&net_dev->channel_init_sema); free(net_dev, M_NETVSC); return (NULL); @@ -746,7 +744,6 @@ hv_nv_on_device_remove(struct hn_softc * vmbus_chan_close(sc->hn_prichan); - sema_destroy(&net_dev->channel_init_sema); free(net_dev, M_NETVSC); return (0); @@ -755,16 +752,16 @@ hv_nv_on_device_remove(struct hn_softc * void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused, - const struct nvsp_msg_ *msg, int dlen) + const void *data, int dlen) { - vmbus_xact_wakeup(sndc->hn_cbarg, msg, dlen); + vmbus_xact_wakeup(sndc->hn_cbarg, data, dlen); } static void hn_nvs_sent_none(struct hn_send_ctx *sndc __unused, struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused, - const struct nvsp_msg_ *msg __unused, int dlen __unused) + const void *data __unused, int dlen __unused) { /* EMPTY */ } @@ -813,33 +810,23 @@ hv_nv_on_send_completion(netvsc_dev *net * Returns 0 on success, non-zero on failure. */ int -hv_nv_on_send(struct vmbus_channel *chan, bool is_data_pkt, +hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt) { - nvsp_msg send_msg; + struct hn_nvs_rndis rndis; int ret; - send_msg.hdr.msg_type = nvsp_msg_1_type_send_rndis_pkt; - if (is_data_pkt) { - /* 0 is RMC_DATA */ - send_msg.msgs.vers_1_msgs.send_rndis_pkt.chan_type = 0; - } else { - /* 1 is RMC_CONTROL */ - send_msg.msgs.vers_1_msgs.send_rndis_pkt.chan_type = 1; - } - - send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_idx = - sndc->hn_chim_idx; - send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_size = - sndc->hn_chim_sz; + rndis.nvs_type = HN_NVS_TYPE_RNDIS; + rndis.nvs_rndis_mtype = rndis_mtype; + rndis.nvs_chim_idx = sndc->hn_chim_idx; + rndis.nvs_chim_sz = sndc->hn_chim_sz; if (gpa_cnt) { - ret = vmbus_chan_send_sglist(chan, gpa, gpa_cnt, - &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)sndc); + ret = hn_nvs_send_sglist(chan, gpa, gpa_cnt, + &rndis, sizeof(rndis), sndc); } else { - ret = vmbus_chan_send(chan, - VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, - &send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)sndc); + ret = hn_nvs_send(chan, VMBUS_CHANPKT_FLAG_RC, + &rndis, sizeof(rndis), sndc); } return (ret); @@ -856,19 +843,18 @@ hv_nv_on_receive(netvsc_dev *net_dev, st struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { const struct vmbus_chanpkt_rxbuf *pkt; - const nvsp_msg *nvsp_msg_pkt; + const struct hn_nvs_hdr *nvs_hdr; netvsc_packet vsc_pkt; netvsc_packet *net_vsc_pkt = &vsc_pkt; int count = 0; int i = 0; - int status = nvsp_status_success; - - nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkthdr); + int status = HN_NVS_STATUS_OK; - /* Make sure this is a valid nvsp packet */ - if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg_1_type_send_rndis_pkt) { - if_printf(rxr->hn_ifp, "packet hdr type %u is invalid!\n", - nvsp_msg_pkt->hdr.msg_type); + /* Make sure that this is a RNDIS message. */ + nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); + if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { + if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", + nvs_hdr->nvs_type); return; } @@ -884,15 +870,16 @@ hv_nv_on_receive(netvsc_dev *net_dev, st /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ for (i = 0; i < count; i++) { - net_vsc_pkt->status = nvsp_status_success; + net_vsc_pkt->status = HN_NVS_STATUS_OK; net_vsc_pkt->data = ((uint8_t *)net_dev->rx_buf + pkt->cp_rxbuf[i].rb_ofs); net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len; hv_rf_on_receive(net_dev, rxr, net_vsc_pkt); - if (net_vsc_pkt->status != nvsp_status_success) { - status = nvsp_status_failure; - } + + /* XXX pretty broken; whack it */ + if (net_vsc_pkt->status != HN_NVS_STATUS_OK) + status = HN_NVS_STATUS_FAILED; } /* @@ -912,20 +899,17 @@ static void hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid, uint32_t status) { - nvsp_msg rx_comp_msg; + struct hn_nvs_rndis_ack ack; int retries = 0; int ret = 0; - rx_comp_msg.hdr.msg_type = nvsp_msg_1_type_send_rndis_pkt_complete; - - /* Pass in the status */ - rx_comp_msg.msgs.vers_1_msgs.send_rndis_pkt_complete.status = - status; + ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK; + ack.nvs_status = status; retry_send_cmplt: /* Send the completion */ - ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, 0, - &rx_comp_msg, sizeof(nvsp_msg), tid); + ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, + VMBUS_CHANPKT_FLAG_NONE, &ack, sizeof(ack), tid); if (ret == 0) { /* success */ /* no-op */ @@ -940,44 +924,17 @@ retry_send_cmplt: } } -/* - * Net VSC receiving vRSS send table from VSP - */ static void -hv_nv_send_table(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) +hn_proc_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { - netvsc_dev *net_dev; - const nvsp_msg *nvsp_msg_pkt; - int i; - uint32_t count; - const uint32_t *table; - - net_dev = hv_nv_get_inbound_net_device(sc); - if (!net_dev) - return; - - nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkt); + const struct hn_nvs_hdr *hdr; - if (nvsp_msg_pkt->hdr.msg_type != - nvsp_msg5_type_send_indirection_table) { - printf("Netvsc: !Warning! receive msg type not " - "send_indirection_table. type = %d\n", - nvsp_msg_pkt->hdr.msg_type); + hdr = VMBUS_CHANPKT_CONST_DATA(pkt); + if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) { + /* Useless; ignore */ return; } - - count = nvsp_msg_pkt->msgs.vers_5_msgs.send_table.count; - if (count != VRSS_SEND_TABLE_SIZE) { - printf("Netvsc: Received wrong send table size: %u\n", count); - return; - } - - table = (const uint32_t *) - ((const uint8_t *)&nvsp_msg_pkt->msgs.vers_5_msgs.send_table + - nvsp_msg_pkt->msgs.vers_5_msgs.send_table.offset); - - for (i = 0; i < count; i++) - net_dev->vrss_send_table[i] = table[i]; + if_printf(sc->hn_ifp, "got notify, nvs type %u\n", hdr->nvs_type); } /* @@ -1015,7 +972,7 @@ hv_nv_on_channel_callback(struct vmbus_c hv_nv_on_receive(net_dev, rxr, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: - hv_nv_send_table(sc, pkt); + hn_proc_notify(sc, pkt); break; default: if_printf(rxr->hn_ifp, Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 05:53:38 2016 (r307475) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 06:09:36 2016 (r307476) @@ -177,834 +177,6 @@ typedef struct rndis_recv_scale_param_ { uint32_t processor_masks_entry_size; } rndis_recv_scale_param; -typedef enum nvsp_msg_type_ { - nvsp_msg_type_none = 0, - - /* - * Init Messages - */ - nvsp_msg_type_init = 1, - nvsp_msg_type_init_complete = 2, - - nvsp_version_msg_start = 100, - - /* - * Version 1 Messages - */ - nvsp_msg_1_type_send_ndis_vers = nvsp_version_msg_start, - - nvsp_msg_1_type_send_rx_buf, - nvsp_msg_1_type_send_rx_buf_complete, - nvsp_msg_1_type_revoke_rx_buf, - - nvsp_msg_1_type_send_send_buf, - nvsp_msg_1_type_send_send_buf_complete, - nvsp_msg_1_type_revoke_send_buf, - - nvsp_msg_1_type_send_rndis_pkt, - nvsp_msg_1_type_send_rndis_pkt_complete, - - /* - * Version 2 Messages - */ - nvsp_msg_2_type_send_chimney_delegated_buf, - nvsp_msg_2_type_send_chimney_delegated_buf_complete, - nvsp_msg_2_type_revoke_chimney_delegated_buf, - - nvsp_msg_2_type_resume_chimney_rx_indication, - - nvsp_msg_2_type_terminate_chimney, - nvsp_msg_2_type_terminate_chimney_complete, - - nvsp_msg_2_type_indicate_chimney_event, - - nvsp_msg_2_type_send_chimney_packet, - nvsp_msg_2_type_send_chimney_packet_complete, - - nvsp_msg_2_type_post_chimney_rx_request, - nvsp_msg_2_type_post_chimney_rx_request_complete, - - nvsp_msg_2_type_alloc_rx_buf, - nvsp_msg_2_type_alloc_rx_buf_complete, - - nvsp_msg_2_type_free_rx_buf, - - nvsp_msg_2_send_vmq_rndis_pkt, - nvsp_msg_2_send_vmq_rndis_pkt_complete, - - nvsp_msg_2_type_send_ndis_config, - - nvsp_msg_2_type_alloc_chimney_handle, - nvsp_msg_2_type_alloc_chimney_handle_complete, - - nvsp_msg2_max = nvsp_msg_2_type_alloc_chimney_handle_complete, - - /* - * Version 4 Messages - */ - nvsp_msg4_type_send_vf_association, - nvsp_msg4_type_switch_data_path, - nvsp_msg4_type_uplink_connect_state_deprecated, - - nvsp_msg4_max = nvsp_msg4_type_uplink_connect_state_deprecated, - - /* - * Version 5 Messages - */ - nvsp_msg5_type_oid_query_ex, - nvsp_msg5_type_oid_query_ex_comp, - nvsp_msg5_type_subchannel, - nvsp_msg5_type_send_indirection_table, - - nvsp_msg5_max = nvsp_msg5_type_send_indirection_table, -} nvsp_msg_type; - -typedef enum nvsp_status_ { - nvsp_status_none = 0, - nvsp_status_success, - nvsp_status_failure, - /* Deprecated */ - nvsp_status_prot_vers_range_too_new, - /* Deprecated */ - nvsp_status_prot_vers_range_too_old, - nvsp_status_invalid_rndis_pkt, - nvsp_status_busy, - nvsp_status_max, -} nvsp_status; - -typedef struct nvsp_msg_hdr_ { - uint32_t msg_type; -} __packed nvsp_msg_hdr; - -/* - * Init Messages - */ - -/* - * This message is used by the VSC to initialize the channel - * after the channels has been opened. This message should - * never include anything other then versioning (i.e. this - * message will be the same for ever). - * - * Forever is a long time. The values have been redefined - * in Win7 to indicate major and minor protocol version - * number. - */ -typedef struct nvsp_msg_init_ { - union { - struct { - uint16_t minor_protocol_version; - uint16_t major_protocol_version; - } s; - /* Formerly min_protocol_version */ - uint32_t protocol_version; - } p1; - /* Formerly max_protocol_version */ - uint32_t protocol_version_2; -} __packed nvsp_msg_init; - -/* - * This message is used by the VSP to complete the initialization - * of the channel. This message should never include anything other - * then versioning (i.e. this message will be the same forever). - */ -typedef struct nvsp_msg_init_complete_ { - /* Deprecated */ - uint32_t negotiated_prot_vers; - uint32_t max_mdl_chain_len; - uint32_t status; -} __packed nvsp_msg_init_complete; - -typedef union nvsp_msg_init_uber_ { - nvsp_msg_init init; - nvsp_msg_init_complete init_compl; -} __packed nvsp_msg_init_uber; - -/* - * Version 1 Messages - */ - -/* - * This message is used by the VSC to send the NDIS version - * to the VSP. The VSP can use this information when handling - * OIDs sent by the VSC. - */ -typedef struct nvsp_1_msg_send_ndis_version_ { - uint32_t ndis_major_vers; - /* Deprecated */ - uint32_t ndis_minor_vers; -} __packed nvsp_1_msg_send_ndis_version; - -/* - * This message is used by the VSC to send a receive buffer - * to the VSP. The VSP can then use the receive buffer to - * send data to the VSC. - */ -typedef struct nvsp_1_msg_send_rx_buf_ { - uint32_t gpadl_handle; - uint16_t id; -} __packed nvsp_1_msg_send_rx_buf; - -typedef struct nvsp_1_rx_buf_section_ { - uint32_t offset; - uint32_t sub_allocation_size; - uint32_t num_sub_allocations; - uint32_t end_offset; -} __packed nvsp_1_rx_buf_section; - -/* - * This message is used by the VSP to acknowledge a receive - * buffer send by the VSC. This message must be sent by the - * VSP before the VSP uses the receive buffer. - */ -typedef struct nvsp_1_msg_send_rx_buf_complete_ { - uint32_t status; - uint32_t num_sections; - - /* - * The receive buffer is split into two parts, a large - * suballocation section and a small suballocation - * section. These sections are then suballocated by a - * certain size. - * - * For example, the following break up of the receive - * buffer has 6 large suballocations and 10 small - * suballocations. - * - * | Large Section | | Small Section | - * ------------------------------------------------------------ - * | | | | | | | | | | | | | | | | | | - * | | - * LargeOffset SmallOffset - */ - nvsp_1_rx_buf_section sections[1]; - -} __packed nvsp_1_msg_send_rx_buf_complete; - -/* - * This message is sent by the VSC to revoke the receive buffer. - * After the VSP completes this transaction, the VSP should never - * use the receive buffer again. - */ -typedef struct nvsp_1_msg_revoke_rx_buf_ { - uint16_t id; -} __packed nvsp_1_msg_revoke_rx_buf; - -/* - * This message is used by the VSC to send a send buffer - * to the VSP. The VSC can then use the send buffer to - * send data to the VSP. - */ -typedef struct nvsp_1_msg_send_send_buf_ { - uint32_t gpadl_handle; - uint16_t id; -} __packed nvsp_1_msg_send_send_buf; - -/* - * This message is used by the VSP to acknowledge a send - * buffer sent by the VSC. This message must be sent by the - * VSP before the VSP uses the sent buffer. - */ -typedef struct nvsp_1_msg_send_send_buf_complete_ { - uint32_t status; - - /* - * The VSC gets to choose the size of the send buffer and - * the VSP gets to choose the sections size of the buffer. - * This was done to enable dynamic reconfigurations when - * the cost of GPA-direct buffers decreases. - */ - uint32_t section_size; -} __packed nvsp_1_msg_send_send_buf_complete; - -/* - * This message is sent by the VSC to revoke the send buffer. - * After the VSP completes this transaction, the vsp should never - * use the send buffer again. - */ -typedef struct nvsp_1_msg_revoke_send_buf_ { - uint16_t id; -} __packed nvsp_1_msg_revoke_send_buf; - -/* - * This message is used by both the VSP and the VSC to send - * an RNDIS message to the opposite channel endpoint. - */ -typedef struct nvsp_1_msg_send_rndis_pkt_ { - /* - * This field is specified by RNIDS. They assume there's - * two different channels of communication. However, - * the Network VSP only has one. Therefore, the channel - * travels with the RNDIS packet. - */ - uint32_t chan_type; - - /* - * This field is used to send part or all of the data - * through a send buffer. This values specifies an - * index into the send buffer. If the index is - * 0xFFFFFFFF, then the send buffer is not being used - * and all of the data was sent through other VMBus - * mechanisms. - */ - uint32_t send_buf_section_idx; - uint32_t send_buf_section_size; -} __packed nvsp_1_msg_send_rndis_pkt; - -/* - * This message is used by both the VSP and the VSC to complete - * a RNDIS message to the opposite channel endpoint. At this - * point, the initiator of this message cannot use any resources - * associated with the original RNDIS packet. - */ -typedef struct nvsp_1_msg_send_rndis_pkt_complete_ { - uint32_t status; -} __packed nvsp_1_msg_send_rndis_pkt_complete; - - -/* - * Version 2 Messages - */ - -/* - * This message is used by the VSC to send the NDIS version - * to the VSP. The VSP can use this information when handling - * OIDs sent by the VSC. - */ -typedef struct nvsp_2_netvsc_capabilities_ { - union { - uint64_t as_uint64; - struct { - uint64_t vmq : 1; - uint64_t chimney : 1; - uint64_t sriov : 1; - uint64_t ieee8021q : 1; - uint64_t correlationid : 1; - uint64_t teaming : 1; - } u2; - } u1; -} __packed nvsp_2_netvsc_capabilities; - -typedef struct nvsp_2_msg_send_ndis_config_ { - uint32_t mtu; - uint32_t reserved; - nvsp_2_netvsc_capabilities capabilities; -} __packed nvsp_2_msg_send_ndis_config; - -/* - * NvspMessage2TypeSendChimneyDelegatedBuffer - */ -typedef struct nvsp_2_msg_send_chimney_buf_ -{ - /* - * On WIN7 beta, delegated_obj_max_size is defined as a uint32_t - * Since WIN7 RC, it was split into two uint16_t. To have the same - * struct layout, delegated_obj_max_size shall be the first field. - */ - uint16_t delegated_obj_max_size; - - /* - * The revision # of chimney protocol used between NVSC and NVSP. - * - * This revision is NOT related to the chimney revision between - * NDIS protocol and miniport drivers. - */ - uint16_t revision; - - uint32_t gpadl_handle; -} __packed nvsp_2_msg_send_chimney_buf; - - -/* Unsupported chimney revision 0 (only present in WIN7 beta) */ -#define NVSP_CHIMNEY_REVISION_0 0 - -/* WIN7 Beta Chimney QFE */ -#define NVSP_CHIMNEY_REVISION_1 1 - -/* The chimney revision since WIN7 RC */ -#define NVSP_CHIMNEY_REVISION_2 2 - - -/* - * NvspMessage2TypeSendChimneyDelegatedBufferComplete - */ -typedef struct nvsp_2_msg_send_chimney_buf_complete_ { - uint32_t status; - - /* - * Maximum number outstanding sends and pre-posted receives. - * - * NVSC should not post more than SendQuota/ReceiveQuota packets. - * Otherwise, it can block the non-chimney path for an indefinite - * amount of time. - * (since chimney sends/receives are affected by the remote peer). - * - * Note: NVSP enforces the quota restrictions on a per-VMBCHANNEL - * basis. It doesn't enforce the restriction separately for chimney - * send/receive. If NVSC doesn't voluntarily enforce "SendQuota", - * it may kill its own network connectivity. - */ - uint32_t send_quota; - uint32_t rx_quota; -} __packed nvsp_2_msg_send_chimney_buf_complete; - -/* - * NvspMessage2TypeRevokeChimneyDelegatedBuffer - */ -typedef struct nvsp_2_msg_revoke_chimney_buf_ { - uint32_t gpadl_handle; -} __packed nvsp_2_msg_revoke_chimney_buf; - - -#define NVSP_CHIMNEY_OBJECT_TYPE_NEIGHBOR 0 -#define NVSP_CHIMNEY_OBJECT_TYPE_PATH4 1 -#define NVSP_CHIMNEY_OBJECT_TYPE_PATH6 2 -#define NVSP_CHIMNEY_OBJECT_TYPE_TCP 3 - -/* - * NvspMessage2TypeAllocateChimneyHandle - */ -typedef struct nvsp_2_msg_alloc_chimney_handle_ { - uint64_t vsc_context; - uint32_t object_type; -} __packed nvsp_2_msg_alloc_chimney_handle; - -/* - * NvspMessage2TypeAllocateChimneyHandleComplete - */ -typedef struct nvsp_2_msg_alloc_chimney_handle_complete_ { - uint32_t vsp_handle; -} __packed nvsp_2_msg_alloc_chimney_handle_complete; - - -/* - * NvspMessage2TypeResumeChimneyRXIndication - */ -typedef struct nvsp_2_msg_resume_chimney_rx_indication { - /* - * Handle identifying the offloaded connection - */ - uint32_t vsp_tcp_handle; -} __packed nvsp_2_msg_resume_chimney_rx_indication; - - -#define NVSP_2_MSG_TERMINATE_CHIMNEY_FLAGS_FIRST_STAGE (0x01u) -#define NVSP_2_MSG_TERMINATE_CHIMNEY_FLAGS_RESERVED (~(0x01u)) - -/* - * NvspMessage2TypeTerminateChimney - */ -typedef struct nvsp_2_msg_terminate_chimney_ { - /* - * Handle identifying the offloaded object - */ - uint32_t vsp_handle; - - /* - * Terminate Offload Flags - * Bit 0: - * When set to 0, terminate the offload at the destination NIC - * Bit 1-31: Reserved, shall be zero - */ - uint32_t flags; - - union { - /* - * This field is valid only when bit 0 of flags is clear. - * It specifies the index into the premapped delegated - * object buffer. The buffer was sent through the - * NvspMessage2TypeSendChimneyDelegatedBuffer - * message at initialization time. - * - * NVSP will write the delegated state into the delegated - * buffer upon upload completion. - */ - uint32_t index; - - /* - * This field is valid only when bit 0 of flags is set. - * - * The seqence number of the most recently accepted RX - * indication when VSC sets its TCP context into - * "terminating" state. - * - * This allows NVSP to determines if there are any in-flight - * RX indications for which the acceptance state is still - * undefined. - */ - uint64_t last_accepted_rx_seq_no; - } f0; -} __packed nvsp_2_msg_terminate_chimney; - - -#define NVSP_TERMINATE_CHIMNEY_COMPLETE_FLAG_DATA_CORRUPTED 0x0000001u - -/* - * NvspMessage2TypeTerminateChimneyComplete - */ -typedef struct nvsp_2_msg_terminate_chimney_complete_ { - uint64_t vsc_context; - uint32_t flags; -} __packed nvsp_2_msg_terminate_chimney_complete; - -/* - * NvspMessage2TypeIndicateChimneyEvent - */ -typedef struct nvsp_2_msg_indicate_chimney_event_ { - /* - * When VscTcpContext is 0, event_type is an NDIS_STATUS event code - * Otherwise, EventType is an TCP connection event (defined in - * NdisTcpOffloadEventHandler chimney DDK document). - */ - uint32_t event_type; - - /* - * When VscTcpContext is 0, EventType is an NDIS_STATUS event code - * Otherwise, EventType is an TCP connection event specific information - * (defined in NdisTcpOffloadEventHandler chimney DDK document). - */ - uint32_t event_specific_info; - - /* - * If not 0, the event is per-TCP connection event. This field - * contains the VSC's TCP context. - * If 0, the event indication is global. - */ - uint64_t vsc_tcp_context; -} __packed nvsp_2_msg_indicate_chimney_event; - - -#define NVSP_1_CHIMNEY_SEND_INVALID_OOB_INDEX 0xffffu -#define NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX 0xffffffff - -/* - * NvspMessage2TypeSendChimneyPacket - */ -typedef struct nvsp_2_msg_send_chimney_pkt_ { - /* - * Identify the TCP connection for which this chimney send is - */ - uint32_t vsp_tcp_handle; - - /* - * This field is used to send part or all of the data - * through a send buffer. This values specifies an - * index into the send buffer. If the index is - * 0xFFFF, then the send buffer is not being used - * and all of the data was sent through other VMBus - * mechanisms. - */ - uint16_t send_buf_section_index; - uint16_t send_buf_section_size; - - /* - * OOB Data Index - * This an index to the OOB data buffer. If the index is 0xFFFFFFFF, - * then there is no OOB data. - * - * This field shall be always 0xFFFFFFFF for now. It is reserved for - * the future. - */ - uint16_t oob_data_index; - - /* - * DisconnectFlags = 0 - * Normal chimney send. See MiniportTcpOffloadSend for details. - * - * DisconnectFlags = TCP_DISCONNECT_GRACEFUL_CLOSE (0x01) - * Graceful disconnect. See MiniportTcpOffloadDisconnect for details. - * - * DisconnectFlags = TCP_DISCONNECT_ABORTIVE_CLOSE (0x02) - * Abortive disconnect. See MiniportTcpOffloadDisconnect for details. - */ - uint16_t disconnect_flags; - - uint32_t seq_no; -} __packed nvsp_2_msg_send_chimney_pkt; - -/* - * NvspMessage2TypeSendChimneyPacketComplete - */ -typedef struct nvsp_2_msg_send_chimney_pkt_complete_ { - /* - * The NDIS_STATUS for the chimney send - */ - uint32_t status; - - /* - * Number of bytes that have been sent to the peer (and ACKed by the peer). - */ - uint32_t bytes_transferred; -} __packed nvsp_2_msg_send_chimney_pkt_complete; - - -#define NVSP_1_CHIMNEY_RECV_FLAG_NO_PUSH 0x0001u -#define NVSP_1_CHIMNEY_RECV_INVALID_OOB_INDEX 0xffffu - -/* - * NvspMessage2TypePostChimneyRecvRequest - */ -typedef struct nvsp_2_msg_post_chimney_rx_request_ { - /* - * Identify the TCP connection which this chimney receive request - * is for. - */ - uint32_t vsp_tcp_handle; - - /* - * OOB Data Index - * This an index to the OOB data buffer. If the index is 0xFFFFFFFF, - * then there is no OOB data. - * - * This field shall be always 0xFFFFFFFF for now. It is reserved for - * the future. - */ - uint32_t oob_data_index; - - /* - * Bit 0 - * When it is set, this is a "no-push" receive. - * When it is clear, this is a "push" receive. - * - * Bit 1-15: Reserved and shall be zero - */ - uint16_t flags; - - /* - * For debugging and diagnoses purpose. - * The SeqNo is per TCP connection and starts from 0. - */ - uint32_t seq_no; -} __packed nvsp_2_msg_post_chimney_rx_request; - -/* - * NvspMessage2TypePostChimneyRecvRequestComplete - */ -typedef struct nvsp_2_msg_post_chimney_rx_request_complete_ { - /* - * The NDIS_STATUS for the chimney send - */ - uint32_t status; - - /* - * Number of bytes that have been sent to the peer (and ACKed by - * the peer). - */ - uint32_t bytes_xferred; -} __packed nvsp_2_msg_post_chimney_rx_request_complete; - -/* - * NvspMessage2TypeAllocateReceiveBuffer - */ -typedef struct nvsp_2_msg_alloc_rx_buf_ { - /* - * Allocation ID to match the allocation request and response - */ - uint32_t allocation_id; - - /* - * Length of the VM shared memory receive buffer that needs to - * be allocated - */ - uint32_t length; -} __packed nvsp_2_msg_alloc_rx_buf; - -/* - * NvspMessage2TypeAllocateReceiveBufferComplete - */ -typedef struct nvsp_2_msg_alloc_rx_buf_complete_ { - /* - * The NDIS_STATUS code for buffer allocation - */ - uint32_t status; - - /* - * Allocation ID from NVSP_2_MESSAGE_ALLOCATE_RECEIVE_BUFFER - */ - uint32_t allocation_id; - - /* - * GPADL handle for the allocated receive buffer - */ - uint32_t gpadl_handle; - - /* - * Receive buffer ID that is further used in *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 06:12:27 2016 Return-Path: Delivered-To: svn-src-all@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 6FC60C15027; Mon, 17 Oct 2016 06:12:27 +0000 (UTC) (envelope-from sephe@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 4747F1765; Mon, 17 Oct 2016 06:12:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H6CQ5a082610; Mon, 17 Oct 2016 06:12:26 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H6CP9W082604; Mon, 17 Oct 2016 06:12:25 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170612.u9H6CP9W082604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 06:12:25 +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: r307477 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 06:12:27 -0000 Author: sephe Date: Mon Oct 17 06:12:25 2016 New Revision: 307477 URL: https://svnweb.freebsd.org/changeset/base/307477 Log: MFC 304270,304273 304270 hyperv/util: Don't reference hn_softc in KVP hn_softc is private data struct. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7519 304273 hyperv/util: Factor out helper for IC device_probe DEVMETHOD Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7530 Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_kvp.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/utilities/hv_util.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 06:09:36 2016 (r307476) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 06:12:25 2016 (r307477) @@ -41,10 +41,15 @@ #include "hv_util.h" #include "vmbus_if.h" -/* Heartbeat Service */ -static const struct hyperv_guid service_guid = { .hv_guid = - {0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, - 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }; +static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { + { + .ic_guid = { .hv_guid = { + 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, + 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }, + .ic_desc = "Hyper-V Heartbeat" + }, + VMBUS_IC_DESC_END +}; /** * Process heartbeat message @@ -96,14 +101,8 @@ hv_heartbeat_cb(struct vmbus_channel *ch static int hv_heartbeat_probe(device_t dev) { - if (resource_disabled("hvheartbeat", 0)) - return ENXIO; - if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { - device_set_desc(dev, "Hyper-V Heartbeat Service"); - return BUS_PROBE_DEFAULT; - } - return ENXIO; + return (vmbus_ic_probe(dev, vmbus_heartbeat_descs)); } static int Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 06:09:36 2016 (r307476) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 06:12:25 2016 (r307477) @@ -54,17 +54,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include -#include -#include - #include -#include #include #include "hv_util.h" @@ -91,9 +87,15 @@ static int hv_kvp_log = 0; log(LOG_INFO, "hv_kvp: " __VA_ARGS__); \ } while (0) -static const struct hyperv_guid service_guid = { .hv_guid = - {0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, - 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6} }; +static const struct vmbus_ic_desc vmbus_kvp_descs[] = { + { + .ic_guid = { .hv_guid = { + 0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, + 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6 } }, + .ic_desc = "Hyper-V KVP" + }, + VMBUS_IC_DESC_END +}; /* character device prototypes */ static d_open_t hv_kvp_dev_open; @@ -333,13 +335,11 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) { /* XXX access other driver's softc? are you kidding? */ device_t dev = devs[devcnt]; - struct hn_softc *sc = device_get_softc(dev); struct vmbus_channel *chan; char buf[HYPERV_GUID_STRLEN]; /* * Trying to find GUID of Network Device - * TODO: need vmbus interface. */ chan = vmbus_get_channel(dev); hyperv_guid2str(vmbus_chan_guid_inst(chan), @@ -348,7 +348,7 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, HYPERV_GUID_STRLEN - 1) == 0) { strlcpy((char *)umsg->body.kvp_ip_val.adapter_id, - sc->hn_ifp->if_xname, MAX_ADAPTER_ID_SIZE); + device_get_nameunit(dev), MAX_ADAPTER_ID_SIZE); break; } } @@ -873,14 +873,8 @@ hv_kvp_dev_daemon_poll(struct cdev *dev, static int hv_kvp_probe(device_t dev) { - if (resource_disabled("hvkvp", 0)) - return ENXIO; - if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { - device_set_desc(dev, "Hyper-V KVP Service"); - return BUS_PROBE_DEFAULT; - } - return ENXIO; + return (vmbus_ic_probe(dev, vmbus_kvp_descs)); } static int Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 06:09:36 2016 (r307476) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 06:12:25 2016 (r307477) @@ -46,9 +46,15 @@ #include "hv_util.h" #include "vmbus_if.h" -static const struct hyperv_guid service_guid = { .hv_guid = - {0x31, 0x60, 0x0B, 0X0E, 0x13, 0x52, 0x34, 0x49, - 0x81, 0x8B, 0x38, 0XD9, 0x0C, 0xED, 0x39, 0xDB} }; +static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { + { + .ic_guid = { .hv_guid = { + 0x31, 0x60, 0x0b, 0x0e, 0x13, 0x52, 0x34, 0x49, + 0x81, 0x8b, 0x38, 0xd9, 0x0c, 0xed, 0x39, 0xdb } }, + .ic_desc = "Hyper-V Shutdown" + }, + VMBUS_IC_DESC_END +}; /** * Shutdown @@ -118,14 +124,8 @@ hv_shutdown_cb(struct vmbus_channel *cha static int hv_shutdown_probe(device_t dev) { - if (resource_disabled("hvshutdown", 0)) - return ENXIO; - if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { - device_set_desc(dev, "Hyper-V Shutdown Service"); - return BUS_PROBE_DEFAULT; - } - return ENXIO; + return (vmbus_ic_probe(dev, vmbus_shutdown_descs)); } static int Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 06:09:36 2016 (r307476) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 06:12:25 2016 (r307477) @@ -58,10 +58,15 @@ typedef struct { uint64_t data; } time_sync_data; - /* Time Synch Service */ -static const struct hyperv_guid service_guid = {.hv_guid = - {0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, - 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }; +static const struct vmbus_ic_desc vmbus_timesync_descs[] = { + { + .ic_guid = { .hv_guid = { + 0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, + 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }, + .ic_desc = "Hyper-V Timesync" + }, + VMBUS_IC_DESC_END +}; struct hv_ictimesync_data { uint64_t parenttime; @@ -174,14 +179,8 @@ hv_timesync_cb(struct vmbus_channel *cha static int hv_timesync_probe(device_t dev) { - if (resource_disabled("hvtimesync", 0)) - return ENXIO; - if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, &service_guid) == 0) { - device_set_desc(dev, "Hyper-V Time Synch Service"); - return BUS_PROBE_DEFAULT; - } - return ENXIO; + return (vmbus_ic_probe(dev, vmbus_timesync_descs)); } static int Modified: stable/11/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 06:09:36 2016 (r307476) +++ stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 06:12:25 2016 (r307477) @@ -42,7 +42,9 @@ #include #include #include -#include "hv_util.h" +#include + +#include "vmbus_if.h" #define VMBUS_IC_BRSIZE (4 * PAGE_SIZE) @@ -75,6 +77,24 @@ hv_negotiate_version(struct hv_vmbus_icm } int +vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]) +{ + device_t bus = device_get_parent(dev); + const struct vmbus_ic_desc *d; + + if (resource_disabled(device_get_name(dev), 0)) + return (ENXIO); + + for (d = descs; d->ic_desc != NULL; ++d) { + if (VMBUS_PROBE_GUID(bus, dev, &d->ic_guid) == 0) { + device_set_desc(dev, d->ic_desc); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); +} + +int hv_util_attach(device_t dev, vmbus_chan_callback_t cb) { struct hv_util_sc *sc = device_get_softc(dev); Modified: stable/11/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 06:09:36 2016 (r307476) +++ stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 06:12:25 2016 (r307477) @@ -31,6 +31,7 @@ #ifndef _HVUTIL_H_ #define _HVUTIL_H_ +#include #include /** @@ -42,9 +43,17 @@ typedef struct hv_util_sc { int ic_buflen; } hv_util_sc; +struct vmbus_ic_desc { + const struct hyperv_guid ic_guid; + const char *ic_desc; +}; + +#define VMBUS_IC_DESC_END { .ic_desc = NULL } + void hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf); -int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); -int hv_util_detach(device_t dev); +int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); +int hv_util_detach(device_t dev); +int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); #endif From owner-svn-src-all@freebsd.org Mon Oct 17 06:16:10 2016 Return-Path: Delivered-To: svn-src-all@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 3B20DC1514E; Mon, 17 Oct 2016 06:16:10 +0000 (UTC) (envelope-from sephe@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 F37E419F9; Mon, 17 Oct 2016 06:16:09 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H6G97w082808; Mon, 17 Oct 2016 06:16:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H6G8c6082801; Mon, 17 Oct 2016 06:16:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170616.u9H6G8c6082801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 06:16:08 +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: r307478 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 06:16:10 -0000 Author: sephe Date: Mon Oct 17 06:16:08 2016 New Revision: 307478 URL: https://svnweb.freebsd.org/changeset/base/307478 Log: MFC 304327,304329,304330 304327 hyperv/hn: Pass RX packet info to netvsc_recv. This paves to nuke netvsc_packet, which does not serves much purpose now. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7541 304329 hyperv/hn: Constify RNDIS messages on RX path. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7542 304330 hyperv/hn: Get rid of the useless netvsc_packet Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7544 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis.h stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 06:12:25 2016 (r307477) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 06:16:08 2016 (r307478) @@ -66,7 +66,7 @@ static int hv_nv_connect_to_vsp(struct static void hv_nv_on_send_completion(netvsc_dev *net_dev, struct vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); static void hv_nv_on_receive_completion(struct vmbus_channel *chan, - uint64_t tid, uint32_t status); + uint64_t tid); static void hv_nv_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); @@ -844,11 +844,8 @@ hv_nv_on_receive(netvsc_dev *net_dev, st { const struct vmbus_chanpkt_rxbuf *pkt; const struct hn_nvs_hdr *nvs_hdr; - netvsc_packet vsc_pkt; - netvsc_packet *net_vsc_pkt = &vsc_pkt; int count = 0; int i = 0; - int status = HN_NVS_STATUS_OK; /* Make sure that this is a RNDIS message. */ nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); @@ -870,16 +867,9 @@ hv_nv_on_receive(netvsc_dev *net_dev, st /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ for (i = 0; i < count; i++) { - net_vsc_pkt->status = HN_NVS_STATUS_OK; - net_vsc_pkt->data = ((uint8_t *)net_dev->rx_buf + - pkt->cp_rxbuf[i].rb_ofs); - net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len; - - hv_rf_on_receive(net_dev, rxr, net_vsc_pkt); - - /* XXX pretty broken; whack it */ - if (net_vsc_pkt->status != HN_NVS_STATUS_OK) - status = HN_NVS_STATUS_FAILED; + hv_rf_on_receive(net_dev, rxr, + (const uint8_t *)net_dev->rx_buf + pkt->cp_rxbuf[i].rb_ofs, + pkt->cp_rxbuf[i].rb_len); } /* @@ -887,7 +877,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * messages (not just data messages) will trigger a response * message back to the host. */ - hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid, status); + hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid); } /* @@ -896,15 +886,14 @@ hv_nv_on_receive(netvsc_dev *net_dev, st * Send a receive completion packet to RNDIS device (ie NetVsp) */ static void -hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid, - uint32_t status) +hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid) { struct hn_nvs_rndis_ack ack; int retries = 0; int ret = 0; ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK; - ack.nvs_status = status; + ack.nvs_status = HN_NVS_STATUS_OK; retry_send_cmplt: /* Send the completion */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 06:12:25 2016 (r307477) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 06:16:08 2016 (r307478) @@ -274,13 +274,6 @@ typedef void (*pfn_on_send_rx_completion #define BITS_PER_LONG 32 #endif -typedef struct netvsc_packet_ { - uint16_t vlan_tci; - uint32_t status; - uint32_t tot_data_buf_len; - void *data; -} netvsc_packet; - typedef struct { uint8_t mac_addr[6]; /* Assumption unsigned long */ uint8_t link_state; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 06:12:25 2016 (r307477) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 06:16:08 2016 (r307478) @@ -1277,10 +1277,8 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb * Note: This is no longer used as a callback */ int -netvsc_recv(struct hn_rx_ring *rxr, netvsc_packet *packet, - const rndis_tcp_ip_csum_info *csum_info, - const struct rndis_hash_info *hash_info, - const struct rndis_hash_value *hash_value) +netvsc_recv(struct hn_rx_ring *rxr, const void *data, int dlen, + const struct hn_recvinfo *info) { struct ifnet *ifp = rxr->hn_ifp; struct mbuf *m_new; @@ -1293,17 +1291,16 @@ netvsc_recv(struct hn_rx_ring *rxr, netv /* * Bail out if packet contains more data than configured MTU. */ - if (packet->tot_data_buf_len > (ifp->if_mtu + ETHER_HDR_LEN)) { + if (dlen > (ifp->if_mtu + ETHER_HDR_LEN)) { return (0); - } else if (packet->tot_data_buf_len <= MHLEN) { + } else if (dlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); return (0); } - memcpy(mtod(m_new, void *), packet->data, - packet->tot_data_buf_len); - m_new->m_pkthdr.len = m_new->m_len = packet->tot_data_buf_len; + memcpy(mtod(m_new, void *), data, dlen); + m_new->m_pkthdr.len = m_new->m_len = dlen; rxr->hn_small_pkts++; } else { /* @@ -1313,7 +1310,7 @@ netvsc_recv(struct hn_rx_ring *rxr, netv * if looped around to the Hyper-V TX channel, so avoid them. */ size = MCLBYTES; - if (packet->tot_data_buf_len > MCLBYTES) { + if (dlen > MCLBYTES) { /* 4096 */ size = MJUMPAGESIZE; } @@ -1324,7 +1321,7 @@ netvsc_recv(struct hn_rx_ring *rxr, netv return (0); } - hv_m_append(m_new, packet->tot_data_buf_len, packet->data); + hv_m_append(m_new, dlen, data); } m_new->m_pkthdr.rcvif = ifp; @@ -1332,28 +1329,28 @@ netvsc_recv(struct hn_rx_ring *rxr, netv do_csum = 0; /* receive side checksum offload */ - if (csum_info != NULL) { + if (info->csum_info != NULL) { /* IP csum offload */ - if (csum_info->receive.ip_csum_succeeded && do_csum) { + if (info->csum_info->receive.ip_csum_succeeded && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); rxr->hn_csum_ip++; } /* TCP/UDP csum offload */ - if ((csum_info->receive.tcp_csum_succeeded || - csum_info->receive.udp_csum_succeeded) && do_csum) { + if ((info->csum_info->receive.tcp_csum_succeeded || + info->csum_info->receive.udp_csum_succeeded) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; - if (csum_info->receive.tcp_csum_succeeded) + if (info->csum_info->receive.tcp_csum_succeeded) rxr->hn_csum_tcp++; else rxr->hn_csum_udp++; } - if (csum_info->receive.ip_csum_succeeded && - csum_info->receive.tcp_csum_succeeded) + if (info->csum_info->receive.ip_csum_succeeded && + info->csum_info->receive.tcp_csum_succeeded) do_lro = 1; } else { const struct ether_header *eh; @@ -1409,19 +1406,18 @@ netvsc_recv(struct hn_rx_ring *rxr, netv } } skip: - if ((packet->vlan_tci != 0) && - (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) { - m_new->m_pkthdr.ether_vtag = packet->vlan_tci; + if (info->vlan_info != NULL) { + m_new->m_pkthdr.ether_vtag = info->vlan_info->u1.s1.vlan_id; m_new->m_flags |= M_VLANTAG; } - if (hash_info != NULL && hash_value != NULL) { + if (info->hash_info != NULL && info->hash_value != NULL) { rxr->hn_rss_pkts++; - m_new->m_pkthdr.flowid = hash_value->hash_value; - if ((hash_info->hash_info & NDIS_HASH_FUNCTION_MASK) == + m_new->m_pkthdr.flowid = info->hash_value->hash_value; + if ((info->hash_info->hash_info & NDIS_HASH_FUNCTION_MASK) == NDIS_HASH_FUNCTION_TOEPLITZ) { uint32_t type = - (hash_info->hash_info & NDIS_HASH_TYPE_MASK); + (info->hash_info->hash_info & NDIS_HASH_TYPE_MASK); switch (type) { case NDIS_HASH_IPV4: @@ -1450,8 +1446,8 @@ skip: } } } else { - if (hash_value != NULL) { - m_new->m_pkthdr.flowid = hash_value->hash_value; + if (info->hash_value != NULL) { + m_new->m_pkthdr.flowid = info->hash_value->hash_value; } else { m_new->m_pkthdr.flowid = rxr->hn_rx_idx; hash_type = M_HASHTYPE_OPAQUE; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 06:12:25 2016 (r307477) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 06:16:08 2016 (r307478) @@ -1088,11 +1088,10 @@ typedef struct rndismp_rx_bufs_info_ { */ struct hn_rx_ring; struct hn_tx_ring; +struct hn_recvinfo; -int netvsc_recv(struct hn_rx_ring *rxr, - netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info, - const struct rndis_hash_info *hash_info, - const struct rndis_hash_value *hash_value); +int netvsc_recv(struct hn_rx_ring *rxr, const void *data, int dlen, + const struct hn_recvinfo *info); void netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void* hv_set_rppi_data(rndis_msg *rndis_mesg, Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 06:12:25 2016 (r307477) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 06:16:08 2016 (r307478) @@ -52,13 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -struct hv_rf_recvinfo { - const ndis_8021q_info *vlan_info; - const rndis_tcp_ip_csum_info *csum_info; - const struct rndis_hash_info *hash_info; - const struct rndis_hash_value *hash_value; -}; - #define HV_RF_RECVINFO_VLAN 0x1 #define HV_RF_RECVINFO_CSUM 0x2 #define HV_RF_RECVINFO_HASHINF 0x4 @@ -74,11 +67,12 @@ struct hv_rf_recvinfo { */ static int hv_rf_send_request(rndis_device *device, rndis_request *request, uint32_t message_type); -static void hv_rf_receive_response(rndis_device *device, rndis_msg *response); +static void hv_rf_receive_response(rndis_device *device, + const rndis_msg *response); static void hv_rf_receive_indicate_status(rndis_device *device, - rndis_msg *response); -static void hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, - netvsc_packet *pkt); + const rndis_msg *response); +static void hv_rf_receive_data(struct hn_rx_ring *rxr, + const void *data, int dlen); static int hv_rf_query_device(rndis_device *device, uint32_t oid, void *result, uint32_t *result_size); static inline int hv_rf_query_device_mac(rndis_device *device); @@ -302,7 +296,7 @@ sendit: * RNDIS filter receive response */ static void -hv_rf_receive_response(rndis_device *device, rndis_msg *response) +hv_rf_receive_response(rndis_device *device, const rndis_msg *response) { rndis_request *request = NULL; rndis_request *next_request; @@ -424,9 +418,9 @@ cleanup: * RNDIS filter receive indicate status */ static void -hv_rf_receive_indicate_status(rndis_device *device, rndis_msg *response) +hv_rf_receive_indicate_status(rndis_device *device, const rndis_msg *response) { - rndis_indicate_status *indicate = &response->msg.indicate_status; + const rndis_indicate_status *indicate = &response->msg.indicate_status; switch(indicate->status) { case RNDIS_STATUS_MEDIA_CONNECT: @@ -444,7 +438,7 @@ hv_rf_receive_indicate_status(rndis_devi } static int -hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hv_rf_recvinfo *info) +hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info) { const rndis_per_packet_info *ppi; uint32_t mask, len; @@ -525,12 +519,12 @@ skip: * RNDIS filter receive data */ static void -hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, - netvsc_packet *pkt) +hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen) { - rndis_packet *rndis_pkt; + const rndis_msg *message = data; + const rndis_packet *rndis_pkt; uint32_t data_offset; - struct hv_rf_recvinfo info; + struct hn_recvinfo info; rndis_pkt = &message->msg.packet; @@ -542,30 +536,22 @@ hv_rf_receive_data(struct hn_rx_ring *rx /* Remove rndis header, then pass data packet up the stack */ data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset; - pkt->tot_data_buf_len -= data_offset; - if (pkt->tot_data_buf_len < rndis_pkt->data_length) { - pkt->status = HN_NVS_STATUS_FAILED; + dlen -= data_offset; + if (dlen < rndis_pkt->data_length) { if_printf(rxr->hn_ifp, "total length %u is less than data length %u\n", - pkt->tot_data_buf_len, rndis_pkt->data_length); + dlen, rndis_pkt->data_length); return; } - pkt->tot_data_buf_len = rndis_pkt->data_length; - pkt->data = (void *)((unsigned long)pkt->data + data_offset); + dlen = rndis_pkt->data_length; + data = (const uint8_t *)data + data_offset; if (hv_rf_find_recvinfo(rndis_pkt, &info)) { - pkt->status = HN_NVS_STATUS_FAILED; if_printf(rxr->hn_ifp, "recvinfo parsing failed\n"); return; } - - if (info.vlan_info != NULL) - pkt->vlan_tci = info.vlan_info->u1.s1.vlan_id; - else - pkt->vlan_tci = 0; - - netvsc_recv(rxr, pkt, info.csum_info, info.hash_info, info.hash_value); + netvsc_recv(rxr, data, dlen, &info); } /* @@ -573,30 +559,25 @@ hv_rf_receive_data(struct hn_rx_ring *rx */ int hv_rf_on_receive(netvsc_dev *net_dev, - struct hn_rx_ring *rxr, netvsc_packet *pkt) + struct hn_rx_ring *rxr, const void *data, int dlen) { rndis_device *rndis_dev; - rndis_msg *rndis_hdr; + const rndis_msg *rndis_hdr; /* Make sure the rndis device state is initialized */ - if (net_dev->extension == NULL) { - pkt->status = HN_NVS_STATUS_FAILED; + if (net_dev->extension == NULL) return (ENODEV); - } rndis_dev = (rndis_device *)net_dev->extension; - if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) { - pkt->status = HN_NVS_STATUS_FAILED; + if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) return (EINVAL); - } - - rndis_hdr = pkt->data; + rndis_hdr = data; switch (rndis_hdr->ndis_msg_type) { /* data message */ case REMOTE_NDIS_PACKET_MSG: - hv_rf_receive_data(rxr, rndis_hdr, pkt); + hv_rf_receive_data(rxr, data, dlen); break; /* completion messages */ case REMOTE_NDIS_INITIALIZE_CMPLT: Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 06:12:25 2016 (r307477) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 06:16:08 2016 (r307478) @@ -115,8 +115,8 @@ typedef struct rndis_device_ { struct hn_softc; struct hn_rx_ring; -int hv_rf_on_receive(netvsc_dev *net_dev, - struct hn_rx_ring *rxr, netvsc_packet *pkt); +int hv_rf_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, + const void *data, int dlen); void hv_rf_receive_rollup(netvsc_dev *net_dev); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int nchan, Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 06:12:25 2016 (r307477) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 06:16:08 2016 (r307478) @@ -35,7 +35,6 @@ #include struct netvsc_dev_; -struct nvsp_msg_; struct vmbus_channel; struct hn_send_ctx; @@ -51,6 +50,18 @@ struct hn_send_ctx { int hn_chim_sz; }; +struct rndis_hash_info; +struct rndix_hash_value; +struct ndis_8021q_info_; +struct rndis_tcp_ip_csum_info_; + +struct hn_recvinfo { + const struct ndis_8021q_info_ *vlan_info; + const struct rndis_tcp_ip_csum_info_ *csum_info; + const struct rndis_hash_info *hash_info; + const struct rndis_hash_value *hash_value; +}; + #define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ { \ .hn_cb = cb, \ From owner-svn-src-all@freebsd.org Mon Oct 17 06:18:11 2016 Return-Path: Delivered-To: svn-src-all@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 DF890C152B9; Mon, 17 Oct 2016 06:18:11 +0000 (UTC) (envelope-from sephe@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 B0F861DAF; Mon, 17 Oct 2016 06:18:11 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H6IAW6083028; Mon, 17 Oct 2016 06:18:10 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H6IAid083027; Mon, 17 Oct 2016 06:18:10 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170618.u9H6IAid083027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 06:18: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: r307479 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 06:18:12 -0000 Author: sephe Date: Mon Oct 17 06:18:10 2016 New Revision: 307479 URL: https://svnweb.freebsd.org/changeset/base/307479 Log: MFC 304331 hyperv/kvp: Remove unnecessary function parameter. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7550 Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 06:16:08 2016 (r307478) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 06:18:10 2016 (r307479) @@ -217,10 +217,9 @@ hv_kvp_transaction_init(hv_kvp_sc *sc, u * hv_kvp - version neogtiation function */ static void -hv_kvp_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, - struct hv_vmbus_icmsg_negotiate *negop, - uint8_t *buf) +hv_kvp_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf) { + struct hv_vmbus_icmsg_negotiate *negop; int icframe_vercnt; int icmsg_vercnt; @@ -641,7 +640,7 @@ hv_kvp_process_request(void *context, in hv_kvp_transaction_init(sc, recvlen, requestid, kvp_buf); if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_kvp_negotiate_version(icmsghdrp, NULL, kvp_buf); + hv_kvp_negotiate_version(icmsghdrp, kvp_buf); hv_kvp_respond_host(sc, ret); /* From owner-svn-src-all@freebsd.org Mon Oct 17 06:47:36 2016 Return-Path: Delivered-To: svn-src-all@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 63A32C15A90; Mon, 17 Oct 2016 06:47:36 +0000 (UTC) (envelope-from sephe@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 2F82E1BC8; Mon, 17 Oct 2016 06:47:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H6lZds094098; Mon, 17 Oct 2016 06:47:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H6lZti094094; Mon, 17 Oct 2016 06:47:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170647.u9H6lZti094094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 06:47: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: r307480 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 06:47:36 -0000 Author: sephe Date: Mon Oct 17 06:47:34 2016 New Revision: 307480 URL: https://svnweb.freebsd.org/changeset/base/307480 Log: MFC 304441,304444,304446,304447,304591,304593-304595 304441 hyperv/hn: Move NVS version to softc Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7553 304444 hyperv/hn: Remove assign-only struct field Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7554 304446 hyperv/hn: Remove the useless num_channel Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7555 304447 hyperv/hn: Move RXBUF to hn_softc And don't recreate RXBUF for each primary channel open, it is now created in device_attach DEVMETHOD and destroyed in device_detach DEVMETHOD. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7556 304591 hyperv/hn: Move chimney sending buffer to hn_softc And don't recreate chimney sending buffer for each primary channel open, it is now created in device_attach DEVMETHOD and destroyed in device_detach DEVMETHOD. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7574 304593 hyperv/hn: Get rid of netvsc_dev Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7575 304594 hyperv/hn: Factor out function to execute NVS transactions. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7577 304595 hyperv/hn: Factor out function to simplify NVS request sending Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7578 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 06:18:10 2016 (r307479) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 06:47:34 2016 (r307480) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -59,85 +60,78 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper static void hv_nv_on_channel_callback(struct vmbus_channel *chan, void *xrxr); static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); -static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); -static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev); -static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); +static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *, int); +static int hv_nv_destroy_send_buffer(struct hn_softc *sc); +static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); static int hv_nv_connect_to_vsp(struct hn_softc *sc); -static void hv_nv_on_send_completion(netvsc_dev *net_dev, +static void hv_nv_on_send_completion(struct hn_softc *sc, struct vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); static void hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid); -static void hv_nv_on_receive(netvsc_dev *net_dev, +static void hv_nv_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, - struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, + struct hn_softc *, struct vmbus_channel *chan, const void *, int); +static void hn_nvs_sent_xact(struct hn_send_ctx *, struct hn_softc *sc, + struct vmbus_channel *, const void *, int); static struct hn_send_ctx hn_send_ctx_none = HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); -/* - * - */ -static inline netvsc_dev * -hv_nv_alloc_net_device(struct hn_softc *sc) +uint32_t +hn_chim_alloc(struct hn_softc *sc) { - netvsc_dev *net_dev; + int i, bmap_cnt = sc->hn_chim_bmap_cnt; + u_long *bmap = sc->hn_chim_bmap; + uint32_t ret = HN_NVS_CHIM_IDX_INVALID; - net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_WAITOK | M_ZERO); + for (i = 0; i < bmap_cnt; ++i) { + int idx; - net_dev->sc = sc; - net_dev->destroy = FALSE; - sc->net_dev = net_dev; + idx = ffsl(~bmap[i]); + if (idx == 0) + continue; - return (net_dev); -} + --idx; /* ffsl is 1-based */ + KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt, + ("invalid i %d and idx %d", i, idx)); -/* - * XXX unnecessary; nuke it. - */ -static inline netvsc_dev * -hv_nv_get_outbound_net_device(struct hn_softc *sc) -{ - return sc->net_dev; -} + if (atomic_testandset_long(&bmap[i], idx)) + continue; -/* - * XXX unnecessary; nuke it. - */ -static inline netvsc_dev * -hv_nv_get_inbound_net_device(struct hn_softc *sc) -{ - return sc->net_dev; + ret = i * LONG_BIT + idx; + break; + } + return (ret); } -int -hv_nv_get_next_send_section(netvsc_dev *net_dev) +const void * +hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, + void *req, int reqlen, size_t *resp_len) { - unsigned long bitsmap_words = net_dev->bitsmap_words; - unsigned long *bitsmap = net_dev->send_section_bitsmap; - unsigned long idx; - int ret = HN_NVS_CHIM_IDX_INVALID; - int i; - - for (i = 0; i < bitsmap_words; i++) { - idx = ffsl(~bitsmap[i]); - if (0 == idx) - continue; - - idx--; - KASSERT(i * BITS_PER_LONG + idx < net_dev->send_section_count, - ("invalid i %d and idx %lu", i, idx)); + struct hn_send_ctx sndc; + int error; - if (atomic_testandset_long(&bitsmap[i], idx)) - continue; + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + vmbus_xact_activate(xact); - ret = i * BITS_PER_LONG + idx; - break; + error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, + req, reqlen, &sndc); + if (error) { + vmbus_xact_deactivate(xact); + return NULL; } + return (vmbus_xact_wait(xact, resp_len)); +} - return (ret); +static __inline int +hn_nvs_req_send(struct hn_softc *sc, void *req, int reqlen) +{ + + return (hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, + req, reqlen, &hn_send_ctx_none)); } /* @@ -147,29 +141,17 @@ hv_nv_get_next_send_section(netvsc_dev * * Hyper-V extensible switch and the synthetic data path. */ static int -hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) +hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc, int rxbuf_size) { - struct vmbus_xact *xact; + struct vmbus_xact *xact = NULL; struct hn_nvs_rxbuf_conn *conn; const struct hn_nvs_rxbuf_connresp *resp; size_t resp_len; - struct hn_send_ctx sndc; - netvsc_dev *net_dev; uint32_t status; int error; - net_dev = hv_nv_get_outbound_net_device(sc); - if (!net_dev) { - return (ENODEV); - } - - net_dev->rx_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), - PAGE_SIZE, 0, net_dev->rx_buf_size, &net_dev->rxbuf_dma, - BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (net_dev->rx_buf == NULL) { - device_printf(sc->hn_dev, "allocate rxbuf failed\n"); - return (ENOMEM); - } + KASSERT(rxbuf_size <= NETVSC_RECEIVE_BUFFER_SIZE, + ("invalid rxbuf size %d", rxbuf_size)); /* * Connect the RXBUF GPADL to the primary channel. @@ -179,8 +161,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct * just share this RXBUF. */ error = vmbus_chan_gpadl_connect(sc->hn_prichan, - net_dev->rxbuf_dma.hv_paddr, net_dev->rx_buf_size, - &net_dev->rx_buf_gpadl_handle); + sc->hn_rxbuf_dma.hv_paddr, rxbuf_size, &sc->hn_rxbuf_gpadl); if (error) { if_printf(sc->hn_ifp, "rxbuf gpadl connect failed: %d\n", error); @@ -197,55 +178,47 @@ hv_nv_init_rx_buffer_with_net_vsp(struct error = ENXIO; goto cleanup; } - conn = vmbus_xact_req_data(xact); conn->nvs_type = HN_NVS_TYPE_RXBUF_CONN; - conn->nvs_gpadl = net_dev->rx_buf_gpadl_handle; + conn->nvs_gpadl = sc->hn_rxbuf_gpadl; conn->nvs_sig = HN_NVS_RXBUF_SIG; - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); - vmbus_xact_activate(xact); - - error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, - conn, sizeof(*conn), &sndc); - if (error != 0) { - if_printf(sc->hn_ifp, "send nvs rxbuf conn failed: %d\n", - error); - vmbus_xact_deactivate(xact); - vmbus_xact_put(xact); + resp = hn_nvs_xact_execute(sc, xact, conn, sizeof(*conn), &resp_len); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec rxbuf conn failed\n"); + error = EIO; goto cleanup; } - - resp = vmbus_xact_wait(xact, &resp_len); if (resp_len < sizeof(*resp)) { if_printf(sc->hn_ifp, "invalid rxbuf conn resp length %zu\n", resp_len); - vmbus_xact_put(xact); error = EINVAL; goto cleanup; } if (resp->nvs_type != HN_NVS_TYPE_RXBUF_CONNRESP) { if_printf(sc->hn_ifp, "not rxbuf conn resp, type %u\n", resp->nvs_type); - vmbus_xact_put(xact); error = EINVAL; goto cleanup; } status = resp->nvs_status; vmbus_xact_put(xact); + xact = NULL; if (status != HN_NVS_STATUS_OK) { if_printf(sc->hn_ifp, "rxbuf conn failed: %x\n", status); error = EIO; goto cleanup; } - net_dev->rx_section_count = 1; + sc->hn_flags |= HN_FLAG_RXBUF_CONNECTED; return (0); cleanup: - hv_nv_destroy_rx_buffer(net_dev); + if (xact != NULL) + vmbus_xact_put(xact); + hv_nv_destroy_rx_buffer(sc); return (error); } @@ -255,28 +228,13 @@ cleanup: static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc) { - struct hn_send_ctx sndc; - struct vmbus_xact *xact; + struct vmbus_xact *xact = NULL; struct hn_nvs_chim_conn *chim; const struct hn_nvs_chim_connresp *resp; size_t resp_len; uint32_t status, sectsz; - netvsc_dev *net_dev; int error; - net_dev = hv_nv_get_outbound_net_device(sc); - if (!net_dev) { - return (ENODEV); - } - - net_dev->send_buf = hyperv_dmamem_alloc(bus_get_dma_tag(sc->hn_dev), - PAGE_SIZE, 0, net_dev->send_buf_size, &net_dev->txbuf_dma, - BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (net_dev->send_buf == NULL) { - device_printf(sc->hn_dev, "allocate chimney txbuf failed\n"); - return (ENOMEM); - } - /* * Connect chimney sending buffer GPADL to the primary channel. * @@ -285,8 +243,8 @@ hv_nv_init_send_buffer_with_net_vsp(stru * Sub-channels just share this chimney sending buffer. */ error = vmbus_chan_gpadl_connect(sc->hn_prichan, - net_dev->txbuf_dma.hv_paddr, net_dev->send_buf_size, - &net_dev->send_buf_gpadl_handle); + sc->hn_chim_dma.hv_paddr, NETVSC_SEND_BUFFER_SIZE, + &sc->hn_chim_gpadl); if (error) { if_printf(sc->hn_ifp, "chimney sending buffer gpadl " "connect failed: %d\n", error); @@ -303,37 +261,26 @@ hv_nv_init_send_buffer_with_net_vsp(stru error = ENXIO; goto cleanup; } - chim = vmbus_xact_req_data(xact); chim->nvs_type = HN_NVS_TYPE_CHIM_CONN; - chim->nvs_gpadl = net_dev->send_buf_gpadl_handle; + chim->nvs_gpadl = sc->hn_chim_gpadl; chim->nvs_sig = HN_NVS_CHIM_SIG; - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); - vmbus_xact_activate(xact); - - error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, - chim, sizeof(*chim), &sndc); - if (error) { - if_printf(sc->hn_ifp, "send nvs chim conn failed: %d\n", - error); - vmbus_xact_deactivate(xact); - vmbus_xact_put(xact); + resp = hn_nvs_xact_execute(sc, xact, chim, sizeof(*chim), &resp_len); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec chim conn failed\n"); + error = EIO; goto cleanup; } - - resp = vmbus_xact_wait(xact, &resp_len); if (resp_len < sizeof(*resp)) { if_printf(sc->hn_ifp, "invalid chim conn resp length %zu\n", resp_len); - vmbus_xact_put(xact); error = EINVAL; goto cleanup; } if (resp->nvs_type != HN_NVS_TYPE_CHIM_CONNRESP) { if_printf(sc->hn_ifp, "not chim conn resp, type %u\n", resp->nvs_type); - vmbus_xact_put(xact); error = EINVAL; goto cleanup; } @@ -341,6 +288,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru status = resp->nvs_status; sectsz = resp->nvs_sectsz; vmbus_xact_put(xact); + xact = NULL; if (status != HN_NVS_STATUS_OK) { if_printf(sc->hn_ifp, "chim conn failed: %x\n", status); @@ -353,23 +301,33 @@ hv_nv_init_send_buffer_with_net_vsp(stru return 0; } - net_dev->send_section_size = sectsz; - net_dev->send_section_count = - net_dev->send_buf_size / net_dev->send_section_size; - net_dev->bitsmap_words = howmany(net_dev->send_section_count, - BITS_PER_LONG); - net_dev->send_section_bitsmap = - malloc(net_dev->bitsmap_words * sizeof(long), M_NETVSC, - M_WAITOK | M_ZERO); + sc->hn_chim_szmax = sectsz; + sc->hn_chim_cnt = NETVSC_SEND_BUFFER_SIZE / sc->hn_chim_szmax; + if (NETVSC_SEND_BUFFER_SIZE % sc->hn_chim_szmax != 0) { + if_printf(sc->hn_ifp, "chimney sending sections are " + "not properly aligned\n"); + } + if (sc->hn_chim_cnt % LONG_BIT != 0) { + if_printf(sc->hn_ifp, "discard %d chimney sending sections\n", + sc->hn_chim_cnt % LONG_BIT); + } + + sc->hn_chim_bmap_cnt = sc->hn_chim_cnt / LONG_BIT; + sc->hn_chim_bmap = malloc(sc->hn_chim_bmap_cnt * sizeof(u_long), + M_NETVSC, M_WAITOK | M_ZERO); + /* Done! */ + sc->hn_flags |= HN_FLAG_CHIM_CONNECTED; if (bootverbose) { - if_printf(sc->hn_ifp, "chimney sending buffer %u/%u\n", - net_dev->send_section_size, net_dev->send_section_count); + if_printf(sc->hn_ifp, "chimney sending buffer %d/%d\n", + sc->hn_chim_szmax, sc->hn_chim_cnt); } return 0; cleanup: - hv_nv_destroy_send_buffer(net_dev); + if (xact != NULL) + vmbus_xact_put(xact); + hv_nv_destroy_send_buffer(sc); return (error); } @@ -377,11 +335,11 @@ cleanup: * Net VSC destroy receive buffer */ static int -hv_nv_destroy_rx_buffer(netvsc_dev *net_dev) +hv_nv_destroy_rx_buffer(struct hn_softc *sc) { int ret = 0; - if (net_dev->rx_section_count) { + if (sc->hn_flags & HN_FLAG_RXBUF_CONNECTED) { struct hn_nvs_rxbuf_disconn disconn; /* @@ -392,37 +350,28 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ disconn.nvs_sig = HN_NVS_RXBUF_SIG; /* NOTE: No response. */ - ret = hn_nvs_send(net_dev->sc->hn_prichan, - VMBUS_CHANPKT_FLAG_NONE, &disconn, sizeof(disconn), - &hn_send_ctx_none); + ret = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); if (ret != 0) { - if_printf(net_dev->sc->hn_ifp, + if_printf(sc->hn_ifp, "send rxbuf disconn failed: %d\n", ret); return (ret); } - net_dev->rx_section_count = 0; + sc->hn_flags &= ~HN_FLAG_RXBUF_CONNECTED; } - /* Tear down the gpadl on the vsp end */ - if (net_dev->rx_buf_gpadl_handle) { - ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, - net_dev->rx_buf_gpadl_handle); + if (sc->hn_rxbuf_gpadl != 0) { /* - * If we failed here, we might as well return and have a leak - * rather than continue and a bugchk + * Disconnect RXBUF from primary channel. */ + ret = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_rxbuf_gpadl); if (ret != 0) { + if_printf(sc->hn_ifp, + "rxbuf disconn failed: %d\n", ret); return (ret); } - net_dev->rx_buf_gpadl_handle = 0; - } - - if (net_dev->rx_buf) { - /* Free up the receive buffer */ - hyperv_dmamem_free(&net_dev->rxbuf_dma, net_dev->rx_buf); - net_dev->rx_buf = NULL; + sc->hn_rxbuf_gpadl = 0; } - return (ret); } @@ -430,11 +379,11 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_ * Net VSC destroy send buffer */ static int -hv_nv_destroy_send_buffer(netvsc_dev *net_dev) +hv_nv_destroy_send_buffer(struct hn_softc *sc) { int ret = 0; - if (net_dev->send_section_size) { + if (sc->hn_flags & HN_FLAG_CHIM_CONNECTED) { struct hn_nvs_chim_disconn disconn; /* @@ -445,80 +394,62 @@ hv_nv_destroy_send_buffer(netvsc_dev *ne disconn.nvs_sig = HN_NVS_CHIM_SIG; /* NOTE: No response. */ - ret = hn_nvs_send(net_dev->sc->hn_prichan, - VMBUS_CHANPKT_FLAG_NONE, &disconn, sizeof(disconn), - &hn_send_ctx_none); + ret = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); if (ret != 0) { - if_printf(net_dev->sc->hn_ifp, + if_printf(sc->hn_ifp, "send chim disconn failed: %d\n", ret); return (ret); } + sc->hn_flags &= ~HN_FLAG_CHIM_CONNECTED; } - /* Tear down the gpadl on the vsp end */ - if (net_dev->send_buf_gpadl_handle) { - ret = vmbus_chan_gpadl_disconnect(net_dev->sc->hn_prichan, - net_dev->send_buf_gpadl_handle); - + if (sc->hn_chim_gpadl != 0) { /* - * If we failed here, we might as well return and have a leak - * rather than continue and a bugchk + * Disconnect chimney sending buffer from primary channel. */ + ret = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_chim_gpadl); if (ret != 0) { + if_printf(sc->hn_ifp, + "chim disconn failed: %d\n", ret); return (ret); } - net_dev->send_buf_gpadl_handle = 0; - } - - if (net_dev->send_buf) { - /* Free up the receive buffer */ - hyperv_dmamem_free(&net_dev->txbuf_dma, net_dev->send_buf); - net_dev->send_buf = NULL; + sc->hn_chim_gpadl = 0; } - if (net_dev->send_section_bitsmap) { - free(net_dev->send_section_bitsmap, M_NETVSC); + if (sc->hn_chim_bmap != NULL) { + free(sc->hn_chim_bmap, M_NETVSC); + sc->hn_chim_bmap = NULL; } return (ret); } static int -hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, netvsc_dev *net_dev, - uint32_t nvs_ver) +hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, uint32_t nvs_ver) { - struct hn_send_ctx sndc; struct vmbus_xact *xact; struct hn_nvs_init *init; const struct hn_nvs_init_resp *resp; size_t resp_len; uint32_t status; - int error; xact = vmbus_xact_get(sc->hn_xact, sizeof(*init)); if (xact == NULL) { if_printf(sc->hn_ifp, "no xact for nvs init\n"); return (ENXIO); } - init = vmbus_xact_req_data(xact); init->nvs_type = HN_NVS_TYPE_INIT; init->nvs_ver_min = nvs_ver; init->nvs_ver_max = nvs_ver; - vmbus_xact_activate(xact); - hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); - - error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, - init, sizeof(*init), &sndc); - if (error) { - if_printf(sc->hn_ifp, "send nvs init failed: %d\n", error); - vmbus_xact_deactivate(xact); + resp = hn_nvs_xact_execute(sc, xact, init, sizeof(*init), &resp_len); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec init failed\n"); vmbus_xact_put(xact); - return (error); + return (EIO); } - - resp = vmbus_xact_wait(xact, &resp_len); if (resp_len < sizeof(*resp)) { if_printf(sc->hn_ifp, "invalid init resp length %zu\n", resp_len); @@ -560,8 +491,7 @@ hv_nv_send_ndis_config(struct hn_softc * conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; /* NOTE: No response. */ - error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, - &conf, sizeof(conf), &hn_send_ctx_none); + error = hn_nvs_req_send(sc, &conf, sizeof(conf)); if (error) if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); return (error); @@ -573,7 +503,6 @@ hv_nv_send_ndis_config(struct hn_softc * static int hv_nv_connect_to_vsp(struct hn_softc *sc) { - netvsc_dev *net_dev; uint32_t protocol_list[] = { NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, NVSP_PROTOCOL_VERSION_4, @@ -584,19 +513,18 @@ hv_nv_connect_to_vsp(struct hn_softc *sc device_t dev = sc->hn_dev; struct ifnet *ifp = sc->hn_ifp; struct hn_nvs_ndis_init ndis; - - net_dev = hv_nv_get_outbound_net_device(sc); + int rxbuf_size; /* * Negotiate the NVSP version. Try the latest NVSP first. */ for (i = protocol_number - 1; i >= 0; i--) { - if (hv_nv_negotiate_nvsp_protocol(sc, net_dev, - protocol_list[i]) == 0) { - net_dev->nvsp_version = protocol_list[i]; - if (bootverbose) - device_printf(dev, "Netvsc: got version 0x%x\n", - net_dev->nvsp_version); + if (hv_nv_negotiate_nvsp_protocol(sc, protocol_list[i]) == 0) { + sc->hn_nvs_ver = protocol_list[i]; + if (bootverbose) { + device_printf(dev, "NVS version 0x%x\n", + sc->hn_nvs_ver); + } break; } } @@ -612,7 +540,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc * Set the MTU if supported by this NVSP protocol version * This needs to be right after the NVSP init message per Haiyang */ - if (net_dev->nvsp_version >= NVSP_PROTOCOL_VERSION_2) + if (sc->hn_nvs_ver >= NVSP_PROTOCOL_VERSION_2) ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); /* @@ -622,27 +550,25 @@ hv_nv_connect_to_vsp(struct hn_softc *sc memset(&ndis, 0, sizeof(ndis)); ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; ndis.nvs_ndis_major = NDIS_VERSION_MAJOR_6; - if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_4) + if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_1; else ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30; /* NOTE: No response. */ - ret = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_NONE, - &ndis, sizeof(ndis), &hn_send_ctx_none); + ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); if (ret != 0) { if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret); goto cleanup; } /* Post the big receive buffer to NetVSP */ - if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_2) - net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; + if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; else - net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE; - net_dev->send_buf_size = NETVSC_SEND_BUFFER_SIZE; + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; - ret = hv_nv_init_rx_buffer_with_net_vsp(sc); + ret = hv_nv_init_rx_buffer_with_net_vsp(sc, rxbuf_size); if (ret == 0) ret = hv_nv_init_send_buffer_with_net_vsp(sc); @@ -654,10 +580,10 @@ cleanup: * Net VSC disconnect from VSP */ static void -hv_nv_disconnect_from_vsp(netvsc_dev *net_dev) +hv_nv_disconnect_from_vsp(struct hn_softc *sc) { - hv_nv_destroy_rx_buffer(net_dev); - hv_nv_destroy_send_buffer(net_dev); + hv_nv_destroy_rx_buffer(sc); + hv_nv_destroy_send_buffer(sc); } void @@ -676,20 +602,12 @@ hv_nv_subchan_attach(struct vmbus_channe * * Callback when the device belonging to this driver is added */ -netvsc_dev * -hv_nv_on_device_add(struct hn_softc *sc, void *additional_info, - struct hn_rx_ring *rxr) +int +hv_nv_on_device_add(struct hn_softc *sc, struct hn_rx_ring *rxr) { struct vmbus_channel *chan = sc->hn_prichan; - netvsc_dev *net_dev; int ret = 0; - net_dev = hv_nv_alloc_net_device(sc); - if (net_dev == NULL) - return NULL; - - /* Initialize the NetVSC channel extension */ - /* * Open the channel */ @@ -709,20 +627,13 @@ hv_nv_on_device_add(struct hn_softc *sc, if (ret != 0) goto close; - return (net_dev); + return (0); close: /* Now, we can close the channel safely */ vmbus_chan_close(chan); - cleanup: - /* - * Free the packet buffers on the netvsc device packet queue. - * Release other resources. - */ - free(net_dev, M_NETVSC); - - return (NULL); + return (ret); } /* @@ -731,27 +642,19 @@ cleanup: int hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) { - netvsc_dev *net_dev = sc->net_dev;; - /* Stop outbound traffic ie sends and receives completions */ - net_dev->destroy = TRUE; - - hv_nv_disconnect_from_vsp(net_dev); - - /* At this point, no one should be accessing net_dev except in here */ + hv_nv_disconnect_from_vsp(sc); /* Now, we can close the channel safely */ vmbus_chan_close(sc->hn_prichan); - free(net_dev, M_NETVSC); - return (0); } -void +static void hn_nvs_sent_xact(struct hn_send_ctx *sndc, - struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused, + struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, const void *data, int dlen) { @@ -760,42 +663,42 @@ hn_nvs_sent_xact(struct hn_send_ctx *snd static void hn_nvs_sent_none(struct hn_send_ctx *sndc __unused, - struct netvsc_dev_ *net_dev __unused, struct vmbus_channel *chan __unused, + struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, const void *data __unused, int dlen __unused) { /* EMPTY */ } void -hn_chim_free(struct netvsc_dev_ *net_dev, uint32_t chim_idx) +hn_chim_free(struct hn_softc *sc, uint32_t chim_idx) { u_long mask; uint32_t idx; - idx = chim_idx / BITS_PER_LONG; - KASSERT(idx < net_dev->bitsmap_words, + idx = chim_idx / LONG_BIT; + KASSERT(idx < sc->hn_chim_bmap_cnt, ("invalid chimney index 0x%x", chim_idx)); - mask = 1UL << (chim_idx % BITS_PER_LONG); - KASSERT(net_dev->send_section_bitsmap[idx] & mask, + mask = 1UL << (chim_idx % LONG_BIT); + KASSERT(sc->hn_chim_bmap[idx] & mask, ("index bitmap 0x%lx, chimney index %u, " "bitmap idx %d, bitmask 0x%lx", - net_dev->send_section_bitsmap[idx], chim_idx, idx, mask)); + sc->hn_chim_bmap[idx], chim_idx, idx, mask)); - atomic_clear_long(&net_dev->send_section_bitsmap[idx], mask); + atomic_clear_long(&sc->hn_chim_bmap[idx], mask); } /* * Net VSC on send completion */ static void -hv_nv_on_send_completion(netvsc_dev *net_dev, struct vmbus_channel *chan, +hv_nv_on_send_completion(struct hn_softc *sc, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkt) { struct hn_send_ctx *sndc; sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; - sndc->hn_cb(sndc, net_dev, chan, VMBUS_CHANPKT_CONST_DATA(pkt), + sndc->hn_cb(sndc, sc, chan, VMBUS_CHANPKT_CONST_DATA(pkt), VMBUS_CHANPKT_DATALEN(pkt)); /* * NOTE: @@ -839,7 +742,7 @@ hv_nv_on_send(struct vmbus_channel *chan * with virtual addresses. */ static void -hv_nv_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, +hv_nv_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { const struct vmbus_chanpkt_rxbuf *pkt; @@ -867,8 +770,8 @@ hv_nv_on_receive(netvsc_dev *net_dev, st /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ for (i = 0; i < count; i++) { - hv_rf_on_receive(net_dev, rxr, - (const uint8_t *)net_dev->rx_buf + pkt->cp_rxbuf[i].rb_ofs, + hv_rf_on_receive(sc, rxr, + rxr->hn_rxbuf + pkt->cp_rxbuf[i].rb_ofs, pkt->cp_rxbuf[i].rb_len); } @@ -934,14 +837,9 @@ hv_nv_on_channel_callback(struct vmbus_c { struct hn_rx_ring *rxr = xrxr; struct hn_softc *sc = rxr->hn_ifp->if_softc; - netvsc_dev *net_dev; void *buffer; int bufferlen = NETVSC_PACKET_SIZE; - net_dev = hv_nv_get_inbound_net_device(sc); - if (net_dev == NULL) - return; - buffer = rxr->hn_rdbuf; do { struct vmbus_chanpkt_hdr *pkt = buffer; @@ -954,11 +852,10 @@ hv_nv_on_channel_callback(struct vmbus_c if (bytes_rxed > 0) { switch (pkt->cph_type) { case VMBUS_CHANPKT_TYPE_COMP: - hv_nv_on_send_completion(net_dev, chan, - pkt); + hv_nv_on_send_completion(sc, chan, pkt); break; case VMBUS_CHANPKT_TYPE_RXBUF: - hv_nv_on_receive(net_dev, rxr, chan, pkt); + hv_nv_on_receive(sc, rxr, chan, pkt); break; case VMBUS_CHANPKT_TYPE_INBAND: hn_proc_notify(sc, pkt); Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 06:18:10 2016 (r307479) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 06:47:34 2016 (r307480) @@ -212,40 +212,6 @@ typedef struct rndis_recv_scale_param_ { * Data types */ -/* - * Per netvsc channel-specific - */ -typedef struct netvsc_dev_ { - struct hn_softc *sc; - - /* Send buffer allocated by us but manages by NetVSP */ - void *send_buf; - uint32_t send_buf_size; - uint32_t send_buf_gpadl_handle; - uint32_t send_section_size; - uint32_t send_section_count; - unsigned long bitsmap_words; - unsigned long *send_section_bitsmap; - - /* Receive buffer allocated by us but managed by NetVSP */ - void *rx_buf; - uint32_t rx_buf_size; - uint32_t rx_buf_gpadl_handle; - uint32_t rx_section_count; - - /* Holds rndis device info */ - void *extension; - - uint8_t destroy; - /* Negotiated NVSP version */ - uint32_t nvsp_version; - - uint32_t num_channel; - - struct hyperv_dma rxbuf_dma; - struct hyperv_dma txbuf_dma; -} netvsc_dev; - struct vmbus_channel; typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); @@ -268,12 +234,6 @@ typedef void (*pfn_on_send_rx_completion #define TRANSPORT_TYPE_IPV6_TCP ((TYPE_IPV6 << 16) | TYPE_TCP) #define TRANSPORT_TYPE_IPV6_UDP ((TYPE_IPV6 << 16) | TYPE_UDP) -#ifdef __LP64__ -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif - typedef struct { uint8_t mac_addr[6]; /* Assumption unsigned long */ uint8_t link_state; @@ -292,6 +252,7 @@ struct hn_rx_ring { struct ifnet *hn_ifp; struct hn_tx_ring *hn_txr; void *hn_rdbuf; + uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; /* Trust csum verification on host side */ @@ -345,7 +306,7 @@ struct hn_tx_ring { struct vmbus_channel *hn_chan; int hn_direct_tx_size; - int hn_tx_chimney_size; + int hn_chim_size; bus_dma_tag_t hn_tx_data_dtag; uint64_t hn_csum_assist; @@ -383,7 +344,7 @@ typedef struct hn_softc { int hn_initdone; /* See hv_netvsc_drv_freebsd.c for rules on how to use */ int temp_unusable; - netvsc_dev *net_dev; + struct rndis_device_ *rndis_dev; struct vmbus_channel *hn_prichan; int hn_rx_ring_cnt; @@ -394,14 +355,31 @@ typedef struct hn_softc { int hn_tx_ring_inuse; struct hn_tx_ring *hn_tx_ring; + uint8_t *hn_chim; + u_long *hn_chim_bmap; + int hn_chim_bmap_cnt; + int hn_chim_cnt; + int hn_chim_szmax; + int hn_cpu; - int hn_tx_chimney_max; struct taskqueue *hn_tx_taskq; struct sysctl_oid *hn_tx_sysctl_tree; struct sysctl_oid *hn_rx_sysctl_tree; struct vmbus_xact_ctx *hn_xact; + uint32_t hn_nvs_ver; + + uint32_t hn_flags; + void *hn_rxbuf; + uint32_t hn_rxbuf_gpadl; + struct hyperv_dma hn_rxbuf_dma; + + uint32_t hn_chim_gpadl; + struct hyperv_dma hn_chim_dma; } hn_softc_t; +#define HN_FLAG_RXBUF_CONNECTED 0x0001 +#define HN_FLAG_CHIM_CONNECTED 0x0002 + /* * Externs */ @@ -409,13 +387,11 @@ extern int hv_promisc_mode; struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); -netvsc_dev *hv_nv_on_device_add(struct hn_softc *sc, - void *additional_info, struct hn_rx_ring *rxr); +int hv_nv_on_device_add(struct hn_softc *sc, struct hn_rx_ring *rxr); int hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); -int hv_nv_get_next_send_section(netvsc_dev *net_dev); void hv_nv_subchan_attach(struct vmbus_channel *chan, struct hn_rx_ring *rxr); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 06:18:10 2016 (r307479) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 06:47:34 2016 (r307480) @@ -328,7 +328,7 @@ static int hn_lro_lenlim_sysctl(SYSCTL_H static int hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS); #endif static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_tx_chimney_size_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS); static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); @@ -342,9 +342,9 @@ static void hn_start_taskfunc(void *, in static void hn_start_txeof_taskfunc(void *, int); static void hn_stop_tx_tasks(struct hn_softc *); static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); -static void hn_create_rx_data(struct hn_softc *sc, int); +static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); -static void hn_set_tx_chimney_size(struct hn_softc *, int); +static void hn_set_chim_size(struct hn_softc *, int); static void hn_channel_attach(struct hn_softc *, struct vmbus_channel *); static void hn_subchan_attach(struct hn_softc *, struct vmbus_channel *); static void hn_subchan_setup(struct hn_softc *); @@ -504,7 +504,9 @@ netvsc_attach(device_t dev) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 06:56:59 2016 Return-Path: Delivered-To: svn-src-all@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 9D200C15C8B; Mon, 17 Oct 2016 06:56:59 +0000 (UTC) (envelope-from sephe@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 6B80F106D; Mon, 17 Oct 2016 06:56:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H6uweO097774; Mon, 17 Oct 2016 06:56:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H6uwag097771; Mon, 17 Oct 2016 06:56:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170656.u9H6uwag097771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 06:56:58 +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: r307481 - in stable/11/sys: dev/usb/net 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 06:56:59 -0000 Author: sephe Date: Mon Oct 17 06:56:58 2016 New Revision: 307481 URL: https://svnweb.freebsd.org/changeset/base/307481 Log: MFC 304654,304722,304723 304654 net: Split RNDIS protocol structs/macros out of dev/usb/net/if_urndisreg.h So that Hyper-V can leverage them instead of rolling its own definition. Discussed with: hps Reviewed by: hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7592 304722 net/rndis: Add canonical RNDIS major/minor version as of today. Reviewed by: hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7593 304723 net/rndis: Fix RNDIS_STATUS_PENDING definition. While I'm here, sort the RNDIS status in ascending order. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7594 Added: stable/11/sys/net/rndis.h - copied, changed from r304654, head/sys/net/rndis.h Modified: stable/11/sys/dev/usb/net/if_urndis.c stable/11/sys/dev/usb/net/if_urndisreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_urndis.c ============================================================================== --- stable/11/sys/dev/usb/net/if_urndis.c Mon Oct 17 06:47:34 2016 (r307480) +++ stable/11/sys/dev/usb/net/if_urndis.c Mon Oct 17 06:56:58 2016 (r307481) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -79,17 +80,17 @@ static uether_fn_t urndis_setmulti; static uether_fn_t urndis_setpromisc; static uint32_t urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, - struct urndis_query_req *msg, uint16_t len, + struct rndis_query_req *msg, uint16_t len, const void **rbuf, uint16_t *rbufsz); static uint32_t urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, - struct urndis_set_req *msg, uint16_t len); + struct rndis_set_req *msg, uint16_t len); static uint32_t urndis_ctrl_handle_init(struct urndis_softc *sc, - const struct urndis_comp_hdr *hdr); + const struct rndis_comp_hdr *hdr); static uint32_t urndis_ctrl_handle_query(struct urndis_softc *sc, - const struct urndis_comp_hdr *hdr, const void **buf, + const struct rndis_comp_hdr *hdr, const void **buf, uint16_t *bufsz); static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *sc, - const struct urndis_comp_hdr *hdr); + const struct rndis_comp_hdr *hdr); static uint32_t urndis_ctrl_init(struct urndis_softc *sc); static uint32_t urndis_ctrl_halt(struct urndis_softc *sc); @@ -212,8 +213,8 @@ urndis_attach(device_t dev) { static struct { union { - struct urndis_query_req query; - struct urndis_set_req set; + struct rndis_query_req query; + struct rndis_set_req set; } hdr; union { uint8_t eaddr[ETHER_ADDR_LEN]; @@ -453,10 +454,10 @@ urndis_ctrl_send(struct urndis_softc *sc return (err); } -static struct urndis_comp_hdr * +static struct rndis_comp_hdr * urndis_ctrl_recv(struct urndis_softc *sc) { - struct urndis_comp_hdr *hdr; + struct rndis_comp_hdr *hdr; usb_error_t err; err = urndis_ctrl_msg(sc, UT_READ_CLASS_INTERFACE, @@ -466,7 +467,7 @@ urndis_ctrl_recv(struct urndis_softc *sc if (err != USB_ERR_NORMAL_COMPLETION) return (NULL); - hdr = (struct urndis_comp_hdr *)sc->sc_response_buf; + hdr = (struct rndis_comp_hdr *)sc->sc_response_buf; DPRINTF("type 0x%x len %u\n", le32toh(hdr->rm_type), le32toh(hdr->rm_len)); @@ -480,7 +481,7 @@ urndis_ctrl_recv(struct urndis_softc *sc } static uint32_t -urndis_ctrl_handle(struct urndis_softc *sc, struct urndis_comp_hdr *hdr, +urndis_ctrl_handle(struct urndis_softc *sc, struct rndis_comp_hdr *hdr, const void **buf, uint16_t *bufsz) { uint32_t rval; @@ -521,11 +522,11 @@ urndis_ctrl_handle(struct urndis_softc * static uint32_t urndis_ctrl_handle_init(struct urndis_softc *sc, - const struct urndis_comp_hdr *hdr) + const struct rndis_comp_hdr *hdr) { - const struct urndis_init_comp *msg; + const struct rndis_init_comp *msg; - msg = (const struct urndis_init_comp *)hdr; + msg = (const struct rndis_init_comp *)hdr; DPRINTF("len %u rid %u status 0x%x " "ver_major %u ver_minor %u devflags 0x%x medium 0x%x pktmaxcnt %u " @@ -564,12 +565,12 @@ urndis_ctrl_handle_init(struct urndis_so static uint32_t urndis_ctrl_handle_query(struct urndis_softc *sc, - const struct urndis_comp_hdr *hdr, const void **buf, uint16_t *bufsz) + const struct rndis_comp_hdr *hdr, const void **buf, uint16_t *bufsz) { - const struct urndis_query_comp *msg; + const struct rndis_query_comp *msg; uint64_t limit; - msg = (const struct urndis_query_comp *)hdr; + msg = (const struct rndis_query_comp *)hdr; DPRINTF("len %u rid %u status 0x%x " "buflen %u bufoff %u\n", @@ -609,12 +610,12 @@ urndis_ctrl_handle_query(struct urndis_s static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *sc, - const struct urndis_comp_hdr *hdr) + const struct rndis_comp_hdr *hdr) { - const struct urndis_reset_comp *msg; + const struct rndis_reset_comp *msg; uint32_t rval; - msg = (const struct urndis_reset_comp *)hdr; + msg = (const struct rndis_reset_comp *)hdr; rval = le32toh(msg->rm_status); @@ -630,7 +631,7 @@ urndis_ctrl_handle_reset(struct urndis_s } if (msg->rm_adrreset != 0) { struct { - struct urndis_set_req hdr; + struct rndis_set_req hdr; uint32_t filter; } msg_filter; @@ -650,14 +651,14 @@ urndis_ctrl_handle_reset(struct urndis_s static uint32_t urndis_ctrl_init(struct urndis_softc *sc) { - struct urndis_init_req msg; - struct urndis_comp_hdr *hdr; + struct rndis_init_req msg; + struct rndis_comp_hdr *hdr; uint32_t rval; msg.rm_type = htole32(REMOTE_NDIS_INITIALIZE_MSG); msg.rm_len = htole32(sizeof(msg)); msg.rm_rid = 0; - msg.rm_ver_major = htole32(1); + msg.rm_ver_major = htole32(RNDIS_VERSION_MAJOR); msg.rm_ver_minor = htole32(1); msg.rm_max_xfersz = htole32(RNDIS_RX_MAXLEN); @@ -688,7 +689,7 @@ urndis_ctrl_init(struct urndis_softc *sc static uint32_t urndis_ctrl_halt(struct urndis_softc *sc) { - struct urndis_halt_req msg; + struct rndis_halt_req msg; uint32_t rval; msg.rm_type = htole32(REMOTE_NDIS_HALT_MSG); @@ -714,10 +715,10 @@ urndis_ctrl_halt(struct urndis_softc *sc */ static uint32_t urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, - struct urndis_query_req *msg, uint16_t len, const void **rbuf, + struct rndis_query_req *msg, uint16_t len, const void **rbuf, uint16_t *rbufsz) { - struct urndis_comp_hdr *hdr; + struct rndis_comp_hdr *hdr; uint32_t datalen, rval; msg->rm_type = htole32(REMOTE_NDIS_QUERY_MSG); @@ -761,9 +762,9 @@ urndis_ctrl_query(struct urndis_softc *s static uint32_t urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, - struct urndis_set_req *msg, uint16_t len) + struct rndis_set_req *msg, uint16_t len) { - struct urndis_comp_hdr *hdr; + struct rndis_comp_hdr *hdr; uint32_t datalen, rval; msg->rm_type = htole32(REMOTE_NDIS_SET_MSG); @@ -813,7 +814,7 @@ urndis_bulk_read_callback(struct usb_xfe struct urndis_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc = usbd_xfer_get_frame(xfer, 0); struct ifnet *ifp = uether_getifp(&sc->sc_ue); - struct urndis_packet_msg msg; + struct rndis_packet_msg msg; struct mbuf *m; int actlen; int aframes; @@ -873,11 +874,11 @@ urndis_bulk_read_callback(struct usb_xfe "datalen %u\n", msg.rm_datalen, actlen); goto tr_setup; } else if ((msg.rm_dataoffset + msg.rm_datalen + - (uint32_t)__offsetof(struct urndis_packet_msg, + (uint32_t)__offsetof(struct rndis_packet_msg, rm_dataoffset)) > (uint32_t)actlen) { DPRINTF("invalid dataoffset %u larger than %u\n", msg.rm_dataoffset + msg.rm_datalen + - (uint32_t)__offsetof(struct urndis_packet_msg, + (uint32_t)__offsetof(struct rndis_packet_msg, rm_dataoffset), actlen); goto tr_setup; } else if (msg.rm_datalen < (uint32_t)sizeof(struct ether_header)) { @@ -903,7 +904,7 @@ urndis_bulk_read_callback(struct usb_xfe m_adj(m, ETHER_ALIGN); usbd_copy_out(pc, offset + msg.rm_dataoffset + - __offsetof(struct urndis_packet_msg, + __offsetof(struct rndis_packet_msg, rm_dataoffset), m->m_data, msg.rm_datalen); /* enqueue */ @@ -939,7 +940,7 @@ tr_setup: static void urndis_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { - struct urndis_packet_msg msg; + struct rndis_packet_msg msg; struct urndis_softc *sc = usbd_xfer_softc(xfer); struct ifnet *ifp = uether_getifp(&sc->sc_ue); struct mbuf *m; Modified: stable/11/sys/dev/usb/net/if_urndisreg.h ============================================================================== --- stable/11/sys/dev/usb/net/if_urndisreg.h Mon Oct 17 06:47:34 2016 (r307480) +++ stable/11/sys/dev/usb/net/if_urndisreg.h Mon Oct 17 06:56:58 2016 (r307481) @@ -55,242 +55,4 @@ struct urndis_softc { #define URNDIS_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) #define URNDIS_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->sc_mtx, (what)) -#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L -#define RNDIS_STATUS_FAILURE 0xC0000001L -#define RNDIS_STATUS_INVALID_DATA 0xC0010015L -#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL -#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL -#define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBL -#define RNDIS_STATUS_PENDING STATUS_PENDING /* XXX */ -#define RNDIS_STATUS_RESOURCES 0xC000009AL -#define RNDIS_STATUS_SUCCESS 0x00000000L - -#define OID_GEN_SUPPORTED_LIST 0x00010101 -#define OID_GEN_HARDWARE_STATUS 0x00010102 -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_MEDIA_IN_USE 0x00010104 -#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 -#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 -#define OID_GEN_LINK_SPEED 0x00010107 -#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 -#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 -#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A -#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B -#define OID_GEN_VENDOR_ID 0x0001010C -#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F -#define OID_GEN_DRIVER_VERSION 0x00010110 -#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 -#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 -#define OID_GEN_MAC_OPTIONS 0x00010113 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 -#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 -#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 -#define OID_GEN_SUPPORTED_GUIDS 0x00010117 -#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 -#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 -#define OID_GEN_MACHINE_NAME 0x0001021A -#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B -#define OID_GEN_VLAN_ID 0x0001021C - -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 -#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 -#define OID_802_3_MAC_OPTIONS 0x01010105 -#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 -#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 -#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 -#define OID_802_3_XMIT_DEFERRED 0x01020201 -#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 -#define OID_802_3_RCV_OVERRUN 0x01020203 -#define OID_802_3_XMIT_UNDERRUN 0x01020204 -#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 -#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 -#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 - -#define RNDIS_MEDIUM_802_3 0x00000000 - -/* Device flags */ -#define RNDIS_DF_CONNECTIONLESS 0x00000001 -#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002 - -/* - * RNDIS data message - */ -#define REMOTE_NDIS_PACKET_MSG 0x00000001 - -struct urndis_packet_msg { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_dataoffset; - uint32_t rm_datalen; - uint32_t rm_oobdataoffset; - uint32_t rm_oobdatalen; - uint32_t rm_oobdataelements; - uint32_t rm_pktinfooffset; - uint32_t rm_pktinfolen; - uint32_t rm_vchandle; - uint32_t rm_reserved; -}; - -/* - * RNDIS control messages - */ -struct urndis_comp_hdr { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_status; -}; - -/* Initialize the device. */ -#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002 -#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002 - -struct urndis_init_req { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_ver_major; - uint32_t rm_ver_minor; - uint32_t rm_max_xfersz; -}; - -struct urndis_init_comp { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_status; - uint32_t rm_ver_major; - uint32_t rm_ver_minor; - uint32_t rm_devflags; - uint32_t rm_medium; - uint32_t rm_pktmaxcnt; - uint32_t rm_pktmaxsz; - uint32_t rm_align; - uint32_t rm_aflistoffset; - uint32_t rm_aflistsz; -}; - -/* Halt the device. No response sent. */ -#define REMOTE_NDIS_HALT_MSG 0x00000003 - -struct urndis_halt_req { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; -}; - -/* Send a query object. */ -#define REMOTE_NDIS_QUERY_MSG 0x00000004 -#define REMOTE_NDIS_QUERY_CMPLT 0x80000004 - -struct urndis_query_req { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_oid; - uint32_t rm_infobuflen; - uint32_t rm_infobufoffset; - uint32_t rm_devicevchdl; -}; - -struct urndis_query_comp { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_status; - uint32_t rm_infobuflen; - uint32_t rm_infobufoffset; -}; - -/* Send a set object request. */ -#define REMOTE_NDIS_SET_MSG 0x00000005 -#define REMOTE_NDIS_SET_CMPLT 0x80000005 - -struct urndis_set_req { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_oid; - uint32_t rm_infobuflen; - uint32_t rm_infobufoffset; - uint32_t rm_devicevchdl; -}; - -struct urndis_set_comp { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_status; -}; - -#define REMOTE_NDIS_SET_PARAM_NUMERIC 0x00000000 -#define REMOTE_NDIS_SET_PARAM_STRING 0x00000002 - -struct urndis_set_parameter { - uint32_t rm_nameoffset; - uint32_t rm_namelen; - uint32_t rm_type; - uint32_t rm_valueoffset; - uint32_t rm_valuelen; -}; - -/* Perform a soft reset on the device. */ -#define REMOTE_NDIS_RESET_MSG 0x00000006 -#define REMOTE_NDIS_RESET_CMPLT 0x80000006 - -struct urndis_reset_req { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; -}; - -struct urndis_reset_comp { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_status; - uint32_t rm_adrreset; -}; - -/* 802.3 link-state or undefined message error. */ -#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007 - -/* Keepalive messsage. May be sent by device. */ -#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008 -#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008 - -struct urndis_keepalive_req { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; -}; - -struct urndis_keepalive_comp { - uint32_t rm_type; - uint32_t rm_len; - uint32_t rm_rid; - uint32_t rm_status; -}; - -/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ -#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001 -#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002 -#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 -#define RNDIS_PACKET_TYPE_BROADCAST 0x00000008 -#define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 -#define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 -#define RNDIS_PACKET_TYPE_SMT 0x00000040 -#define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 -#define RNDIS_PACKET_TYPE_GROUP 0x00001000 -#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000 -#define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 -#define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000 - -/* RNDIS offsets */ -#define RNDIS_HEADER_OFFSET 8 /* bytes */ -#define RNDIS_DATA_OFFSET ((uint32_t)(sizeof(struct urndis_packet_msg) - RNDIS_HEADER_OFFSET)) - #endif /* _IF_URNDISREG_H_ */ Copied and modified: stable/11/sys/net/rndis.h (from r304654, head/sys/net/rndis.h) ============================================================================== --- head/sys/net/rndis.h Tue Aug 23 02:54:06 2016 (r304654, copy source) +++ stable/11/sys/net/rndis.h Mon Oct 17 06:56:58 2016 (r307481) @@ -23,15 +23,19 @@ #ifndef _NET_RNDIS_H_ #define _NET_RNDIS_H_ -#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L -#define RNDIS_STATUS_FAILURE 0xC0000001L -#define RNDIS_STATUS_INVALID_DATA 0xC0010015L +/* Canonical major/minor version as of 22th Aug. 2016. */ +#define RNDIS_VERSION_MAJOR 0x00000001 +#define RNDIS_VERSION_MINOR 0x00000000 + +#define RNDIS_STATUS_SUCCESS 0x00000000L +#define RNDIS_STATUS_PENDING 0x00000103L #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL +#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L +#define RNDIS_STATUS_FAILURE 0xC0000001L #define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBL -#define RNDIS_STATUS_PENDING STATUS_PENDING /* XXX */ #define RNDIS_STATUS_RESOURCES 0xC000009AL -#define RNDIS_STATUS_SUCCESS 0x00000000L +#define RNDIS_STATUS_INVALID_DATA 0xC0010015L #define OID_GEN_SUPPORTED_LIST 0x00010101 #define OID_GEN_HARDWARE_STATUS 0x00010102 From owner-svn-src-all@freebsd.org Mon Oct 17 07:02:18 2016 Return-Path: Delivered-To: svn-src-all@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 5AE74C15F0F; Mon, 17 Oct 2016 07:02:18 +0000 (UTC) (envelope-from sephe@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 328EF159E; Mon, 17 Oct 2016 07:02:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H72HS3001628; Mon, 17 Oct 2016 07:02:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H72HP7001627; Mon, 17 Oct 2016 07:02:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170702.u9H72HP7001627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:02:17 +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: r307482 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:02:18 -0000 Author: sephe Date: Mon Oct 17 07:02:17 2016 New Revision: 307482 URL: https://svnweb.freebsd.org/changeset/base/307482 Log: MFC 304724,304728 304724 hyperv/hn: Remove the redundant rid setting for RNDIS HALT. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7595 304728 hyperv/hn: Log a warning for RESET_CMPLT. RESET is not used by the hn(4) at all, and RESET_CMPLT does not even have a rid to match with the pending requests. So, let's put it onto an independent switch branch and log a warning about it. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7602 Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 06:56:58 2016 (r307481) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:02:17 2016 (r307482) @@ -324,16 +324,9 @@ hv_rf_receive_response(rndis_device *dev memcpy(&request->response_msg, response, response->msg_len); } else { - if (response->ndis_msg_type == REMOTE_NDIS_RESET_CMPLT) { - /* Does not have a request id field */ - request->response_msg.msg.reset_complete.status = - STATUS_BUFFER_OVERFLOW; - } else { - request->response_msg.msg.init_complete.status = - STATUS_BUFFER_OVERFLOW; - } + request->response_msg.msg.init_complete.status = + STATUS_BUFFER_OVERFLOW; } - sema_post(&request->wait_sema); } } @@ -566,29 +559,40 @@ hv_rf_on_receive(struct hn_softc *sc, st rndis_hdr = data; switch (rndis_hdr->ndis_msg_type) { - /* data message */ case REMOTE_NDIS_PACKET_MSG: hv_rf_receive_data(rxr, data, dlen); break; + /* completion messages */ case REMOTE_NDIS_INITIALIZE_CMPLT: case REMOTE_NDIS_QUERY_CMPLT: case REMOTE_NDIS_SET_CMPLT: - case REMOTE_NDIS_RESET_CMPLT: case REMOTE_NDIS_KEEPALIVE_CMPLT: hv_rf_receive_response(rndis_dev, rndis_hdr); break; + /* notification message */ case REMOTE_NDIS_INDICATE_STATUS_MSG: hv_rf_receive_indicate_status(rndis_dev, rndis_hdr); break; + + case REMOTE_NDIS_RESET_CMPLT: + /* + * Reset completed, no rid. + * + * NOTE: + * RESET is not issued by hn(4), so this message should + * _not_ be observed. + */ + if_printf(sc->hn_ifp, "RESET CMPLT received\n"); + break; + default: - printf("hv_rf_on_receive(): Unknown msg_type 0x%x\n", + if_printf(sc->hn_ifp, "unknown RNDIS message 0x%x\n", rndis_hdr->ndis_msg_type); break; } - return (0); } @@ -928,7 +932,6 @@ static int hv_rf_halt_device(rndis_device *device) { rndis_request *request; - rndis_halt_request *halt; int i, ret; /* Attempt to do a rndis device halt */ @@ -941,12 +944,6 @@ hv_rf_halt_device(rndis_device *device) /* initialize "poor man's semaphore" */ request->halt_complete_flag = 0; - /* Set up the rndis set */ - halt = &request->request_msg.msg.halt_request; - halt->request_id = atomic_fetchadd_int(&device->new_request_id, 1); - /* Increment to get the new value (call above returns old value) */ - halt->request_id += 1; - ret = hv_rf_send_request(device, request, REMOTE_NDIS_HALT_MSG); if (ret != 0) { return (-1); From owner-svn-src-all@freebsd.org Mon Oct 17 07:06:16 2016 Return-Path: Delivered-To: svn-src-all@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 14262C130F7; Mon, 17 Oct 2016 07:06:16 +0000 (UTC) (envelope-from sephe@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 CAE651786; Mon, 17 Oct 2016 07:06:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H76Esi001809; Mon, 17 Oct 2016 07:06:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H76E0Z001803; Mon, 17 Oct 2016 07:06:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170706.u9H76E0Z001803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:06: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: r307483 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:06:16 -0000 Author: sephe Date: Mon Oct 17 07:06:14 2016 New Revision: 307483 URL: https://svnweb.freebsd.org/changeset/base/307483 Log: MFC 304730 hyperv/ic: Redefine IC version negotiate message. And stringent input IC version negotiate message checks. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7614 Added: stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h - copied unchanged from r304730, head/sys/dev/hyperv/utilities/vmbus_icreg.h Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/utilities/hv_util.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 07:02:17 2016 (r307482) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 07:06:14 2016 (r307483) @@ -80,7 +80,11 @@ hv_heartbeat_cb(struct vmbus_channel *ch &buf[sizeof(struct hv_vmbus_pipe_hdr)]; if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_negotiate_version(icmsghdrp, buf); + int error; + + error = vmbus_ic_negomsg(softc, buf, recvlen); + if (error) + return; } else { heartbeat_msg = (struct hv_vmbus_heartbeat_msg_data *) Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 07:02:17 2016 (r307482) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 07:06:14 2016 (r307483) @@ -85,7 +85,11 @@ hv_shutdown_cb(struct vmbus_channel *cha &buf[sizeof(struct hv_vmbus_pipe_hdr)]; if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_negotiate_version(icmsghdrp, buf); + int error; + + error = vmbus_ic_negomsg(softc, buf, recv_len); + if (error) + return; } else { shutdown_msg = (struct hv_vmbus_shutdown_msg_data *) Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 07:02:17 2016 (r307482) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 07:06:14 2016 (r307483) @@ -160,7 +160,11 @@ hv_timesync_cb(struct vmbus_channel *cha sizeof(struct hv_vmbus_pipe_hdr)]; if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - hv_negotiate_version(icmsghdrp, time_buf); + int error; + + error = vmbus_ic_negomsg(&softc->util_sc, time_buf, recvlen); + if (error) + return; } else { timedatap = (struct hv_ictimesync_data *) &time_buf[ sizeof(struct hv_vmbus_pipe_hdr) + Modified: stable/11/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 07:02:17 2016 (r307482) +++ stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 07:06:14 2016 (r307483) @@ -36,44 +36,62 @@ #include #include #include +#include #include -#include #include #include -#include #include +#include #include "vmbus_if.h" #define VMBUS_IC_BRSIZE (4 * PAGE_SIZE) -void -hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf) +CTASSERT(sizeof(struct vmbus_icmsg_negotiate) < VMBUS_IC_BRSIZE); + +int +vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int dlen) { - struct hv_vmbus_icmsg_negotiate *negop; + struct vmbus_icmsg_negotiate *nego; + int cnt, major; - icmsghdrp->icmsgsize = 0x10; + /* + * Preliminary message size verification + */ + if (dlen < sizeof(*nego)) { + device_printf(sc->ic_dev, "truncated ic negotiate, len %d\n", + dlen); + return EINVAL; + } + nego = data; - negop = (struct hv_vmbus_icmsg_negotiate *)&buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; - - if (negop->icframe_vercnt >= 2 && - negop->icversion_data[1].major == 3) { - negop->icversion_data[0].major = 3; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = 3; - negop->icversion_data[1].minor = 0; - } else { - negop->icversion_data[0].major = 1; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = 1; - negop->icversion_data[1].minor = 0; + cnt = nego->ic_fwver_cnt + nego->ic_msgver_cnt; + if (dlen < __offsetof(struct vmbus_icmsg_negotiate, ic_ver[cnt])) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "versions %d\n", dlen); + return EINVAL; } - negop->icframe_vercnt = 1; - negop->icmsg_vercnt = 1; + /* Select major version; XXX looks wrong. */ + if (nego->ic_fwver_cnt >= 2 && VMBUS_ICVER_MAJOR(nego->ic_ver[1]) == 3) + major = 3; + else + major = 1; + + /* One framework version */ + nego->ic_fwver_cnt = 1; + nego->ic_ver[0] = VMBUS_IC_VERSION(major, 0); + + /* One message version */ + nego->ic_msgver_cnt = 1; + nego->ic_ver[1] = VMBUS_IC_VERSION(major, 0); + + /* Data contains two versions */ + nego->ic_hdr.ic_dsize = __offsetof(struct vmbus_icmsg_negotiate, + ic_ver[2]) - sizeof(struct vmbus_icmsg_hdr); + + return 0; } int @@ -101,6 +119,7 @@ hv_util_attach(device_t dev, vmbus_chan_ struct vmbus_channel *chan = vmbus_get_channel(dev); int error; + sc->ic_dev = dev; sc->ic_buflen = VMBUS_IC_BRSIZE; sc->receive_buffer = malloc(VMBUS_IC_BRSIZE, M_DEVBUF, M_WAITOK | M_ZERO); Modified: stable/11/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 07:02:17 2016 (r307482) +++ stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 07:06:14 2016 (r307483) @@ -39,6 +39,7 @@ * */ typedef struct hv_util_sc { + device_t ic_dev; uint8_t *receive_buffer; int ic_buflen; } hv_util_sc; @@ -50,10 +51,9 @@ struct vmbus_ic_desc { #define VMBUS_IC_DESC_END { .ic_desc = NULL } -void hv_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf); - int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); int hv_util_detach(device_t dev); int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); +int vmbus_ic_negomsg(struct hv_util_sc *, void *data, int dlen); #endif Copied: stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h (from r304730, head/sys/dev/hyperv/utilities/vmbus_icreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Mon Oct 17 07:06:14 2016 (r307483, copy of r304730, head/sys/dev/hyperv/utilities/vmbus_icreg.h) @@ -0,0 +1,84 @@ +/*- + * Copyright (c) 2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VMBUS_ICREG_H_ +#define _VMBUS_ICREG_H_ + +#define VMBUS_ICMSG_TYPE_NEGOTIATE 0 +#define VMBUS_ICMSG_TYPE_HEARTBEAT 1 +#define VMBUS_ICMSG_TYPE_KVP 2 +#define VMBUS_ICMSG_TYPE_SHUTDOWN 3 +#define VMBUS_ICMSG_TYPE_TIMESYNC 4 +#define VMBUS_ICMSG_TYPE_VSS 5 + +#define VMBUS_ICMSG_STATUS_OK 0x00000000 +#define VMBUS_ICMSG_STATUS_FAIL 0x80004005 + +#define VMBUS_IC_VERSION(major, minor) ((major) | (((uint32_t)(minor)) << 16)) +#define VMBUS_ICVER_MAJOR(ver) ((ver) & 0xffff) +#define VMBUS_ICVER_MINOR(ver) (((ver) & 0xffff0000) >> 16) + +struct vmbus_pipe_hdr { + uint32_t ph_flags; + uint32_t ph_msgsz; +} __packed; + +struct vmbus_icmsg_hdr { + struct vmbus_pipe_hdr ic_pipe; + uint32_t ic_fwver; /* framework version */ + uint16_t ic_type; + uint32_t ic_msgver; /* message version */ + uint16_t ic_dsize; /* data size */ + uint32_t ic_status; /* VMBUS_ICMSG_STATUS_ */ + uint8_t ic_xactid; + uint8_t ic_flags; /* VMBUS_ICMSG_FLAG_ */ + uint8_t ic_rsvd[2]; +} __packed; + +#define VMBUS_ICMSG_FLAG_XACT 0x0001 +#define VMBUS_ICMSG_FLAG_REQ 0x0002 +#define VMBUS_ICMSG_FLAG_RESP 0x0004 + +/* VMBUS_ICMSG_TYPE_NEGOTIATE */ +struct vmbus_icmsg_negotiate { + struct vmbus_icmsg_hdr ic_hdr; + uint16_t ic_fwver_cnt; + uint16_t ic_msgver_cnt; + uint32_t ic_rsvd; + /* + * This version array contains two set of supported + * versions: + * - The first set consists of #ic_fwver_cnt supported framework + * versions. + * - The second set consists of #ic_msgver_cnt supported message + * versions. + */ + uint32_t ic_ver[]; +} __packed; + +#endif /* !_VMBUS_ICREG_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 07:10:59 2016 Return-Path: Delivered-To: svn-src-all@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 DC388C13266; Mon, 17 Oct 2016 07:10:59 +0000 (UTC) (envelope-from sephe@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 A7C201A25; Mon, 17 Oct 2016 07:10:59 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7Awhl004734; Mon, 17 Oct 2016 07:10:58 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7AwWl004726; Mon, 17 Oct 2016 07:10:58 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170710.u9H7AwWl004726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:10:58 +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: r307484 - in stable/11/sys: dev/hyperv/netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:11:00 -0000 Author: sephe Date: Mon Oct 17 07:10:58 2016 New Revision: 307484 URL: https://svnweb.freebsd.org/changeset/base/307484 Log: MFC 304783-304785 304783 hyperv/hn: Use definition in net/rndis.h for message type and status code. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7620 304784 hyperv/hn: Add compat code for RNDIS reorganization phase. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7621 304785 hyperv/hn: Use vmbus xact for RNDIS initialize. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7624 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis.h stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:06:14 2016 (r307483) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:10:58 2016 (r307484) @@ -77,7 +77,7 @@ static void hn_nvs_sent_none(struct hn_s static void hn_nvs_sent_xact(struct hn_send_ctx *, struct hn_softc *sc, struct vmbus_channel *, const void *, int); -static struct hn_send_ctx hn_send_ctx_none = +struct hn_send_ctx hn_send_ctx_none = HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); uint32_t Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:06:14 2016 (r307483) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:10:58 2016 (r307484) @@ -239,6 +239,11 @@ typedef struct { uint8_t link_state; } netvsc_device_info; +#define HN_XACT_REQ_PGCNT 2 +#define HN_XACT_RESP_PGCNT 2 +#define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) +#define HN_XACT_RESP_SIZE (HN_XACT_RESP_PGCNT * PAGE_SIZE) + #ifndef HN_USE_TXDESC_BUFRING struct hn_txdesc; SLIST_HEAD(hn_txdesc_list, hn_txdesc); @@ -375,6 +380,8 @@ typedef struct hn_softc { uint32_t hn_chim_gpadl; struct hyperv_dma hn_chim_dma; + + uint32_t hn_rndis_rid; } hn_softc_t; #define HN_FLAG_RXBUF_CONNECTED 0x0001 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:06:14 2016 (r307483) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:10:58 2016 (r307484) @@ -125,9 +125,6 @@ __FBSDID("$FreeBSD$"); /* Short for Hyper-V network interface */ #define NETVSC_DEVNAME "hn" -#define HN_XACT_REQ_SIZE (2 * PAGE_SIZE) -#define HN_XACT_RESP_SIZE (2 * PAGE_SIZE) - /* * It looks like offset 0 of buf is reserved to hold the softc pointer. * The sc pointer evidently not needed, and is not presently populated. Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:06:14 2016 (r307483) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:10:58 2016 (r307484) @@ -31,6 +31,7 @@ #ifndef __HV_RNDIS_H__ #define __HV_RNDIS_H__ +#include /* * NDIS protocol version numbers @@ -48,95 +49,6 @@ #define NDIS_VERSION (NDIS_VERSION_5_1) /* - * Status codes - */ - -#define STATUS_SUCCESS (0x00000000L) -#define STATUS_UNSUCCESSFUL (0xC0000001L) -#define STATUS_PENDING (0x00000103L) -#define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL) -#define STATUS_BUFFER_OVERFLOW (0x80000005L) -#define STATUS_NOT_SUPPORTED (0xC00000BBL) - -#define RNDIS_STATUS_SUCCESS (STATUS_SUCCESS) -#define RNDIS_STATUS_PENDING (STATUS_PENDING) -#define RNDIS_STATUS_NOT_RECOGNIZED (0x00010001L) -#define RNDIS_STATUS_NOT_COPIED (0x00010002L) -#define RNDIS_STATUS_NOT_ACCEPTED (0x00010003L) -#define RNDIS_STATUS_CALL_ACTIVE (0x00010007L) - -#define RNDIS_STATUS_ONLINE (0x40010003L) -#define RNDIS_STATUS_RESET_START (0x40010004L) -#define RNDIS_STATUS_RESET_END (0x40010005L) -#define RNDIS_STATUS_RING_STATUS (0x40010006L) -#define RNDIS_STATUS_CLOSED (0x40010007L) -#define RNDIS_STATUS_WAN_LINE_UP (0x40010008L) -#define RNDIS_STATUS_WAN_LINE_DOWN (0x40010009L) -#define RNDIS_STATUS_WAN_FRAGMENT (0x4001000AL) -#define RNDIS_STATUS_MEDIA_CONNECT (0x4001000BL) -#define RNDIS_STATUS_MEDIA_DISCONNECT (0x4001000CL) -#define RNDIS_STATUS_HARDWARE_LINE_UP (0x4001000DL) -#define RNDIS_STATUS_HARDWARE_LINE_DOWN (0x4001000EL) -#define RNDIS_STATUS_INTERFACE_UP (0x4001000FL) -#define RNDIS_STATUS_INTERFACE_DOWN (0x40010010L) -#define RNDIS_STATUS_MEDIA_BUSY (0x40010011L) -#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION (0x40010012L) -#define RNDIS_STATUS_WW_INDICATION RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION -#define RNDIS_STATUS_LINK_SPEED_CHANGE (0x40010013L) - -#define RNDIS_STATUS_NOT_RESETTABLE (0x80010001L) -#define RNDIS_STATUS_SOFT_ERRORS (0x80010003L) -#define RNDIS_STATUS_HARD_ERRORS (0x80010004L) -#define RNDIS_STATUS_BUFFER_OVERFLOW (STATUS_BUFFER_OVERFLOW) - -#define RNDIS_STATUS_FAILURE (STATUS_UNSUCCESSFUL) -#define RNDIS_STATUS_RESOURCES (STATUS_INSUFFICIENT_RESOURCES) -#define RNDIS_STATUS_CLOSING (0xC0010002L) -#define RNDIS_STATUS_BAD_VERSION (0xC0010004L) -#define RNDIS_STATUS_BAD_CHARACTERISTICS (0xC0010005L) -#define RNDIS_STATUS_ADAPTER_NOT_FOUND (0xC0010006L) -#define RNDIS_STATUS_OPEN_FAILED (0xC0010007L) -#define RNDIS_STATUS_DEVICE_FAILED (0xC0010008L) -#define RNDIS_STATUS_MULTICAST_FULL (0xC0010009L) -#define RNDIS_STATUS_MULTICAST_EXISTS (0xC001000AL) -#define RNDIS_STATUS_MULTICAST_NOT_FOUND (0xC001000BL) -#define RNDIS_STATUS_REQUEST_ABORTED (0xC001000CL) -#define RNDIS_STATUS_RESET_IN_PROGRESS (0xC001000DL) -#define RNDIS_STATUS_CLOSING_INDICATING (0xC001000EL) -#define RNDIS_STATUS_NOT_SUPPORTED (STATUS_NOT_SUPPORTED) -#define RNDIS_STATUS_INVALID_PACKET (0xC001000FL) -#define RNDIS_STATUS_OPEN_LIST_FULL (0xC0010010L) -#define RNDIS_STATUS_ADAPTER_NOT_READY (0xC0010011L) -#define RNDIS_STATUS_ADAPTER_NOT_OPEN (0xC0010012L) -#define RNDIS_STATUS_NOT_INDICATING (0xC0010013L) -#define RNDIS_STATUS_INVALID_LENGTH (0xC0010014L) -#define RNDIS_STATUS_INVALID_DATA (0xC0010015L) -#define RNDIS_STATUS_BUFFER_TOO_SHORT (0xC0010016L) -#define RNDIS_STATUS_INVALID_OID (0xC0010017L) -#define RNDIS_STATUS_ADAPTER_REMOVED (0xC0010018L) -#define RNDIS_STATUS_UNSUPPORTED_MEDIA (0xC0010019L) -#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE (0xC001001AL) -#define RNDIS_STATUS_FILE_NOT_FOUND (0xC001001BL) -#define RNDIS_STATUS_ERROR_READING_FILE (0xC001001CL) -#define RNDIS_STATUS_ALREADY_MAPPED (0xC001001DL) -#define RNDIS_STATUS_RESOURCE_CONFLICT (0xC001001EL) -#define RNDIS_STATUS_NO_CABLE (0xC001001FL) - -#define RNDIS_STATUS_INVALID_SAP (0xC0010020L) -#define RNDIS_STATUS_SAP_IN_USE (0xC0010021L) -#define RNDIS_STATUS_INVALID_ADDRESS (0xC0010022L) -#define RNDIS_STATUS_VC_NOT_ACTIVATED (0xC0010023L) -#define RNDIS_STATUS_DEST_OUT_OF_ORDER (0xC0010024L) -#define RNDIS_STATUS_VC_NOT_AVAILABLE (0xC0010025L) -#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE (0xC0010026L) -#define RNDIS_STATUS_INCOMPATABLE_QOS (0xC0010027L) -#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED (0xC0010028L) -#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION (0xC0010029L) - -#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L) - - -/* * Object Identifiers used by NdisRequest Query/Set Information */ @@ -289,82 +201,6 @@ */ #define OID_RNDISMP_GET_RECEIVE_BUFFERS 0xFFA0C90D // Query only - -/* - * Remote NDIS message types - */ -#define REMOTE_NDIS_PACKET_MSG 0x00000001 -#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002 -#define REMOTE_NDIS_HALT_MSG 0x00000003 -#define REMOTE_NDIS_QUERY_MSG 0x00000004 -#define REMOTE_NDIS_SET_MSG 0x00000005 -#define REMOTE_NDIS_RESET_MSG 0x00000006 -#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007 -#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008 - -#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001 -#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002 -#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005 -#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006 -#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007 - -/* - * Remote NDIS message completion types - */ -#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002 -#define REMOTE_NDIS_QUERY_CMPLT 0x80000004 -#define REMOTE_NDIS_SET_CMPLT 0x80000005 -#define REMOTE_NDIS_RESET_CMPLT 0x80000006 -#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008 - -#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001 -#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002 -#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005 -#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006 - -/* - * Reserved message type for private communication between lower-layer - * host driver and remote device, if necessary. - */ -#define REMOTE_NDIS_BUS_MSG 0xff000001 - -/* - * Defines for DeviceFlags in rndis_initialize_complete - */ -#define RNDIS_DF_CONNECTIONLESS 0x00000001 -#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002 -#define RNDIS_DF_RAW_DATA 0x00000004 - -/* - * Remote NDIS medium types. - */ -#define RNDIS_MEDIUM_802_3 0x00000000 -#define RNDIS_MEDIUM_802_5 0x00000001 -#define RNDIS_MEDIUM_FDDI 0x00000002 -#define RNDIS_MEDIUM_WAN 0x00000003 -#define RNDIS_MEDIUM_LOCAL_TALK 0x00000004 -#define RNDIS_MEDIUM_ARCNET_RAW 0x00000006 -#define RNDIS_MEDIUM_ARCNET_878_2 0x00000007 -#define RNDIS_MEDIUM_ATM 0x00000008 -#define RNDIS_MEDIUM_WIRELESS_WAN 0x00000009 -#define RNDIS_MEDIUM_IRDA 0x0000000a -#define RNDIS_MEDIUM_CO_WAN 0x0000000b -/* Not a real medium, defined as an upper bound */ -#define RNDIS_MEDIUM_MAX 0x0000000d - -/* - * Remote NDIS medium connection states. - */ -#define RNDIS_MEDIA_STATE_CONNECTED 0x00000000 -#define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001 - -/* - * Remote NDIS version numbers - */ -#define RNDIS_MAJOR_VERSION 0x00000001 -#define RNDIS_MINOR_VERSION 0x00000000 - - /* * Remote NDIS offload parameters */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:06:14 2016 (r307483) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:10:58 2016 (r307484) @@ -62,6 +62,11 @@ __FBSDID("$FreeBSD$"); HV_RF_RECVINFO_HASHINF | \ HV_RF_RECVINFO_HASHVAL) +#define HN_RNDIS_RID_COMPAT_MASK 0xffff +#define HN_RNDIS_RID_COMPAT_MAX HN_RNDIS_RID_COMPAT_MASK + +#define HN_RNDIS_XFER_SIZE 2048 + /* * Forward declarations */ @@ -92,6 +97,20 @@ static void hn_rndis_sent_cb(struct hn_s struct hn_softc *sc, struct vmbus_channel *chan, const void *data, int dlen); +static __inline uint32_t +hn_rndis_rid(struct hn_softc *sc) +{ + uint32_t rid; + +again: + rid = atomic_fetchadd_int(&sc->hn_rndis_rid, 1); + if (rid == 0) + goto again; + + /* Use upper 16 bits for non-compat RNDIS messages. */ + return ((rid & 0xffff) << 16); +} + /* * Set the Per-Packet-Info with the specified type */ @@ -202,9 +221,8 @@ hv_rndis_request(rndis_device *device, u * as a template. */ set = &rndis_mesg->msg.set_request; - set->request_id = atomic_fetchadd_int(&device->new_request_id, 1); - /* Increment to get the new value (call above returns old value) */ - set->request_id += 1; + set->request_id = atomic_fetchadd_int(&device->new_request_id, 1) & + HN_RNDIS_RID_COMPAT_MASK; /* Add to the request list */ mtx_lock(&device->req_lock); @@ -325,7 +343,7 @@ hv_rf_receive_response(rndis_device *dev response->msg_len); } else { request->response_msg.msg.init_complete.status = - STATUS_BUFFER_OVERFLOW; + RNDIS_STATUS_BUFFER_OVERFLOW; } sema_post(&request->wait_sema); } @@ -389,7 +407,7 @@ hv_rf_send_offload_request(struct hn_sof device_printf(dev, "hv send offload request succeeded\n"); ret = 0; } else { - if (set_complete->status == STATUS_NOT_SUPPORTED) { + if (set_complete->status == RNDIS_STATUS_NOT_SUPPORTED) { device_printf(dev, "HV Not support offload\n"); ret = 0; } else { @@ -552,6 +570,7 @@ hv_rf_on_receive(struct hn_softc *sc, st { rndis_device *rndis_dev; const rndis_msg *rndis_hdr; + const struct rndis_comp_hdr *comp; rndis_dev = sc->rndis_dev; if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) @@ -569,7 +588,13 @@ hv_rf_on_receive(struct hn_softc *sc, st case REMOTE_NDIS_QUERY_CMPLT: case REMOTE_NDIS_SET_CMPLT: case REMOTE_NDIS_KEEPALIVE_CMPLT: - hv_rf_receive_response(rndis_dev, rndis_hdr); + comp = data; + if (comp->rm_rid <= HN_RNDIS_RID_COMPAT_MAX) { + /* Transition time compat code */ + hv_rf_receive_response(rndis_dev, rndis_hdr); + } else { + vmbus_xact_ctx_wakeup(sc->hn_xact, data, dlen); + } break; /* notification message */ @@ -865,62 +890,139 @@ exit: return (ret); } -/* - * RNDIS filter init device - */ -static int -hv_rf_init_device(rndis_device *device) -{ - rndis_request *request; - rndis_initialize_request *init; - rndis_initialize_complete *init_complete; - uint32_t status; - int ret; +static const void * +hn_rndis_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, uint32_t rid, + size_t reqlen, size_t min_complen, uint32_t comp_type) +{ + struct vmbus_gpa gpa[HN_XACT_REQ_PGCNT]; + const struct rndis_comp_hdr *comp; + bus_addr_t paddr; + size_t comp_len; + int gpa_cnt, error; + + KASSERT(rid > HN_RNDIS_RID_COMPAT_MAX, ("invalid rid %u\n", rid)); + KASSERT(reqlen <= HN_XACT_REQ_SIZE && reqlen > 0, + ("invalid request length %zu", reqlen)); + KASSERT(min_complen >= sizeof(*comp), + ("invalid minimum complete len %zu", min_complen)); - request = hv_rndis_request(device, REMOTE_NDIS_INITIALIZE_MSG, - RNDIS_MESSAGE_SIZE(rndis_initialize_request)); - if (!request) { - ret = -1; - goto cleanup; + /* + * Setup the SG list. + */ + paddr = vmbus_xact_req_paddr(xact); + KASSERT((paddr & PAGE_MASK) == 0, + ("vmbus xact request is not page aligned 0x%jx", (uintmax_t)paddr)); + for (gpa_cnt = 0; gpa_cnt < HN_XACT_REQ_PGCNT; ++gpa_cnt) { + int len = PAGE_SIZE; + + if (reqlen == 0) + break; + if (reqlen < len) + len = reqlen; + + gpa[gpa_cnt].gpa_page = atop(paddr) + gpa_cnt; + gpa[gpa_cnt].gpa_len = len; + gpa[gpa_cnt].gpa_ofs = 0; + + reqlen -= len; } + KASSERT(reqlen == 0, ("still have %zu request data left", reqlen)); - /* Set up the rndis set */ - init = &request->request_msg.msg.init_request; - init->major_version = RNDIS_MAJOR_VERSION; - init->minor_version = RNDIS_MINOR_VERSION; /* - * Per the RNDIS document, this should be set to the max MTU - * plus the header size. However, 2048 works fine, so leaving - * it as is. + * Send this RNDIS control message and wait for its completion + * message. */ - init->max_xfer_size = 2048; - - device->state = RNDIS_DEV_INITIALIZING; + vmbus_xact_activate(xact); + error = hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL, + &hn_send_ctx_none, gpa, gpa_cnt); + if (error) { + vmbus_xact_deactivate(xact); + if_printf(sc->hn_ifp, "RNDIS ctrl send failed: %d\n", error); + return (NULL); + } + comp = vmbus_xact_wait(xact, &comp_len); - ret = hv_rf_send_request(device, request, REMOTE_NDIS_INITIALIZE_MSG); - if (ret != 0) { - device->state = RNDIS_DEV_UNINITIALIZED; - goto cleanup; + /* + * Check this RNDIS complete message. + */ + if (comp_len < min_complen) { + if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu\n", comp_len); + return (NULL); + } + if (comp->rm_len < min_complen) { + if_printf(sc->hn_ifp, "invalid RNDIS comp msglen %u\n", + comp->rm_len); + return (NULL); + } + if (comp->rm_type != comp_type) { + if_printf(sc->hn_ifp, "unexpected RNDIS comp 0x%08x, " + "expect 0x%08x\n", comp->rm_type, comp_type); + return (NULL); + } + if (comp->rm_rid != rid) { + if_printf(sc->hn_ifp, "RNDIS comp rid mismatch %u, " + "expect %u\n", comp->rm_rid, rid); + return (NULL); } + /* All pass! */ + return (comp); +} - sema_wait(&request->wait_sema); +/* + * RNDIS filter init device + */ +static int +hv_rf_init_device(rndis_device *device) +{ + struct hn_softc *sc = device->sc; + struct rndis_init_req *req; + const struct rndis_init_comp *comp; + struct vmbus_xact *xact; + uint32_t rid; + int error; - init_complete = &request->response_msg.msg.init_complete; - status = init_complete->status; - if (status == RNDIS_STATUS_SUCCESS) { - device->state = RNDIS_DEV_INITIALIZED; - ret = 0; - } else { - device->state = RNDIS_DEV_UNINITIALIZED; - ret = -1; - } + /* XXX */ + device->state = RNDIS_DEV_INITIALIZED; -cleanup: - if (request) { - hv_put_rndis_request(device, request); + xact = vmbus_xact_get(sc->hn_xact, sizeof(*req)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for RNDIS init\n"); + return (ENXIO); + } + rid = hn_rndis_rid(sc); + req = vmbus_xact_req_data(xact); + req->rm_type = REMOTE_NDIS_INITIALIZE_MSG; + req->rm_len = sizeof(*req); + req->rm_rid = rid; + req->rm_ver_major = RNDIS_VERSION_MAJOR; + req->rm_ver_minor = RNDIS_VERSION_MINOR; + req->rm_max_xfersz = HN_RNDIS_XFER_SIZE; + + comp = hn_rndis_xact_execute(sc, xact, rid, sizeof(*req), + RNDIS_INIT_COMP_SIZE_MIN, REMOTE_NDIS_INITIALIZE_CMPLT); + if (comp == NULL) { + if_printf(sc->hn_ifp, "exec RNDIS init failed\n"); + error = EIO; + goto done; + } + + if (comp->rm_status != RNDIS_STATUS_SUCCESS) { + if_printf(sc->hn_ifp, "RNDIS init failed: status 0x%08x\n", + comp->rm_status); + error = EIO; + goto done; + } + if (bootverbose) { + if_printf(sc->hn_ifp, "RNDIS ver %u.%u, pktsz %u, pktcnt %u\n", + comp->rm_ver_major, comp->rm_ver_minor, + comp->rm_pktmaxsz, comp->rm_pktmaxcnt); } + error = 0; - return (ret); +done: + if (xact != NULL) + vmbus_xact_put(xact); + return (error); } #define HALT_COMPLETION_WAIT_COUNT 25 Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:06:14 2016 (r307483) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:10:58 2016 (r307484) @@ -115,4 +115,6 @@ const void *hn_nvs_xact_execute(struct h uint32_t hn_chim_alloc(struct hn_softc *sc); void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); +extern struct hn_send_ctx hn_send_ctx_none; + #endif /* !_IF_HNVAR_H_ */ Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Mon Oct 17 07:06:14 2016 (r307483) +++ stable/11/sys/net/rndis.h Mon Oct 17 07:10:58 2016 (r307484) @@ -146,6 +146,9 @@ struct rndis_init_comp { uint32_t rm_aflistsz; }; +#define RNDIS_INIT_COMP_SIZE_MIN \ + __offsetof(struct rndis_init_comp, rm_aflistsz) + /* Halt the device. No response sent. */ #define REMOTE_NDIS_HALT_MSG 0x00000003 From owner-svn-src-all@freebsd.org Mon Oct 17 07:13:50 2016 Return-Path: Delivered-To: svn-src-all@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 8EEAAC1340C; Mon, 17 Oct 2016 07:13:50 +0000 (UTC) (envelope-from sephe@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 66B661CF1; Mon, 17 Oct 2016 07:13:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7Dnbw005717; Mon, 17 Oct 2016 07:13:49 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7Dmvh005711; Mon, 17 Oct 2016 07:13:48 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170713.u9H7Dmvh005711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:13: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: r307485 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:13:50 -0000 Author: sephe Date: Mon Oct 17 07:13:48 2016 New Revision: 307485 URL: https://svnweb.freebsd.org/changeset/base/307485 Log: MFC 304786,304788 304786 hyperv/ic: Cleanup heartbeat channel callback. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7626 304788 hyperv/ic: Update total message size if negotiate message size grows. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7627 Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/hv_util.c stable/11/sys/dev/hyperv/utilities/hv_util.h stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 07:10:58 2016 (r307484) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 07:13:48 2016 (r307485) @@ -22,23 +22,22 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include -#include #include -#include +#include #include -#include -#include #include #include #include -#include -#include "hv_util.h" +#include +#include + #include "vmbus_if.h" static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { @@ -51,55 +50,64 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; -/** - * Process heartbeat message - */ static void -hv_heartbeat_cb(struct vmbus_channel *channel, void *context) +vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc) { - uint8_t* buf; - int recvlen; - uint64_t requestid; - int ret; - - struct hv_vmbus_heartbeat_msg_data* heartbeat_msg; - struct hv_vmbus_icmsg_hdr* icmsghdrp; - hv_util_sc *softc; - - softc = (hv_util_sc*)context; - buf = softc->receive_buffer; - - recvlen = softc->ic_buflen; - ret = vmbus_chan_recv(channel, buf, &recvlen, &requestid); - KASSERT(ret != ENOBUFS, ("hvheartbeat recvbuf is not large enough")); - /* XXX check recvlen to make sure that it contains enough data */ - - if ((ret == 0) && recvlen > 0) { - - icmsghdrp = (struct hv_vmbus_icmsg_hdr *) - &buf[sizeof(struct hv_vmbus_pipe_hdr)]; - - if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - int error; + struct hv_util_sc *sc = xsc; + struct vmbus_icmsg_hdr *hdr; + int dlen, error; + uint64_t xactid; + void *data; + + /* + * Receive request. + */ + data = sc->receive_buffer; + dlen = sc->ic_buflen; + error = vmbus_chan_recv(chan, data, &dlen, &xactid); + KASSERT(error != ENOBUFS, ("icbuf is not large enough")); + if (error) + return; + + if (dlen < sizeof(struct vmbus_icmsg_hdr)) { + device_printf(sc->ic_dev, "invalid data len %d\n", dlen); + return; + } + hdr = data; - error = vmbus_ic_negomsg(softc, buf, recvlen); + /* + * Update request, which will be echoed back as response. + */ + switch (hdr->ic_type) { + case VMBUS_ICMSG_TYPE_NEGOTIATE: + error = vmbus_ic_negomsg(sc, data, &dlen); if (error) return; - } else { - heartbeat_msg = - (struct hv_vmbus_heartbeat_msg_data *) - &buf[sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; - - heartbeat_msg->seq_num += 1; - } + break; - icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | - HV_ICMSGHDRFLAG_RESPONSE; - - vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, - buf, recvlen, requestid); + case VMBUS_ICMSG_TYPE_HEARTBEAT: + /* Only ic_seq is a must */ + if (dlen < VMBUS_ICMSG_HEARTBEAT_SIZE_MIN) { + device_printf(sc->ic_dev, "invalid heartbeat len %d\n", + dlen); + return; + } + ((struct vmbus_icmsg_heartbeat *)data)->ic_seq++; + break; + + default: + device_printf(sc->ic_dev, "got 0x%08x icmsg\n", hdr->ic_type); + break; } + + /* + * Send response by echoing the updated request back. + */ + hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; + error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + data, dlen, xactid); + if (error) + device_printf(sc->ic_dev, "resp send failed: %d\n", error); } static int @@ -112,7 +120,8 @@ hv_heartbeat_probe(device_t dev) static int hv_heartbeat_attach(device_t dev) { - return hv_util_attach(dev, hv_heartbeat_cb); + + return (hv_util_attach(dev, vmbus_heartbeat_cb)); } static device_method_t heartbeat_methods[] = { Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 07:10:58 2016 (r307484) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 07:13:48 2016 (r307485) @@ -87,7 +87,7 @@ hv_shutdown_cb(struct vmbus_channel *cha if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { int error; - error = vmbus_ic_negomsg(softc, buf, recv_len); + error = vmbus_ic_negomsg(softc, buf, &recv_len); if (error) return; } else { Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 07:10:58 2016 (r307484) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 07:13:48 2016 (r307485) @@ -162,7 +162,7 @@ hv_timesync_cb(struct vmbus_channel *cha if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { int error; - error = vmbus_ic_negomsg(&softc->util_sc, time_buf, recvlen); + error = vmbus_ic_negomsg(&softc->util_sc, time_buf, &recvlen); if (error) return; } else { Modified: stable/11/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 07:10:58 2016 (r307484) +++ stable/11/sys/dev/hyperv/utilities/hv_util.c Mon Oct 17 07:13:48 2016 (r307485) @@ -48,13 +48,16 @@ #define VMBUS_IC_BRSIZE (4 * PAGE_SIZE) -CTASSERT(sizeof(struct vmbus_icmsg_negotiate) < VMBUS_IC_BRSIZE); +#define VMBUS_IC_VERCNT 2 +#define VMBUS_IC_NEGOSZ \ + __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT]) +CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE); int -vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int dlen) +vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0) { struct vmbus_icmsg_negotiate *nego; - int cnt, major; + int cnt, major, dlen = *dlen0; /* * Preliminary message size verification @@ -87,9 +90,13 @@ vmbus_ic_negomsg(struct hv_util_sc *sc, nego->ic_msgver_cnt = 1; nego->ic_ver[1] = VMBUS_IC_VERSION(major, 0); - /* Data contains two versions */ - nego->ic_hdr.ic_dsize = __offsetof(struct vmbus_icmsg_negotiate, - ic_ver[2]) - sizeof(struct vmbus_icmsg_hdr); + /* Update data size */ + nego->ic_hdr.ic_dsize = VMBUS_IC_NEGOSZ - + sizeof(struct vmbus_icmsg_hdr); + + /* Update total size, if necessary */ + if (dlen < VMBUS_IC_NEGOSZ) + *dlen0 = VMBUS_IC_NEGOSZ; return 0; } Modified: stable/11/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 07:10:58 2016 (r307484) +++ stable/11/sys/dev/hyperv/utilities/hv_util.h Mon Oct 17 07:13:48 2016 (r307485) @@ -54,6 +54,6 @@ struct vmbus_ic_desc { int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); int hv_util_detach(device_t dev); int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); -int vmbus_ic_negomsg(struct hv_util_sc *, void *data, int dlen); +int vmbus_ic_negomsg(struct hv_util_sc *, void *data, int *dlen); #endif Modified: stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Mon Oct 17 07:10:58 2016 (r307484) +++ stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Mon Oct 17 07:13:48 2016 (r307485) @@ -81,4 +81,14 @@ struct vmbus_icmsg_negotiate { uint32_t ic_ver[]; } __packed; +/* VMBUS_ICMSG_TYPE_HEARTBEAT */ +struct vmbus_icmsg_heartbeat { + struct vmbus_icmsg_hdr ic_hdr; + uint64_t ic_seq; + uint32_t ic_rsvd[8]; +} __packed; + +#define VMBUS_ICMSG_HEARTBEAT_SIZE_MIN \ + __offsetof(struct vmbus_icmsg_heartbeat, ic_rsvd[0]) + #endif /* !_VMBUS_ICREG_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 07:16:06 2016 Return-Path: Delivered-To: svn-src-all@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 49B14C13540; Mon, 17 Oct 2016 07:16:06 +0000 (UTC) (envelope-from sephe@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 116591E99; Mon, 17 Oct 2016 07:16:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7G5TY005859; Mon, 17 Oct 2016 07:16:05 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7G4Wt005854; Mon, 17 Oct 2016 07:16:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170716.u9H7G4Wt005854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:16: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: r307486 - in stable/11/sys/dev/hyperv: include storvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:16:06 -0000 Author: sephe Date: Mon Oct 17 07:16:04 2016 New Revision: 307486 URL: https://svnweb.freebsd.org/changeset/base/307486 Log: MFC 304790,304791 304790 hyperv/vmbus: Add function to calculate max # of elements in a bufring. Sponsored by: Microsoft 304791 hyperv/storvsc: Increase queue depth and rework channel selection. - Increasing queue depth gives ~100% performance improvement for randwrite fio test in Azure. - New channel selection, which takes LUN id and the current cpuid into consideration, gives additional ~20% performance improvement for ranwrite fio test in Azure. Submitted by: Hongzhang Jiang Modified by: sephe Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7622 Modified: stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 07:13:48 2016 (r307485) +++ stable/11/sys/dev/hyperv/include/vmbus.h Mon Oct 17 07:16:04 2016 (r307486) @@ -161,5 +161,7 @@ uint32_t vmbus_chan_subidx(const struct bool vmbus_chan_is_primary(const struct vmbus_channel *chan); const struct hyperv_guid * vmbus_chan_guid_inst(const struct vmbus_channel *chan); +int vmbus_chan_prplist_nelem(int br_size, int prpcnt_max, + int dlen_max); #endif /* !_VMBUS_H_ */ Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 07:13:48 2016 (r307485) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Oct 17 07:16:04 2016 (r307486) @@ -75,11 +75,9 @@ __FBSDID("$FreeBSD$"); #include #include - #include "hv_vstorage.h" #include "vmbus_if.h" -#define STORVSC_RINGBUFFER_SIZE (20*PAGE_SIZE) #define STORVSC_MAX_LUNS_PER_TARGET (64) #define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) #define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) @@ -121,8 +119,6 @@ struct hv_sgl_page_pool{ boolean_t is_init; } g_hv_sgl_page_pool; -#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * STORVSC_DATA_SEGCNT_MAX - enum storvsc_request_type { WRITE_TYPE, READ_TYPE, @@ -130,17 +126,35 @@ enum storvsc_request_type { }; SYSCTL_NODE(_hw, OID_AUTO, storvsc, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, - "Hyper-V storage interface"); + "Hyper-V storage interface"); + +static u_int hv_storvsc_use_win8ext_flags = 1; +SYSCTL_UINT(_hw_storvsc, OID_AUTO, use_win8ext_flags, CTLFLAG_RW, + &hv_storvsc_use_win8ext_flags, 0, + "Use win8 extension flags or not"); static u_int hv_storvsc_use_pim_unmapped = 1; -SYSCTL_INT(_hw_storvsc, OID_AUTO, use_pim_unmapped, CTLFLAG_RDTUN, - &hv_storvsc_use_pim_unmapped, 0, - "Optimize storvsc by using unmapped I/O"); +SYSCTL_UINT(_hw_storvsc, OID_AUTO, use_pim_unmapped, CTLFLAG_RDTUN, + &hv_storvsc_use_pim_unmapped, 0, + "Optimize storvsc by using unmapped I/O"); + +static u_int hv_storvsc_ringbuffer_size = (64 * PAGE_SIZE); +SYSCTL_UINT(_hw_storvsc, OID_AUTO, ringbuffer_size, CTLFLAG_RDTUN, + &hv_storvsc_ringbuffer_size, 0, "Hyper-V storage ringbuffer size"); + +static u_int hv_storvsc_max_io = 512; +SYSCTL_UINT(_hw_storvsc, OID_AUTO, max_io, CTLFLAG_RDTUN, + &hv_storvsc_max_io, 0, "Hyper-V storage max io limit"); + +#define STORVSC_MAX_IO \ + vmbus_chan_prplist_nelem(hv_storvsc_ringbuffer_size, \ + STORVSC_DATA_SEGCNT_MAX, VSTOR_PKT_SIZE) struct hv_storvsc_sysctl { u_long data_bio_cnt; u_long data_vaddr_cnt; u_long data_sg_cnt; + u_long chan_send_cnt[MAXCPU]; }; struct storvsc_gpa_range { @@ -184,10 +198,18 @@ struct storvsc_softc { device_t hs_dev; bus_dma_tag_t storvsc_req_dtag; struct hv_storvsc_sysctl sysctl_data; - - struct vmbus_channel *hs_cpu2chan[MAXCPU]; + uint32_t hs_nchan; + struct vmbus_channel *hs_sel_chan[MAXCPU]; }; +/* + * The size of the vmscsi_request has changed in win8. The + * additional size is for the newly added elements in the + * structure. These elements are valid only when we are talking + * to a win8 host. + * Track the correct size we need to apply. + */ +static int vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); /** * HyperV storvsc timeout testing cases: @@ -211,7 +233,7 @@ struct storvsc_driver_props { char *drv_name; char *drv_desc; uint8_t drv_max_luns_per_target; - uint8_t drv_max_ios_per_target; + uint32_t drv_max_ios_per_target; uint32_t drv_ringbuffer_size; }; @@ -240,10 +262,10 @@ static const struct hyperv_guid gBlkVscD static struct storvsc_driver_props g_drv_props_table[] = { {"blkvsc", "Hyper-V IDE Storage Interface", BLKVSC_MAX_IDE_DISKS_PER_TARGET, BLKVSC_MAX_IO_REQUESTS, - STORVSC_RINGBUFFER_SIZE}, + 20*PAGE_SIZE}, {"storvsc", "Hyper-V SCSI Storage Interface", STORVSC_MAX_LUNS_PER_TARGET, STORVSC_MAX_IO_REQUESTS, - STORVSC_RINGBUFFER_SIZE} + 20*PAGE_SIZE} }; /* @@ -253,14 +275,6 @@ static struct storvsc_driver_props g_drv static int sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; /* - * The size of the vmscsi_request has changed in win8. The - * additional size is for the newly added elements in the - * structure. These elements are valid only when we are talking - * to a win8 host. - * Track the correct size we need to apply. - */ -static int vmscsi_size_delta; -/* * The storage protocol version is determined during the * initial exchange with the host. It will indicate which * storage functionality is available in the host. @@ -413,6 +427,9 @@ storvsc_send_multichannel_request(struct return; } + /* Update channel count */ + sc->hs_nchan = request_channels_cnt + 1; + /* Wait for sub-channels setup to complete. */ subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt); @@ -585,7 +602,6 @@ hv_storvsc_channel_init(struct storvsc_s */ if (support_multichannel) storvsc_send_multichannel_request(sc, max_chans); - cleanup: sema_destroy(&request->synch_sema); return (ret); @@ -624,7 +640,6 @@ hv_storvsc_connect_vsp(struct storvsc_so } ret = hv_storvsc_channel_init(sc); - return (ret); } @@ -686,7 +701,7 @@ hv_storvsc_io_request(struct storvsc_sof { struct vstor_packet *vstor_packet = &request->vstor_packet; struct vmbus_channel* outgoing_channel = NULL; - int ret = 0; + int ret = 0, ch_sel; vstor_packet->flags |= REQUEST_COMPLETION_FLAG; @@ -700,7 +715,8 @@ hv_storvsc_io_request(struct storvsc_sof vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; - outgoing_channel = sc->hs_cpu2chan[curcpu]; + ch_sel = (vstor_packet->u.vm_srb.lun + curcpu) % sc->hs_nchan; + outgoing_channel = sc->hs_sel_chan[ch_sel]; mtx_unlock(&request->softc->hs_lock); if (request->prp_list.gpa_range.gpa_len) { @@ -712,6 +728,10 @@ hv_storvsc_io_request(struct storvsc_sof VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); } + /* statistic for successful request sending on each channel */ + if (!ret) { + sc->sysctl_data.chan_send_cnt[ch_sel]++; + } mtx_lock(&request->softc->hs_lock); if (ret != 0) { @@ -907,17 +927,20 @@ storvsc_probe(device_t dev) } static void -storvsc_create_cpu2chan(struct storvsc_softc *sc) +storvsc_create_chan_sel(struct storvsc_softc *sc) { - int cpu; + struct vmbus_channel **subch; + int i, nsubch; - CPU_FOREACH(cpu) { - sc->hs_cpu2chan[cpu] = vmbus_chan_cpu2chan(sc->hs_chan, cpu); - if (bootverbose) { - device_printf(sc->hs_dev, "cpu%d -> chan%u\n", - cpu, vmbus_chan_id(sc->hs_cpu2chan[cpu])); - } - } + sc->hs_sel_chan[0] = sc->hs_chan; + nsubch = sc->hs_nchan - 1; + if (nsubch == 0) + return; + + subch = vmbus_subchan_get(sc->hs_chan, nsubch); + for (i = 0; i < nsubch; i++) + sc->hs_sel_chan[i + 1] = subch[i]; + vmbus_subchan_rel(subch, nsubch); } static int @@ -977,7 +1000,10 @@ storvsc_sysctl(device_t dev) { struct sysctl_oid_list *child; struct sysctl_ctx_list *ctx; + struct sysctl_oid *ch_tree, *chid_tree; struct storvsc_softc *sc; + char name[16]; + int i; sc = device_get_softc(dev); ctx = device_get_sysctl_ctx(dev); @@ -989,6 +1015,28 @@ storvsc_sysctl(device_t dev) &sc->sysctl_data.data_vaddr_cnt, "# of vaddr data block"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "data_sg_cnt", CTLFLAG_RW, &sc->sysctl_data.data_sg_cnt, "# of sg data block"); + + /* dev.storvsc.UNIT.channel */ + ch_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "channel", + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (ch_tree == NULL) + return; + + for (i = 0; i < sc->hs_nchan; i++) { + uint32_t ch_id; + + ch_id = vmbus_chan_id(sc->hs_sel_chan[i]); + snprintf(name, sizeof(name), "%d", ch_id); + /* dev.storvsc.UNIT.channel.CHID */ + chid_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(ch_tree), + OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, ""); + if (chid_tree == NULL) + return; + /* dev.storvsc.UNIT.channel.CHID.send_req */ + SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(chid_tree), OID_AUTO, + "send_req", CTLFLAG_RD, &sc->sysctl_data.chan_send_cnt[i], + "# of request sending from this channel"); + } } /** @@ -1019,6 +1067,7 @@ storvsc_attach(device_t dev) root_mount_token = root_mount_hold("storvsc"); sc = device_get_softc(dev); + sc->hs_nchan = 1; sc->hs_chan = vmbus_get_channel(dev); stor_type = storvsc_get_storage_type(dev); @@ -1030,7 +1079,14 @@ storvsc_attach(device_t dev) /* fill in driver specific properties */ sc->hs_drv_props = &g_drv_props_table[stor_type]; - + sc->hs_drv_props->drv_ringbuffer_size = hv_storvsc_ringbuffer_size; + sc->hs_drv_props->drv_max_ios_per_target = + MIN(STORVSC_MAX_IO, hv_storvsc_max_io); + if (bootverbose) { + printf("storvsc ringbuffer size: %d, max_io: %d\n", + sc->hs_drv_props->drv_ringbuffer_size, + sc->hs_drv_props->drv_max_ios_per_target); + } /* fill in device specific properties */ sc->hs_unit = device_get_unit(dev); sc->hs_dev = dev; @@ -1052,7 +1108,7 @@ storvsc_attach(device_t dev) * STORVSC_DATA_SEGCNT_MAX segments, each * segment has one page buffer */ - for (i = 0; i < STORVSC_MAX_IO_REQUESTS; i++) { + for (i = 0; i < sc->hs_drv_props->drv_max_ios_per_target; i++) { sgl_node = malloc(sizeof(struct hv_sgl_node), M_DEVBUF, M_WAITOK|M_ZERO); @@ -1083,7 +1139,7 @@ storvsc_attach(device_t dev) } /* Construct cpu to channel mapping */ - storvsc_create_cpu2chan(sc); + storvsc_create_chan_sel(sc); /* * Create the device queue. @@ -1840,19 +1896,37 @@ create_storvsc_request(union ccb *ccb, s csio->cdb_len); } + if (hv_storvsc_use_win8ext_flags) { + reqp->vstor_packet.u.vm_srb.win8_extension.time_out_value = 60; + reqp->vstor_packet.u.vm_srb.win8_extension.srb_flags |= + SRB_FLAGS_DISABLE_SYNCH_TRANSFER; + } switch (ccb->ccb_h.flags & CAM_DIR_MASK) { case CAM_DIR_OUT: - reqp->vstor_packet.u.vm_srb.data_in = WRITE_TYPE; + reqp->vstor_packet.u.vm_srb.data_in = WRITE_TYPE; + if (hv_storvsc_use_win8ext_flags) { + reqp->vstor_packet.u.vm_srb.win8_extension.srb_flags |= + SRB_FLAGS_DATA_OUT; + } break; case CAM_DIR_IN: reqp->vstor_packet.u.vm_srb.data_in = READ_TYPE; + if (hv_storvsc_use_win8ext_flags) { + reqp->vstor_packet.u.vm_srb.win8_extension.srb_flags |= + SRB_FLAGS_DATA_IN; + } break; case CAM_DIR_NONE: reqp->vstor_packet.u.vm_srb.data_in = UNKNOWN_TYPE; + if (hv_storvsc_use_win8ext_flags) { + reqp->vstor_packet.u.vm_srb.win8_extension.srb_flags |= + SRB_FLAGS_NO_DATA_TRANSFER; + } break; default: - reqp->vstor_packet.u.vm_srb.data_in = UNKNOWN_TYPE; - break; + printf("Error: unexpected data direction: 0x%x\n", + ccb->ccb_h.flags & CAM_DIR_MASK); + return (EINVAL); } reqp->sense_data = &csio->sense_data; Modified: stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Oct 17 07:13:48 2016 (r307485) +++ stable/11/sys/dev/hyperv/storvsc/hv_vstorage.h Mon Oct 17 07:16:04 2016 (r307486) @@ -253,6 +253,22 @@ struct vstor_packet { #define SRB_STATUS_AUTOSENSE_VALID 0x80 #define SRB_STATUS_INVALID_LUN 0X20 +/* + * SRB Flag Bits + */ + +#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002 +#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004 +#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008 +#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010 +#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020 +#define SRB_FLAGS_DATA_IN 0x00000040 +#define SRB_FLAGS_DATA_OUT 0x00000080 +#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000 +#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT) +#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100 +#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200 +#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400 /** * Packet flags */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Oct 17 07:13:48 2016 (r307485) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Mon Oct 17 07:16:04 2016 (r307486) @@ -74,6 +74,7 @@ struct sysctl_oid; static __inline int vmbus_txbr_maxpktsz(const struct vmbus_txbr *tbr) { + /* * - 64 bits for the trailing start index (- sizeof(uint64_t)). * - The rindex and windex can't be same (- 1). See @@ -82,6 +83,17 @@ vmbus_txbr_maxpktsz(const struct vmbus_t return (tbr->txbr_dsize - sizeof(uint64_t) - 1); } +static __inline int +vmbus_br_nelem(int br_size, int elem_size) +{ + + /* Strip bufring header */ + br_size -= sizeof(struct vmbus_bufring); + /* Add per-element trailing index */ + elem_size += sizeof(uint64_t); + return (br_size / elem_size); +} + void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx, struct sysctl_oid *br_tree, struct vmbus_br *br, const char *name); Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 07:13:48 2016 (r307485) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 07:16:04 2016 (r307486) @@ -1411,3 +1411,16 @@ vmbus_chan_guid_inst(const struct vmbus_ { return &chan->ch_guid_inst; } + +int +vmbus_chan_prplist_nelem(int br_size, int prpcnt_max, int dlen_max) +{ + int elem_size; + + elem_size = __offsetof(struct vmbus_chanpkt_prplist, + cp_range[0].gpa_page[prpcnt_max]); + elem_size += dlen_max; + elem_size = VMBUS_CHANPKT_TOTLEN(elem_size); + + return (vmbus_br_nelem(br_size, elem_size)); +} From owner-svn-src-all@freebsd.org Mon Oct 17 07:20:03 2016 Return-Path: Delivered-To: svn-src-all@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 13D18C138E9; Mon, 17 Oct 2016 07:20:03 +0000 (UTC) (envelope-from sephe@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 CA0D011C4; Mon, 17 Oct 2016 07:20:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7K2vq006091; Mon, 17 Oct 2016 07:20:02 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7K1Lm006083; Mon, 17 Oct 2016 07:20:01 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170720.u9H7K1Lm006083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:20:01 +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: r307487 - in stable/11/sys: dev/hyperv/netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:20:03 -0000 Author: sephe Date: Mon Oct 17 07:20:01 2016 New Revision: 307487 URL: https://svnweb.freebsd.org/changeset/base/307487 Log: MFC 304832-304834,304972 304832 hyperv/hn: Use vmbus xact for RNDIS query. And switch MAC address query to use new RNDIS query function. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7639 304833 hyperv/hn: Save the adopted NDIS version for RNDIS to use later. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7640 304834 hyperv/hn: Use vmbus xact for RNDIS set. And use new RNDIS set to configure NDIS offloading parameters. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7641 304972 hyperv/hn: Add definition for NDIS media state. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7652 Added: stable/11/sys/dev/hyperv/netvsc/ndis.h - copied, changed from r304834, head/sys/dev/hyperv/netvsc/ndis.h Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis.h stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:16:04 2016 (r307486) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:20:01 2016 (r307487) @@ -521,9 +521,15 @@ hv_nv_connect_to_vsp(struct hn_softc *sc for (i = protocol_number - 1; i >= 0; i--) { if (hv_nv_negotiate_nvsp_protocol(sc, protocol_list[i]) == 0) { sc->hn_nvs_ver = protocol_list[i]; + sc->hn_ndis_ver = NDIS_VERSION_6_30; + if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) + sc->hn_ndis_ver = NDIS_VERSION_6_1; if (bootverbose) { - device_printf(dev, "NVS version 0x%x\n", - sc->hn_nvs_ver); + if_printf(sc->hn_ifp, "NVS version 0x%x, " + "NDIS version %u.%u\n", + sc->hn_nvs_ver, + NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } break; } @@ -549,11 +555,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc memset(&ndis, 0, sizeof(ndis)); ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; - ndis.nvs_ndis_major = NDIS_VERSION_MAJOR_6; - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) - ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_1; - else - ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30; + ndis.nvs_ndis_major = NDIS_VERSION_MAJOR(sc->hn_ndis_ver); + ndis.nvs_ndis_minor = NDIS_VERSION_MINOR(sc->hn_ndis_ver); /* NOTE: No response. */ ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:16:04 2016 (r307486) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:20:01 2016 (r307487) @@ -382,6 +382,7 @@ typedef struct hn_softc { struct hyperv_dma hn_chim_dma; uint32_t hn_rndis_rid; + uint32_t hn_ndis_ver; } hn_softc_t; #define HN_FLAG_RXBUF_CONNECTED 0x0001 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:16:04 2016 (r307486) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:20:01 2016 (r307487) @@ -117,9 +117,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include "hv_net_vsc.h" -#include "hv_rndis.h" -#include "hv_rndis_filter.h" +#include +#include +#include +#include + #include "vmbus_if.h" /* Short for Hyper-V network interface */ @@ -330,6 +332,7 @@ static int hn_rx_stat_ulong_sysctl(SYSCT static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS); static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); static int hn_create_tx_ring(struct hn_softc *, int); static void hn_destroy_tx_ring(struct hn_tx_ring *); @@ -427,6 +430,8 @@ netvsc_probe(device_t dev) static int netvsc_attach(device_t dev) { + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; netvsc_device_info device_info; hn_softc_t *sc; int unit = device_get_unit(dev); @@ -581,7 +586,7 @@ netvsc_attach(device_t dev) } #endif - if (device_info.link_state == 0) { + if (device_info.link_state == NDIS_MEDIA_STATE_CONNECTED) { sc->hn_carrier = 1; } @@ -608,9 +613,13 @@ netvsc_attach(device_t dev) hn_tx_chimney_size < sc->hn_chim_szmax) hn_set_chim_size(sc, hn_tx_chimney_size); - SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, - "nvs_version", CTLFLAG_RD, &sc->hn_nvs_ver, 0, "NVS version"); + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "nvs_version", CTLFLAG_RD, + &sc->hn_nvs_ver, 0, "NVS version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "ndis_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_ndis_version_sysctl, "A", "NDIS version"); return (0); failed: @@ -2094,6 +2103,18 @@ hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARG } static int +hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:16:04 2016 (r307486) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:20:01 2016 (r307487) @@ -42,11 +42,8 @@ #define NDIS_VERSION_6_1 0x00060001 #define NDIS_VERSION_6_30 0x0006001e -#define NDIS_VERSION_MAJOR_6 6 -#define NDIS_VERSION_MINOR_1 1 -#define NDIS_VERSION_MINOR_30 30 - -#define NDIS_VERSION (NDIS_VERSION_5_1) +#define NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) +#define NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) /* * Object Identifiers used by NdisRequest Query/Set Information Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:16:04 2016 (r307486) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:20:01 2016 (r307487) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define HV_RF_RECVINFO_VLAN 0x1 #define HV_RF_RECVINFO_CSUM 0x2 @@ -96,6 +97,11 @@ static void hn_rndis_sent_halt(struct hn static void hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data, int dlen); +static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, + const void *idata, size_t idlen, void *odata, size_t *odlen0); +static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, + size_t dlen); +static int hn_rndis_conf_offload(struct hn_softc *sc); static __inline uint32_t hn_rndis_rid(struct hn_softc *sc) @@ -695,13 +701,23 @@ cleanup: /* * RNDIS filter query device MAC address */ -static inline int +static int hv_rf_query_device_mac(rndis_device *device) { - uint32_t size = ETHER_ADDR_LEN; + struct hn_softc *sc = device->sc; + size_t hwaddr_len; + int error; - return (hv_rf_query_device(device, - RNDIS_OID_802_3_PERMANENT_ADDRESS, device->hw_mac_addr, &size)); + hwaddr_len = ETHER_ADDR_LEN; + error = hn_rndis_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0, + device->hw_mac_addr, &hwaddr_len); + if (error) + return error; + if (hwaddr_len != ETHER_ADDR_LEN) { + if_printf(sc->hn_ifp, "invalid hwaddr len %zu\n", hwaddr_len); + return EINVAL; + } + return 0; } /* @@ -892,12 +908,12 @@ exit: static const void * hn_rndis_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, uint32_t rid, - size_t reqlen, size_t min_complen, uint32_t comp_type) + size_t reqlen, size_t *comp_len0, uint32_t comp_type) { struct vmbus_gpa gpa[HN_XACT_REQ_PGCNT]; const struct rndis_comp_hdr *comp; bus_addr_t paddr; - size_t comp_len; + size_t comp_len, min_complen = *comp_len0; int gpa_cnt, error; KASSERT(rid > HN_RNDIS_RID_COMPAT_MAX, ("invalid rid %u\n", rid)); @@ -946,7 +962,14 @@ hn_rndis_xact_execute(struct hn_softc *s * Check this RNDIS complete message. */ if (comp_len < min_complen) { - if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu\n", comp_len); + if (comp_len >= sizeof(*comp)) { + /* rm_status field is valid */ + if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu, " + "status 0x%08x\n", comp_len, comp->rm_status); + } else { + if_printf(sc->hn_ifp, "invalid RNDIS comp len %zu\n", + comp_len); + } return (NULL); } if (comp->rm_len < min_complen) { @@ -965,9 +988,190 @@ hn_rndis_xact_execute(struct hn_softc *s return (NULL); } /* All pass! */ + *comp_len0 = comp_len; return (comp); } +static int +hn_rndis_query(struct hn_softc *sc, uint32_t oid, + const void *idata, size_t idlen, void *odata, size_t *odlen0) +{ + struct rndis_query_req *req; + const struct rndis_query_comp *comp; + struct vmbus_xact *xact; + size_t reqlen, odlen = *odlen0, comp_len; + int error, ofs; + uint32_t rid; + + reqlen = sizeof(*req) + idlen; + xact = vmbus_xact_get(sc->hn_xact, reqlen); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for RNDIS query 0x%08x\n", oid); + return (ENXIO); + } + rid = hn_rndis_rid(sc); + req = vmbus_xact_req_data(xact); + req->rm_type = REMOTE_NDIS_QUERY_MSG; + req->rm_len = reqlen; + req->rm_rid = rid; + req->rm_oid = oid; + /* + * XXX + * This is _not_ RNDIS Spec conforming: + * "This MUST be set to 0 when there is no input data + * associated with the OID." + * + * If this field was set to 0 according to the RNDIS Spec, + * Hyper-V would set non-SUCCESS status in the query + * completion. + */ + req->rm_infobufoffset = RNDIS_QUERY_REQ_INFOBUFOFFSET; + + if (idlen > 0) { + req->rm_infobuflen = idlen; + /* Input data immediately follows RNDIS query. */ + memcpy(req + 1, idata, idlen); + } + + comp_len = sizeof(*comp) + odlen; + comp = hn_rndis_xact_execute(sc, xact, rid, reqlen, &comp_len, + REMOTE_NDIS_QUERY_CMPLT); + if (comp == NULL) { + if_printf(sc->hn_ifp, "exec RNDIS query 0x%08x failed\n", oid); + error = EIO; + goto done; + } + + if (comp->rm_status != RNDIS_STATUS_SUCCESS) { + if_printf(sc->hn_ifp, "RNDIS query 0x%08x failed: " + "status 0x%08x\n", oid, comp->rm_status); + error = EIO; + goto done; + } + if (comp->rm_infobuflen == 0 || comp->rm_infobufoffset == 0) { + /* No output data! */ + if_printf(sc->hn_ifp, "RNDIS query 0x%08x, no data\n", oid); + *odlen0 = 0; + error = 0; + goto done; + } + + /* + * Check output data length and offset. + */ + /* ofs is the offset from the beginning of comp. */ + ofs = RNDIS_QUERY_COMP_INFOBUFABS(comp->rm_infobufoffset); + if (ofs < sizeof(*comp) || ofs + comp->rm_infobuflen > comp_len) { + if_printf(sc->hn_ifp, "RNDIS query invalid comp ib off/len, " + "%u/%u\n", comp->rm_infobufoffset, comp->rm_infobuflen); + error = EINVAL; + goto done; + } + + /* + * Save output data. + */ + if (comp->rm_infobuflen < odlen) + odlen = comp->rm_infobuflen; + memcpy(odata, ((const uint8_t *)comp) + ofs, odlen); + *odlen0 = odlen; + + error = 0; +done: + vmbus_xact_put(xact); + return (error); +} + +static int +hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen) +{ + struct rndis_set_req *req; + const struct rndis_set_comp *comp; + struct vmbus_xact *xact; + size_t reqlen, comp_len; + uint32_t rid; + int error; + + KASSERT(dlen > 0, ("invalid dlen %zu", dlen)); + + reqlen = sizeof(*req) + dlen; + xact = vmbus_xact_get(sc->hn_xact, reqlen); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for RNDIS set 0x%08x\n", oid); + return (ENXIO); + } + rid = hn_rndis_rid(sc); + req = vmbus_xact_req_data(xact); + req->rm_type = REMOTE_NDIS_SET_MSG; + req->rm_len = reqlen; + req->rm_rid = rid; + req->rm_oid = oid; + req->rm_infobuflen = dlen; + req->rm_infobufoffset = RNDIS_SET_REQ_INFOBUFOFFSET; + /* Data immediately follows RNDIS set. */ + memcpy(req + 1, data, dlen); + + comp_len = sizeof(*comp); + comp = hn_rndis_xact_execute(sc, xact, rid, reqlen, &comp_len, + REMOTE_NDIS_SET_CMPLT); + if (comp == NULL) { + if_printf(sc->hn_ifp, "exec RNDIS set 0x%08x failed\n", oid); + error = EIO; + goto done; + } + + if (comp->rm_status != RNDIS_STATUS_SUCCESS) { + if_printf(sc->hn_ifp, "RNDIS set 0x%08x failed: " + "status 0x%08x\n", oid, comp->rm_status); + error = EIO; + goto done; + } + error = 0; +done: + vmbus_xact_put(xact); + return (error); +} + +static int +hn_rndis_conf_offload(struct hn_softc *sc) +{ + struct ndis_offload_params params; + size_t paramsz; + int error; + + /* NOTE: 0 means "no change" */ + memset(¶ms, 0, sizeof(params)); + + params.ndis_hdr.ndis_type = NDIS_OBJTYPE_DEFAULT; + if (sc->hn_ndis_ver < NDIS_VERSION_6_30) { + params.ndis_hdr.ndis_rev = NDIS_OFFLOAD_PARAMS_REV_2; + paramsz = NDIS_OFFLOAD_PARAMS_SIZE_6_1; + } else { + params.ndis_hdr.ndis_rev = NDIS_OFFLOAD_PARAMS_REV_3; + paramsz = NDIS_OFFLOAD_PARAMS_SIZE; + } + params.ndis_hdr.ndis_size = paramsz; + + params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; + params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; + params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; + if (sc->hn_ndis_ver >= NDIS_VERSION_6_30) { + params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; + params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; + } + params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_ON; + /* XXX ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON */ + + error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); + if (error) { + if_printf(sc->hn_ifp, "offload config failed: %d\n", error); + } else { + if (bootverbose) + if_printf(sc->hn_ifp, "offload config done\n"); + } + return (error); +} + /* * RNDIS filter init device */ @@ -978,6 +1182,7 @@ hv_rf_init_device(rndis_device *device) struct rndis_init_req *req; const struct rndis_init_comp *comp; struct vmbus_xact *xact; + size_t comp_len; uint32_t rid; int error; @@ -998,8 +1203,9 @@ hv_rf_init_device(rndis_device *device) req->rm_ver_minor = RNDIS_VERSION_MINOR; req->rm_max_xfersz = HN_RNDIS_XFER_SIZE; - comp = hn_rndis_xact_execute(sc, xact, rid, sizeof(*req), - RNDIS_INIT_COMP_SIZE_MIN, REMOTE_NDIS_INITIALIZE_CMPLT); + comp_len = RNDIS_INIT_COMP_SIZE_MIN; + comp = hn_rndis_xact_execute(sc, xact, rid, sizeof(*req), &comp_len, + REMOTE_NDIS_INITIALIZE_CMPLT); if (comp == NULL) { if_printf(sc->hn_ifp, "exec RNDIS init failed\n"); error = EIO; @@ -1131,7 +1337,6 @@ hv_rf_on_device_add(struct hn_softc *sc, { int ret; rndis_device *rndis_dev; - rndis_offload_params offloads; struct rndis_recv_scale_cap rsscaps; uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap); netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; @@ -1181,21 +1386,8 @@ hv_rf_on_device_add(struct hn_softc *sc, /* TODO: shut down rndis device and the channel */ } - /* config csum offload and send request to host */ - memset(&offloads, 0, sizeof(offloads)); - offloads.ipv4_csum = RNDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; - offloads.tcp_ipv4_csum = RNDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; - offloads.udp_ipv4_csum = RNDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; - offloads.tcp_ipv6_csum = RNDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; - offloads.udp_ipv6_csum = RNDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED; - offloads.lso_v2_ipv4 = RNDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED; - - ret = hv_rf_send_offload_request(sc, &offloads); - if (ret != 0) { - /* TODO: shut down rndis device and the channel */ - device_printf(dev, - "hv_rf_send_offload_request failed, ret=%d\n", ret); - } + /* Configure NDIS offload settings */ + hn_rndis_conf_offload(sc); memcpy(dev_info->mac_addr, rndis_dev->hw_mac_addr, ETHER_ADDR_LEN); Copied and modified: stable/11/sys/dev/hyperv/netvsc/ndis.h (from r304834, head/sys/dev/hyperv/netvsc/ndis.h) ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Fri Aug 26 05:18:27 2016 (r304834, copy source) +++ stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 07:20:01 2016 (r307487) @@ -29,6 +29,9 @@ #ifndef _NET_NDIS_H_ #define _NET_NDIS_H_ +#define NDIS_MEDIA_STATE_CONNECTED 0 +#define NDIS_MEDIA_STATE_DISCONNECTED 1 + #define OID_TCP_OFFLOAD_PARAMETERS 0xFC01020C #define NDIS_OBJTYPE_DEFAULT 0x80 Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Mon Oct 17 07:16:04 2016 (r307486) +++ stable/11/sys/net/rndis.h Mon Oct 17 07:20:01 2016 (r307487) @@ -172,6 +172,10 @@ struct rndis_query_req { uint32_t rm_devicevchdl; }; +#define RNDIS_QUERY_REQ_INFOBUFOFFSET \ + (sizeof(struct rndis_query_req) - \ + __offsetof(struct rndis_query_req, rm_rid)) + struct rndis_query_comp { uint32_t rm_type; uint32_t rm_len; @@ -181,6 +185,9 @@ struct rndis_query_comp { uint32_t rm_infobufoffset; }; +#define RNDIS_QUERY_COMP_INFOBUFABS(ofs) \ + ((ofs) + __offsetof(struct rndis_query_req, rm_rid)) + /* Send a set object request. */ #define REMOTE_NDIS_SET_MSG 0x00000005 #define REMOTE_NDIS_SET_CMPLT 0x80000005 @@ -195,6 +202,10 @@ struct rndis_set_req { uint32_t rm_devicevchdl; }; +#define RNDIS_SET_REQ_INFOBUFOFFSET \ + (sizeof(struct rndis_set_req) - \ + __offsetof(struct rndis_set_req, rm_rid)) + struct rndis_set_comp { uint32_t rm_type; uint32_t rm_len; From owner-svn-src-all@freebsd.org Mon Oct 17 07:27:18 2016 Return-Path: Delivered-To: svn-src-all@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 9ACA9C13E2C; Mon, 17 Oct 2016 07:27:18 +0000 (UTC) (envelope-from sephe@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 625FA1867; Mon, 17 Oct 2016 07:27:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7RHS6009869; Mon, 17 Oct 2016 07:27:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7RHYl009863; Mon, 17 Oct 2016 07:27:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170727.u9H7RHYl009863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:27:17 +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: r307490 - in stable/11/sys: dev/hyperv/netvsc dev/usb/net 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:27:18 -0000 Author: sephe Date: Mon Oct 17 07:27:16 2016 New Revision: 307490 URL: https://svnweb.freebsd.org/changeset/base/307490 Log: MFC 304973,304975,304976,304979,305044-305048 304973 hyperv/hn: Switch to new RNDIS query for link status extraction. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7654 304975 hyperv/hn: Switch to new RNDIS query for RSS capabilities extraction. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7656 304976 hyperv/hn: Fix # of channels setting, if RSS is not available. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7657 304979 hyperv/hn: Switch to new RNDIS set for RSS parameters. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7658 305044 hyperv/hn: Move OIDs to net/rndis.h; they are standard NDIS OIDs. Actually all OIDs defined in net/rndis.h are standard NDIS OIDs. While I'm here, use the verbose macro name as in NDIS spec. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7679 305045 hyperv/hn: Indentation and field comment fixup for ndis.h. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7680 305046 net/rndis: Packet types are defined by NDIS; not RNDIS specific. Reviewed by: hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7681 305047 hyperv/hn: Switch to new RNDIS set for RX filters. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7683 305048 hyperv/hn: Remove unused function Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7684 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_rndis.h stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/ndis.h stable/11/sys/dev/usb/net/if_urndis.c stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:25:46 2016 (r307489) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:27:16 2016 (r307490) @@ -62,6 +62,8 @@ #include #include +#include + #define HN_USE_TXDESC_BUFRING MALLOC_DECLARE(M_NETVSC); @@ -383,6 +385,8 @@ typedef struct hn_softc { uint32_t hn_rndis_rid; uint32_t hn_ndis_ver; + + struct ndis_rssprm_toeplitz hn_rss; } hn_softc_t; #define HN_FLAG_RXBUF_CONNECTED 0x0001 Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:25:46 2016 (r307489) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:27:16 2016 (r307490) @@ -536,20 +536,6 @@ struct rndis_hash_info { uint32_t hash_info; } __packed; -#define NDIS_HASH_FUNCTION_MASK 0x000000FF /* see hash function */ -#define NDIS_HASH_TYPE_MASK 0x00FFFF00 /* see hash type */ - -/* hash function */ -#define NDIS_HASH_FUNCTION_TOEPLITZ 0x00000001 - -/* hash type */ -#define NDIS_HASH_IPV4 0x00000100 -#define NDIS_HASH_TCP_IPV4 0x00000200 -#define NDIS_HASH_IPV6 0x00000400 -#define NDIS_HASH_IPV6_EX 0x00000800 -#define NDIS_HASH_TCP_IPV6 0x00001000 -#define NDIS_HASH_TCP_IPV6_EX 0x00002000 - typedef struct rndis_tcp_tso_info_ { union { struct { @@ -903,19 +889,6 @@ typedef struct rndismp_rx_bufs_info_ { #define RNDIS_HEADER_SIZE (sizeof(rndis_msg) - sizeof(rndis_msg_container)) -#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 -#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 -#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 -#define NDIS_PACKET_TYPE_SMT 0x00000040 -#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 -#define NDIS_PACKET_TYPE_GROUP 0x00000100 -#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200 -#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400 -#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800 - /* * Externs */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:25:46 2016 (r307489) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:27:16 2016 (r307490) @@ -79,17 +79,9 @@ static void hv_rf_receive_indicate_statu const rndis_msg *response); static void hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen); -static int hv_rf_query_device(rndis_device *device, uint32_t oid, - void *result, uint32_t *result_size); static inline int hv_rf_query_device_mac(rndis_device *device); static inline int hv_rf_query_device_link_status(rndis_device *device); -static int hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter); static int hv_rf_init_device(rndis_device *device); -static int hv_rf_open_device(rndis_device *device); -static int hv_rf_close_device(rndis_device *device); -int -hv_rf_send_offload_request(struct hn_softc *sc, - rndis_offload_params *offloads); static void hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, @@ -102,6 +94,8 @@ static int hn_rndis_query(struct hn_soft static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen); static int hn_rndis_conf_offload(struct hn_softc *sc); +static int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt); +static int hn_rndis_conf_rss(struct hn_softc *sc, int nchan); static __inline uint32_t hn_rndis_rid(struct hn_softc *sc) @@ -355,78 +349,6 @@ hv_rf_receive_response(rndis_device *dev } } -int -hv_rf_send_offload_request(struct hn_softc *sc, - rndis_offload_params *offloads) -{ - rndis_request *request; - rndis_set_request *set; - rndis_offload_params *offload_req; - rndis_set_complete *set_complete; - rndis_device *rndis_dev = sc->rndis_dev; - device_t dev = sc->hn_dev; - uint32_t extlen = sizeof(rndis_offload_params); - int ret; - - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) { - extlen = VERSION_4_OFFLOAD_SIZE; - /* On NVSP_PROTOCOL_VERSION_4 and below, we do not support - * UDP checksum offload. - */ - offloads->udp_ipv4_csum = 0; - offloads->udp_ipv6_csum = 0; - } - - request = hv_rndis_request(rndis_dev, REMOTE_NDIS_SET_MSG, - RNDIS_MESSAGE_SIZE(rndis_set_request) + extlen); - if (!request) - return (ENOMEM); - - set = &request->request_msg.msg.set_request; - set->oid = RNDIS_OID_TCP_OFFLOAD_PARAMETERS; - set->info_buffer_length = extlen; - set->info_buffer_offset = sizeof(rndis_set_request); - set->device_vc_handle = 0; - - offload_req = (rndis_offload_params *)((unsigned long)set + - set->info_buffer_offset); - *offload_req = *offloads; - offload_req->header.type = RNDIS_OBJECT_TYPE_DEFAULT; - offload_req->header.revision = RNDIS_OFFLOAD_PARAMETERS_REVISION_3; - offload_req->header.size = extlen; - - ret = hv_rf_send_request(rndis_dev, request, REMOTE_NDIS_SET_MSG); - if (ret != 0) { - device_printf(dev, "hv send offload request failed, ret=%d!\n", - ret); - goto cleanup; - } - - ret = sema_timedwait(&request->wait_sema, 5 * hz); - if (ret != 0) { - device_printf(dev, "hv send offload request timeout\n"); - goto cleanup; - } - - set_complete = &request->response_msg.msg.set_complete; - if (set_complete->status == RNDIS_STATUS_SUCCESS) { - device_printf(dev, "hv send offload request succeeded\n"); - ret = 0; - } else { - if (set_complete->status == RNDIS_STATUS_NOT_SUPPORTED) { - device_printf(dev, "HV Not support offload\n"); - ret = 0; - } else { - ret = set_complete->status; - } - } - -cleanup: - hv_put_rndis_request(rndis_dev, request); - - return (ret); -} - /* * RNDIS filter receive indicate status */ @@ -628,77 +550,6 @@ hv_rf_on_receive(struct hn_softc *sc, st } /* - * RNDIS filter query device - */ -static int -hv_rf_query_device(rndis_device *device, uint32_t oid, void *result, - uint32_t *result_size) -{ - rndis_request *request; - uint32_t in_result_size = *result_size; - rndis_query_request *query; - rndis_query_complete *query_complete; - int ret = 0; - - *result_size = 0; - request = hv_rndis_request(device, REMOTE_NDIS_QUERY_MSG, - RNDIS_MESSAGE_SIZE(rndis_query_request)); - if (request == NULL) { - ret = -1; - goto cleanup; - } - - /* Set up the rndis query */ - query = &request->request_msg.msg.query_request; - query->oid = oid; - query->info_buffer_offset = sizeof(rndis_query_request); - query->info_buffer_length = 0; - query->device_vc_handle = 0; - - if (oid == RNDIS_OID_GEN_RSS_CAPABILITIES) { - struct rndis_recv_scale_cap *cap; - - request->request_msg.msg_len += - sizeof(struct rndis_recv_scale_cap); - query->info_buffer_length = sizeof(struct rndis_recv_scale_cap); - cap = (struct rndis_recv_scale_cap *)((unsigned long)query + - query->info_buffer_offset); - cap->hdr.type = RNDIS_OBJECT_TYPE_RSS_CAPABILITIES; - cap->hdr.rev = RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2; - cap->hdr.size = sizeof(struct rndis_recv_scale_cap); - } - - ret = hv_rf_send_request(device, request, REMOTE_NDIS_QUERY_MSG); - if (ret != 0) { - /* Fixme: printf added */ - printf("RNDISFILTER request failed to Send!\n"); - goto cleanup; - } - - sema_wait(&request->wait_sema); - - /* Copy the response back */ - query_complete = &request->response_msg.msg.query_complete; - - if (query_complete->info_buffer_length > in_result_size) { - ret = EINVAL; - goto cleanup; - } - - memcpy(result, (void *)((unsigned long)query_complete + - query_complete->info_buffer_offset), - query_complete->info_buffer_length); - - *result_size = query_complete->info_buffer_length; - -cleanup: - if (request != NULL) - hv_put_rndis_request(device, request); - - return (ret); -} - -/* * RNDIS filter query device MAC address */ static int @@ -712,12 +563,12 @@ hv_rf_query_device_mac(rndis_device *dev error = hn_rndis_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0, device->hw_mac_addr, &hwaddr_len); if (error) - return error; + return (error); if (hwaddr_len != ETHER_ADDR_LEN) { if_printf(sc->hn_ifp, "invalid hwaddr len %zu\n", hwaddr_len); - return EINVAL; + return (EINVAL); } - return 0; + return (0); } /* @@ -726,13 +577,23 @@ hv_rf_query_device_mac(rndis_device *dev static inline int hv_rf_query_device_link_status(rndis_device *device) { - uint32_t size = sizeof(uint32_t); + struct hn_softc *sc = device->sc; + size_t size; + int error; - return (hv_rf_query_device(device, - RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, &device->link_status, &size)); + size = sizeof(uint32_t); + error = hn_rndis_query(sc, OID_GEN_MEDIA_CONNECT_STATUS, NULL, 0, + &device->link_status, &size); + if (error) + return (error); + if (size != sizeof(uint32_t)) { + if_printf(sc->hn_ifp, "invalid link status len %zu\n", size); + return (EINVAL); + } + return (0); } -static uint8_t netvsc_hash_key[HASH_KEYLEN] = { +static uint8_t netvsc_hash_key[NDIS_HASH_KEYSIZE_TOEPLITZ] = { 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, @@ -740,172 +601,6 @@ static uint8_t netvsc_hash_key[HASH_KEYL 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa }; -/* - * RNDIS set vRSS parameters - */ -static int -hv_rf_set_rss_param(rndis_device *device, int num_queue) -{ - rndis_request *request; - rndis_set_request *set; - rndis_set_complete *set_complete; - rndis_recv_scale_param *rssp; - uint32_t extlen = sizeof(rndis_recv_scale_param) + - (4 * ITAB_NUM) + HASH_KEYLEN; - uint32_t *itab, status; - uint8_t *keyp; - int i, ret; - - - request = hv_rndis_request(device, REMOTE_NDIS_SET_MSG, - RNDIS_MESSAGE_SIZE(rndis_set_request) + extlen); - if (request == NULL) { - if (bootverbose) - printf("Netvsc: No memory to set vRSS parameters.\n"); - ret = -1; - goto cleanup; - } - - set = &request->request_msg.msg.set_request; - set->oid = RNDIS_OID_GEN_RSS_PARAMETERS; - set->info_buffer_length = extlen; - set->info_buffer_offset = sizeof(rndis_set_request); - set->device_vc_handle = 0; - - /* Fill out the rssp parameter structure */ - rssp = (rndis_recv_scale_param *)(set + 1); - rssp->hdr.type = RNDIS_OBJECT_TYPE_RSS_PARAMETERS; - rssp->hdr.rev = RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2; - rssp->hdr.size = sizeof(rndis_recv_scale_param); - rssp->flag = 0; - rssp->hashinfo = RNDIS_HASH_FUNC_TOEPLITZ | RNDIS_HASH_IPV4 | - RNDIS_HASH_TCP_IPV4 | RNDIS_HASH_IPV6 | RNDIS_HASH_TCP_IPV6; - rssp->indirect_tabsize = 4 * ITAB_NUM; - rssp->indirect_taboffset = sizeof(rndis_recv_scale_param); - rssp->hashkey_size = HASH_KEYLEN; - rssp->hashkey_offset = rssp->indirect_taboffset + - rssp->indirect_tabsize; - - /* Set indirection table entries */ - itab = (uint32_t *)(rssp + 1); - for (i = 0; i < ITAB_NUM; i++) - itab[i] = i % num_queue; - - /* Set hash key values */ - keyp = (uint8_t *)((unsigned long)rssp + rssp->hashkey_offset); - for (i = 0; i < HASH_KEYLEN; i++) - keyp[i] = netvsc_hash_key[i]; - - ret = hv_rf_send_request(device, request, REMOTE_NDIS_SET_MSG); - if (ret != 0) { - goto cleanup; - } - - /* - * Wait for the response from the host. Another thread will signal - * us when the response has arrived. In the failure case, - * sema_timedwait() returns a non-zero status after waiting 5 seconds. - */ - ret = sema_timedwait(&request->wait_sema, 5 * hz); - if (ret == 0) { - /* Response received, check status */ - set_complete = &request->response_msg.msg.set_complete; - status = set_complete->status; - if (status != RNDIS_STATUS_SUCCESS) { - /* Bad response status, return error */ - if (bootverbose) - printf("Netvsc: Failed to set vRSS " - "parameters.\n"); - ret = -2; - } else { - if (bootverbose) - printf("Netvsc: Successfully set vRSS " - "parameters.\n"); - } - } else { - /* - * We cannot deallocate the request since we may still - * receive a send completion for it. - */ - printf("Netvsc: vRSS set timeout, id = %u, ret = %d\n", - request->request_msg.msg.init_request.request_id, ret); - goto exit; - } - -cleanup: - if (request != NULL) { - hv_put_rndis_request(device, request); - } -exit: - return (ret); -} - -/* - * RNDIS filter set packet filter - * Sends an rndis request with the new filter, then waits for a response - * from the host. - * Returns zero on success, non-zero on failure. - */ -static int -hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter) -{ - rndis_request *request; - rndis_set_request *set; - rndis_set_complete *set_complete; - uint32_t status; - int ret; - - request = hv_rndis_request(device, REMOTE_NDIS_SET_MSG, - RNDIS_MESSAGE_SIZE(rndis_set_request) + sizeof(uint32_t)); - if (request == NULL) { - ret = -1; - goto cleanup; - } - - /* Set up the rndis set */ - set = &request->request_msg.msg.set_request; - set->oid = RNDIS_OID_GEN_CURRENT_PACKET_FILTER; - set->info_buffer_length = sizeof(uint32_t); - set->info_buffer_offset = sizeof(rndis_set_request); - - memcpy((void *)((unsigned long)set + sizeof(rndis_set_request)), - &new_filter, sizeof(uint32_t)); - - ret = hv_rf_send_request(device, request, REMOTE_NDIS_SET_MSG); - if (ret != 0) { - goto cleanup; - } - - /* - * Wait for the response from the host. Another thread will signal - * us when the response has arrived. In the failure case, - * sema_timedwait() returns a non-zero status after waiting 5 seconds. - */ - ret = sema_timedwait(&request->wait_sema, 5 * hz); - if (ret == 0) { - /* Response received, check status */ - set_complete = &request->response_msg.msg.set_complete; - status = set_complete->status; - if (status != RNDIS_STATUS_SUCCESS) { - /* Bad response status, return error */ - ret = -2; - } - } else { - /* - * We cannot deallocate the request since we may still - * receive a send completion for it. - */ - goto exit; - } - -cleanup: - if (request != NULL) { - hv_put_rndis_request(device, request); - } -exit: - return (ret); -} - static const void * hn_rndis_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, uint32_t rid, size_t reqlen, size_t *comp_len0, uint32_t comp_type) @@ -1083,6 +778,51 @@ done: } static int +hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt) +{ + struct ndis_rss_caps in, caps; + size_t caps_len; + int error; + + /* + * Only NDIS 6.30+ is supported. + */ + KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30, + ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); + *rxr_cnt = 0; + + memset(&in, 0, sizeof(in)); + in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS; + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; + + caps_len = NDIS_RSS_CAPS_SIZE; + error = hn_rndis_query(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, + &in, NDIS_RSS_CAPS_SIZE, &caps, &caps_len); + if (error) + return (error); + if (caps_len < NDIS_RSS_CAPS_SIZE_6_0) { + if_printf(sc->hn_ifp, "invalid NDIS RSS caps len %zu", + caps_len); + return (EINVAL); + } + + if (caps.ndis_nrxr == 0) { + if_printf(sc->hn_ifp, "0 RX rings!?\n"); + return (EINVAL); + } + *rxr_cnt = caps.ndis_nrxr; + + if (caps_len == NDIS_RSS_CAPS_SIZE) { + if (bootverbose) { + if_printf(sc->hn_ifp, "RSS indirect table size %u\n", + caps.ndis_nind); + } + } + return (0); +} + +static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen) { struct rndis_set_req *req; @@ -1172,6 +912,72 @@ hn_rndis_conf_offload(struct hn_softc *s return (error); } +static int +hn_rndis_conf_rss(struct hn_softc *sc, int nchan) +{ + struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; + struct ndis_rss_params *prm = &rss->rss_params; + int i, error; + + /* + * Only NDIS 6.30+ is supported. + */ + KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30, + ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); + + memset(rss, 0, sizeof(*rss)); + prm->ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_PARAMS; + prm->ndis_hdr.ndis_rev = NDIS_RSS_PARAMS_REV_2; + prm->ndis_hdr.ndis_size = sizeof(*rss); + prm->ndis_hash = NDIS_HASH_FUNCTION_TOEPLITZ | + NDIS_HASH_IPV4 | NDIS_HASH_TCP_IPV4 | + NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV6; + /* TODO: Take ndis_rss_caps.ndis_nind into account */ + prm->ndis_indsize = sizeof(rss->rss_ind); + prm->ndis_indoffset = + __offsetof(struct ndis_rssprm_toeplitz, rss_ind[0]); + prm->ndis_keysize = sizeof(rss->rss_key); + prm->ndis_keyoffset = + __offsetof(struct ndis_rssprm_toeplitz, rss_key[0]); + + /* Setup RSS key */ + memcpy(rss->rss_key, netvsc_hash_key, sizeof(rss->rss_key)); + + /* Setup RSS indirect table */ + /* TODO: Take ndis_rss_caps.ndis_nind into account */ + for (i = 0; i < NDIS_HASH_INDCNT; ++i) + rss->rss_ind[i] = i % nchan; + + error = hn_rndis_set(sc, OID_GEN_RECEIVE_SCALE_PARAMETERS, + rss, sizeof(*rss)); + if (error) { + if_printf(sc->hn_ifp, "RSS config failed: %d\n", error); + } else { + if (bootverbose) + if_printf(sc->hn_ifp, "RSS config done\n"); + } + return (error); +} + +static int +hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter) +{ + int error; + + error = hn_rndis_set(sc, OID_GEN_CURRENT_PACKET_FILTER, + &filter, sizeof(filter)); + if (error) { + if_printf(sc->hn_ifp, "set RX filter 0x%08x failed: %d\n", + filter, error); + } else { + if (bootverbose) { + if_printf(sc->hn_ifp, "set RX filter 0x%08x done\n", + filter); + } + } + return (error); +} + /* * RNDIS filter init device */ @@ -1280,55 +1086,6 @@ hv_rf_halt_device(rndis_device *device) } /* - * RNDIS filter open device - */ -static int -hv_rf_open_device(rndis_device *device) -{ - int ret; - - if (device->state != RNDIS_DEV_INITIALIZED) { - return (0); - } - - if (hv_promisc_mode != 1) { - ret = hv_rf_set_packet_filter(device, - NDIS_PACKET_TYPE_BROADCAST | - NDIS_PACKET_TYPE_ALL_MULTICAST | - NDIS_PACKET_TYPE_DIRECTED); - } else { - ret = hv_rf_set_packet_filter(device, - NDIS_PACKET_TYPE_PROMISCUOUS); - } - - if (ret == 0) { - device->state = RNDIS_DEV_DATAINITIALIZED; - } - - return (ret); -} - -/* - * RNDIS filter close device - */ -static int -hv_rf_close_device(rndis_device *device) -{ - int ret; - - if (device->state != RNDIS_DEV_DATAINITIALIZED) { - return (0); - } - - ret = hv_rf_set_packet_filter(device, 0); - if (ret == 0) { - device->state = RNDIS_DEV_INITIALIZED; - } - - return (ret); -} - -/* * RNDIS filter on device add */ int @@ -1337,8 +1094,6 @@ hv_rf_on_device_add(struct hn_softc *sc, { int ret; rndis_device *rndis_dev; - struct rndis_recv_scale_cap rsscaps; - uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap); netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; device_t dev = sc->hn_dev; struct hn_nvs_subch_req *req; @@ -1347,6 +1102,7 @@ hv_rf_on_device_add(struct hn_softc *sc, struct vmbus_xact *xact = NULL; uint32_t status, nsubch; int nchan = *nchan0; + int rxr_cnt; rndis_dev = hv_get_rndis_device(); if (rndis_dev == NULL) { @@ -1395,22 +1151,29 @@ hv_rf_on_device_add(struct hn_softc *sc, dev_info->link_state = rndis_dev->link_status; - if (sc->hn_nvs_ver < NVSP_PROTOCOL_VERSION_5 || nchan == 1) + if (sc->hn_ndis_ver < NDIS_VERSION_6_30 || nchan == 1) { + /* + * Either RSS is not supported, or multiple RX/TX rings + * are not requested. + */ + *nchan0 = 1; return (0); + } - memset(&rsscaps, 0, rsscaps_size); - ret = hv_rf_query_device(rndis_dev, - RNDIS_OID_GEN_RSS_CAPABILITIES, - &rsscaps, &rsscaps_size); - if ((ret != 0) || (rsscaps.num_recv_que < 2)) { - device_printf(dev, "hv_rf_query_device failed or " - "rsscaps.num_recv_que < 2 \n"); - goto out; + /* + * Get RSS capabilities, e.g. # of RX rings, and # of indirect + * table entries. + */ + ret = hn_rndis_get_rsscaps(sc, &rxr_cnt); + if (ret) { + /* No RSS; this is benign. */ + *nchan0 = 1; + return (0); } - device_printf(dev, "channel, offered %u, requested %d\n", - rsscaps.num_recv_que, nchan); - if (nchan > rsscaps.num_recv_que) - nchan = rsscaps.num_recv_que; + if (nchan > rxr_cnt) + nchan = rxr_cnt; + if_printf(sc->hn_ifp, "RX rings offered %u, requested %d\n", + rxr_cnt, nchan); if (nchan == 1) { device_printf(dev, "only 1 channel is supported, no vRSS\n"); @@ -1467,8 +1230,11 @@ hv_rf_on_device_add(struct hn_softc *sc, } nchan = nsubch + 1; - ret = hv_rf_set_rss_param(rndis_dev, nchan); - *nchan0 = nchan; + ret = hn_rndis_conf_rss(sc, nchan); + if (ret != 0) + *nchan0 = 1; + else + *nchan0 = nchan; out: if (xact != NULL) vmbus_xact_put(xact); @@ -1502,8 +1268,17 @@ hv_rf_on_device_remove(struct hn_softc * int hv_rf_on_open(struct hn_softc *sc) { + uint32_t filter; - return (hv_rf_open_device(sc->rndis_dev)); + /* XXX */ + if (hv_promisc_mode != 1) { + filter = NDIS_PACKET_TYPE_BROADCAST | + NDIS_PACKET_TYPE_ALL_MULTICAST | + NDIS_PACKET_TYPE_DIRECTED; + } else { + filter = NDIS_PACKET_TYPE_PROMISCUOUS; + } + return (hn_rndis_set_rxfilter(sc, filter)); } /* @@ -1513,7 +1288,7 @@ int hv_rf_on_close(struct hn_softc *sc) { - return (hv_rf_close_device(sc->rndis_dev)); + return (hn_rndis_set_rxfilter(sc, 0)); } static void Modified: stable/11/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 07:25:46 2016 (r307489) +++ stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 07:27:16 2016 (r307490) @@ -29,93 +29,178 @@ #ifndef _NET_NDIS_H_ #define _NET_NDIS_H_ -#define NDIS_MEDIA_STATE_CONNECTED 0 -#define NDIS_MEDIA_STATE_DISCONNECTED 1 +#define NDIS_MEDIA_STATE_CONNECTED 0 +#define NDIS_MEDIA_STATE_DISCONNECTED 1 -#define OID_TCP_OFFLOAD_PARAMETERS 0xFC01020C +#define NDIS_OFFLOAD_SET_NOCHG 0 +#define NDIS_OFFLOAD_SET_ON 1 +#define NDIS_OFFLOAD_SET_OFF 2 -#define NDIS_OBJTYPE_DEFAULT 0x80 +/* a.k.a GRE MAC */ +#define NDIS_ENCAP_TYPE_NVGRE 0x00000001 -/* common_set */ -#define NDIS_OFFLOAD_SET_NOCHG 0 -#define NDIS_OFFLOAD_SET_ON 1 -#define NDIS_OFFLOAD_SET_OFF 2 +#define NDIS_HASH_FUNCTION_MASK 0x000000FF /* see hash function */ +#define NDIS_HASH_TYPE_MASK 0x00FFFF00 /* see hash type */ -/* a.k.a GRE MAC */ -#define NDIS_ENCAP_TYPE_NVGRE 0x00000001 +/* hash function */ +#define NDIS_HASH_FUNCTION_TOEPLITZ 0x00000001 + +/* hash type */ +#define NDIS_HASH_IPV4 0x00000100 +#define NDIS_HASH_TCP_IPV4 0x00000200 +#define NDIS_HASH_IPV6 0x00000400 +#define NDIS_HASH_IPV6_EX 0x00000800 +#define NDIS_HASH_TCP_IPV6 0x00001000 +#define NDIS_HASH_TCP_IPV6_EX 0x00002000 + +#define NDIS_HASH_KEYSIZE_TOEPLITZ 40 +#define NDIS_HASH_INDCNT 128 + +#define NDIS_OBJTYPE_DEFAULT 0x80 +#define NDIS_OBJTYPE_RSS_CAPS 0x88 +#define NDIS_OBJTYPE_RSS_PARAMS 0x89 struct ndis_object_hdr { - uint8_t ndis_type; /* NDIS_OBJTYPE_ */ - uint8_t ndis_rev; /* type specific */ - uint16_t ndis_size; /* incl. this hdr */ + uint8_t ndis_type; /* NDIS_OBJTYPE_ */ + uint8_t ndis_rev; /* type specific */ + uint16_t ndis_size; /* incl. this hdr */ }; -/* OID_TCP_OFFLOAD_PARAMETERS */ +/* + * OID_TCP_OFFLOAD_PARAMETERS + * ndis_type: NDIS_OBJTYPE_DEFAULT + */ struct ndis_offload_params { struct ndis_object_hdr ndis_hdr; - uint8_t ndis_ip4csum; /* param_set */ - uint8_t ndis_tcp4csum; /* param_set */ - uint8_t ndis_udp4csum; /* param_set */ - uint8_t ndis_tcp6csum; /* param_set */ - uint8_t ndis_udp6csum; /* param_set */ - uint8_t ndis_lsov1; /* lsov1_set */ - uint8_t ndis_ipsecv1; /* ipsecv1_set */ - uint8_t ndis_lsov2_ip4; /* lsov2_set */ - uint8_t ndis_lsov2_ip6; /* lsov2_set */ - uint8_t ndis_tcp4conn; /* PARAM_NOCHG */ - uint8_t ndis_tcp6conn; /* PARAM_NOCHG */ - uint32_t ndis_flags; /* 0 */ + uint8_t ndis_ip4csum; /* NDIS_OFFLOAD_PARAM_ */ + uint8_t ndis_tcp4csum; /* NDIS_OFFLOAD_PARAM_ */ + uint8_t ndis_udp4csum; /* NDIS_OFFLOAD_PARAM_ */ + uint8_t ndis_tcp6csum; /* NDIS_OFFLOAD_PARAM_ */ + uint8_t ndis_udp6csum; /* NDIS_OFFLOAD_PARAM_ */ + uint8_t ndis_lsov1; /* NDIS_OFFLOAD_PARAM_ */ + uint8_t ndis_ipsecv1; /* NDIS_OFFLOAD_IPSECV1_ */ + uint8_t ndis_lsov2_ip4; /* NDIS_OFFLOAD_LSOV2_ */ + uint8_t ndis_lsov2_ip6; /* NDIS_OFFLOAD_LSOV2_ */ + uint8_t ndis_tcp4conn; /* 0 */ + uint8_t ndis_tcp6conn; /* 0 */ + uint32_t ndis_flags; /* 0 */ /* NDIS >= 6.1 */ - uint8_t ndis_ipsecv2; /* ipsecv2_set */ - uint8_t ndis_ipsecv2_ip4; /* ipsecv2_set */ + uint8_t ndis_ipsecv2; /* NDIS_OFFLOAD_IPSECV2_ */ + uint8_t ndis_ipsecv2_ip4;/* NDIS_OFFLOAD_IPSECV2_ */ /* NDIS >= 6.30 */ - uint8_t ndis_rsc_ip4; /* rsc_set */ - uint8_t ndis_rsc_ip6; /* rsc_set */ - uint8_t ndis_encap; /* common_set */ - uint8_t ndis_encap_types; /* NDIS_ENCAP_TYPE_ */ + uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ + uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ + uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; -#define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) -#define NDIS_OFFLOAD_PARAMS_SIZE_6_1 \ +#define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) +#define NDIS_OFFLOAD_PARAMS_SIZE_6_1 \ __offsetof(struct ndis_offload_params, ndis_rsc_ip4) -#define NDIS_OFFLOAD_PARAMS_REV_2 2 /* NDIS 6.1 */ -#define NDIS_OFFLOAD_PARAMS_REV_3 3 /* NDIS 6.30 */ +#define NDIS_OFFLOAD_PARAMS_REV_2 2 /* NDIS 6.1 */ +#define NDIS_OFFLOAD_PARAMS_REV_3 3 /* NDIS 6.30 */ -/* param_set */ -#define NDIS_OFFLOAD_PARAM_NOCHG 0 /* common to all sets */ -#define NDIS_OFFLOAD_PARAM_OFF 1 -#define NDIS_OFFLOAD_PARAM_TX 2 -#define NDIS_OFFLOAD_PARAM_RX 3 -#define NDIS_OFFLOAD_PARAM_TXRX 4 +#define NDIS_OFFLOAD_PARAM_NOCHG 0 /* common */ +#define NDIS_OFFLOAD_PARAM_OFF 1 +#define NDIS_OFFLOAD_PARAM_TX 2 +#define NDIS_OFFLOAD_PARAM_RX 3 +#define NDIS_OFFLOAD_PARAM_TXRX 4 -/* lsov1_set */ /* NDIS_OFFLOAD_PARAM_NOCHG */ -#define NDIS_OFFLOAD_LSOV1_OFF 1 -#define NDIS_OFFLOAD_LSOV1_ON 2 +#define NDIS_OFFLOAD_LSOV1_OFF 1 +#define NDIS_OFFLOAD_LSOV1_ON 2 -/* ipsecv1_set */ /* NDIS_OFFLOAD_PARAM_NOCHG */ -#define NDIS_OFFLOAD_IPSECV1_OFF 1 -#define NDIS_OFFLOAD_IPSECV1_AH 2 -#define NDIS_OFFLOAD_IPSECV1_ESP 3 -#define NDIS_OFFLOAD_IPSECV1_AH_ESP 4 +#define NDIS_OFFLOAD_IPSECV1_OFF 1 +#define NDIS_OFFLOAD_IPSECV1_AH 2 +#define NDIS_OFFLOAD_IPSECV1_ESP 3 +#define NDIS_OFFLOAD_IPSECV1_AH_ESP 4 -/* lsov2_set */ /* NDIS_OFFLOAD_PARAM_NOCHG */ -#define NDIS_OFFLOAD_LSOV2_OFF 1 -#define NDIS_OFFLOAD_LSOV2_ON 2 +#define NDIS_OFFLOAD_LSOV2_OFF 1 +#define NDIS_OFFLOAD_LSOV2_ON 2 -/* ipsecv2_set */ /* NDIS_OFFLOAD_PARAM_NOCHG */ -#define NDIS_OFFLOAD_IPSECV2_OFF 1 -#define NDIS_OFFLOAD_IPSECV2_AH 2 -#define NDIS_OFFLOAD_IPSECV2_ESP 3 -#define NDIS_OFFLOAD_IPSECV2_AH_ESP 4 +#define NDIS_OFFLOAD_IPSECV2_OFF 1 +#define NDIS_OFFLOAD_IPSECV2_AH 2 +#define NDIS_OFFLOAD_IPSECV2_ESP 3 +#define NDIS_OFFLOAD_IPSECV2_AH_ESP 4 -/* rsc_set */ /* NDIS_OFFLOAD_PARAM_NOCHG */ -#define NDIS_OFFLOAD_RSC_OFF 1 -#define NDIS_OFFLOAD_RSC_ON 2 +#define NDIS_OFFLOAD_RSC_OFF 1 +#define NDIS_OFFLOAD_RSC_ON 2 + +/* + * OID_GEN_RECEIVE_SCALE_CAPABILITIES + * ndis_type: NDIS_OBJTYPE_RSS_CAPS + */ +struct ndis_rss_caps { + struct ndis_object_hdr ndis_hdr; + uint32_t ndis_flags; /* NDIS_RSS_CAP_ */ + uint32_t ndis_nmsi; /* # of MSIs */ + uint32_t ndis_nrxr; /* # of RX rings */ + /* NDIS >= 6.30 */ + uint16_t ndis_nind; /* # of indtbl ent. */ + uint16_t ndis_pad; +}; + +#define NDIS_RSS_CAPS_SIZE \ + __offsetof(struct ndis_rss_caps, ndis_pad) +#define NDIS_RSS_CAPS_SIZE_6_0 \ + __offsetof(struct ndis_rss_caps, ndis_nind) + +#define NDIS_RSS_CAPS_REV_1 1 /* NDIS 6.{0,1,20} */ +#define NDIS_RSS_CAPS_REV_2 2 /* NDIS 6.30 */ + +#define NDIS_RSS_CAP_MSI 0x01000000 +#define NDIS_RSS_CAP_CLASSIFY_ISR 0x02000000 +#define NDIS_RSS_CAP_CLASSIFY_DPC 0x04000000 +#define NDIS_RSS_CAP_MSIX 0x08000000 +#define NDIS_RSS_CAP_IPV4 0x00000100 +#define NDIS_RSS_CAP_IPV6 0x00000200 +#define NDIS_RSS_CAP_IPV6_EX 0x00000400 +#define NDIS_RSS_CAP_HASH_TOEPLITZ 0x00000001 + +/* + * OID_GEN_RECEIVE_SCALE_PARAMETERS + * ndis_type: NDIS_OBJTYPE_RSS_PARAMS + */ +struct ndis_rss_params { + struct ndis_object_hdr ndis_hdr; + uint16_t ndis_flags; /* NDIS_RSS_FLAG_ */ + uint16_t ndis_bcpu; /* base cpu 0 */ + uint32_t ndis_hash; /* NDIS_HASH_ */ + uint16_t ndis_indsize; /* indirect table */ + uint32_t ndis_indoffset; + uint16_t ndis_keysize; /* hash key */ + uint32_t ndis_keyoffset; + /* NDIS >= 6.20 */ + uint32_t ndis_cpumaskoffset; + uint32_t ndis_cpumaskcnt; + uint32_t ndis_cpumaskentsz; +}; + +#define NDIS_RSS_PARAMS_SIZE sizeof(struct ndis_rss_params) +#define NDIS_RSS_PARAMS_SIZE_6_0 \ + __offsetof(struct ndis_rss_params, ndis_cpumaskoffset) + +#define NDIS_RSS_PARAMS_REV_1 1 /* NDIS 6.0 */ +#define NDIS_RSS_PARAMS_REV_2 2 /* NDIS 6.20 */ + +#define NDIS_RSS_FLAG_BCPU_UNCHG 0x0001 +#define NDIS_RSS_FLAG_HASH_UNCHG 0x0002 +#define NDIS_RSS_FLAG_IND_UNCHG 0x0004 +#define NDIS_RSS_FLAG_KEY_UNCHG 0x0008 +#define NDIS_RSS_FLAG_DISABLE 0x0010 + +/* non-standard convenient struct */ +struct ndis_rssprm_toeplitz { + struct ndis_rss_params rss_params; + /* Toeplitz hash key */ + uint8_t rss_key[NDIS_HASH_KEYSIZE_TOEPLITZ]; + /* Indirect table */ + uint32_t rss_ind[NDIS_HASH_INDCNT]; +}; #endif /* !_NET_NDIS_H_ */ Modified: stable/11/sys/dev/usb/net/if_urndis.c ============================================================================== --- stable/11/sys/dev/usb/net/if_urndis.c Mon Oct 17 07:25:46 2016 (r307489) +++ stable/11/sys/dev/usb/net/if_urndis.c Mon Oct 17 07:27:16 2016 (r307490) @@ -292,8 +292,8 @@ urndis_attach(device_t dev) memcpy(&sc->sc_ue.ue_eaddr, buf, ETHER_ADDR_LEN); /* Initialize packet filter */ - sc->sc_filter = RNDIS_PACKET_TYPE_BROADCAST | - RNDIS_PACKET_TYPE_ALL_MULTICAST; + sc->sc_filter = NDIS_PACKET_TYPE_BROADCAST | *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 07:29:12 2016 Return-Path: Delivered-To: svn-src-all@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 237BFC13E9E; Mon, 17 Oct 2016 07:29:12 +0000 (UTC) (envelope-from sephe@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 F1D7B19DE; Mon, 17 Oct 2016 07:29:11 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7TB48010010; Mon, 17 Oct 2016 07:29:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7TAuC010007; Mon, 17 Oct 2016 07:29:10 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170729.u9H7TAuC010007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:29: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: r307491 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:29:12 -0000 Author: sephe Date: Mon Oct 17 07:29:10 2016 New Revision: 307491 URL: https://svnweb.freebsd.org/changeset/base/307491 Log: MFC 305049,305050 305049 hyperv/hn: Factor out func to exec RNDIS transaction w/o checking result It will be used by RNDIS HALT and RESET. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7685 305050 hyperv/hn: Switch to new RNDIS transaction execution for halt. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7686 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:27:16 2016 (r307490) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:29:10 2016 (r307491) @@ -74,8 +74,6 @@ static void hv_nv_on_receive(struct hn_s static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct hn_softc *, struct vmbus_channel *chan, const void *, int); -static void hn_nvs_sent_xact(struct hn_send_ctx *, struct hn_softc *sc, - struct vmbus_channel *, const void *, int); struct hn_send_ctx hn_send_ctx_none = HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); @@ -655,7 +653,7 @@ hv_nv_on_device_remove(struct hn_softc * return (0); } -static void +void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, const void *data, int dlen) Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:27:16 2016 (r307490) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:29:10 2016 (r307491) @@ -71,8 +71,6 @@ __FBSDID("$FreeBSD$"); /* * Forward declarations */ -static int hv_rf_send_request(rndis_device *device, rndis_request *request, - uint32_t message_type); static void hv_rf_receive_response(rndis_device *device, const rndis_msg *response); static void hv_rf_receive_indicate_status(rndis_device *device, @@ -83,12 +81,6 @@ static inline int hv_rf_query_device_mac static inline int hv_rf_query_device_link_status(rndis_device *device); static int hv_rf_init_device(rndis_device *device); -static void hn_rndis_sent_halt(struct hn_send_ctx *sndc, - struct hn_softc *sc, struct vmbus_channel *chan, - const void *data, int dlen); -static void hn_rndis_sent_cb(struct hn_send_ctx *sndc, - struct hn_softc *sc, struct vmbus_channel *chan, - const void *data, int dlen); static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0); static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, @@ -197,120 +189,6 @@ hv_put_rndis_device(rndis_device *device } /* - * - */ -static inline rndis_request * -hv_rndis_request(rndis_device *device, uint32_t message_type, - uint32_t message_length) -{ - rndis_request *request; - rndis_msg *rndis_mesg; - rndis_set_request *set; - - request = malloc(sizeof(rndis_request), M_NETVSC, M_WAITOK | M_ZERO); - - sema_init(&request->wait_sema, 0, "rndis sema"); - - rndis_mesg = &request->request_msg; - rndis_mesg->ndis_msg_type = message_type; - rndis_mesg->msg_len = message_length; - - /* - * Set the request id. This field is always after the rndis header - * for request/response packet types so we just use the set_request - * as a template. - */ - set = &rndis_mesg->msg.set_request; - set->request_id = atomic_fetchadd_int(&device->new_request_id, 1) & - HN_RNDIS_RID_COMPAT_MASK; - - /* Add to the request list */ - mtx_lock(&device->req_lock); - STAILQ_INSERT_TAIL(&device->myrequest_list, request, mylist_entry); - mtx_unlock(&device->req_lock); - - return (request); -} - -/* - * - */ -static inline void -hv_put_rndis_request(rndis_device *device, rndis_request *request) -{ - mtx_lock(&device->req_lock); - /* Fixme: Has O(n) performance */ - /* - * XXXKYS: Use Doubly linked lists. - */ - STAILQ_REMOVE(&device->myrequest_list, request, rndis_request_, - mylist_entry); - mtx_unlock(&device->req_lock); - - sema_destroy(&request->wait_sema); - free(request, M_NETVSC); -} - -/* - * - */ -static int -hv_rf_send_request(rndis_device *device, rndis_request *request, - uint32_t message_type) -{ - struct hn_softc *sc = device->sc; - uint32_t send_buf_section_idx, tot_data_buf_len; - struct vmbus_gpa gpa[2]; - int gpa_cnt, send_buf_section_size; - hn_sent_callback_t cb; - - /* Set up the packet to send it */ - tot_data_buf_len = request->request_msg.msg_len; - - gpa_cnt = 1; - gpa[0].gpa_page = hv_get_phys_addr(&request->request_msg) >> PAGE_SHIFT; - gpa[0].gpa_len = request->request_msg.msg_len; - gpa[0].gpa_ofs = (unsigned long)&request->request_msg & (PAGE_SIZE - 1); - - if (gpa[0].gpa_ofs + gpa[0].gpa_len > PAGE_SIZE) { - gpa_cnt = 2; - gpa[0].gpa_len = PAGE_SIZE - gpa[0].gpa_ofs; - gpa[1].gpa_page = - hv_get_phys_addr((char*)&request->request_msg + - gpa[0].gpa_len) >> PAGE_SHIFT; - gpa[1].gpa_ofs = 0; - gpa[1].gpa_len = request->request_msg.msg_len - gpa[0].gpa_len; - } - - if (message_type != REMOTE_NDIS_HALT_MSG) - cb = hn_rndis_sent_cb; - else - cb = hn_rndis_sent_halt; - - if (tot_data_buf_len < sc->hn_chim_szmax) { - send_buf_section_idx = hn_chim_alloc(sc); - if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { - uint8_t *dest = sc->hn_chim + - (send_buf_section_idx * sc->hn_chim_szmax); - - memcpy(dest, &request->request_msg, request->request_msg.msg_len); - send_buf_section_size = tot_data_buf_len; - gpa_cnt = 0; - goto sendit; - } - /* Failed to allocate chimney send buffer; move on */ - } - send_buf_section_idx = HN_NVS_CHIM_IDX_INVALID; - send_buf_section_size = 0; - -sendit: - hn_send_ctx_init(&request->send_ctx, cb, request, - send_buf_section_idx, send_buf_section_size); - return hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL, - &request->send_ctx, gpa, gpa_cnt); -} - -/* * RNDIS filter receive response */ static void @@ -602,20 +480,15 @@ static uint8_t netvsc_hash_key[NDIS_HASH }; static const void * -hn_rndis_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, uint32_t rid, - size_t reqlen, size_t *comp_len0, uint32_t comp_type) +hn_rndis_xact_exec1(struct hn_softc *sc, struct vmbus_xact *xact, size_t reqlen, + struct hn_send_ctx *sndc, size_t *comp_len) { struct vmbus_gpa gpa[HN_XACT_REQ_PGCNT]; - const struct rndis_comp_hdr *comp; - bus_addr_t paddr; - size_t comp_len, min_complen = *comp_len0; int gpa_cnt, error; + bus_addr_t paddr; - KASSERT(rid > HN_RNDIS_RID_COMPAT_MAX, ("invalid rid %u\n", rid)); KASSERT(reqlen <= HN_XACT_REQ_SIZE && reqlen > 0, ("invalid request length %zu", reqlen)); - KASSERT(min_complen >= sizeof(*comp), - ("invalid minimum complete len %zu", min_complen)); /* * Setup the SG list. @@ -644,14 +517,34 @@ hn_rndis_xact_execute(struct hn_softc *s * message. */ vmbus_xact_activate(xact); - error = hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL, - &hn_send_ctx_none, gpa, gpa_cnt); + error = hv_nv_on_send(sc->hn_prichan, HN_NVS_RNDIS_MTYPE_CTRL, sndc, + gpa, gpa_cnt); if (error) { vmbus_xact_deactivate(xact); if_printf(sc->hn_ifp, "RNDIS ctrl send failed: %d\n", error); return (NULL); } - comp = vmbus_xact_wait(xact, &comp_len); + return (vmbus_xact_wait(xact, comp_len)); +} + +static const void * +hn_rndis_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, uint32_t rid, + size_t reqlen, size_t *comp_len0, uint32_t comp_type) +{ + const struct rndis_comp_hdr *comp; + size_t comp_len, min_complen = *comp_len0; + + KASSERT(rid > HN_RNDIS_RID_COMPAT_MAX, ("invalid rid %u\n", rid)); + KASSERT(min_complen >= sizeof(*comp), + ("invalid minimum complete len %zu", min_complen)); + + /* + * Execute the xact setup by the caller. + */ + comp = hn_rndis_xact_exec1(sc, xact, reqlen, &hn_send_ctx_none, + &comp_len); + if (comp == NULL) + return (NULL); /* * Check this RNDIS complete message. @@ -1037,51 +930,34 @@ done: return (error); } -#define HALT_COMPLETION_WAIT_COUNT 25 - /* * RNDIS filter halt device */ static int -hv_rf_halt_device(rndis_device *device) +hv_rf_halt_device(struct hn_softc *sc) { - rndis_request *request; - int i, ret; - - /* Attempt to do a rndis device halt */ - request = hv_rndis_request(device, REMOTE_NDIS_HALT_MSG, - RNDIS_MESSAGE_SIZE(rndis_halt_request)); - if (request == NULL) { - return (-1); - } - - /* initialize "poor man's semaphore" */ - request->halt_complete_flag = 0; - - ret = hv_rf_send_request(device, request, REMOTE_NDIS_HALT_MSG); - if (ret != 0) { - return (-1); - } + struct vmbus_xact *xact; + struct rndis_halt_req *halt; + struct hn_send_ctx sndc; + size_t comp_len; - /* - * Wait for halt response from halt callback. We must wait for - * the transaction response before freeing the request and other - * resources. - */ - for (i=HALT_COMPLETION_WAIT_COUNT; i > 0; i--) { - if (request->halt_complete_flag != 0) { - break; - } - DELAY(400); - } - if (i == 0) { - return (-1); + xact = vmbus_xact_get(sc->hn_xact, sizeof(*halt)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for RNDIS halt\n"); + return (ENXIO); } + halt = vmbus_xact_req_data(xact); + halt->rm_type = REMOTE_NDIS_HALT_MSG; + halt->rm_len = sizeof(*halt); + halt->rm_rid = hn_rndis_rid(sc); + + /* No RNDIS completion; rely on NVS message send completion */ + hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); + hn_rndis_xact_exec1(sc, xact, sizeof(*halt), &sndc, &comp_len); - device->state = RNDIS_DEV_UNINITIALIZED; - - hv_put_rndis_request(device, request); - + vmbus_xact_put(xact); + if (bootverbose) + if_printf(sc->hn_ifp, "RNDIS halt done\n"); return (0); } @@ -1251,7 +1127,7 @@ hv_rf_on_device_remove(struct hn_softc * int ret; /* Halt and release the rndis device */ - ret = hv_rf_halt_device(rndis_dev); + ret = hv_rf_halt_device(sc); sc->rndis_dev = NULL; hv_put_rndis_device(rndis_dev); @@ -1291,33 +1167,6 @@ hv_rf_on_close(struct hn_softc *sc) return (hn_rndis_set_rxfilter(sc, 0)); } -static void -hn_rndis_sent_cb(struct hn_send_ctx *sndc, struct hn_softc *sc, - struct vmbus_channel *chan __unused, const void *data __unused, - int dlen __unused) -{ - if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) - hn_chim_free(sc, sndc->hn_chim_idx); -} - -static void -hn_rndis_sent_halt(struct hn_send_ctx *sndc, struct hn_softc *sc, - struct vmbus_channel *chan __unused, const void *data __unused, - int dlen __unused) -{ - rndis_request *request = sndc->hn_cbarg; - - if (sndc->hn_chim_idx != HN_NVS_CHIM_IDX_INVALID) - hn_chim_free(sc, sndc->hn_chim_idx); - - /* - * Notify hv_rf_halt_device() about halt completion. - * The halt code must wait for completion before freeing - * the transaction resources. - */ - request->halt_complete_flag = 1; -} - void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:27:16 2016 (r307490) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:29:10 2016 (r307491) @@ -112,6 +112,8 @@ struct vmbus_xact; const void *hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, size_t *resp_len); +void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc, + struct vmbus_channel *chan, const void *data, int dlen); uint32_t hn_chim_alloc(struct hn_softc *sc); void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); From owner-svn-src-all@freebsd.org Mon Oct 17 07:32:51 2016 Return-Path: Delivered-To: svn-src-all@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 0FAB1C15018; Mon, 17 Oct 2016 07:32:51 +0000 (UTC) (envelope-from sephe@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 CB3E21D8E; Mon, 17 Oct 2016 07:32:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7Woup013519; Mon, 17 Oct 2016 07:32:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7WnnC013513; Mon, 17 Oct 2016 07:32:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170732.u9H7WnnC013513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:32: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: r307492 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:32:51 -0000 Author: sephe Date: Mon Oct 17 07:32:49 2016 New Revision: 307492 URL: https://svnweb.freebsd.org/changeset/base/307492 Log: MFC 305052-305054,305110 305052 hyperv/hn: Remove the useless rndis_device and related bits Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7687 305053 hyperv/hn: Log packet message alignment. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7689 305054 hyperv/hn: Remove unnecessary NULL check. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7690 305110 hyperv/hn: Consolidate NVS transaction execution. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7704 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:29:10 2016 (r307491) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 07:32:49 2016 (r307492) @@ -107,21 +107,45 @@ hn_chim_alloc(struct hn_softc *sc) const void * hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, - void *req, int reqlen, size_t *resp_len) + void *req, int reqlen, size_t *resplen0, uint32_t type) { struct hn_send_ctx sndc; + size_t resplen, min_resplen = *resplen0; + const struct hn_nvs_hdr *hdr; int error; + KASSERT(min_resplen >= sizeof(*hdr), + ("invalid minimum response len %zu", min_resplen)); + + /* + * Execute the xact setup by the caller. + */ hn_send_ctx_init_simple(&sndc, hn_nvs_sent_xact, xact); - vmbus_xact_activate(xact); + vmbus_xact_activate(xact); error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC, req, reqlen, &sndc); if (error) { vmbus_xact_deactivate(xact); - return NULL; + return (NULL); } - return (vmbus_xact_wait(xact, resp_len)); + hdr = vmbus_xact_wait(xact, &resplen); + + /* + * Check this NVS response message. + */ + if (resplen < min_resplen) { + if_printf(sc->hn_ifp, "invalid NVS resp len %zu\n", resplen); + return (NULL); + } + if (hdr->nvs_type != type) { + if_printf(sc->hn_ifp, "unexpected NVS resp 0x%08x, " + "expect 0x%08x\n", hdr->nvs_type, type); + return (NULL); + } + /* All pass! */ + *resplen0 = resplen; + return (hdr); } static __inline int @@ -181,24 +205,14 @@ hv_nv_init_rx_buffer_with_net_vsp(struct conn->nvs_gpadl = sc->hn_rxbuf_gpadl; conn->nvs_sig = HN_NVS_RXBUF_SIG; - resp = hn_nvs_xact_execute(sc, xact, conn, sizeof(*conn), &resp_len); + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, conn, sizeof(*conn), &resp_len, + HN_NVS_TYPE_RXBUF_CONNRESP); if (resp == NULL) { if_printf(sc->hn_ifp, "exec rxbuf conn failed\n"); error = EIO; goto cleanup; } - if (resp_len < sizeof(*resp)) { - if_printf(sc->hn_ifp, "invalid rxbuf conn resp length %zu\n", - resp_len); - error = EINVAL; - goto cleanup; - } - if (resp->nvs_type != HN_NVS_TYPE_RXBUF_CONNRESP) { - if_printf(sc->hn_ifp, "not rxbuf conn resp, type %u\n", - resp->nvs_type); - error = EINVAL; - goto cleanup; - } status = resp->nvs_status; vmbus_xact_put(xact); @@ -264,24 +278,14 @@ hv_nv_init_send_buffer_with_net_vsp(stru chim->nvs_gpadl = sc->hn_chim_gpadl; chim->nvs_sig = HN_NVS_CHIM_SIG; - resp = hn_nvs_xact_execute(sc, xact, chim, sizeof(*chim), &resp_len); + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, chim, sizeof(*chim), &resp_len, + HN_NVS_TYPE_CHIM_CONNRESP); if (resp == NULL) { if_printf(sc->hn_ifp, "exec chim conn failed\n"); error = EIO; goto cleanup; } - if (resp_len < sizeof(*resp)) { - if_printf(sc->hn_ifp, "invalid chim conn resp length %zu\n", - resp_len); - error = EINVAL; - goto cleanup; - } - if (resp->nvs_type != HN_NVS_TYPE_CHIM_CONNRESP) { - if_printf(sc->hn_ifp, "not chim conn resp, type %u\n", - resp->nvs_type); - error = EINVAL; - goto cleanup; - } status = resp->nvs_status; sectsz = resp->nvs_sectsz; @@ -442,24 +446,14 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ init->nvs_ver_min = nvs_ver; init->nvs_ver_max = nvs_ver; - resp = hn_nvs_xact_execute(sc, xact, init, sizeof(*init), &resp_len); + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, init, sizeof(*init), &resp_len, + HN_NVS_TYPE_INIT_RESP); if (resp == NULL) { if_printf(sc->hn_ifp, "exec init failed\n"); vmbus_xact_put(xact); return (EIO); } - if (resp_len < sizeof(*resp)) { - if_printf(sc->hn_ifp, "invalid init resp length %zu\n", - resp_len); - vmbus_xact_put(xact); - return (EINVAL); - } - if (resp->nvs_type != HN_NVS_TYPE_INIT_RESP) { - if_printf(sc->hn_ifp, "not init resp, type %u\n", - resp->nvs_type); - vmbus_xact_put(xact); - return (EINVAL); - } status = resp->nvs_status; vmbus_xact_put(xact); @@ -641,7 +635,7 @@ cleanup: * Net VSC on device remove */ int -hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) +hv_nv_on_device_remove(struct hn_softc *sc) { hv_nv_disconnect_from_vsp(sc); Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:29:10 2016 (r307491) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 07:32:49 2016 (r307492) @@ -237,8 +237,8 @@ typedef void (*pfn_on_send_rx_completion #define TRANSPORT_TYPE_IPV6_UDP ((TYPE_IPV6 << 16) | TYPE_UDP) typedef struct { - uint8_t mac_addr[6]; /* Assumption unsigned long */ - uint8_t link_state; + uint8_t mac_addr[ETHER_ADDR_LEN]; + uint32_t link_state; } netvsc_device_info; #define HN_XACT_REQ_PGCNT 2 @@ -351,7 +351,6 @@ typedef struct hn_softc { int hn_initdone; /* See hv_netvsc_drv_freebsd.c for rules on how to use */ int temp_unusable; - struct rndis_device_ *rndis_dev; struct vmbus_channel *hn_prichan; int hn_rx_ring_cnt; @@ -400,8 +399,7 @@ struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); int hv_nv_on_device_add(struct hn_softc *sc, struct hn_rx_ring *rxr); -int hv_nv_on_device_remove(struct hn_softc *sc, - boolean_t destroy_channel); +int hv_nv_on_device_remove(struct hn_softc *sc); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); void hv_nv_subchan_attach(struct vmbus_channel *chan, Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:29:10 2016 (r307491) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:32:49 2016 (r307492) @@ -154,8 +154,8 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_BOUNDARY PAGE_SIZE #define HN_TX_DATA_MAXSIZE IP_MAXPACKET #define HN_TX_DATA_SEGSIZE PAGE_SIZE -#define HN_TX_DATA_SEGCNT_MAX \ - (NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) +/* -1 for RNDIS packet message */ +#define HN_TX_DATA_SEGCNT_MAX (NETVSC_PACKET_MAXPAGE - 1) #define HN_DIRECT_TX_SIZE_DEF 128 @@ -651,7 +651,7 @@ netvsc_detach(device_t dev) * the netdevice. */ - hv_rf_on_device_remove(sc, HV_RF_NV_DESTROY_CHANNEL); + hv_rf_on_device_remove(sc); hn_stop_tx_tasks(sc); @@ -1029,7 +1029,8 @@ hn_encap(struct hn_tx_ring *txr, struct } *m_head0 = m_head; - txr->hn_gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS; + /* +1 RNDIS packet message */ + txr->hn_gpa_cnt = nsegs + 1; /* send packet with page buffer */ txr->hn_gpa[0].gpa_page = atop(txd->rndis_msg_paddr); @@ -1037,12 +1038,11 @@ hn_encap(struct hn_tx_ring *txr, struct txr->hn_gpa[0].gpa_len = rndis_msg_size; /* - * Fill the page buffers with mbuf info starting at index - * HV_RF_NUM_TX_RESERVED_PAGE_BUFS. + * Fill the page buffers with mbuf info after the page + * buffer for RNDIS packet message. */ for (i = 0; i < nsegs; ++i) { - struct vmbus_gpa *gpa = &txr->hn_gpa[ - i + HV_RF_NUM_TX_RESERVED_PAGE_BUFS]; + struct vmbus_gpa *gpa = &txr->hn_gpa[i + 1]; gpa->gpa_page = atop(segs[i].ds_addr); gpa->gpa_ofs = segs[i].ds_addr & PAGE_MASK; @@ -1576,7 +1576,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * MTU to take effect. This includes tearing down, but not * deleting the channel, then bringing it back up. */ - error = hv_rf_on_device_remove(sc, HV_RF_NV_RETAIN_CHANNEL); + error = hv_rf_on_device_remove(sc); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:29:10 2016 (r307491) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:32:49 2016 (r307492) @@ -71,15 +71,14 @@ __FBSDID("$FreeBSD$"); /* * Forward declarations */ -static void hv_rf_receive_response(rndis_device *device, - const rndis_msg *response); -static void hv_rf_receive_indicate_status(rndis_device *device, +static void hv_rf_receive_indicate_status(struct hn_softc *sc, const rndis_msg *response); static void hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen); -static inline int hv_rf_query_device_mac(rndis_device *device); -static inline int hv_rf_query_device_link_status(rndis_device *device); -static int hv_rf_init_device(rndis_device *device); +static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr); +static int hv_rf_query_device_link_status(struct hn_softc *sc, + uint32_t *link_status); +static int hv_rf_init_device(struct hn_softc *sc); static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0); @@ -157,94 +156,24 @@ hv_get_ppi_data(rndis_packet *rpkt, uint return (NULL); } - -/* - * Allow module_param to work and override to switch to promiscuous mode. - */ -static inline rndis_device * -hv_get_rndis_device(void) -{ - rndis_device *device; - - device = malloc(sizeof(rndis_device), M_NETVSC, M_WAITOK | M_ZERO); - - mtx_init(&device->req_lock, "HV-FRL", NULL, MTX_DEF); - - /* Same effect as STAILQ_HEAD_INITIALIZER() static initializer */ - STAILQ_INIT(&device->myrequest_list); - - device->state = RNDIS_DEV_UNINITIALIZED; - - return (device); -} - -/* - * - */ -static inline void -hv_put_rndis_device(rndis_device *device) -{ - mtx_destroy(&device->req_lock); - free(device, M_NETVSC); -} - -/* - * RNDIS filter receive response - */ -static void -hv_rf_receive_response(rndis_device *device, const rndis_msg *response) -{ - rndis_request *request = NULL; - rndis_request *next_request; - boolean_t found = FALSE; - - mtx_lock(&device->req_lock); - request = STAILQ_FIRST(&device->myrequest_list); - while (request != NULL) { - /* - * All request/response message contains request_id as the - * first field - */ - if (request->request_msg.msg.init_request.request_id == - response->msg.init_complete.request_id) { - found = TRUE; - break; - } - next_request = STAILQ_NEXT(request, mylist_entry); - request = next_request; - } - mtx_unlock(&device->req_lock); - - if (found) { - if (response->msg_len <= sizeof(rndis_msg)) { - memcpy(&request->response_msg, response, - response->msg_len); - } else { - request->response_msg.msg.init_complete.status = - RNDIS_STATUS_BUFFER_OVERFLOW; - } - sema_post(&request->wait_sema); - } -} - /* * RNDIS filter receive indicate status */ static void -hv_rf_receive_indicate_status(rndis_device *device, const rndis_msg *response) +hv_rf_receive_indicate_status(struct hn_softc *sc, const rndis_msg *response) { const rndis_indicate_status *indicate = &response->msg.indicate_status; switch(indicate->status) { case RNDIS_STATUS_MEDIA_CONNECT: - netvsc_linkstatus_callback(device->sc, 1); + netvsc_linkstatus_callback(sc, 1); break; case RNDIS_STATUS_MEDIA_DISCONNECT: - netvsc_linkstatus_callback(device->sc, 0); + netvsc_linkstatus_callback(sc, 0); break; default: /* TODO: */ - device_printf(device->sc->hn_dev, + if_printf(sc->hn_ifp, "unknown status %d received\n", indicate->status); break; } @@ -374,14 +303,9 @@ int hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen) { - rndis_device *rndis_dev; const rndis_msg *rndis_hdr; const struct rndis_comp_hdr *comp; - rndis_dev = sc->rndis_dev; - if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) - return (EINVAL); - rndis_hdr = data; switch (rndis_hdr->ndis_msg_type) { /* data message */ @@ -395,17 +319,14 @@ hv_rf_on_receive(struct hn_softc *sc, st case REMOTE_NDIS_SET_CMPLT: case REMOTE_NDIS_KEEPALIVE_CMPLT: comp = data; - if (comp->rm_rid <= HN_RNDIS_RID_COMPAT_MAX) { - /* Transition time compat code */ - hv_rf_receive_response(rndis_dev, rndis_hdr); - } else { - vmbus_xact_ctx_wakeup(sc->hn_xact, data, dlen); - } + KASSERT(comp->rm_rid > HN_RNDIS_RID_COMPAT_MAX, + ("invalid rid 0x%08x\n", comp->rm_rid)); + vmbus_xact_ctx_wakeup(sc->hn_xact, comp, dlen); break; /* notification message */ case REMOTE_NDIS_INDICATE_STATUS_MSG: - hv_rf_receive_indicate_status(rndis_dev, rndis_hdr); + hv_rf_receive_indicate_status(sc, rndis_hdr); break; case REMOTE_NDIS_RESET_CMPLT: @@ -431,19 +352,18 @@ hv_rf_on_receive(struct hn_softc *sc, st * RNDIS filter query device MAC address */ static int -hv_rf_query_device_mac(rndis_device *device) +hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr) { - struct hn_softc *sc = device->sc; - size_t hwaddr_len; + size_t eaddr_len; int error; - hwaddr_len = ETHER_ADDR_LEN; + eaddr_len = ETHER_ADDR_LEN; error = hn_rndis_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0, - device->hw_mac_addr, &hwaddr_len); + eaddr, &eaddr_len); if (error) return (error); - if (hwaddr_len != ETHER_ADDR_LEN) { - if_printf(sc->hn_ifp, "invalid hwaddr len %zu\n", hwaddr_len); + if (eaddr_len != ETHER_ADDR_LEN) { + if_printf(sc->hn_ifp, "invalid eaddr len %zu\n", eaddr_len); return (EINVAL); } return (0); @@ -452,16 +372,15 @@ hv_rf_query_device_mac(rndis_device *dev /* * RNDIS filter query device link status */ -static inline int -hv_rf_query_device_link_status(rndis_device *device) +static int +hv_rf_query_device_link_status(struct hn_softc *sc, uint32_t *link_status) { - struct hn_softc *sc = device->sc; size_t size; int error; - size = sizeof(uint32_t); + size = sizeof(*link_status); error = hn_rndis_query(sc, OID_GEN_MEDIA_CONNECT_STATUS, NULL, 0, - &device->link_status, &size); + link_status, &size); if (error) return (error); if (size != sizeof(uint32_t)) { @@ -875,9 +794,8 @@ hn_rndis_set_rxfilter(struct hn_softc *s * RNDIS filter init device */ static int -hv_rf_init_device(rndis_device *device) +hv_rf_init_device(struct hn_softc *sc) { - struct hn_softc *sc = device->sc; struct rndis_init_req *req; const struct rndis_init_comp *comp; struct vmbus_xact *xact; @@ -885,9 +803,6 @@ hv_rf_init_device(rndis_device *device) uint32_t rid; int error; - /* XXX */ - device->state = RNDIS_DEV_INITIALIZED; - xact = vmbus_xact_get(sc->hn_xact, sizeof(*req)); if (xact == NULL) { if_printf(sc->hn_ifp, "no xact for RNDIS init\n"); @@ -918,15 +833,14 @@ hv_rf_init_device(rndis_device *device) goto done; } if (bootverbose) { - if_printf(sc->hn_ifp, "RNDIS ver %u.%u, pktsz %u, pktcnt %u\n", - comp->rm_ver_major, comp->rm_ver_minor, - comp->rm_pktmaxsz, comp->rm_pktmaxcnt); + if_printf(sc->hn_ifp, "RNDIS ver %u.%u, pktsz %u, pktcnt %u, " + "align %u\n", comp->rm_ver_major, comp->rm_ver_minor, + comp->rm_pktmaxsz, comp->rm_pktmaxcnt, + 1U << comp->rm_align); } error = 0; - done: - if (xact != NULL) - vmbus_xact_put(xact); + vmbus_xact_put(xact); return (error); } @@ -969,7 +883,6 @@ hv_rf_on_device_add(struct hn_softc *sc, int *nchan0, struct hn_rx_ring *rxr) { int ret; - rndis_device *rndis_dev; netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; device_t dev = sc->hn_dev; struct hn_nvs_subch_req *req; @@ -980,13 +893,6 @@ hv_rf_on_device_add(struct hn_softc *sc, int nchan = *nchan0; int rxr_cnt; - rndis_dev = hv_get_rndis_device(); - if (rndis_dev == NULL) { - return (ENOMEM); - } - sc->rndis_dev = rndis_dev; - rndis_dev->sc = sc; - /* * Let the inner driver handle this first to create the netvsc channel * NOTE! Once the channel is created, we may get a receive callback @@ -994,17 +900,15 @@ hv_rf_on_device_add(struct hn_softc *sc, * Note: Earlier code used a function pointer here. */ ret = hv_nv_on_device_add(sc, rxr); - if (ret != 0) { - hv_put_rndis_device(rndis_dev); + if (ret != 0) return (ret); - } /* * Initialize the rndis device */ /* Send the rndis initialization message */ - ret = hv_rf_init_device(rndis_dev); + ret = hv_rf_init_device(sc); if (ret != 0) { /* * TODO: If rndis init failed, we will need to shut down @@ -1013,19 +917,15 @@ hv_rf_on_device_add(struct hn_softc *sc, } /* Get the mac address */ - ret = hv_rf_query_device_mac(rndis_dev); + ret = hv_rf_query_device_mac(sc, dev_info->mac_addr); if (ret != 0) { /* TODO: shut down rndis device and the channel */ } /* Configure NDIS offload settings */ hn_rndis_conf_offload(sc); - - memcpy(dev_info->mac_addr, rndis_dev->hw_mac_addr, ETHER_ADDR_LEN); - hv_rf_query_device_link_status(rndis_dev); - - dev_info->link_state = rndis_dev->link_status; + hv_rf_query_device_link_status(sc, &dev_info->link_state); if (sc->hn_ndis_ver < NDIS_VERSION_6_30 || nchan == 1) { /* @@ -1070,24 +970,14 @@ hv_rf_on_device_add(struct hn_softc *sc, req->nvs_op = HN_NVS_SUBCH_OP_ALLOC; req->nvs_nsubch = nchan - 1; - resp = hn_nvs_xact_execute(sc, xact, req, sizeof(*req), &resp_len); + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, req, sizeof(*req), &resp_len, + HN_NVS_TYPE_SUBCH_RESP); if (resp == NULL) { if_printf(sc->hn_ifp, "exec subch failed\n"); ret = EIO; goto out; } - if (resp_len < sizeof(*resp)) { - if_printf(sc->hn_ifp, "invalid subch resp length %zu\n", - resp_len); - ret = EINVAL; - goto out; - } - if (resp->nvs_type != HN_NVS_TYPE_SUBCH_RESP) { - if_printf(sc->hn_ifp, "not subch resp, type %u\n", - resp->nvs_type); - ret = EINVAL; - goto out; - } status = resp->nvs_status; nsubch = resp->nvs_nsubch; @@ -1121,19 +1011,15 @@ out: * RNDIS filter on device remove */ int -hv_rf_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel) +hv_rf_on_device_remove(struct hn_softc *sc) { - rndis_device *rndis_dev = sc->rndis_dev; int ret; /* Halt and release the rndis device */ ret = hv_rf_halt_device(sc); - sc->rndis_dev = NULL; - hv_put_rndis_device(rndis_dev); - /* Pass control to inner driver to remove the device */ - ret |= hv_nv_on_device_remove(sc, destroy_channel); + ret |= hv_nv_on_device_remove(sc); return (ret); } Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 07:29:10 2016 (r307491) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 07:32:49 2016 (r307492) @@ -36,80 +36,6 @@ #include /* - * Defines - */ - -/* Destroy or preserve channel on filter/netvsc teardown */ -#define HV_RF_NV_DESTROY_CHANNEL TRUE -#define HV_RF_NV_RETAIN_CHANNEL FALSE - -/* - * Number of page buffers to reserve for the RNDIS filter packet in the - * transmitted message. - */ -#define HV_RF_NUM_TX_RESERVED_PAGE_BUFS 1 - - -/* - * Data types - */ - -typedef enum { - RNDIS_DEV_UNINITIALIZED = 0, - RNDIS_DEV_INITIALIZING, - RNDIS_DEV_INITIALIZED, - RNDIS_DEV_DATAINITIALIZED, -} rndis_device_state; - -typedef struct rndis_request_ { - STAILQ_ENTRY(rndis_request_) mylist_entry; - struct sema wait_sema; - - /* - * The max response size is sizeof(rndis_msg) + PAGE_SIZE. - * - * XXX - * This is ugly and should be cleaned up once we busdma-fy - * RNDIS request bits. - */ - rndis_msg response_msg; - uint8_t buf_resp[PAGE_SIZE]; - - /* Simplify allocation by having a netvsc packet inline */ - struct hn_send_ctx send_ctx; - - /* - * The max request size is sizeof(rndis_msg) + PAGE_SIZE. - * - * NOTE: - * This is required for the large request like RSS settings. - * - * XXX - * This is ugly and should be cleaned up once we busdma-fy - * RNDIS request bits. - */ - rndis_msg request_msg; - uint8_t buf_req[PAGE_SIZE]; - - /* Fixme: Poor man's semaphore. */ - uint32_t halt_complete_flag; -} rndis_request; - -typedef struct rndis_device_ { - struct hn_softc *sc; - - rndis_device_state state; - uint32_t link_status; - uint32_t new_request_id; - - struct mtx req_lock; - - STAILQ_HEAD(RQ, rndis_request_) myrequest_list; - - uint8_t hw_mac_addr[ETHER_ADDR_LEN]; -} rndis_device; - -/* * Externs */ struct hn_rx_ring; @@ -119,7 +45,7 @@ int hv_rf_on_receive(struct hn_softc *sc void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan, struct hn_rx_ring *rxr); -int hv_rf_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel); +int hv_rf_on_device_remove(struct hn_softc *sc); int hv_rf_on_open(struct hn_softc *sc); int hv_rf_on_close(struct hn_softc *sc); Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:29:10 2016 (r307491) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:32:49 2016 (r307492) @@ -111,7 +111,7 @@ struct vmbus_xact; const void *hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, - size_t *resp_len); + size_t *resp_len, uint32_t type); void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data, int dlen); uint32_t hn_chim_alloc(struct hn_softc *sc); From owner-svn-src-all@freebsd.org Mon Oct 17 07:35:32 2016 Return-Path: Delivered-To: svn-src-all@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 ABBB9C15119; Mon, 17 Oct 2016 07:35:32 +0000 (UTC) (envelope-from sephe@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 6B1A61F53; Mon, 17 Oct 2016 07:35:32 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7ZVfO013689; Mon, 17 Oct 2016 07:35:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7ZVZW013688; Mon, 17 Oct 2016 07:35:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170735.u9H7ZVZW013688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:35:31 +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: r307493 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:35:32 -0000 Author: sephe Date: Mon Oct 17 07:35:31 2016 New Revision: 307493 URL: https://svnweb.freebsd.org/changeset/base/307493 Log: MFC 305111 hyperv/timesync: Rework time adjustment policy - By default, adjust time upon SYNC request. It can be disabled through hw.hvtimesync.ignore_sync_req. SYNC request will be sent by hypervisor the host is resumed, rebooted, etc. - By default, adjust time upon SAMPLE request, if there is 100ms difference between VM time and hypervisor time. This can be disabled through hw.hvtimesync.sample_drift. And nuke the unnecessary task, since channel callback is running in a Hyper-V taskqueue nowadays. Submitted by: YanZhe Chen Discussed with: Dexuan Cui , Hongjiang Zhang , sephe Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7707 Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 07:32:49 2016 (r307492) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 07:35:31 2016 (r307493) @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include @@ -52,11 +52,7 @@ #define HV_ICTIMESYNCFLAG_SYNC 1 #define HV_ICTIMESYNCFLAG_SAMPLE 2 #define HV_NANO_SEC_PER_SEC 1000000000 - -/* Time Sync data */ -typedef struct { - uint64_t data; -} time_sync_data; +#define HV_NANO_SEC_PER_MILLI_SEC 1000000 static const struct vmbus_ic_desc vmbus_timesync_descs[] = { { @@ -75,22 +71,43 @@ struct hv_ictimesync_data { uint8_t flags; } __packed; -typedef struct hv_timesync_sc { - hv_util_sc util_sc; - struct task task; - time_sync_data time_msg; -} hv_timesync_sc; +/* + * Globals + */ +SYSCTL_NODE(_hw, OID_AUTO, hvtimesync, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, + "Hyper-V timesync interface"); + +/* Ignore the sync request when set to 1. */ +static int ignore_sync_req = 0; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, ignore_sync_req, CTLFLAG_RWTUN, + &ignore_sync_req, 0, + "Ignore the sync request when set to 1."); + +/* + * Trigger sample sync when drift exceeds threshold (ms). + * Ignore the sample request when set to 0. + */ +static int sample_drift = 100; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sample_drift, CTLFLAG_RWTUN, + &sample_drift, 0, + "Threshold that makes sample request trigger the sync."); /** - * Set host time based on time sync message from host + * @brief Synchronize time with host after reboot, restore, etc. + * + * ICTIMESYNCFLAG_SYNC flag bit indicates reboot, restore events of the VM. + * After reboot the flag ICTIMESYNCFLAG_SYNC is included in the first time + * message after the timesync channel is opened. Since the hv_utils module is + * loaded after hv_vmbus, the first message is usually missed. The other + * thing is, systime is automatically set to emulated hardware clock which may + * not be UTC time or in the same time zone. So, to override these effects, we + * use the first 50 time samples for initial system time setting. */ -static void -hv_set_host_time(void *context, int pending) +static inline +void hv_adj_guesttime(hv_util_sc *sc, uint64_t hosttime, uint8_t flags) { - hv_timesync_sc *softc = (hv_timesync_sc*)context; - uint64_t hosttime = softc->time_msg.data; struct timespec guest_ts, host_ts; - uint64_t host_tns; + uint64_t host_tns, guest_tns; int64_t diff; int error; @@ -99,37 +116,35 @@ hv_set_host_time(void *context, int pend host_ts.tv_nsec = (long)(host_tns%HV_NANO_SEC_PER_SEC); nanotime(&guest_ts); + guest_tns = guest_ts.tv_sec * HV_NANO_SEC_PER_SEC + guest_ts.tv_nsec; - diff = (int64_t)host_ts.tv_sec - (int64_t)guest_ts.tv_sec; + if ((flags & HV_ICTIMESYNCFLAG_SYNC) != 0 && ignore_sync_req == 0) { + if (bootverbose) { + device_printf(sc->ic_dev, "handle sync request " + "{host: %ju, guest: %ju}\n", + (uintmax_t)host_tns, (uintmax_t)guest_tns); + } - /* - * If host differs by 5 seconds then make the guest catch up - */ - if (diff > 5 || diff < -5) { error = kern_clock_settime(curthread, CLOCK_REALTIME, &host_ts); + return; } -} -/** - * @brief Synchronize time with host after reboot, restore, etc. - * - * ICTIMESYNCFLAG_SYNC flag bit indicates reboot, restore events of the VM. - * After reboot the flag ICTIMESYNCFLAG_SYNC is included in the first time - * message after the timesync channel is opened. Since the hv_utils module is - * loaded after hv_vmbus, the first message is usually missed. The other - * thing is, systime is automatically set to emulated hardware clock which may - * not be UTC time or in the same time zone. So, to override these effects, we - * use the first 50 time samples for initial system time setting. - */ -static inline -void hv_adj_guesttime(hv_timesync_sc *sc, uint64_t hosttime, uint8_t flags) -{ - sc->time_msg.data = hosttime; - - if (((flags & HV_ICTIMESYNCFLAG_SYNC) != 0) || - ((flags & HV_ICTIMESYNCFLAG_SAMPLE) != 0)) { - taskqueue_enqueue(taskqueue_thread, &sc->task); + if ((flags & HV_ICTIMESYNCFLAG_SAMPLE) != 0 && sample_drift != 0) { + if (bootverbose) { + device_printf(sc->ic_dev, "handle sample request " + "{host: %ju, guest: %ju}\n", + (uintmax_t)host_tns, (uintmax_t)guest_tns); + } + + diff = (int64_t)(host_tns - guest_tns) / HV_NANO_SEC_PER_MILLI_SEC; + if (diff > sample_drift || diff < -sample_drift) { + error = kern_clock_settime(curthread, CLOCK_REALTIME, + &host_ts); + if (bootverbose) + device_printf(sc->ic_dev, "trigger sample sync"); + } + return; } } @@ -145,12 +160,12 @@ hv_timesync_cb(struct vmbus_channel *cha int ret; uint8_t* time_buf; struct hv_ictimesync_data* timedatap; - hv_timesync_sc *softc; + hv_util_sc *softc; - softc = (hv_timesync_sc*)context; - time_buf = softc->util_sc.receive_buffer; + softc = (hv_util_sc*)context; + time_buf = softc->receive_buffer; - recvlen = softc->util_sc.ic_buflen; + recvlen = softc->ic_buflen; ret = vmbus_chan_recv(channel, time_buf, &recvlen, &requestId); KASSERT(ret != ENOBUFS, ("hvtimesync recvbuf is not large enough")); /* XXX check recvlen to make sure that it contains enough data */ @@ -162,7 +177,7 @@ hv_timesync_cb(struct vmbus_channel *cha if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { int error; - error = vmbus_ic_negomsg(&softc->util_sc, time_buf, &recvlen); + error = vmbus_ic_negomsg(softc, time_buf, &recvlen); if (error) return; } else { @@ -190,18 +205,12 @@ hv_timesync_probe(device_t dev) static int hv_timesync_attach(device_t dev) { - hv_timesync_sc *softc = device_get_softc(dev); - - TASK_INIT(&softc->task, 1, hv_set_host_time, softc); return hv_util_attach(dev, hv_timesync_cb); } static int hv_timesync_detach(device_t dev) { - hv_timesync_sc *softc = device_get_softc(dev); - - taskqueue_drain(taskqueue_thread, &softc->task); return hv_util_detach(dev); } @@ -213,7 +222,7 @@ static device_method_t timesync_methods[ { 0, 0 } }; -static driver_t timesync_driver = { "hvtimesync", timesync_methods, sizeof(hv_timesync_sc)}; +static driver_t timesync_driver = { "hvtimesync", timesync_methods, sizeof(hv_util_sc)}; static devclass_t timesync_devclass; From owner-svn-src-all@freebsd.org Mon Oct 17 07:38:23 2016 Return-Path: Delivered-To: svn-src-all@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 3C410C1523C; Mon, 17 Oct 2016 07:38:23 +0000 (UTC) (envelope-from sephe@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 DEF1910DC; Mon, 17 Oct 2016 07:38:22 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7cMTg013844; Mon, 17 Oct 2016 07:38:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7cLbt013841; Mon, 17 Oct 2016 07:38:21 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170738.u9H7cLbt013841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:38: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: r307494 - in stable/11/sys: dev/hyperv/netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:38:23 -0000 Author: sephe Date: Mon Oct 17 07:38:21 2016 New Revision: 307494 URL: https://svnweb.freebsd.org/changeset/base/307494 Log: MFC 305173,305174 305173 net/rndis: Add comment for rndis_set_parameter Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7705 305174 hyperv/hn: Remove unused function Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7706 Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:35:31 2016 (r307493) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Mon Oct 17 07:38:21 2016 (r307494) @@ -904,7 +904,5 @@ void* hv_set_rppi_data(rndis_msg *rndis_ uint32_t rppi_size, int pkt_type); -void* hv_get_ppi_data(rndis_packet *rpkt, uint32_t type); - #endif /* __HV_RNDIS_H__ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:35:31 2016 (r307493) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:38:21 2016 (r307494) @@ -128,35 +128,6 @@ hv_set_rppi_data(rndis_msg *rndis_mesg, } /* - * Get the Per-Packet-Info with the specified type - * return NULL if not found. - */ -void * -hv_get_ppi_data(rndis_packet *rpkt, uint32_t type) -{ - rndis_per_packet_info *ppi; - int len; - - if (rpkt->per_pkt_info_offset == 0) - return (NULL); - - ppi = (rndis_per_packet_info *)((unsigned long)rpkt + - rpkt->per_pkt_info_offset); - len = rpkt->per_pkt_info_length; - - while (len > 0) { - if (ppi->type == type) - return (void *)((unsigned long)ppi + - ppi->per_packet_info_offset); - - len -= ppi->size; - ppi = (rndis_per_packet_info *)((unsigned long)ppi + ppi->size); - } - - return (NULL); -} - -/* * RNDIS filter receive indicate status */ static void Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Mon Oct 17 07:35:31 2016 (r307493) +++ stable/11/sys/net/rndis.h Mon Oct 17 07:38:21 2016 (r307494) @@ -217,6 +217,9 @@ struct rndis_set_comp { uint32_t rm_status; }; +/* + * Parameter used by OID_GEN_RNDIS_CONFIG_PARAMETER. + */ #define REMOTE_NDIS_SET_PARAM_NUMERIC 0x00000000 #define REMOTE_NDIS_SET_PARAM_STRING 0x00000002 From owner-svn-src-all@freebsd.org Mon Oct 17 07:46:15 2016 Return-Path: Delivered-To: svn-src-all@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 8E90FC15427; Mon, 17 Oct 2016 07:46:15 +0000 (UTC) (envelope-from sephe@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 520FD15CF; Mon, 17 Oct 2016 07:46:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H7kEkZ017726; Mon, 17 Oct 2016 07:46:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H7kDji017720; Mon, 17 Oct 2016 07:46:13 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170746.u9H7kDji017720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 07:46: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: r307495 - in stable/11/sys: dev/hyperv/netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 07:46:15 -0000 Author: sephe Date: Mon Oct 17 07:46:13 2016 New Revision: 307495 URL: https://svnweb.freebsd.org/changeset/base/307495 Log: MFC 305175,305176,305179,305182,305268,305270,305276 305175 net/rndis: Define per-packet-info for RNDIS packet message Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7708 305176 hyperv/hn: Stringent per-packet-info verification. While I'm here, minor style changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7709 305179 hyperv/hn: Fix VLAN tag construction. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7716 305182 net/rndis: Define types for RNDIS pktinfo rm_type field. They are defined by NDIS spec, so the NDIS prefix. Reviewed by: hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7717 305268 hyperv/hn: Rework RXCSUM related bits Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7735 305270 hyperv/hn: Simplify RX hash related bits. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7736 305276 hyperv/hn: Use the per-packet-info types defined by net/rndis.h Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7737 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnreg.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/netvsc/ndis.h stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:38:21 2016 (r307494) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 07:46:13 2016 (r307495) @@ -1289,7 +1289,7 @@ netvsc_recv(struct hn_rx_ring *rxr, cons struct ifnet *ifp = rxr->hn_ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; - int hash_type = M_HASHTYPE_OPAQUE_HASH; + int hash_type; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) return (0); @@ -1335,28 +1335,29 @@ netvsc_recv(struct hn_rx_ring *rxr, cons do_csum = 0; /* receive side checksum offload */ - if (info->csum_info != NULL) { + if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) { /* IP csum offload */ - if (info->csum_info->receive.ip_csum_succeeded && do_csum) { + if ((info->csum_info & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); rxr->hn_csum_ip++; } /* TCP/UDP csum offload */ - if ((info->csum_info->receive.tcp_csum_succeeded || - info->csum_info->receive.udp_csum_succeeded) && do_csum) { + if ((info->csum_info & (NDIS_RXCSUM_INFO_UDPCS_OK | + NDIS_RXCSUM_INFO_TCPCS_OK)) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; - if (info->csum_info->receive.tcp_csum_succeeded) + if (info->csum_info & NDIS_RXCSUM_INFO_TCPCS_OK) rxr->hn_csum_tcp++; else rxr->hn_csum_udp++; } - if (info->csum_info->receive.ip_csum_succeeded && - info->csum_info->receive.tcp_csum_succeeded) + if ((info->csum_info & + (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) == + (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) do_lro = 1; } else { const struct ether_header *eh; @@ -1412,18 +1413,21 @@ netvsc_recv(struct hn_rx_ring *rxr, cons } } skip: - if (info->vlan_info != NULL) { - m_new->m_pkthdr.ether_vtag = info->vlan_info->u1.s1.vlan_id; + if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) { + m_new->m_pkthdr.ether_vtag = EVL_MAKETAG( + NDIS_VLAN_INFO_ID(info->vlan_info), + NDIS_VLAN_INFO_PRI(info->vlan_info), + NDIS_VLAN_INFO_CFI(info->vlan_info)); m_new->m_flags |= M_VLANTAG; } - if (info->hash_info != NULL && info->hash_value != NULL) { + if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { rxr->hn_rss_pkts++; - m_new->m_pkthdr.flowid = info->hash_value->hash_value; - if ((info->hash_info->hash_info & NDIS_HASH_FUNCTION_MASK) == + m_new->m_pkthdr.flowid = info->hash_value; + hash_type = M_HASHTYPE_OPAQUE_HASH; + if ((info->hash_info & NDIS_HASH_FUNCTION_MASK) == NDIS_HASH_FUNCTION_TOEPLITZ) { - uint32_t type = - (info->hash_info->hash_info & NDIS_HASH_TYPE_MASK); + uint32_t type = (info->hash_info & NDIS_HASH_TYPE_MASK); switch (type) { case NDIS_HASH_IPV4: @@ -1452,12 +1456,8 @@ skip: } } } else { - if (info->hash_value != NULL) { - m_new->m_pkthdr.flowid = info->hash_value->hash_value; - } else { - m_new->m_pkthdr.flowid = rxr->hn_rx_idx; - hash_type = M_HASHTYPE_OPAQUE; - } + m_new->m_pkthdr.flowid = rxr->hn_rx_idx; + hash_type = M_HASHTYPE_OPAQUE; } M_HASHTYPE_SET(m_new, hash_type); Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:38:21 2016 (r307494) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 07:46:13 2016 (r307495) @@ -153,79 +153,92 @@ hv_rf_receive_indicate_status(struct hn_ static int hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info) { - const rndis_per_packet_info *ppi; - uint32_t mask, len; + const struct rndis_pktinfo *pi; + uint32_t mask = 0, len; - info->vlan_info = NULL; - info->csum_info = NULL; - info->hash_info = NULL; - info->hash_value = NULL; + info->vlan_info = HN_NDIS_VLAN_INFO_INVALID; + info->csum_info = HN_NDIS_RXCSUM_INFO_INVALID; + info->hash_info = HN_NDIS_HASH_INFO_INVALID; if (rpkt->per_pkt_info_offset == 0) - return 0; + return (0); + if (__predict_false(rpkt->per_pkt_info_offset & + (RNDIS_PKTINFO_ALIGN - 1))) + return (EINVAL); + if (__predict_false(rpkt->per_pkt_info_offset < + RNDIS_PACKET_MSG_OFFSET_MIN)) + return (EINVAL); - ppi = (const rndis_per_packet_info *) + pi = (const struct rndis_pktinfo *) ((const uint8_t *)rpkt + rpkt->per_pkt_info_offset); len = rpkt->per_pkt_info_length; - mask = 0; while (len != 0) { - const void *ppi_dptr; - uint32_t ppi_dlen; + const void *data; + uint32_t dlen; - if (__predict_false(ppi->size < ppi->per_packet_info_offset)) - return EINVAL; - ppi_dlen = ppi->size - ppi->per_packet_info_offset; - ppi_dptr = (const uint8_t *)ppi + ppi->per_packet_info_offset; - - switch (ppi->type) { - case ieee_8021q_info: - if (__predict_false(ppi_dlen < sizeof(ndis_8021q_info))) - return EINVAL; - info->vlan_info = ppi_dptr; + if (__predict_false(len < sizeof(*pi))) + return (EINVAL); + if (__predict_false(len < pi->rm_size)) + return (EINVAL); + len -= pi->rm_size; + + if (__predict_false(pi->rm_size & (RNDIS_PKTINFO_ALIGN - 1))) + return (EINVAL); + if (__predict_false(pi->rm_size < pi->rm_pktinfooffset)) + return (EINVAL); + dlen = pi->rm_size - pi->rm_pktinfooffset; + data = pi->rm_data; + + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = *((const uint32_t *)data); mask |= HV_RF_RECVINFO_VLAN; break; - case tcpip_chksum_info: - if (__predict_false(ppi_dlen < - sizeof(rndis_tcp_ip_csum_info))) - return EINVAL; - info->csum_info = ppi_dptr; + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = *((const uint32_t *)data); mask |= HV_RF_RECVINFO_CSUM; break; - case nbl_hash_value: - if (__predict_false(ppi_dlen < - sizeof(struct rndis_hash_value))) - return EINVAL; - info->hash_value = ppi_dptr; + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = *((const uint32_t *)data); mask |= HV_RF_RECVINFO_HASHVAL; break; - case nbl_hash_info: - if (__predict_false(ppi_dlen < - sizeof(struct rndis_hash_info))) - return EINVAL; - info->hash_info = ppi_dptr; + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = *((const uint32_t *)data); mask |= HV_RF_RECVINFO_HASHINF; break; default: - goto skip; + goto next; } if (mask == HV_RF_RECVINFO_ALL) { /* All found; done */ break; } -skip: - if (__predict_false(len < ppi->size)) - return EINVAL; - len -= ppi->size; - ppi = (const rndis_per_packet_info *) - ((const uint8_t *)ppi + ppi->size); +next: + pi = (const struct rndis_pktinfo *) + ((const uint8_t *)pi + pi->rm_size); } - return 0; + + /* + * Final fixup. + * - If there is no hash value, invalidate the hash info. + */ + if ((mask & HV_RF_RECVINFO_HASHVAL) == 0) + info->hash_info = HN_NDIS_HASH_INFO_INVALID; + return (0); } /* Modified: stable/11/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Mon Oct 17 07:38:21 2016 (r307494) +++ stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Mon Oct 17 07:46:13 2016 (r307495) @@ -208,4 +208,17 @@ struct hn_nvs_rndis_ack { } __packed; CTASSERT(sizeof(struct hn_nvs_rndis_ack) >= HN_NVS_REQSIZE_MIN); +/* + * RNDIS extension + */ + +/* Per-packet hash info */ +#define HN_NDIS_HASH_INFO_SIZE sizeof(uint32_t) +#define HN_NDIS_PKTINFO_TYPE_HASHINF NDIS_PKTINFO_TYPE_ORIG_NBLIST +/* NDIS_HASH_ */ + +/* Per-packet hash value */ +#define HN_NDIS_HASH_VALUE_SIZE sizeof(uint32_t) +#define HN_NDIS_PKTINFO_TYPE_HASHVAL NDIS_PKTINFO_TYPE_PKT_CANCELID + #endif /* !_IF_HNREG_H_ */ Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:38:21 2016 (r307494) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 07:46:13 2016 (r307495) @@ -55,11 +55,15 @@ struct rndix_hash_value; struct ndis_8021q_info_; struct rndis_tcp_ip_csum_info_; +#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff +#define HN_NDIS_RXCSUM_INFO_INVALID 0 +#define HN_NDIS_HASH_INFO_INVALID 0 + struct hn_recvinfo { - const struct ndis_8021q_info_ *vlan_info; - const struct rndis_tcp_ip_csum_info_ *csum_info; - const struct rndis_hash_info *hash_info; - const struct rndis_hash_value *hash_value; + uint32_t vlan_info; + uint32_t csum_info; + uint32_t hash_info; + uint32_t hash_value; }; #define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ Modified: stable/11/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 07:38:21 2016 (r307494) +++ stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 07:46:13 2016 (r307495) @@ -203,4 +203,32 @@ struct ndis_rssprm_toeplitz { uint32_t rss_ind[NDIS_HASH_INDCNT]; }; +/* + * Per-packet-info + */ + +/* VLAN */ +#define NDIS_VLAN_INFO_SIZE sizeof(uint32_t) +#define NDIS_VLAN_INFO_PRI_MASK 0x0007 +#define NDIS_VLAN_INFO_CFI_MASK 0x0008 +#define NDIS_VLAN_INFO_ID_MASK 0xfff0 +#define NDIS_VLAN_INFO_MAKE(id, pri, cfi) \ + (((pri) & NVIS_VLAN_INFO_PRI_MASK) | \ + (((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4)) +#define NDIS_VLAN_INFO_ID(inf) (((inf) & NDIS_VLAN_INFO_ID_MASK) >> 4) +#define NDIS_VLAN_INFO_CFI(inf) (((inf) & NDIS_VLAN_INFO_CFI_MASK) >> 3) +#define NDIS_VLAN_INFO_PRI(inf) ((inf) & NDIS_VLAN_INFO_PRI_MASK) + +/* Reception checksum */ +#define NDIS_RXCSUM_INFO_SIZE sizeof(uint32_t) +#define NDIS_RXCSUM_INFO_TCPCS_FAILED 0x0001 +#define NDIS_RXCSUM_INFO_UDPCS_FAILED 0x0002 +#define NDIS_RXCSUM_INFO_IPCS_FAILED 0x0004 +#define NDIS_RXCSUM_INFO_TCPCS_OK 0x0008 +#define NDIS_RXCSUM_INFO_UDPCS_OK 0x0010 +#define NDIS_RXCSUM_INFO_IPCS_OK 0x0020 +#define NDIS_RXCSUM_INFO_LOOPBACK 0x0040 +#define NDIS_RXCSUM_INFO_TCPCS_INVAL 0x0080 +#define NDIS_RXCSUM_INFO_IPCS_INVAL 0x0100 + #endif /* !_NET_NDIS_H_ */ Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Mon Oct 17 07:38:21 2016 (r307494) +++ stable/11/sys/net/rndis.h Mon Oct 17 07:46:13 2016 (r307495) @@ -112,6 +112,39 @@ struct rndis_packet_msg { }; /* + * Minimum value for rm_dataoffset, rm_oobdataoffset, and + * rm_pktinfooffset. + */ +#define RNDIS_PACKET_MSG_OFFSET_MIN \ + (sizeof(struct rndis_packet_msg) - \ + __offsetof(struct rndis_packet_msg, rm_dataoffset)) + +/* Per-packet-info for RNDIS data message */ +struct rndis_pktinfo { + uint32_t rm_size; + uint32_t rm_type; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_pktinfooffset; + uint8_t rm_data[]; +}; + +#define RNDIS_PKTINFO_OFFSET \ + __offsetof(struct rndis_pktinfo, rm_data[0]) +#define RNDIS_PKTINFO_ALIGN 4 + +#define NDIS_PKTINFO_TYPE_CSUM 0 +#define NDIS_PKTINFO_TYPE_IPSEC 1 +#define NDIS_PKTINFO_TYPE_LSO 2 +#define NDIS_PKTINFO_TYPE_CLASSIFY 3 +/* reserved 4 */ +#define NDIS_PKTINFO_TYPE_SGLIST 5 +#define NDIS_PKTINFO_TYPE_VLAN 6 +#define NDIS_PKTINFO_TYPE_ORIG 7 +#define NDIS_PKTINFO_TYPE_PKT_CANCELID 8 +#define NDIS_PKTINFO_TYPE_ORIG_NBLIST 9 +#define NDIS_PKTINFO_TYPE_CACHE_NBLIST 10 +#define NDIS_PKTINFO_TYPE_PKT_PAD 11 + +/* * RNDIS control messages */ struct rndis_comp_hdr { From owner-svn-src-all@freebsd.org Mon Oct 17 08:03:16 2016 Return-Path: Delivered-To: svn-src-all@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 B74D4C15A36; Mon, 17 Oct 2016 08:03:16 +0000 (UTC) (envelope-from sephe@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 88D2B1E58; Mon, 17 Oct 2016 08:03:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H83Fc3024975; Mon, 17 Oct 2016 08:03:15 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H83FkP024974; Mon, 17 Oct 2016 08:03:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170803.u9H83FkP024974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:03: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: r307496 - stable/11/sys/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:03:16 -0000 Author: sephe Date: Mon Oct 17 08:03:15 2016 New Revision: 307496 URL: https://svnweb.freebsd.org/changeset/base/307496 Log: MFC 305277,305278 305277 net/rndis: Add comment for rndis_comp_hdr Reviewed by: hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7738 305278 net/rndis: Define common message header for RNDIS messages. And avoid RNDIS_HEADER_OFFSET hardcoding. Reviewed by: hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7739 Modified: stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Mon Oct 17 07:46:13 2016 (r307495) +++ stable/11/sys/net/rndis.h Mon Oct 17 08:03:15 2016 (r307496) @@ -93,6 +93,14 @@ #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002 /* + * Common RNDIS message header. + */ +struct rndis_msghdr { + uint32_t rm_type; + uint32_t rm_len; +}; + +/* * RNDIS data message */ #define REMOTE_NDIS_PACKET_MSG 0x00000001 @@ -147,6 +155,12 @@ struct rndis_pktinfo { /* * RNDIS control messages */ + +/* + * Common header for RNDIS completion messages. + * + * NOTE: It does not apply to REMOTE_NDIS_RESET_CMPLT. + */ struct rndis_comp_hdr { uint32_t rm_type; uint32_t rm_len; @@ -316,7 +330,7 @@ struct rndis_keepalive_comp { #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 /* RNDIS offsets */ -#define RNDIS_HEADER_OFFSET 8 /* bytes */ +#define RNDIS_HEADER_OFFSET ((uint32_t)sizeof(struct rndis_msghdr)) #define RNDIS_DATA_OFFSET \ ((uint32_t)(sizeof(struct rndis_packet_msg) - RNDIS_HEADER_OFFSET)) From owner-svn-src-all@freebsd.org Mon Oct 17 08:06:21 2016 Return-Path: Delivered-To: svn-src-all@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 43B7DC15AFD; Mon, 17 Oct 2016 08:06:21 +0000 (UTC) (envelope-from sephe@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 12CCA100B; Mon, 17 Oct 2016 08:06:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H86K0t025149; Mon, 17 Oct 2016 08:06:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H86Jet025145; Mon, 17 Oct 2016 08:06:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170806.u9H86Jet025145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:06: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: r307497 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:06:21 -0000 Author: sephe Date: Mon Oct 17 08:06:19 2016 New Revision: 307497 URL: https://svnweb.freebsd.org/changeset/base/307497 Log: MFC 305279-305281 305279 hyperv/ic: Minor style fix. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7743 305280 hyperv/ic: Cleanup shutdown channel callback. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7744 305281 hyperv/ic: Cleanup timesync channel callback. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7745 Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c stable/11/sys/dev/hyperv/utilities/hv_shutdown.c stable/11/sys/dev/hyperv/utilities/hv_timesync.c stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 08:03:15 2016 (r307496) +++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c Mon Oct 17 08:06:19 2016 (r307497) @@ -69,7 +69,7 @@ vmbus_heartbeat_cb(struct vmbus_channel if (error) return; - if (dlen < sizeof(struct vmbus_icmsg_hdr)) { + if (dlen < sizeof(*hdr)) { device_printf(sc->ic_dev, "invalid data len %d\n", dlen); return; } Modified: stable/11/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 08:03:15 2016 (r307496) +++ stable/11/sys/dev/hyperv/utilities/hv_shutdown.c Mon Oct 17 08:06:19 2016 (r307497) @@ -22,28 +22,23 @@ * 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$ */ -/* - * A common driver for all hyper-V util services. - */ +#include +__FBSDID("$FreeBSD$"); #include -#include #include -#include +#include #include #include -#include -#include #include #include #include -#include -#include "hv_util.h" +#include +#include + #include "vmbus_if.h" static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { @@ -56,73 +51,78 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; -/** - * Shutdown - */ static void -hv_shutdown_cb(struct vmbus_channel *channel, void *context) +vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) { - uint8_t* buf; - uint8_t execute_shutdown = 0; - hv_vmbus_icmsg_hdr* icmsghdrp; - uint32_t recv_len; - uint64_t request_id; - int ret; - hv_vmbus_shutdown_msg_data* shutdown_msg; - hv_util_sc *softc; - - softc = (hv_util_sc*)context; - buf = softc->receive_buffer; - - recv_len = softc->ic_buflen; - ret = vmbus_chan_recv(channel, buf, &recv_len, &request_id); - KASSERT(ret != ENOBUFS, ("hvshutdown recvbuf is not large enough")); - /* XXX check recv_len to make sure that it contains enough data */ - - if ((ret == 0) && recv_len > 0) { - - icmsghdrp = (struct hv_vmbus_icmsg_hdr *) - &buf[sizeof(struct hv_vmbus_pipe_hdr)]; - - if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - int error; + struct hv_util_sc *sc = xsc; + struct vmbus_icmsg_hdr *hdr; + struct vmbus_icmsg_shutdown *msg; + int dlen, error, do_shutdown = 0; + uint64_t xactid; + void *data; + + /* + * Receive request. + */ + data = sc->receive_buffer; + dlen = sc->ic_buflen; + error = vmbus_chan_recv(chan, data, &dlen, &xactid); + KASSERT(error != ENOBUFS, ("icbuf is not large enough")); + if (error) + return; + + if (dlen < sizeof(*hdr)) { + device_printf(sc->ic_dev, "invalid data len %d\n", dlen); + return; + } + hdr = data; - error = vmbus_ic_negomsg(softc, buf, &recv_len); + /* + * Update request, which will be echoed back as response. + */ + switch (hdr->ic_type) { + case VMBUS_ICMSG_TYPE_NEGOTIATE: + error = vmbus_ic_negomsg(sc, data, &dlen); if (error) return; - } else { - shutdown_msg = - (struct hv_vmbus_shutdown_msg_data *) - &buf[sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; - - switch (shutdown_msg->flags) { - case 0: - case 1: - icmsghdrp->status = HV_S_OK; - execute_shutdown = 1; - if(bootverbose) - printf("Shutdown request received -" - " graceful shutdown initiated\n"); - break; - default: - icmsghdrp->status = HV_E_FAIL; - execute_shutdown = 0; - printf("Shutdown request received -" - " Invalid request\n"); - break; - } - } + break; - icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | - HV_ICMSGHDRFLAG_RESPONSE; + case VMBUS_ICMSG_TYPE_SHUTDOWN: + if (dlen < VMBUS_ICMSG_SHUTDOWN_SIZE_MIN) { + device_printf(sc->ic_dev, "invalid shutdown len %d\n", + dlen); + return; + } + msg = data; - vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, - buf, recv_len, request_id); + /* XXX ic_flags definition? */ + if (msg->ic_haltflags == 0 || msg->ic_haltflags == 1) { + device_printf(sc->ic_dev, "shutdown requested\n"); + hdr->ic_status = VMBUS_ICMSG_STATUS_OK; + do_shutdown = 1; + } else { + device_printf(sc->ic_dev, "unknown shutdown flags " + "0x%08x\n", msg->ic_haltflags); + hdr->ic_status = VMBUS_ICMSG_STATUS_FAIL; + } + break; + + default: + device_printf(sc->ic_dev, "got 0x%08x icmsg\n", hdr->ic_type); + break; } - if (execute_shutdown) - shutdown_nice(RB_POWEROFF); + /* + * Send response by echoing the updated request back. + */ + hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; + error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + data, dlen, xactid); + if (error) + device_printf(sc->ic_dev, "resp send failed: %d\n", error); + + if (do_shutdown) + shutdown_nice(RB_POWEROFF); } static int @@ -135,7 +135,8 @@ hv_shutdown_probe(device_t dev) static int hv_shutdown_attach(device_t dev) { - return hv_util_attach(dev, hv_shutdown_cb); + + return (hv_util_attach(dev, vmbus_shutdown_cb)); } static device_method_t shutdown_methods[] = { Modified: stable/11/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 08:03:15 2016 (r307496) +++ stable/11/sys/dev/hyperv/utilities/hv_timesync.c Mon Oct 17 08:06:19 2016 (r307497) @@ -22,37 +22,25 @@ * 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$ */ -/* - * A common driver for all hyper-V util services. - */ +#include +__FBSDID("$FreeBSD$"); #include -#include #include -#include +#include #include -#include -#include #include -#include #include +#include #include #include -#include -#include "hv_util.h" -#include "vmbus_if.h" +#include +#include -#define HV_WLTIMEDELTA 116444736000000000L /* in 100ns unit */ -#define HV_ICTIMESYNCFLAG_PROBE 0 -#define HV_ICTIMESYNCFLAG_SYNC 1 -#define HV_ICTIMESYNCFLAG_SAMPLE 2 -#define HV_NANO_SEC_PER_SEC 1000000000 -#define HV_NANO_SEC_PER_MILLI_SEC 1000000 +#include "vmbus_if.h" static const struct vmbus_ic_desc vmbus_timesync_descs[] = { { @@ -64,135 +52,144 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; -struct hv_ictimesync_data { - uint64_t parenttime; - uint64_t childtime; - uint64_t roundtriptime; - uint8_t flags; -} __packed; - -/* - * Globals - */ SYSCTL_NODE(_hw, OID_AUTO, hvtimesync, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "Hyper-V timesync interface"); -/* Ignore the sync request when set to 1. */ -static int ignore_sync_req = 0; -SYSCTL_INT(_hw_hvtimesync, OID_AUTO, ignore_sync_req, CTLFLAG_RWTUN, - &ignore_sync_req, 0, - "Ignore the sync request when set to 1."); +static int vmbus_ts_ignore_sync = 0; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, ignore_sync, CTLFLAG_RWTUN, + &vmbus_ts_ignore_sync, 0, "Ignore the sync request."); /* * Trigger sample sync when drift exceeds threshold (ms). * Ignore the sample request when set to 0. */ -static int sample_drift = 100; -SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sample_drift, CTLFLAG_RWTUN, - &sample_drift, 0, - "Threshold that makes sample request trigger the sync."); - -/** - * @brief Synchronize time with host after reboot, restore, etc. - * - * ICTIMESYNCFLAG_SYNC flag bit indicates reboot, restore events of the VM. - * After reboot the flag ICTIMESYNCFLAG_SYNC is included in the first time - * message after the timesync channel is opened. Since the hv_utils module is - * loaded after hv_vmbus, the first message is usually missed. The other - * thing is, systime is automatically set to emulated hardware clock which may - * not be UTC time or in the same time zone. So, to override these effects, we - * use the first 50 time samples for initial system time setting. - */ -static inline -void hv_adj_guesttime(hv_util_sc *sc, uint64_t hosttime, uint8_t flags) +static int vmbus_ts_sample_thresh = 100; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sample_thresh, CTLFLAG_RWTUN, + &vmbus_ts_sample_thresh, 0, + "Threshold that makes sample request trigger the sync (unit: ms)."); + +static int vmbus_ts_sample_verbose = 0; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sample_verbose, CTLFLAG_RWTUN, + &vmbus_ts_sample_verbose, 0, "Increase sample request verbosity."); + +static void +vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint8_t tsflags) { - struct timespec guest_ts, host_ts; - uint64_t host_tns, guest_tns; - int64_t diff; - int error; - - host_tns = (hosttime - HV_WLTIMEDELTA) * 100; - host_ts.tv_sec = (time_t)(host_tns/HV_NANO_SEC_PER_SEC); - host_ts.tv_nsec = (long)(host_tns%HV_NANO_SEC_PER_SEC); + struct timespec vm_ts; + uint64_t hv_ns, vm_ns; - nanotime(&guest_ts); - guest_tns = guest_ts.tv_sec * HV_NANO_SEC_PER_SEC + guest_ts.tv_nsec; + hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE) * VMBUS_ICMSG_TS_FACTOR; + nanotime(&vm_ts); + vm_ns = (vm_ts.tv_sec * NANOSEC) + vm_ts.tv_nsec; + + if ((tsflags & VMBUS_ICMSG_TS_FLAG_SYNC) && !vmbus_ts_ignore_sync) { + struct timespec hv_ts; - if ((flags & HV_ICTIMESYNCFLAG_SYNC) != 0 && ignore_sync_req == 0) { if (bootverbose) { - device_printf(sc->ic_dev, "handle sync request " - "{host: %ju, guest: %ju}\n", - (uintmax_t)host_tns, (uintmax_t)guest_tns); + device_printf(sc->ic_dev, "apply sync request, " + "hv: %ju, vm: %ju\n", + (uintmax_t)hv_ns, (uintmax_t)vm_ns); } - - error = kern_clock_settime(curthread, CLOCK_REALTIME, - &host_ts); + hv_ts.tv_sec = hv_ns / NANOSEC; + hv_ts.tv_nsec = hv_ns % NANOSEC; + kern_clock_settime(curthread, CLOCK_REALTIME, &hv_ts); + /* Done! */ return; } - if ((flags & HV_ICTIMESYNCFLAG_SAMPLE) != 0 && sample_drift != 0) { - if (bootverbose) { - device_printf(sc->ic_dev, "handle sample request " - "{host: %ju, guest: %ju}\n", - (uintmax_t)host_tns, (uintmax_t)guest_tns); + if ((tsflags & VMBUS_ICMSG_TS_FLAG_SAMPLE) && + vmbus_ts_sample_thresh > 0) { + int64_t diff; + + if (vmbus_ts_sample_verbose) { + device_printf(sc->ic_dev, "sample request, " + "hv: %ju, vm: %ju\n", + (uintmax_t)hv_ns, (uintmax_t)vm_ns); } - diff = (int64_t)(host_tns - guest_tns) / HV_NANO_SEC_PER_MILLI_SEC; - if (diff > sample_drift || diff < -sample_drift) { - error = kern_clock_settime(curthread, CLOCK_REALTIME, - &host_ts); - if (bootverbose) - device_printf(sc->ic_dev, "trigger sample sync"); + if (hv_ns > vm_ns) + diff = hv_ns - vm_ns; + else + diff = vm_ns - hv_ns; + /* nanosec -> millisec */ + diff /= 1000000; + + if (diff > vmbus_ts_sample_thresh) { + struct timespec hv_ts; + + if (bootverbose) { + device_printf(sc->ic_dev, + "apply sample request, hv: %ju, vm: %ju\n", + (uintmax_t)hv_ns, (uintmax_t)vm_ns); + } + hv_ts.tv_sec = hv_ns / NANOSEC; + hv_ts.tv_nsec = hv_ns % NANOSEC; + kern_clock_settime(curthread, CLOCK_REALTIME, &hv_ts); } + /* Done */ return; } } -/** - * Time Sync Channel message handler - */ static void -hv_timesync_cb(struct vmbus_channel *channel, void *context) +vmbus_timesync_cb(struct vmbus_channel *chan, void *xsc) { - hv_vmbus_icmsg_hdr* icmsghdrp; - uint32_t recvlen; - uint64_t requestId; - int ret; - uint8_t* time_buf; - struct hv_ictimesync_data* timedatap; - hv_util_sc *softc; - - softc = (hv_util_sc*)context; - time_buf = softc->receive_buffer; - - recvlen = softc->ic_buflen; - ret = vmbus_chan_recv(channel, time_buf, &recvlen, &requestId); - KASSERT(ret != ENOBUFS, ("hvtimesync recvbuf is not large enough")); - /* XXX check recvlen to make sure that it contains enough data */ - - if ((ret == 0) && recvlen > 0) { - icmsghdrp = (struct hv_vmbus_icmsg_hdr *) &time_buf[ - sizeof(struct hv_vmbus_pipe_hdr)]; + struct hv_util_sc *sc = xsc; + struct vmbus_icmsg_hdr *hdr; + const struct vmbus_icmsg_timesync *msg; + int dlen, error; + uint64_t xactid; + void *data; + + /* + * Receive request. + */ + data = sc->receive_buffer; + dlen = sc->ic_buflen; + error = vmbus_chan_recv(chan, data, &dlen, &xactid); + KASSERT(error != ENOBUFS, ("icbuf is not large enough")); + if (error) + return; - if (icmsghdrp->icmsgtype == HV_ICMSGTYPE_NEGOTIATE) { - int error; + if (dlen < sizeof(*hdr)) { + device_printf(sc->ic_dev, "invalid data len %d\n", dlen); + return; + } + hdr = data; - error = vmbus_ic_negomsg(softc, time_buf, &recvlen); + /* + * Update request, which will be echoed back as response. + */ + switch (hdr->ic_type) { + case VMBUS_ICMSG_TYPE_NEGOTIATE: + error = vmbus_ic_negomsg(sc, data, &dlen); if (error) return; - } else { - timedatap = (struct hv_ictimesync_data *) &time_buf[ - sizeof(struct hv_vmbus_pipe_hdr) + - sizeof(struct hv_vmbus_icmsg_hdr)]; - hv_adj_guesttime(softc, timedatap->parenttime, timedatap->flags); - } + break; - icmsghdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION - | HV_ICMSGHDRFLAG_RESPONSE; - - vmbus_chan_send(channel, VMBUS_CHANPKT_TYPE_INBAND, 0, - time_buf, recvlen, requestId); + case VMBUS_ICMSG_TYPE_TIMESYNC: + if (dlen < sizeof(*msg)) { + device_printf(sc->ic_dev, "invalid timesync len %d\n", + dlen); + return; + } + msg = data; + vmbus_timesync(sc, msg->ic_hvtime, msg->ic_tsflags); + break; + + default: + device_printf(sc->ic_dev, "got 0x%08x icmsg\n", hdr->ic_type); + break; } + + /* + * Send response by echoing the updated request back. + */ + hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; + error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + data, dlen, xactid); + if (error) + device_printf(sc->ic_dev, "resp send failed: %d\n", error); } static int @@ -205,20 +202,15 @@ hv_timesync_probe(device_t dev) static int hv_timesync_attach(device_t dev) { - return hv_util_attach(dev, hv_timesync_cb); -} -static int -hv_timesync_detach(device_t dev) -{ - return hv_util_detach(dev); + return (hv_util_attach(dev, vmbus_timesync_cb)); } static device_method_t timesync_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hv_timesync_probe), DEVMETHOD(device_attach, hv_timesync_attach), - DEVMETHOD(device_detach, hv_timesync_detach), + DEVMETHOD(device_detach, hv_util_detach), { 0, 0 } }; Modified: stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h ============================================================================== --- stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Mon Oct 17 08:03:15 2016 (r307496) +++ stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h Mon Oct 17 08:06:19 2016 (r307497) @@ -91,4 +91,35 @@ struct vmbus_icmsg_heartbeat { #define VMBUS_ICMSG_HEARTBEAT_SIZE_MIN \ __offsetof(struct vmbus_icmsg_heartbeat, ic_rsvd[0]) +/* VMBUS_ICMSG_TYPE_SHUTDOWN */ +struct vmbus_icmsg_shutdown { + struct vmbus_icmsg_hdr ic_hdr; + uint32_t ic_code; + uint32_t ic_timeo; + uint32_t ic_haltflags; + uint8_t ic_msg[2048]; +} __packed; + +#define VMBUS_ICMSG_SHUTDOWN_SIZE_MIN \ + __offsetof(struct vmbus_icmsg_shutdown, ic_msg[0]) + +/* VMBUS_ICMSG_TYPE_TIMESYNC */ +struct vmbus_icmsg_timesync { + struct vmbus_icmsg_hdr ic_hdr; + uint64_t ic_hvtime; + uint64_t ic_vmtime; + uint64_t ic_rtt; + uint8_t ic_tsflags; /* VMBUS_ICMSG_TS_FLAG_ */ +} __packed; + +#define VMBUS_ICMSG_TS_FLAG_SYNC 0x01 +#define VMBUS_ICMSG_TS_FLAG_SAMPLE 0x02 + +/* XXX consolidate w/ hyperv */ +#define VMBUS_ICMSG_TS_BASE 116444736000000000ULL +#define VMBUS_ICMSG_TS_FACTOR 100ULL +#ifndef NANOSEC +#define NANOSEC 1000000000ULL +#endif + #endif /* !_VMBUS_ICREG_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 08:10:25 2016 Return-Path: Delivered-To: svn-src-all@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 DAF50C15BB4; Mon, 17 Oct 2016 08:10:25 +0000 (UTC) (envelope-from sephe@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 A6B6711CC; Mon, 17 Oct 2016 08:10:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8AOC7025390; Mon, 17 Oct 2016 08:10:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8AOHm025384; Mon, 17 Oct 2016 08:10:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170810.u9H8AOHm025384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:10: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: r307498 - in stable/11/sys: dev/hyperv/netvsc dev/hyperv/vmbus 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:10:26 -0000 Author: sephe Date: Mon Oct 17 08:10:24 2016 New Revision: 307498 URL: https://svnweb.freebsd.org/changeset/base/307498 Log: MFC 305405,305407,305408,305410,305411,305453 305405 hyperv/vmbus: Stringent header length and total length check. While I'm here, minor style changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7752 305407 hyperv/hn: Stringent NVS notification length check. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7753 305408 hyperv/hn: Stringent NVS RNDIS packets length checks. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7755 305410 net/rndis: Define RNDIS status message, which could be sent by device. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7757 305411 hyperv/hn: Stringent RNDIS control message length check. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7758 305453 hyperv/hn: Stringent RNDIS packet message length/offset check. While I'm here, use definition in net/rndis.h Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7782 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:06:19 2016 (r307497) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:10:24 2016 (r307498) @@ -742,32 +742,53 @@ hv_nv_on_receive(struct hn_softc *sc, st { const struct vmbus_chanpkt_rxbuf *pkt; const struct hn_nvs_hdr *nvs_hdr; - int count = 0; - int i = 0; + int count, i, hlen; - /* Make sure that this is a RNDIS message. */ + if (__predict_false(VMBUS_CHANPKT_DATALEN(pkthdr) < sizeof(*nvs_hdr))) { + if_printf(rxr->hn_ifp, "invalid nvs RNDIS\n"); + return; + } nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); + + /* Make sure that this is a RNDIS message. */ if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", nvs_hdr->nvs_type); return; } - + + hlen = VMBUS_CHANPKT_GETLEN(pkthdr->cph_hlen); + if (__predict_false(hlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid rxbuf chanpkt\n"); + return; + } pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { - if_printf(rxr->hn_ifp, "rxbuf_id %d is invalid!\n", + if (__predict_false(pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID)) { + if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", pkt->cp_rxbuf_id); return; } count = pkt->cp_rxbuf_cnt; + if (__predict_false(hlen < + __offsetof(struct vmbus_chanpkt_rxbuf, cp_rxbuf[count]))) { + if_printf(rxr->hn_ifp, "invalid rxbuf_cnt %d\n", count); + return; + } /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ - for (i = 0; i < count; i++) { - hv_rf_on_receive(sc, rxr, - rxr->hn_rxbuf + pkt->cp_rxbuf[i].rb_ofs, - pkt->cp_rxbuf[i].rb_len); + for (i = 0; i < count; ++i) { + int ofs, len; + + ofs = pkt->cp_rxbuf[i].rb_ofs; + len = pkt->cp_rxbuf[i].rb_len; + if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { + if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " + "ofs %d, len %d\n", i, ofs, len); + continue; + } + hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); } /* @@ -816,7 +837,12 @@ hn_proc_notify(struct hn_softc *sc, cons { const struct hn_nvs_hdr *hdr; + if (VMBUS_CHANPKT_DATALEN(pkt) < sizeof(*hdr)) { + if_printf(sc->hn_ifp, "invalid nvs notify\n"); + return; + } hdr = VMBUS_CHANPKT_CONST_DATA(pkt); + if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) { /* Useless; ignore */ return; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:06:19 2016 (r307497) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:10:24 2016 (r307498) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); * Forward declarations */ static void hv_rf_receive_indicate_status(struct hn_softc *sc, - const rndis_msg *response); + const void *data, int dlen); static void hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen); static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr); @@ -131,59 +131,50 @@ hv_set_rppi_data(rndis_msg *rndis_mesg, * RNDIS filter receive indicate status */ static void -hv_rf_receive_indicate_status(struct hn_softc *sc, const rndis_msg *response) +hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen) { - const rndis_indicate_status *indicate = &response->msg.indicate_status; - - switch(indicate->status) { + const struct rndis_status_msg *msg; + + if (dlen < sizeof(*msg)) { + if_printf(sc->hn_ifp, "invalid RNDIS status\n"); + return; + } + msg = data; + + switch (msg->rm_status) { case RNDIS_STATUS_MEDIA_CONNECT: netvsc_linkstatus_callback(sc, 1); break; + case RNDIS_STATUS_MEDIA_DISCONNECT: netvsc_linkstatus_callback(sc, 0); break; + default: /* TODO: */ - if_printf(sc->hn_ifp, - "unknown status %d received\n", indicate->status); + if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n", + msg->rm_status); break; } } static int -hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info) +hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_recvinfo *info) { - const struct rndis_pktinfo *pi; - uint32_t mask = 0, len; - - info->vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info->csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info->hash_info = HN_NDIS_HASH_INFO_INVALID; - - if (rpkt->per_pkt_info_offset == 0) - return (0); - if (__predict_false(rpkt->per_pkt_info_offset & - (RNDIS_PKTINFO_ALIGN - 1))) - return (EINVAL); - if (__predict_false(rpkt->per_pkt_info_offset < - RNDIS_PACKET_MSG_OFFSET_MIN)) - return (EINVAL); + const struct rndis_pktinfo *pi = info_data; + uint32_t mask = 0; - pi = (const struct rndis_pktinfo *) - ((const uint8_t *)rpkt + rpkt->per_pkt_info_offset); - len = rpkt->per_pkt_info_length; - - while (len != 0) { + while (info_dlen != 0) { const void *data; uint32_t dlen; - if (__predict_false(len < sizeof(*pi))) + if (__predict_false(info_dlen < sizeof(*pi))) return (EINVAL); - if (__predict_false(len < pi->rm_size)) + if (__predict_false(info_dlen < pi->rm_size)) return (EINVAL); - len -= pi->rm_size; + info_dlen -= pi->rm_size; - if (__predict_false(pi->rm_size & (RNDIS_PKTINFO_ALIGN - 1))) + if (__predict_false(pi->rm_size & RNDIS_PKTINFO_SIZE_ALIGNMASK)) return (EINVAL); if (__predict_false(pi->rm_size < pi->rm_pktinfooffset)) return (EINVAL); @@ -241,76 +232,223 @@ next: return (0); } +static __inline bool +hn_rndis_check_overlap(int off, int len, int check_off, int check_len) +{ + + if (off < check_off) { + if (__predict_true(off + len <= check_off)) + return (false); + } else if (off > check_off) { + if (__predict_true(check_off + check_len <= off)) + return (false); + } + return (true); +} + /* * RNDIS filter receive data */ static void hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen) { - const rndis_msg *message = data; - const rndis_packet *rndis_pkt; - uint32_t data_offset; + const struct rndis_packet_msg *pkt; struct hn_recvinfo info; - - rndis_pkt = &message->msg.packet; + int data_off, pktinfo_off, data_len, pktinfo_len; /* - * Fixme: Handle multiple rndis pkt msgs that may be enclosed in this - * netvsc packet (ie tot_data_buf_len != message_length) + * Check length. */ + if (__predict_false(dlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg\n"); + return; + } + pkt = data; - /* Remove rndis header, then pass data packet up the stack */ - data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset; + if (__predict_false(dlen < pkt->rm_len)) { + if_printf(rxr->hn_ifp, "truncated RNDIS packet msg, " + "dlen %d, msglen %u\n", dlen, pkt->rm_len); + return; + } + if (__predict_false(pkt->rm_len < + pkt->rm_datalen + pkt->rm_oobdatalen + pkt->rm_pktinfolen)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msglen, " + "msglen %u, data %u, oob %u, pktinfo %u\n", + pkt->rm_len, pkt->rm_datalen, pkt->rm_oobdatalen, + pkt->rm_pktinfolen); + return; + } + if (__predict_false(pkt->rm_datalen == 0)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, no data\n"); + return; + } - dlen -= data_offset; - if (dlen < rndis_pkt->data_length) { - if_printf(rxr->hn_ifp, - "total length %u is less than data length %u\n", - dlen, rndis_pkt->data_length); + /* + * Check offests. + */ +#define IS_OFFSET_INVALID(ofs) \ + ((ofs) < RNDIS_PACKET_MSG_OFFSET_MIN || \ + ((ofs) & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK)) + + /* XXX Hyper-V does not meet data offset alignment requirement */ + if (__predict_false(pkt->rm_dataoffset < RNDIS_PACKET_MSG_OFFSET_MIN)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data offset %u\n", pkt->rm_dataoffset); + return; + } + if (__predict_false(pkt->rm_oobdataoffset > 0 && + IS_OFFSET_INVALID(pkt->rm_oobdataoffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob offset %u\n", pkt->rm_oobdataoffset); + return; + } + if (__predict_true(pkt->rm_pktinfooffset > 0) && + __predict_false(IS_OFFSET_INVALID(pkt->rm_pktinfooffset))) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo offset %u\n", pkt->rm_pktinfooffset); return; } - dlen = rndis_pkt->data_length; - data = (const uint8_t *)data + data_offset; +#undef IS_OFFSET_INVALID - if (hv_rf_find_recvinfo(rndis_pkt, &info)) { - if_printf(rxr->hn_ifp, "recvinfo parsing failed\n"); + data_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_dataoffset); + data_len = pkt->rm_datalen; + pktinfo_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_pktinfooffset); + pktinfo_len = pkt->rm_pktinfolen; + + /* + * Check OOB coverage. + */ + if (__predict_false(pkt->rm_oobdatalen != 0)) { + int oob_off, oob_len; + + if_printf(rxr->hn_ifp, "got oobdata\n"); + oob_off = RNDIS_PACKET_MSG_OFFSET_ABS(pkt->rm_oobdataoffset); + oob_len = pkt->rm_oobdatalen; + + if (__predict_false(oob_off + oob_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overflow, msglen %u, oob abs %d len %d\n", + pkt->rm_len, oob_off, oob_len); + return; + } + + /* + * Check against data. + */ + if (hn_rndis_check_overlap(oob_off, oob_len, + data_off, data_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps data, oob abs %d len %d, " + "data abs %d len %d\n", + oob_off, oob_len, data_off, data_len); + return; + } + + /* + * Check against pktinfo. + */ + if (pktinfo_len != 0 && + hn_rndis_check_overlap(oob_off, oob_len, + pktinfo_off, pktinfo_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "oob overlaps pktinfo, oob abs %d len %d, " + "pktinfo abs %d len %d\n", + oob_off, oob_len, pktinfo_off, pktinfo_len); + return; + } + } + + /* + * Check per-packet-info coverage and find useful per-packet-info. + */ + info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; + info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; + info.hash_info = HN_NDIS_HASH_INFO_INVALID; + if (__predict_true(pktinfo_len != 0)) { + bool overlap; + int error; + + if (__predict_false(pktinfo_off + pktinfo_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overflow, msglen %u, " + "pktinfo abs %d len %d\n", + pkt->rm_len, pktinfo_off, pktinfo_len); + return; + } + + /* + * Check packet info coverage. + */ + overlap = hn_rndis_check_overlap(pktinfo_off, pktinfo_len, + data_off, data_len); + if (__predict_false(overlap)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "pktinfo overlap data, pktinfo abs %d len %d, " + "data abs %d len %d\n", + pktinfo_off, pktinfo_len, data_off, data_len); + return; + } + + /* + * Find useful per-packet-info. + */ + error = hn_rndis_rxinfo(((const uint8_t *)pkt) + pktinfo_off, + pktinfo_len, &info); + if (__predict_false(error)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg " + "pktinfo\n"); + return; + } + } + + if (__predict_false(data_off + data_len > pkt->rm_len)) { + if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, " + "data overflow, msglen %u, data abs %d len %d\n", + pkt->rm_len, data_off, data_len); return; } - netvsc_recv(rxr, data, dlen, &info); + netvsc_recv(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); } /* * RNDIS filter on receive */ -int +void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen) { - const rndis_msg *rndis_hdr; const struct rndis_comp_hdr *comp; + const struct rndis_msghdr *hdr; + + if (__predict_false(dlen < sizeof(*hdr))) { + if_printf(rxr->hn_ifp, "invalid RNDIS msg\n"); + return; + } + hdr = data; - rndis_hdr = data; - switch (rndis_hdr->ndis_msg_type) { - /* data message */ + switch (hdr->rm_type) { case REMOTE_NDIS_PACKET_MSG: hv_rf_receive_data(rxr, data, dlen); break; - /* completion messages */ case REMOTE_NDIS_INITIALIZE_CMPLT: case REMOTE_NDIS_QUERY_CMPLT: case REMOTE_NDIS_SET_CMPLT: - case REMOTE_NDIS_KEEPALIVE_CMPLT: + case REMOTE_NDIS_KEEPALIVE_CMPLT: /* unused */ + if (dlen < sizeof(*comp)) { + if_printf(rxr->hn_ifp, "invalid RNDIS cmplt\n"); + return; + } comp = data; + KASSERT(comp->rm_rid > HN_RNDIS_RID_COMPAT_MAX, - ("invalid rid 0x%08x\n", comp->rm_rid)); + ("invalid RNDIS rid 0x%08x\n", comp->rm_rid)); vmbus_xact_ctx_wakeup(sc->hn_xact, comp, dlen); break; - /* notification message */ case REMOTE_NDIS_INDICATE_STATUS_MSG: - hv_rf_receive_indicate_status(sc, rndis_hdr); + hv_rf_receive_indicate_status(sc, data, dlen); break; case REMOTE_NDIS_RESET_CMPLT: @@ -321,15 +459,14 @@ hv_rf_on_receive(struct hn_softc *sc, st * RESET is not issued by hn(4), so this message should * _not_ be observed. */ - if_printf(sc->hn_ifp, "RESET CMPLT received\n"); + if_printf(rxr->hn_ifp, "RESET cmplt received\n"); break; default: - if_printf(sc->hn_ifp, "unknown RNDIS message 0x%x\n", - rndis_hdr->ndis_msg_type); + if_printf(rxr->hn_ifp, "unknown RNDIS msg 0x%x\n", + hdr->rm_type); break; } - return (0); } /* @@ -551,7 +688,7 @@ hn_rndis_query(struct hn_softc *sc, uint * Check output data length and offset. */ /* ofs is the offset from the beginning of comp. */ - ofs = RNDIS_QUERY_COMP_INFOBUFABS(comp->rm_infobufoffset); + ofs = RNDIS_QUERY_COMP_INFOBUFOFFSET_ABS(comp->rm_infobufoffset); if (ofs < sizeof(*comp) || ofs + comp->rm_infobuflen > comp_len) { if_printf(sc->hn_ifp, "RNDIS query invalid comp ib off/len, " "%u/%u\n", comp->rm_infobufoffset, comp->rm_infobuflen); Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 08:06:19 2016 (r307497) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 08:10:24 2016 (r307498) @@ -40,7 +40,7 @@ */ struct hn_rx_ring; -int hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, +void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan, Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 08:06:19 2016 (r307497) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 08:10:24 2016 (r307498) @@ -721,7 +721,20 @@ vmbus_chan_recv(struct vmbus_channel *ch error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) - return error; + return (error); + + if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { + device_printf(chan->ch_dev, "invalid hlen %u\n", + pkt.cph_hlen); + /* XXX this channel is dead actually. */ + return (EIO); + } + if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { + device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + pkt.cph_hlen, pkt.cph_tlen); + /* XXX this channel is dead actually. */ + return (EIO); + } hlen = VMBUS_CHANPKT_GETLEN(pkt.cph_hlen); dlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen) - hlen; @@ -729,7 +742,7 @@ vmbus_chan_recv(struct vmbus_channel *ch if (*dlen0 < dlen) { /* Return the size of this packet's data. */ *dlen0 = dlen; - return ENOBUFS; + return (ENOBUFS); } *xactid = pkt.cph_xactid; @@ -739,7 +752,7 @@ vmbus_chan_recv(struct vmbus_channel *ch error = vmbus_rxbr_read(&chan->ch_rxbr, data, dlen, hlen); KASSERT(!error, ("vmbus_rxbr_read failed")); - return 0; + return (0); } int @@ -751,13 +764,26 @@ vmbus_chan_recv_pkt(struct vmbus_channel error = vmbus_rxbr_peek(&chan->ch_rxbr, &pkt, sizeof(pkt)); if (error) - return error; + return (error); + + if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) { + device_printf(chan->ch_dev, "invalid hlen %u\n", + pkt.cph_hlen); + /* XXX this channel is dead actually. */ + return (EIO); + } + if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) { + device_printf(chan->ch_dev, "invalid hlen %u and tlen %u\n", + pkt.cph_hlen, pkt.cph_tlen); + /* XXX this channel is dead actually. */ + return (EIO); + } pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen); if (*pktlen0 < pktlen) { /* Return the size of this packet. */ *pktlen0 = pktlen; - return ENOBUFS; + return (ENOBUFS); } *pktlen0 = pktlen; @@ -765,7 +791,7 @@ vmbus_chan_recv_pkt(struct vmbus_channel error = vmbus_rxbr_read(&chan->ch_rxbr, pkt0, pktlen, 0); KASSERT(!error, ("vmbus_rxbr_read failed")); - return 0; + return (0); } static void Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 08:06:19 2016 (r307497) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_reg.h Mon Oct 17 08:10:24 2016 (r307498) @@ -153,6 +153,9 @@ do { \ #define VMBUS_CHANPKT_TOTLEN(tlen) \ roundup2((tlen), VMBUS_CHANPKT_SIZE_ALIGN) +#define VMBUS_CHANPKT_HLEN_MIN \ + (sizeof(struct vmbus_chanpkt_hdr) >> VMBUS_CHANPKT_SIZE_SHIFT) + struct vmbus_chanpkt { struct vmbus_chanpkt_hdr cp_hdr; } __packed; Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Mon Oct 17 08:06:19 2016 (r307497) +++ stable/11/sys/net/rndis.h Mon Oct 17 08:10:24 2016 (r307498) @@ -127,6 +127,14 @@ struct rndis_packet_msg { (sizeof(struct rndis_packet_msg) - \ __offsetof(struct rndis_packet_msg, rm_dataoffset)) +/* Offset from the beginning of rndis_packet_msg. */ +#define RNDIS_PACKET_MSG_OFFSET_ABS(ofs) \ + ((ofs) + __offsetof(struct rndis_packet_msg, rm_dataoffset)) + +#define RNDIS_PACKET_MSG_OFFSET_ALIGN 4 +#define RNDIS_PACKET_MSG_OFFSET_ALIGNMASK \ + (RNDIS_PACKET_MSG_OFFSET_ALIGN - 1) + /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; @@ -137,7 +145,8 @@ struct rndis_pktinfo { #define RNDIS_PKTINFO_OFFSET \ __offsetof(struct rndis_pktinfo, rm_data[0]) -#define RNDIS_PKTINFO_ALIGN 4 +#define RNDIS_PKTINFO_SIZE_ALIGN 4 +#define RNDIS_PKTINFO_SIZE_ALIGNMASK (RNDIS_PKTINFO_SIZE_ALIGN - 1) #define NDIS_PKTINFO_TYPE_CSUM 0 #define NDIS_PKTINFO_TYPE_IPSEC 1 @@ -236,7 +245,8 @@ struct rndis_query_comp { uint32_t rm_infobufoffset; }; -#define RNDIS_QUERY_COMP_INFOBUFABS(ofs) \ +/* infobuf offset from the beginning of rndis_query_comp. */ +#define RNDIS_QUERY_COMP_INFOBUFOFFSET_ABS(ofs) \ ((ofs) + __offsetof(struct rndis_query_req, rm_rid)) /* Send a set object request. */ @@ -295,9 +305,28 @@ struct rndis_reset_comp { uint32_t rm_adrreset; }; -/* 802.3 link-state or undefined message error. */ +/* 802.3 link-state or undefined message error. Sent by device. */ #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007 +struct rndis_status_msg { + uint32_t rm_type; + uint32_t rm_len; + uint32_t rm_status; + uint32_t rm_stbuflen; + uint32_t rm_stbufoffset; + /* rndis_diag_info */ +}; + +/* + * Immediately after rndis_status_msg.rm_stbufoffset, if a control + * message is malformatted, or a packet message contains inappropriate + * content. + */ +struct rndis_diag_info { + uint32_t rm_diagstatus; + uint32_t rm_erroffset; +}; + /* Keepalive messsage. May be sent by device. */ #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008 From owner-svn-src-all@freebsd.org Mon Oct 17 08:14:25 2016 Return-Path: Delivered-To: svn-src-all@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 2420AC15CFB; Mon, 17 Oct 2016 08:14:25 +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 EA6921621; Mon, 17 Oct 2016 08:14:24 +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 u9H8EOL6029102; Mon, 17 Oct 2016 08:14:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8ENn6029100; Mon, 17 Oct 2016 08:14:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610170814.u9H8ENn6029100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 17 Oct 2016 08:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307499 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:14:25 -0000 Author: kib Date: Mon Oct 17 08:14:23 2016 New Revision: 307499 URL: https://svnweb.freebsd.org/changeset/base/307499 Log: Export vm_page_xunbusy_maybelocked(). Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week X-Differential revision: https://reviews.freebsd.org/D8197 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Oct 17 08:10:24 2016 (r307498) +++ head/sys/vm/vm_page.c Mon Oct 17 08:14:23 2016 (r307499) @@ -794,7 +794,7 @@ vm_page_xunbusy_locked(vm_page_t m) wakeup(m); } -static void +void vm_page_xunbusy_maybelocked(vm_page_t m) { bool lockacq; Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Oct 17 08:10:24 2016 (r307498) +++ head/sys/vm/vm_page.h Mon Oct 17 08:14:23 2016 (r307499) @@ -495,6 +495,7 @@ boolean_t vm_page_unwire(vm_page_t m, ui void vm_page_updatefake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_wire (vm_page_t); void vm_page_xunbusy_hard(vm_page_t m); +void vm_page_xunbusy_maybelocked(vm_page_t m); void vm_page_set_validclean (vm_page_t, int, int); void vm_page_clear_dirty (vm_page_t, int, int); void vm_page_set_invalid (vm_page_t, int, int); From owner-svn-src-all@freebsd.org Mon Oct 17 08:16:28 2016 Return-Path: Delivered-To: svn-src-all@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 CB1A2C15D70; Mon, 17 Oct 2016 08:16:28 +0000 (UTC) (envelope-from sephe@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 8EF4417BE; Mon, 17 Oct 2016 08:16:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8GRuF029225; Mon, 17 Oct 2016 08:16:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8GRK8029218; Mon, 17 Oct 2016 08:16:27 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170816.u9H8GRK8029218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:16:27 +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: r307500 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:16:28 -0000 Author: sephe Date: Mon Oct 17 08:16:26 2016 New Revision: 307500 URL: https://svnweb.freebsd.org/changeset/base/307500 Log: MFC 305454,305455,305521,305524-305526 305454 hyperv/hn: Fix VLAN tag setup for outgoing VLAN packets. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7785 305455 hyperv/hn: Avoid bit fields for LSOv2 setup. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7786 305521 hyperv/hn: Avoid bit fields for TXCSUM setup. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7792 305524 hyperv/hn: Cleanup RNDIS packet message encapsulation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7793 305525 hyperv/hn: Simplify per-packet-info construction. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7794 305526 hyperv/hn: Nuke unused bits Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7795 Deleted: stable/11/sys/dev/hyperv/netvsc/hv_rndis.h Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnreg.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/netvsc/ndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:14:23 2016 (r307499) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:16:26 2016 (r307500) @@ -48,9 +48,9 @@ #include #include #include -#include #include #include +#include MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); @@ -513,15 +513,15 @@ hv_nv_connect_to_vsp(struct hn_softc *sc for (i = protocol_number - 1; i >= 0; i--) { if (hv_nv_negotiate_nvsp_protocol(sc, protocol_list[i]) == 0) { sc->hn_nvs_ver = protocol_list[i]; - sc->hn_ndis_ver = NDIS_VERSION_6_30; + sc->hn_ndis_ver = HN_NDIS_VERSION_6_30; if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) - sc->hn_ndis_ver = NDIS_VERSION_6_1; + sc->hn_ndis_ver = HN_NDIS_VERSION_6_1; if (bootverbose) { if_printf(sc->hn_ifp, "NVS version 0x%x, " "NDIS version %u.%u\n", sc->hn_nvs_ver, - NDIS_VERSION_MAJOR(sc->hn_ndis_ver), - NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } break; } @@ -547,8 +547,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc memset(&ndis, 0, sizeof(ndis)); ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; - ndis.nvs_ndis_major = NDIS_VERSION_MAJOR(sc->hn_ndis_ver); - ndis.nvs_ndis_minor = NDIS_VERSION_MINOR(sc->hn_ndis_ver); + ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver); + ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver); /* NOTE: No response. */ ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); @@ -764,7 +764,7 @@ hv_nv_on_receive(struct hn_softc *sc, st } pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - if (__predict_false(pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID)) { + if (__predict_false(pkt->cp_rxbuf_id != HN_NVS_RXBUF_SIG)) { if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", pkt->cp_rxbuf_id); return; Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:14:23 2016 (r307499) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:16:26 2016 (r307500) @@ -74,110 +74,6 @@ MALLOC_DECLARE(M_NETVSC); #define NVSP_PROTOCOL_VERSION_2 0x30002 #define NVSP_PROTOCOL_VERSION_4 0x40000 #define NVSP_PROTOCOL_VERSION_5 0x50000 -#define NVSP_MIN_PROTOCOL_VERSION (NVSP_PROTOCOL_VERSION_1) -#define NVSP_MAX_PROTOCOL_VERSION (NVSP_PROTOCOL_VERSION_2) - -#define NVSP_PROTOCOL_VERSION_CURRENT NVSP_PROTOCOL_VERSION_2 - -#define VERSION_4_OFFLOAD_SIZE 22 - -#define NVSP_OPERATIONAL_STATUS_OK (0x00000000) -#define NVSP_OPERATIONAL_STATUS_DEGRADED (0x00000001) -#define NVSP_OPERATIONAL_STATUS_NONRECOVERABLE (0x00000002) -#define NVSP_OPERATIONAL_STATUS_NO_CONTACT (0x00000003) -#define NVSP_OPERATIONAL_STATUS_LOST_COMMUNICATION (0x00000004) - -/* - * Maximun number of transfer pages (packets) the VSP will use on a receive - */ -#define NVSP_MAX_PACKETS_PER_RECEIVE 375 - -/* vRSS stuff */ -#define RNDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88 -#define RNDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89 - -#define RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2 -#define RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2 - -struct rndis_obj_header { - uint8_t type; - uint8_t rev; - uint16_t size; -} __packed; - -/* rndis_recv_scale_cap/cap_flag */ -#define RNDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x01000000 -#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x02000000 -#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x04000000 -#define RNDIS_RSS_CAPS_USING_MSI_X 0x08000000 -#define RNDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x10000000 -#define RNDIS_RSS_CAPS_SUPPORTS_MSI_X 0x20000000 -#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x00000100 -#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x00000200 -#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x00000400 - -/* RNDIS_RECEIVE_SCALE_CAPABILITIES */ -struct rndis_recv_scale_cap { - struct rndis_obj_header hdr; - uint32_t cap_flag; - uint32_t num_int_msg; - uint32_t num_recv_que; - uint16_t num_indirect_tabent; -} __packed; - -/* rndis_recv_scale_param flags */ -#define RNDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001 -#define RNDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED 0x0002 -#define RNDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004 -#define RNDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008 -#define RNDIS_RSS_PARAM_FLAG_DISABLE_RSS 0x0010 - -/* Hash info bits */ -#define RNDIS_HASH_FUNC_TOEPLITZ 0x00000001 -#define RNDIS_HASH_IPV4 0x00000100 -#define RNDIS_HASH_TCP_IPV4 0x00000200 -#define RNDIS_HASH_IPV6 0x00000400 -#define RNDIS_HASH_IPV6_EX 0x00000800 -#define RNDIS_HASH_TCP_IPV6 0x00001000 -#define RNDIS_HASH_TCP_IPV6_EX 0x00002000 - -#define RNDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4) -#define RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40 - -#define ITAB_NUM 128 -#define HASH_KEYLEN RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 - -/* RNDIS_RECEIVE_SCALE_PARAMETERS */ -typedef struct rndis_recv_scale_param_ { - struct rndis_obj_header hdr; - - /* Qualifies the rest of the information */ - uint16_t flag; - - /* The base CPU number to do receive processing. not used */ - uint16_t base_cpu_number; - - /* This describes the hash function and type being enabled */ - uint32_t hashinfo; - - /* The size of indirection table array */ - uint16_t indirect_tabsize; - - /* The offset of the indirection table from the beginning of this - * structure - */ - uint32_t indirect_taboffset; - - /* The size of the hash secret key */ - uint16_t hashkey_size; - - /* The offset of the secret key from the beginning of this structure */ - uint32_t hashkey_offset; - - uint32_t processor_masks_offset; - uint32_t num_processor_masks; - uint32_t processor_masks_entry_size; -} rndis_recv_scale_param; /* * The following arguably belongs in a separate header file @@ -188,18 +84,10 @@ typedef struct rndis_recv_scale_param_ { */ #define NETVSC_SEND_BUFFER_SIZE (1024*1024*15) /* 15M */ -#define NETVSC_SEND_BUFFER_ID 0xface #define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */ #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ -#define NETVSC_RECEIVE_BUFFER_ID 0xcafe - -#define NETVSC_RECEIVE_SG_COUNT 1 - -/* Preallocated receive packets */ -#define NETVSC_RECEIVE_PACKETLIST_COUNT 256 - /* * Maximum MTU we permit to be configured for a netvsc interface. * When the code was developed, a max MTU of 12232 was tested and @@ -208,7 +96,6 @@ typedef struct rndis_recv_scale_param_ { #define NETVSC_MAX_CONFIGURABLE_MTU (9 * 1024) #define NETVSC_PACKET_SIZE PAGE_SIZE -#define VRSS_SEND_TABLE_SIZE 16 /* * Data types @@ -216,26 +103,9 @@ typedef struct rndis_recv_scale_param_ { struct vmbus_channel; -typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); - #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) #define NETVSC_PACKET_MAXPAGE 32 -#define NETVSC_VLAN_PRIO_MASK 0xe000 -#define NETVSC_VLAN_PRIO_SHIFT 13 -#define NETVSC_VLAN_VID_MASK 0x0fff - -#define TYPE_IPV4 2 -#define TYPE_IPV6 4 -#define TYPE_TCP 2 -#define TYPE_UDP 4 - -#define TRANSPORT_TYPE_NOT_IP 0 -#define TRANSPORT_TYPE_IPV4_TCP ((TYPE_IPV4 << 16) | TYPE_TCP) -#define TRANSPORT_TYPE_IPV4_UDP ((TYPE_IPV4 << 16) | TYPE_UDP) -#define TRANSPORT_TYPE_IPV6_TCP ((TYPE_IPV6 << 16) | TYPE_TCP) -#define TRANSPORT_TYPE_IPV6_UDP ((TYPE_IPV6 << 16) | TYPE_UDP) - typedef struct { uint8_t mac_addr[ETHER_ADDR_LEN]; uint32_t link_state; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:14:23 2016 (r307499) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:16:26 2016 (r307500) @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - +#include #include #include @@ -118,7 +118,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -142,14 +141,14 @@ __FBSDID("$FreeBSD$"); #define HN_RING_CNT_DEF_MAX 8 -#define HN_RNDIS_MSG_LEN \ - (sizeof(rndis_msg) + \ - RNDIS_HASHVAL_PPI_SIZE + \ - RNDIS_VLAN_PPI_SIZE + \ - RNDIS_TSO_PPI_SIZE + \ - RNDIS_CSUM_PPI_SIZE) -#define HN_RNDIS_MSG_BOUNDARY PAGE_SIZE -#define HN_RNDIS_MSG_ALIGN CACHE_LINE_SIZE +#define HN_RNDIS_PKT_LEN \ + (sizeof(struct rndis_packet_msg) + \ + HN_RNDIS_PKTINFO_SIZE(HN_NDIS_HASH_VALUE_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_VLAN_INFO_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_LSO2_INFO_SIZE) + \ + HN_RNDIS_PKTINFO_SIZE(NDIS_TXCSUM_INFO_SIZE)) +#define HN_RNDIS_PKT_BOUNDARY PAGE_SIZE +#define HN_RNDIS_PKT_ALIGN CACHE_LINE_SIZE #define HN_TX_DATA_BOUNDARY PAGE_SIZE #define HN_TX_DATA_MAXSIZE IP_MAXPACKET @@ -173,9 +172,9 @@ struct hn_txdesc { bus_dmamap_t data_dmap; - bus_addr_t rndis_msg_paddr; - rndis_msg *rndis_msg; - bus_dmamap_t rndis_msg_dmap; + bus_addr_t rndis_pkt_paddr; + struct rndis_packet_msg *rndis_pkt; + bus_dmamap_t rndis_pkt_dmap; }; #define HN_TXD_FLAG_ONLIST 0x1 @@ -827,7 +826,7 @@ hn_tx_done(struct hn_send_ctx *sndc, str } void -netvsc_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) +hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { #if defined(INET) || defined(INET6) tcp_lro_flush_all(&rxr->hn_lro); @@ -845,6 +844,15 @@ netvsc_channel_rollup(struct hn_rx_ring hn_txeof(txr); } +static __inline uint32_t +hn_rndis_pktmsg_offset(uint32_t ofs) +{ + + KASSERT(ofs >= sizeof(struct rndis_packet_msg), + ("invalid RNDIS packet msg offset %u", ofs)); + return (ofs - __offsetof(struct rndis_packet_msg, rm_dataoffset)); +} + /* * NOTE: * If this function fails, then both txd and m_head0 will be freed. @@ -855,14 +863,10 @@ hn_encap(struct hn_tx_ring *txr, struct bus_dma_segment_t segs[HN_TX_DATA_SEGCNT_MAX]; int error, nsegs, i; struct mbuf *m_head = *m_head0; - rndis_msg *rndis_mesg; - rndis_packet *rndis_pkt; - rndis_per_packet_info *rppi; - struct rndis_hash_value *hash_value; - uint32_t rndis_msg_size, tot_data_buf_len, send_buf_section_idx; - int send_buf_section_size; - - tot_data_buf_len = m_head->m_pkthdr.len; + struct rndis_packet_msg *pkt; + uint32_t send_buf_section_idx; + int send_buf_section_size, pktlen; + uint32_t *pi_data; /* * extension points to the area reserved for the @@ -870,45 +874,34 @@ hn_encap(struct hn_tx_ring *txr, struct * the netvsc_packet (and rppi struct, if present; * length is updated later). */ - rndis_mesg = txd->rndis_msg; - /* XXX not necessary */ - memset(rndis_mesg, 0, HN_RNDIS_MSG_LEN); - rndis_mesg->ndis_msg_type = REMOTE_NDIS_PACKET_MSG; - - rndis_pkt = &rndis_mesg->msg.packet; - rndis_pkt->data_offset = sizeof(rndis_packet); - rndis_pkt->data_length = tot_data_buf_len; - rndis_pkt->per_pkt_info_offset = sizeof(rndis_packet); - - rndis_msg_size = RNDIS_MESSAGE_SIZE(rndis_packet); + pkt = txd->rndis_pkt; + pkt->rm_type = REMOTE_NDIS_PACKET_MSG; + pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len; + pkt->rm_dataoffset = sizeof(*pkt); + pkt->rm_datalen = m_head->m_pkthdr.len; + pkt->rm_pktinfooffset = sizeof(*pkt); + pkt->rm_pktinfolen = 0; /* * Set the hash value for this packet, so that the host could * dispatch the TX done event for this packet back to this TX * ring's channel. */ - rndis_msg_size += RNDIS_HASHVAL_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_HASHVAL_PPI_SIZE, - nbl_hash_value); - hash_value = (struct rndis_hash_value *)((uint8_t *)rppi + - rppi->per_packet_info_offset); - hash_value->hash_value = txr->hn_tx_idx; + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); + *pi_data = txr->hn_tx_idx; if (m_head->m_flags & M_VLANTAG) { - ndis_8021q_info *rppi_vlan_info; - - rndis_msg_size += RNDIS_VLAN_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_VLAN_PPI_SIZE, - ieee_8021q_info); - - rppi_vlan_info = (ndis_8021q_info *)((uint8_t *)rppi + - rppi->per_packet_info_offset); - rppi_vlan_info->u1.s1.vlan_id = - m_head->m_pkthdr.ether_vtag & 0xfff; + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + NDIS_VLAN_INFO_SIZE, NDIS_PKTINFO_TYPE_VLAN); + *pi_data = NDIS_VLAN_INFO_MAKE( + EVL_VLANOFTAG(m_head->m_pkthdr.ether_vtag), + EVL_PRIOFTAG(m_head->m_pkthdr.ether_vtag), + EVL_CFIOFTAG(m_head->m_pkthdr.ether_vtag)); } if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { - rndis_tcp_tso_info *tso_info; +#if defined(INET6) || defined(INET) struct ether_vlan_header *eh; int ether_len; @@ -921,15 +914,8 @@ hn_encap(struct hn_tx_ring *txr, struct else ether_len = ETHER_HDR_LEN; - rndis_msg_size += RNDIS_TSO_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_TSO_PPI_SIZE, - tcp_large_send_info); - - tso_info = (rndis_tcp_tso_info *)((uint8_t *)rppi + - rppi->per_packet_info_offset); - tso_info->lso_v2_xmit.type = - RNDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE; - + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + NDIS_LSO2_INFO_SIZE, NDIS_PKTINFO_TYPE_LSO); #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { struct ip *ip = @@ -938,13 +924,12 @@ hn_encap(struct hn_tx_ring *txr, struct struct tcphdr *th = (struct tcphdr *)((caddr_t)ip + iph_len); - tso_info->lso_v2_xmit.ip_version = - RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV4; ip->ip_len = 0; ip->ip_sum = 0; - th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); + *pi_data = NDIS_LSO2_INFO_MAKEIPV4(0, + m_head->m_pkthdr.tso_segsz); } #endif #if defined(INET6) && defined(INET) @@ -956,53 +941,47 @@ hn_encap(struct hn_tx_ring *txr, struct (m_head->m_data + ether_len); struct tcphdr *th = (struct tcphdr *)(ip6 + 1); - tso_info->lso_v2_xmit.ip_version = - RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV6; ip6->ip6_plen = 0; th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); + *pi_data = NDIS_LSO2_INFO_MAKEIPV6(0, + m_head->m_pkthdr.tso_segsz); } #endif - tso_info->lso_v2_xmit.tcp_header_offset = 0; - tso_info->lso_v2_xmit.mss = m_head->m_pkthdr.tso_segsz; +#endif /* INET6 || INET */ } else if (m_head->m_pkthdr.csum_flags & txr->hn_csum_assist) { - rndis_tcp_ip_csum_info *csum_info; - - rndis_msg_size += RNDIS_CSUM_PPI_SIZE; - rppi = hv_set_rppi_data(rndis_mesg, RNDIS_CSUM_PPI_SIZE, - tcpip_chksum_info); - csum_info = (rndis_tcp_ip_csum_info *)((uint8_t *)rppi + - rppi->per_packet_info_offset); + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + NDIS_TXCSUM_INFO_SIZE, NDIS_PKTINFO_TYPE_CSUM); + *pi_data = NDIS_TXCSUM_INFO_IPV4; - csum_info->xmit.is_ipv4 = 1; if (m_head->m_pkthdr.csum_flags & CSUM_IP) - csum_info->xmit.ip_header_csum = 1; + *pi_data |= NDIS_TXCSUM_INFO_IPCS; - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { - csum_info->xmit.tcp_csum = 1; - csum_info->xmit.tcp_header_offset = 0; - } else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) { - csum_info->xmit.udp_csum = 1; - } + if (m_head->m_pkthdr.csum_flags & CSUM_TCP) + *pi_data |= NDIS_TXCSUM_INFO_TCPCS; + else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) + *pi_data |= NDIS_TXCSUM_INFO_UDPCS; } - rndis_mesg->msg_len = tot_data_buf_len + rndis_msg_size; - tot_data_buf_len = rndis_mesg->msg_len; + pktlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; + /* Convert RNDIS packet message offsets */ + pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt->rm_dataoffset); + pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset); /* * Chimney send, if the packet could fit into one chimney buffer. */ - if (tot_data_buf_len < txr->hn_chim_size) { + if (pkt->rm_len < txr->hn_chim_size) { txr->hn_tx_chimney_tried++; send_buf_section_idx = hn_chim_alloc(txr->hn_sc); if (send_buf_section_idx != HN_NVS_CHIM_IDX_INVALID) { uint8_t *dest = txr->hn_sc->hn_chim + (send_buf_section_idx * txr->hn_sc->hn_chim_szmax); - memcpy(dest, rndis_mesg, rndis_msg_size); - dest += rndis_msg_size; + memcpy(dest, pkt, pktlen); + dest += pktlen; m_copydata(m_head, 0, m_head->m_pkthdr.len, dest); - send_buf_section_size = tot_data_buf_len; + send_buf_section_size = pkt->rm_len; txr->hn_gpa_cnt = 0; txr->hn_tx_chimney++; goto done; @@ -1033,9 +1012,9 @@ hn_encap(struct hn_tx_ring *txr, struct txr->hn_gpa_cnt = nsegs + 1; /* send packet with page buffer */ - txr->hn_gpa[0].gpa_page = atop(txd->rndis_msg_paddr); - txr->hn_gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK; - txr->hn_gpa[0].gpa_len = rndis_msg_size; + txr->hn_gpa[0].gpa_page = atop(txd->rndis_pkt_paddr); + txr->hn_gpa[0].gpa_ofs = txd->rndis_pkt_paddr & PAGE_MASK; + txr->hn_gpa[0].gpa_len = pktlen; /* * Fill the page buffers with mbuf info after the page @@ -1283,7 +1262,7 @@ hn_lro_rx(struct lro_ctrl *lc, struct mb * Note: This is no longer used as a callback */ int -netvsc_recv(struct hn_rx_ring *rxr, const void *data, int dlen, +hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info) { struct ifnet *ifp = rxr->hn_ifp; @@ -2109,8 +2088,8 @@ hn_ndis_version_sysctl(SYSCTL_HANDLER_AR char verstr[16]; snprintf(verstr, sizeof(verstr), "%u.%u", - NDIS_VERSION_MAJOR(sc->hn_ndis_ver), - NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); } @@ -2460,16 +2439,16 @@ hn_create_tx_ring(struct hn_softc *sc, i parent_dtag = bus_get_dma_tag(dev); - /* DMA tag for RNDIS messages. */ + /* DMA tag for RNDIS packet messages. */ error = bus_dma_tag_create(parent_dtag, /* parent */ - HN_RNDIS_MSG_ALIGN, /* alignment */ - HN_RNDIS_MSG_BOUNDARY, /* boundary */ + HN_RNDIS_PKT_ALIGN, /* alignment */ + HN_RNDIS_PKT_BOUNDARY, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - HN_RNDIS_MSG_LEN, /* maxsize */ + HN_RNDIS_PKT_LEN, /* maxsize */ 1, /* nsegments */ - HN_RNDIS_MSG_LEN, /* maxsegsize */ + HN_RNDIS_PKT_LEN, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ @@ -2504,28 +2483,28 @@ hn_create_tx_ring(struct hn_softc *sc, i txd->txr = txr; /* - * Allocate and load RNDIS messages. + * Allocate and load RNDIS packet message. */ error = bus_dmamem_alloc(txr->hn_tx_rndis_dtag, - (void **)&txd->rndis_msg, - BUS_DMA_WAITOK | BUS_DMA_COHERENT, - &txd->rndis_msg_dmap); + (void **)&txd->rndis_pkt, + BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, + &txd->rndis_pkt_dmap); if (error) { device_printf(dev, - "failed to allocate rndis_msg, %d\n", i); + "failed to allocate rndis_packet_msg, %d\n", i); return error; } error = bus_dmamap_load(txr->hn_tx_rndis_dtag, - txd->rndis_msg_dmap, - txd->rndis_msg, HN_RNDIS_MSG_LEN, - hyperv_dma_map_paddr, &txd->rndis_msg_paddr, + txd->rndis_pkt_dmap, + txd->rndis_pkt, HN_RNDIS_PKT_LEN, + hyperv_dma_map_paddr, &txd->rndis_pkt_paddr, BUS_DMA_NOWAIT); if (error) { device_printf(dev, - "failed to load rndis_msg, %d\n", i); + "failed to load rndis_packet_msg, %d\n", i); bus_dmamem_free(txr->hn_tx_rndis_dtag, - txd->rndis_msg, txd->rndis_msg_dmap); + txd->rndis_pkt, txd->rndis_pkt_dmap); return error; } @@ -2536,9 +2515,9 @@ hn_create_tx_ring(struct hn_softc *sc, i device_printf(dev, "failed to allocate tx data dmamap\n"); bus_dmamap_unload(txr->hn_tx_rndis_dtag, - txd->rndis_msg_dmap); + txd->rndis_pkt_dmap); bus_dmamem_free(txr->hn_tx_rndis_dtag, - txd->rndis_msg, txd->rndis_msg_dmap); + txd->rndis_pkt, txd->rndis_pkt_dmap); return error; } @@ -2596,9 +2575,9 @@ hn_txdesc_dmamap_destroy(struct hn_txdes KASSERT(txd->m == NULL, ("still has mbuf installed")); KASSERT((txd->flags & HN_TXD_FLAG_DMAMAP) == 0, ("still dma mapped")); - bus_dmamap_unload(txr->hn_tx_rndis_dtag, txd->rndis_msg_dmap); - bus_dmamem_free(txr->hn_tx_rndis_dtag, txd->rndis_msg, - txd->rndis_msg_dmap); + bus_dmamap_unload(txr->hn_tx_rndis_dtag, txd->rndis_pkt_dmap); + bus_dmamem_free(txr->hn_tx_rndis_dtag, txd->rndis_pkt, + txd->rndis_pkt_dmap); bus_dmamap_destroy(txr->hn_tx_data_dtag, txd->data_dmap); } Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:14:23 2016 (r307499) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:16:26 2016 (r307500) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -48,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -102,29 +102,40 @@ again: return ((rid & 0xffff) << 16); } -/* - * Set the Per-Packet-Info with the specified type - */ void * -hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, - int pkt_type) +hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, + size_t pi_dlen, uint32_t pi_type) { - rndis_packet *rndis_pkt; - rndis_per_packet_info *rppi; + const size_t pi_size = HN_RNDIS_PKTINFO_SIZE(pi_dlen); + struct rndis_pktinfo *pi; - rndis_pkt = &rndis_mesg->msg.packet; - rndis_pkt->data_offset += rppi_size; + KASSERT((pi_size & RNDIS_PACKET_MSG_OFFSET_ALIGNMASK) == 0, + ("unaligned pktinfo size %zu, pktinfo dlen %zu", pi_size, pi_dlen)); - rppi = (rndis_per_packet_info *)((char *)rndis_pkt + - rndis_pkt->per_pkt_info_offset + rndis_pkt->per_pkt_info_length); + /* + * Per-packet-info does not move; it only grows. + * + * NOTE: + * rm_pktinfooffset in this phase counts from the beginning + * of rndis_packet_msg. + */ + KASSERT(pkt->rm_pktinfooffset + pkt->rm_pktinfolen + pi_size <= pktsize, + ("%u pktinfo overflows RNDIS packet msg", pi_type)); + pi = (struct rndis_pktinfo *)((uint8_t *)pkt + pkt->rm_pktinfooffset + + pkt->rm_pktinfolen); + pkt->rm_pktinfolen += pi_size; + + pi->rm_size = pi_size; + pi->rm_type = pi_type; + pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; - rppi->size = rppi_size; - rppi->type = pkt_type; - rppi->per_packet_info_offset = sizeof(rndis_per_packet_info); + /* Data immediately follow per-packet-info. */ + pkt->rm_dataoffset += pi_size; - rndis_pkt->per_pkt_info_length += rppi_size; + /* Update RNDIS packet msg length */ + pkt->rm_len += pi_size; - return (rppi); + return (pi->rm_data); } /* @@ -408,7 +419,7 @@ hv_rf_receive_data(struct hn_rx_ring *rx pkt->rm_len, data_off, data_len); return; } - netvsc_recv(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); + hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); } /* @@ -720,7 +731,7 @@ hn_rndis_get_rsscaps(struct hn_softc *sc /* * Only NDIS 6.30+ is supported. */ - KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30, + KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); *rxr_cnt = 0; @@ -816,7 +827,7 @@ hn_rndis_conf_offload(struct hn_softc *s memset(¶ms, 0, sizeof(params)); params.ndis_hdr.ndis_type = NDIS_OBJTYPE_DEFAULT; - if (sc->hn_ndis_ver < NDIS_VERSION_6_30) { + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) { params.ndis_hdr.ndis_rev = NDIS_OFFLOAD_PARAMS_REV_2; paramsz = NDIS_OFFLOAD_PARAMS_SIZE_6_1; } else { @@ -828,7 +839,7 @@ hn_rndis_conf_offload(struct hn_softc *s params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; - if (sc->hn_ndis_ver >= NDIS_VERSION_6_30) { + if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; } @@ -855,7 +866,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, i /* * Only NDIS 6.30+ is supported. */ - KASSERT(sc->hn_ndis_ver >= NDIS_VERSION_6_30, + KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); memset(rss, 0, sizeof(*rss)); @@ -1048,7 +1059,7 @@ hv_rf_on_device_add(struct hn_softc *sc, hv_rf_query_device_link_status(sc, &dev_info->link_state); - if (sc->hn_ndis_ver < NDIS_VERSION_6_30 || nchan == 1) { + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) { /* * Either RSS is not supported, or multiple RX/TX rings * are not requested. @@ -1178,5 +1189,5 @@ void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { - netvsc_channel_rollup(rxr, txr); + hn_chan_rollup(rxr, txr); } Modified: stable/11/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Mon Oct 17 08:14:23 2016 (r307499) +++ stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Mon Oct 17 08:16:26 2016 (r307500) @@ -32,6 +32,14 @@ #include #include +/* + * NDIS protocol version numbers + */ +#define HN_NDIS_VERSION_6_1 0x00060001 +#define HN_NDIS_VERSION_6_30 0x0006001e +#define HN_NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) +#define HN_NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) + #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface @@ -221,4 +229,8 @@ CTASSERT(sizeof(struct hn_nvs_rndis_ack) #define HN_NDIS_HASH_VALUE_SIZE sizeof(uint32_t) #define HN_NDIS_PKTINFO_TYPE_HASHVAL NDIS_PKTINFO_TYPE_PKT_CANCELID +/* Per-packet-info size */ +#define HN_RNDIS_PKTINFO_SIZE(dlen) \ + __offsetof(struct rndis_pktinfo, rm_data[dlen]) + #endif /* !_IF_HNREG_H_ */ Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 08:14:23 2016 (r307499) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 08:16:26 2016 (r307500) @@ -112,6 +112,7 @@ hn_nvs_send_sglist(struct vmbus_channel } struct vmbus_xact; +struct rndis_packet_msg; const void *hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, @@ -121,6 +122,13 @@ void hn_nvs_sent_xact(struct hn_send_ct uint32_t hn_chim_alloc(struct hn_softc *sc); void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); +void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, + size_t pktsize, size_t pi_dlen, uint32_t pi_type); + +int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, + const struct hn_recvinfo *info); +void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); + extern struct hn_send_ctx hn_send_ctx_none; #endif /* !_IF_HNVAR_H_ */ Modified: stable/11/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 08:14:23 2016 (r307499) +++ stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 08:16:26 2016 (r307500) @@ -213,7 +213,7 @@ struct ndis_rssprm_toeplitz { #define NDIS_VLAN_INFO_CFI_MASK 0x0008 #define NDIS_VLAN_INFO_ID_MASK 0xfff0 #define NDIS_VLAN_INFO_MAKE(id, pri, cfi) \ - (((pri) & NVIS_VLAN_INFO_PRI_MASK) | \ + (((pri) & NDIS_VLAN_INFO_PRI_MASK) | \ (((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4)) #define NDIS_VLAN_INFO_ID(inf) (((inf) & NDIS_VLAN_INFO_ID_MASK) >> 4) #define NDIS_VLAN_INFO_CFI(inf) (((inf) & NDIS_VLAN_INFO_CFI_MASK) >> 3) @@ -231,4 +231,31 @@ struct ndis_rssprm_toeplitz { #define NDIS_RXCSUM_INFO_TCPCS_INVAL 0x0080 #define NDIS_RXCSUM_INFO_IPCS_INVAL 0x0100 +/* LSOv2 */ +#define NDIS_LSO2_INFO_SIZE sizeof(uint32_t) +#define NDIS_LSO2_INFO_MSS_MASK 0x000fffff +#define NDIS_LSO2_INFO_THOFF_MASK 0x3ff00000 +#define NDIS_LSO2_INFO_ISLSO2 0x40000000 +#define NDIS_LSO2_INFO_ISIPV6 0x80000000 + +#define NDIS_LSO2_INFO_MAKE(thoff, mss) \ + ((((uint32_t)(mss)) & NDIS_LSO2_INFO_MSS_MASK) | \ + ((((uint32_t)(thoff)) & 0x3ff) << 20) | \ + NDIS_LSO2_INFO_ISLSO2) + +#define NDIS_LSO2_INFO_MAKEIPV4(thoff, mss) \ + NDIS_LSO2_INFO_MAKE((thoff), (mss)) + +#define NDIS_LSO2_INFO_MAKEIPV6(thoff, mss) \ + (NDIS_LSO2_INFO_MAKE((thoff), (mss)) | NDIS_LSO2_INFO_ISIPV6) + +/* Transmission checksum */ +#define NDIS_TXCSUM_INFO_SIZE sizeof(uint32_t) +#define NDIS_TXCSUM_INFO_IPV4 0x00000001 +#define NDIS_TXCSUM_INFO_IPV6 0x00000002 +#define NDIS_TXCSUM_INFO_TCPCS 0x00000004 +#define NDIS_TXCSUM_INFO_UDPCS 0x00000008 +#define NDIS_TXCSUM_INFO_IPCS 0x00000010 +#define NDIS_TXCSUM_INFO_THOFF 0x03ff0000 + #endif /* !_NET_NDIS_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 08:17:07 2016 Return-Path: Delivered-To: svn-src-all@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 57A97C15DD7; Mon, 17 Oct 2016 08:17:07 +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 2731E192D; Mon, 17 Oct 2016 08:17:07 +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 u9H8H650029305; Mon, 17 Oct 2016 08:17:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8H6xe029304; Mon, 17 Oct 2016 08:17:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610170817.u9H8H6xe029304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 17 Oct 2016 08:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307501 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:17:07 -0000 Author: kib Date: Mon Oct 17 08:17:06 2016 New Revision: 307501 URL: https://svnweb.freebsd.org/changeset/base/307501 Log: If vm_fault_hold(9) finds that fs.m is wired, do not free it after a pager error, leave the page to the wire owner. E.g. the page might be a part of the invalidated buffer. Reported and tested by: pho Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D8197 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Oct 17 08:16:26 2016 (r307500) +++ head/sys/vm/vm_fault.c Mon Oct 17 08:17:06 2016 (r307501) @@ -722,7 +722,10 @@ vnode_locked: */ if (rv == VM_PAGER_ERROR || rv == VM_PAGER_BAD) { vm_page_lock(fs.m); - vm_page_free(fs.m); + if (fs.m->wire_count == 0) + vm_page_free(fs.m); + else + vm_page_xunbusy_maybelocked(fs.m); vm_page_unlock(fs.m); fs.m = NULL; unlock_and_deallocate(&fs); @@ -742,7 +745,10 @@ vnode_locked: */ if (fs.object != fs.first_object) { vm_page_lock(fs.m); - vm_page_free(fs.m); + if (fs.m->wire_count == 0) + vm_page_free(fs.m); + else + vm_page_xunbusy_maybelocked(fs.m); vm_page_unlock(fs.m); fs.m = NULL; } From owner-svn-src-all@freebsd.org Mon Oct 17 08:20:19 2016 Return-Path: Delivered-To: svn-src-all@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 24951C15E9E; Mon, 17 Oct 2016 08:20:19 +0000 (UTC) (envelope-from sephe@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 C9E8B1B7A; Mon, 17 Oct 2016 08:20:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8KI10029510; Mon, 17 Oct 2016 08:20:18 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8KHol029504; Mon, 17 Oct 2016 08:20:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170820.u9H8KHol029504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:20:17 +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: r307502 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:20:19 -0000 Author: sephe Date: Mon Oct 17 08:20:17 2016 New Revision: 307502 URL: https://svnweb.freebsd.org/changeset/base/307502 Log: MFC 305578-305581 305578 hyperv/hn: Pull vmbus channel open up. While I'm here, pull up the channel callback related code too. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7805 305579 hyperv/hn: Push RXBUF size adjustment down. It is not used in other places. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7806 305580 hyperv/hn: Factor out function to do NVS initialization. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7807 305581 hyperv/hn: Pass MTU around. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7808 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:17:06 2016 (r307501) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:20:17 2016 (r307502) @@ -57,20 +57,11 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper /* * Forward declarations */ -static void hv_nv_on_channel_callback(struct vmbus_channel *chan, - void *xrxr); static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); -static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *, int); +static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(struct hn_softc *sc); static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); -static int hv_nv_connect_to_vsp(struct hn_softc *sc); -static void hv_nv_on_send_completion(struct hn_softc *sc, - struct vmbus_channel *, const struct vmbus_chanpkt_hdr *pkt); -static void hv_nv_on_receive_completion(struct vmbus_channel *chan, - uint64_t tid); -static void hv_nv_on_receive(struct hn_softc *sc, - struct hn_rx_ring *rxr, struct vmbus_channel *chan, - const struct vmbus_chanpkt_hdr *pkt); +static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct hn_softc *, struct vmbus_channel *chan, const void *, int); @@ -78,6 +69,13 @@ static void hn_nvs_sent_none(struct hn_s struct hn_send_ctx hn_send_ctx_none = HN_SEND_CTX_INITIALIZER(hn_nvs_sent_none, NULL); +static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_5, + HN_NVS_VERSION_4, + HN_NVS_VERSION_2, + HN_NVS_VERSION_1 +}; + uint32_t hn_chim_alloc(struct hn_softc *sc) { @@ -163,17 +161,22 @@ hn_nvs_req_send(struct hn_softc *sc, voi * Hyper-V extensible switch and the synthetic data path. */ static int -hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc, int rxbuf_size) +hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) { struct vmbus_xact *xact = NULL; struct hn_nvs_rxbuf_conn *conn; const struct hn_nvs_rxbuf_connresp *resp; size_t resp_len; uint32_t status; - int error; + int error, rxbuf_size; - KASSERT(rxbuf_size <= NETVSC_RECEIVE_BUFFER_SIZE, - ("invalid rxbuf size %d", rxbuf_size)); + /* + * Limit RXBUF size for old NVS. + */ + if (sc->hn_nvs_ver <= HN_NVS_VERSION_2) + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; + else + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; /* * Connect the RXBUF GPADL to the primary channel. @@ -428,7 +431,7 @@ hv_nv_destroy_send_buffer(struct hn_soft } static int -hv_nv_negotiate_nvsp_protocol(struct hn_softc *sc, uint32_t nvs_ver) +hn_nvs_doinit(struct hn_softc *sc, uint32_t nvs_ver) { struct vmbus_xact *xact; struct hn_nvs_init *init; @@ -489,57 +492,55 @@ hv_nv_send_ndis_config(struct hn_softc * return (error); } -/* - * Net VSC connect to VSP - */ static int -hv_nv_connect_to_vsp(struct hn_softc *sc) +hn_nvs_init(struct hn_softc *sc) { - uint32_t protocol_list[] = { NVSP_PROTOCOL_VERSION_1, - NVSP_PROTOCOL_VERSION_2, - NVSP_PROTOCOL_VERSION_4, - NVSP_PROTOCOL_VERSION_5 }; int i; - int protocol_number = nitems(protocol_list); - int ret = 0; - device_t dev = sc->hn_dev; - struct ifnet *ifp = sc->hn_ifp; - struct hn_nvs_ndis_init ndis; - int rxbuf_size; - /* - * Negotiate the NVSP version. Try the latest NVSP first. - */ - for (i = protocol_number - 1; i >= 0; i--) { - if (hv_nv_negotiate_nvsp_protocol(sc, protocol_list[i]) == 0) { - sc->hn_nvs_ver = protocol_list[i]; + for (i = 0; i < nitems(hn_nvs_version); ++i) { + int error; + + error = hn_nvs_doinit(sc, hn_nvs_version[i]); + if (!error) { + sc->hn_nvs_ver = hn_nvs_version[i]; + + /* Set NDIS version according to NVS version. */ sc->hn_ndis_ver = HN_NDIS_VERSION_6_30; - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) + if (sc->hn_nvs_ver <= HN_NVS_VERSION_4) sc->hn_ndis_ver = HN_NDIS_VERSION_6_1; + if (bootverbose) { if_printf(sc->hn_ifp, "NVS version 0x%x, " - "NDIS version %u.%u\n", - sc->hn_nvs_ver, + "NDIS version %u.%u\n", sc->hn_nvs_ver, HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } - break; + return (0); } } + if_printf(sc->hn_ifp, "no NVS available\n"); + return (ENXIO); +} - if (i < 0) { - if (bootverbose) - device_printf(dev, "failed to negotiate a valid " - "protocol.\n"); - return (EPROTO); - } +/* + * Net VSC connect to VSP + */ +static int +hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu) +{ + int ret = 0; + struct hn_nvs_ndis_init ndis; + + ret = hn_nvs_init(sc); + if (ret != 0) + return (ret); /* * Set the MTU if supported by this NVSP protocol version * This needs to be right after the NVSP init message per Haiyang */ - if (sc->hn_nvs_ver >= NVSP_PROTOCOL_VERSION_2) - ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); + if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) + ret = hv_nv_send_ndis_config(sc, mtu); /* * Initialize NDIS. @@ -557,13 +558,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc goto cleanup; } - /* Post the big receive buffer to NetVSP */ - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; - else - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; - - ret = hv_nv_init_rx_buffer_with_net_vsp(sc, rxbuf_size); + ret = hv_nv_init_rx_buffer_with_net_vsp(sc); if (ret == 0) ret = hv_nv_init_send_buffer_with_net_vsp(sc); @@ -581,54 +576,19 @@ hv_nv_disconnect_from_vsp(struct hn_soft hv_nv_destroy_send_buffer(sc); } -void -hv_nv_subchan_attach(struct vmbus_channel *chan, struct hn_rx_ring *rxr) -{ - KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), - ("chan%u subidx %u, rxr%d mismatch", - vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); - vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, - NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, - hv_nv_on_channel_callback, rxr); -} - /* * Net VSC on device add * * Callback when the device belonging to this driver is added */ int -hv_nv_on_device_add(struct hn_softc *sc, struct hn_rx_ring *rxr) +hv_nv_on_device_add(struct hn_softc *sc, int mtu) { - struct vmbus_channel *chan = sc->hn_prichan; - int ret = 0; - - /* - * Open the channel - */ - KASSERT(rxr->hn_rx_idx == vmbus_chan_subidx(chan), - ("chan%u subidx %u, rxr%d mismatch", - vmbus_chan_id(chan), vmbus_chan_subidx(chan), rxr->hn_rx_idx)); - ret = vmbus_chan_open(chan, - NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, - NULL, 0, hv_nv_on_channel_callback, rxr); - if (ret != 0) - goto cleanup; /* * Connect with the NetVsp */ - ret = hv_nv_connect_to_vsp(sc); - if (ret != 0) - goto close; - - return (0); - -close: - /* Now, we can close the channel safely */ - vmbus_chan_close(chan); -cleanup: - return (ret); + return (hv_nv_connect_to_vsp(sc, mtu)); } /* @@ -684,25 +644,6 @@ hn_chim_free(struct hn_softc *sc, uint32 } /* - * Net VSC on send completion - */ -static void -hv_nv_on_send_completion(struct hn_softc *sc, struct vmbus_channel *chan, - const struct vmbus_chanpkt_hdr *pkt) -{ - struct hn_send_ctx *sndc; - - sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; - sndc->hn_cb(sndc, sc, chan, VMBUS_CHANPKT_CONST_DATA(pkt), - VMBUS_CHANPKT_DATALEN(pkt)); - /* - * NOTE: - * 'sndc' CAN NOT be accessed anymore, since it can be freed by - * its callback. - */ -} - -/* * Net VSC on send * Sends a packet on the specified Hyper-V device. * Returns 0 on success, non-zero on failure. @@ -729,190 +670,3 @@ hv_nv_on_send(struct vmbus_channel *chan return (ret); } - -/* - * Net VSC on receive - * - * In the FreeBSD Hyper-V virtual world, this function deals exclusively - * with virtual addresses. - */ -static void -hv_nv_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, - struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) -{ - const struct vmbus_chanpkt_rxbuf *pkt; - const struct hn_nvs_hdr *nvs_hdr; - int count, i, hlen; - - if (__predict_false(VMBUS_CHANPKT_DATALEN(pkthdr) < sizeof(*nvs_hdr))) { - if_printf(rxr->hn_ifp, "invalid nvs RNDIS\n"); - return; - } - nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); - - /* Make sure that this is a RNDIS message. */ - if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { - if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", - nvs_hdr->nvs_type); - return; - } - - hlen = VMBUS_CHANPKT_GETLEN(pkthdr->cph_hlen); - if (__predict_false(hlen < sizeof(*pkt))) { - if_printf(rxr->hn_ifp, "invalid rxbuf chanpkt\n"); - return; - } - pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; - - if (__predict_false(pkt->cp_rxbuf_id != HN_NVS_RXBUF_SIG)) { - if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", - pkt->cp_rxbuf_id); - return; - } - - count = pkt->cp_rxbuf_cnt; - if (__predict_false(hlen < - __offsetof(struct vmbus_chanpkt_rxbuf, cp_rxbuf[count]))) { - if_printf(rxr->hn_ifp, "invalid rxbuf_cnt %d\n", count); - return; - } - - /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ - for (i = 0; i < count; ++i) { - int ofs, len; - - ofs = pkt->cp_rxbuf[i].rb_ofs; - len = pkt->cp_rxbuf[i].rb_len; - if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { - if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " - "ofs %d, len %d\n", i, ofs, len); - continue; - } - hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); - } - - /* - * Moved completion call back here so that all received - * messages (not just data messages) will trigger a response - * message back to the host. - */ - hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid); -} - -/* - * Net VSC on receive completion - * - * Send a receive completion packet to RNDIS device (ie NetVsp) - */ -static void -hv_nv_on_receive_completion(struct vmbus_channel *chan, uint64_t tid) -{ - struct hn_nvs_rndis_ack ack; - int retries = 0; - int ret = 0; - - ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK; - ack.nvs_status = HN_NVS_STATUS_OK; - -retry_send_cmplt: - /* Send the completion */ - ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, - VMBUS_CHANPKT_FLAG_NONE, &ack, sizeof(ack), tid); - if (ret == 0) { - /* success */ - /* no-op */ - } else if (ret == EAGAIN) { - /* no more room... wait a bit and attempt to retry 3 times */ - retries++; - - if (retries < 4) { - DELAY(100); - goto retry_send_cmplt; - } - } -} - -static void -hn_proc_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) -{ - const struct hn_nvs_hdr *hdr; - - if (VMBUS_CHANPKT_DATALEN(pkt) < sizeof(*hdr)) { - if_printf(sc->hn_ifp, "invalid nvs notify\n"); - return; - } - hdr = VMBUS_CHANPKT_CONST_DATA(pkt); - - if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) { - /* Useless; ignore */ - return; - } - if_printf(sc->hn_ifp, "got notify, nvs type %u\n", hdr->nvs_type); -} - -/* - * Net VSC on channel callback - */ -static void -hv_nv_on_channel_callback(struct vmbus_channel *chan, void *xrxr) -{ - struct hn_rx_ring *rxr = xrxr; - struct hn_softc *sc = rxr->hn_ifp->if_softc; - void *buffer; - int bufferlen = NETVSC_PACKET_SIZE; - - buffer = rxr->hn_rdbuf; - do { - struct vmbus_chanpkt_hdr *pkt = buffer; - uint32_t bytes_rxed; - int ret; - - bytes_rxed = bufferlen; - ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); - if (ret == 0) { - if (bytes_rxed > 0) { - switch (pkt->cph_type) { - case VMBUS_CHANPKT_TYPE_COMP: - hv_nv_on_send_completion(sc, chan, pkt); - break; - case VMBUS_CHANPKT_TYPE_RXBUF: - hv_nv_on_receive(sc, rxr, chan, pkt); - break; - case VMBUS_CHANPKT_TYPE_INBAND: - hn_proc_notify(sc, pkt); - break; - default: - if_printf(rxr->hn_ifp, - "unknown chan pkt %u\n", - pkt->cph_type); - break; - } - } - } else if (ret == ENOBUFS) { - /* Handle large packet */ - if (bufferlen > NETVSC_PACKET_SIZE) { - free(buffer, M_NETVSC); - buffer = NULL; - } - - /* alloc new buffer */ - buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); - if (buffer == NULL) { - if_printf(rxr->hn_ifp, - "hv_cb malloc buffer failed, len=%u\n", - bytes_rxed); - bufferlen = 0; - break; - } - bufferlen = bytes_rxed; - } else { - /* No more packets */ - break; - } - } while (1); - - if (bufferlen > NETVSC_PACKET_SIZE) - free(buffer, M_NETVSC); - - hv_rf_channel_rollup(rxr, rxr->hn_txr); -} Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:17:06 2016 (r307501) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:20:17 2016 (r307502) @@ -68,13 +68,6 @@ MALLOC_DECLARE(M_NETVSC); -#define NVSP_INVALID_PROTOCOL_VERSION (0xFFFFFFFF) - -#define NVSP_PROTOCOL_VERSION_1 2 -#define NVSP_PROTOCOL_VERSION_2 0x30002 -#define NVSP_PROTOCOL_VERSION_4 0x40000 -#define NVSP_PROTOCOL_VERSION_5 0x50000 - /* * The following arguably belongs in a separate header file */ @@ -268,12 +261,10 @@ extern int hv_promisc_mode; struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); -int hv_nv_on_device_add(struct hn_softc *sc, struct hn_rx_ring *rxr); +int hv_nv_on_device_add(struct hn_softc *sc, int mtu); int hv_nv_on_device_remove(struct hn_softc *sc); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); -void hv_nv_subchan_attach(struct vmbus_channel *chan, - struct hn_rx_ring *rxr); #endif /* __HV_NET_VSC_H__ */ Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:17:06 2016 (r307501) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:20:17 2016 (r307502) @@ -344,9 +344,18 @@ static int hn_encap(struct hn_tx_ring *, static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_chim_size(struct hn_softc *, int); -static void hn_channel_attach(struct hn_softc *, struct vmbus_channel *); -static void hn_subchan_attach(struct hn_softc *, struct vmbus_channel *); -static void hn_subchan_setup(struct hn_softc *); +static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); +static int hn_attach_subchans(struct hn_softc *); +static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr); + +static void hn_nvs_handle_notify(struct hn_softc *sc, + const struct vmbus_chanpkt_hdr *pkt); +static void hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkt); +static void hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, + struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkthdr); +static void hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid); static int hn_transmit(struct ifnet *, struct mbuf *); static void hn_xmit_qflush(struct ifnet *); @@ -512,12 +521,13 @@ netvsc_attach(device_t dev) /* * Associate the first TX/RX ring w/ the primary channel. */ - hn_channel_attach(sc, sc->hn_prichan); + error = hn_chan_attach(sc, sc->hn_prichan); + if (error) + goto failed; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_ifinit; - /* needed by hv_rf_on_device_add() code */ ifp->if_mtu = ETHERMTU; if (hn_use_if_start) { int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); @@ -554,8 +564,7 @@ netvsc_attach(device_t dev) if (sc->hn_xact == NULL) goto failed; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, - &sc->hn_rx_ring[0]); + error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, ETHERMTU); if (error) goto failed; KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, @@ -572,8 +581,11 @@ netvsc_attach(device_t dev) device_printf(dev, "%d TX ring, %d RX ring\n", sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); - if (sc->hn_rx_ring_inuse > 1) - hn_subchan_setup(sc); + if (sc->hn_rx_ring_inuse > 1) { + error = hn_attach_subchans(sc); + if (error) + goto failed; + } #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { @@ -1566,9 +1578,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, /* Wait for subchannels to be destroyed */ vmbus_subchan_drain(sc->hn_prichan); + sc->hn_rx_ring[0].hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; + sc->hn_tx_ring[0].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; + hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */ + ring_cnt = sc->hn_rx_ring_inuse; error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, - &sc->hn_rx_ring[0]); + ifr->ifr_mtu); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; @@ -1594,7 +1610,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, sc->hn_tx_ring[r].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; } - hn_subchan_setup(sc); + hn_attach_subchans(sc); /* XXX check error */ } if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) @@ -2948,14 +2964,18 @@ hn_xmit_txeof_taskfunc(void *xtxr, int p mtx_unlock(&txr->hn_tx_lock); } -static void -hn_channel_attach(struct hn_softc *sc, struct vmbus_channel *chan) +static int +hn_chan_attach(struct hn_softc *sc, struct vmbus_channel *chan) { struct hn_rx_ring *rxr; - int idx; + struct hn_tx_ring *txr = NULL; + int idx, error; idx = vmbus_chan_subidx(chan); + /* + * Link this channel to RX/TX ring. + */ KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse, ("invalid channel index %d, should > 0 && < %d", idx, sc->hn_rx_ring_inuse)); @@ -2965,60 +2985,260 @@ hn_channel_attach(struct hn_softc *sc, s rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED; if (bootverbose) { - if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", + if_printf(sc->hn_ifp, "link RX ring %d to chan%u\n", idx, vmbus_chan_id(chan)); } if (idx < sc->hn_tx_ring_inuse) { - struct hn_tx_ring *txr = &sc->hn_tx_ring[idx]; - + txr = &sc->hn_tx_ring[idx]; KASSERT((txr->hn_tx_flags & HN_TX_FLAG_ATTACHED) == 0, ("TX ring %d already attached", idx)); txr->hn_tx_flags |= HN_TX_FLAG_ATTACHED; txr->hn_chan = chan; if (bootverbose) { - if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", + if_printf(sc->hn_ifp, "link TX ring %d to chan%u\n", idx, vmbus_chan_id(chan)); } } - /* Bind channel to a proper CPU */ + /* Bind this channel to a proper CPU. */ vmbus_chan_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); -} - -static void -hn_subchan_attach(struct hn_softc *sc, struct vmbus_channel *chan) -{ - KASSERT(!vmbus_chan_is_primary(chan), - ("subchannel callback on primary channel")); - hn_channel_attach(sc, chan); + /* Open this channel */ + error = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, + NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hn_chan_callback, rxr); + if (error) { + if_printf(sc->hn_ifp, "open chan%u failed: %d\n", + vmbus_chan_id(chan), error); + rxr->hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; + if (txr != NULL) + txr->hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; + } + return (error); } -static void -hn_subchan_setup(struct hn_softc *sc) +static int +hn_attach_subchans(struct hn_softc *sc) { struct vmbus_channel **subchans; int subchan_cnt = sc->hn_rx_ring_inuse - 1; - int i; + int i, error = 0; /* Wait for sub-channels setup to complete. */ subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); /* Attach the sub-channels. */ for (i = 0; i < subchan_cnt; ++i) { - struct vmbus_channel *subchan = subchans[i]; - - /* NOTE: Calling order is critical. */ - hn_subchan_attach(sc, subchan); - hv_nv_subchan_attach(subchan, - &sc->hn_rx_ring[vmbus_chan_subidx(subchan)]); + error = hn_chan_attach(sc, subchans[i]); + if (error) + break; } /* Release the sub-channels */ vmbus_subchan_rel(subchans, subchan_cnt); - if_printf(sc->hn_ifp, "%d sub-channels setup done\n", subchan_cnt); + + if (error) { + if_printf(sc->hn_ifp, "sub-channels attach failed: %d\n", error); + } else { + if (bootverbose) { + if_printf(sc->hn_ifp, "%d sub-channels attached\n", + subchan_cnt); + } + } + return (error); +} + +static void +hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) +{ + const struct hn_nvs_hdr *hdr; + + if (VMBUS_CHANPKT_DATALEN(pkt) < sizeof(*hdr)) { + if_printf(sc->hn_ifp, "invalid nvs notify\n"); + return; + } + hdr = VMBUS_CHANPKT_CONST_DATA(pkt); + + if (hdr->nvs_type == HN_NVS_TYPE_TXTBL_NOTE) { + /* Useless; ignore */ + return; + } + if_printf(sc->hn_ifp, "got notify, nvs type %u\n", hdr->nvs_type); +} + +static void +hn_nvs_handle_comp(struct hn_softc *sc, struct vmbus_channel *chan, + const struct vmbus_chanpkt_hdr *pkt) +{ + struct hn_send_ctx *sndc; + + sndc = (struct hn_send_ctx *)(uintptr_t)pkt->cph_xactid; + sndc->hn_cb(sndc, sc, chan, VMBUS_CHANPKT_CONST_DATA(pkt), + VMBUS_CHANPKT_DATALEN(pkt)); + /* + * NOTE: + * 'sndc' CAN NOT be accessed anymore, since it can be freed by + * its callback. + */ +} + +static void +hn_nvs_handle_rxbuf(struct hn_softc *sc, struct hn_rx_ring *rxr, + struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) +{ + const struct vmbus_chanpkt_rxbuf *pkt; + const struct hn_nvs_hdr *nvs_hdr; + int count, i, hlen; + + if (__predict_false(VMBUS_CHANPKT_DATALEN(pkthdr) < sizeof(*nvs_hdr))) { + if_printf(rxr->hn_ifp, "invalid nvs RNDIS\n"); + return; + } + nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); + + /* Make sure that this is a RNDIS message. */ + if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { + if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", + nvs_hdr->nvs_type); + return; + } + + hlen = VMBUS_CHANPKT_GETLEN(pkthdr->cph_hlen); + if (__predict_false(hlen < sizeof(*pkt))) { + if_printf(rxr->hn_ifp, "invalid rxbuf chanpkt\n"); + return; + } + pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; + + if (__predict_false(pkt->cp_rxbuf_id != HN_NVS_RXBUF_SIG)) { + if_printf(rxr->hn_ifp, "invalid rxbuf_id 0x%08x\n", + pkt->cp_rxbuf_id); + return; + } + + count = pkt->cp_rxbuf_cnt; + if (__predict_false(hlen < + __offsetof(struct vmbus_chanpkt_rxbuf, cp_rxbuf[count]))) { + if_printf(rxr->hn_ifp, "invalid rxbuf_cnt %d\n", count); + return; + } + + /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ + for (i = 0; i < count; ++i) { + int ofs, len; + + ofs = pkt->cp_rxbuf[i].rb_ofs; + len = pkt->cp_rxbuf[i].rb_len; + if (__predict_false(ofs + len > NETVSC_RECEIVE_BUFFER_SIZE)) { + if_printf(rxr->hn_ifp, "%dth RNDIS msg overflow rxbuf, " + "ofs %d, len %d\n", i, ofs, len); + continue; + } + hv_rf_on_receive(sc, rxr, rxr->hn_rxbuf + ofs, len); + } + + /* + * Moved completion call back here so that all received + * messages (not just data messages) will trigger a response + * message back to the host. + */ + hn_nvs_ack_rxbuf(chan, pkt->cp_hdr.cph_xactid); +} + +/* + * Net VSC on receive completion + * + * Send a receive completion packet to RNDIS device (ie NetVsp) + */ +static void +hn_nvs_ack_rxbuf(struct vmbus_channel *chan, uint64_t tid) +{ + struct hn_nvs_rndis_ack ack; + int retries = 0; + int ret = 0; + + ack.nvs_type = HN_NVS_TYPE_RNDIS_ACK; + ack.nvs_status = HN_NVS_STATUS_OK; + +retry_send_cmplt: + /* Send the completion */ + ret = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_COMP, + VMBUS_CHANPKT_FLAG_NONE, &ack, sizeof(ack), tid); + if (ret == 0) { + /* success */ + /* no-op */ + } else if (ret == EAGAIN) { + /* no more room... wait a bit and attempt to retry 3 times */ + retries++; + + if (retries < 4) { + DELAY(100); + goto retry_send_cmplt; + } + } +} + +static void +hn_chan_callback(struct vmbus_channel *chan, void *xrxr) +{ + struct hn_rx_ring *rxr = xrxr; + struct hn_softc *sc = rxr->hn_ifp->if_softc; + void *buffer; + int bufferlen = NETVSC_PACKET_SIZE; + + buffer = rxr->hn_rdbuf; + do { + struct vmbus_chanpkt_hdr *pkt = buffer; + uint32_t bytes_rxed; + int ret; + + bytes_rxed = bufferlen; + ret = vmbus_chan_recv_pkt(chan, pkt, &bytes_rxed); + if (ret == 0) { + switch (pkt->cph_type) { + case VMBUS_CHANPKT_TYPE_COMP: + hn_nvs_handle_comp(sc, chan, pkt); + break; + case VMBUS_CHANPKT_TYPE_RXBUF: + hn_nvs_handle_rxbuf(sc, rxr, chan, pkt); + break; + case VMBUS_CHANPKT_TYPE_INBAND: + hn_nvs_handle_notify(sc, pkt); + break; + default: + if_printf(rxr->hn_ifp, + "unknown chan pkt %u\n", + pkt->cph_type); + break; + } + } else if (ret == ENOBUFS) { + /* Handle large packet */ + if (bufferlen > NETVSC_PACKET_SIZE) { + free(buffer, M_NETVSC); + buffer = NULL; + } + + /* alloc new buffer */ + buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT); + if (buffer == NULL) { + if_printf(rxr->hn_ifp, + "hv_cb malloc buffer failed, len=%u\n", + bytes_rxed); + bufferlen = 0; + break; + } + bufferlen = bytes_rxed; + } else { + /* No more packets */ + break; + } + } while (1); + + if (bufferlen > NETVSC_PACKET_SIZE) + free(buffer, M_NETVSC); + + hv_rf_channel_rollup(rxr, rxr->hn_txr); } static void Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:17:06 2016 (r307501) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:20:17 2016 (r307502) @@ -1012,7 +1012,7 @@ hv_rf_halt_device(struct hn_softc *sc) */ int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, - int *nchan0, struct hn_rx_ring *rxr) + int *nchan0, int mtu) { int ret; netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; @@ -1031,7 +1031,7 @@ hv_rf_on_device_add(struct hn_softc *sc, * (hv_rf_on_receive()) before this call is completed. * Note: Earlier code used a function pointer here. */ - ret = hv_nv_on_device_add(sc, rxr); + ret = hv_nv_on_device_add(sc, mtu); if (ret != 0) return (ret); Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 08:17:06 2016 (r307501) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Mon Oct 17 08:20:17 2016 (r307502) @@ -44,7 +44,7 @@ void hv_rf_on_receive(struct hn_softc *s const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan, - struct hn_rx_ring *rxr); + int mtu); int hv_rf_on_device_remove(struct hn_softc *sc); int hv_rf_on_open(struct hn_softc *sc); int hv_rf_on_close(struct hn_softc *sc); Modified: stable/11/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Mon Oct 17 08:17:06 2016 (r307501) +++ stable/11/sys/dev/hyperv/netvsc/if_hnreg.h Mon Oct 17 08:20:17 2016 (r307502) @@ -40,6 +40,14 @@ #define HN_NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) #define HN_NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) +/* + * NVS versions. + */ +#define HN_NVS_VERSION_1 0x00002 +#define HN_NVS_VERSION_2 0x30002 +#define HN_NVS_VERSION_4 0x40000 +#define HN_NVS_VERSION_5 0x50000 + #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface From owner-svn-src-all@freebsd.org Mon Oct 17 08:23:31 2016 Return-Path: Delivered-To: svn-src-all@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 A3DDEC140E7; Mon, 17 Oct 2016 08:23:31 +0000 (UTC) (envelope-from sephe@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 58BE21008; Mon, 17 Oct 2016 08:23:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8NUjP033180; Mon, 17 Oct 2016 08:23:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8NUHt033179; Mon, 17 Oct 2016 08:23:30 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170823.u9H8NUHt033179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:23:30 +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: r307503 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:23:31 -0000 Author: sephe Date: Mon Oct 17 08:23:30 2016 New Revision: 307503 URL: https://svnweb.freebsd.org/changeset/base/307503 Log: MFC 305585 hyperv/kvp: Fix IPv4/IPv6 address injection support. The GUID string provided by hypervisor has leading and trailing braces, while our GUID string does not have braces at all. Both braces should be ignored, when the GUID strings are compared. Submitted by: Hongjiang Zhang Modified by: sephe Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7809 Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 08:20:17 2016 (r307502) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Oct 17 08:23:30 2016 (r307503) @@ -332,20 +332,23 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru if (devclass_get_devices(devclass_find("hn"), &devs, &devcnt) == 0) { for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) { - /* XXX access other driver's softc? are you kidding? */ device_t dev = devs[devcnt]; struct vmbus_channel *chan; char buf[HYPERV_GUID_STRLEN]; + int n; - /* - * Trying to find GUID of Network Device - */ chan = vmbus_get_channel(dev); - hyperv_guid2str(vmbus_chan_guid_inst(chan), - buf, sizeof(buf)); + n = hyperv_guid2str(vmbus_chan_guid_inst(chan), buf, + sizeof(buf)); - if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, - HYPERV_GUID_STRLEN - 1) == 0) { + /* + * The string in the 'kvp_ip_val.adapter_id' has + * braces around the GUID; skip the leading brace + * in 'kvp_ip_val.adapter_id'. + */ + if (strncmp(buf, + ((char *)&umsg->body.kvp_ip_val.adapter_id) + 1, + n) == 0) { strlcpy((char *)umsg->body.kvp_ip_val.adapter_id, device_get_nameunit(dev), MAX_ADAPTER_ID_SIZE); break; From owner-svn-src-all@freebsd.org Mon Oct 17 08:25:48 2016 Return-Path: Delivered-To: svn-src-all@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 78133C14208; Mon, 17 Oct 2016 08:25:48 +0000 (UTC) (envelope-from sephe@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 4E609120A; Mon, 17 Oct 2016 08:25:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8PlRD033317; Mon, 17 Oct 2016 08:25:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8PldZ033316; Mon, 17 Oct 2016 08:25:47 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170825.u9H8PldZ033316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:25: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: r307504 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:25:48 -0000 Author: sephe Date: Mon Oct 17 08:25:47 2016 New Revision: 307504 URL: https://svnweb.freebsd.org/changeset/base/307504 Log: MFC 305586,305587 305586 hyperv/hn: Function renaming. While I'm here, remove obvious comment. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7810 305587 hyperv/hn: Factor out NVS NDIS initialization Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7811 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:23:30 2016 (r307503) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:25:47 2016 (r307504) @@ -470,12 +470,10 @@ hn_nvs_doinit(struct hn_softc *sc, uint3 } /* - * Send NDIS version 2 config packet containing MTU. - * - * Not valid for NDIS version 1. + * Configure MTU and enable VLAN. */ static int -hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu) +hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) { struct hn_nvs_ndis_conf conf; int error; @@ -493,6 +491,24 @@ hv_nv_send_ndis_config(struct hn_softc * } static int +hn_nvs_init_ndis(struct hn_softc *sc) +{ + struct hn_nvs_ndis_init ndis; + int error; + + memset(&ndis, 0, sizeof(ndis)); + ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; + ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver); + ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver); + + /* NOTE: No response. */ + error = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); + if (error) + if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", error); + return (error); +} + +static int hn_nvs_init(struct hn_softc *sc) { int i; @@ -522,47 +538,37 @@ hn_nvs_init(struct hn_softc *sc) return (ENXIO); } -/* - * Net VSC connect to VSP - */ static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu) { - int ret = 0; - struct hn_nvs_ndis_init ndis; + int ret; + /* + * Initialize NVS. + */ ret = hn_nvs_init(sc); if (ret != 0) return (ret); - /* - * Set the MTU if supported by this NVSP protocol version - * This needs to be right after the NVSP init message per Haiyang - */ - if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) - ret = hv_nv_send_ndis_config(sc, mtu); + if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) { + /* + * Configure NDIS before initializing it. + */ + ret = hn_nvs_conf_ndis(sc, mtu); + if (ret != 0) + return (ret); + } /* * Initialize NDIS. */ - - memset(&ndis, 0, sizeof(ndis)); - ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT; - ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver); - ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver); - - /* NOTE: No response. */ - ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis)); - if (ret != 0) { - if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret); - goto cleanup; - } + ret = hn_nvs_init_ndis(sc); + if (ret != 0) + return (ret); ret = hv_nv_init_rx_buffer_with_net_vsp(sc); if (ret == 0) ret = hv_nv_init_send_buffer_with_net_vsp(sc); - -cleanup: return (ret); } From owner-svn-src-all@freebsd.org Mon Oct 17 08:27:20 2016 Return-Path: Delivered-To: svn-src-all@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 3E797C143A4; Mon, 17 Oct 2016 08:27:20 +0000 (UTC) (envelope-from sephe@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 17A0F13CE; Mon, 17 Oct 2016 08:27:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8RJMm033421; Mon, 17 Oct 2016 08:27:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8RJWH033419; Mon, 17 Oct 2016 08:27:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170827.u9H8RJWH033419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08: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: r307505 - in stable/11: lib/libstand sys/boot/i386/pxeldr X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:27:20 -0000 Author: sephe Date: Mon Oct 17 08:27:18 2016 New Revision: 307505 URL: https://svnweb.freebsd.org/changeset/base/307505 Log: MFC 305588 pxeboot: Add nfs.read_size tunable. Increase this tunable improves kernel loading speed. Submitted by: Jun Su Reviewed by: rpokala, wblock (previous version) Obtained from: DragonFlyBSD Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7756 Modified: stable/11/lib/libstand/nfs.c stable/11/sys/boot/i386/pxeldr/pxeboot.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libstand/nfs.c ============================================================================== --- stable/11/lib/libstand/nfs.c Mon Oct 17 08:25:47 2016 (r307504) +++ stable/11/lib/libstand/nfs.c Mon Oct 17 08:27:18 2016 (r307505) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -50,7 +51,8 @@ __FBSDID("$FreeBSD$"); #define NFS_DEBUGxx -#define NFSREAD_SIZE 1024 +#define NFSREAD_MIN_SIZE 1024 +#define NFSREAD_MAX_SIZE 4096 /* Define our own NFS attributes without NQNFS stuff. */ #ifdef OLD_NFSV2 @@ -83,7 +85,7 @@ struct nfs_read_repl { n_long errno; struct nfsv2_fattrs fa; n_long count; - u_char data[NFSREAD_SIZE]; + u_char data[NFSREAD_MAX_SIZE]; }; #ifndef NFS_NOSYMLINK @@ -210,6 +212,8 @@ struct fs_ops nfs_fsops = { nfs_readdir }; +static int nfs_read_size = NFSREAD_MIN_SIZE; + #ifdef OLD_NFSV2 /* * Fetch the root file handle (call mount daemon) @@ -264,6 +268,17 @@ nfs_getrootfh(struct iodesc *d, char *pa if (repl->errno) return (ntohl(repl->errno)); bcopy(repl->fh, fhp, sizeof(repl->fh)); + + /* + * Improve boot performance over NFS + */ + if (getenv("nfs.read_size") != NULL) + nfs_read_size = strtol(getenv("nfs.read_size"), NULL, 0); + if (nfs_read_size < NFSREAD_MIN_SIZE) + nfs_read_size = NFSREAD_MIN_SIZE; + if (nfs_read_size > NFSREAD_MAX_SIZE) + nfs_read_size = NFSREAD_MAX_SIZE; + return (0); } @@ -401,11 +416,11 @@ nfs_readdata(struct nfs_iodesc *d, off_t bcopy(d->fh, args->fh, NFS_FHSIZE); args->off = htonl((n_long)off); - if (len > NFSREAD_SIZE) - len = NFSREAD_SIZE; + if (len > nfs_read_size) + len = nfs_read_size; args->len = htonl((n_long)len); args->xxx = htonl((n_long)0); - hlen = sizeof(*repl) - NFSREAD_SIZE; + hlen = offsetof(struct nfs_read_rpl, data[0]); cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READ, args, sizeof(*args), @@ -1022,7 +1037,7 @@ nfs_readdata(struct nfs_iodesc *d, off_t uint32_t count; uint32_t eof; uint32_t len; - u_char data[NFSREAD_SIZE]; + u_char data[NFSREAD_MAX_SIZE]; } *repl; struct { uint32_t h[RPC_HEADER_WORDS]; @@ -1045,10 +1060,10 @@ nfs_readdata(struct nfs_iodesc *d, off_t pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t); args->fhoffcnt[pos++] = 0; args->fhoffcnt[pos++] = htonl((uint32_t)off); - if (len > NFSREAD_SIZE) - len = NFSREAD_SIZE; + if (len > nfs_read_size) + len = nfs_read_size; args->fhoffcnt[pos] = htonl((uint32_t)len); - hlen = sizeof(*repl) - NFSREAD_SIZE; + hlen = offsetof(struct repl, data[0]); cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READ, args, 4 * sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)), Modified: stable/11/sys/boot/i386/pxeldr/pxeboot.8 ============================================================================== --- stable/11/sys/boot/i386/pxeldr/pxeboot.8 Mon Oct 17 08:25:47 2016 (r307504) +++ stable/11/sys/boot/i386/pxeldr/pxeboot.8 Mon Oct 17 08:27:18 2016 (r307505) @@ -85,6 +85,14 @@ expects to fetch .Pa /boot/loader.rc from the specified server before loading any other files. .Pp +.Nm +defaults to a conservative 1024 byte NFS data packet size. +This may be changed by setting the +.Va nfs.read_size +variable in +.Pa /boot/loader.conf . +Valid values range from 1024 to 4096 bytes. +.Pp In all other respects, .Nm acts just like From owner-svn-src-all@freebsd.org Mon Oct 17 08:29:17 2016 Return-Path: Delivered-To: svn-src-all@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 824C2C14436; Mon, 17 Oct 2016 08:29:17 +0000 (UTC) (envelope-from sephe@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 4703415C7; Mon, 17 Oct 2016 08:29:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8TGQ1033534; Mon, 17 Oct 2016 08:29:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8TGJw033533; Mon, 17 Oct 2016 08:29:16 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170829.u9H8TGJw033533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:29: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: r307506 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:29:17 -0000 Author: sephe Date: Mon Oct 17 08:29:16 2016 New Revision: 307506 URL: https://svnweb.freebsd.org/changeset/base/307506 Log: MFC 305722 x86: Use sx lock for interrupt sources. - Certain pic_assign_cpu, e.g. msi_assign_cpu can have quite a long call chain. For msi_assign_cpu, mutex makes complex PCI bridge drivers more tricky, e.g. sleep can note be called, etc, it will be pretty tricky for upcoming Hyper-V PCI bridge driver for PCI pass-through. - It is not used on any hot code path nor non-sleepable context, so sx should have the same effect as mutex. PIC list is still protected by mutex to keep suspend/resume work. Discussed with: jhb Reviewed by: jhb Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7784 Modified: stable/11/sys/x86/x86/intr_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/intr_machdep.c ============================================================================== --- stable/11/sys/x86/x86/intr_machdep.c Mon Oct 17 08:27:18 2016 (r307505) +++ stable/11/sys/x86/x86/intr_machdep.c Mon Oct 17 08:29:16 2016 (r307506) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -73,7 +74,8 @@ typedef void (*mask_fn)(void *); static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; -static struct mtx intr_table_lock; +static struct sx intrsrc_lock; +static struct mtx intrpic_lock; static struct mtx intrcnt_lock; static TAILQ_HEAD(pics_head, pic) pics; @@ -117,14 +119,14 @@ intr_register_pic(struct pic *pic) { int error; - mtx_lock(&intr_table_lock); + mtx_lock(&intrpic_lock); if (intr_pic_registered(pic)) error = EBUSY; else { TAILQ_INSERT_TAIL(&pics, pic, pics); error = 0; } - mtx_unlock(&intr_table_lock); + mtx_unlock(&intrpic_lock); return (error); } @@ -148,16 +150,16 @@ intr_register_source(struct intsrc *isrc vector); if (error) return (error); - mtx_lock(&intr_table_lock); + sx_xlock(&intrsrc_lock); if (interrupt_sources[vector] != NULL) { - mtx_unlock(&intr_table_lock); + sx_xunlock(&intrsrc_lock); intr_event_destroy(isrc->is_event); return (EEXIST); } intrcnt_register(isrc); interrupt_sources[vector] = isrc; isrc->is_handlers = 0; - mtx_unlock(&intr_table_lock); + sx_xunlock(&intrsrc_lock); return (0); } @@ -181,14 +183,14 @@ intr_add_handler(const char *name, int v error = intr_event_add_handler(isrc->is_event, name, filter, handler, arg, intr_priority(flags), flags, cookiep); if (error == 0) { - mtx_lock(&intr_table_lock); + sx_xlock(&intrsrc_lock); intrcnt_updatename(isrc); isrc->is_handlers++; if (isrc->is_handlers == 1) { isrc->is_pic->pic_enable_intr(isrc); isrc->is_pic->pic_enable_source(isrc); } - mtx_unlock(&intr_table_lock); + sx_xunlock(&intrsrc_lock); } return (error); } @@ -202,14 +204,14 @@ intr_remove_handler(void *cookie) isrc = intr_handler_source(cookie); error = intr_event_remove_handler(cookie); if (error == 0) { - mtx_lock(&intr_table_lock); + sx_xlock(&intrsrc_lock); isrc->is_handlers--; if (isrc->is_handlers == 0) { isrc->is_pic->pic_disable_source(isrc, PIC_NO_EOI); isrc->is_pic->pic_disable_intr(isrc); } intrcnt_updatename(isrc); - mtx_unlock(&intr_table_lock); + sx_xunlock(&intrsrc_lock); } return (error); } @@ -283,12 +285,12 @@ intr_resume(bool suspend_cancelled) #ifndef DEV_ATPIC atpic_reset(); #endif - mtx_lock(&intr_table_lock); + mtx_lock(&intrpic_lock); TAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_resume != NULL) pic->pic_resume(pic, suspend_cancelled); } - mtx_unlock(&intr_table_lock); + mtx_unlock(&intrpic_lock); } void @@ -296,12 +298,12 @@ intr_suspend(void) { struct pic *pic; - mtx_lock(&intr_table_lock); + mtx_lock(&intrpic_lock); TAILQ_FOREACH_REVERSE(pic, &pics, pics_head, pics) { if (pic->pic_suspend != NULL) pic->pic_suspend(pic); } - mtx_unlock(&intr_table_lock); + mtx_unlock(&intrpic_lock); } static int @@ -322,9 +324,9 @@ intr_assign_cpu(void *arg, int cpu) if (assign_cpu && cpu != NOCPU) { #endif isrc = arg; - mtx_lock(&intr_table_lock); + sx_xlock(&intrsrc_lock); error = isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[cpu]); - mtx_unlock(&intr_table_lock); + sx_xunlock(&intrsrc_lock); } else error = 0; return (error); @@ -384,7 +386,8 @@ intr_init(void *dummy __unused) intrcnt_setname("???", 0); intrcnt_index = 1; TAILQ_INIT(&pics); - mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF); + mtx_init(&intrpic_lock, "intrpic", NULL, MTX_DEF); + sx_init(&intrsrc_lock, "intrsrc"); mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); } SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL); @@ -449,7 +452,7 @@ intr_reprogram(void) struct intsrc *is; int v; - mtx_lock(&intr_table_lock); + sx_xlock(&intrsrc_lock); for (v = 0; v < NUM_IO_INTS; v++) { is = interrupt_sources[v]; if (is == NULL) @@ -457,7 +460,7 @@ intr_reprogram(void) if (is->is_pic->pic_reprogram_pin != NULL) is->is_pic->pic_reprogram_pin(is); } - mtx_unlock(&intr_table_lock); + sx_xunlock(&intrsrc_lock); } #ifdef DDB @@ -562,7 +565,7 @@ intr_shuffle_irqs(void *arg __unused) return; /* Round-robin assign a CPU to each enabled source. */ - mtx_lock(&intr_table_lock); + sx_xlock(&intrsrc_lock); assign_cpu = 1; for (i = 0; i < NUM_IO_INTS; i++) { isrc = interrupt_sources[i]; @@ -583,7 +586,7 @@ intr_shuffle_irqs(void *arg __unused) } } - mtx_unlock(&intr_table_lock); + sx_xunlock(&intrsrc_lock); } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); From owner-svn-src-all@freebsd.org Mon Oct 17 08:35:58 2016 Return-Path: Delivered-To: svn-src-all@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 55B56C14747; Mon, 17 Oct 2016 08:35:58 +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 1F8321B36; Mon, 17 Oct 2016 08:35:58 +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 u9H8ZvqR037191; Mon, 17 Oct 2016 08:35:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8ZvQi037190; Mon, 17 Oct 2016 08:35:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610170835.u9H8ZvQi037190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 17 Oct 2016 08:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307507 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:35:58 -0000 Author: mav Date: Mon Oct 17 08:35:56 2016 New Revision: 307507 URL: https://svnweb.freebsd.org/changeset/base/307507 Log: Consider device as clean even if SYNCHRONIZE CACHE failed. If device reservation was preempted by other initiator, our sync request will always fail. Without this change CAM tried to sync cache on every following device close, including numerous GEOM tasting opens/closes, causing lots of useless noise in logs. While there, increase SYNCHRONIZE CACHE timeout to default value. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Oct 17 08:29:16 2016 (r307506) +++ head/sys/cam/scsi/scsi_da.c Mon Oct 17 08:35:56 2016 (r307507) @@ -1488,12 +1488,11 @@ daclose(struct disk *dp) scsi_synchronize_cache(&ccb->csio, /*retries*/1, /*cbfcnp*/dadone, MSG_SIMPLE_Q_TAG, /*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE, - 5 * 60 * 1000); + da_default_timeout * 1000); error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0, /*sense_flags*/SF_RETRY_UA | SF_QUIET_IR, softc->disk->d_devstat); - if (error == 0) - softc->flags &= ~DA_FLAG_DIRTY; + softc->flags &= ~DA_FLAG_DIRTY; xpt_release_ccb(ccb); } From owner-svn-src-all@freebsd.org Mon Oct 17 08:37:21 2016 Return-Path: Delivered-To: svn-src-all@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 47A49C14822; Mon, 17 Oct 2016 08:37:21 +0000 (UTC) (envelope-from sephe@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 0FC321D2E; Mon, 17 Oct 2016 08:37:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8bK3x037303; Mon, 17 Oct 2016 08:37:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8bJTZ037297; Mon, 17 Oct 2016 08:37:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170837.u9H8bJTZ037297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:37: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: r307508 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:37:21 -0000 Author: sephe Date: Mon Oct 17 08:37:19 2016 New Revision: 307508 URL: https://svnweb.freebsd.org/changeset/base/307508 Log: MFC 305724,305725,305727-305730,305760,305761,305763,305788 305724 hyperv/hn: Rename RXBUF connect/disconnect functions. Minor cleanup and wording in error messages. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7823 305725 hyperv/hn: Rename chimney sending buffer connect/disconnect functions. Minor cleanup and wording in error messages. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7825 305727 hyperv/hn: Function rename. - Minor style changes. - Nuke unnecessary indirection. - Nuke unapplied comment. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7827 305728 hyperv/hn: Reorganize sub-channel allocation. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7829 305729 hyperv/hn: Reorganize RNDIS attach Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7830 305730 hyperv/hn: Pull ether address and link status extraction up. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7831 305760 hyperv/hn: Reorganize channel attach/detach code. This paves the way for further attach/detach code reorganization. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7858 305761 hyperv/hn: Regroup synthetic parts attach code. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7859 305763 hyperv/hn: Reorganize synthetic parts attach code. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7860 305788 hyperv/hn: Pull RSS key and indirect table setup up. This paves the way for the dynamic RSS key and indirect table setting. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7864 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:35:56 2016 (r307507) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:37:19 2016 (r307508) @@ -57,11 +57,10 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper /* * Forward declarations */ -static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); -static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); -static int hv_nv_destroy_send_buffer(struct hn_softc *sc); -static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); -static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu); +static int hn_nvs_conn_chim(struct hn_softc *sc); +static int hn_nvs_conn_rxbuf(struct hn_softc *); +static int hn_nvs_disconn_chim(struct hn_softc *sc); +static int hn_nvs_disconn_rxbuf(struct hn_softc *sc); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct hn_softc *, struct vmbus_channel *chan, const void *, int); @@ -103,7 +102,7 @@ hn_chim_alloc(struct hn_softc *sc) return (ret); } -const void * +static const void * hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact, void *req, int reqlen, size_t *resplen0, uint32_t type) { @@ -154,14 +153,8 @@ hn_nvs_req_send(struct hn_softc *sc, voi req, reqlen, &hn_send_ctx_none)); } -/* - * Net VSC initialize receive buffer with net VSP - * - * Net VSP: Network virtual services client, also known as the - * Hyper-V extensible switch and the synthetic data path. - */ static int -hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) +hn_nvs_conn_rxbuf(struct hn_softc *sc) { struct vmbus_xact *xact = NULL; struct hn_nvs_rxbuf_conn *conn; @@ -188,7 +181,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct error = vmbus_chan_gpadl_connect(sc->hn_prichan, sc->hn_rxbuf_dma.hv_paddr, rxbuf_size, &sc->hn_rxbuf_gpadl); if (error) { - if_printf(sc->hn_ifp, "rxbuf gpadl connect failed: %d\n", + if_printf(sc->hn_ifp, "rxbuf gpadl conn failed: %d\n", error); goto cleanup; } @@ -212,7 +205,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct resp = hn_nvs_xact_execute(sc, xact, conn, sizeof(*conn), &resp_len, HN_NVS_TYPE_RXBUF_CONNRESP); if (resp == NULL) { - if_printf(sc->hn_ifp, "exec rxbuf conn failed\n"); + if_printf(sc->hn_ifp, "exec nvs rxbuf conn failed\n"); error = EIO; goto cleanup; } @@ -222,7 +215,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct xact = NULL; if (status != HN_NVS_STATUS_OK) { - if_printf(sc->hn_ifp, "rxbuf conn failed: %x\n", status); + if_printf(sc->hn_ifp, "nvs rxbuf conn failed: %x\n", status); error = EIO; goto cleanup; } @@ -233,15 +226,12 @@ hv_nv_init_rx_buffer_with_net_vsp(struct cleanup: if (xact != NULL) vmbus_xact_put(xact); - hv_nv_destroy_rx_buffer(sc); + hn_nvs_disconn_rxbuf(sc); return (error); } -/* - * Net VSC initialize send buffer with net VSP - */ static int -hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc) +hn_nvs_conn_chim(struct hn_softc *sc) { struct vmbus_xact *xact = NULL; struct hn_nvs_chim_conn *chim; @@ -261,8 +251,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru sc->hn_chim_dma.hv_paddr, NETVSC_SEND_BUFFER_SIZE, &sc->hn_chim_gpadl); if (error) { - if_printf(sc->hn_ifp, "chimney sending buffer gpadl " - "connect failed: %d\n", error); + if_printf(sc->hn_ifp, "chim gpadl conn failed: %d\n", error); goto cleanup; } @@ -285,7 +274,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru resp = hn_nvs_xact_execute(sc, xact, chim, sizeof(*chim), &resp_len, HN_NVS_TYPE_CHIM_CONNRESP); if (resp == NULL) { - if_printf(sc->hn_ifp, "exec chim conn failed\n"); + if_printf(sc->hn_ifp, "exec nvs chim conn failed\n"); error = EIO; goto cleanup; } @@ -296,14 +285,14 @@ hv_nv_init_send_buffer_with_net_vsp(stru xact = NULL; if (status != HN_NVS_STATUS_OK) { - if_printf(sc->hn_ifp, "chim conn failed: %x\n", status); + if_printf(sc->hn_ifp, "nvs chim conn failed: %x\n", status); error = EIO; goto cleanup; } if (sectsz == 0) { if_printf(sc->hn_ifp, "zero chimney sending buffer " "section size\n"); - return 0; + return (0); } sc->hn_chim_szmax = sectsz; @@ -327,22 +316,19 @@ hv_nv_init_send_buffer_with_net_vsp(stru if_printf(sc->hn_ifp, "chimney sending buffer %d/%d\n", sc->hn_chim_szmax, sc->hn_chim_cnt); } - return 0; + return (0); cleanup: if (xact != NULL) vmbus_xact_put(xact); - hv_nv_destroy_send_buffer(sc); + hn_nvs_disconn_chim(sc); return (error); } -/* - * Net VSC destroy receive buffer - */ static int -hv_nv_destroy_rx_buffer(struct hn_softc *sc) +hn_nvs_disconn_rxbuf(struct hn_softc *sc) { - int ret = 0; + int error; if (sc->hn_flags & HN_FLAG_RXBUF_CONNECTED) { struct hn_nvs_rxbuf_disconn disconn; @@ -355,38 +341,35 @@ hv_nv_destroy_rx_buffer(struct hn_softc disconn.nvs_sig = HN_NVS_RXBUF_SIG; /* NOTE: No response. */ - ret = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); - if (ret != 0) { + error = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); + if (error) { if_printf(sc->hn_ifp, - "send rxbuf disconn failed: %d\n", ret); - return (ret); + "send nvs rxbuf disconn failed: %d\n", error); + return (error); } sc->hn_flags &= ~HN_FLAG_RXBUF_CONNECTED; } - + if (sc->hn_rxbuf_gpadl != 0) { /* * Disconnect RXBUF from primary channel. */ - ret = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, sc->hn_rxbuf_gpadl); - if (ret != 0) { + if (error) { if_printf(sc->hn_ifp, - "rxbuf disconn failed: %d\n", ret); - return (ret); + "rxbuf gpadl disconn failed: %d\n", error); + return (error); } sc->hn_rxbuf_gpadl = 0; } - return (ret); + return (0); } -/* - * Net VSC destroy send buffer - */ static int -hv_nv_destroy_send_buffer(struct hn_softc *sc) +hn_nvs_disconn_chim(struct hn_softc *sc) { - int ret = 0; + int error; if (sc->hn_flags & HN_FLAG_CHIM_CONNECTED) { struct hn_nvs_chim_disconn disconn; @@ -399,25 +382,25 @@ hv_nv_destroy_send_buffer(struct hn_soft disconn.nvs_sig = HN_NVS_CHIM_SIG; /* NOTE: No response. */ - ret = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); - if (ret != 0) { + error = hn_nvs_req_send(sc, &disconn, sizeof(disconn)); + if (error) { if_printf(sc->hn_ifp, - "send chim disconn failed: %d\n", ret); - return (ret); + "send nvs chim disconn failed: %d\n", error); + return (error); } sc->hn_flags &= ~HN_FLAG_CHIM_CONNECTED; } - + if (sc->hn_chim_gpadl != 0) { /* * Disconnect chimney sending buffer from primary channel. */ - ret = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, sc->hn_chim_gpadl); - if (ret != 0) { + if (error) { if_printf(sc->hn_ifp, - "chim disconn failed: %d\n", ret); - return (ret); + "chim gpadl disconn failed: %d\n", error); + return (error); } sc->hn_chim_gpadl = 0; } @@ -426,8 +409,7 @@ hv_nv_destroy_send_buffer(struct hn_soft free(sc->hn_chim_bmap, M_NETVSC); sc->hn_chim_bmap = NULL; } - - return (ret); + return (0); } static int @@ -538,38 +520,48 @@ hn_nvs_init(struct hn_softc *sc) return (ENXIO); } -static int -hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu) +int +hn_nvs_attach(struct hn_softc *sc, int mtu) { - int ret; + int error; /* * Initialize NVS. */ - ret = hn_nvs_init(sc); - if (ret != 0) - return (ret); + error = hn_nvs_init(sc); + if (error) + return (error); if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) { /* * Configure NDIS before initializing it. */ - ret = hn_nvs_conf_ndis(sc, mtu); - if (ret != 0) - return (ret); + error = hn_nvs_conf_ndis(sc, mtu); + if (error) + return (error); } /* * Initialize NDIS. */ - ret = hn_nvs_init_ndis(sc); - if (ret != 0) - return (ret); - - ret = hv_nv_init_rx_buffer_with_net_vsp(sc); - if (ret == 0) - ret = hv_nv_init_send_buffer_with_net_vsp(sc); - return (ret); + error = hn_nvs_init_ndis(sc); + if (error) + return (error); + + /* + * Connect RXBUF. + */ + error = hn_nvs_conn_rxbuf(sc); + if (error) + return (error); + + /* + * Connect chimney sending buffer. + */ + error = hn_nvs_conn_chim(sc); + if (error) + return (error); + return (0); } /* @@ -578,23 +570,8 @@ hv_nv_connect_to_vsp(struct hn_softc *sc static void hv_nv_disconnect_from_vsp(struct hn_softc *sc) { - hv_nv_destroy_rx_buffer(sc); - hv_nv_destroy_send_buffer(sc); -} - -/* - * Net VSC on device add - * - * Callback when the device belonging to this driver is added - */ -int -hv_nv_on_device_add(struct hn_softc *sc, int mtu) -{ - - /* - * Connect with the NetVsp - */ - return (hv_nv_connect_to_vsp(sc, mtu)); + hn_nvs_disconn_rxbuf(sc); + hn_nvs_disconn_chim(sc); } /* @@ -605,11 +582,6 @@ hv_nv_on_device_remove(struct hn_softc * { hv_nv_disconnect_from_vsp(sc); - - /* Now, we can close the channel safely */ - - vmbus_chan_close(sc->hn_prichan); - return (0); } @@ -676,3 +648,54 @@ hv_nv_on_send(struct vmbus_channel *chan return (ret); } + +int +hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0) +{ + struct vmbus_xact *xact; + struct hn_nvs_subch_req *req; + const struct hn_nvs_subch_resp *resp; + int error, nsubch_req; + uint32_t nsubch; + size_t resp_len; + + nsubch_req = *nsubch0; + KASSERT(nsubch_req > 0, ("invalid # of sub-channels %d", nsubch_req)); + + xact = vmbus_xact_get(sc->hn_xact, sizeof(*req)); + if (xact == NULL) { + if_printf(sc->hn_ifp, "no xact for nvs subch alloc\n"); + return (ENXIO); + } + req = vmbus_xact_req_data(xact); + req->nvs_type = HN_NVS_TYPE_SUBCH_REQ; + req->nvs_op = HN_NVS_SUBCH_OP_ALLOC; + req->nvs_nsubch = nsubch_req; + + resp_len = sizeof(*resp); + resp = hn_nvs_xact_execute(sc, xact, req, sizeof(*req), &resp_len, + HN_NVS_TYPE_SUBCH_RESP); + if (resp == NULL) { + if_printf(sc->hn_ifp, "exec nvs subch alloc failed\n"); + error = EIO; + goto done; + } + if (resp->nvs_status != HN_NVS_STATUS_OK) { + if_printf(sc->hn_ifp, "nvs subch alloc failed: %x\n", + resp->nvs_status); + error = EIO; + goto done; + } + + nsubch = resp->nvs_nsubch; + if (nsubch > nsubch_req) { + if_printf(sc->hn_ifp, "%u subchans are allocated, " + "requested %d\n", nsubch, nsubch_req); + nsubch = nsubch_req; + } + *nsubch0 = nsubch; + error = 0; +done: + vmbus_xact_put(xact); + return (error); +} Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:35:56 2016 (r307507) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:37:19 2016 (r307508) @@ -99,11 +99,6 @@ struct vmbus_channel; #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) #define NETVSC_PACKET_MAXPAGE 32 -typedef struct { - uint8_t mac_addr[ETHER_ADDR_LEN]; - uint32_t link_state; -} netvsc_device_info; - #define HN_XACT_REQ_PGCNT 2 #define HN_XACT_RESP_PGCNT 2 #define HN_XACT_REQ_SIZE (HN_XACT_REQ_PGCNT * PAGE_SIZE) @@ -261,7 +256,7 @@ extern int hv_promisc_mode; struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); -int hv_nv_on_device_add(struct hn_softc *sc, int mtu); +int hn_nvs_attach(struct hn_softc *sc, int mtu); int hv_nv_on_device_remove(struct hn_softc *sc); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:35:56 2016 (r307507) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:37:19 2016 (r307508) @@ -345,8 +345,12 @@ static int hn_create_rx_data(struct hn_s static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_chim_size(struct hn_softc *, int); static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); +static void hn_chan_detach(struct hn_softc *, struct vmbus_channel *); static int hn_attach_subchans(struct hn_softc *); +static void hn_detach_allchans(struct hn_softc *); static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr); +static void hn_set_ring_inuse(struct hn_softc *, int); +static int hn_synth_attach(struct hn_softc *, int); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -364,6 +368,14 @@ static void hn_xmit_txeof(struct hn_tx_r static void hn_xmit_taskfunc(void *, int); static void hn_xmit_txeof_taskfunc(void *, int); +static const uint8_t hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { + 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, + 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, + 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, + 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, + 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa +}; + #if __FreeBSD_version >= 1100099 static void hn_set_lro_lenlim(struct hn_softc *sc, int lenlim) @@ -440,7 +452,8 @@ netvsc_attach(device_t dev) { struct sysctl_oid_list *child; struct sysctl_ctx_list *ctx; - netvsc_device_info device_info; + uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t link_status; hn_softc_t *sc; int unit = device_get_unit(dev); struct ifnet *ifp = NULL; @@ -519,9 +532,17 @@ netvsc_attach(device_t dev) goto failed; /* - * Associate the first TX/RX ring w/ the primary channel. + * Create transaction context for NVS and RNDIS transactions. */ - error = hn_chan_attach(sc, sc->hn_prichan); + sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), + HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); + if (sc->hn_xact == NULL) + goto failed; + + /* + * Attach the synthetic parts, i.e. NVS and RNDIS. + */ + error = hn_synth_attach(sc, ETHERMTU); if (error) goto failed; @@ -559,34 +580,6 @@ netvsc_attach(device_t dev) IFCAP_LRO; ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; - sc->hn_xact = vmbus_xact_ctx_create(bus_get_dma_tag(dev), - HN_XACT_REQ_SIZE, HN_XACT_RESP_SIZE, 0); - if (sc->hn_xact == NULL) - goto failed; - - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, ETHERMTU); - if (error) - goto failed; - KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, - ("invalid channel count %d, should be less than %d", - ring_cnt, sc->hn_rx_ring_inuse)); - - /* - * Set the # of TX/RX rings that could be used according to - * the # of channels that host offered. - */ - if (sc->hn_tx_ring_inuse > ring_cnt) - sc->hn_tx_ring_inuse = ring_cnt; - sc->hn_rx_ring_inuse = ring_cnt; - device_printf(dev, "%d TX ring, %d RX ring\n", - sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); - - if (sc->hn_rx_ring_inuse > 1) { - error = hn_attach_subchans(sc); - if (error) - goto failed; - } - #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { /* @@ -597,9 +590,11 @@ netvsc_attach(device_t dev) } #endif - if (device_info.link_state == NDIS_MEDIA_STATE_CONNECTED) { + error = hn_rndis_get_linkstatus(sc, &link_status); + if (error) + goto failed; + if (link_status == NDIS_MEDIA_STATE_CONNECTED) sc->hn_carrier = 1; - } #if __FreeBSD_version >= 1100045 tso_maxlen = hn_tso_maxlen; @@ -612,7 +607,10 @@ netvsc_attach(device_t dev) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); #endif - ether_ifattach(ifp, device_info.mac_addr); + error = hn_rndis_get_eaddr(sc, eaddr); + if (error) + goto failed; + ether_ifattach(ifp, eaddr); #if __FreeBSD_version >= 1100045 if_printf(ifp, "TSO: %u/%u/%u\n", ifp->if_hw_tsomax, @@ -663,6 +661,7 @@ netvsc_detach(device_t dev) */ hv_rf_on_device_remove(sc); + hn_detach_allchans(sc); hn_stop_tx_tasks(sc); @@ -1503,8 +1502,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, #ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; #endif - netvsc_device_info device_info; - int mask, error = 0, ring_cnt; + int mask, error = 0; int retry_cnt = 500; switch(cmd) { @@ -1575,43 +1573,16 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, break; } - /* Wait for subchannels to be destroyed */ - vmbus_subchan_drain(sc->hn_prichan); - - sc->hn_rx_ring[0].hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; - sc->hn_tx_ring[0].hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; - hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */ - - ring_cnt = sc->hn_rx_ring_inuse; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, - ifr->ifr_mtu); - if (error) { - NV_LOCK(sc); - sc->temp_unusable = FALSE; - NV_UNLOCK(sc); - break; - } - /* # of channels can _not_ be changed */ - KASSERT(sc->hn_rx_ring_inuse == ring_cnt, - ("RX ring count %d and channel count %u mismatch", - sc->hn_rx_ring_cnt, ring_cnt)); - if (sc->hn_rx_ring_inuse > 1) { - int r; + /* + * Detach all of the channels. + */ + hn_detach_allchans(sc); - /* - * Skip the rings on primary channel; they are - * handled by the hv_rf_on_device_add() above. - */ - for (r = 1; r < sc->hn_rx_ring_cnt; ++r) { - sc->hn_rx_ring[r].hn_rx_flags &= - ~HN_RX_FLAG_ATTACHED; - } - for (r = 1; r < sc->hn_tx_ring_cnt; ++r) { - sc->hn_tx_ring[r].hn_tx_flags &= - ~HN_TX_FLAG_ATTACHED; - } - hn_attach_subchans(sc); /* XXX check error */ - } + /* + * Attach the synthetic parts, i.e. NVS and RNDIS. + * XXX check error. + */ + hn_synth_attach(sc, ifr->ifr_mtu); if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); @@ -3018,6 +2989,42 @@ hn_chan_attach(struct hn_softc *sc, stru return (error); } +static void +hn_chan_detach(struct hn_softc *sc, struct vmbus_channel *chan) +{ + struct hn_rx_ring *rxr; + int idx; + + idx = vmbus_chan_subidx(chan); + + /* + * Link this channel to RX/TX ring. + */ + KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse, + ("invalid channel index %d, should > 0 && < %d", + idx, sc->hn_rx_ring_inuse)); + rxr = &sc->hn_rx_ring[idx]; + KASSERT((rxr->hn_rx_flags & HN_RX_FLAG_ATTACHED), + ("RX ring %d is not attached", idx)); + rxr->hn_rx_flags &= ~HN_RX_FLAG_ATTACHED; + + if (idx < sc->hn_tx_ring_inuse) { + struct hn_tx_ring *txr = &sc->hn_tx_ring[idx]; + + KASSERT((txr->hn_tx_flags & HN_TX_FLAG_ATTACHED), + ("TX ring %d is not attached attached", idx)); + txr->hn_tx_flags &= ~HN_TX_FLAG_ATTACHED; + } + + /* + * Close this channel. + * + * NOTE: + * Channel closing does _not_ destroy the target channel. + */ + vmbus_chan_close(chan); +} + static int hn_attach_subchans(struct hn_softc *sc) { @@ -3025,17 +3032,16 @@ hn_attach_subchans(struct hn_softc *sc) int subchan_cnt = sc->hn_rx_ring_inuse - 1; int i, error = 0; - /* Wait for sub-channels setup to complete. */ - subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); + if (subchan_cnt == 0) + return (0); /* Attach the sub-channels. */ + subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); for (i = 0; i < subchan_cnt; ++i) { error = hn_chan_attach(sc, subchans[i]); if (error) break; } - - /* Release the sub-channels */ vmbus_subchan_rel(subchans, subchan_cnt); if (error) { @@ -3050,6 +3056,202 @@ hn_attach_subchans(struct hn_softc *sc) } static void +hn_detach_allchans(struct hn_softc *sc) +{ + struct vmbus_channel **subchans; + int subchan_cnt = sc->hn_rx_ring_inuse - 1; + int i; + + if (subchan_cnt == 0) + goto back; + + /* Detach the sub-channels. */ + subchans = vmbus_subchan_get(sc->hn_prichan, subchan_cnt); + for (i = 0; i < subchan_cnt; ++i) + hn_chan_detach(sc, subchans[i]); + vmbus_subchan_rel(subchans, subchan_cnt); + +back: + /* + * Detach the primary channel, _after_ all sub-channels + * are detached. + */ + hn_chan_detach(sc, sc->hn_prichan); + + /* Wait for sub-channels to be destroyed, if any. */ + vmbus_subchan_drain(sc->hn_prichan); + +#ifdef INVARIANTS + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { + KASSERT((sc->hn_rx_ring[i].hn_rx_flags & + HN_RX_FLAG_ATTACHED) == 0, + ("%dth RX ring is still attached", i)); + } + for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { + KASSERT((sc->hn_tx_ring[i].hn_tx_flags & + HN_TX_FLAG_ATTACHED) == 0, + ("%dth TX ring is still attached", i)); + } +#endif +} + +static int +hn_synth_alloc_subchans(struct hn_softc *sc, int *nsubch) +{ + struct vmbus_channel **subchans; + int nchan, rxr_cnt, error; + + nchan = *nsubch + 1; + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) { + /* + * Either RSS is not supported, or multiple RX/TX rings + * are not requested. + */ + *nsubch = 0; + return (0); + } + + /* + * Get RSS capabilities, e.g. # of RX rings, and # of indirect + * table entries. + */ + error = hn_rndis_get_rsscaps(sc, &rxr_cnt); + if (error) { + /* No RSS; this is benign. */ + *nsubch = 0; + return (0); + } + if_printf(sc->hn_ifp, "RX rings offered %u, requested %d\n", + rxr_cnt, nchan); + + if (nchan > rxr_cnt) + nchan = rxr_cnt; + if (nchan == 1) { + if_printf(sc->hn_ifp, "only 1 channel is supported, no vRSS\n"); + *nsubch = 0; + return (0); + } + + /* + * Allocate sub-channels from NVS. + */ + *nsubch = nchan - 1; + error = hn_nvs_alloc_subchans(sc, nsubch); + if (error || *nsubch == 0) { + /* Failed to allocate sub-channels. */ + *nsubch = 0; + return (0); + } + + /* + * Wait for all sub-channels to become ready before moving on. + */ + subchans = vmbus_subchan_get(sc->hn_prichan, *nsubch); + vmbus_subchan_rel(subchans, *nsubch); + return (0); +} + +static int +hn_synth_attach(struct hn_softc *sc, int mtu) +{ + struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; + int error, nsubch, nchan, i; + + /* + * Attach the primary channel _before_ attaching NVS and RNDIS. + */ + error = hn_chan_attach(sc, sc->hn_prichan); + if (error) + return (error); + + /* + * Attach NVS. + */ + error = hn_nvs_attach(sc, mtu); + if (error) + return (error); + + /* + * Attach RNDIS _after_ NVS is attached. + */ + error = hn_rndis_attach(sc); + if (error) + return (error); + + /* + * Allocate sub-channels for multi-TX/RX rings. + * + * NOTE: + * The # of RX rings that can be used is equivalent to the # of + * channels to be requested. + */ + nsubch = sc->hn_rx_ring_cnt - 1; + error = hn_synth_alloc_subchans(sc, &nsubch); + if (error) + return (error); + + nchan = nsubch + 1; + if (nchan == 1) { + /* Only the primary channel can be used; done */ + goto back; + } + + /* + * Configure RSS key and indirect table _after_ all sub-channels + * are allocated. + */ + + /* Setup default RSS key. */ + memcpy(rss->rss_key, hn_rss_key_default, sizeof(rss->rss_key)); + + /* Setup default RSS indirect table. */ + /* TODO: Take ndis_rss_caps.ndis_nind into account. */ + for (i = 0; i < NDIS_HASH_INDCNT; ++i) + rss->rss_ind[i] = i % nchan; + + error = hn_rndis_conf_rss(sc); + if (error) { + /* + * Failed to configure RSS key or indirect table; only + * the primary channel can be used. + */ + nchan = 1; + } +back: + /* + * Set the # of TX/RX rings that could be used according to + * the # of channels that NVS offered. + */ + hn_set_ring_inuse(sc, nchan); + + /* + * Attach the sub-channels, if any. + */ + error = hn_attach_subchans(sc); + if (error) + return (error); + return (0); +} + +static void +hn_set_ring_inuse(struct hn_softc *sc, int ring_cnt) +{ + KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_cnt, + ("invalid ring count %d", ring_cnt)); + + if (sc->hn_tx_ring_cnt > ring_cnt) + sc->hn_tx_ring_inuse = ring_cnt; + else + sc->hn_tx_ring_inuse = sc->hn_tx_ring_cnt; + sc->hn_rx_ring_inuse = ring_cnt; + + if (bootverbose) { + if_printf(sc->hn_ifp, "%d TX ring, %d RX ring\n", + sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); + } +} + +static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { const struct hn_nvs_hdr *hdr; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:35:56 2016 (r307507) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 08:37:19 2016 (r307508) @@ -75,18 +75,12 @@ static void hv_rf_receive_indicate_statu const void *data, int dlen); static void hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen); -static int hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr); -static int hv_rf_query_device_link_status(struct hn_softc *sc, - uint32_t *link_status); -static int hv_rf_init_device(struct hn_softc *sc); static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0); static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen); static int hn_rndis_conf_offload(struct hn_softc *sc); -static int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt); -static int hn_rndis_conf_rss(struct hn_softc *sc, int nchan); static __inline uint32_t hn_rndis_rid(struct hn_softc *sc) @@ -480,11 +474,8 @@ hv_rf_on_receive(struct hn_softc *sc, st } } -/* - * RNDIS filter query device MAC address - */ -static int -hv_rf_query_device_mac(struct hn_softc *sc, uint8_t *eaddr) +int +hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr) { size_t eaddr_len; int error; @@ -501,11 +492,8 @@ hv_rf_query_device_mac(struct hn_softc * return (0); } -/* - * RNDIS filter query device link status - */ -static int -hv_rf_query_device_link_status(struct hn_softc *sc, uint32_t *link_status) +int +hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status) { size_t size; int error; @@ -522,14 +510,6 @@ hv_rf_query_device_link_status(struct hn return (0); } -static uint8_t netvsc_hash_key[NDIS_HASH_KEYSIZE_TOEPLITZ] = { - 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, - 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, - 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, - 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, - 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa -}; - static const void * hn_rndis_xact_exec1(struct hn_softc *sc, struct vmbus_xact *xact, size_t reqlen, struct hn_send_ctx *sndc, size_t *comp_len) @@ -721,7 +701,7 @@ done: return (error); } -static int +int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt) { struct ndis_rss_caps in, caps; @@ -856,12 +836,12 @@ hn_rndis_conf_offload(struct hn_softc *s return (error); } -static int -hn_rndis_conf_rss(struct hn_softc *sc, int nchan) +int +hn_rndis_conf_rss(struct hn_softc *sc) { struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; struct ndis_rss_params *prm = &rss->rss_params; - int i, error; + int error; /* * Only NDIS 6.30+ is supported. @@ -869,7 +849,12 @@ hn_rndis_conf_rss(struct hn_softc *sc, i KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); - memset(rss, 0, sizeof(*rss)); + /* + * NOTE: + * DO NOT whack rss_key and rss_ind, which are setup by the caller. + */ + memset(prm, 0, sizeof(*prm)); + prm->ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_PARAMS; prm->ndis_hdr.ndis_rev = NDIS_RSS_PARAMS_REV_2; prm->ndis_hdr.ndis_size = sizeof(*rss); @@ -884,14 +869,6 @@ hn_rndis_conf_rss(struct hn_softc *sc, i prm->ndis_keyoffset = __offsetof(struct ndis_rssprm_toeplitz, rss_key[0]); - /* Setup RSS key */ - memcpy(rss->rss_key, netvsc_hash_key, sizeof(rss->rss_key)); - - /* Setup RSS indirect table */ - /* TODO: Take ndis_rss_caps.ndis_nind into account */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 08:38:26 2016 Return-Path: Delivered-To: svn-src-all@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 14C3AC148EF; Mon, 17 Oct 2016 08:38:26 +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 DB1F11F8B; Mon, 17 Oct 2016 08:38:25 +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 u9H8cPKA037519; Mon, 17 Oct 2016 08:38:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8cPYl037518; Mon, 17 Oct 2016 08:38:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610170838.u9H8cPYl037518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 17 Oct 2016 08:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307509 - head/sys/cam/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:38:26 -0000 Author: mav Date: Mon Oct 17 08:38:24 2016 New Revision: 307509 URL: https://svnweb.freebsd.org/changeset/base/307509 Log: Replicate r307507 for ATA disks. MFC after: 2 weeks Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon Oct 17 08:37:19 2016 (r307508) +++ head/sys/cam/ata/ata_da.c Mon Oct 17 08:38:24 2016 (r307509) @@ -926,8 +926,7 @@ adaclose(struct disk *dp) if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); - else - softc->flags &= ~ADA_FLAG_DIRTY; + softc->flags &= ~ADA_FLAG_DIRTY; xpt_release_ccb(ccb); cam_periph_unhold(periph); } From owner-svn-src-all@freebsd.org Mon Oct 17 08:39:18 2016 Return-Path: Delivered-To: svn-src-all@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 50100C14959; Mon, 17 Oct 2016 08:39:18 +0000 (UTC) (envelope-from sephe@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 1E0411111; Mon, 17 Oct 2016 08:39:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8dHrq037592; Mon, 17 Oct 2016 08:39:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8dHMU037591; Mon, 17 Oct 2016 08:39:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170839.u9H8dHMU037591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:39:17 +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: r307510 - stable/11/sys/dev/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:39:18 -0000 Author: sephe Date: Mon Oct 17 08:39:17 2016 New Revision: 307510 URL: https://svnweb.freebsd.org/changeset/base/307510 Log: MFC 305789 hyperv/vmbus: Make sure that the sub-channel count is valid. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7865 Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 08:38:24 2016 (r307509) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Oct 17 08:39:17 2016 (r307510) @@ -1346,6 +1346,8 @@ vmbus_subchan_get(struct vmbus_channel * struct vmbus_channel **ret, *chan; int i; + KASSERT(subchan_cnt > 0, ("invalid sub-channel count %d", subchan_cnt)); + ret = malloc(subchan_cnt * sizeof(struct vmbus_channel *), M_TEMP, M_WAITOK); From owner-svn-src-all@freebsd.org Mon Oct 17 08:42:55 2016 Return-Path: Delivered-To: svn-src-all@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 927B4C14B52; Mon, 17 Oct 2016 08:42:55 +0000 (UTC) (envelope-from sephe@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 6A58B1595; Mon, 17 Oct 2016 08:42:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8gsmH041083; Mon, 17 Oct 2016 08:42:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8gsNk041081; Mon, 17 Oct 2016 08:42:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170842.u9H8gsNk041081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:42:54 +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: r307511 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:42:55 -0000 Author: sephe Date: Mon Oct 17 08:42:54 2016 New Revision: 307511 URL: https://svnweb.freebsd.org/changeset/base/307511 Log: MFC 305790-305793 305790 hyperv/hn: Remove unused softc field Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7866 305791 hyperv/hn: Deprecate hn_softc_t Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7867 305792 hyperv/hn: Function renaming: hn_ifinit -> hn_init No functional changes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7868 305793 hyperv/hn: Cleanup hn_ioctl. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7869 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:39:17 2016 (r307510) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:42:54 2016 (r307511) @@ -198,11 +198,10 @@ struct hn_tx_ring { /* * Device-specific softc structure */ -typedef struct hn_softc { +struct hn_softc { struct ifnet *hn_ifp; struct ifmedia hn_media; device_t hn_dev; - uint8_t hn_unit; int hn_carrier; int hn_if_flags; struct mtx hn_lock; @@ -244,7 +243,7 @@ typedef struct hn_softc { uint32_t hn_ndis_ver; struct ndis_rssprm_toeplitz hn_rss; -} hn_softc_t; +}; #define HN_FLAG_RXBUF_CONNECTED 0x0001 #define HN_FLAG_CHIM_CONNECTED 0x0002 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:39:17 2016 (r307510) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:42:54 2016 (r307511) @@ -312,9 +312,9 @@ static u_int hn_cpu_index; /* * Forward declarations */ -static void hn_stop(hn_softc_t *sc); -static void hn_ifinit_locked(hn_softc_t *sc); -static void hn_ifinit(void *xsc); +static void hn_stop(struct hn_softc *sc); +static void hn_init_locked(struct hn_softc *sc); +static void hn_init(void *xsc); static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static int hn_start_locked(struct hn_tx_ring *txr, int len); static void hn_start(struct ifnet *ifp); @@ -450,21 +450,17 @@ netvsc_probe(device_t dev) static int netvsc_attach(device_t dev) { + struct hn_softc *sc = device_get_softc(dev); struct sysctl_oid_list *child; struct sysctl_ctx_list *ctx; uint8_t eaddr[ETHER_ADDR_LEN]; uint32_t link_status; - hn_softc_t *sc; - int unit = device_get_unit(dev); struct ifnet *ifp = NULL; int error, ring_cnt, tx_ring_cnt; #if __FreeBSD_version >= 1100045 int tso_maxlen; #endif - sc = device_get_softc(dev); - - sc->hn_unit = unit; sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); @@ -548,7 +544,7 @@ netvsc_attach(device_t dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; - ifp->if_init = hn_ifinit; + ifp->if_init = hn_init; ifp->if_mtu = ETHERMTU; if (hn_use_if_start) { int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); @@ -1497,29 +1493,13 @@ skip: static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - hn_softc_t *sc = ifp->if_softc; + struct hn_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; -#ifdef INET - struct ifaddr *ifa = (struct ifaddr *)data; -#endif int mask, error = 0; int retry_cnt = 500; - switch(cmd) { - - case SIOCSIFADDR: -#ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - hn_ifinit(sc); - arp_ifinit(ifp, ifa); - } else -#endif - error = ether_ioctl(ifp, cmd, data); - break; + switch (cmd) { case SIOCSIFMTU: - /* Check MTU value change */ if (ifp->if_mtu == ifr->ifr_mtu) break; @@ -1587,12 +1567,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_ifinit_locked(sc); + hn_init_locked(sc); NV_LOCK(sc); sc->temp_unusable = FALSE; NV_UNLOCK(sc); break; + case SIOCSIFFLAGS: do { NV_LOCK(sc); @@ -1633,7 +1614,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, /* do something here for Hyper-V */ } else #endif - hn_ifinit_locked(sc); + hn_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { hn_stop(sc); @@ -1643,8 +1624,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, sc->temp_unusable = FALSE; NV_UNLOCK(sc); sc->hn_if_flags = ifp->if_flags; - error = 0; break; + case SIOCSIFCAP: NV_LOCK(sc); @@ -1683,38 +1664,32 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, } NV_UNLOCK(sc); - error = 0; break; + case SIOCADDMULTI: case SIOCDELMULTI: -#ifdef notyet - /* Fixme: Multicast mode? */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - NV_LOCK(sc); - netvsc_setmulti(sc); - NV_UNLOCK(sc); - error = 0; - } -#endif - error = EINVAL; + /* Always all-multi */ + /* + * TODO: + * Enable/disable all-multi according to the emptiness of + * the mcast address list. + */ break; + case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); break; + default: error = ether_ioctl(ifp, cmd, data); break; } - return (error); } -/* - * - */ static void -hn_stop(hn_softc_t *sc) +hn_stop(struct hn_softc *sc) { struct ifnet *ifp; int ret, i; @@ -1793,11 +1768,8 @@ do_sched: } } -/* - * - */ static void -hn_ifinit_locked(hn_softc_t *sc) +hn_init_locked(struct hn_softc *sc) { struct ifnet *ifp; int ret, i; @@ -1829,9 +1801,9 @@ hn_ifinit_locked(hn_softc_t *sc) * */ static void -hn_ifinit(void *xsc) +hn_init(void *xsc) { - hn_softc_t *sc = xsc; + struct hn_softc *sc = xsc; NV_LOCK(sc); if (sc->temp_unusable) { @@ -1841,7 +1813,7 @@ hn_ifinit(void *xsc) sc->temp_unusable = TRUE; NV_UNLOCK(sc); - hn_ifinit_locked(sc); + hn_init_locked(sc); NV_LOCK(sc); sc->temp_unusable = FALSE; @@ -1855,11 +1827,9 @@ hn_ifinit(void *xsc) static void hn_watchdog(struct ifnet *ifp) { - hn_softc_t *sc; - sc = ifp->if_softc; - printf("hn%d: watchdog timeout -- resetting\n", sc->hn_unit); - hn_ifinit(sc); /*???*/ + if_printf(ifp, "watchdog timeout -- resetting\n"); + hn_init(ifp->if_softc); /* XXX */ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } #endif @@ -3489,7 +3459,7 @@ static device_method_t netvsc_methods[] static driver_t netvsc_driver = { NETVSC_DEVNAME, netvsc_methods, - sizeof(hn_softc_t) + sizeof(struct hn_softc) }; static devclass_t netvsc_devclass; From owner-svn-src-all@freebsd.org Mon Oct 17 08:45:00 2016 Return-Path: Delivered-To: svn-src-all@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 BC2BAC14BEA; Mon, 17 Oct 2016 08:45:00 +0000 (UTC) (envelope-from sephe@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 99191172E; Mon, 17 Oct 2016 08:45:00 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8ixw0041220; Mon, 17 Oct 2016 08:44:59 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8ixG1041218; Mon, 17 Oct 2016 08:44:59 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170844.u9H8ixG1041218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:44: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: r307512 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:45:00 -0000 Author: sephe Date: Mon Oct 17 08:44:59 2016 New Revision: 307512 URL: https://svnweb.freebsd.org/changeset/base/307512 Log: MFC 305794 hyperv/hn: Use sx for the main lock. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7870 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:42:54 2016 (r307511) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Mon Oct 17 08:44:59 2016 (r307512) @@ -204,10 +204,7 @@ struct hn_softc { device_t hn_dev; int hn_carrier; int hn_if_flags; - struct mtx hn_lock; - int hn_initdone; - /* See hv_netvsc_drv_freebsd.c for rules on how to use */ - int temp_unusable; + struct sx hn_lock; struct vmbus_channel *hn_prichan; int hn_rx_ring_cnt; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:42:54 2016 (r307511) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:44:59 2016 (r307512) @@ -195,21 +195,12 @@ struct hn_txdesc { #define HN_LRO_ACKCNT_DEF 1 -/* - * Be aware that this sleepable mutex will exhibit WITNESS errors when - * certain TCP and ARP code paths are taken. This appears to be a - * well-known condition, as all other drivers checked use a sleeping - * mutex to protect their transmit paths. - * Also Be aware that mutexes do not play well with semaphores, and there - * is a conflicting semaphore in a certain channel code path. - */ -#define NV_LOCK_INIT(_sc, _name) \ - mtx_init(&(_sc)->hn_lock, _name, MTX_NETWORK_LOCK, MTX_DEF) -#define NV_LOCK(_sc) mtx_lock(&(_sc)->hn_lock) -#define NV_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->hn_lock, MA_OWNED) -#define NV_UNLOCK(_sc) mtx_unlock(&(_sc)->hn_lock) -#define NV_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->hn_lock) - +#define HN_LOCK_INIT(sc) \ + sx_init(&(sc)->hn_lock, device_get_nameunit((sc)->hn_dev)) +#define HN_LOCK_ASSERT(sc) sx_assert(&(sc)->hn_lock, SA_XLOCKED) +#define HN_LOCK_DESTROY(sc) sx_destroy(&(sc)->hn_lock) +#define HN_LOCK(sc) sx_xlock(&(sc)->hn_lock) +#define HN_UNLOCK(sc) sx_xunlock(&(sc)->hn_lock) /* * Globals @@ -463,6 +454,7 @@ netvsc_attach(device_t dev) sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); + HN_LOCK_INIT(sc); if (hn_tx_taskq == NULL) { sc->hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK, @@ -484,7 +476,6 @@ netvsc_attach(device_t dev) } else { sc->hn_tx_taskq = hn_tx_taskq; } - NV_LOCK_INIT(sc, "NetVSCLock"); ifp = sc->hn_ifp = if_alloc(IFT_ETHER); ifp->if_softc = sc; @@ -669,6 +660,7 @@ netvsc_detach(device_t dev) taskqueue_free(sc->hn_tx_taskq); vmbus_xact_ctx_destroy(sc->hn_xact); + HN_LOCK_DESTROY(sc); return (0); } @@ -1475,39 +1467,27 @@ skip: return (0); } -/* - * Rules for using sc->temp_unusable: - * 1. sc->temp_unusable can only be read or written while holding NV_LOCK() - * 2. code reading sc->temp_unusable under NV_LOCK(), and finding - * sc->temp_unusable set, must release NV_LOCK() and exit - * 3. to retain exclusive control of the interface, - * sc->temp_unusable must be set by code before releasing NV_LOCK() - * 4. only code setting sc->temp_unusable can clear sc->temp_unusable - * 5. code setting sc->temp_unusable must eventually clear sc->temp_unusable - */ - -/* - * Standard ioctl entry point. Called when the user wants to configure - * the interface. - */ static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct hn_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; int mask, error = 0; - int retry_cnt = 500; - + switch (cmd) { case SIOCSIFMTU: - if (ifp->if_mtu == ifr->ifr_mtu) - break; - if (ifr->ifr_mtu > NETVSC_MAX_CONFIGURABLE_MTU) { error = EINVAL; break; } + HN_LOCK(sc); + + if (ifp->if_mtu == ifr->ifr_mtu) { + HN_UNLOCK(sc); + break; + } + /* Obtain and record requested MTU */ ifp->if_mtu = ifr->ifr_mtu; @@ -1516,40 +1496,18 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * Make sure that LRO aggregation length limit is still * valid, after the MTU change. */ - NV_LOCK(sc); if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < HN_LRO_LENLIM_MIN(ifp)) hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); - NV_UNLOCK(sc); #endif - do { - NV_LOCK(sc); - if (!sc->temp_unusable) { - sc->temp_unusable = TRUE; - retry_cnt = -1; - } - NV_UNLOCK(sc); - if (retry_cnt > 0) { - retry_cnt--; - DELAY(5 * 1000); - } - } while (retry_cnt > 0); - - if (retry_cnt == 0) { - error = EINVAL; - break; - } - /* We must remove and add back the device to cause the new * MTU to take effect. This includes tearing down, but not * deleting the channel, then bringing it back up. */ error = hv_rf_on_device_remove(sc); if (error) { - NV_LOCK(sc); - sc->temp_unusable = FALSE; - NV_UNLOCK(sc); + HN_UNLOCK(sc); break; } @@ -1569,29 +1527,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_init_locked(sc); - NV_LOCK(sc); - sc->temp_unusable = FALSE; - NV_UNLOCK(sc); + HN_UNLOCK(sc); break; case SIOCSIFFLAGS: - do { - NV_LOCK(sc); - if (!sc->temp_unusable) { - sc->temp_unusable = TRUE; - retry_cnt = -1; - } - NV_UNLOCK(sc); - if (retry_cnt > 0) { - retry_cnt--; - DELAY(5 * 1000); - } - } while (retry_cnt > 0); - - if (retry_cnt == 0) { - error = EINVAL; - break; - } + HN_LOCK(sc); if (ifp->if_flags & IFF_UP) { /* @@ -1620,14 +1560,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_stop(sc); } } - NV_LOCK(sc); - sc->temp_unusable = FALSE; - NV_UNLOCK(sc); sc->hn_if_flags = ifp->if_flags; + + HN_UNLOCK(sc); break; case SIOCSIFCAP: - NV_LOCK(sc); + HN_LOCK(sc); mask = ifr->ifr_reqcap ^ ifp->if_capenable; if (mask & IFCAP_TXCSUM) { @@ -1663,7 +1602,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, ifp->if_hwassist &= ~CSUM_IP6_TSO; } - NV_UNLOCK(sc); + HN_UNLOCK(sc); break; case SIOCADDMULTI: @@ -1694,6 +1633,8 @@ hn_stop(struct hn_softc *sc) struct ifnet *ifp; int ret, i; + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; if (bootverbose) @@ -1705,7 +1646,6 @@ hn_stop(struct hn_softc *sc) sc->hn_tx_ring[i].hn_oactive = 0; if_link_state_change(ifp, LINK_STATE_DOWN); - sc->hn_initdone = 0; ret = hv_rf_on_close(sc); } @@ -1774,6 +1714,8 @@ hn_init_locked(struct hn_softc *sc) struct ifnet *ifp; int ret, i; + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { @@ -1783,11 +1725,8 @@ hn_init_locked(struct hn_softc *sc) hv_promisc_mode = 1; ret = hv_rf_on_open(sc); - if (ret != 0) { + if (ret != 0) return; - } else { - sc->hn_initdone = 1; - } atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); for (i = 0; i < sc->hn_tx_ring_inuse; ++i) @@ -1797,27 +1736,14 @@ hn_init_locked(struct hn_softc *sc) if_link_state_change(ifp, LINK_STATE_UP); } -/* - * - */ static void hn_init(void *xsc) { struct hn_softc *sc = xsc; - NV_LOCK(sc); - if (sc->temp_unusable) { - NV_UNLOCK(sc); - return; - } - sc->temp_unusable = TRUE; - NV_UNLOCK(sc); - + HN_LOCK(sc); hn_init_locked(sc); - - NV_LOCK(sc); - sc->temp_unusable = FALSE; - NV_UNLOCK(sc); + HN_UNLOCK(sc); } #ifdef LATER @@ -1848,13 +1774,15 @@ hn_lro_lenlim_sysctl(SYSCTL_HANDLER_ARGS if (error || req->newptr == NULL) return error; + HN_LOCK(sc); if (lenlim < HN_LRO_LENLIM_MIN(sc->hn_ifp) || - lenlim > TCP_LRO_LENGTH_MAX) + lenlim > TCP_LRO_LENGTH_MAX) { + HN_UNLOCK(sc); return EINVAL; - - NV_LOCK(sc); + } hn_set_lro_lenlim(sc, lenlim); - NV_UNLOCK(sc); + HN_UNLOCK(sc); + return 0; } @@ -1881,10 +1809,10 @@ hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS * count limit. */ --ackcnt; - NV_LOCK(sc); + HN_LOCK(sc); for (i = 0; i < sc->hn_rx_ring_inuse; ++i) sc->hn_rx_ring[i].hn_lro.lro_ackcnt_lim = ackcnt; - NV_UNLOCK(sc); + HN_UNLOCK(sc); return 0; } @@ -1905,7 +1833,7 @@ hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARG if (error || req->newptr == NULL) return error; - NV_LOCK(sc); + HN_LOCK(sc); for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; @@ -1914,7 +1842,7 @@ hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARG else rxr->hn_trust_hcsum &= ~hcsum; } - NV_UNLOCK(sc); + HN_UNLOCK(sc); return 0; } @@ -1932,7 +1860,9 @@ hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS) if (chim_size > sc->hn_chim_szmax || chim_size <= 0) return EINVAL; + HN_LOCK(sc); hn_set_chim_size(sc, chim_size); + HN_UNLOCK(sc); return 0; } @@ -2028,12 +1958,12 @@ hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARG if (error || req->newptr == NULL) return error; - NV_LOCK(sc); + HN_LOCK(sc); for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { txr = &sc->hn_tx_ring[i]; *((int *)((uint8_t *)txr + ofs)) = conf; } - NV_UNLOCK(sc); + HN_UNLOCK(sc); return 0; } @@ -2677,10 +2607,8 @@ hn_set_chim_size(struct hn_softc *sc, in { int i; - NV_LOCK(sc); for (i = 0; i < sc->hn_tx_ring_inuse; ++i) sc->hn_tx_ring[i].hn_chim_size = chim_size; - NV_UNLOCK(sc); } static void From owner-svn-src-all@freebsd.org Mon Oct 17 08:45:12 2016 Return-Path: Delivered-To: svn-src-all@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 9C8DCC14C37 for ; Mon, 17 Oct 2016 08:45:12 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com [IPv6:2a00:1450:4010:c07::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 26402189B for ; Mon, 17 Oct 2016 08:45:11 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-lf0-x22f.google.com with SMTP id x79so283004188lff.0 for ; Mon, 17 Oct 2016 01:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=kQplLbPaq5755lzPfLZ6aMELIpnag5XjePewTZGm39U=; b=fF1lkxbe2jMghlZn8NDYivABTMtiAiOsYnBPI1AaEYEHIM5y5zOtLQAKsZF+wbeiI8 hcQ+LqGlcYpYX9Kie81uFVwuejaQwdJGHN8D0ykQwQjGjGfy7jpjJOdj5EGjiuyAc49P 5r8gL+cI8flUdlL2/cKl6FSY5Bb53p00+ikETXicxO1P/LKCtP5UOeuV9oQHYPduURj2 rAVE59rJ7zFoQmFQe4kq8iK/kkHpGR/2Xd7xZysQrezhguZwcJTd71+XUlpujLpK3g/4 JDO3NOVH5xa60lDnTvrcTK0n3VvoWoy8ZMET433Xz2c/0xR0bM2IakAwV31+WWlBb6wk pQRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=kQplLbPaq5755lzPfLZ6aMELIpnag5XjePewTZGm39U=; b=fk7f6biIxFmcEKx3HqBH8q8/Vi4F3NNsIjGAv1VsCPNPLoRPwvkHKxkMgf8i4afrI5 hebWXIFPkS0ilqyDK9ek86rc7Vx48w9IiX/U0zb8xCiGhAuqz0+SZ3HXcTuc/q9KmtvZ O91ggeiXVvr1vOxRQlncqYmpfcEScVv09sZ0yqw+l1hPri1xks5NF9OfSCwrnNbE0GB7 2PGp+V2XX5OIGJcojcWy0+n5ThPbjuBi3scELxVlCHE6AeCOIGxIgRnaKxUSBqMmQfI7 OYiAgdZ71qsYVFm1RRV7JW7Ymb30rK5ljknNTkQ0Di/T0RDrTzra9pYjoq9tQGtPrKle mbCg== X-Gm-Message-State: AA6/9RllmAvU/5W/A9oMn5n6IfS1DITlR5LhPO1fjfOUQglycH2qJVu+wK+poAxLuBV6SwBu X-Received: by 10.25.41.205 with SMTP id p196mr12942237lfp.2.1476693909947; Mon, 17 Oct 2016 01:45:09 -0700 (PDT) Received: from [10.10.1.58] ([185.97.61.26]) by smtp.gmail.com with ESMTPSA id 13sm7366709ljb.22.2016.10.17.01.45.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 01:45:09 -0700 (PDT) Subject: Re: svn commit: r307507 - head/sys/cam/scsi To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201610170835.u9H8ZvQi037190@repo.freebsd.org> From: Steven Hartland Message-ID: <14e5b11b-d623-fe1b-2ad3-088961d1ffab@multiplay.co.uk> Date: Mon, 17 Oct 2016 09:45:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201610170835.u9H8ZvQi037190@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:45:12 -0000 IIRC the timeout for this was intentionally lower than the default, might be worth just checking. On 17/10/2016 09:35, Alexander Motin wrote: > Author: mav > Date: Mon Oct 17 08:35:56 2016 > New Revision: 307507 > URL: https://svnweb.freebsd.org/changeset/base/307507 > > Log: > Consider device as clean even if SYNCHRONIZE CACHE failed. > > If device reservation was preempted by other initiator, our sync request > will always fail. Without this change CAM tried to sync cache on every > following device close, including numerous GEOM tasting opens/closes, > causing lots of useless noise in logs. > > While there, increase SYNCHRONIZE CACHE timeout to default value. > > MFC after: 2 weeks > > Modified: > head/sys/cam/scsi/scsi_da.c > > Modified: head/sys/cam/scsi/scsi_da.c > ============================================================================== > --- head/sys/cam/scsi/scsi_da.c Mon Oct 17 08:29:16 2016 (r307506) > +++ head/sys/cam/scsi/scsi_da.c Mon Oct 17 08:35:56 2016 (r307507) > @@ -1488,12 +1488,11 @@ daclose(struct disk *dp) > scsi_synchronize_cache(&ccb->csio, /*retries*/1, > /*cbfcnp*/dadone, MSG_SIMPLE_Q_TAG, > /*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE, > - 5 * 60 * 1000); > + da_default_timeout * 1000); > error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0, > /*sense_flags*/SF_RETRY_UA | SF_QUIET_IR, > softc->disk->d_devstat); > - if (error == 0) > - softc->flags &= ~DA_FLAG_DIRTY; > + softc->flags &= ~DA_FLAG_DIRTY; > xpt_release_ccb(ccb); > } > > From owner-svn-src-all@freebsd.org Mon Oct 17 08:48:47 2016 Return-Path: Delivered-To: svn-src-all@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 24BA0C14CEE; Mon, 17 Oct 2016 08:48:47 +0000 (UTC) (envelope-from sephe@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 DC81C1A2C; Mon, 17 Oct 2016 08:48:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8mktM041404; Mon, 17 Oct 2016 08:48:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8mkte041403; Mon, 17 Oct 2016 08:48:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170848.u9H8mkte041403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:48: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: r307513 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:48:47 -0000 Author: sephe Date: Mon Oct 17 08:48:45 2016 New Revision: 307513 URL: https://svnweb.freebsd.org/changeset/base/307513 Log: MFC 305795,305796 305795 hyperv/hn: Bring in shims from stable/10 This eases future MFCs to stable/10. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7871 305796 hyperv/hn: Remove the FreeBSD_version check for TSO configuration It is available on both stable/10 and stable/11. This eases future MFCs to stable/10. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7872 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:44:59 2016 (r307512) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:48:45 2016 (r307513) @@ -232,12 +232,10 @@ SYSCTL_INT(_hw_hn, OID_AUTO, trust_hosti "Trust ip packet verification on host side, " "when csum info is missing (global setting)"); -#if __FreeBSD_version >= 1100045 /* Limit TSO burst size */ static int hn_tso_maxlen = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, &hn_tso_maxlen, 0, "TSO burst limit"); -#endif /* Limit chimney send size */ static int hn_tx_chimney_size = 0; @@ -318,8 +316,12 @@ static int hn_lro_ackcnt_sysctl(SYSCTL_H #endif static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS); static int hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS); -static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); +#if __FreeBSD_version < 1100095 +static int hn_rx_stat_int_sysctl(SYSCTL_HANDLER_ARGS); +#else static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS); +#endif +static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); @@ -448,9 +450,7 @@ netvsc_attach(device_t dev) uint32_t link_status; struct ifnet *ifp = NULL; int error, ring_cnt, tx_ring_cnt; -#if __FreeBSD_version >= 1100045 int tso_maxlen; -#endif sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); @@ -583,7 +583,6 @@ netvsc_attach(device_t dev) if (link_status == NDIS_MEDIA_STATE_CONNECTED) sc->hn_carrier = 1; -#if __FreeBSD_version >= 1100045 tso_maxlen = hn_tso_maxlen; if (tso_maxlen <= 0 || tso_maxlen > IP_MAXPACKET) tso_maxlen = IP_MAXPACKET; @@ -592,17 +591,14 @@ netvsc_attach(device_t dev) ifp->if_hw_tsomaxsegsize = PAGE_SIZE; ifp->if_hw_tsomax = tso_maxlen - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); -#endif error = hn_rndis_get_eaddr(sc, eaddr); if (error) goto failed; ether_ifattach(ifp, eaddr); -#if __FreeBSD_version >= 1100045 if_printf(ifp, "TSO: %u/%u/%u\n", ifp->if_hw_tsomax, ifp->if_hw_tsomaxsegcount, ifp->if_hw_tsomaxsegsize); -#endif hn_set_chim_size(sc, sc->hn_chim_szmax); if (hn_tx_chimney_size > 0 && @@ -1866,32 +1862,33 @@ hn_chim_size_sysctl(SYSCTL_HANDLER_ARGS) return 0; } +#if __FreeBSD_version < 1100095 static int -hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS) +hn_rx_stat_int_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; int ofs = arg2, i, error; struct hn_rx_ring *rxr; - u_long stat; + uint64_t stat; stat = 0; - for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { rxr = &sc->hn_rx_ring[i]; - stat += *((u_long *)((uint8_t *)rxr + ofs)); + stat += *((int *)((uint8_t *)rxr + ofs)); } - error = sysctl_handle_long(oidp, &stat, 0, req); + error = sysctl_handle_64(oidp, &stat, 0, req); if (error || req->newptr == NULL) return error; /* Zero out this stat. */ - for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { rxr = &sc->hn_rx_ring[i]; - *((u_long *)((uint8_t *)rxr + ofs)) = 0; + *((int *)((uint8_t *)rxr + ofs)) = 0; } return 0; } - +#else static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS) { @@ -1918,6 +1915,34 @@ hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARG return 0; } +#endif + +static int +hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int ofs = arg2, i, error; + struct hn_rx_ring *rxr; + u_long stat; + + stat = 0; + for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { + rxr = &sc->hn_rx_ring[i]; + stat += *((u_long *)((uint8_t *)rxr + ofs)); + } + + error = sysctl_handle_long(oidp, &stat, 0, req); + if (error || req->newptr == NULL) + return error; + + /* Zero out this stat. */ + for (i = 0; i < sc->hn_rx_ring_inuse; ++i) { + rxr = &sc->hn_rx_ring[i]; + *((u_long *)((uint8_t *)rxr + ofs)) = 0; + } + return 0; +} + static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS) { @@ -2168,11 +2193,21 @@ hn_create_rx_data(struct hn_softc *sc, i SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_queued", CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_lro.lro_queued), - hn_rx_stat_u64_sysctl, "LU", "LRO queued"); +#if __FreeBSD_version < 1100095 + hn_rx_stat_int_sysctl, +#else + hn_rx_stat_u64_sysctl, +#endif + "LU", "LRO queued"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_flushed", CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_lro.lro_flushed), - hn_rx_stat_u64_sysctl, "LU", "LRO flushed"); +#if __FreeBSD_version < 1100095 + hn_rx_stat_int_sysctl, +#else + hn_rx_stat_u64_sysctl, +#endif + "LU", "LRO flushed"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_tried", CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, __offsetof(struct hn_rx_ring, hn_lro_tried), From owner-svn-src-all@freebsd.org Mon Oct 17 08:51:55 2016 Return-Path: Delivered-To: svn-src-all@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 8CC87C14F48; Mon, 17 Oct 2016 08:51:55 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 185181D6A; Mon, 17 Oct 2016 08:51:55 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-lf0-x22e.google.com with SMTP id x79so283272071lff.0; Mon, 17 Oct 2016 01:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=sgtewpdQlM+6tABNogYlH1+/0Xcata628LVIguchCPY=; b=ZGkfd2d3BTmksVvpWh/5VFmRuky8Ha3MZbQImJd3rRZHPQYz9JxEjr8ZLHFJP38qek +U7eiPNUZFH/pOovkrz+3iXskOfV1L8f23A3QiSsZuJ/2Hu4pO/3YZqNh5/UmXEYbrFt 4POJel6zKB5GcnJpnrG08ey6fUGtpqPfU/PmVbIB041YObpsj9ow4TvxpjpiI3Xmw1Sl y7MoRaO1Wb+y05hG9gGElzxDPmxBQWgLf7ISm9z7FyVaiQngsqP8YJ+sVgtZxlsraOwO mP/3Nq/3il69oofvPbaRzahufR8BurEm1n95wa2N9YX6xK38q9rtA3S5+siGN/9GMf8a ah3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=sgtewpdQlM+6tABNogYlH1+/0Xcata628LVIguchCPY=; b=WqtqGiEthMDPT202Ucff2VZkBwbRT4dlsTtaur39zJ0LiCRLgeLNVNyDmsMjIomsdi RZVH/Flxr2WDuK1yUTDpfxGIaVO30xtzzJir6FFFdH9/gPbhggTG0GrzoO8H9Roxrri9 rBvXramY7MHFCcFG2UkmzGbRuvqUUo2P+SzWccp5IZnKZxg4vGqIvY19JEBBJvAreaS1 RJxPVtGsfjnk6iSJ+Tn7xu1IFKKB8s0H4Exr6MOLmV0A1JQYpNuZYQ16KV6S2tFU/Uq7 kOkKkRPJSq+ZRbgq3XxEZ/e/l0N9b74U3NUUo0BYsgKjXogGNbUfmWchoElBw5pi9zmJ HLzA== X-Gm-Message-State: AA6/9RklFawvuA+fIlhLPyHyCE0F8GzAe7bnyJVv1vtuDSb4vROZG13S1UpIIItXxIfv3g== X-Received: by 10.25.215.34 with SMTP id o34mr12232073lfg.35.1476694313243; Mon, 17 Oct 2016 01:51:53 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by smtp.gmail.com with ESMTPSA id h36sm7364736ljh.41.2016.10.17.01.51.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 01:51:52 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r307507 - head/sys/cam/scsi To: Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201610170835.u9H8ZvQi037190@repo.freebsd.org> <14e5b11b-d623-fe1b-2ad3-088961d1ffab@multiplay.co.uk> From: Alexander Motin Message-ID: <9d9c7a6a-74cf-e3f5-4aba-02e4ed636fbe@FreeBSD.org> Date: Mon, 17 Oct 2016 11:51:51 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <14e5b11b-d623-fe1b-2ad3-088961d1ffab@multiplay.co.uk> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:51:55 -0000 On 17.10.2016 11:45, Steven Hartland wrote: > IIRC the timeout for this was intentionally lower than the default, > might be worth just checking. I did traced back the commit history, and it was hardcoded to that value since the beginning 18 years ago. Theoretically SYNCHRONIZE CACHE may require even more time then WRITE, since nobody knows how big can be write caches and how many writes are sitting there. > On 17/10/2016 09:35, Alexander Motin wrote: >> Author: mav >> Date: Mon Oct 17 08:35:56 2016 >> New Revision: 307507 >> URL: https://svnweb.freebsd.org/changeset/base/307507 >> >> Log: >> Consider device as clean even if SYNCHRONIZE CACHE failed. >> >> If device reservation was preempted by other initiator, our sync request >> will always fail. Without this change CAM tried to sync cache on every >> following device close, including numerous GEOM tasting opens/closes, >> causing lots of useless noise in logs. >> >> While there, increase SYNCHRONIZE CACHE timeout to default value. >> >> MFC after: 2 weeks >> >> Modified: >> head/sys/cam/scsi/scsi_da.c >> >> Modified: head/sys/cam/scsi/scsi_da.c >> ============================================================================== >> --- head/sys/cam/scsi/scsi_da.c Mon Oct 17 08:29:16 2016 (r307506) >> +++ head/sys/cam/scsi/scsi_da.c Mon Oct 17 08:35:56 2016 (r307507) >> @@ -1488,12 +1488,11 @@ daclose(struct disk *dp) >> scsi_synchronize_cache(&ccb->csio, /*retries*/1, >> /*cbfcnp*/dadone, MSG_SIMPLE_Q_TAG, >> /*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE, >> - 5 * 60 * 1000); >> + da_default_timeout * 1000); >> error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0, >> /*sense_flags*/SF_RETRY_UA | SF_QUIET_IR, >> softc->disk->d_devstat); >> - if (error == 0) >> - softc->flags &= ~DA_FLAG_DIRTY; >> + softc->flags &= ~DA_FLAG_DIRTY; >> xpt_release_ccb(ccb); >> } >> >> > -- Alexander Motin From owner-svn-src-all@freebsd.org Mon Oct 17 08:53:13 2016 Return-Path: Delivered-To: svn-src-all@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 462B9C14FCC; Mon, 17 Oct 2016 08:53:13 +0000 (UTC) (envelope-from sephe@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 2327C1F5F; Mon, 17 Oct 2016 08:53:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H8rCPG044941; Mon, 17 Oct 2016 08:53:12 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H8rCBA044940; Mon, 17 Oct 2016 08:53:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170853.u9H8rCBA044940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 08:53: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: r307514 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 08:53:13 -0000 Author: sephe Date: Mon Oct 17 08:53:12 2016 New Revision: 307514 URL: https://svnweb.freebsd.org/changeset/base/307514 Log: MFC 305801,305923,305924 305801 hyperv/hn: Fix some ifnet settings - ifnet.if_mtu does not require explicit setting. - ifnet.if_hdrlen must be set after ether_ifattach(). Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7873 305923 hyperv/hn: Regroup ifnet setup code. While I'm here, add comment along the attach DEVMETHOD. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7874 305924 hyperv/hn: Put debug message under bootverbose Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7875 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:48:45 2016 (r307513) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 08:53:12 2016 (r307514) @@ -456,6 +456,9 @@ netvsc_attach(device_t dev) sc->hn_prichan = vmbus_get_channel(dev); HN_LOCK_INIT(sc); + /* + * Setup taskqueue for transmission. + */ if (hn_tx_taskq == NULL) { sc->hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK, taskqueue_thread_enqueue, &sc->hn_tx_taskq); @@ -477,11 +480,22 @@ netvsc_attach(device_t dev) sc->hn_tx_taskq = hn_tx_taskq; } + /* + * Allocate ifnet and setup its name earlier, so that if_printf + * can be used by functions, which will be called after + * ether_ifattach(). + */ ifp = sc->hn_ifp = if_alloc(IFT_ETHER); ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); /* + * Initialize ifmedia earlier so that it can be unconditionally + * destroyed, if error happened later on. + */ + ifmedia_init(&sc->hn_media, 0, hn_ifmedia_upd, hn_ifmedia_sts); + + /* * Figure out the # of RX rings (ring_cnt) and the # of TX rings * to use (tx_ring_cnt). * @@ -511,6 +525,10 @@ netvsc_attach(device_t dev) */ sc->hn_cpu = atomic_fetchadd_int(&hn_cpu_index, ring_cnt) % mp_ncpus; + /* + * Create enough TX/RX rings, even if only limited number of + * channels can be allocated. + */ error = hn_create_tx_data(sc, tx_ring_cnt); if (error) goto failed; @@ -533,10 +551,54 @@ netvsc_attach(device_t dev) if (error) goto failed; + error = hn_rndis_get_linkstatus(sc, &link_status); + if (error) + goto failed; + if (link_status == NDIS_MEDIA_STATE_CONNECTED) + sc->hn_carrier = 1; + + error = hn_rndis_get_eaddr(sc, eaddr); + if (error) + goto failed; + +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring_inuse > 1) { + /* + * Reduce TCP segment aggregation limit for multiple + * RX rings to increase ACK timeliness. + */ + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MULTIRX_DEF); + } +#endif + + hn_set_chim_size(sc, sc->hn_chim_szmax); + if (hn_tx_chimney_size > 0 && + hn_tx_chimney_size < sc->hn_chim_szmax) + hn_set_chim_size(sc, hn_tx_chimney_size); + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "nvs_version", CTLFLAG_RD, + &sc->hn_nvs_ver, 0, "NVS version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "ndis_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_ndis_version_sysctl, "A", "NDIS version"); + + /* + * Setup the ifmedia, which has been initialized earlier. + */ + ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO); + /* XXX ifmedia_set really should do this for us */ + sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media; + + /* + * Setup the ifnet for this interface. + */ + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_init; - ifp->if_mtu = ETHERMTU; if (hn_use_if_start) { int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); @@ -549,16 +611,6 @@ netvsc_attach(device_t dev) ifp->if_qflush = hn_xmit_qflush; } - ifmedia_init(&sc->hn_media, 0, hn_ifmedia_upd, hn_ifmedia_sts); - ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO); - /* XXX ifmedia_set really should do this for us */ - sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media; - - /* - * Tell upper layers that we support full VLAN capability. - */ - ifp->if_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO; @@ -567,54 +619,27 @@ netvsc_attach(device_t dev) IFCAP_LRO; ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; -#if __FreeBSD_version >= 1100099 - if (sc->hn_rx_ring_inuse > 1) { - /* - * Reduce TCP segment aggregation limit for multiple - * RX rings to increase ACK timeliness. - */ - hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MULTIRX_DEF); - } -#endif - - error = hn_rndis_get_linkstatus(sc, &link_status); - if (error) - goto failed; - if (link_status == NDIS_MEDIA_STATE_CONNECTED) - sc->hn_carrier = 1; - tso_maxlen = hn_tso_maxlen; if (tso_maxlen <= 0 || tso_maxlen > IP_MAXPACKET) tso_maxlen = IP_MAXPACKET; - ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; ifp->if_hw_tsomaxsegsize = PAGE_SIZE; ifp->if_hw_tsomax = tso_maxlen - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); - error = hn_rndis_get_eaddr(sc, eaddr); - if (error) - goto failed; ether_ifattach(ifp, eaddr); - if_printf(ifp, "TSO: %u/%u/%u\n", ifp->if_hw_tsomax, - ifp->if_hw_tsomaxsegcount, ifp->if_hw_tsomaxsegsize); - - hn_set_chim_size(sc, sc->hn_chim_szmax); - if (hn_tx_chimney_size > 0 && - hn_tx_chimney_size < sc->hn_chim_szmax) - hn_set_chim_size(sc, hn_tx_chimney_size); + if (bootverbose) { + if_printf(ifp, "TSO: %u/%u/%u\n", ifp->if_hw_tsomax, + ifp->if_hw_tsomaxsegcount, ifp->if_hw_tsomaxsegsize); + } - ctx = device_get_sysctl_ctx(dev); - child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); - SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "nvs_version", CTLFLAG_RD, - &sc->hn_nvs_ver, 0, "NVS version"); - SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "ndis_version", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, - hn_ndis_version_sysctl, "A", "NDIS version"); + /* Inform the upper layer about the long frame support. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); return (0); failed: + /* TODO: reuse netvsc_detach() */ hn_destroy_tx_data(sc); if (ifp != NULL) if_free(ifp); From owner-svn-src-all@freebsd.org Mon Oct 17 09:16:45 2016 Return-Path: Delivered-To: svn-src-all@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 5CEBCC157F6; Mon, 17 Oct 2016 09:16:45 +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 2EC041A30; Mon, 17 Oct 2016 09:16:45 +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 u9H9GiYe053061; Mon, 17 Oct 2016 09:16:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H9GijL053060; Mon, 17 Oct 2016 09:16:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610170916.u9H9GijL053060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 17 Oct 2016 09:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307515 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 09:16:45 -0000 Author: mav Date: Mon Oct 17 09:16:44 2016 New Revision: 307515 URL: https://svnweb.freebsd.org/changeset/base/307515 Log: Revert timeout part of r307507. I misread 5 minutes as 5 seconds. Timeout of 5 minutes may have sense. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Oct 17 08:53:12 2016 (r307514) +++ head/sys/cam/scsi/scsi_da.c Mon Oct 17 09:16:44 2016 (r307515) @@ -1488,7 +1488,7 @@ daclose(struct disk *dp) scsi_synchronize_cache(&ccb->csio, /*retries*/1, /*cbfcnp*/dadone, MSG_SIMPLE_Q_TAG, /*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE, - da_default_timeout * 1000); + 5 * 60 * 1000); error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0, /*sense_flags*/SF_RETRY_UA | SF_QUIET_IR, softc->disk->d_devstat); From owner-svn-src-all@freebsd.org Mon Oct 17 09:31:50 2016 Return-Path: Delivered-To: svn-src-all@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 B29E7C15B83; Mon, 17 Oct 2016 09:31:50 +0000 (UTC) (envelope-from sephe@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 6EE9311AA; Mon, 17 Oct 2016 09:31:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H9VnWd061071; Mon, 17 Oct 2016 09:31:49 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H9Vn8N061053; Mon, 17 Oct 2016 09:31:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610170931.u9H9Vn8N061053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 17 Oct 2016 09:31: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: r307516 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 09:31:50 -0000 Author: sephe Date: Mon Oct 17 09:31:49 2016 New Revision: 307516 URL: https://svnweb.freebsd.org/changeset/base/307516 Log: MFC 305925,305926,305960 305925 hyperv/hn: Don't mess up RSS key and indirect table after attachment. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7889 305926 hyperv/hn: Add sysctls to dynamic adjust RSS key and indirect table Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7890 305960 hyperv/hn: Apply RSS indirect table fixup before configure RNDIS RSS. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7916 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/netvsc/ndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 09:16:44 2016 (r307515) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Oct 17 09:31:49 2016 (r307516) @@ -325,6 +325,8 @@ static int hn_rx_stat_ulong_sysctl(SYSCT static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); static int hn_create_tx_ring(struct hn_softc *, int); static void hn_destroy_tx_ring(struct hn_tx_ring *); @@ -391,6 +393,62 @@ hn_get_txswq_depth(const struct hn_tx_ri } static int +hn_rss_reconfig(struct hn_softc *sc) +{ + int error; + + HN_LOCK_ASSERT(sc); + + /* + * Disable RSS first. + * + * NOTE: + * Direct reconfiguration by setting the UNCHG flags does + * _not_ work properly. + */ + if (bootverbose) + if_printf(sc->hn_ifp, "disable RSS\n"); + error = hn_rndis_conf_rss(sc, NDIS_RSS_FLAG_DISABLE); + if (error) { + if_printf(sc->hn_ifp, "RSS disable failed\n"); + return (error); + } + + /* + * Reenable the RSS w/ the updated RSS key or indirect + * table. + */ + if (bootverbose) + if_printf(sc->hn_ifp, "reconfig RSS\n"); + error = hn_rndis_conf_rss(sc, NDIS_RSS_FLAG_NONE); + if (error) { + if_printf(sc->hn_ifp, "RSS reconfig failed\n"); + return (error); + } + return (0); +} + +static void +hn_rss_ind_fixup(struct hn_softc *sc, int nchan) +{ + struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; + int i; + + /* + * Check indirect table to make sure that all channels in it + * can be used. + */ + for (i = 0; i < NDIS_HASH_INDCNT; ++i) { + if (rss->rss_ind[i] >= nchan) { + if_printf(sc->hn_ifp, + "RSS indirect table %d fixup: %u -> %d\n", + i, rss->rss_ind[i], nchan - 1); + rss->rss_ind[i] = nchan - 1; + } + } +} + +static int hn_ifmedia_upd(struct ifnet *ifp __unused) { @@ -583,6 +641,12 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "ndis_version", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_ndis_version_sysctl, "A", "NDIS version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", + CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_rss_key_sysctl, "IU", "RSS key"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_ind", + CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_rss_ind_sysctl, "IU", "RSS indirect table"); /* * Setup the ifmedia, which has been initialized earlier. @@ -2031,6 +2095,51 @@ hn_ndis_version_sysctl(SYSCTL_HANDLER_AR } static int +hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int error; + + HN_LOCK(sc); + + error = SYSCTL_OUT(req, sc->hn_rss.rss_key, sizeof(sc->hn_rss.rss_key)); + if (error || req->newptr == NULL) + goto back; + + error = SYSCTL_IN(req, sc->hn_rss.rss_key, sizeof(sc->hn_rss.rss_key)); + if (error) + goto back; + + error = hn_rss_reconfig(sc); +back: + HN_UNLOCK(sc); + return (error); +} + +static int +hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int error; + + HN_LOCK(sc); + + error = SYSCTL_OUT(req, sc->hn_rss.rss_ind, sizeof(sc->hn_rss.rss_ind)); + if (error || req->newptr == NULL) + goto back; + + error = SYSCTL_IN(req, sc->hn_rss.rss_ind, sizeof(sc->hn_rss.rss_ind)); + if (error) + goto back; + + hn_rss_ind_fixup(sc, sc->hn_rx_ring_inuse); + error = hn_rss_reconfig(sc); +back: + HN_UNLOCK(sc); + return (error); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -3159,15 +3268,34 @@ hn_synth_attach(struct hn_softc *sc, int * are allocated. */ - /* Setup default RSS key. */ - memcpy(rss->rss_key, hn_rss_key_default, sizeof(rss->rss_key)); + if (!device_is_attached(sc->hn_dev)) { + /* + * Setup default RSS key and indirect table for the + * attach DEVMETHOD. They can be altered later on, + * so don't mess them up once this interface is attached. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "setup default RSS key and " + "indirect table\n"); + } + + /* Setup default RSS key. */ + memcpy(rss->rss_key, hn_rss_key_default, sizeof(rss->rss_key)); - /* Setup default RSS indirect table. */ - /* TODO: Take ndis_rss_caps.ndis_nind into account. */ - for (i = 0; i < NDIS_HASH_INDCNT; ++i) - rss->rss_ind[i] = i % nchan; + /* Setup default RSS indirect table. */ + /* TODO: Take ndis_rss_caps.ndis_nind into account. */ + for (i = 0; i < NDIS_HASH_INDCNT; ++i) + rss->rss_ind[i] = i % nchan; + } else { + /* + * # of usable channels may be changed, so we have to + * make sure that all entries in RSS indirect table + * are valid. + */ + hn_rss_ind_fixup(sc, nchan); + } - error = hn_rndis_conf_rss(sc); + error = hn_rndis_conf_rss(sc, NDIS_RSS_FLAG_NONE); if (error) { /* * Failed to configure RSS key or indirect table; only Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 09:16:44 2016 (r307515) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Mon Oct 17 09:31:49 2016 (r307516) @@ -837,7 +837,7 @@ hn_rndis_conf_offload(struct hn_softc *s } int -hn_rndis_conf_rss(struct hn_softc *sc) +hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags) { struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; struct ndis_rss_params *prm = &rss->rss_params; @@ -858,6 +858,7 @@ hn_rndis_conf_rss(struct hn_softc *sc) prm->ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_PARAMS; prm->ndis_hdr.ndis_rev = NDIS_RSS_PARAMS_REV_2; prm->ndis_hdr.ndis_size = sizeof(*rss); + prm->ndis_flags = flags; prm->ndis_hash = NDIS_HASH_FUNCTION_TOEPLITZ | NDIS_HASH_IPV4 | NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 | NDIS_HASH_TCP_IPV6; Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 09:16:44 2016 (r307515) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Oct 17 09:31:49 2016 (r307516) @@ -118,7 +118,7 @@ uint32_t hn_chim_alloc(struct hn_softc * void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); int hn_rndis_attach(struct hn_softc *sc); -int hn_rndis_conf_rss(struct hn_softc *sc); +int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, size_t pktsize, size_t pi_dlen, uint32_t pi_type); int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt); Modified: stable/11/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 09:16:44 2016 (r307515) +++ stable/11/sys/dev/hyperv/netvsc/ndis.h Mon Oct 17 09:31:49 2016 (r307516) @@ -188,6 +188,7 @@ struct ndis_rss_params { #define NDIS_RSS_PARAMS_REV_1 1 /* NDIS 6.0 */ #define NDIS_RSS_PARAMS_REV_2 2 /* NDIS 6.20 */ +#define NDIS_RSS_FLAG_NONE 0x0000 #define NDIS_RSS_FLAG_BCPU_UNCHG 0x0001 #define NDIS_RSS_FLAG_HASH_UNCHG 0x0002 #define NDIS_RSS_FLAG_IND_UNCHG 0x0004 From owner-svn-src-all@freebsd.org Mon Oct 17 09:32:12 2016 Return-Path: Delivered-To: svn-src-all@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 248B3C15BDB for ; Mon, 17 Oct 2016 09:32:12 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C17A71351 for ; Mon, 17 Oct 2016 09:32:11 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-lf0-x22d.google.com with SMTP id b75so278792883lfg.3 for ; Mon, 17 Oct 2016 02:32:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=FXBof/bJq4K8A/ha7t06USXxBDSo39Id4ePe2r1exBs=; b=uOLTvLooihXihZyhSZcJx8trdCEGnAE76MjlRnoRHtgirtQJKRANr9Z/7h8JGM4N1r YeEFccRl5Q1lELXaq+sT9FKY8MLYC1vioavsLQ/kIP8Imt90OnDfiJH7srxFh0EA1C3C l62iSqcg+gKQTO2fIrXRJC45RfqbPdfkhcxb4YFN9Mcuohwaxx5DZzQY3mf0KrKnlzur LUEB5jx4cnTIHTYirDB6ysO50pbt/MDvqbxXnmvhNOb8FX9UigfT+MoRO1P6xUz5Rnos 0aIj1TZwN/iBYPyrZEhEaf+4QnsQx+EqskYm14TzHTpUCkXBACCsUwpx0s1Y2M830CMq Uxdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=FXBof/bJq4K8A/ha7t06USXxBDSo39Id4ePe2r1exBs=; b=cqyj1m9qHLeAw4Crz3AG01/nbuKcyfkMa5Zoj/A6jKNHG7qMNzHz7DGN9N1ERF99f5 7ydvFHgneTghaz0zwshvUYMEHDbM2K6nktOsYBB/OV8Q4FU+zaY0LXj4sw6NPBmuzb7g aAJs3eYD+lKHx4vS1LP7WG/3SdDZmFP2drJipFOZkbnTF1PmeMcgpMWR30dhtIWMWUTQ Z7/bpslDVs6mTGT4RK2qz/3O2ovd/E1gDIIRFmC+HaaDMTzoY30kEB6o6jTOD9Z9dFT8 BOVvWoCIbpiXNXLSI137tMgO9dRtASHVIXzv8espJ1188H/00JaQSVgOUoIejBymhpaF W6wg== X-Gm-Message-State: AA6/9RkL3SNlv3RdEx9ZchcVcOgizIHcxgefvve1/s9kvv2y/B6pXQN1HnRF73jaEB2P/4z5 X-Received: by 10.25.99.4 with SMTP id x4mr11801856lfb.128.1476696729739; Mon, 17 Oct 2016 02:32:09 -0700 (PDT) Received: from [10.10.1.58] ([185.97.61.26]) by smtp.gmail.com with ESMTPSA id b188sm7391465lfg.41.2016.10.17.02.32.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 02:32:08 -0700 (PDT) Subject: Re: svn commit: r307507 - head/sys/cam/scsi To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201610170835.u9H8ZvQi037190@repo.freebsd.org> <14e5b11b-d623-fe1b-2ad3-088961d1ffab@multiplay.co.uk> <9d9c7a6a-74cf-e3f5-4aba-02e4ed636fbe@FreeBSD.org> From: Steven Hartland Message-ID: <00584f8b-9e2d-0e69-98bd-2633136acdf3@multiplay.co.uk> Date: Mon, 17 Oct 2016 10:32:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <9d9c7a6a-74cf-e3f5-4aba-02e4ed636fbe@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 09:32:12 -0000 On 17/10/2016 09:51, Alexander Motin wrote: > On 17.10.2016 11:45, Steven Hartland wrote: >> IIRC the timeout for this was intentionally lower than the default, >> might be worth just checking. > I did traced back the commit history, and it was hardcoded to that value > since the beginning 18 years ago. Theoretically SYNCHRONIZE CACHE may > require even more time then WRITE, since nobody knows how big can be > write caches and how many writes are sitting there. Cool, must be thinking about something else that was added recently then, thanks for checking :) From owner-svn-src-all@freebsd.org Mon Oct 17 09:35:09 2016 Return-Path: Delivered-To: svn-src-all@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 E477CC15CCE; Mon, 17 Oct 2016 09:35:09 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com [IPv6:2a00:1450:4010:c07::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6526D15C9; Mon, 17 Oct 2016 09:35:09 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-lf0-x22f.google.com with SMTP id x79so285090311lff.0; Mon, 17 Oct 2016 02:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=jczcu4HlMndx1o6sIT0FysoqceGpoSxEoZSJDelC3RA=; b=Fl6Hrs+L4ynKrOI/mf+4Fffv9kJLqAie49s5OuUIDQk5+MQSmQTWXi2vwhtbzuZtjM 5gMRVg/LyNLEYe8VMQWUVrf9zNuD0lVXbHlhsuPyoQy2hDEfb5IUhZ03aa+Qx2e4Tru2 PyD9HF9aW6IxN3CdnOLkMJrznJecFxdHnrhaZBzxBiSo5BGYkttFDs0mV7iOVfgYnnef DMwjVKIsrO//dA8pXl0COcr2gyspMyiObcuaBUClvhoY9ScvebUdXK6mmfDUbVcwaEw3 MV7xQmy72//lsdPVdLcSKpcDhbtA2mW3xwjK0ZqHcE1BW5L1zcVFx71tCU7GAoS7ST8o /g5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=jczcu4HlMndx1o6sIT0FysoqceGpoSxEoZSJDelC3RA=; b=iiOZcfFpmQFQuiy+01obzLPwj8P0ScBP0GyMyOl7Aqq9sM1ce9VD0D5Qm+jBm64v0m sliASku4qSJ+Ze0CwKg9zUV+Spz6/IoQMQAOV26TQNKu8Aqsd4Wb0AwWDGHke6+jP4ZX jL3hW+aCrrr5bVb9w6EKwcud2eRvy2epAQ1kmx5/B1+kh0ewlYE8/rnk3HW80UlTAqzT AYEO0uOkpQ3ZC3MINUIjtm3oLl6vta5wTl2HHLIDknqAjWL1EiQRL/0YGi7hJxNa3An3 YBry9EKA9/zfgp/CxNeV8s2sEFeGdP80eCK5ofQSzvhT9LrwA9JSUbUbYrxOeDSKUzDu xRiQ== X-Gm-Message-State: AA6/9RmTpOESWdqFlCVSqTXHslmeb/lIoOiiDENk+gjxKHEO3kuOacFOWAiOz3hkIW5ehg== X-Received: by 10.25.199.76 with SMTP id x73mr13502537lff.162.1476696907372; Mon, 17 Oct 2016 02:35:07 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by smtp.gmail.com with ESMTPSA id j4sm1531585lfg.23.2016.10.17.02.35.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 02:35:06 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r307507 - head/sys/cam/scsi To: Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201610170835.u9H8ZvQi037190@repo.freebsd.org> <14e5b11b-d623-fe1b-2ad3-088961d1ffab@multiplay.co.uk> <9d9c7a6a-74cf-e3f5-4aba-02e4ed636fbe@FreeBSD.org> <00584f8b-9e2d-0e69-98bd-2633136acdf3@multiplay.co.uk> From: Alexander Motin Message-ID: <9f72eb3f-40ff-6aca-0ec4-bfe9d1d4b15c@FreeBSD.org> Date: Mon, 17 Oct 2016 12:35:05 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <00584f8b-9e2d-0e69-98bd-2633136acdf3@multiplay.co.uk> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 09:35:10 -0000 On 17.10.2016 12:32, Steven Hartland wrote: > On 17/10/2016 09:51, Alexander Motin wrote: >> On 17.10.2016 11:45, Steven Hartland wrote: >>> IIRC the timeout for this was intentionally lower than the default, >>> might be worth just checking. >> I did traced back the commit history, and it was hardcoded to that value >> since the beginning 18 years ago. Theoretically SYNCHRONIZE CACHE may >> require even more time then WRITE, since nobody knows how big can be >> write caches and how many writes are sitting there. > Cool, must be thinking about something else that was added recently > then, thanks for checking :) And still it was my mistake. Reverted. Sorry. -- Alexander Motin From owner-svn-src-all@freebsd.org Mon Oct 17 09:40:20 2016 Return-Path: Delivered-To: svn-src-all@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 46F37C1511A; Mon, 17 Oct 2016 09:40:20 +0000 (UTC) (envelope-from maxim@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 1608E1DAA; Mon, 17 Oct 2016 09:40:20 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9H9eJSs061912; Mon, 17 Oct 2016 09:40:19 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9H9eJkS061911; Mon, 17 Oct 2016 09:40:19 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201610170940.u9H9eJkS061911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Mon, 17 Oct 2016 09:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307517 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 09:40:20 -0000 Author: maxim Date: Mon Oct 17 09:40:18 2016 New Revision: 307517 URL: https://svnweb.freebsd.org/changeset/base/307517 Log: Typo fixed: arbitraty -> arbitrary. PR: 213559 Submitted by: olgeni Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Mon Oct 17 09:31:49 2016 (r307516) +++ head/usr.sbin/bhyve/bhyve.8 Mon Oct 17 09:40:18 2016 (r307517) @@ -172,7 +172,7 @@ Virtio block storage interface. .It Li virtio-rnd Virtio RNG interface. .It Li ahci -AHCI controller attached to arbitraty devices. +AHCI controller attached to arbitrary devices. .It Li ahci-cd AHCI controller attached to an ATAPI CD/DVD. .It Li ahci-hd From owner-svn-src-all@freebsd.org Mon Oct 17 10:20:45 2016 Return-Path: Delivered-To: svn-src-all@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 15B1EC15A30; Mon, 17 Oct 2016 10:20:45 +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 CFEED319; Mon, 17 Oct 2016 10:20:44 +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 u9HAKimG078781; Mon, 17 Oct 2016 10:20:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HAKdWO076718; Mon, 17 Oct 2016 10:20:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610171020.u9HAKdWO076718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 17 Oct 2016 10:20:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307518 - in head/sys: arm/allwinner arm/at91 arm/cavium/cns11xx arm/samsung/exynos arm/ti/am335x arm/ti/usb arm/xilinx boot/kshim dev/bhnd/cores/usb dev/puc dev/usb dev/usb/controller ... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 10:20:45 -0000 Author: hselasky Date: Mon Oct 17 10:20:38 2016 New Revision: 307518 URL: https://svnweb.freebsd.org/changeset/base/307518 Log: Fix device delete child function. When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070 MFC after: 2 weeks Modified: head/sys/arm/allwinner/a10_ehci.c head/sys/arm/at91/at91_ohci.c head/sys/arm/at91/at91_ohci_fdt.c head/sys/arm/cavium/cns11xx/ehci_ebus.c head/sys/arm/cavium/cns11xx/ohci_ec.c head/sys/arm/samsung/exynos/exynos5_xhci.c head/sys/arm/ti/am335x/am335x_musb.c head/sys/arm/ti/usb/omap_ehci.c head/sys/arm/xilinx/zy7_ehci.c head/sys/boot/kshim/bsd_kernel.c head/sys/dev/bhnd/cores/usb/bhnd_ehci.c head/sys/dev/bhnd/cores/usb/bhnd_ohci.c head/sys/dev/puc/puc.c head/sys/dev/usb/controller/at91dci_atmelarm.c head/sys/dev/usb/controller/at91dci_fdt.c head/sys/dev/usb/controller/atmegadci_atmelarm.c head/sys/dev/usb/controller/dwc_otg_fdt.c head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mv.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/generic_ehci.c head/sys/dev/usb/controller/generic_ohci.c head/sys/dev/usb/controller/musb_otg_atmelarm.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/ohci_s3c24x0.c head/sys/dev/usb/controller/saf1761_otg_boot.c head/sys/dev/usb/controller/saf1761_otg_fdt.c head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/usb/controller/uss820dci_atmelarm.c head/sys/dev/usb/controller/xhci_mv.c head/sys/dev/usb/controller/xhci_pci.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/video/udl.c head/sys/kern/subr_bus.c head/sys/mips/atheros/ar71xx_ehci.c head/sys/mips/atheros/ar71xx_ohci.c head/sys/mips/cavium/usb/octusb_octeon.c head/sys/mips/mediatek/mtk_dotg.c head/sys/mips/mediatek/mtk_ehci.c head/sys/mips/mediatek/mtk_ohci.c head/sys/mips/mediatek/mtk_xhci.c head/sys/mips/rmi/xls_ehci.c head/sys/mips/rt305x/rt305x_dotg.c head/sys/mips/rt305x/rt305x_ehci.c head/sys/mips/rt305x/rt305x_ohci.c Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/allwinner/a10_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -275,17 +275,11 @@ a10_ehci_detach(device_t self) struct aw_ehci_softc *aw_sc = device_get_softc(self); ehci_softc_t *sc = &aw_sc->sc; const struct aw_ehci_conf *conf; - device_t bdev; int err; uint32_t reg_value = 0; conf = USB_CONF(self); - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/arm/at91/at91_ohci.c ============================================================================== --- head/sys/arm/at91/at91_ohci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/at91/at91_ohci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -165,14 +165,8 @@ static int ohci_atmelarm_detach(device_t dev) { struct at91_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/arm/at91/at91_ohci_fdt.c ============================================================================== --- head/sys/arm/at91/at91_ohci_fdt.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/at91/at91_ohci_fdt.c Mon Oct 17 10:20:38 2016 (r307518) @@ -171,14 +171,8 @@ static int ohci_at91_fdt_detach(device_t dev) { struct at91_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/arm/cavium/cns11xx/ehci_ebus.c ============================================================================== --- head/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Oct 17 10:20:38 2016 (r307518) @@ -184,14 +184,8 @@ static int ehci_ebus_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/arm/cavium/cns11xx/ohci_ec.c ============================================================================== --- head/sys/arm/cavium/cns11xx/ohci_ec.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/cavium/cns11xx/ohci_ec.c Mon Oct 17 10:20:38 2016 (r307518) @@ -177,14 +177,8 @@ static int ohci_ec_detach(device_t dev) { struct ec_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/arm/samsung/exynos/exynos5_xhci.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_xhci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/samsung/exynos/exynos5_xhci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -288,14 +288,8 @@ static int exynos_xhci_detach(device_t dev) { struct exynos_xhci_softc *esc = device_get_softc(dev); - device_t bdev; int err; - if (esc->base.sc_bus.bdev != NULL) { - bdev = esc->base.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* During module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/arm/ti/am335x/am335x_musb.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_musb.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/ti/am335x/am335x_musb.c Mon Oct 17 10:20:38 2016 (r307518) @@ -366,14 +366,10 @@ static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } + /* during module unload there are lots of children leftover */ + device_delete_children(dev); if (sc->sc_otg.sc_irq_res && sc->sc_otg.sc_intr_hdl) { /* @@ -397,9 +393,6 @@ musbotg_detach(device_t dev) bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_otg.sc_irq_res); - /* during module unload there are lots of children leftover */ - device_delete_children(dev); - return (0); } Modified: head/sys/arm/ti/usb/omap_ehci.c ============================================================================== --- head/sys/arm/ti/usb/omap_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/ti/usb/omap_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -392,15 +392,8 @@ omap_ehci_detach(device_t dev) { struct omap_ehci_softc *isc = device_get_softc(dev); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } - /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/arm/xilinx/zy7_ehci.c ============================================================================== --- head/sys/arm/xilinx/zy7_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/arm/xilinx/zy7_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -323,20 +323,17 @@ zy7_ehci_detach(device_t dev) { ehci_softc_t *sc = device_get_softc(dev); + /* during module unload there are lots of children leftover */ + device_delete_children(dev); + sc->sc_flags &= ~EHCI_SCFLG_DONEINIT; - if (device_is_attached(dev)) - bus_generic_detach(dev); - if (sc->sc_irq_res && sc->sc_intr_hdl) /* call ehci_detach() after ehci_init() called after * successful bus_setup_intr(). */ ehci_detach(sc); - if (sc->sc_bus.bdev) { - device_detach(sc->sc_bus.bdev); - device_delete_child(dev, sc->sc_bus.bdev); - } + if (sc->sc_irq_res) { if (sc->sc_intr_hdl != NULL) bus_teardown_intr(dev, sc->sc_irq_res, Modified: head/sys/boot/kshim/bsd_kernel.c ============================================================================== --- head/sys/boot/kshim/bsd_kernel.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/boot/kshim/bsd_kernel.c Mon Oct 17 10:20:38 2016 (r307518) @@ -817,8 +817,12 @@ device_delete_child(device_t dev, device int error = 0; device_t grandchild; - /* remove children first */ + /* detach parent before deleting children, if any */ + error = device_detach(child); + if (error) + goto done; + /* remove children second */ while ((grandchild = TAILQ_FIRST(&child->dev_children))) { error = device_delete_child(child, grandchild); if (error) { @@ -827,11 +831,6 @@ device_delete_child(device_t dev, device } } - error = device_detach(child); - - if (error) - goto done; - devclass_delete_device(child->dev_module, child); if (dev != NULL) { Modified: head/sys/dev/bhnd/cores/usb/bhnd_ehci.c ============================================================================== --- head/sys/dev/bhnd/cores/usb/bhnd_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/bhnd/cores/usb/bhnd_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -191,16 +191,10 @@ static int bhnd_ehci_detach(device_t self) { ehci_softc_t *sc; - device_t bdev; int err; sc = device_get_softc(self); - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/bhnd/cores/usb/bhnd_ohci.c ============================================================================== --- head/sys/dev/bhnd/cores/usb/bhnd_ohci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/bhnd/cores/usb/bhnd_ohci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -163,15 +163,9 @@ static int bhnd_ohci_detach(device_t self) { ohci_softc_t *sc; - device_t bdev; sc = device_get_softc(self); - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/puc/puc.c ============================================================================== --- head/sys/dev/puc/puc.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/puc/puc.c Mon Oct 17 10:20:38 2016 (r307518) @@ -414,8 +414,7 @@ puc_bfe_detach(device_t dev) port = &sc->sc_port[idx]; if (port->p_dev == NULL) continue; - if (device_detach(port->p_dev) == 0) { - device_delete_child(dev, port->p_dev); + if (device_delete_child(dev, port->p_dev) == 0) { if (port->p_rres != NULL) rman_release_resource(port->p_rres); if (port->p_ires != NULL) Modified: head/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/at91dci_atmelarm.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/at91dci_atmelarm.c Mon Oct 17 10:20:38 2016 (r307518) @@ -243,14 +243,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/at91dci_fdt.c ============================================================================== --- head/sys/dev/usb/controller/at91dci_fdt.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/at91dci_fdt.c Mon Oct 17 10:20:38 2016 (r307518) @@ -249,14 +249,8 @@ static int at91_udp_detach(device_t dev) { struct at91_udp_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Oct 17 10:20:38 2016 (r307518) @@ -155,14 +155,8 @@ static int atmegadci_detach(device_t dev) { struct atmegadci_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/dwc_otg_fdt.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg_fdt.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/dwc_otg_fdt.c Mon Oct 17 10:20:38 2016 (r307518) @@ -163,14 +163,8 @@ static int dwc_otg_detach(device_t dev) { struct dwc_otg_fdt_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_ixp4xx.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/ehci_ixp4xx.c Mon Oct 17 10:20:38 2016 (r307518) @@ -221,14 +221,8 @@ ehci_ixp_detach(device_t self) { struct ixp_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- head/sys/dev/usb/controller/ehci_mv.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/ehci_mv.c Mon Oct 17 10:20:38 2016 (r307518) @@ -264,14 +264,8 @@ static int mv_ehci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/ehci_pci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -477,13 +477,7 @@ static int ehci_pci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/usb/controller/generic_ehci.c ============================================================================== --- head/sys/dev/usb/controller/generic_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/generic_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -156,14 +156,8 @@ static int generic_ehci_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/usb/controller/generic_ohci.c ============================================================================== --- head/sys/dev/usb/controller/generic_ohci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/generic_ohci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -214,18 +214,11 @@ static int generic_ohci_detach(device_t dev) { struct generic_ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; #ifdef EXT_RESOURCES struct clk_list *clk, *clk_tmp; #endif - if (sc->ohci_sc.sc_bus.bdev) { - bdev = sc->ohci_sc.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } - /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Oct 17 10:20:38 2016 (r307518) @@ -204,14 +204,8 @@ static int musbotg_detach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_otg.sc_bus.bdev) { - bdev = sc->sc_otg.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ohci_pci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/ohci_pci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -335,13 +335,7 @@ static int ohci_pci_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- head/sys/dev/usb/controller/ohci_s3c24x0.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/ohci_s3c24x0.c Mon Oct 17 10:20:38 2016 (r307518) @@ -148,14 +148,8 @@ static int ohci_s3c24x0_detach(device_t dev) { struct ohci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/saf1761_otg_boot.c ============================================================================== --- head/sys/dev/usb/controller/saf1761_otg_boot.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/saf1761_otg_boot.c Mon Oct 17 10:20:38 2016 (r307518) @@ -124,13 +124,6 @@ static int saf1761_otg_fdt_detach(device_t dev) { struct saf1761_otg_softc *sc = device_get_softc(dev); - device_t bdev; - - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/saf1761_otg_fdt.c ============================================================================== --- head/sys/dev/usb/controller/saf1761_otg_fdt.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/saf1761_otg_fdt.c Mon Oct 17 10:20:38 2016 (r307518) @@ -238,14 +238,8 @@ static int saf1761_otg_fdt_detach(device_t dev) { struct saf1761_otg_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/uhci_pci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -393,13 +393,7 @@ int uhci_pci_detach(device_t self) { uhci_softc_t *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Oct 17 10:20:38 2016 (r307518) @@ -164,14 +164,8 @@ static int uss820_atmelarm_detach(device_t dev) { struct uss820dci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/xhci_mv.c ============================================================================== --- head/sys/dev/usb/controller/xhci_mv.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/xhci_mv.c Mon Oct 17 10:20:38 2016 (r307518) @@ -171,15 +171,8 @@ static int xhci_detach(device_t dev) { struct xhci_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev != NULL) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } - /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/controller/xhci_pci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -340,13 +340,7 @@ static int xhci_pci_detach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - device_t bdev; - if (sc->sc_bus.bdev != NULL) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/usb_device.c Mon Oct 17 10:20:38 2016 (r307518) @@ -1103,10 +1103,8 @@ usb_detach_device_sub(struct usb_device device_printf(dev, "Resume failed\n"); } } - if (device_detach(dev)) { - goto error; - } } + /* detach and delete child */ if (device_delete_child(udev->parent_dev, dev)) { goto error; } Modified: head/sys/dev/usb/video/udl.c ============================================================================== --- head/sys/dev/usb/video/udl.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/dev/usb/video/udl.c Mon Oct 17 10:20:38 2016 (r307518) @@ -443,14 +443,9 @@ udl_detach(device_t dev) { struct udl_softc *sc = device_get_softc(dev); - if (sc->sc_fbdev != NULL) { - device_t bdev; + /* delete all child devices */ + device_delete_children(dev); - bdev = sc->sc_fbdev; - sc->sc_fbdev = NULL; - device_detach(bdev); - device_delete_child(dev, bdev); - } UDL_LOCK(sc); sc->sc_gone = 1; callout_stop(&sc->sc_callout); Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/kern/subr_bus.c Mon Oct 17 10:20:38 2016 (r307518) @@ -1949,15 +1949,17 @@ device_delete_child(device_t dev, device PDEBUG(("%s from %s", DEVICENAME(child), DEVICENAME(dev))); - /* remove children first */ + /* detach parent before deleting children, if any */ + if ((error = device_detach(child)) != 0) + return (error); + + /* remove children second */ while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { error = device_delete_child(child, grandchild); if (error) return (error); } - if ((error = device_detach(child)) != 0) - return (error); if (child->devclass) devclass_delete_device(child->devclass, child); if (child->parent) Modified: head/sys/mips/atheros/ar71xx_ehci.c ============================================================================== --- head/sys/mips/atheros/ar71xx_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/atheros/ar71xx_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -231,14 +231,8 @@ ar71xx_ehci_detach(device_t self) { struct ar71xx_ehci_softc *isc = device_get_softc(self); ehci_softc_t *sc = &isc->base; - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/mips/atheros/ar71xx_ohci.c ============================================================================== --- head/sys/mips/atheros/ar71xx_ohci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/atheros/ar71xx_ohci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -156,13 +156,7 @@ static int ar71xx_ohci_detach(device_t dev) { struct ar71xx_ohci_softc *sc = device_get_softc(dev); - device_t bdev; - if (sc->sc_ohci.sc_bus.bdev) { - bdev = sc->sc_ohci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- head/sys/mips/cavium/usb/octusb_octeon.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/cavium/usb/octusb_octeon.c Mon Oct 17 10:20:38 2016 (r307518) @@ -160,16 +160,10 @@ static int octusb_octeon_detach(device_t dev) { struct octusb_octeon_softc *sc = device_get_softc(dev); - device_t bdev; int err; int nports; int i; - if (sc->sc_dci.sc_bus.bdev) { - bdev = sc->sc_dci.sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/mips/mediatek/mtk_dotg.c ============================================================================== --- head/sys/mips/mediatek/mtk_dotg.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/mediatek/mtk_dotg.c Mon Oct 17 10:20:38 2016 (r307518) @@ -161,14 +161,8 @@ static int dotg_fdt_detach(device_t dev) { struct dwc_otg_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/mips/mediatek/mtk_ehci.c ============================================================================== --- head/sys/mips/mediatek/mtk_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/mediatek/mtk_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -162,14 +162,8 @@ static int ehci_fdt_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/mips/mediatek/mtk_ohci.c ============================================================================== --- head/sys/mips/mediatek/mtk_ohci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/mediatek/mtk_ohci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -162,14 +162,8 @@ static int ohci_fdt_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/mips/mediatek/mtk_xhci.c ============================================================================== --- head/sys/mips/mediatek/mtk_xhci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/mediatek/mtk_xhci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -161,14 +161,8 @@ static int mtk_xhci_fdt_detach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/mips/rmi/xls_ehci.c ============================================================================== --- head/sys/mips/rmi/xls_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/rmi/xls_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -164,14 +164,8 @@ static int ehci_xls_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/mips/rt305x/rt305x_dotg.c ============================================================================== --- head/sys/mips/rt305x/rt305x_dotg.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/rt305x/rt305x_dotg.c Mon Oct 17 10:20:38 2016 (r307518) @@ -173,14 +173,8 @@ static int dotg_obio_detach(device_t dev) { struct dwc_otg_softc *sc = device_get_softc(dev); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(dev, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(dev); Modified: head/sys/mips/rt305x/rt305x_ehci.c ============================================================================== --- head/sys/mips/rt305x/rt305x_ehci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/rt305x/rt305x_ehci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -175,14 +175,8 @@ static int ehci_obio_detach(device_t self) { ehci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); Modified: head/sys/mips/rt305x/rt305x_ohci.c ============================================================================== --- head/sys/mips/rt305x/rt305x_ohci.c Mon Oct 17 09:40:18 2016 (r307517) +++ head/sys/mips/rt305x/rt305x_ohci.c Mon Oct 17 10:20:38 2016 (r307518) @@ -175,14 +175,8 @@ static int ohci_obio_detach(device_t self) { ohci_softc_t *sc = device_get_softc(self); - device_t bdev; int err; - if (sc->sc_bus.bdev) { - bdev = sc->sc_bus.bdev; - device_detach(bdev); - device_delete_child(self, bdev); - } /* during module unload there are lots of children leftover */ device_delete_children(self); From owner-svn-src-all@freebsd.org Mon Oct 17 10:21:54 2016 Return-Path: Delivered-To: svn-src-all@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 80539C15B6F; Mon, 17 Oct 2016 10:21:54 +0000 (UTC) (envelope-from br@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 50CD97D2; Mon, 17 Oct 2016 10:21:54 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HALree079649; Mon, 17 Oct 2016 10:21:53 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HALr4T079648; Mon, 17 Oct 2016 10:21:53 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610171021.u9HALr4T079648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 17 Oct 2016 10:21:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307519 - head/bin/pkill/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 10:21:54 -0000 Author: br Date: Mon Oct 17 10:21:53 2016 New Revision: 307519 URL: https://svnweb.freebsd.org/changeset/base/307519 Log: Increase timeout so low-end platforms have a chance to complete test procedures. This fixes operation in QEMU/MIPS64. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/bin/pkill/tests/pgrep-j_test.sh Modified: head/bin/pkill/tests/pgrep-j_test.sh ============================================================================== --- head/bin/pkill/tests/pgrep-j_test.sh Mon Oct 17 10:20:38 2016 (r307518) +++ head/bin/pkill/tests/pgrep-j_test.sh Mon Oct 17 10:21:53 2016 (r307519) @@ -20,12 +20,13 @@ sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep name="pgrep -j " -sleep_amount=5 +sleep_amount=15 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & +sleep 0.5 for i in `seq 1 10`; do jid1=$(jail_name_to_jid ${base}_1_1) From owner-svn-src-all@freebsd.org Mon Oct 17 13:36:51 2016 Return-Path: Delivered-To: svn-src-all@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 518D0C12890; Mon, 17 Oct 2016 13:36:51 +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 20D3E79E; Mon, 17 Oct 2016 13:36:51 +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 u9HDaokJ053344; Mon, 17 Oct 2016 13:36:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HDaora053343; Mon, 17 Oct 2016 13:36:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610171336.u9HDaora053343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 17 Oct 2016 13:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307520 - head/usr.bin/elfdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 13:36:51 -0000 Author: emaste Date: Mon Oct 17 13:36:50 2016 New Revision: 307520 URL: https://svnweb.freebsd.org/changeset/base/307520 Log: elfdump: correct DT_AUXILIARY / DT_USED / DT_FILTER definitions r109332 introduced these three as DT_SUNW_*. Update to the correct names already used elsewhere in FreeBSD and the Sun "Linker and Libraries Guide" MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/elfdump/elfdump.c Modified: head/usr.bin/elfdump/elfdump.c ============================================================================== --- head/usr.bin/elfdump/elfdump.c Mon Oct 17 10:21:53 2016 (r307519) +++ head/usr.bin/elfdump/elfdump.c Mon Oct 17 13:36:50 2016 (r307520) @@ -241,9 +241,9 @@ d_tags(u_int64_t tag) case 0x6ffffff0: return "DT_GNU_VERSYM"; /* 0x70000000 - 0x7fffffff processor-specific semantics */ case 0x70000000: return "DT_IA_64_PLT_RESERVE"; - case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; - case 0x7ffffffe: return "DT_SUNW_USED"; - case 0x7fffffff: return "DT_SUNW_FILTER"; + case DT_AUXILIARY: return "DT_AUXILIARY"; + case DT_USED: return "DT_USED"; + case DT_FILTER: return "DT_FILTER"; } snprintf(unknown_tag, sizeof(unknown_tag), "ERROR: TAG NOT DEFINED -- tag 0x%jx", (uintmax_t)tag); From owner-svn-src-all@freebsd.org Mon Oct 17 13:47:24 2016 Return-Path: Delivered-To: svn-src-all@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 877A9C12F01; Mon, 17 Oct 2016 13:47:24 +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 580CC1CE; Mon, 17 Oct 2016 13:47:24 +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 u9HDlNqX057281; Mon, 17 Oct 2016 13:47:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HDlM3J057269; Mon, 17 Oct 2016 13:47:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610171347.u9HDlM3J057269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 17 Oct 2016 13:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307521 - in head: lib/libmd sys/crypto/sha2 sys/crypto/skein sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 13:47:24 -0000 Author: emaste Date: Mon Oct 17 13:47:22 2016 New Revision: 307521 URL: https://svnweb.freebsd.org/changeset/base/307521 Log: libmd: introduce functions that operate on an fd instead of filename Reviewed by: allanjude, cem MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8264 Modified: head/lib/libmd/md4.h head/lib/libmd/md5.h head/lib/libmd/mdXhl.c head/lib/libmd/ripemd.h head/lib/libmd/sha.h head/sys/crypto/sha2/sha256.h head/sys/crypto/sha2/sha384.h head/sys/crypto/sha2/sha512.h head/sys/crypto/sha2/sha512t.h head/sys/crypto/skein/skein_freebsd.h head/sys/crypto/skein/skein_port.h head/sys/sys/md5.h Modified: head/lib/libmd/md4.h ============================================================================== --- head/lib/libmd/md4.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/lib/libmd/md4.h Mon Oct 17 13:47:22 2016 (r307521) @@ -53,6 +53,12 @@ __BEGIN_DECLS #ifndef MD4End #define MD4End _libmd_MD4End #endif +#ifndef MD4Fd +#define MD4Fd _libmd_MD4Fd +#endif +#ifndef MD4FdChunk +#define MD4FdChunk _libmd_MD4FdChunk +#endif #ifndef MD4File #define MD4File _libmd_MD4File #endif @@ -68,6 +74,8 @@ void MD4Update(MD4_CTX *, const void * void MD4Pad(MD4_CTX *); void MD4Final(unsigned char [16], MD4_CTX *); char * MD4End(MD4_CTX *, char *); +char * MD4Fd(int, char *); +char * MD4FdChunk(int, char *, off_t, off_t); char * MD4File(const char *, char *); char * MD4FileChunk(const char *, char *, off_t, off_t); char * MD4Data(const void *, unsigned int, char *); Modified: head/lib/libmd/md5.h ============================================================================== --- head/lib/libmd/md5.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/lib/libmd/md5.h Mon Oct 17 13:47:22 2016 (r307521) @@ -25,6 +25,12 @@ #ifndef MD5End #define MD5End _libmd_MD5End #endif +#ifndef MD5Fd +#define MD5Fd _libmd_MD5Fd +#endif +#ifndef MD5FdChunk +#define MD5FdChunk _libmd_MD5FdChunk +#endif #ifndef MD5File #define MD5File _libmd_MD5File #endif Modified: head/lib/libmd/mdXhl.c ============================================================================== --- head/lib/libmd/mdXhl.c Mon Oct 17 13:36:50 2016 (r307520) +++ head/lib/libmd/mdXhl.c Mon Oct 17 13:47:22 2016 (r307521) @@ -42,18 +42,18 @@ MDXEnd(MDX_CTX *ctx, char *buf) } char * -MDXFile(const char *filename, char *buf) +MDXFd(int fd, char *buf) { - return (MDXFileChunk(filename, buf, 0, 0)); + return MDXFdChunk(fd, buf, 0, 0); } char * -MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +MDXFdChunk(int fd, char *buf, off_t ofs, off_t len) { unsigned char buffer[16*1024]; MDX_CTX ctx; struct stat stbuf; - int fd, readrv, e; + int readrv, e; off_t remain; if (len < 0) { @@ -62,9 +62,6 @@ MDXFileChunk(const char *filename, char } MDXInit(&ctx); - fd = open(filename, O_RDONLY); - if (fd < 0) - return NULL; if (ofs != 0) { errno = 0; if (lseek(fd, ofs, SEEK_SET) != ofs || @@ -86,15 +83,34 @@ MDXFileChunk(const char *filename, char remain -= readrv; } error: - e = errno; - close(fd); - errno = e; if (readrv < 0) return NULL; return (MDXEnd(&ctx, buf)); } char * +MDXFile(const char *filename, char *buf) +{ + return (MDXFileChunk(filename, buf, 0, 0)); +} + +char * +MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +{ + char *ret; + int e, fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) + return NULL; + ret = MDXFdChunk(fd, buf, ofs, len); + e = errno; + close (fd); + errno = e; + return ret; +} + +char * MDXData (const void *data, unsigned int len, char *buf) { MDX_CTX ctx; Modified: head/lib/libmd/ripemd.h ============================================================================== --- head/lib/libmd/ripemd.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/lib/libmd/ripemd.h Mon Oct 17 13:47:22 2016 (r307521) @@ -96,6 +96,12 @@ __BEGIN_DECLS #ifndef RIPEMD160_End #define RIPEMD160_End _libmd_RIPEMD160_End #endif +#ifndef RIPEMD160_Fd +#define RIPEMD160_Fd _libmd_RIPEMD160_Fd +#endif +#ifndef RIPEMD160_FdChunk +#define RIPEMD160_FdChunk _libmd_RIPEMD160_FdChunk +#endif #ifndef RIPEMD160_File #define RIPEMD160_File _libmd_RIPEMD160_File #endif @@ -121,6 +127,8 @@ void RIPEMD160_Update(RIPEMD160_CTX *c, size_t len); void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); char *RIPEMD160_End(RIPEMD160_CTX *, char *); +char *RIPEMD160_Fd(int, char *); +char *RIPEMD160_FdChunk(int, char *, off_t, off_t); char *RIPEMD160_File(const char *, char *); char *RIPEMD160_FileChunk(const char *, char *, off_t, off_t); char *RIPEMD160_Data(const void *, unsigned int, char *); Modified: head/lib/libmd/sha.h ============================================================================== --- head/lib/libmd/sha.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/lib/libmd/sha.h Mon Oct 17 13:47:22 2016 (r307521) @@ -94,6 +94,12 @@ __BEGIN_DECLS #ifndef SHA_End #define SHA_End _libmd_SHA_End #endif +#ifndef SHA_Fd +#define SHA_Fd _libmd_SHA_Fd +#endif +#ifndef SHA_FdChunk +#define SHA_FdChunk _libmd_SHA_FdChunk +#endif #ifndef SHA_File #define SHA_File _libmd_SHA_File #endif @@ -126,6 +132,12 @@ __BEGIN_DECLS #ifndef SHA1_End #define SHA1_End _libmd_SHA1_End #endif +#ifndef SHA1_Fd +#define SHA1_Fd _libmd_SHA1_Fd +#endif +#ifndef SHA1_FdChunk +#define SHA1_FdChunk _libmd_SHA1_FdChunk +#endif #ifndef SHA1_File #define SHA1_File _libmd_SHA1_File #endif @@ -150,6 +162,8 @@ void SHA_Init(SHA_CTX *c); void SHA_Update(SHA_CTX *c, const void *data, size_t len); void SHA_Final(unsigned char *md, SHA_CTX *c); char *SHA_End(SHA_CTX *, char *); +char *SHA_Fd(int, char *); +char *SHA_FdChunk(int, char *, off_t, off_t); char *SHA_File(const char *, char *); char *SHA_FileChunk(const char *, char *, off_t, off_t); char *SHA_Data(const void *, unsigned int, char *); @@ -158,6 +172,8 @@ void SHA1_Init(SHA_CTX *c); void SHA1_Update(SHA_CTX *c, const void *data, size_t len); void SHA1_Final(unsigned char *md, SHA_CTX *c); char *SHA1_End(SHA_CTX *, char *); +char *SHA1_Fd(int, char *); +char *SHA1_FdChunk(int, char *, off_t, off_t); char *SHA1_File(const char *, char *); char *SHA1_FileChunk(const char *, char *, off_t, off_t); char *SHA1_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/sha2/sha256.h ============================================================================== --- head/sys/crypto/sha2/sha256.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/sys/crypto/sha2/sha256.h Mon Oct 17 13:47:22 2016 (r307521) @@ -59,6 +59,12 @@ __BEGIN_DECLS #ifndef SHA256_End #define SHA256_End _libmd_SHA256_End #endif +#ifndef SHA256_Fd +#define SHA256_Fd _libmd_SHA256_Fd +#endif +#ifndef SHA256_FdChunk +#define SHA256_FdChunk _libmd_SHA256_FdChunk +#endif #ifndef SHA256_File #define SHA256_File _libmd_SHA256_File #endif @@ -82,6 +88,8 @@ void SHA256_Final(unsigned char [static #ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); +char *SHA256_Fd(int, char *); +char *SHA256_FdChunk(int, char *, off_t, off_t); char *SHA256_File(const char *, char *); char *SHA256_FileChunk(const char *, char *, off_t, off_t); #endif Modified: head/sys/crypto/sha2/sha384.h ============================================================================== --- head/sys/crypto/sha2/sha384.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/sys/crypto/sha2/sha384.h Mon Oct 17 13:47:22 2016 (r307521) @@ -58,6 +58,12 @@ __BEGIN_DECLS #ifndef SHA384_End #define SHA384_End _libmd_SHA384_End #endif +#ifndef SHA384_Fd +#define SHA384_Fd _libmd_SHA384_Fd +#endif +#ifndef SHA384_FdChunk +#define SHA384_FdChunk _libmd_SHA384_FdChunk +#endif #ifndef SHA384_File #define SHA384_File _libmd_SHA384_File #endif @@ -78,6 +84,8 @@ void SHA384_Final(unsigned char [static #ifndef _KERNEL char *SHA384_End(SHA384_CTX *, char *); char *SHA384_Data(const void *, unsigned int, char *); +char *SHA384_Fd(int, char *); +char *SHA384_FdChunk(int, char *, off_t, off_t); char *SHA384_File(const char *, char *); char *SHA384_FileChunk(const char *, char *, off_t, off_t); #endif Modified: head/sys/crypto/sha2/sha512.h ============================================================================== --- head/sys/crypto/sha2/sha512.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/sys/crypto/sha2/sha512.h Mon Oct 17 13:47:22 2016 (r307521) @@ -58,6 +58,12 @@ __BEGIN_DECLS #ifndef SHA512_End #define SHA512_End _libmd_SHA512_End #endif +#ifndef SHA512_Fd +#define SHA512_Fd _libmd_SHA512_Fd +#endif +#ifndef SHA512_FdChunk +#define SHA512_FdChunk _libmd_SHA512_FdChunk +#endif #ifndef SHA512_File #define SHA512_File _libmd_SHA512_File #endif @@ -81,6 +87,8 @@ void SHA512_Final(unsigned char [static #ifndef _KERNEL char *SHA512_End(SHA512_CTX *, char *); char *SHA512_Data(const void *, unsigned int, char *); +char *SHA512_Fd(int, char *); +char *SHA512_FdChunk(int, char *, off_t, off_t); char *SHA512_File(const char *, char *); char *SHA512_FileChunk(const char *, char *, off_t, off_t); #endif Modified: head/sys/crypto/sha2/sha512t.h ============================================================================== --- head/sys/crypto/sha2/sha512t.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/sys/crypto/sha2/sha512t.h Mon Oct 17 13:47:22 2016 (r307521) @@ -55,6 +55,12 @@ __BEGIN_DECLS #ifndef SHA512_224_End #define SHA512_224_End _libmd_SHA512_224_End #endif +#ifndef SHA512_224_Fd +#define SHA512_224_Fd _libmd_SHA512_224_Fd +#endif +#ifndef SHA512_224_FdChunk +#define SHA512_224_FdChunk _libmd_SHA512_224_FdChunk +#endif #ifndef SHA512_224_File #define SHA512_224_File _libmd_SHA512_224_File #endif @@ -84,6 +90,12 @@ __BEGIN_DECLS #ifndef SHA512_256_End #define SHA512_256_End _libmd_SHA512_256_End #endif +#ifndef SHA512_256_Fd +#define SHA512_256_Fd _libmd_SHA512_256_Fd +#endif +#ifndef SHA512_256_FdChunk +#define SHA512_256_FdChunk _libmd_SHA512_256_FdChunk +#endif #ifndef SHA512_256_File #define SHA512_256_File _libmd_SHA512_256_File #endif @@ -107,6 +119,8 @@ void SHA512_224_Final(unsigned char [sta #ifndef _KERNEL char *SHA512_224_End(SHA512_CTX *, char *); char *SHA512_224_Data(const void *, unsigned int, char *); +char *SHA512_224_Fd(int, char *); +char *SHA512_224_FdChunk(int, char *, off_t, off_t); char *SHA512_224_File(const char *, char *); char *SHA512_224_FileChunk(const char *, char *, off_t, off_t); #endif @@ -116,6 +130,8 @@ void SHA512_256_Final(unsigned char [sta #ifndef _KERNEL char *SHA512_256_End(SHA512_CTX *, char *); char *SHA512_256_Data(const void *, unsigned int, char *); +char *SHA512_256_Fd(int, char *); +char *SHA512_256_FdChunk(int, char *, off_t, off_t); char *SHA512_256_File(const char *, char *); char *SHA512_256_FileChunk(const char *, char *, off_t, off_t); #endif Modified: head/sys/crypto/skein/skein_freebsd.h ============================================================================== --- head/sys/crypto/skein/skein_freebsd.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/sys/crypto/skein/skein_freebsd.h Mon Oct 17 13:47:22 2016 (r307521) @@ -68,6 +68,12 @@ char *SKEIN1024_End(SKEIN1024_CTX *, c char *SKEIN256_Data(const void *, unsigned int, char *); char *SKEIN512_Data(const void *, unsigned int, char *); char *SKEIN1024_Data(const void *, unsigned int, char *); +char *SKEIN256_Fd(int, char *); +char *SKEIN512_Fd(int, char *); +char *SKEIN1024_Fd(int, char *); +char *SKEIN256_FdChunk(int, char *, off_t, off_t); +char *SKEIN512_FdChunk(int, char *, off_t, off_t); +char *SKEIN1024_FdChunk(int, char *, off_t, off_t); char *SKEIN256_File(const char *, char *); char *SKEIN512_File(const char *, char *); char *SKEIN1024_File(const char *, char *); Modified: head/sys/crypto/skein/skein_port.h ============================================================================== --- head/sys/crypto/skein/skein_port.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/sys/crypto/skein/skein_port.h Mon Oct 17 13:47:22 2016 (r307521) @@ -137,6 +137,16 @@ void Skein_Get64_LSB_First(u64b_t *ds #define SKEIN512_End _libmd_SKEIN512_End #define SKEIN1024_End _libmd_SKEIN1024_End #endif +#ifndef SKEIN256_Fd +#define SKEIN256_Fd _libmd_SKEIN256_Fd +#define SKEIN512_Fd _libmd_SKEIN512_Fd +#define SKEIN1024_Fd _libmd_SKEIN1024_Fd +#endif +#ifndef SKEIN256_FdChunk +#define SKEIN256_FdChunk _libmd_SKEIN256_FdChunk +#define SKEIN512_FdChunk _libmd_SKEIN512_FdChunk +#define SKEIN1024_FdChunk _libmd_SKEIN1024_FdChunk +#endif #ifndef SKEIN256_File #define SKEIN256_File _libmd_SKEIN256_File #define SKEIN512_File _libmd_SKEIN512_File Modified: head/sys/sys/md5.h ============================================================================== --- head/sys/sys/md5.h Mon Oct 17 13:36:50 2016 (r307520) +++ head/sys/sys/md5.h Mon Oct 17 13:47:22 2016 (r307521) @@ -47,6 +47,8 @@ void MD5Update (MD5_CTX *, const void void MD5Final (unsigned char[static MD5_DIGEST_LENGTH], MD5_CTX *); #ifndef _KERNEL char * MD5End(MD5_CTX *, char *); +char * MD5Fd(int, char *); +char * MD5FdChunk(int, char *, off_t, off_t); char * MD5File(const char *, char *); char * MD5FileChunk(const char *, char *, off_t, off_t); char * MD5Data(const void *, unsigned int, char *); From owner-svn-src-all@freebsd.org Mon Oct 17 13:52:25 2016 Return-Path: Delivered-To: svn-src-all@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 55FFAC140C8; Mon, 17 Oct 2016 13:52:25 +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 2856B923; Mon, 17 Oct 2016 13:52:25 +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 u9HDqOs7060769; Mon, 17 Oct 2016 13:52:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HDqOw9060768; Mon, 17 Oct 2016 13:52:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610171352.u9HDqOw9060768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 17 Oct 2016 13:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307522 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 13:52:25 -0000 Author: emaste Date: Mon Oct 17 13:52:24 2016 New Revision: 307522 URL: https://svnweb.freebsd.org/changeset/base/307522 Log: makesyscalls.sh: remove trailing space on the "created from" line In r10905 and r10906 makesyscalls was modified to avoid emitting a literal $Id$ string in the generated file, with: gsub("[$]Id: ", "", $0) gsub(" [$]", "", $0) Then r11294 added some functionality and also tried to address the $Id$ problem in a different way, by removing every $: sed -e 's/\$//g ... This rendered the gsub infeffective. The gsub was later updated to track the $Id$ -> $FreeBSD$ switch, even though it did not do anything. Revert the addition of the s/\$//g, and update the gsub to keep the resulting format the same. Discussed with: bde MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Mon Oct 17 13:47:22 2016 (r307521) +++ head/sys/kern/makesyscalls.sh Mon Oct 17 13:52:24 2016 (r307522) @@ -65,7 +65,6 @@ if [ -n "$2" ]; then fi sed -e ' -s/\$//g :join /\\$/{a\ @@ -147,7 +146,7 @@ s/\$//g printf " * $%s$\n", "FreeBSD" > systrace } NR == 1 { - gsub("[$]FreeBSD: ", "", $0) + gsub("[$]FreeBSD: ", "FreeBSD: ", $0) gsub(" [$]", "", $0) printf " * created from%s\n */\n\n", $0 > syssw From owner-svn-src-all@freebsd.org Mon Oct 17 15:02:19 2016 Return-Path: Delivered-To: svn-src-all@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 332FCC15A8A; Mon, 17 Oct 2016 15:02:19 +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 053EDCA3; Mon, 17 Oct 2016 15:02:18 +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 u9HF2I68087800; Mon, 17 Oct 2016 15:02:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HF2I7L087799; Mon, 17 Oct 2016 15:02:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610171502.u9HF2I7L087799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 17 Oct 2016 15:02:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307523 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 15:02:19 -0000 Author: mav Date: Mon Oct 17 15:02:17 2016 New Revision: 307523 URL: https://svnweb.freebsd.org/changeset/base/307523 Log: Make pass driver better support CAM_CDB_POINTER flag. Previously pass driver just ignored the flag, making random kernel code access user-space pointer, sometime causing crashes even for correctly written applications if user-level context was switched or swapped out. This patch tries to copyin the CDB into kernel space to avoid it. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Mon Oct 17 13:52:24 2016 (r307522) +++ head/sys/cam/scsi/scsi_pass.c Mon Oct 17 15:02:17 2016 (r307523) @@ -1876,6 +1876,18 @@ passdoioctl(struct cdev *dev, u_long cmd break; } + if (ccb->ccb_h.flags & CAM_CDB_POINTER) { + if (ccb->csio.cdb_len > IOCDBLEN) { + error = EINVAL; + break; + } + error = copyin(ccb->csio.cdb_io.cdb_ptr, + ccb->csio.cdb_io.cdb_bytes, ccb->csio.cdb_len); + if (error) + break; + ccb->ccb_h.flags &= ~CAM_CDB_POINTER; + } + /* * Some CCB types, like scan bus and scan lun can only go * through the transport layer device. @@ -2143,6 +2155,7 @@ passsendccb(struct cam_periph *periph, u { struct pass_softc *softc; struct cam_periph_map_info mapinfo; + uint8_t *cmd; xpt_opcode fc; int error; @@ -2154,6 +2167,14 @@ passsendccb(struct cam_periph *periph, u */ xpt_merge_ccb(ccb, inccb); + if (ccb->ccb_h.flags & CAM_CDB_POINTER) { + cmd = __builtin_alloca(ccb->csio.cdb_len); + error = copyin(ccb->csio.cdb_io.cdb_ptr, cmd, ccb->csio.cdb_len); + if (error) + return (error); + ccb->csio.cdb_io.cdb_ptr = cmd; + } + /* */ ccb->ccb_h.cbfcnp = passdone; From owner-svn-src-all@freebsd.org Mon Oct 17 18:04:21 2016 Return-Path: Delivered-To: svn-src-all@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 808DCC15B20; Mon, 17 Oct 2016 18:04:21 +0000 (UTC) (envelope-from davidcs@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 511932E0; Mon, 17 Oct 2016 18:04:21 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HI4KV5057642; Mon, 17 Oct 2016 18:04:20 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HI4K7W057638; Mon, 17 Oct 2016 18:04:20 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201610171804.u9HI4K7W057638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 17 Oct 2016 18:04:20 +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: r307524 - stable/11/sys/dev/qlxgbe X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 18:04:21 -0000 Author: davidcs Date: Mon Oct 17 18:04:19 2016 New Revision: 307524 URL: https://svnweb.freebsd.org/changeset/base/307524 Log: MFC r306790 Add support for adding up to 64 Multicast addresses with a single mailbox command Modified: stable/11/sys/dev/qlxgbe/ql_hw.c stable/11/sys/dev/qlxgbe/ql_hw.h stable/11/sys/dev/qlxgbe/ql_os.c stable/11/sys/dev/qlxgbe/ql_ver.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_hw.c Mon Oct 17 15:02:17 2016 (r307523) +++ stable/11/sys/dev/qlxgbe/ql_hw.c Mon Oct 17 18:04:19 2016 (r307524) @@ -1128,12 +1128,21 @@ qla_config_intr_coalesce(qla_host_t *ha, * Can be unicast, multicast or broadcast. */ static int -qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint32_t add_mac) +qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint32_t add_mac, + uint32_t num_mac) { q80_config_mac_addr_t *cmac; q80_config_mac_addr_rsp_t *cmac_rsp; uint32_t err; device_t dev = ha->pci_dev; + int i; + uint8_t *mac_cpy = mac_addr; + + if (num_mac > Q8_MAX_MAC_ADDRS) { + device_printf(dev, "%s: %s num_mac [0x%x] > Q8_MAX_MAC_ADDRS\n", + __func__, (add_mac ? "Add" : "Del"), num_mac); + return (-1); + } cmac = (q80_config_mac_addr_t *)ha->hw.mbox; bzero(cmac, (sizeof (q80_config_mac_addr_t))); @@ -1149,9 +1158,13 @@ qla_config_mac_addr(qla_host_t *ha, uint cmac->cmd |= Q8_MBX_CMAC_CMD_CAM_INGRESS; - cmac->nmac_entries = 1; + cmac->nmac_entries = num_mac; cmac->cntxt_id = ha->hw.rcv_cntxt_id; - bcopy(mac_addr, cmac->mac_addr[0].addr, 6); + + for (i = 0; i < num_mac; i++) { + bcopy(mac_addr, cmac->mac_addr[i].addr, Q8_ETHER_ADDR_LEN); + mac_addr = mac_addr + ETHER_ADDR_LEN; + } if (qla_mbx_cmd(ha, (uint32_t *)cmac, (sizeof (q80_config_mac_addr_t) >> 2), @@ -1165,11 +1178,14 @@ qla_config_mac_addr(qla_host_t *ha, uint err = Q8_MBX_RSP_STATUS(cmac_rsp->regcnt_status); if (err) { - device_printf(dev, "%s: %s " - "%02x:%02x:%02x:%02x:%02x:%02x failed1 [0x%08x]\n", - __func__, (add_mac ? "Add" : "Del"), - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5], err); + device_printf(dev, "%s: %s failed1 [0x%08x]\n", __func__, + (add_mac ? "Add" : "Del"), err); + for (i = 0; i < num_mac; i++) { + device_printf(dev, "%s: %02x:%02x:%02x:%02x:%02x:%02x\n", + __func__, mac_cpy[0], mac_cpy[1], mac_cpy[2], + mac_cpy[3], mac_cpy[4], mac_cpy[5]); + mac_cpy += ETHER_ADDR_LEN; + } return (-1); } @@ -2254,6 +2270,7 @@ ql_del_hw_if(qla_host_t *ha) (void)qla_stop_nic_func(ha); qla_del_rcv_cntxt(ha); + qla_del_xmt_cntxt(ha); if (ha->hw.flags.init_intr_cnxt) { @@ -2270,6 +2287,7 @@ ql_del_hw_if(qla_host_t *ha) ha->hw.flags.init_intr_cnxt = 0; } + return; } @@ -2368,7 +2386,7 @@ ql_init_hw_if(qla_host_t *ha) } ha->hw.max_tx_segs = 0; - if (qla_config_mac_addr(ha, ha->hw.mac_addr, 1)) + if (qla_config_mac_addr(ha, ha->hw.mac_addr, 1, 1)) return(-1); ha->hw.flags.unicast_mac = 1; @@ -2376,7 +2394,7 @@ ql_init_hw_if(qla_host_t *ha) bcast_mac[0] = 0xFF; bcast_mac[1] = 0xFF; bcast_mac[2] = 0xFF; bcast_mac[3] = 0xFF; bcast_mac[4] = 0xFF; bcast_mac[5] = 0xFF; - if (qla_config_mac_addr(ha, bcast_mac, 1)) + if (qla_config_mac_addr(ha, bcast_mac, 1, 1)) return (-1); ha->hw.flags.bcast_mac = 1; @@ -2733,14 +2751,14 @@ qla_del_rcv_cntxt(qla_host_t *ha) bcast_mac[0] = 0xFF; bcast_mac[1] = 0xFF; bcast_mac[2] = 0xFF; bcast_mac[3] = 0xFF; bcast_mac[4] = 0xFF; bcast_mac[5] = 0xFF; - if (qla_config_mac_addr(ha, bcast_mac, 0)) + if (qla_config_mac_addr(ha, bcast_mac, 0, 1)) return; ha->hw.flags.bcast_mac = 0; } if (ha->hw.flags.unicast_mac) { - if (qla_config_mac_addr(ha, ha->hw.mac_addr, 0)) + if (qla_config_mac_addr(ha, ha->hw.mac_addr, 0, 1)) return; ha->hw.flags.unicast_mac = 0; } @@ -2926,12 +2944,20 @@ qla_init_xmt_cntxt(qla_host_t *ha) } static int -qla_hw_add_all_mcast(qla_host_t *ha) +qla_hw_all_mcast(qla_host_t *ha, uint32_t add_mcast) { int i, nmcast; + uint32_t count = 0; + uint8_t *mcast; nmcast = ha->hw.nmcast; + QL_DPRINT2(ha, (ha->pci_dev, + "%s:[0x%x] enter nmcast = %d \n", __func__, add_mcast, nmcast)); + + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); + for (i = 0 ; ((i < Q8_MAX_NUM_MULTICAST_ADDRS) && nmcast); i++) { if ((ha->hw.mcast[i].addr[0] != 0) || (ha->hw.mcast[i].addr[1] != 0) || @@ -2940,52 +2966,80 @@ qla_hw_add_all_mcast(qla_host_t *ha) (ha->hw.mcast[i].addr[4] != 0) || (ha->hw.mcast[i].addr[5] != 0)) { - if (qla_config_mac_addr(ha, ha->hw.mcast[i].addr, 1)) { - device_printf(ha->pci_dev, "%s: failed\n", - __func__); - return (-1); + bcopy(ha->hw.mcast[i].addr, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + + if (count == Q8_MAX_MAC_ADDRS) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, + add_mcast, count)) { + device_printf(ha->pci_dev, + "%s: failed\n", __func__); + return (-1); + } + + count = 0; + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, + (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); } nmcast--; } } + + if (count) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, add_mcast, + count)) { + device_printf(ha->pci_dev, "%s: failed\n", __func__); + return (-1); + } + } + QL_DPRINT2(ha, (ha->pci_dev, + "%s:[0x%x] exit nmcast = %d \n", __func__, add_mcast, nmcast)); + return 0; } static int -qla_hw_del_all_mcast(qla_host_t *ha) +qla_hw_add_all_mcast(qla_host_t *ha) { - int i, nmcast; + int ret; - nmcast = ha->hw.nmcast; + ret = qla_hw_all_mcast(ha, 1); - for (i = 0 ; ((i < Q8_MAX_NUM_MULTICAST_ADDRS) && nmcast); i++) { - if ((ha->hw.mcast[i].addr[0] != 0) || - (ha->hw.mcast[i].addr[1] != 0) || - (ha->hw.mcast[i].addr[2] != 0) || - (ha->hw.mcast[i].addr[3] != 0) || - (ha->hw.mcast[i].addr[4] != 0) || - (ha->hw.mcast[i].addr[5] != 0)) { + return (ret); +} - if (qla_config_mac_addr(ha, ha->hw.mcast[i].addr, 0)) - return (-1); +static int +qla_hw_del_all_mcast(qla_host_t *ha) +{ + int ret; - nmcast--; - } - } - return 0; + ret = qla_hw_all_mcast(ha, 0); + + bzero(ha->hw.mcast, (sizeof (qla_mcast_t) * Q8_MAX_NUM_MULTICAST_ADDRS)); + ha->hw.nmcast = 0; + + return (ret); } static int -qla_hw_add_mcast(qla_host_t *ha, uint8_t *mta) +qla_hw_mac_addr_present(qla_host_t *ha, uint8_t *mta) { int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { - if (QL_MAC_CMP(ha->hw.mcast[i].addr, mta) == 0) - return 0; /* its been already added */ + return (0); /* its been already added */ } + return (-1); +} + +static int +qla_hw_add_mcast(qla_host_t *ha, uint8_t *mta, uint32_t nmcast) +{ + int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { @@ -2996,29 +3050,28 @@ qla_hw_add_mcast(qla_host_t *ha, uint8_t (ha->hw.mcast[i].addr[4] == 0) && (ha->hw.mcast[i].addr[5] == 0)) { - if (qla_config_mac_addr(ha, mta, 1)) - return (-1); - bcopy(mta, ha->hw.mcast[i].addr, Q8_MAC_ADDR_LEN); ha->hw.nmcast++; - return 0; + mta = mta + ETHER_ADDR_LEN; + nmcast--; + + if (nmcast == 0) + break; } + } return 0; } static int -qla_hw_del_mcast(qla_host_t *ha, uint8_t *mta) +qla_hw_del_mcast(qla_host_t *ha, uint8_t *mta, uint32_t nmcast) { int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { if (QL_MAC_CMP(ha->hw.mcast[i].addr, mta) == 0) { - if (qla_config_mac_addr(ha, mta, 0)) - return (-1); - ha->hw.mcast[i].addr[0] = 0; ha->hw.mcast[i].addr[1] = 0; ha->hw.mcast[i].addr[2] = 0; @@ -3028,7 +3081,11 @@ qla_hw_del_mcast(qla_host_t *ha, uint8_t ha->hw.nmcast--; - return 0; + mta = mta + ETHER_ADDR_LEN; + nmcast--; + + if (nmcast == 0) + break; } } return 0; @@ -3036,30 +3093,75 @@ qla_hw_del_mcast(qla_host_t *ha, uint8_t /* * Name: ql_hw_set_multi - * Function: Sets the Multicast Addresses provided the host O.S into the + * Function: Sets the Multicast Addresses provided by the host O.S into the * hardware (for the given interface) */ int -ql_hw_set_multi(qla_host_t *ha, uint8_t *mcast, uint32_t mcnt, +ql_hw_set_multi(qla_host_t *ha, uint8_t *mcast_addr, uint32_t mcnt, uint32_t add_mac) { + uint8_t *mta = mcast_addr; int i; - uint8_t *mta = mcast; int ret = 0; + uint32_t count = 0; + uint8_t *mcast; + + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); for (i = 0; i < mcnt; i++) { - if (add_mac) { - ret = qla_hw_add_mcast(ha, mta); - if (ret) - break; - } else { - ret = qla_hw_del_mcast(ha, mta); - if (ret) - break; + if (mta[0] || mta[1] || mta[2] || mta[3] || mta[4] || mta[5]) { + if (add_mac) { + if (qla_hw_mac_addr_present(ha, mta) != 0) { + bcopy(mta, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + } + } else { + if (qla_hw_mac_addr_present(ha, mta) == 0) { + bcopy(mta, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + } + } + } + if (count == Q8_MAX_MAC_ADDRS) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, + add_mac, count)) { + device_printf(ha->pci_dev, "%s: failed\n", + __func__); + return (-1); + } + + if (add_mac) { + qla_hw_add_mcast(ha, ha->hw.mac_addr_arr, + count); + } else { + qla_hw_del_mcast(ha, ha->hw.mac_addr_arr, + count); + } + + count = 0; + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); } mta += Q8_MAC_ADDR_LEN; } + + if (count) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, add_mac, + count)) { + device_printf(ha->pci_dev, "%s: failed\n", __func__); + return (-1); + } + if (add_mac) { + qla_hw_add_mcast(ha, ha->hw.mac_addr_arr, count); + } else { + qla_hw_del_mcast(ha, ha->hw.mac_addr_arr, count); + } + } + return (ret); } Modified: stable/11/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_hw.h Mon Oct 17 15:02:17 2016 (r307523) +++ stable/11/sys/dev/qlxgbe/ql_hw.h Mon Oct 17 18:04:19 2016 (r307524) @@ -210,7 +210,7 @@ #define Q8_NUM_MBOX 512 -#define Q8_MAX_NUM_MULTICAST_ADDRS 1023 +#define Q8_MAX_NUM_MULTICAST_ADDRS 1022 #define Q8_MAC_ADDR_LEN 6 /* @@ -511,8 +511,9 @@ typedef struct _q80_config_intr_coalesc_ /* * Configure MAC Address */ +#define Q8_ETHER_ADDR_LEN 6 typedef struct _q80_mac_addr { - uint8_t addr[6]; + uint8_t addr[Q8_ETHER_ADDR_LEN]; uint16_t vlan_tci; } __packed q80_mac_addr_t; @@ -1548,7 +1549,7 @@ typedef struct _qla_hw_tx_cntxt { typedef struct _qla_mcast { uint16_t rsrvd; - uint8_t addr[6]; + uint8_t addr[ETHER_ADDR_LEN]; } __packed qla_mcast_t; typedef struct _qla_rdesc { @@ -1660,6 +1661,7 @@ typedef struct _qla_hw { /* multicast address list */ uint32_t nmcast; qla_mcast_t mcast[Q8_MAX_NUM_MULTICAST_ADDRS]; + uint8_t mac_addr_arr[(Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)]; /* reset sequence */ #define Q8_MAX_RESET_SEQ_IDX 16 Modified: stable/11/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_os.c Mon Oct 17 15:02:17 2016 (r307523) +++ stable/11/sys/dev/qlxgbe/ql_os.c Mon Oct 17 18:04:19 2016 (r307524) @@ -243,6 +243,8 @@ qla_watchdog(void *arg) ha->flags.qla_watchdog_pause = 1; ha->qla_initiate_recovery = 0; ha->err_inject = 0; + device_printf(ha->pci_dev, + "%s: taskqueue_enqueue(err_task) \n", __func__); taskqueue_enqueue(ha->err_tq, &ha->err_task); } else if (ha->flags.qla_interface_up) { @@ -452,7 +454,7 @@ qla_pci_attach(device_t dev) TASK_INIT(&ha->tx_task, 0, qla_tx_done, ha); - ha->tx_tq = taskqueue_create_fast("qla_txq", M_NOWAIT, + ha->tx_tq = taskqueue_create("qla_txq", M_NOWAIT, taskqueue_thread_enqueue, &ha->tx_tq); taskqueue_start_threads(&ha->tx_tq, 1, PI_NET, "%s txq", device_get_nameunit(ha->pci_dev)); @@ -470,13 +472,13 @@ qla_pci_attach(device_t dev) qla_watchdog, ha); TASK_INIT(&ha->err_task, 0, qla_error_recovery, ha); - ha->err_tq = taskqueue_create_fast("qla_errq", M_NOWAIT, + ha->err_tq = taskqueue_create("qla_errq", M_NOWAIT, taskqueue_thread_enqueue, &ha->err_tq); taskqueue_start_threads(&ha->err_tq, 1, PI_NET, "%s errq", device_get_nameunit(ha->pci_dev)); TASK_INIT(&ha->async_event_task, 0, qla_async_event, ha); - ha->async_event_tq = taskqueue_create_fast("qla_asyncq", M_NOWAIT, + ha->async_event_tq = taskqueue_create("qla_asyncq", M_NOWAIT, taskqueue_thread_enqueue, &ha->async_event_tq); taskqueue_start_threads(&ha->async_event_tq, 1, PI_NET, "%s asyncq", device_get_nameunit(ha->pci_dev)); Modified: stable/11/sys/dev/qlxgbe/ql_ver.h ============================================================================== --- stable/11/sys/dev/qlxgbe/ql_ver.h Mon Oct 17 15:02:17 2016 (r307523) +++ stable/11/sys/dev/qlxgbe/ql_ver.h Mon Oct 17 18:04:19 2016 (r307524) @@ -36,6 +36,6 @@ #define QLA_VERSION_MAJOR 3 #define QLA_VERSION_MINOR 10 -#define QLA_VERSION_BUILD 30 +#define QLA_VERSION_BUILD 31 #endif /* #ifndef _QL_VER_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 18:07:53 2016 Return-Path: Delivered-To: svn-src-all@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 9350FC15C02; Mon, 17 Oct 2016 18:07:53 +0000 (UTC) (envelope-from davidcs@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 6140E75E; Mon, 17 Oct 2016 18:07:53 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HI7qAe057810; Mon, 17 Oct 2016 18:07:52 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HI7qjU057806; Mon, 17 Oct 2016 18:07:52 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201610171807.u9HI7qjU057806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 17 Oct 2016 18:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307525 - stable/10/sys/dev/qlxgbe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 18:07:53 -0000 Author: davidcs Date: Mon Oct 17 18:07:51 2016 New Revision: 307525 URL: https://svnweb.freebsd.org/changeset/base/307525 Log: MFC r306790 Add support for adding up to 64 Multicast addresses with a single mailbox command Modified: stable/10/sys/dev/qlxgbe/ql_hw.c stable/10/sys/dev/qlxgbe/ql_hw.h stable/10/sys/dev/qlxgbe/ql_os.c stable/10/sys/dev/qlxgbe/ql_ver.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_hw.c Mon Oct 17 18:04:19 2016 (r307524) +++ stable/10/sys/dev/qlxgbe/ql_hw.c Mon Oct 17 18:07:51 2016 (r307525) @@ -1128,12 +1128,21 @@ qla_config_intr_coalesce(qla_host_t *ha, * Can be unicast, multicast or broadcast. */ static int -qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint32_t add_mac) +qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint32_t add_mac, + uint32_t num_mac) { q80_config_mac_addr_t *cmac; q80_config_mac_addr_rsp_t *cmac_rsp; uint32_t err; device_t dev = ha->pci_dev; + int i; + uint8_t *mac_cpy = mac_addr; + + if (num_mac > Q8_MAX_MAC_ADDRS) { + device_printf(dev, "%s: %s num_mac [0x%x] > Q8_MAX_MAC_ADDRS\n", + __func__, (add_mac ? "Add" : "Del"), num_mac); + return (-1); + } cmac = (q80_config_mac_addr_t *)ha->hw.mbox; bzero(cmac, (sizeof (q80_config_mac_addr_t))); @@ -1149,9 +1158,13 @@ qla_config_mac_addr(qla_host_t *ha, uint cmac->cmd |= Q8_MBX_CMAC_CMD_CAM_INGRESS; - cmac->nmac_entries = 1; + cmac->nmac_entries = num_mac; cmac->cntxt_id = ha->hw.rcv_cntxt_id; - bcopy(mac_addr, cmac->mac_addr[0].addr, 6); + + for (i = 0; i < num_mac; i++) { + bcopy(mac_addr, cmac->mac_addr[i].addr, Q8_ETHER_ADDR_LEN); + mac_addr = mac_addr + ETHER_ADDR_LEN; + } if (qla_mbx_cmd(ha, (uint32_t *)cmac, (sizeof (q80_config_mac_addr_t) >> 2), @@ -1165,11 +1178,14 @@ qla_config_mac_addr(qla_host_t *ha, uint err = Q8_MBX_RSP_STATUS(cmac_rsp->regcnt_status); if (err) { - device_printf(dev, "%s: %s " - "%02x:%02x:%02x:%02x:%02x:%02x failed1 [0x%08x]\n", - __func__, (add_mac ? "Add" : "Del"), - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5], err); + device_printf(dev, "%s: %s failed1 [0x%08x]\n", __func__, + (add_mac ? "Add" : "Del"), err); + for (i = 0; i < num_mac; i++) { + device_printf(dev, "%s: %02x:%02x:%02x:%02x:%02x:%02x\n", + __func__, mac_cpy[0], mac_cpy[1], mac_cpy[2], + mac_cpy[3], mac_cpy[4], mac_cpy[5]); + mac_cpy += ETHER_ADDR_LEN; + } return (-1); } @@ -2254,6 +2270,7 @@ ql_del_hw_if(qla_host_t *ha) (void)qla_stop_nic_func(ha); qla_del_rcv_cntxt(ha); + qla_del_xmt_cntxt(ha); if (ha->hw.flags.init_intr_cnxt) { @@ -2270,6 +2287,7 @@ ql_del_hw_if(qla_host_t *ha) ha->hw.flags.init_intr_cnxt = 0; } + return; } @@ -2368,7 +2386,7 @@ ql_init_hw_if(qla_host_t *ha) } ha->hw.max_tx_segs = 0; - if (qla_config_mac_addr(ha, ha->hw.mac_addr, 1)) + if (qla_config_mac_addr(ha, ha->hw.mac_addr, 1, 1)) return(-1); ha->hw.flags.unicast_mac = 1; @@ -2376,7 +2394,7 @@ ql_init_hw_if(qla_host_t *ha) bcast_mac[0] = 0xFF; bcast_mac[1] = 0xFF; bcast_mac[2] = 0xFF; bcast_mac[3] = 0xFF; bcast_mac[4] = 0xFF; bcast_mac[5] = 0xFF; - if (qla_config_mac_addr(ha, bcast_mac, 1)) + if (qla_config_mac_addr(ha, bcast_mac, 1, 1)) return (-1); ha->hw.flags.bcast_mac = 1; @@ -2733,14 +2751,14 @@ qla_del_rcv_cntxt(qla_host_t *ha) bcast_mac[0] = 0xFF; bcast_mac[1] = 0xFF; bcast_mac[2] = 0xFF; bcast_mac[3] = 0xFF; bcast_mac[4] = 0xFF; bcast_mac[5] = 0xFF; - if (qla_config_mac_addr(ha, bcast_mac, 0)) + if (qla_config_mac_addr(ha, bcast_mac, 0, 1)) return; ha->hw.flags.bcast_mac = 0; } if (ha->hw.flags.unicast_mac) { - if (qla_config_mac_addr(ha, ha->hw.mac_addr, 0)) + if (qla_config_mac_addr(ha, ha->hw.mac_addr, 0, 1)) return; ha->hw.flags.unicast_mac = 0; } @@ -2926,12 +2944,20 @@ qla_init_xmt_cntxt(qla_host_t *ha) } static int -qla_hw_add_all_mcast(qla_host_t *ha) +qla_hw_all_mcast(qla_host_t *ha, uint32_t add_mcast) { int i, nmcast; + uint32_t count = 0; + uint8_t *mcast; nmcast = ha->hw.nmcast; + QL_DPRINT2(ha, (ha->pci_dev, + "%s:[0x%x] enter nmcast = %d \n", __func__, add_mcast, nmcast)); + + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); + for (i = 0 ; ((i < Q8_MAX_NUM_MULTICAST_ADDRS) && nmcast); i++) { if ((ha->hw.mcast[i].addr[0] != 0) || (ha->hw.mcast[i].addr[1] != 0) || @@ -2940,52 +2966,80 @@ qla_hw_add_all_mcast(qla_host_t *ha) (ha->hw.mcast[i].addr[4] != 0) || (ha->hw.mcast[i].addr[5] != 0)) { - if (qla_config_mac_addr(ha, ha->hw.mcast[i].addr, 1)) { - device_printf(ha->pci_dev, "%s: failed\n", - __func__); - return (-1); + bcopy(ha->hw.mcast[i].addr, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + + if (count == Q8_MAX_MAC_ADDRS) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, + add_mcast, count)) { + device_printf(ha->pci_dev, + "%s: failed\n", __func__); + return (-1); + } + + count = 0; + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, + (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); } nmcast--; } } + + if (count) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, add_mcast, + count)) { + device_printf(ha->pci_dev, "%s: failed\n", __func__); + return (-1); + } + } + QL_DPRINT2(ha, (ha->pci_dev, + "%s:[0x%x] exit nmcast = %d \n", __func__, add_mcast, nmcast)); + return 0; } static int -qla_hw_del_all_mcast(qla_host_t *ha) +qla_hw_add_all_mcast(qla_host_t *ha) { - int i, nmcast; + int ret; - nmcast = ha->hw.nmcast; + ret = qla_hw_all_mcast(ha, 1); - for (i = 0 ; ((i < Q8_MAX_NUM_MULTICAST_ADDRS) && nmcast); i++) { - if ((ha->hw.mcast[i].addr[0] != 0) || - (ha->hw.mcast[i].addr[1] != 0) || - (ha->hw.mcast[i].addr[2] != 0) || - (ha->hw.mcast[i].addr[3] != 0) || - (ha->hw.mcast[i].addr[4] != 0) || - (ha->hw.mcast[i].addr[5] != 0)) { + return (ret); +} - if (qla_config_mac_addr(ha, ha->hw.mcast[i].addr, 0)) - return (-1); +static int +qla_hw_del_all_mcast(qla_host_t *ha) +{ + int ret; - nmcast--; - } - } - return 0; + ret = qla_hw_all_mcast(ha, 0); + + bzero(ha->hw.mcast, (sizeof (qla_mcast_t) * Q8_MAX_NUM_MULTICAST_ADDRS)); + ha->hw.nmcast = 0; + + return (ret); } static int -qla_hw_add_mcast(qla_host_t *ha, uint8_t *mta) +qla_hw_mac_addr_present(qla_host_t *ha, uint8_t *mta) { int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { - if (QL_MAC_CMP(ha->hw.mcast[i].addr, mta) == 0) - return 0; /* its been already added */ + return (0); /* its been already added */ } + return (-1); +} + +static int +qla_hw_add_mcast(qla_host_t *ha, uint8_t *mta, uint32_t nmcast) +{ + int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { @@ -2996,29 +3050,28 @@ qla_hw_add_mcast(qla_host_t *ha, uint8_t (ha->hw.mcast[i].addr[4] == 0) && (ha->hw.mcast[i].addr[5] == 0)) { - if (qla_config_mac_addr(ha, mta, 1)) - return (-1); - bcopy(mta, ha->hw.mcast[i].addr, Q8_MAC_ADDR_LEN); ha->hw.nmcast++; - return 0; + mta = mta + ETHER_ADDR_LEN; + nmcast--; + + if (nmcast == 0) + break; } + } return 0; } static int -qla_hw_del_mcast(qla_host_t *ha, uint8_t *mta) +qla_hw_del_mcast(qla_host_t *ha, uint8_t *mta, uint32_t nmcast) { int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { if (QL_MAC_CMP(ha->hw.mcast[i].addr, mta) == 0) { - if (qla_config_mac_addr(ha, mta, 0)) - return (-1); - ha->hw.mcast[i].addr[0] = 0; ha->hw.mcast[i].addr[1] = 0; ha->hw.mcast[i].addr[2] = 0; @@ -3028,7 +3081,11 @@ qla_hw_del_mcast(qla_host_t *ha, uint8_t ha->hw.nmcast--; - return 0; + mta = mta + ETHER_ADDR_LEN; + nmcast--; + + if (nmcast == 0) + break; } } return 0; @@ -3036,30 +3093,75 @@ qla_hw_del_mcast(qla_host_t *ha, uint8_t /* * Name: ql_hw_set_multi - * Function: Sets the Multicast Addresses provided the host O.S into the + * Function: Sets the Multicast Addresses provided by the host O.S into the * hardware (for the given interface) */ int -ql_hw_set_multi(qla_host_t *ha, uint8_t *mcast, uint32_t mcnt, +ql_hw_set_multi(qla_host_t *ha, uint8_t *mcast_addr, uint32_t mcnt, uint32_t add_mac) { + uint8_t *mta = mcast_addr; int i; - uint8_t *mta = mcast; int ret = 0; + uint32_t count = 0; + uint8_t *mcast; + + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); for (i = 0; i < mcnt; i++) { - if (add_mac) { - ret = qla_hw_add_mcast(ha, mta); - if (ret) - break; - } else { - ret = qla_hw_del_mcast(ha, mta); - if (ret) - break; + if (mta[0] || mta[1] || mta[2] || mta[3] || mta[4] || mta[5]) { + if (add_mac) { + if (qla_hw_mac_addr_present(ha, mta) != 0) { + bcopy(mta, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + } + } else { + if (qla_hw_mac_addr_present(ha, mta) == 0) { + bcopy(mta, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + } + } + } + if (count == Q8_MAX_MAC_ADDRS) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, + add_mac, count)) { + device_printf(ha->pci_dev, "%s: failed\n", + __func__); + return (-1); + } + + if (add_mac) { + qla_hw_add_mcast(ha, ha->hw.mac_addr_arr, + count); + } else { + qla_hw_del_mcast(ha, ha->hw.mac_addr_arr, + count); + } + + count = 0; + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); } mta += Q8_MAC_ADDR_LEN; } + + if (count) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, add_mac, + count)) { + device_printf(ha->pci_dev, "%s: failed\n", __func__); + return (-1); + } + if (add_mac) { + qla_hw_add_mcast(ha, ha->hw.mac_addr_arr, count); + } else { + qla_hw_del_mcast(ha, ha->hw.mac_addr_arr, count); + } + } + return (ret); } Modified: stable/10/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_hw.h Mon Oct 17 18:04:19 2016 (r307524) +++ stable/10/sys/dev/qlxgbe/ql_hw.h Mon Oct 17 18:07:51 2016 (r307525) @@ -210,7 +210,7 @@ #define Q8_NUM_MBOX 512 -#define Q8_MAX_NUM_MULTICAST_ADDRS 1023 +#define Q8_MAX_NUM_MULTICAST_ADDRS 1022 #define Q8_MAC_ADDR_LEN 6 /* @@ -511,8 +511,9 @@ typedef struct _q80_config_intr_coalesc_ /* * Configure MAC Address */ +#define Q8_ETHER_ADDR_LEN 6 typedef struct _q80_mac_addr { - uint8_t addr[6]; + uint8_t addr[Q8_ETHER_ADDR_LEN]; uint16_t vlan_tci; } __packed q80_mac_addr_t; @@ -1548,7 +1549,7 @@ typedef struct _qla_hw_tx_cntxt { typedef struct _qla_mcast { uint16_t rsrvd; - uint8_t addr[6]; + uint8_t addr[ETHER_ADDR_LEN]; } __packed qla_mcast_t; typedef struct _qla_rdesc { @@ -1660,6 +1661,7 @@ typedef struct _qla_hw { /* multicast address list */ uint32_t nmcast; qla_mcast_t mcast[Q8_MAX_NUM_MULTICAST_ADDRS]; + uint8_t mac_addr_arr[(Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)]; /* reset sequence */ #define Q8_MAX_RESET_SEQ_IDX 16 Modified: stable/10/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_os.c Mon Oct 17 18:04:19 2016 (r307524) +++ stable/10/sys/dev/qlxgbe/ql_os.c Mon Oct 17 18:07:51 2016 (r307525) @@ -243,6 +243,8 @@ qla_watchdog(void *arg) ha->flags.qla_watchdog_pause = 1; ha->qla_initiate_recovery = 0; ha->err_inject = 0; + device_printf(ha->pci_dev, + "%s: taskqueue_enqueue(err_task) \n", __func__); taskqueue_enqueue(ha->err_tq, &ha->err_task); } else if (ha->flags.qla_interface_up) { @@ -452,7 +454,7 @@ qla_pci_attach(device_t dev) TASK_INIT(&ha->tx_task, 0, qla_tx_done, ha); - ha->tx_tq = taskqueue_create_fast("qla_txq", M_NOWAIT, + ha->tx_tq = taskqueue_create("qla_txq", M_NOWAIT, taskqueue_thread_enqueue, &ha->tx_tq); taskqueue_start_threads(&ha->tx_tq, 1, PI_NET, "%s txq", device_get_nameunit(ha->pci_dev)); @@ -470,13 +472,13 @@ qla_pci_attach(device_t dev) qla_watchdog, ha); TASK_INIT(&ha->err_task, 0, qla_error_recovery, ha); - ha->err_tq = taskqueue_create_fast("qla_errq", M_NOWAIT, + ha->err_tq = taskqueue_create("qla_errq", M_NOWAIT, taskqueue_thread_enqueue, &ha->err_tq); taskqueue_start_threads(&ha->err_tq, 1, PI_NET, "%s errq", device_get_nameunit(ha->pci_dev)); TASK_INIT(&ha->async_event_task, 0, qla_async_event, ha); - ha->async_event_tq = taskqueue_create_fast("qla_asyncq", M_NOWAIT, + ha->async_event_tq = taskqueue_create("qla_asyncq", M_NOWAIT, taskqueue_thread_enqueue, &ha->async_event_tq); taskqueue_start_threads(&ha->async_event_tq, 1, PI_NET, "%s asyncq", device_get_nameunit(ha->pci_dev)); Modified: stable/10/sys/dev/qlxgbe/ql_ver.h ============================================================================== --- stable/10/sys/dev/qlxgbe/ql_ver.h Mon Oct 17 18:04:19 2016 (r307524) +++ stable/10/sys/dev/qlxgbe/ql_ver.h Mon Oct 17 18:07:51 2016 (r307525) @@ -36,6 +36,6 @@ #define QLA_VERSION_MAJOR 3 #define QLA_VERSION_MINOR 10 -#define QLA_VERSION_BUILD 30 +#define QLA_VERSION_BUILD 31 #endif /* #ifndef _QL_VER_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 18:14:33 2016 Return-Path: Delivered-To: svn-src-all@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 1B090C15F20; Mon, 17 Oct 2016 18:14:33 +0000 (UTC) (envelope-from davidcs@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 DFD01F02; Mon, 17 Oct 2016 18:14:32 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HIEW7o061764; Mon, 17 Oct 2016 18:14:32 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HIEVnq061760; Mon, 17 Oct 2016 18:14:31 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201610171814.u9HIEVnq061760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Mon, 17 Oct 2016 18:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r307526 - stable/9/sys/dev/qlxgbe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 18:14:33 -0000 Author: davidcs Date: Mon Oct 17 18:14:31 2016 New Revision: 307526 URL: https://svnweb.freebsd.org/changeset/base/307526 Log: MFC r306790 Add support for adding up to 64 Multicast addresses with a single mailbox command Modified: stable/9/sys/dev/qlxgbe/ql_hw.c stable/9/sys/dev/qlxgbe/ql_hw.h stable/9/sys/dev/qlxgbe/ql_os.c stable/9/sys/dev/qlxgbe/ql_ver.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_hw.c Mon Oct 17 18:07:51 2016 (r307525) +++ stable/9/sys/dev/qlxgbe/ql_hw.c Mon Oct 17 18:14:31 2016 (r307526) @@ -1128,12 +1128,21 @@ qla_config_intr_coalesce(qla_host_t *ha, * Can be unicast, multicast or broadcast. */ static int -qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint32_t add_mac) +qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint32_t add_mac, + uint32_t num_mac) { q80_config_mac_addr_t *cmac; q80_config_mac_addr_rsp_t *cmac_rsp; uint32_t err; device_t dev = ha->pci_dev; + int i; + uint8_t *mac_cpy = mac_addr; + + if (num_mac > Q8_MAX_MAC_ADDRS) { + device_printf(dev, "%s: %s num_mac [0x%x] > Q8_MAX_MAC_ADDRS\n", + __func__, (add_mac ? "Add" : "Del"), num_mac); + return (-1); + } cmac = (q80_config_mac_addr_t *)ha->hw.mbox; bzero(cmac, (sizeof (q80_config_mac_addr_t))); @@ -1149,9 +1158,13 @@ qla_config_mac_addr(qla_host_t *ha, uint cmac->cmd |= Q8_MBX_CMAC_CMD_CAM_INGRESS; - cmac->nmac_entries = 1; + cmac->nmac_entries = num_mac; cmac->cntxt_id = ha->hw.rcv_cntxt_id; - bcopy(mac_addr, cmac->mac_addr[0].addr, 6); + + for (i = 0; i < num_mac; i++) { + bcopy(mac_addr, cmac->mac_addr[i].addr, Q8_ETHER_ADDR_LEN); + mac_addr = mac_addr + ETHER_ADDR_LEN; + } if (qla_mbx_cmd(ha, (uint32_t *)cmac, (sizeof (q80_config_mac_addr_t) >> 2), @@ -1165,11 +1178,14 @@ qla_config_mac_addr(qla_host_t *ha, uint err = Q8_MBX_RSP_STATUS(cmac_rsp->regcnt_status); if (err) { - device_printf(dev, "%s: %s " - "%02x:%02x:%02x:%02x:%02x:%02x failed1 [0x%08x]\n", - __func__, (add_mac ? "Add" : "Del"), - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5], err); + device_printf(dev, "%s: %s failed1 [0x%08x]\n", __func__, + (add_mac ? "Add" : "Del"), err); + for (i = 0; i < num_mac; i++) { + device_printf(dev, "%s: %02x:%02x:%02x:%02x:%02x:%02x\n", + __func__, mac_cpy[0], mac_cpy[1], mac_cpy[2], + mac_cpy[3], mac_cpy[4], mac_cpy[5]); + mac_cpy += ETHER_ADDR_LEN; + } return (-1); } @@ -2254,6 +2270,7 @@ ql_del_hw_if(qla_host_t *ha) (void)qla_stop_nic_func(ha); qla_del_rcv_cntxt(ha); + qla_del_xmt_cntxt(ha); if (ha->hw.flags.init_intr_cnxt) { @@ -2270,6 +2287,7 @@ ql_del_hw_if(qla_host_t *ha) ha->hw.flags.init_intr_cnxt = 0; } + return; } @@ -2368,7 +2386,7 @@ ql_init_hw_if(qla_host_t *ha) } ha->hw.max_tx_segs = 0; - if (qla_config_mac_addr(ha, ha->hw.mac_addr, 1)) + if (qla_config_mac_addr(ha, ha->hw.mac_addr, 1, 1)) return(-1); ha->hw.flags.unicast_mac = 1; @@ -2376,7 +2394,7 @@ ql_init_hw_if(qla_host_t *ha) bcast_mac[0] = 0xFF; bcast_mac[1] = 0xFF; bcast_mac[2] = 0xFF; bcast_mac[3] = 0xFF; bcast_mac[4] = 0xFF; bcast_mac[5] = 0xFF; - if (qla_config_mac_addr(ha, bcast_mac, 1)) + if (qla_config_mac_addr(ha, bcast_mac, 1, 1)) return (-1); ha->hw.flags.bcast_mac = 1; @@ -2733,14 +2751,14 @@ qla_del_rcv_cntxt(qla_host_t *ha) bcast_mac[0] = 0xFF; bcast_mac[1] = 0xFF; bcast_mac[2] = 0xFF; bcast_mac[3] = 0xFF; bcast_mac[4] = 0xFF; bcast_mac[5] = 0xFF; - if (qla_config_mac_addr(ha, bcast_mac, 0)) + if (qla_config_mac_addr(ha, bcast_mac, 0, 1)) return; ha->hw.flags.bcast_mac = 0; } if (ha->hw.flags.unicast_mac) { - if (qla_config_mac_addr(ha, ha->hw.mac_addr, 0)) + if (qla_config_mac_addr(ha, ha->hw.mac_addr, 0, 1)) return; ha->hw.flags.unicast_mac = 0; } @@ -2926,12 +2944,20 @@ qla_init_xmt_cntxt(qla_host_t *ha) } static int -qla_hw_add_all_mcast(qla_host_t *ha) +qla_hw_all_mcast(qla_host_t *ha, uint32_t add_mcast) { int i, nmcast; + uint32_t count = 0; + uint8_t *mcast; nmcast = ha->hw.nmcast; + QL_DPRINT2(ha, (ha->pci_dev, + "%s:[0x%x] enter nmcast = %d \n", __func__, add_mcast, nmcast)); + + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); + for (i = 0 ; ((i < Q8_MAX_NUM_MULTICAST_ADDRS) && nmcast); i++) { if ((ha->hw.mcast[i].addr[0] != 0) || (ha->hw.mcast[i].addr[1] != 0) || @@ -2940,52 +2966,80 @@ qla_hw_add_all_mcast(qla_host_t *ha) (ha->hw.mcast[i].addr[4] != 0) || (ha->hw.mcast[i].addr[5] != 0)) { - if (qla_config_mac_addr(ha, ha->hw.mcast[i].addr, 1)) { - device_printf(ha->pci_dev, "%s: failed\n", - __func__); - return (-1); + bcopy(ha->hw.mcast[i].addr, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + + if (count == Q8_MAX_MAC_ADDRS) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, + add_mcast, count)) { + device_printf(ha->pci_dev, + "%s: failed\n", __func__); + return (-1); + } + + count = 0; + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, + (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); } nmcast--; } } + + if (count) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, add_mcast, + count)) { + device_printf(ha->pci_dev, "%s: failed\n", __func__); + return (-1); + } + } + QL_DPRINT2(ha, (ha->pci_dev, + "%s:[0x%x] exit nmcast = %d \n", __func__, add_mcast, nmcast)); + return 0; } static int -qla_hw_del_all_mcast(qla_host_t *ha) +qla_hw_add_all_mcast(qla_host_t *ha) { - int i, nmcast; + int ret; - nmcast = ha->hw.nmcast; + ret = qla_hw_all_mcast(ha, 1); - for (i = 0 ; ((i < Q8_MAX_NUM_MULTICAST_ADDRS) && nmcast); i++) { - if ((ha->hw.mcast[i].addr[0] != 0) || - (ha->hw.mcast[i].addr[1] != 0) || - (ha->hw.mcast[i].addr[2] != 0) || - (ha->hw.mcast[i].addr[3] != 0) || - (ha->hw.mcast[i].addr[4] != 0) || - (ha->hw.mcast[i].addr[5] != 0)) { + return (ret); +} - if (qla_config_mac_addr(ha, ha->hw.mcast[i].addr, 0)) - return (-1); +static int +qla_hw_del_all_mcast(qla_host_t *ha) +{ + int ret; - nmcast--; - } - } - return 0; + ret = qla_hw_all_mcast(ha, 0); + + bzero(ha->hw.mcast, (sizeof (qla_mcast_t) * Q8_MAX_NUM_MULTICAST_ADDRS)); + ha->hw.nmcast = 0; + + return (ret); } static int -qla_hw_add_mcast(qla_host_t *ha, uint8_t *mta) +qla_hw_mac_addr_present(qla_host_t *ha, uint8_t *mta) { int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { - if (QL_MAC_CMP(ha->hw.mcast[i].addr, mta) == 0) - return 0; /* its been already added */ + return (0); /* its been already added */ } + return (-1); +} + +static int +qla_hw_add_mcast(qla_host_t *ha, uint8_t *mta, uint32_t nmcast) +{ + int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { @@ -2996,29 +3050,28 @@ qla_hw_add_mcast(qla_host_t *ha, uint8_t (ha->hw.mcast[i].addr[4] == 0) && (ha->hw.mcast[i].addr[5] == 0)) { - if (qla_config_mac_addr(ha, mta, 1)) - return (-1); - bcopy(mta, ha->hw.mcast[i].addr, Q8_MAC_ADDR_LEN); ha->hw.nmcast++; - return 0; + mta = mta + ETHER_ADDR_LEN; + nmcast--; + + if (nmcast == 0) + break; } + } return 0; } static int -qla_hw_del_mcast(qla_host_t *ha, uint8_t *mta) +qla_hw_del_mcast(qla_host_t *ha, uint8_t *mta, uint32_t nmcast) { int i; for (i = 0; i < Q8_MAX_NUM_MULTICAST_ADDRS; i++) { if (QL_MAC_CMP(ha->hw.mcast[i].addr, mta) == 0) { - if (qla_config_mac_addr(ha, mta, 0)) - return (-1); - ha->hw.mcast[i].addr[0] = 0; ha->hw.mcast[i].addr[1] = 0; ha->hw.mcast[i].addr[2] = 0; @@ -3028,7 +3081,11 @@ qla_hw_del_mcast(qla_host_t *ha, uint8_t ha->hw.nmcast--; - return 0; + mta = mta + ETHER_ADDR_LEN; + nmcast--; + + if (nmcast == 0) + break; } } return 0; @@ -3036,30 +3093,75 @@ qla_hw_del_mcast(qla_host_t *ha, uint8_t /* * Name: ql_hw_set_multi - * Function: Sets the Multicast Addresses provided the host O.S into the + * Function: Sets the Multicast Addresses provided by the host O.S into the * hardware (for the given interface) */ int -ql_hw_set_multi(qla_host_t *ha, uint8_t *mcast, uint32_t mcnt, +ql_hw_set_multi(qla_host_t *ha, uint8_t *mcast_addr, uint32_t mcnt, uint32_t add_mac) { + uint8_t *mta = mcast_addr; int i; - uint8_t *mta = mcast; int ret = 0; + uint32_t count = 0; + uint8_t *mcast; + + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); for (i = 0; i < mcnt; i++) { - if (add_mac) { - ret = qla_hw_add_mcast(ha, mta); - if (ret) - break; - } else { - ret = qla_hw_del_mcast(ha, mta); - if (ret) - break; + if (mta[0] || mta[1] || mta[2] || mta[3] || mta[4] || mta[5]) { + if (add_mac) { + if (qla_hw_mac_addr_present(ha, mta) != 0) { + bcopy(mta, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + } + } else { + if (qla_hw_mac_addr_present(ha, mta) == 0) { + bcopy(mta, mcast, ETHER_ADDR_LEN); + mcast = mcast + ETHER_ADDR_LEN; + count++; + } + } + } + if (count == Q8_MAX_MAC_ADDRS) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, + add_mac, count)) { + device_printf(ha->pci_dev, "%s: failed\n", + __func__); + return (-1); + } + + if (add_mac) { + qla_hw_add_mcast(ha, ha->hw.mac_addr_arr, + count); + } else { + qla_hw_del_mcast(ha, ha->hw.mac_addr_arr, + count); + } + + count = 0; + mcast = ha->hw.mac_addr_arr; + memset(mcast, 0, (Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)); } mta += Q8_MAC_ADDR_LEN; } + + if (count) { + if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, add_mac, + count)) { + device_printf(ha->pci_dev, "%s: failed\n", __func__); + return (-1); + } + if (add_mac) { + qla_hw_add_mcast(ha, ha->hw.mac_addr_arr, count); + } else { + qla_hw_del_mcast(ha, ha->hw.mac_addr_arr, count); + } + } + return (ret); } Modified: stable/9/sys/dev/qlxgbe/ql_hw.h ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_hw.h Mon Oct 17 18:07:51 2016 (r307525) +++ stable/9/sys/dev/qlxgbe/ql_hw.h Mon Oct 17 18:14:31 2016 (r307526) @@ -210,7 +210,7 @@ #define Q8_NUM_MBOX 512 -#define Q8_MAX_NUM_MULTICAST_ADDRS 1023 +#define Q8_MAX_NUM_MULTICAST_ADDRS 1022 #define Q8_MAC_ADDR_LEN 6 /* @@ -511,8 +511,9 @@ typedef struct _q80_config_intr_coalesc_ /* * Configure MAC Address */ +#define Q8_ETHER_ADDR_LEN 6 typedef struct _q80_mac_addr { - uint8_t addr[6]; + uint8_t addr[Q8_ETHER_ADDR_LEN]; uint16_t vlan_tci; } __packed q80_mac_addr_t; @@ -1548,7 +1549,7 @@ typedef struct _qla_hw_tx_cntxt { typedef struct _qla_mcast { uint16_t rsrvd; - uint8_t addr[6]; + uint8_t addr[ETHER_ADDR_LEN]; } __packed qla_mcast_t; typedef struct _qla_rdesc { @@ -1660,6 +1661,7 @@ typedef struct _qla_hw { /* multicast address list */ uint32_t nmcast; qla_mcast_t mcast[Q8_MAX_NUM_MULTICAST_ADDRS]; + uint8_t mac_addr_arr[(Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)]; /* reset sequence */ #define Q8_MAX_RESET_SEQ_IDX 16 Modified: stable/9/sys/dev/qlxgbe/ql_os.c ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_os.c Mon Oct 17 18:07:51 2016 (r307525) +++ stable/9/sys/dev/qlxgbe/ql_os.c Mon Oct 17 18:14:31 2016 (r307526) @@ -243,6 +243,8 @@ qla_watchdog(void *arg) ha->flags.qla_watchdog_pause = 1; ha->qla_initiate_recovery = 0; ha->err_inject = 0; + device_printf(ha->pci_dev, + "%s: taskqueue_enqueue(err_task) \n", __func__); taskqueue_enqueue(ha->err_tq, &ha->err_task); } else if (ha->flags.qla_interface_up) { @@ -452,7 +454,7 @@ qla_pci_attach(device_t dev) TASK_INIT(&ha->tx_task, 0, qla_tx_done, ha); - ha->tx_tq = taskqueue_create_fast("qla_txq", M_NOWAIT, + ha->tx_tq = taskqueue_create("qla_txq", M_NOWAIT, taskqueue_thread_enqueue, &ha->tx_tq); taskqueue_start_threads(&ha->tx_tq, 1, PI_NET, "%s txq", device_get_nameunit(ha->pci_dev)); @@ -470,13 +472,13 @@ qla_pci_attach(device_t dev) qla_watchdog, ha); TASK_INIT(&ha->err_task, 0, qla_error_recovery, ha); - ha->err_tq = taskqueue_create_fast("qla_errq", M_NOWAIT, + ha->err_tq = taskqueue_create("qla_errq", M_NOWAIT, taskqueue_thread_enqueue, &ha->err_tq); taskqueue_start_threads(&ha->err_tq, 1, PI_NET, "%s errq", device_get_nameunit(ha->pci_dev)); TASK_INIT(&ha->async_event_task, 0, qla_async_event, ha); - ha->async_event_tq = taskqueue_create_fast("qla_asyncq", M_NOWAIT, + ha->async_event_tq = taskqueue_create("qla_asyncq", M_NOWAIT, taskqueue_thread_enqueue, &ha->async_event_tq); taskqueue_start_threads(&ha->async_event_tq, 1, PI_NET, "%s asyncq", device_get_nameunit(ha->pci_dev)); Modified: stable/9/sys/dev/qlxgbe/ql_ver.h ============================================================================== --- stable/9/sys/dev/qlxgbe/ql_ver.h Mon Oct 17 18:07:51 2016 (r307525) +++ stable/9/sys/dev/qlxgbe/ql_ver.h Mon Oct 17 18:14:31 2016 (r307526) @@ -36,6 +36,6 @@ #define QLA_VERSION_MAJOR 3 #define QLA_VERSION_MINOR 10 -#define QLA_VERSION_BUILD 30 +#define QLA_VERSION_BUILD 31 #endif /* #ifndef _QL_VER_H_ */ From owner-svn-src-all@freebsd.org Mon Oct 17 18:20:05 2016 Return-Path: Delivered-To: svn-src-all@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 C731EC16059; Mon, 17 Oct 2016 18:20:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9146812EA; Mon, 17 Oct 2016 18:20:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 8B0D610AF7E; Mon, 17 Oct 2016 14:20:03 -0400 (EDT) From: John Baldwin To: Warner Losh Cc: Doug Ambrisko , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Doug Ambrisko , Ravi Pokala Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader Date: Mon, 17 Oct 2016 10:40:53 -0700 Message-ID: <1950201.IjTl3rpdGP@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201610141710.u9EHArlL089412@repo.freebsd.org> <20161014175542.GB65545@ambrisko.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 17 Oct 2016 14:20:03 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 18:20:05 -0000 On Friday, October 14, 2016 12:25:54 PM Warner Losh wrote: > On Oct 14, 2016 11:55 AM, "Doug Ambrisko" wrote: > > > > On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote: > > | -----Original Message----- > > | > From: on behalf of Doug Ambrisko < > ambrisko@ambrisko.com> > > | > Date: 2016-10-14, Friday at 10:27 > > | > To: Warner Losh > > | > Cc: Doug Ambrisko , src-committers < > src-committers@freebsd.org>, "svn-src-all@freebsd.org" < > svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" < > svn-src-head@freebsd.org> > > | > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader > > | > > > | > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote: > > | > | Love the functionality, but don't like using the 'hint' namespace > for > > | > | this. Can we change it now before too many things depend on it? We > had > > | > | similar issues in ACPI and moved it to the 'acpi' space. Can we move > > | > | this to the 'smbios' space please? > > | > | > > | > | The reason is that 'hint' is special and sometimes filtered out, so > it > > | > | is a poor choice to export data from the boot loader to the kernel. > > | > > > | > The reason I picked hint was it could be put /boot/device.hints > > | > to make it work as well and that it was a hint. Other standards in > the > > | > future might use other methods. Looking back over the email I had > > | > with John he had suggested hint.smbios.0.anchor to make this look > > | > different. This code had been hanging around for so long I forgot > > | > about that and we were using hint.smbios.0.mem in our shipping code > base. > > | > > > | > However, I hope that nothing would use this except for smbios(4) and > > | > for people to make smbios(4) useful for this info. > > | > > | Doug's looking at me when he says that. :-) > > | > > | We talked about this last night at BAFUG; right now, even if smbios(4) > > | is able to find the SMBIOS info -- it currently only looks at the > > | aforementioned 0xf0000 - 0xfffff range, so it can't find it on UEFI -- > > | smbios(4) doesn't actually provide any interface for that information. > > | Doug and I have talked about making smbios(4) useful, by parsing the > > | data and providing KPIs and APIs, for years now; I think I'll *finally* > > | have the time and motivation to do so "soon". > > > > I've actually talked to a few people. However, your the first to > > step up. This needs to be designed and will take some time and > > review. I would hope that except for smbios(4), nothing else would > > use this kenv but there is nothing to prevent that :-( I could name > > it super_secret_dont_use. > > > > BTW, to get you started this patch prevents smbios(4) from blowing chunks > > when it gets a anchor in high memory and works on legacy machines. > > > > --- /sys/x86/bios/smbios.c 2013-10-01 14:28:25.000000000 -0700 > > +++ ./smbios.c 2016-04-11 11:58:03.234969000 -0700 > > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8 > > #include > > #include > > #include > > +#include > > > > #include > > #include > > @@ -59,7 +60,7 @@ struct smbios_softc { > > }; > > > > #define RES2EPS(res) ((struct smbios_eps > *)rman_get_virtual(res)) > > -#define ADDR2EPS(addr) ((struct smbios_eps > *)BIOS_PADDRTOVADDR(addr)) > > +#define ADDR2EPS(addr) ((struct smbios_eps *)PHYS_TO_DMAP(addr)) > > > > static devclass_t smbios_devclass; > > > > @@ -71,19 +72,26 @@ static int smbios_modevent (module_t, in > > > > static int smbios_cksum (struct smbios_eps *); > > > > +static unsigned long addr; > > +static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0, > > + "SMBIOS driver parameters"); > > +SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW, > > + &addr, 0, ""); > > + > > static void > > smbios_identify (driver_t *driver, device_t parent) > > { > > device_t child; > > - u_int32_t addr; > > int length; > > int rid; > > > > if (!device_is_alive(parent)) > > return; > > > > - addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, > > - SMBIOS_STEP, SMBIOS_OFF); > > + if (resource_long_value("smbios", 0, "mem", &addr) != 0 || > > + addr == 0) > > + addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, > SMBIOS_LEN, > > + SMBIOS_STEP, SMBIOS_OFF); > > if (addr != 0) { > > rid = 0; > > length = ADDR2EPS(addr)->length; > > > > Note I don't plan to commit this since it doesn't really do much and we > > need a lot more. > > I was planning on exporting all smbios stuff via sysctl. I'm a bit hesitant to do all the type parsing in the kernel vs userland. However, I think having smbios(4) export a /dev/smbios that you can either read() or mmap() to access the table would be very convenient and let you keep the bits to parse the table in userland (and not require root if we allow read-only access to mortals on /dev/foo). -- John Baldwin From owner-svn-src-all@freebsd.org Mon Oct 17 18:20:06 2016 Return-Path: Delivered-To: svn-src-all@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 5E4E5C1605D; Mon, 17 Oct 2016 18:20:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E18412EC; Mon, 17 Oct 2016 18:20:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id E1D6810AF91; Mon, 17 Oct 2016 14:20:04 -0400 (EDT) From: John Baldwin To: Marcel Moolenaar Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307386 - in head: etc/mtree include sys/sys sys/sys/disk Date: Mon, 17 Oct 2016 10:28:44 -0700 Message-ID: <3498461.uNz0HOhrYy@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201610160243.u9G2hpJE050577@repo.freebsd.org> References: <201610160243.u9G2hpJE050577@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 17 Oct 2016 14:20:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 18:20:06 -0000 On Sunday, October 16, 2016 02:43:51 AM Marcel Moolenaar wrote: > Author: marcel > Date: Sun Oct 16 02:43:51 2016 > New Revision: 307386 > URL: https://svnweb.freebsd.org/changeset/base/307386 > > Log: > Re-apply change 306811 or alternatively, revert change 307385. Thanks! -- John Baldwin From owner-svn-src-all@freebsd.org Mon Oct 17 18:20:07 2016 Return-Path: Delivered-To: svn-src-all@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 AEDBAC1606E; Mon, 17 Oct 2016 18:20:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DAC812F6; Mon, 17 Oct 2016 18:20:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id A8F6C10AF92; Mon, 17 Oct 2016 14:20:06 -0400 (EDT) From: John Baldwin To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307518 - in head/sys: arm/allwinner arm/at91 arm/cavium/cns11xx arm/samsung/exynos arm/ti/am335x arm/ti/usb arm/xilinx boot/kshim dev/bhnd/cores/usb dev/puc dev/usb dev/usb/controller ... Date: Mon, 17 Oct 2016 10:27:21 -0700 Message-ID: <1894111.JRI62yHUp5@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201610171020.u9HAKdWO076718@repo.freebsd.org> References: <201610171020.u9HAKdWO076718@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 17 Oct 2016 14:20:06 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 18:20:07 -0000 On Monday, October 17, 2016 10:20:39 AM Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Oct 17 10:20:38 2016 > New Revision: 307518 > URL: https://svnweb.freebsd.org/changeset/base/307518 > > Log: > Fix device delete child function. > > When detaching device trees parent devices must be detached prior to > detaching its children. This is because parent devices can have > pointers to the child devices in their softcs which are not > invalidated by device_delete_child(). This can cause use after free > issues and panic(). > > Device drivers implementing trees, must ensure its detach function > detaches or deletes all its children before returning. > > While at it remove now redundant device_detach() calls before > device_delete_child() and device_delete_children(), mostly in > the USB controller drivers. > > Tested by: Jan Henrik Sylvester > Reviewed by: jhb > Differential Revision: https://reviews.freebsd.org/D8070 > MFC after: 2 weeks Thanks. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Oct 17 18:52:27 2016 Return-Path: Delivered-To: svn-src-all@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 476D2C1679A; Mon, 17 Oct 2016 18:52: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 EDB50E68; Mon, 17 Oct 2016 18:52:26 +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 u9HIqQhq077374; Mon, 17 Oct 2016 18:52:26 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HIqPt2077370; Mon, 17 Oct 2016 18:52:25 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610171852.u9HIqPt2077370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 17 Oct 2016 18:52:25 +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: r307527 - in stable/11/sys/boot: fdt uboot/lib X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 18:52:27 -0000 Author: gonzo Date: Mon Oct 17 18:52:25 2016 New Revision: 307527 URL: https://svnweb.freebsd.org/changeset/base/307527 Log: MFC r302465: Remove extra 0x before %p format strings introduced by r296182 Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/sys/boot/uboot/lib/elf_freebsd.c stable/11/sys/boot/uboot/lib/glue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Mon Oct 17 18:14:31 2016 (r307526) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Mon Oct 17 18:52:25 2016 (r307527) @@ -421,7 +421,7 @@ fdt_setup_fdtp() /* If we were given the address of a valid blob in memory, use it. */ if (fdt_to_load != NULL) { if (fdt_load_dtb_addr(fdt_to_load) == 0) { - printf("Using DTB from memory address 0x%p.\n", + printf("Using DTB from memory address %p.\n", fdt_to_load); return (0); } Modified: stable/11/sys/boot/uboot/lib/elf_freebsd.c ============================================================================== --- stable/11/sys/boot/uboot/lib/elf_freebsd.c Mon Oct 17 18:14:31 2016 (r307526) +++ stable/11/sys/boot/uboot/lib/elf_freebsd.c Mon Oct 17 18:52:25 2016 (r307527) @@ -85,7 +85,7 @@ __elfN(uboot_exec)(struct preloaded_file return (error); entry = (void *)e->e_entry; - printf("Kernel entry at 0x%p...\n", entry); + printf("Kernel entry at %p...\n", entry); dev_cleanup(); printf("Kernel args: %s\n", fp->f_args); Modified: stable/11/sys/boot/uboot/lib/glue.c ============================================================================== --- stable/11/sys/boot/uboot/lib/glue.c Mon Oct 17 18:14:31 2016 (r307526) +++ stable/11/sys/boot/uboot/lib/glue.c Mon Oct 17 18:52:25 2016 (r307527) @@ -469,7 +469,7 @@ ub_dump_di(int handle) int i; printf("device info (%d):\n", handle); - printf(" cookie\t= 0x%p\n", di->cookie); + printf(" cookie\t= %p\n", di->cookie); printf(" type\t\t= 0x%08x\n", di->type); if (di->type == DEV_TYP_NET) { From owner-svn-src-all@freebsd.org Mon Oct 17 19:51:02 2016 Return-Path: Delivered-To: svn-src-all@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 27644AF42FB; Mon, 17 Oct 2016 19:51:02 +0000 (UTC) (envelope-from avos@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 EB04ED8A; Mon, 17 Oct 2016 19:51:01 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HJp1m8098421; Mon, 17 Oct 2016 19:51:01 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HJp1vs098420; Mon, 17 Oct 2016 19:51:01 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201610171951.u9HJp1vs098420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 17 Oct 2016 19:51:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r307528 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 19:51:02 -0000 Author: avos Date: Mon Oct 17 19:51:00 2016 New Revision: 307528 URL: https://svnweb.freebsd.org/changeset/base/307528 Log: Increase size limit for rtwn(4) / urtwn(4) update. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Mon Oct 17 18:52:25 2016 (r307527) +++ svnadmin/conf/sizelimit.conf Mon Oct 17 19:51:00 2016 (r307528) @@ -15,6 +15,7 @@ # First field is username, second field is the raised limit required. achim +avos bapt brooks davidcs From owner-svn-src-all@freebsd.org Mon Oct 17 20:23:07 2016 Return-Path: Delivered-To: svn-src-all@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 C94EEC15021; Mon, 17 Oct 2016 20:23:07 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 98E13901; Mon, 17 Oct 2016 20:23:07 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 408CD2083F; Mon, 17 Oct 2016 16:23:06 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 17 Oct 2016 16:23:06 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=e8UDR1Do4Tx6r06Qe59GbfGRVE8=; b=BPOz0A vBuMrzqbUTM+tsR7jzOFdMNXty9AKFH1LhXYH0SOyDdN+AseciWvPcy4I9cF21Ul M1ZBg57Z1/tC5n9ByQREopvgVzVXWypI1w1BS/VDN+tM3BTRYp3ye8o3F/Q37jIc b4JuSRkzpeMGtiEZGfIA2Hq4EtU3MsrtaAfj8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=e8UDR1Do4Tx6r06 Qe59GbfGRVE8=; b=ryooaBYgEkV1OERD4zXOFy2yV4j4LE7QPHAHvurUM/q8619 b3mbD9IWNbsRoi7rtM7yCb4KWziegiOjDewHch0+cUgJTfSNgK+MLiEKg/1bgdrL HVvWq5Q+p3cH+pyrwItyg0VccS5YAwu6qXaBNTA0Q0aR9X94cBgrTIWZYDHc= X-Sasl-enc: 2MylpfjoJTjB9N0Nt2NClOAGc1deJ2D+s8ExK0/yYMk1 1476735785 Received: from [192.168.1.88] (cpc96954-walt26-2-0-cust843.13-2.cable.virginm.net [82.31.91.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 24E85F29C9; Mon, 17 Oct 2016 16:23:05 -0400 (EDT) Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader To: John Baldwin , Warner Losh References: <201610141710.u9EHArlL089412@repo.freebsd.org> <20161014175542.GB65545@ambrisko.com> <1950201.IjTl3rpdGP@ralph.baldwin.cx> Cc: Doug Ambrisko , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Doug Ambrisko , Ravi Pokala From: Bruce Simpson Message-ID: <2397b12d-ddd7-8fde-9575-44dd825d6f60@fastmail.net> Date: Mon, 17 Oct 2016 21:23:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1950201.IjTl3rpdGP@ralph.baldwin.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 20:23:07 -0000 On 17/10/16 18:40, John Baldwin wrote: > I'm a bit hesitant to do all the type parsing in the kernel vs userland. > However, I think having smbios(4) export a /dev/smbios that you can either > read() or mmap() to access the table would be very convenient and let you > keep the bits to parse the table in userland (and not require root if we > allow read-only access to mortals on /dev/foo). This is probably a bit left-field, but I'm wondering if both methods (expose-to-loader-kenv and user-space-accessible devfs node) can be re-used for things like the Linux-oriented kernel environment page exported by SYSLINUX/PXELINUX memdisk, which I've used with some success to boot FreeBSD installers in heterogeneous private cloud/lab setups. It exports this information using an ACPI-like table in that BIOS HBA type area in x86 address space, but the table is not DSDT linked (it's not produced by the BIOS). Having a coherent means of dealing with it would be very useful, as such FreeBSD installers (which I've deployed as mfsBSD images) can then basically re-use what's been done for EFI variables for those legacy systems which don't support/can't use EFI network boot. As yet, I've not tried this with 64-bit EFI systems. From owner-svn-src-all@freebsd.org Mon Oct 17 20:26:57 2016 Return-Path: Delivered-To: svn-src-all@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 9C8DCC152DB; Mon, 17 Oct 2016 20:26:57 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 5E9D2C37; Mon, 17 Oct 2016 20:26:57 +0000 (UTC) (envelope-from bms@fastmail.net) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 3172420286; Mon, 17 Oct 2016 16:26:56 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 17 Oct 2016 16:26:56 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=5XwgTk9HpArVTCdbaMkjFOUer9s=; b=JGS1yc rol4jFCg1ZIEHgVGVKA0d696KeF9N4xeA6QcqS2jOOKzxpJXIGrzTYbHqAwbcfxa FeBQ37GOSENUDEPvgDBPA7VXZj8C+dvzAVjLTmAh41FzOKt1H8C2JSqYR9klmDtD 03C5dbvyw3TLo+H2Ju3bskuzuh647Dm6cOl1U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=5XwgTk9HpArVTCd baMkjFOUer9s=; b=h2JmrQmlu0QwZNmgEYEytSDz72MJTxMHOU4MRGNAeUij9qV +wnF0u8R8CV6bfZbCjL0VWlRL3mP6nmFMmp2iNpZ7h3BUleWkts+wJMHcNkbhUUp 68Jc4ORrT1+vUmuId8MPeuGY6456VqhxRMCz8sPDqaL1k6Tas0TkndQEuCEA= X-Sasl-enc: JuuIK7u2wbkhVjNaRwxUe8EQdsuQdmuBHkuz8LXftdkW 1476736015 Received: from [192.168.1.88] (cpc96954-walt26-2-0-cust843.13-2.cable.virginm.net [82.31.91.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 1D3E8F29C9; Mon, 17 Oct 2016 16:26:55 -0400 (EDT) Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader To: John Baldwin , Warner Losh References: <201610141710.u9EHArlL089412@repo.freebsd.org> <20161014175542.GB65545@ambrisko.com> <1950201.IjTl3rpdGP@ralph.baldwin.cx> <2397b12d-ddd7-8fde-9575-44dd825d6f60@fastmail.net> Cc: Doug Ambrisko , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Doug Ambrisko , Ravi Pokala From: Bruce Simpson Message-ID: Date: Mon, 17 Oct 2016 21:26:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <2397b12d-ddd7-8fde-9575-44dd825d6f60@fastmail.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 20:26:57 -0000 On 17/10/16 21:23, Bruce Simpson wrote: > On 17/10/16 18:40, John Baldwin wrote: >> I'm a bit hesitant to do all the type parsing in the kernel vs userland. >> However, I think having smbios(4) export a /dev/smbios that you can >> either >> read() or mmap() to access the table would be very convenient and let you >> keep the bits to parse the table in userland (and not require root if we >> allow read-only access to mortals on /dev/foo). > > This is probably a bit left-field, but I'm wondering if both methods > (expose-to-loader-kenv and user-space-accessible devfs node) can be > re-used for things like the Linux-oriented kernel environment page > exported by SYSLINUX/PXELINUX memdisk, which I've used with some success > to boot FreeBSD installers in heterogeneous private cloud/lab setups. PS Hit send too soon -- the main reason a FreeBSD installer, or image wrapper for a FreeBSD installer tool (akin to the Debian style of network driven installer), would need access to the memdisk's ACPI-style table (containing boot & textual 'environment' page, filled out by the TFTP boot server, perhaps by scripted means) is... ...where it can't intuit all system configuration settings by reference to its primary MAC address alone, or where it needs network bootstrap information to proceed with other provisioning methods (straight to Puppet/Ansible, and/or fetching a list of pkgng pkgs to grab from some trusted package server). The code required would just pretty much resemble what you guys are doing for EFI right now, but for BIOS-era systems (of which we've got a large installed base, and mass provisioning those would be great, for the sake of recycling.) From owner-svn-src-all@freebsd.org Mon Oct 17 20:38:26 2016 Return-Path: Delivered-To: svn-src-all@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 556D5C15592; Mon, 17 Oct 2016 20:38:26 +0000 (UTC) (envelope-from avos@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 0CEE320E; Mon, 17 Oct 2016 20:38:25 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HKcPuk015455; Mon, 17 Oct 2016 20:38:25 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HKcOxs015446; Mon, 17 Oct 2016 20:38:24 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201610172038.u9HKcOxs015446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 17 Oct 2016 20:38:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307529 - in head: . etc etc/devd share/doc/legal/realtek share/man/man4 sys/conf sys/contrib/dev/rtwn sys/contrib/dev/urtwn sys/dev/rtwn sys/dev/rtwn/pci sys/dev/rtwn/rtl8188e sys/dev/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 20:38:26 -0000 Author: avos Date: Mon Oct 17 20:38:24 2016 New Revision: 307529 URL: https://svnweb.freebsd.org/changeset/base/307529 Log: rtwn(4), urtwn(4): merge common code, add support for 11ac devices. All devices: - add support for rate adaptation via ieee80211_amrr(9); - use short preamble for transmitted frames when needed; - multi-bss support: * for RTL8821AU: 2 VAPs at the same time; * other: 1 any VAP + 1 sta VAP. RTL8188CE: - fix IQ calibration bug (reason of significant speed degradation); - add h/w crypto acceleration support. USB: - A-MPDU Tx support; - short GI support; Other: - add support for RTL8812AU / RTL8821AU chipsets (a/b/g/n only; no ac yet); - split merged code into subparts: * bus glue (usb/*, pci/*, rtl*/usb/*, rtl*/pci/*) * common (if_rtwn*) * chip-specific (rtl*/*) - various other bugfixes. Due to code reorganization, module names / requirements were changed too: urtwn urtwnfw -> rtwn rtwn_usb rtwnfw rtwn rtwnfw -> rtwn rtwn_pci rtwnfw Tested with RTL8188CE, RTL8188CUS, RTL8188EU and RTL8821AU. Tested by: kevlo, garga, Peter Garshtja , Kevin McAleavey , Ilias-Dimitrios Vrachnis , Relnotes: yes Added: head/share/man/man4/rtwn_pci.4 (contents, props changed) head/share/man/man4/rtwn_usb.4 (contents, props changed) head/sys/contrib/dev/rtwn/rtwn-rtl8188eufw.fw.uu - copied, changed from r307528, head/sys/contrib/dev/urtwn/urtwn-rtl8188eufw.fw.uu head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwE.fw.uu head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwE_B.fw.uu - copied, changed from r307528, head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU_B.fw.uu head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwT.fw.uu head/sys/contrib/dev/rtwn/rtwn-rtl8812aufw.fw.uu head/sys/contrib/dev/rtwn/rtwn-rtl8821aufw.fw.uu head/sys/dev/rtwn/if_rtwn_beacon.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_beacon.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_calib.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_calib.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_cam.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_cam.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_debug.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_efuse.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_efuse.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_fw.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_fw.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_nop.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_ridx.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_rx.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_rx.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_task.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_task.h (contents, props changed) head/sys/dev/rtwn/if_rtwn_tx.c (contents, props changed) head/sys/dev/rtwn/if_rtwn_tx.h (contents, props changed) head/sys/dev/rtwn/if_rtwnvar.h (contents, props changed) head/sys/dev/rtwn/pci/ head/sys/dev/rtwn/pci/rtwn_pci_attach.c (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_attach.h (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_reg.c (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_reg.h (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_rx.c (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_rx.h (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_tx.c (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_tx.h (contents, props changed) head/sys/dev/rtwn/pci/rtwn_pci_var.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/ head/sys/dev/rtwn/rtl8188e/r88e.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_beacon.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_calib.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_chan.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_fw.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_fw_cmd.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_init.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_led.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_priv.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_rf.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_rom.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_rom_defs.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_rom_image.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_rx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_tx.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/r88e_tx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/usb/ head/sys/dev/rtwn/rtl8188e/usb/r88eu.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c (contents, props changed) head/sys/dev/rtwn/rtl8188e/usb/r88eu_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8188e/usb/r88eu_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/ head/sys/dev/rtwn/rtl8192c/pci/ head/sys/dev/rtwn/rtl8192c/pci/r92ce.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_calib.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_init.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_led.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_priv.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_rx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_tx.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/pci/r92ce_tx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_attach.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_beacon.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_calib.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_chan.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_fw.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_fw_cmd.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_init.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_priv.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_rf.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_rom.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_rom_defs.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_rom_image.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_rx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_tx.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/r92c_var.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/ head/sys/dev/rtwn/rtl8192c/usb/r92cu.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_led.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_priv.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_tx.c (contents, props changed) head/sys/dev/rtwn/rtl8192c/usb/r92cu_tx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/ head/sys/dev/rtwn/rtl8812a/r12a.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_beacon.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_calib.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_caps.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_chan.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_fw.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_fw_cmd.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_init.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_led.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_priv.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_rf.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_rom.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_rom_defs.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_rom_image.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_rx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_tx.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_tx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/r12a_var.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/usb/ head/sys/dev/rtwn/rtl8812a/usb/r12au.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/usb/r12au_init.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/usb/r12au_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8812a/usb/r12au_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/usb/r12au_tx.c (contents, props changed) head/sys/dev/rtwn/rtl8812a/usb/r12au_tx_desc.h (contents, props changed) head/sys/dev/rtwn/rtl8821a/ head/sys/dev/rtwn/rtl8821a/r21a.h (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_beacon.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_calib.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_chan.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_fw.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_init.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_led.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_priv.h (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_reg.h (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_rom.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/r21a_rx.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/usb/ head/sys/dev/rtwn/rtl8821a/usb/r21au.h (contents, props changed) head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/usb/r21au_init.c (contents, props changed) head/sys/dev/rtwn/rtl8821a/usb/r21au_reg.h (contents, props changed) head/sys/dev/rtwn/usb/ head/sys/dev/rtwn/usb/rtwn_usb_attach.c (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_attach.h (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_ep.c (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_ep.h (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_reg.c (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_reg.h (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_rx.c (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_rx.h (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_tx.c (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_tx.h (contents, props changed) head/sys/dev/rtwn/usb/rtwn_usb_var.h (contents, props changed) head/sys/modules/rtwn_pci/ head/sys/modules/rtwn_pci/Makefile (contents, props changed) head/sys/modules/rtwn_usb/ head/sys/modules/rtwn_usb/Makefile (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8188eu/ head/sys/modules/rtwnfw/rtwnrtl8188eu/Makefile (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8192cE/ head/sys/modules/rtwnfw/rtwnrtl8192cE/Makefile (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8192cEB/ head/sys/modules/rtwnfw/rtwnrtl8192cEB/Makefile (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8192cT/ head/sys/modules/rtwnfw/rtwnrtl8192cT/Makefile (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8812au/ head/sys/modules/rtwnfw/rtwnrtl8812au/Makefile (contents, props changed) head/sys/modules/rtwnfw/rtwnrtl8821au/ head/sys/modules/rtwnfw/rtwnrtl8821au/Makefile (contents, props changed) Deleted: head/share/man/man4/urtwn.4 head/share/man/man4/urtwnfw.4 head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU_B.fw.uu head/sys/contrib/dev/urtwn/ head/sys/dev/urtwn/ head/sys/modules/rtwnfw/rtwnrtl8192cUB/ head/sys/modules/urtwn/ head/sys/modules/urtwnfw/ Modified: head/ObsoleteFiles.inc head/etc/devd.conf head/etc/devd/usb.conf head/share/doc/legal/realtek/Makefile head/share/man/man4/Makefile head/share/man/man4/rtwn.4 head/share/man/man4/rtwnfw.4 head/share/man/man4/wlan.4 head/sys/conf/WITHOUT_SOURCELESS_UCODE head/sys/conf/files head/sys/conf/options head/sys/contrib/dev/rtwn/LICENSE head/sys/contrib/dev/rtwn/rtwn-rtl8192cfwU.fw.uu head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwnreg.h head/sys/mips/conf/std.AR933X head/sys/mips/conf/std.AR934X head/sys/mips/conf/std.QCA955X head/sys/modules/Makefile head/sys/modules/rtwn/Makefile head/sys/modules/rtwnfw/Makefile head/sys/modules/rtwnfw/Makefile.inc head/sys/riscv/conf/GENERIC head/sys/sys/param.h head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Oct 17 19:51:00 2016 (r307528) +++ head/ObsoleteFiles.inc Mon Oct 17 20:38:24 2016 (r307529) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20161016: urtwn(4) was merged into rtwn(4) +OLD_FILES+=usr/share/man/man4/urtwn.4.gz +OLD_FILES+=usr/share/man/man4/urtwnfw.4.gz # 20161015: Remove GNU rcs OLD_FILES+=usr/bin/ci OLD_FILES+=usr/bin/co Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Mon Oct 17 19:51:00 2016 (r307528) +++ head/etc/devd.conf Mon Oct 17 20:38:24 2016 (r307529) @@ -24,7 +24,7 @@ options { [0-9]+"; set wifi-driver-regex "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rum|run|uath|\ - upgt|ural|urtw|urtwn|wi|wpi|wtap|zyd)[0-9]+"; + upgt|ural|urtw|rtwn_usb|wi|wpi|wtap|zyd)[0-9]+"; }; # Note that the attach/detach with the highest value wins, so that one can Modified: head/etc/devd/usb.conf ============================================================================== --- head/etc/devd/usb.conf Mon Oct 17 19:51:00 2016 (r307528) +++ head/etc/devd/usb.conf Mon Oct 17 20:38:24 2016 (r307529) @@ -185,6 +185,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0409"; + match "product" "0x0408"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0409"; match "product" "(0x8024|0x8025)"; action "kldload -n uipaq"; }; @@ -304,6 +312,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0411"; + match "product" "(0x0242|0x025d)"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0413"; match "product" "0x2101"; action "kldload -n uplcom"; @@ -553,6 +569,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x04bb"; + match "product" "0x0952"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x04bb"; match "product" "(0x0a03|0x0a0e)"; action "kldload -n uplcom"; }; @@ -682,7 +706,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x04f2"; match "product" "(0xaff7|0xaff8|0xaff9|0xaffa|0xaffa)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -754,7 +778,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x050d"; match "product" "0x1102"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -778,7 +802,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x050d"; match "product" "(0x2102|0x2103)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -1050,7 +1074,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x056e"; match "product" "0x4008"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -1146,7 +1170,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0586"; match "product" "0x341f"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -1160,6 +1184,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0586"; + match "product" "0x3426"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x058f"; match "product" "0x9720"; action "kldload -n uplcom"; @@ -1442,7 +1474,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x06f8"; match "product" "0xe033"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -1658,7 +1690,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x07aa"; match "product" "0x0056"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -1722,7 +1754,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x07b8"; match "product" "(0x8178|0x8179|0x8188|0x8189)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2026,7 +2058,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0846"; match "product" "0x9021"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2041,8 +2073,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0846"; - match "product" "0x9041"; - action "kldload -n if_urtwn"; + match "product" "(0x9041|0x9052)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2498,7 +2530,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0b05"; match "product" "0x17ab"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2522,7 +2554,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0b05"; match "product" "0x17ba"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2537,6 +2569,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0b05"; + match "product" "0x17d2"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0b05"; match "product" "(0x4200|0x4201|0x4202|0x420f|0x9200|0x9202)"; action "kldload -n uipaq"; }; @@ -2658,7 +2698,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0bda"; match "product" "(0x0179|0x018a|0x317f)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2682,7 +2722,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0bda"; match "product" "0x8170"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2698,7 +2738,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0bda"; match "product" "(0x8176|0x8177|0x8178|0x8179|0x817a|0x817b|0x817c|0x817d|0x817e|0x817f)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2714,7 +2754,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0bda"; match "product" "(0x818a|0x8191)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -2738,7 +2778,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0bda"; match "product" "0x8754"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3162,7 +3202,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0df6"; match "product" "0x0052"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3178,7 +3218,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0df6"; match "product" "(0x005c|0x0061)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3193,6 +3233,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0df6"; + match "product" "0x0074"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0df6"; match "product" "0x061c"; action "kldload -n if_axe"; }; @@ -3257,8 +3305,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0e66"; - match "product" "0x0019"; - action "kldload -n if_urtwn"; + match "product" "(0x0019|0x0023)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3330,7 +3378,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0eb0"; match "product" "0x9071"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3490,7 +3538,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x103c"; match "product" "0x1629"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3976,6 +4024,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x13b1"; + match "product" "0x003f"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x13d2"; match "product" "0x0400"; action "kldload -n if_kue"; @@ -4018,7 +4074,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x13d3"; match "product" "(0x3357|0x3358|0x3359)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -4569,6 +4625,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1740"; + match "product" "0x0100"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x1740"; match "product" "(0x0605|0x0615)"; action "kldload -n if_run"; }; @@ -4961,8 +5025,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f|0x3310)"; - action "kldload -n if_urtwn"; + match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f|0x3310|0x3314|0x3315|0x3316|0x3318)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5042,7 +5106,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x2019"; match "product" "(0x1201|0x4902)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5089,8 +5153,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2019"; - match "product" "(0xab2a|0xab2b|0xab2e)"; - action "kldload -n if_urtwn"; + match "product" "(0xab2a|0xab2b|0xab2e|0xab30)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5130,7 +5194,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x2019"; match "product" "0xed17"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5170,7 +5234,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x20f4"; match "product" "0x624d"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5185,8 +5249,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x20f4"; - match "product" "0x648b"; - action "kldload -n if_urtwn"; + match "product" "(0x648b|0x805b)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5232,6 +5296,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x2357"; + match "product" "0x0101"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x2405"; match "product" "0x0003"; action "kldload -n uslcom"; @@ -5354,7 +5426,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x4855"; match "product" "(0x0090|0x0091)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5465,8 +5537,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x7392"; - match "product" "(0x7811|0x7822)"; - action "kldload -n if_urtwn"; + match "product" "(0x7811|0x7822|0xa811|0xa812|0xa822)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5522,7 +5594,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x9846"; match "product" "0x9041"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5817,5 +5889,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2722 USB entries processed +# 2743 USB entries processed Modified: head/share/doc/legal/realtek/Makefile ============================================================================== --- head/share/doc/legal/realtek/Makefile Mon Oct 17 19:51:00 2016 (r307528) +++ head/share/doc/legal/realtek/Makefile Mon Oct 17 20:38:24 2016 (r307529) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= ${.CURDIR}/../../../../sys/contrib/dev/urtwn/LICENSE +FILES= ${.CURDIR}/../../../../sys/contrib/dev/rtwn/LICENSE FILESDIR= ${SHAREDIR}/doc/legal FILESNAME= realtek.LICENSE Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Oct 17 19:51:00 2016 (r307528) +++ head/share/man/man4/Makefile Mon Oct 17 20:38:24 2016 (r307529) @@ -433,6 +433,7 @@ MAN= aac.4 \ rp.4 \ rtwn.4 \ rtwnfw.4 \ + rtwn_pci.4 \ rue.4 \ rum.4 \ run.4 \ @@ -692,6 +693,8 @@ MLINKS+=pms.4 pmspcv.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 +MLINKS+=rtwn.4 if_rtwn.4 +MLINKS+=rtwn_pci.4 if_rtwn_pci.4 MLINKS+=rue.4 if_rue.4 MLINKS+=rum.4 if_rum.4 MLINKS+=run.4 if_run.4 @@ -886,6 +889,7 @@ MAN+= \ otusfw.4 \ rsu.4 \ rsufw.4 \ + rtwn_usb.4 \ u3g.4 \ uark.4 \ uart.4 \ @@ -928,8 +932,6 @@ MAN+= \ urio.4 \ urndis.4 \ ${_urtw.4} \ - urtwn.4 \ - urtwnfw.4 \ usb.4 \ usb_quirk.4 \ usb_template.4 \ @@ -941,6 +943,7 @@ MAN+= \ MLINKS+=otus.4 if_otus.4 MLINKS+=rsu.4 if_rsu.4 +MLINKS+=rtwn_usb.4 if_rtwn_usb.4 MLINKS+=u3g.4 u3gstub.4 MLINKS+=uath.4 if_uath.4 MLINKS+=udav.4 if_udav.4 @@ -948,7 +951,6 @@ MLINKS+=upgt.4 if_upgt.4 MLINKS+=ural.4 if_ural.4 MLINKS+=urndis.4 if_urndis.4 MLINKS+=${_urtw.4} ${_if_urtw.4} -MLINKS+=urtwn.4 if_urtwn.4 .endif .include Modified: head/share/man/man4/rtwn.4 ============================================================================== --- head/share/man/man4/rtwn.4 Mon Oct 17 19:51:00 2016 (r307528) +++ head/share/man/man4/rtwn.4 Mon Oct 17 20:38:24 2016 (r307529) @@ -2,6 +2,7 @@ .\" .\" Copyright (c) 2010 Damien Bergamini .\" Copyright (c) 2015 Stefan Sperling +.\" Copyright (c) 2016 Andriy Voskoboinyk .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -17,89 +18,88 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2015 +.Dd September 19, 2016 .Dt RTWN 4 .Os .Sh NAME .Nm rtwn -.Nd Realtek RTL8188CE PCIe IEEE 802.11b/g/n wireless network device +.Nd Realtek IEEE 802.11 wireless network driver .Sh SYNOPSIS +.Cd "options RTWN_DEBUG" +.Cd "options RTWN_WITHOUT_UCODE" +.Pp To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device rtwn" .Cd "device rtwnfw" +.Cd "device rtwn_usb" +.Cd "device rtwn_pci" .Cd "device wlan" .Cd "device firmware" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place following lines in .Xr loader.conf 5 : .Bd -literal -offset indent if_rtwn_load="YES" -.Ed -.Pp -After you have read the license in -.Pa /usr/share/doc/legal/realtek.LICENSE -you will want to add the following lines to -.Xr loader.conf 5 : -.Bd -literal -offset indent -legal.realtek.license_ack=1 -rtwn-rtl8192cfwU_load="YES" -rtwn-rtl8192cfwU_B_load="YES" +if_rtwn_pci_load="YES" +if_rtwn_usb_load="YES" .Ed .Sh DESCRIPTION The .Nm -driver supports PCIe wireless network devices based on the Realtek -RTL8188CE chipset. +driver provides support for wireless network devices based on +the Realtek RTL8192C, RTL8188E, RTL8812A and RTL8821A programming APIs. +These APIs are used by a wide variety of chips; most chips with USB +and some with PCI interface are supported. +.Pp +To enable use for PCI/PCIe systems, see the rtwn_pci(4) driver; +for USB devices, use the rtwn_usb(4) driver. +.Pp +The driver supports +.Cm station , +.Cm adhoc , +.Cm hostap +and +.Cm monitor +mode operation. +There are no limitations for number of +.Cm monitor +mode +virtual interfaces; in addition to any other virtual interface +one +.Cm station +interface can be added (Note: RTL8821AU supports two non-monitor +mode interfaces at the same time). .Pp -The RTL8188CE is a highly integrated 802.11n adapter that combines a MAC, -a 1T1R capable baseband and an RF in a single chip. -It operates in the 2GHz spectrum only. -.Pp -These are the modes the -.Nm -driver can operate in: -.Bl -tag -width "IBSS-masterXX" -.It BSS mode -Also known as -.Em infrastructure -mode, this is used when associating with an access point, through -which all traffic passes. -This mode is the default. -.It monitor mode -In this mode the driver is able to receive packets without -associating with an access point. -This disables the internal receive filter and enables the card to -capture packets from networks which it wouldn't normally have access to, -or to scan for access points. -.El -.Pp -The -.Nm -driver can be configured to use -Wired Equivalent Privacy (WEP) or -Wi-Fi Protected Access (WPA-PSK and WPA2-PSK). -WPA is the current encryption standard for wireless networks. -It is strongly recommended that WEP -not be used as the sole mechanism -to secure wireless communication, -due to serious weaknesses in it. +All chips have hardware support for WEP, AES-CCM and TKIP encryption. .Pp The .Nm driver can be configured at runtime with .Xr ifconfig 8 . .Sh FILES -The driver needs at least version 1.0 of the following firmware files, -which are loaded when an interface is brought up: +.Bl -tag -width ".Pa /usr/share/doc/legal/realtek.LICENSE" -compact +.It Pa /usr/share/doc/legal/realtek.LICENSE +.Nm +firmware license +.El .Pp +The driver (if not compiled with +.Cd options RTWN_WITHOUT_UCODE +) may use following firmware files, which are loaded +when an interface is brought up: .Bl -tag -width Ds -offset indent -compact +.It Pa /boot/kernel/rtwn-rtl8188eufw.ko +.It Pa /boot/kernel/rtwn-rtl8192cfwE_B.ko +.It Pa /boot/kernel/rtwn-rtl8192cfwE.ko +.It Pa /boot/kernel/rtwn-rtl8192cfwT.ko .It Pa /boot/kernel/rtwn-rtl8192cfwU.ko -.It Pa /boot/kernel/rtwn-rtl8192cfwU_B.ko +.It Pa /boot/kernel/rtwn-rtl8812aufw.ko +.It Pa /boot/kernel/rtwn-rtl8821aufw.ko .El .Sh EXAMPLES Join an existing BSS network (i.e., connect to an access point): @@ -118,48 +118,124 @@ Join a specific BSS network with 64-bit ifconfig wlan create wlandev rtwn0 ssid my_net \e wepmode on wepkey 0x1234567890 weptxkey 1 up .Ed +.Pp +Create an IBSS network with 128-bit WEP encryption on the channel 4: +.Bd -literal -offset indent +ifconfig wlan create wlandev rtwn0 wlanmode adhoc ssid my_net \e + wepmode on wepkey 0x01020304050607080910111213 weptxkey 1 \e + channel 4 +.Ed +.Pp +Join/create an 802.11b IBSS network with network name +.Dq Li my_net : +.Bd -literal -offset indent +ifconfig wlan0 create wlandev rtwn0 wlanmode adhoc +ifconfig wlan0 inet 192.168.0.22 netmask 0xffffff00 ssid my_net \e + mode 11b +.Ed +.Pp +Create a host-based access point: +.Bd -literal -offset indent +ifconfig wlan0 create wlandev rtwn0 wlanmode hostap +ifconfig wlan0 inet 192.168.0.10 netmask 0xffffff00 ssid my_ap +.Ed +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va dev.rtwn.%d.hwcrypto +This tunable controls how key slots are assigned: +.br +0 - disable h/w crypto support. Features that require access +to frame contents (e.g., TCP/UDP/IP Rx checksum validation) +will not work; +.br +1 - use h/w crypto support for pairwise keys only; +.br +2 - use h/w crypto support for all keys; may not work for +multi-vap configurations. +.br +By default it is set to 1. +.It Va dev.rtwn.%d.ratectl +This tunable switches between rate control implementations: +.br +0 - no rate control; +.br +1 - driver sends 'tx complete' reports to net80211; algorithm +is controlled via net80211; +.br +2 - firmware-based rate control. +.br +By default it is set to 1; however driver may choose another +algorithm in case if it is not implemented +.br +Currently selected algorithm is reported via +.Em Va dev.rtwn.%d.ratectl_selected +read-only OID. +.El .Sh DIAGNOSTICS .Bl -diag -.It "could not read firmware %s" +.It "rtwn%d: could not read efuse byte at address 0x%x" +.It "rtwn%d: %s: cannot read rom, error %d" +There was an error while reading ROM; device attach will be aborted. +This should not happen. +.It "rtwn%d: failed loadfirmware of file %s" For some reason, the driver was unable to read the microcode file from the filesystem. The file might be missing or corrupted. -.It "device timeout" +The driver will disable firmware-dependent features. +.It "rtwn%d: wrong firmware size (%zu)" +.It "rtwn%d: %s: failed to upload firmware %s (error %d)" +.It "rtwn%d: timeout waiting for firmware readiness" +Firmware upload failed; the file might be corrupted. +The driver will disable firmware-dependent features. +This should not happen. +.It "rtwn%d: device timeout" A frame dispatched to the hardware for transmission did not complete in time. The driver will reset the hardware. This should not happen. .El .Sh SEE ALSO -.Xr pci 4 , +.Xr intro 4 , +.Xr netintro 4 , +.Xr rtwn_pci 4 , +.Xr rtwn_usb 4 , .Xr rtwnfw 4 , .Xr wlan 4 , +.Xr wlan_amrr 4 , .Xr wlan_ccmp 4 , .Xr wlan_tkip 4 , .Xr wlan_wep 4 , +.Xr wlan_xauth 4 , +.Xr hostapd 4 , .Xr ifconfig 8 , .Xr wpa_supplicant 8 .Sh HISTORY The +.Cm urtwn +driver first appeared in +.Ox 4.9 +and +.Fx 10.0 ; +the .Nm driver first appeared in .Ox 5.8 . .Sh AUTHORS The .Nm -driver was written by +driver was initially written by .An -nosplit .An Stefan Sperling Aq Mt stsp@openbsd.org and ported by .An Kevin Lo Aq Mt kevlo@freebsd.org . It was based on the -.Xr urtwn 4 +.Cm urtwn driver written by .An Damien Bergamini Aq Mt damien.bergamini@free.fr . -.Sh CAVEATS +.Sh BUGS The .Nm -driver does not support any of the 802.11n capabilities offered by the -adapters. -Additional work is required in -.Xr ieee80211 9 -before those features can be supported. +driver currently does not implement firmware-based rate control. Added: head/share/man/man4/rtwn_pci.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/rtwn_pci.4 Mon Oct 17 20:38:24 2016 (r307529) @@ -0,0 +1,63 @@ +.\"- +.\" Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd +.\" Copyright (c) 2016 Andriy Voskoboinyk +.\" 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, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any +.\" redistribution must be conditioned upon including a substantially +.\" similar Disclaimer requirement for further binary redistribution. +.\" +.\" NO WARRANTY +.\" 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 NONINFRINGEMENT, MERCHANTIBILITY +.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" $FreeBSD$ +.\"/ +.Dd September 19, 2016 +.Dt RTWN_PCI 4 +.Os +.Sh NAME +.Nm rtwn_pci +.Nd "Realtek PCI device glue" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device rtwn_pci" +.Cd "device pci" +.Cd "device wlan" +.Ed +.Sh DESCRIPTION +The +.Nm +driver supports PCIe wireless network devices based on the Realtek +RTL8188CE chipset. +.Pp +The RTL8188CE is a highly integrated 802.11n adapter that combines a MAC, +a 1T1R capable baseband and an RF in a single chip. +It operates in the 2GHz spectrum only. +.Sh SEE ALSO +.Xr rtwn 4 , +.Xr rtwnfw 4 , +.Xr rtwn_usb 4 , +.Xr pci 4 +.Sh CAVEATS +Most 802.11 capabilities were turned off; some more testing +is required to re-enable them. Added: head/share/man/man4/rtwn_usb.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/rtwn_usb.4 Mon Oct 17 20:38:24 2016 (r307529) @@ -0,0 +1,111 @@ +.\"- +.\" Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd +.\" Copyright (c) 2016 Andriy Voskoboinyk +.\" 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, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any +.\" redistribution must be conditioned upon including a substantially +.\" similar Disclaimer requirement for further binary redistribution. +.\" +.\" NO WARRANTY +.\" 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 NONINFRINGEMENT, MERCHANTIBILITY +.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" $FreeBSD$ +.\"/ +.Dd September 19, 2016 +.Dt RTWN_USB 4 +.Os +.Sh NAME +.Nm rtwn_usb +.Nd "Realtek USB device glue" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device xhci" +.Cd "device ehci" +.Cd "device uhci" +.Cd "device ohci" +.Cd "device usb" +.Cd "device rtwn_usb" +.Cd "device wlan" +.Ed +.Sh DESCRIPTION +This module provides the USB bus glue needed for the devices supported +by the +.Xr rtwn 4 +driver. +.Sh HARDWARE +The +.Nm +driver supports Realtek RTL8188CU/RTL8188RU/RTL8188EU/RTL8192CU/RTL8812AU/RTL8821AU +based USB wireless network adapters, including: +.Pp +.Bl -column -compact "Belkin F7D1102 Surf Wireless Micro" "Bus" +.It Em Card Ta Em Bus +.It "Alfa AWUS036NHR v2" Ta USB 2.0 +.It "ASUS USB-AC56" Ta USB 3.0 +.It "ASUS USB-N10 NANO" Ta USB 2.0 +.It "Belkin F7D1102 Surf Wireless Micro" Ta USB 2.0 +.It "Buffalo WI-U2-433DM" Ta USB 2.0 +.It "Buffalo WI-U3-866D" Ta USB 3.0 +.It "D-Link DWA-123 rev D1" Ta USB 2.0 +.It "D-Link DWA-125 rev D1" Ta USB 2.0 +.It "D-Link DWA-131" Ta USB 2.0 +.It "D-Link DWA-171 rev A1" Ta USB 2.0 +.It "D-Link DWA-172 rev A1" Ta USB 2.0 +.It "D-Link DWA-180 rev A1" Ta USB 2.0 +.It "D-Link DWA-182 rev C1" Ta USB 3.0 +.It "Edimax EW-7811Un" Ta USB 2.0 +.It "Edimax EW-7811UTC" Ta USB 2.0 +.It "Edimax EW-7822UAC" Ta USB 3.0 +.It "Elecom WDC-150SU2M" Ta USB 2.0 +.It "EnGenius EUB1200AC" Ta USB 3.0 +.It "Hawking HD65U" Ta USB 2.0 +.It "Hercules Wireless N USB Pico" Ta USB 2.0 +.It "I-O Data WN-AC867U" Ta USB 3.0 +.It "Linksys WUSB6300" Ta USB 3.0 +.It "NEC AtermWL900U PA-WL900U" Ta USB 3.0 +.It "Netgear A6100" Ta USB 2.0 +.It "Netgear WNA1000M" Ta USB 2.0 +.It "Planex GW-900D" Ta USB 3.0 +.It "Realtek RTL8192CU" Ta USB 2.0 +.It "Realtek RTL8188CUS" Ta USB 2.0 +.It "Sitecom WLA-7100" Ta USB 3.0 +.It "TP-Link Archer T4U" Ta USB 3.0 +.It "TP-LINK TL-WN723N v3" Ta USB 2.0 +.It "TP-LINK TL-WN725N v2" Ta USB 2.0 +.It "TRENDnet TEW-805UB" Ta USB 3.0 +.It "ZyXEL NWD6605" Ta USB 3.0 +.El +.Sh SEE ALSO +.Xr rtwn 4 , +.Xr rtwnfw 4 , +.Xr rtwn_pci 4 , +.Xr usb 4 +.Sh BUGS +The +.Nm +driver does not support any of the 802.11ac capabilities offered by the +adapters. +Additional work is required in +.Xr ieee80211 9 +before those features can be supported. Modified: head/share/man/man4/rtwnfw.4 ============================================================================== --- head/share/man/man4/rtwnfw.4 Mon Oct 17 19:51:00 2016 (r307528) +++ head/share/man/man4/rtwnfw.4 Mon Oct 17 20:38:24 2016 (r307529) @@ -1,4 +1,5 @@ .\" Copyright (c) 2015 Kevin Lo +.\" Copyright (c) 2016 Andriy Voskoboinyk .\" All rights reserved. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 20:41:13 2016 Return-Path: Delivered-To: svn-src-all@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 6EF7BC15693; Mon, 17 Oct 2016 20:41:13 +0000 (UTC) (envelope-from avos@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 3E8AB7A8; Mon, 17 Oct 2016 20:41:13 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HKfCf1015605; Mon, 17 Oct 2016 20:41:12 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HKfCWe015604; Mon, 17 Oct 2016 20:41:12 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201610172041.u9HKfCWe015604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 17 Oct 2016 20:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r307530 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 20:41:13 -0000 Author: avos Date: Mon Oct 17 20:41:12 2016 New Revision: 307530 URL: https://svnweb.freebsd.org/changeset/base/307530 Log: Remove myself from sizelimit.conf Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Mon Oct 17 20:38:24 2016 (r307529) +++ svnadmin/conf/sizelimit.conf Mon Oct 17 20:41:12 2016 (r307530) @@ -15,7 +15,6 @@ # First field is username, second field is the raised limit required. achim -avos bapt brooks davidcs From owner-svn-src-all@freebsd.org Mon Oct 17 20:57:56 2016 Return-Path: Delivered-To: svn-src-all@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 0FD20C15AEE; Mon, 17 Oct 2016 20:57:56 +0000 (UTC) (envelope-from np@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 D373FEB1; Mon, 17 Oct 2016 20:57:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HKvsnq023328; Mon, 17 Oct 2016 20:57:54 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HKvsOs023327; Mon, 17 Oct 2016 20:57:54 GMT (envelope-from np@FreeBSD.org) Message-Id: <201610172057.u9HKvsOs023327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 17 Oct 2016 20:57:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307531 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 20:57:56 -0000 Author: np Date: Mon Oct 17 20:57:54 2016 New Revision: 307531 URL: https://svnweb.freebsd.org/changeset/base/307531 Log: cxgbe(4): Adjust whitespace to line up the column titles in cim_qcfg with the values displayed. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Oct 17 20:41:12 2016 (r307530) +++ head/sys/dev/cxgbe/t4_main.c Mon Oct 17 20:57:54 2016 (r307531) @@ -6156,7 +6156,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", From owner-svn-src-all@freebsd.org Mon Oct 17 21:35:15 2016 Return-Path: Delivered-To: svn-src-all@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 944D4C16313; Mon, 17 Oct 2016 21:35:15 +0000 (UTC) (envelope-from avos@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 3F6F028B; Mon, 17 Oct 2016 21:35:15 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HLZEF0037963; Mon, 17 Oct 2016 21:35:14 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HLZD9a037958; Mon, 17 Oct 2016 21:35:13 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201610172135.u9HLZD9a037958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 17 Oct 2016 21:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307532 - in head: . share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 21:35:15 -0000 Author: avos Date: Mon Oct 17 21:35:13 2016 New Revision: 307532 URL: https://svnweb.freebsd.org/changeset/base/307532 Log: Fix dates + add an UPDATING entry. Modified: head/ObsoleteFiles.inc head/UPDATING head/share/man/man4/rtwn.4 head/share/man/man4/rtwn_pci.4 head/share/man/man4/rtwn_usb.4 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Oct 17 20:57:54 2016 (r307531) +++ head/ObsoleteFiles.inc Mon Oct 17 21:35:13 2016 (r307532) @@ -38,7 +38,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20161016: urtwn(4) was merged into rtwn(4) +# 20161017: urtwn(4) was merged into rtwn(4) OLD_FILES+=usr/share/man/man4/urtwn.4.gz OLD_FILES+=usr/share/man/man4/urtwnfw.4.gz # 20161015: Remove GNU rcs Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Oct 17 20:57:54 2016 (r307531) +++ head/UPDATING Mon Oct 17 21:35:13 2016 (r307532) @@ -31,6 +31,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20161017: + The urtwn(4) driver was merged into rtwn(4) and now consists of + rtwn(4) main module + rtwn_usb(4) and rtwn_pci(4) bus-specific + parts. + Also, firmware for RTL8188CE was renamed due to possible name + conflict (rtwnrtl8192cU(B) -> rtwnrtl8192cE(B)) + 20161015: GNU rcs has been removed from base. It is available as packages: - rcs: Latest GPLv3 GNU rcs version. Modified: head/share/man/man4/rtwn.4 ============================================================================== --- head/share/man/man4/rtwn.4 Mon Oct 17 20:57:54 2016 (r307531) +++ head/share/man/man4/rtwn.4 Mon Oct 17 21:35:13 2016 (r307532) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 19, 2016 +.Dd October 17, 2016 .Dt RTWN 4 .Os .Sh NAME Modified: head/share/man/man4/rtwn_pci.4 ============================================================================== --- head/share/man/man4/rtwn_pci.4 Mon Oct 17 20:57:54 2016 (r307531) +++ head/share/man/man4/rtwn_pci.4 Mon Oct 17 21:35:13 2016 (r307532) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd September 19, 2016 +.Dd October 17, 2016 .Dt RTWN_PCI 4 .Os .Sh NAME Modified: head/share/man/man4/rtwn_usb.4 ============================================================================== --- head/share/man/man4/rtwn_usb.4 Mon Oct 17 20:57:54 2016 (r307531) +++ head/share/man/man4/rtwn_usb.4 Mon Oct 17 21:35:13 2016 (r307532) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd September 19, 2016 +.Dd October 17, 2016 .Dt RTWN_USB 4 .Os .Sh NAME From owner-svn-src-all@freebsd.org Mon Oct 17 21:44:42 2016 Return-Path: Delivered-To: svn-src-all@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 8D520C165E4; Mon, 17 Oct 2016 21:44:42 +0000 (UTC) (envelope-from mckusick@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 5BF86C40; Mon, 17 Oct 2016 21:44:42 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HLif8m041735; Mon, 17 Oct 2016 21:44:41 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HLif26041731; Mon, 17 Oct 2016 21:44:41 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201610172144.u9HLif26041731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 17 Oct 2016 21:44: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: r307533 - in stable/11: share/man/man3 sys/sys sys/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 21:44:42 -0000 Author: mckusick Date: Mon Oct 17 21:44:41 2016 New Revision: 307533 URL: https://svnweb.freebsd.org/changeset/base/307533 Log: MFC r304230: Add two new macros, SLIST_CONCAT and LIST_CONCAT. MFC r304239: Bug 211013 reports that a write error to a UFS filesystem running with softupdates panics the kernel. PR: 211013 Modified: stable/11/share/man/man3/queue.3 stable/11/sys/sys/queue.h stable/11/sys/ufs/ffs/ffs_softdep.c stable/11/sys/ufs/ffs/softdep.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man3/queue.3 ============================================================================== --- stable/11/share/man/man3/queue.3 Mon Oct 17 21:35:13 2016 (r307532) +++ stable/11/share/man/man3/queue.3 Mon Oct 17 21:44:41 2016 (r307533) @@ -28,12 +28,13 @@ .\" @(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd June 24, 2015 +.Dd August 15, 2016 .Dt QUEUE 3 .Os .Sh NAME .Nm SLIST_CLASS_ENTRY , .Nm SLIST_CLASS_HEAD , +.Nm SLIST_CONCAT , .Nm SLIST_EMPTY , .Nm SLIST_ENTRY , .Nm SLIST_FIRST , @@ -75,6 +76,7 @@ .Nm STAILQ_SWAP , .Nm LIST_CLASS_ENTRY , .Nm LIST_CLASS_HEAD , +.Nm LIST_CONCAT , .Nm LIST_EMPTY , .Nm LIST_ENTRY , .Nm LIST_FIRST , @@ -125,6 +127,7 @@ lists and tail queues .\" .Fn SLIST_CLASS_ENTRY "CLASSTYPE" .Fn SLIST_CLASS_HEAD "HEADNAME" "CLASSTYPE" +.Fn SLIST_CONCAT "SLIST_HEAD *head1" "SLIST_HEAD *head2" "TYPE" "SLIST_ENTRY NAME" .Fn SLIST_EMPTY "SLIST_HEAD *head" .Fn SLIST_ENTRY "TYPE" .Fn SLIST_FIRST "SLIST_HEAD *head" @@ -168,6 +171,7 @@ lists and tail queues .\" .Fn LIST_CLASS_ENTRY "CLASSTYPE" .Fn LIST_CLASS_HEAD "HEADNAME" "CLASSTYPE" +.Fn LIST_CONCAT "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME" .Fn LIST_EMPTY "LIST_HEAD *head" .Fn LIST_ENTRY "TYPE" .Fn LIST_FIRST "LIST_HEAD *head" @@ -249,6 +253,8 @@ Singly-linked lists add the following fu .Bl -enum -compact -offset indent .It O(n) removal of any entry in the list. +.It +O(n) concatenation of two lists. .El .Pp Singly-linked tail queues add the following functionality: @@ -296,6 +302,8 @@ Linked lists are the simplest of the dou They add the following functionality over the above: .Bl -enum -compact -offset indent .It +O(n) concatenation of two lists. +.It They may be traversed backwards. .El However: @@ -401,6 +409,19 @@ evaluates to an initializer for the list .Fa head . .Pp The macro +.Nm SLIST_CONCAT +concatenates the list headed by +.Fa head2 +onto the end of the one headed by +.Fa head1 +removing all entries from the former. +Use of this macro should be avoided as it traverses the entirety of the +.Fa head1 +list. +A singly-linked tail queue should be used if this macro is needed in +high-usage code paths or to operate on long lists. +.Pp +The macro .Nm SLIST_EMPTY evaluates to true if there are no elements in the list. .Pp @@ -508,6 +529,9 @@ The macro removes the element .Fa elm from the list. +Use of this macro should be avoided as it traverses the entire list. +A doubly-linked list should be used if this macro is needed in +high-usage code paths or to operate on long lists. .Pp The macro .Nm SLIST_SWAP @@ -724,6 +748,9 @@ The macro removes the element .Fa elm from the tail queue. +Use of this macro should be avoided as it traverses the entire list. +A doubly-linked tail queue should be used if this macro is needed in +high-usage code paths or to operate on long tail queues. .Pp The macro .Nm STAILQ_SWAP @@ -823,6 +850,19 @@ evaluates to an initializer for the list .Fa head . .Pp The macro +.Nm LIST_CONCAT +concatenates the list headed by +.Fa head2 +onto the end of the one headed by +.Fa head1 +removing all entries from the former. +Use of this macro should be avoided as it traverses the entirety of the +.Fa head1 +list. +A tail queue should be used if this macro is needed in +high-usage code paths or to operate on long lists. +.Pp +The macro .Nm LIST_EMPTY evaluates to true if there are no elements in the list. .Pp Modified: stable/11/sys/sys/queue.h ============================================================================== --- stable/11/sys/sys/queue.h Mon Oct 17 21:35:13 2016 (r307532) +++ stable/11/sys/sys/queue.h Mon Oct 17 21:44:41 2016 (r307533) @@ -76,6 +76,10 @@ * * For details on the use of these macros, see the queue(3) manual page. * + * Below is a summary of implemented functions where: + * + means the macro is available + * - means the macro is not available + * s means the macro is available but is slow (runs in O(n) time) * * SLIST LIST STAILQ TAILQ * _HEAD + + + + @@ -101,10 +105,10 @@ * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + * _INSERT_TAIL - - + + - * _CONCAT - - + + + * _CONCAT s s + + * _REMOVE_AFTER + - + - * _REMOVE_HEAD + - + - - * _REMOVE + + + + + * _REMOVE s + s + * _SWAP + + + + * */ @@ -183,6 +187,19 @@ struct { \ /* * Singly-linked List functions. */ +#define SLIST_CONCAT(head1, head2, type, field) do { \ + QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \ + if (curelm == NULL) { \ + if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \ + SLIST_INIT(head2); \ + } else if (SLIST_FIRST(head2) != NULL) { \ + while (SLIST_NEXT(curelm, field) != NULL) \ + curelm = SLIST_NEXT(curelm, field); \ + SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \ + SLIST_INIT(head2); \ + } \ +} while (0) + #define SLIST_EMPTY(head) ((head)->slh_first == NULL) #define SLIST_FIRST(head) ((head)->slh_first) @@ -447,6 +464,23 @@ struct { \ #define QMD_LIST_CHECK_PREV(elm, field) #endif /* (_KERNEL && INVARIANTS) */ +#define LIST_CONCAT(head1, head2, type, field) do { \ + QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \ + if (curelm == NULL) { \ + if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \ + LIST_FIRST(head2)->field.le_prev = \ + &LIST_FIRST((head1)); \ + LIST_INIT(head2); \ + } \ + } else if (LIST_FIRST(head2) != NULL) { \ + while (LIST_NEXT(curelm, field) != NULL) \ + curelm = LIST_NEXT(curelm, field); \ + LIST_NEXT(curelm, field) = LIST_FIRST(head2); \ + LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \ + LIST_INIT(head2); \ + } \ +} while (0) + #define LIST_EMPTY(head) ((head)->lh_first == NULL) #define LIST_FIRST(head) ((head)->lh_first) Modified: stable/11/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_softdep.c Mon Oct 17 21:35:13 2016 (r307532) +++ stable/11/sys/ufs/ffs/ffs_softdep.c Mon Oct 17 21:44:41 2016 (r307533) @@ -752,16 +752,16 @@ static int flush_newblk_dep(struct vnode static int flush_inodedep_deps(struct vnode *, struct mount *, ino_t); static int flush_deplist(struct allocdirectlst *, int, int *); static int sync_cgs(struct mount *, int); -static int handle_written_filepage(struct pagedep *, struct buf *); +static int handle_written_filepage(struct pagedep *, struct buf *, int); static int handle_written_sbdep(struct sbdep *, struct buf *); static void initiate_write_sbdep(struct sbdep *); static void diradd_inode_written(struct diradd *, struct inodedep *); static int handle_written_indirdep(struct indirdep *, struct buf *, - struct buf**); -static int handle_written_inodeblock(struct inodedep *, struct buf *); + struct buf**, int); +static int handle_written_inodeblock(struct inodedep *, struct buf *, int); static int jnewblk_rollforward(struct jnewblk *, struct fs *, struct cg *, uint8_t *); -static int handle_written_bmsafemap(struct bmsafemap *, struct buf *); +static int handle_written_bmsafemap(struct bmsafemap *, struct buf *, int); static void handle_written_jaddref(struct jaddref *); static void handle_written_jremref(struct jremref *); static void handle_written_jseg(struct jseg *, struct buf *); @@ -10903,6 +10903,10 @@ initiate_write_bmsafemap(bmsafemap, bp) struct fs *fs; ino_t ino; + /* + * If this is a background write, we did this at the time that + * the copy was made, so do not need to do it again. + */ if (bmsafemap->sm_state & IOSTARTED) return; bmsafemap->sm_state |= IOSTARTED; @@ -10976,10 +10980,39 @@ softdep_disk_write_complete(bp) /* * If an error occurred while doing the write, then the data - * has not hit the disk and the dependencies cannot be unrolled. + * has not hit the disk and the dependencies cannot be processed. + * But we do have to go through and roll forward any dependencies + * that were rolled back before the disk write. */ - if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & B_INVAL) == 0) + if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & B_INVAL) == 0) { + LIST_FOREACH(wk, &bp->b_dep, wk_list) { + switch (wk->wk_type) { + + case D_PAGEDEP: + handle_written_filepage(WK_PAGEDEP(wk), bp, 0); + continue; + + case D_INODEDEP: + handle_written_inodeblock(WK_INODEDEP(wk), + bp, 0); + continue; + + case D_BMSAFEMAP: + handle_written_bmsafemap(WK_BMSAFEMAP(wk), + bp, 0); + continue; + + case D_INDIRDEP: + handle_written_indirdep(WK_INDIRDEP(wk), + bp, &sbp, 0); + continue; + default: + /* nothing to roll forward */ + continue; + } + } return; + } if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) return; ump = VFSTOUFS(wk->wk_mp); @@ -10999,17 +11032,20 @@ softdep_disk_write_complete(bp) switch (wk->wk_type) { case D_PAGEDEP: - if (handle_written_filepage(WK_PAGEDEP(wk), bp)) + if (handle_written_filepage(WK_PAGEDEP(wk), bp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; case D_INODEDEP: - if (handle_written_inodeblock(WK_INODEDEP(wk), bp)) + if (handle_written_inodeblock(WK_INODEDEP(wk), bp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; case D_BMSAFEMAP: - if (handle_written_bmsafemap(WK_BMSAFEMAP(wk), bp)) + if (handle_written_bmsafemap(WK_BMSAFEMAP(wk), bp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; @@ -11028,7 +11064,8 @@ softdep_disk_write_complete(bp) continue; case D_INDIRDEP: - if (handle_written_indirdep(WK_INDIRDEP(wk), bp, &sbp)) + if (handle_written_indirdep(WK_INDIRDEP(wk), bp, &sbp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; @@ -11328,12 +11365,17 @@ handle_bufwait(inodedep, refhd) * Called from within softdep_disk_write_complete above to restore * in-memory inode block contents to their most up-to-date state. Note * that this routine is always called from interrupt level with further - * splbio interrupts blocked. + * interrupts from this device blocked. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. */ static int -handle_written_inodeblock(inodedep, bp) +handle_written_inodeblock(inodedep, bp, flags) struct inodedep *inodedep; struct buf *bp; /* buffer containing the inode block */ + int flags; { struct freefile *freefile; struct allocdirect *adp, *nextadp; @@ -11363,7 +11405,8 @@ handle_written_inodeblock(inodedep, bp) /* * Leave this inodeblock dirty until it's in the list. */ - if ((inodedep->id_state & (UNLINKED | UNLINKONLIST)) == UNLINKED) { + if ((inodedep->id_state & (UNLINKED | UNLINKONLIST)) == UNLINKED && + (flags & WRITESUCCEEDED)) { struct inodedep *inon; inon = TAILQ_NEXT(inodedep, id_unlinked); @@ -11402,7 +11445,8 @@ handle_written_inodeblock(inodedep, bp) goto bufwait; return (1); } - inodedep->id_state |= COMPLETE; + if (flags & WRITESUCCEEDED) + inodedep->id_state |= COMPLETE; /* * Roll forward anything that had to be rolled back before * the inode could be updated. @@ -11517,6 +11561,13 @@ handle_written_inodeblock(inodedep, bp) bdirty(bp); bufwait: /* + * If the write did not succeed, we have done all the roll-forward + * operations, but we cannot take the actions that will allow its + * dependencies to be processed. + */ + if ((flags & WRITESUCCEEDED) == 0) + return (hadchanges); + /* * Process any allocdirects that completed during the update. */ if ((adp = TAILQ_FIRST(&inodedep->id_inoupdt)) != NULL) @@ -11573,11 +11624,20 @@ bufwait: return (hadchanges); } +/* + * Perform needed roll-forwards and kick off any dependencies that + * can now be processed. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. + */ static int -handle_written_indirdep(indirdep, bp, bpp) +handle_written_indirdep(indirdep, bp, bpp, flags) struct indirdep *indirdep; struct buf *bp; struct buf **bpp; + int flags; { struct allocindir *aip; struct buf *sbp; @@ -11602,6 +11662,16 @@ handle_written_indirdep(indirdep, bp, bp indirdep->ir_state &= ~(UNDONE | IOSTARTED); indirdep->ir_state |= ATTACHED; /* + * If the write did not succeed, we have done all the roll-forward + * operations, but we cannot take the actions that will allow its + * dependencies to be processed. + */ + if ((flags & WRITESUCCEEDED) == 0) { + stat_indir_blk_ptrs++; + bdirty(bp); + return (1); + } + /* * Move allocindirs with written pointers to the completehd if * the indirdep's pointer is not yet written. Otherwise * free them here. @@ -11755,11 +11825,16 @@ jnewblk_rollforward(jnewblk, fs, cgp, bl * Complete a write to a bmsafemap structure. Roll forward any bitmap * changes if it's not a background write. Set all written dependencies * to DEPCOMPLETE and free the structure if possible. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. */ static int -handle_written_bmsafemap(bmsafemap, bp) +handle_written_bmsafemap(bmsafemap, bp, flags) struct bmsafemap *bmsafemap; struct buf *bp; + int flags; { struct newblk *newblk; struct inodedep *inodedep; @@ -11775,15 +11850,20 @@ handle_written_bmsafemap(bmsafemap, bp) int chgs; if ((bmsafemap->sm_state & IOSTARTED) == 0) - panic("initiate_write_bmsafemap: Not started\n"); + panic("handle_written_bmsafemap: Not started\n"); ump = VFSTOUFS(bmsafemap->sm_list.wk_mp); chgs = 0; bmsafemap->sm_state &= ~IOSTARTED; foreground = (bp->b_xflags & BX_BKGRDMARKER) == 0; /* - * Release journal work that was waiting on the write. + * If write was successful, release journal work that was waiting + * on the write. Otherwise move the work back. */ - handle_jwork(&bmsafemap->sm_freewr); + if (flags & WRITESUCCEEDED) + handle_jwork(&bmsafemap->sm_freewr); + else + LIST_CONCAT(&bmsafemap->sm_freehd, &bmsafemap->sm_freewr, + worklist, wk_list); /* * Restore unwritten inode allocation pending jaddref writes. @@ -11833,6 +11913,20 @@ handle_written_bmsafemap(bmsafemap, bp) free_jnewblk(jnewblk); } } + /* + * If the write did not succeed, we have done all the roll-forward + * operations, but we cannot take the actions that will allow its + * dependencies to be processed. + */ + if ((flags & WRITESUCCEEDED) == 0) { + LIST_CONCAT(&bmsafemap->sm_newblkhd, &bmsafemap->sm_newblkwr, + newblk, nb_deps); + LIST_CONCAT(&bmsafemap->sm_freehd, &bmsafemap->sm_freewr, + worklist, wk_list); + if (foreground) + bdirty(bp); + return (1); + } while ((newblk = LIST_FIRST(&bmsafemap->sm_newblkwr))) { newblk->nb_state |= DEPCOMPLETE; newblk->nb_state &= ~ONDEPLIST; @@ -11936,12 +12030,17 @@ free_pagedep(pagedep) * A write operation was just completed. Removed inodes can * now be freed and associated block pointers may be committed. * Note that this routine is always called from interrupt level - * with further splbio interrupts blocked. + * with further interrupts from this device blocked. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. */ static int -handle_written_filepage(pagedep, bp) +handle_written_filepage(pagedep, bp, flags) struct pagedep *pagedep; struct buf *bp; /* buffer containing the written page */ + int flags; { struct dirrem *dirrem; struct diradd *dap, *nextdap; @@ -11951,6 +12050,8 @@ handle_written_filepage(pagedep, bp) if ((pagedep->pd_state & IOSTARTED) == 0) panic("handle_written_filepage: not started"); pagedep->pd_state &= ~IOSTARTED; + if ((flags & WRITESUCCEEDED) == 0) + goto rollforward; /* * Process any directory removals that have been committed. */ @@ -11970,6 +12071,7 @@ handle_written_filepage(pagedep, bp) if ((pagedep->pd_state & NEWBLOCK) == 0) while ((dap = LIST_FIRST(&pagedep->pd_pendinghd)) != NULL) free_diradd(dap, NULL); +rollforward: /* * Uncommitted directory entries must be restored. */ @@ -12002,7 +12104,7 @@ handle_written_filepage(pagedep, bp) * marked dirty so that its will eventually get written back in * its correct form. */ - if (chgs) { + if (chgs || (flags & WRITESUCCEEDED) == 0) { if ((bp->b_flags & B_DELWRI) == 0) stat_dir_entry++; bdirty(bp); Modified: stable/11/sys/ufs/ffs/softdep.h ============================================================================== --- stable/11/sys/ufs/ffs/softdep.h Mon Oct 17 21:35:13 2016 (r307532) +++ stable/11/sys/ufs/ffs/softdep.h Mon Oct 17 21:44:41 2016 (r307533) @@ -140,6 +140,7 @@ #define UNLINKPREV 0x100000 /* inodedep is pointed at in the unlink list */ #define UNLINKONLIST 0x200000 /* inodedep is in the unlinked list on disk */ #define UNLINKLINKS (UNLINKNEXT | UNLINKPREV) +#define WRITESUCCEEDED 0x400000 /* the disk write completed successfully */ #define ALLCOMPLETE (ATTACHED | COMPLETE | DEPCOMPLETE) From owner-svn-src-all@freebsd.org Mon Oct 17 21:49:56 2016 Return-Path: Delivered-To: svn-src-all@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 12AE7C1670C; Mon, 17 Oct 2016 21:49:56 +0000 (UTC) (envelope-from mckusick@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 CE1A0F09; Mon, 17 Oct 2016 21:49:55 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HLnsZC041974; Mon, 17 Oct 2016 21:49:54 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HLnsQW041970; Mon, 17 Oct 2016 21:49:54 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201610172149.u9HLnsQW041970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 17 Oct 2016 21:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307534 - in stable/10: share/man/man3 sys/sys sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 21:49:56 -0000 Author: mckusick Date: Mon Oct 17 21:49:54 2016 New Revision: 307534 URL: https://svnweb.freebsd.org/changeset/base/307534 Log: MFC r304230: Add two new macros, SLIST_CONCAT and LIST_CONCAT. MFC r304239: Bug 211013 reports that a write error to a UFS filesystem running with softupdates panics the kernel. PR: 211013 Modified: stable/10/share/man/man3/queue.3 stable/10/sys/sys/queue.h stable/10/sys/ufs/ffs/ffs_softdep.c stable/10/sys/ufs/ffs/softdep.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man3/queue.3 ============================================================================== --- stable/10/share/man/man3/queue.3 Mon Oct 17 21:44:41 2016 (r307533) +++ stable/10/share/man/man3/queue.3 Mon Oct 17 21:49:54 2016 (r307534) @@ -32,12 +32,13 @@ .\" @(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd June 24, 2015 +.Dd August 15, 2016 .Dt QUEUE 3 .Os .Sh NAME .Nm SLIST_CLASS_ENTRY , .Nm SLIST_CLASS_HEAD , +.Nm SLIST_CONCAT , .Nm SLIST_EMPTY , .Nm SLIST_ENTRY , .Nm SLIST_FIRST , @@ -79,6 +80,7 @@ .Nm STAILQ_SWAP , .Nm LIST_CLASS_ENTRY , .Nm LIST_CLASS_HEAD , +.Nm LIST_CONCAT , .Nm LIST_EMPTY , .Nm LIST_ENTRY , .Nm LIST_FIRST , @@ -129,6 +131,7 @@ lists and tail queues .\" .Fn SLIST_CLASS_ENTRY "CLASSTYPE" .Fn SLIST_CLASS_HEAD "HEADNAME" "CLASSTYPE" +.Fn SLIST_CONCAT "SLIST_HEAD *head1" "SLIST_HEAD *head2" "TYPE" "SLIST_ENTRY NAME" .Fn SLIST_EMPTY "SLIST_HEAD *head" .Fn SLIST_ENTRY "TYPE" .Fn SLIST_FIRST "SLIST_HEAD *head" @@ -172,6 +175,7 @@ lists and tail queues .\" .Fn LIST_CLASS_ENTRY "CLASSTYPE" .Fn LIST_CLASS_HEAD "HEADNAME" "CLASSTYPE" +.Fn LIST_CONCAT "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME" .Fn LIST_EMPTY "LIST_HEAD *head" .Fn LIST_ENTRY "TYPE" .Fn LIST_FIRST "LIST_HEAD *head" @@ -253,6 +257,8 @@ Singly-linked lists add the following fu .Bl -enum -compact -offset indent .It O(n) removal of any entry in the list. +.It +O(n) concatenation of two lists. .El .Pp Singly-linked tail queues add the following functionality: @@ -300,6 +306,8 @@ Linked lists are the simplest of the dou They add the following functionality over the above: .Bl -enum -compact -offset indent .It +O(n) concatenation of two lists. +.It They may be traversed backwards. .El However: @@ -405,6 +413,19 @@ evaluates to an initializer for the list .Fa head . .Pp The macro +.Nm SLIST_CONCAT +concatenates the list headed by +.Fa head2 +onto the end of the one headed by +.Fa head1 +removing all entries from the former. +Use of this macro should be avoided as it traverses the entirety of the +.Fa head1 +list. +A singly-linked tail queue should be used if this macro is needed in +high-usage code paths or to operate on long lists. +.Pp +The macro .Nm SLIST_EMPTY evaluates to true if there are no elements in the list. .Pp @@ -512,6 +533,9 @@ The macro removes the element .Fa elm from the list. +Use of this macro should be avoided as it traverses the entire list. +A doubly-linked list should be used if this macro is needed in +high-usage code paths or to operate on long lists. .Pp The macro .Nm SLIST_SWAP @@ -728,6 +752,9 @@ The macro removes the element .Fa elm from the tail queue. +Use of this macro should be avoided as it traverses the entire list. +A doubly-linked tail queue should be used if this macro is needed in +high-usage code paths or to operate on long tail queues. .Pp The macro .Nm STAILQ_SWAP @@ -827,6 +854,19 @@ evaluates to an initializer for the list .Fa head . .Pp The macro +.Nm LIST_CONCAT +concatenates the list headed by +.Fa head2 +onto the end of the one headed by +.Fa head1 +removing all entries from the former. +Use of this macro should be avoided as it traverses the entirety of the +.Fa head1 +list. +A tail queue should be used if this macro is needed in +high-usage code paths or to operate on long lists. +.Pp +The macro .Nm LIST_EMPTY evaluates to true if there are no elements in the list. .Pp Modified: stable/10/sys/sys/queue.h ============================================================================== --- stable/10/sys/sys/queue.h Mon Oct 17 21:44:41 2016 (r307533) +++ stable/10/sys/sys/queue.h Mon Oct 17 21:49:54 2016 (r307534) @@ -76,6 +76,10 @@ * * For details on the use of these macros, see the queue(3) manual page. * + * Below is a summary of implemented functions where: + * + means the macro is available + * - means the macro is not available + * s means the macro is available but is slow (runs in O(n) time) * * SLIST LIST STAILQ TAILQ * _HEAD + + + + @@ -101,10 +105,10 @@ * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + * _INSERT_TAIL - - + + - * _CONCAT - - + + + * _CONCAT s s + + * _REMOVE_AFTER + - + - * _REMOVE_HEAD + - + - - * _REMOVE + + + + + * _REMOVE s + s + * _SWAP + + + + * */ @@ -183,6 +187,19 @@ struct { \ /* * Singly-linked List functions. */ +#define SLIST_CONCAT(head1, head2, type, field) do { \ + QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \ + if (curelm == NULL) { \ + if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \ + SLIST_INIT(head2); \ + } else if (SLIST_FIRST(head2) != NULL) { \ + while (SLIST_NEXT(curelm, field) != NULL) \ + curelm = SLIST_NEXT(curelm, field); \ + SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \ + SLIST_INIT(head2); \ + } \ +} while (0) + #define SLIST_EMPTY(head) ((head)->slh_first == NULL) #define SLIST_FIRST(head) ((head)->slh_first) @@ -447,6 +464,23 @@ struct { \ #define QMD_LIST_CHECK_PREV(elm, field) #endif /* (_KERNEL && INVARIANTS) */ +#define LIST_CONCAT(head1, head2, type, field) do { \ + QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \ + if (curelm == NULL) { \ + if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \ + LIST_FIRST(head2)->field.le_prev = \ + &LIST_FIRST((head1)); \ + LIST_INIT(head2); \ + } \ + } else if (LIST_FIRST(head2) != NULL) { \ + while (LIST_NEXT(curelm, field) != NULL) \ + curelm = LIST_NEXT(curelm, field); \ + LIST_NEXT(curelm, field) = LIST_FIRST(head2); \ + LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \ + LIST_INIT(head2); \ + } \ +} while (0) + #define LIST_EMPTY(head) ((head)->lh_first == NULL) #define LIST_FIRST(head) ((head)->lh_first) Modified: stable/10/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_softdep.c Mon Oct 17 21:44:41 2016 (r307533) +++ stable/10/sys/ufs/ffs/ffs_softdep.c Mon Oct 17 21:49:54 2016 (r307534) @@ -751,16 +751,16 @@ static int flush_newblk_dep(struct vnode static int flush_inodedep_deps(struct vnode *, struct mount *, ino_t); static int flush_deplist(struct allocdirectlst *, int, int *); static int sync_cgs(struct mount *, int); -static int handle_written_filepage(struct pagedep *, struct buf *); +static int handle_written_filepage(struct pagedep *, struct buf *, int); static int handle_written_sbdep(struct sbdep *, struct buf *); static void initiate_write_sbdep(struct sbdep *); static void diradd_inode_written(struct diradd *, struct inodedep *); static int handle_written_indirdep(struct indirdep *, struct buf *, - struct buf**); -static int handle_written_inodeblock(struct inodedep *, struct buf *); + struct buf**, int); +static int handle_written_inodeblock(struct inodedep *, struct buf *, int); static int jnewblk_rollforward(struct jnewblk *, struct fs *, struct cg *, uint8_t *); -static int handle_written_bmsafemap(struct bmsafemap *, struct buf *); +static int handle_written_bmsafemap(struct bmsafemap *, struct buf *, int); static void handle_written_jaddref(struct jaddref *); static void handle_written_jremref(struct jremref *); static void handle_written_jseg(struct jseg *, struct buf *); @@ -10868,6 +10868,10 @@ initiate_write_bmsafemap(bmsafemap, bp) struct fs *fs; ino_t ino; + /* + * If this is a background write, we did this at the time that + * the copy was made, so do not need to do it again. + */ if (bmsafemap->sm_state & IOSTARTED) return; bmsafemap->sm_state |= IOSTARTED; @@ -10941,10 +10945,39 @@ softdep_disk_write_complete(bp) /* * If an error occurred while doing the write, then the data - * has not hit the disk and the dependencies cannot be unrolled. + * has not hit the disk and the dependencies cannot be processed. + * But we do have to go through and roll forward any dependencies + * that were rolled back before the disk write. */ - if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & B_INVAL) == 0) + if ((bp->b_ioflags & BIO_ERROR) != 0 && (bp->b_flags & B_INVAL) == 0) { + LIST_FOREACH(wk, &bp->b_dep, wk_list) { + switch (wk->wk_type) { + + case D_PAGEDEP: + handle_written_filepage(WK_PAGEDEP(wk), bp, 0); + continue; + + case D_INODEDEP: + handle_written_inodeblock(WK_INODEDEP(wk), + bp, 0); + continue; + + case D_BMSAFEMAP: + handle_written_bmsafemap(WK_BMSAFEMAP(wk), + bp, 0); + continue; + + case D_INDIRDEP: + handle_written_indirdep(WK_INDIRDEP(wk), + bp, &sbp, 0); + continue; + default: + /* nothing to roll forward */ + continue; + } + } return; + } if ((wk = LIST_FIRST(&bp->b_dep)) == NULL) return; ump = VFSTOUFS(wk->wk_mp); @@ -10964,17 +10997,20 @@ softdep_disk_write_complete(bp) switch (wk->wk_type) { case D_PAGEDEP: - if (handle_written_filepage(WK_PAGEDEP(wk), bp)) + if (handle_written_filepage(WK_PAGEDEP(wk), bp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; case D_INODEDEP: - if (handle_written_inodeblock(WK_INODEDEP(wk), bp)) + if (handle_written_inodeblock(WK_INODEDEP(wk), bp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; case D_BMSAFEMAP: - if (handle_written_bmsafemap(WK_BMSAFEMAP(wk), bp)) + if (handle_written_bmsafemap(WK_BMSAFEMAP(wk), bp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; @@ -10993,7 +11029,8 @@ softdep_disk_write_complete(bp) continue; case D_INDIRDEP: - if (handle_written_indirdep(WK_INDIRDEP(wk), bp, &sbp)) + if (handle_written_indirdep(WK_INDIRDEP(wk), bp, &sbp, + WRITESUCCEEDED)) WORKLIST_INSERT(&reattach, wk); continue; @@ -11293,12 +11330,17 @@ handle_bufwait(inodedep, refhd) * Called from within softdep_disk_write_complete above to restore * in-memory inode block contents to their most up-to-date state. Note * that this routine is always called from interrupt level with further - * splbio interrupts blocked. + * interrupts from this device blocked. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. */ static int -handle_written_inodeblock(inodedep, bp) +handle_written_inodeblock(inodedep, bp, flags) struct inodedep *inodedep; struct buf *bp; /* buffer containing the inode block */ + int flags; { struct freefile *freefile; struct allocdirect *adp, *nextadp; @@ -11328,7 +11370,8 @@ handle_written_inodeblock(inodedep, bp) /* * Leave this inodeblock dirty until it's in the list. */ - if ((inodedep->id_state & (UNLINKED | UNLINKONLIST)) == UNLINKED) { + if ((inodedep->id_state & (UNLINKED | UNLINKONLIST)) == UNLINKED && + (flags & WRITESUCCEEDED)) { struct inodedep *inon; inon = TAILQ_NEXT(inodedep, id_unlinked); @@ -11367,7 +11410,8 @@ handle_written_inodeblock(inodedep, bp) goto bufwait; return (1); } - inodedep->id_state |= COMPLETE; + if (flags & WRITESUCCEEDED) + inodedep->id_state |= COMPLETE; /* * Roll forward anything that had to be rolled back before * the inode could be updated. @@ -11482,6 +11526,13 @@ handle_written_inodeblock(inodedep, bp) bdirty(bp); bufwait: /* + * If the write did not succeed, we have done all the roll-forward + * operations, but we cannot take the actions that will allow its + * dependencies to be processed. + */ + if ((flags & WRITESUCCEEDED) == 0) + return (hadchanges); + /* * Process any allocdirects that completed during the update. */ if ((adp = TAILQ_FIRST(&inodedep->id_inoupdt)) != NULL) @@ -11538,11 +11589,20 @@ bufwait: return (hadchanges); } +/* + * Perform needed roll-forwards and kick off any dependencies that + * can now be processed. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. + */ static int -handle_written_indirdep(indirdep, bp, bpp) +handle_written_indirdep(indirdep, bp, bpp, flags) struct indirdep *indirdep; struct buf *bp; struct buf **bpp; + int flags; { struct allocindir *aip; struct buf *sbp; @@ -11567,6 +11627,16 @@ handle_written_indirdep(indirdep, bp, bp indirdep->ir_state &= ~(UNDONE | IOSTARTED); indirdep->ir_state |= ATTACHED; /* + * If the write did not succeed, we have done all the roll-forward + * operations, but we cannot take the actions that will allow its + * dependencies to be processed. + */ + if ((flags & WRITESUCCEEDED) == 0) { + stat_indir_blk_ptrs++; + bdirty(bp); + return (1); + } + /* * Move allocindirs with written pointers to the completehd if * the indirdep's pointer is not yet written. Otherwise * free them here. @@ -11720,11 +11790,16 @@ jnewblk_rollforward(jnewblk, fs, cgp, bl * Complete a write to a bmsafemap structure. Roll forward any bitmap * changes if it's not a background write. Set all written dependencies * to DEPCOMPLETE and free the structure if possible. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. */ static int -handle_written_bmsafemap(bmsafemap, bp) +handle_written_bmsafemap(bmsafemap, bp, flags) struct bmsafemap *bmsafemap; struct buf *bp; + int flags; { struct newblk *newblk; struct inodedep *inodedep; @@ -11740,15 +11815,20 @@ handle_written_bmsafemap(bmsafemap, bp) int chgs; if ((bmsafemap->sm_state & IOSTARTED) == 0) - panic("initiate_write_bmsafemap: Not started\n"); + panic("handle_written_bmsafemap: Not started\n"); ump = VFSTOUFS(bmsafemap->sm_list.wk_mp); chgs = 0; bmsafemap->sm_state &= ~IOSTARTED; foreground = (bp->b_xflags & BX_BKGRDMARKER) == 0; /* - * Release journal work that was waiting on the write. + * If write was successful, release journal work that was waiting + * on the write. Otherwise move the work back. */ - handle_jwork(&bmsafemap->sm_freewr); + if (flags & WRITESUCCEEDED) + handle_jwork(&bmsafemap->sm_freewr); + else + LIST_CONCAT(&bmsafemap->sm_freehd, &bmsafemap->sm_freewr, + worklist, wk_list); /* * Restore unwritten inode allocation pending jaddref writes. @@ -11798,6 +11878,20 @@ handle_written_bmsafemap(bmsafemap, bp) free_jnewblk(jnewblk); } } + /* + * If the write did not succeed, we have done all the roll-forward + * operations, but we cannot take the actions that will allow its + * dependencies to be processed. + */ + if ((flags & WRITESUCCEEDED) == 0) { + LIST_CONCAT(&bmsafemap->sm_newblkhd, &bmsafemap->sm_newblkwr, + newblk, nb_deps); + LIST_CONCAT(&bmsafemap->sm_freehd, &bmsafemap->sm_freewr, + worklist, wk_list); + if (foreground) + bdirty(bp); + return (1); + } while ((newblk = LIST_FIRST(&bmsafemap->sm_newblkwr))) { newblk->nb_state |= DEPCOMPLETE; newblk->nb_state &= ~ONDEPLIST; @@ -11901,12 +11995,17 @@ free_pagedep(pagedep) * A write operation was just completed. Removed inodes can * now be freed and associated block pointers may be committed. * Note that this routine is always called from interrupt level - * with further splbio interrupts blocked. + * with further interrupts from this device blocked. + * + * If the write did not succeed, we will do all the roll-forward + * operations, but we will not take the actions that will allow its + * dependencies to be processed. */ static int -handle_written_filepage(pagedep, bp) +handle_written_filepage(pagedep, bp, flags) struct pagedep *pagedep; struct buf *bp; /* buffer containing the written page */ + int flags; { struct dirrem *dirrem; struct diradd *dap, *nextdap; @@ -11916,6 +12015,8 @@ handle_written_filepage(pagedep, bp) if ((pagedep->pd_state & IOSTARTED) == 0) panic("handle_written_filepage: not started"); pagedep->pd_state &= ~IOSTARTED; + if ((flags & WRITESUCCEEDED) == 0) + goto rollforward; /* * Process any directory removals that have been committed. */ @@ -11935,6 +12036,7 @@ handle_written_filepage(pagedep, bp) if ((pagedep->pd_state & NEWBLOCK) == 0) while ((dap = LIST_FIRST(&pagedep->pd_pendinghd)) != NULL) free_diradd(dap, NULL); +rollforward: /* * Uncommitted directory entries must be restored. */ @@ -11967,7 +12069,7 @@ handle_written_filepage(pagedep, bp) * marked dirty so that its will eventually get written back in * its correct form. */ - if (chgs) { + if (chgs || (flags & WRITESUCCEEDED) == 0) { if ((bp->b_flags & B_DELWRI) == 0) stat_dir_entry++; bdirty(bp); Modified: stable/10/sys/ufs/ffs/softdep.h ============================================================================== --- stable/10/sys/ufs/ffs/softdep.h Mon Oct 17 21:44:41 2016 (r307533) +++ stable/10/sys/ufs/ffs/softdep.h Mon Oct 17 21:49:54 2016 (r307534) @@ -140,6 +140,7 @@ #define UNLINKPREV 0x100000 /* inodedep is pointed at in the unlink list */ #define UNLINKONLIST 0x200000 /* inodedep is in the unlinked list on disk */ #define UNLINKLINKS (UNLINKNEXT | UNLINKPREV) +#define WRITESUCCEEDED 0x400000 /* the disk write completed successfully */ #define ALLCOMPLETE (ATTACHED | COMPLETE | DEPCOMPLETE) From owner-svn-src-all@freebsd.org Mon Oct 17 22:07:50 2016 Return-Path: Delivered-To: svn-src-all@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 7C6F5C16B4E; Mon, 17 Oct 2016 22:07:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F619C0B; Mon, 17 Oct 2016 22:07:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id C3B1F10AF7E; Mon, 17 Oct 2016 18:07:48 -0400 (EDT) From: John Baldwin To: Luigi Rizzo Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap Date: Mon, 17 Oct 2016 15:07:40 -0700 Message-ID: <2315348.5F9GHXx3dh@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201610161413.u9GEDW91013522@repo.freebsd.org> References: <201610161413.u9GEDW91013522@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 17 Oct 2016 18:07:48 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:07:50 -0000 On Sunday, October 16, 2016 02:13:32 PM Luigi Rizzo wrote: > Author: luigi > Date: Sun Oct 16 14:13:32 2016 > New Revision: 307394 > URL: https://svnweb.freebsd.org/changeset/base/307394 > > Log: > Import the current version of netmap, aligned with the one on github. > > This commit, long overdue, contains contributions in the last 2 years > from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including: > + fixes on monitor ports > + the 'ptnet' virtual device driver, and ptnetmap backend, for > high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit) > + improved emulated netmap mode > + more robust error handling > + removal of stale code > + various fixes to code and documentation (some mixup between RX and TX > parameters, and private and public variables) > > We also include an additional tool, nmreplay, which is functionally > equivalent to tcpreplay but operating on netmap ports. FYI, this broke the build of the following kernel configs from 'make tinderbox': sparc64 LINT kernel failed, check _.sparc64.LINT for details i386 LINT-NOINET kernel failed, check _.i386.LINT-NOINET for details i386 LINT kernel failed, check _.i386.LINT for details pc98 LINT kernel failed, check _.pc98.LINT for details i386 LINT-NOINET6 kernel failed, check _.i386.LINT-NOINET6 for details i386 LINT-NOIP kernel failed, check _.i386.LINT-NOIP for details i386 LINT-VIMAGE kernel failed, check _.i386.LINT-VIMAGE for details amd64 LINT kernel failed, check _.amd64.LINT for details amd64 LINT-NOINET kernel failed, check _.amd64.LINT-NOINET for details powerpc LINT kernel failed, check _.powerpc.LINT for details powerpc LINT64 kernel failed, check _.powerpc.LINT64 for details amd64 LINT-NOINET6 kernel failed, check _.amd64.LINT-NOINET6 for details amd64 LINT-NOIP kernel failed, check _.amd64.LINT-NOIP for details amd64 LINT-VIMAGE kernel failed, check _.amd64.LINT-VIMAGE for details arm LINT kernel failed, check _.arm.LINT for details Some of the errors: (1) In file included from /zoo/jhb/git/freebsd/sys/modules/em/../../dev/e1000/if_lem .c:343: /zoo/jhb/git/freebsd/sys/dev/netmap/if_lem_netmap.h:42: warning: redundant redec laration of 'netmap_adaptive_io' [-Wredundant-decls] /zoo/jhb/git/freebsd/sys/dev/netmap/netmap_kern.h:1529: warning: previous declar (2) /zoo/jhb/git/freebsd/sys/dev/netmap/if_ptnet.c:347:15: error: shift count >= wid th of type [-Werror,-Wshift-count-overflow] (paddr >> 32) & 0xffffffff); ^ ~~ /zoo/jhb/git/freebsd/sys/sys/bus.h:882:59: note: expanded from macro 'bus_write_4' bus_space_write_4((r)->r_bustag, (r)->r_bushandle, (o), (v)) ^ For this one I think 'paddr' should be 'uint64_t' instead of 'vm_paddr_t' which should fix the build on 32-bit platforms. (3) /zoo/jhb/git/freebsd/sys/dev/netmap/netmap_pt.c:72:9: error: 'DEBUG' macro redefined [-Werror,-Wmacro-redefined] #define DEBUG /* Enables communication debugging. */ ^ ./opt_global.h:40:9: note: previous definition is here #define DEBUG 1 ^ (4) /zoo/jhb/git/freebsd/sys/dev/netmap/netmap_freebsd.c:671:4: error: format specif ies type 'unsigned long' but the argument has type 'vm_paddr_t' (aka 'unsigned i nt') [-Werror,-Wformat] *nm_paddr, ^~~~~~~~~ /zoo/jhb/git/freebsd/sys/dev/netmap/netmap_kern.h:249:29: note: expanded from ma cro 'D' __LINE__, __FUNCTION__, ##__VA_ARGS__); \ ^~~~~~~~~~~ /zoo/jhb/git/freebsd/sys/dev/netmap/netmap_freebsd.c:672:4: error: format specif ies type 'unsigned long' but the argument has type 'rman_res_t' (aka 'unsigned l ong long') [-Werror,-Wformat] rman_get_size(ptn_dev->pci_mem), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /zoo/jhb/git/freebsd/sys/dev/netmap/netmap_kern.h:249:29: note: expanded from ma cro 'D' __LINE__, __FUNCTION__, ##__VA_ARGS__); \ ^~~~~~~~~~~ -- John Baldwin From owner-svn-src-all@freebsd.org Mon Oct 17 22:07:52 2016 Return-Path: Delivered-To: svn-src-all@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 D274FC16B5D; Mon, 17 Oct 2016 22:07:52 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BBEBC10; Mon, 17 Oct 2016 22:07:52 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x242.google.com with SMTP id k64so4336902itb.0; Mon, 17 Oct 2016 15:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=k2CbkxkY6hS8sugzASnJnmkPEzTwHi4dNlvFAYjqXzA=; b=amEe/i3nSOw5GqWrmaQNHxH5VK2Yy528D1LbBE726nlQp69ZOjHwsMdijUrb0vPMOX DIgKu+nfbBULcYfnKvuEMvXYWXVGBQIw57J1T88mcvD6sAPwEK5zoaVuuFv2cfAZ41ri HiV8ZnCS7Z+RkeIr8WIOBcg9s3iPv3xCPNXm+0O8PujnYJa4Sv24kAMdHz8EmC+komrc 194Rfc0ogaJslsPWNt/y3QExoh8gzvJVfnGL7JAUXjHrWk61r0mNoWzL9woecXErVH2E NtXvlswFi0H0lBxPAk4Ku/mIidgxzNeqpy5N1MNcyUU29yxDqo2+5Kjin8OExe1G9OAF DvGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=k2CbkxkY6hS8sugzASnJnmkPEzTwHi4dNlvFAYjqXzA=; b=KlIbHC/LDkQQZgf32ToqnrXI+cZzwP57dO0Z1jgo13unUKLBVIjKhIPQ5muXk+VpN8 bq1N10JZgoLBV+Xn5qipPYrz/TqrCAusKYOerdamSucODiwPI1KyNY/0OdXgohPr4n2R 0J6jUPatmGrQfGn4b8zCAKmCbPaN3K3FNgvBiEKEg9Y0xSl0w231GwoihjR5uygxekH/ xEmmoPQxu6uZNDAi3WKQ6Lu6Z2DsH6PRgPYM6q/19lyP1FG5IGXVWONJwwPAInukT7Ak /NcxdLNaQ5EpilEcpgODWUvs7CBohhxTUB3SJGyoNIZ3phxgVJwk2JHlTfCQrSdnpOkD holg== X-Gm-Message-State: AA6/9RnWZVDu9bCk8FXb5nGaZm92v+aJuxXHxMFyBdX8tVgw2FuuAfzFFfZyw0kuOqyHMELYNXCLlg8w+/+nkA== X-Received: by 10.36.142.196 with SMTP id h187mr10565247ite.108.1476742071821; Mon, 17 Oct 2016 15:07:51 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.180.211 with HTTP; Mon, 17 Oct 2016 15:07:31 -0700 (PDT) In-Reply-To: <201610161413.u9GEDW91013522@repo.freebsd.org> References: <201610161413.u9GEDW91013522@repo.freebsd.org> From: Ed Maste Date: Mon, 17 Oct 2016 18:07:31 -0400 X-Google-Sender-Auth: 6CzI_4hZpBavNFFuDPO4XBnAduA Message-ID: Subject: Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap To: Luigi Rizzo Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:07:52 -0000 On 16 October 2016 at 10:13, Luigi Rizzo wrote: > Author: luigi > Date: Sun Oct 16 14:13:32 2016 > New Revision: 307394 > URL: https://svnweb.freebsd.org/changeset/base/307394 > > Log: > Import the current version of netmap, aligned with the one on github. my tinderbox build failed with this, in sparc64 LINT: In file included from /scratch/tmp/emaste/freebsd/sys/modules/em/../../dev/e1000/if_lem.c:343: /scratch/tmp/emaste/freebsd/sys/dev/netmap/if_lem_netmap.h:42: warning: redundant redeclaration of 'netmap_adaptive_io' [-Wredundant-decls] /scratch/tmp/emaste/freebsd/sys/dev/netmap/netmap_kern.h:1529: warning: previous declaration of 'netmap_adaptive_io' was here *** [if_lem.o] Error code 1 From owner-svn-src-all@freebsd.org Mon Oct 17 22:33:30 2016 Return-Path: Delivered-To: svn-src-all@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 EAE65C157EC; Mon, 17 Oct 2016 22:33:30 +0000 (UTC) (envelope-from mckusick@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 AB98F1C9; Mon, 17 Oct 2016 22:33:30 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HMXTbr061033; Mon, 17 Oct 2016 22:33:29 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HMXTMW061029; Mon, 17 Oct 2016 22:33:29 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201610172233.u9HMXTMW061029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 17 Oct 2016 22:33:29 +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: r307535 - stable/11/sbin/fsck_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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:33:31 -0000 Author: mckusick Date: Mon Oct 17 22:33:29 2016 New Revision: 307535 URL: https://svnweb.freebsd.org/changeset/base/307535 Log: MFC 304438: Fsck_ufs was using an int rather than a ufs2_daddr_t to store the alternate superblock location when given in the -b option. Modified: stable/11/sbin/fsck_ffs/fsck.h stable/11/sbin/fsck_ffs/globs.c stable/11/sbin/fsck_ffs/main.c stable/11/sbin/fsck_ffs/setup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/11/sbin/fsck_ffs/fsck.h Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/fsck.h Mon Oct 17 22:33:29 2016 (r307535) @@ -305,7 +305,7 @@ extern u_int real_dev_bsize; /* actual extern char nflag; /* assume a no response */ extern char yflag; /* assume a yes response */ extern int bkgrdflag; /* use a snapshot to run on an active system */ -extern int bflag; /* location of alternate super block */ +extern ufs2_daddr_t bflag; /* location of alternate super block */ extern int debug; /* output debugging info */ extern int Eflag; /* delete empty data blocks */ extern int Zflag; /* zero empty data blocks */ Modified: stable/11/sbin/fsck_ffs/globs.c ============================================================================== --- stable/11/sbin/fsck_ffs/globs.c Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/globs.c Mon Oct 17 22:33:29 2016 (r307535) @@ -77,7 +77,7 @@ u_int real_dev_bsize; /* actual disk se char nflag; /* assume a no response */ char yflag; /* assume a yes response */ int bkgrdflag; /* use a snapshot to run on an active system */ -int bflag; /* location of alternate super block */ +ufs2_daddr_t bflag; /* location of alternate super block */ int debug; /* output debugging info */ int Eflag; /* delete empty data blocks */ int Zflag; /* zero empty data blocks */ Modified: stable/11/sbin/fsck_ffs/main.c ============================================================================== --- stable/11/sbin/fsck_ffs/main.c Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/main.c Mon Oct 17 22:33:29 2016 (r307535) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -68,7 +69,7 @@ __FBSDID("$FreeBSD$"); int restarts; static void usage(void) __dead2; -static int argtoi(int flag, const char *req, const char *str, int base); +static intmax_t argtoimax(int flag, const char *req, const char *str, int base); static int checkfilesys(char *filesys); static int chkdoreload(struct statfs *mntp); static struct statfs *getmntpt(const char *); @@ -88,8 +89,8 @@ main(int argc, char *argv[]) switch (ch) { case 'b': skipclean = 0; - bflag = argtoi('b', "number", optarg, 10); - printf("Alternate super block location: %d\n", bflag); + bflag = argtoimax('b', "number", optarg, 10); + printf("Alternate super block location: %jd\n", bflag); break; case 'B': @@ -98,7 +99,8 @@ main(int argc, char *argv[]) case 'c': skipclean = 0; - cvtlevel = argtoi('c', "conversion level", optarg, 10); + cvtlevel = argtoimax('c', "conversion level", optarg, + 10); if (cvtlevel < 3) errx(EEXIT, "cannot do level %d conversion", cvtlevel); @@ -121,7 +123,7 @@ main(int argc, char *argv[]) break; case 'm': - lfmode = argtoi('m', "mode", optarg, 8); + lfmode = argtoimax('m', "mode", optarg, 8); if (lfmode &~ 07777) errx(EEXIT, "bad mode to -m: %o", lfmode); printf("** lost+found creation mode %o\n", lfmode); @@ -203,13 +205,13 @@ main(int argc, char *argv[]) exit(ret); } -static int -argtoi(int flag, const char *req, const char *str, int base) +static intmax_t +argtoimax(int flag, const char *req, const char *str, int base) { char *cp; - int ret; + intmax_t ret; - ret = (int)strtol(str, &cp, base); + ret = strtoimax(str, &cp, base); if (cp == str || *cp) errx(EEXIT, "-%c flag requires a %s", flag, req); return (ret); Modified: stable/11/sbin/fsck_ffs/setup.c ============================================================================== --- stable/11/sbin/fsck_ffs/setup.c Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/setup.c Mon Oct 17 22:33:29 2016 (r307535) @@ -196,7 +196,7 @@ setup(char *dev) bflag = 0; return(0); } - pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag); + pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); bflag = 0; } if (skipclean && ckclean && sblock.fs_clean) { @@ -329,7 +329,7 @@ readsb(int listerr) } if (sblock.fs_magic != FS_UFS1_MAGIC && sblock.fs_magic != FS_UFS2_MAGIC) { - fprintf(stderr, "%d is not a file system superblock\n", + fprintf(stderr, "%jd is not a file system superblock\n", bflag); return (0); } From owner-svn-src-all@freebsd.org Mon Oct 17 22:34:43 2016 Return-Path: Delivered-To: svn-src-all@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 4285EC15896; Mon, 17 Oct 2016 22:34:43 +0000 (UTC) (envelope-from mckusick@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 0645B382; Mon, 17 Oct 2016 22:34:42 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HMYgqg061138; Mon, 17 Oct 2016 22:34:42 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HMYfqY061134; Mon, 17 Oct 2016 22:34:41 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201610172234.u9HMYfqY061134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 17 Oct 2016 22:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307536 - stable/10/sbin/fsck_ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:34:43 -0000 Author: mckusick Date: Mon Oct 17 22:34:41 2016 New Revision: 307536 URL: https://svnweb.freebsd.org/changeset/base/307536 Log: MFC 304438: Fsck_ufs was using an int rather than a ufs2_daddr_t to store the alternate superblock location when given in the -b option. Modified: stable/10/sbin/fsck_ffs/fsck.h stable/10/sbin/fsck_ffs/globs.c stable/10/sbin/fsck_ffs/main.c stable/10/sbin/fsck_ffs/setup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/10/sbin/fsck_ffs/fsck.h Mon Oct 17 22:33:29 2016 (r307535) +++ stable/10/sbin/fsck_ffs/fsck.h Mon Oct 17 22:34:41 2016 (r307536) @@ -305,7 +305,7 @@ extern u_int real_dev_bsize; /* actual extern char nflag; /* assume a no response */ extern char yflag; /* assume a yes response */ extern int bkgrdflag; /* use a snapshot to run on an active system */ -extern int bflag; /* location of alternate super block */ +extern ufs2_daddr_t bflag; /* location of alternate super block */ extern int debug; /* output debugging info */ extern int Eflag; /* delete empty data blocks */ extern int Zflag; /* zero empty data blocks */ Modified: stable/10/sbin/fsck_ffs/globs.c ============================================================================== --- stable/10/sbin/fsck_ffs/globs.c Mon Oct 17 22:33:29 2016 (r307535) +++ stable/10/sbin/fsck_ffs/globs.c Mon Oct 17 22:34:41 2016 (r307536) @@ -77,7 +77,7 @@ u_int real_dev_bsize; /* actual disk se char nflag; /* assume a no response */ char yflag; /* assume a yes response */ int bkgrdflag; /* use a snapshot to run on an active system */ -int bflag; /* location of alternate super block */ +ufs2_daddr_t bflag; /* location of alternate super block */ int debug; /* output debugging info */ int Eflag; /* delete empty data blocks */ int Zflag; /* zero empty data blocks */ Modified: stable/10/sbin/fsck_ffs/main.c ============================================================================== --- stable/10/sbin/fsck_ffs/main.c Mon Oct 17 22:33:29 2016 (r307535) +++ stable/10/sbin/fsck_ffs/main.c Mon Oct 17 22:34:41 2016 (r307536) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -68,7 +69,7 @@ __FBSDID("$FreeBSD$"); int restarts; static void usage(void) __dead2; -static int argtoi(int flag, const char *req, const char *str, int base); +static intmax_t argtoimax(int flag, const char *req, const char *str, int base); static int checkfilesys(char *filesys); static int chkdoreload(struct statfs *mntp); static struct statfs *getmntpt(const char *); @@ -88,8 +89,8 @@ main(int argc, char *argv[]) switch (ch) { case 'b': skipclean = 0; - bflag = argtoi('b', "number", optarg, 10); - printf("Alternate super block location: %d\n", bflag); + bflag = argtoimax('b', "number", optarg, 10); + printf("Alternate super block location: %jd\n", bflag); break; case 'B': @@ -98,7 +99,8 @@ main(int argc, char *argv[]) case 'c': skipclean = 0; - cvtlevel = argtoi('c', "conversion level", optarg, 10); + cvtlevel = argtoimax('c', "conversion level", optarg, + 10); if (cvtlevel < 3) errx(EEXIT, "cannot do level %d conversion", cvtlevel); @@ -121,7 +123,7 @@ main(int argc, char *argv[]) break; case 'm': - lfmode = argtoi('m', "mode", optarg, 8); + lfmode = argtoimax('m', "mode", optarg, 8); if (lfmode &~ 07777) errx(EEXIT, "bad mode to -m: %o", lfmode); printf("** lost+found creation mode %o\n", lfmode); @@ -203,13 +205,13 @@ main(int argc, char *argv[]) exit(ret); } -static int -argtoi(int flag, const char *req, const char *str, int base) +static intmax_t +argtoimax(int flag, const char *req, const char *str, int base) { char *cp; - int ret; + intmax_t ret; - ret = (int)strtol(str, &cp, base); + ret = strtoimax(str, &cp, base); if (cp == str || *cp) errx(EEXIT, "-%c flag requires a %s", flag, req); return (ret); Modified: stable/10/sbin/fsck_ffs/setup.c ============================================================================== --- stable/10/sbin/fsck_ffs/setup.c Mon Oct 17 22:33:29 2016 (r307535) +++ stable/10/sbin/fsck_ffs/setup.c Mon Oct 17 22:34:41 2016 (r307536) @@ -198,7 +198,7 @@ setup(char *dev) bflag = 0; return(0); } - pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag); + pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); bflag = 0; } if (skipclean && ckclean && sblock.fs_clean) { @@ -332,7 +332,7 @@ readsb(int listerr) } if (sblock.fs_magic != FS_UFS1_MAGIC && sblock.fs_magic != FS_UFS2_MAGIC) { - fprintf(stderr, "%d is not a file system superblock\n", + fprintf(stderr, "%jd is not a file system superblock\n", bflag); return (0); } From owner-svn-src-all@freebsd.org Mon Oct 17 22:36:38 2016 Return-Path: Delivered-To: svn-src-all@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 5480AC15924; Mon, 17 Oct 2016 22: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 23FA4787; Mon, 17 Oct 2016 22: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 u9HMabNV061284; Mon, 17 Oct 2016 22:36:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HMab1k061283; Mon, 17 Oct 2016 22:36:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610172236.u9HMab1k061283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 17 Oct 2016 22:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307537 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:36:38 -0000 Author: jhb Date: Mon Oct 17 22:36:37 2016 New Revision: 307537 URL: https://svnweb.freebsd.org/changeset/base/307537 Log: Use 'cmd' rather than 'command' to match the function prototype. Modified: head/lib/libc/sys/kldsym.2 Modified: head/lib/libc/sys/kldsym.2 ============================================================================== --- head/lib/libc/sys/kldsym.2 Mon Oct 17 22:34:41 2016 (r307536) +++ head/lib/libc/sys/kldsym.2 Mon Oct 17 22:36:37 2016 (r307537) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 26, 2001 +.Dd October 17, 2016 .Dt KLDSYM 2 .Os .Sh NAME @@ -36,7 +36,7 @@ .In sys/param.h .In sys/linker.h .Ft int -.Fn kldsym "int fileid" "int command" "void *data" +.Fn kldsym "int fileid" "int cmd" "void *data" .Sh DESCRIPTION The .Fn kldsym @@ -48,7 +48,7 @@ If .Fa fileid is 0, all loaded modules are searched. Currently, the only -.Fa command +.Fa cmd implemented is .Dv KLDSYM_LOOKUP . .Pp @@ -96,7 +96,7 @@ system call will fail if: Invalid value in .Fa data->version or -.Fa command . +.Fa cmd . .It Bq Er ENOENT The .Fa fileid From owner-svn-src-all@freebsd.org Mon Oct 17 22:37:08 2016 Return-Path: Delivered-To: svn-src-all@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 9CAE0C15996; Mon, 17 Oct 2016 22:37:08 +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 3E6FD901; Mon, 17 Oct 2016 22:37:08 +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 u9HMb7Q1061354; Mon, 17 Oct 2016 22:37:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HMb77U061350; Mon, 17 Oct 2016 22:37:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610172237.u9HMb77U061350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 17 Oct 2016 22:37:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307538 - in head: lib/libsysdecode usr.bin/kdump usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:37:08 -0000 Author: jhb Date: Mon Oct 17 22:37:07 2016 New Revision: 307538 URL: https://svnweb.freebsd.org/changeset/base/307538 Log: Move mksubr from kdump into libsysdecode. Restructure this script so that it generates a header of tables instead of a source file. The tables are included in a flags.c source file which provides functions to decode various system call arguments. For functions that decode an enumeration, the function returns a pointer to a string for known values and NULL for unknown values. For functions that do more complex decoding (typically of a bitmask), the function accepts a pointer to a FILE object (open_memstream() can be used as a string builder) to which decoded values are written. If the function operates on a bitmask, the function returns true if any bits were decoded or false if the entire value was valid. Additionally, the third argument accepts a pointer to a value to which any undecoded bits are stored. This pointer can be NULL if the caller doesn't care about remaining bits. Convert kdump over to using decoder functions from libsysdecode instead of mksubr. truss also uses decoders from libsysdecode instead of private lookup tables, though lookup tables for objects not decoded by kdump remain in truss for now. Eventually most of these tables should move into libsysdecode as the automated table generation approach from mksubr is less stale than the static tables in truss. Some changes have been made to truss and kdump output: - The flags passed to open() are now properly decoded in that one of O_RDONLY, O_RDWR, O_WRONLY, or O_EXEC is always included in a decoded mask. - Optional arguments to open(), openat(), and fcntl() are only printed in kdump if they exist (e.g. the mode is only printed for open() if O_CREAT is set in the flags). - Print argument to F_GETLK/SETLK/SETLKW in kdump as a pointer, not int. - Include all procctl() commands. - Correctly decode pipe2() flags in truss by not assuming full open()-like flags with O_RDONLY, etc. - Decode file flags passed to *chflags() as file flags (UF_* and SF_*) rather than as a file mode. - Fix decoding of quotactl() commands by splitting out the two command components instead of assuming the raw command value matches the primary command component. In addition, truss and kdump now build without triggering any warnings. All of the sysdecode manpages now include the required headers in the synopsis. Reviewed by: kib (several older versions), wblock (manpages) MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D7847 Added: head/lib/libsysdecode/flags.c - copied, changed from r307534, head/usr.bin/kdump/mksubr head/lib/libsysdecode/mktables - copied, changed from r307534, head/usr.bin/kdump/mksubr head/lib/libsysdecode/signal.c (contents, props changed) head/lib/libsysdecode/sysdecode_cap_rights.3 (contents, props changed) head/lib/libsysdecode/sysdecode_enum.3 (contents, props changed) head/lib/libsysdecode/sysdecode_fcntl_arg.3 (contents, props changed) head/lib/libsysdecode/sysdecode_mask.3 (contents, props changed) head/lib/libsysdecode/sysdecode_quotactl_cmd.3 (contents, props changed) head/lib/libsysdecode/sysdecode_sigcode.3 (contents, props changed) head/lib/libsysdecode/sysdecode_sockopt_name.3 (contents, props changed) Deleted: head/usr.bin/kdump/mksubr Modified: head/lib/libsysdecode/Makefile head/lib/libsysdecode/errno.c head/lib/libsysdecode/mkioctls head/lib/libsysdecode/syscallnames.c head/lib/libsysdecode/sysdecode.3 head/lib/libsysdecode/sysdecode.h head/lib/libsysdecode/sysdecode_abi_to_freebsd_errno.3 head/lib/libsysdecode/sysdecode_ioctlname.3 head/lib/libsysdecode/sysdecode_syscallnames.3 head/lib/libsysdecode/sysdecode_utrace.3 head/lib/libsysdecode/utrace.c head/usr.bin/kdump/Makefile head/usr.bin/kdump/kdump.c head/usr.bin/truss/Makefile head/usr.bin/truss/aarch64-cloudabi64.c head/usr.bin/truss/aarch64-freebsd.c head/usr.bin/truss/amd64-cloudabi64.c head/usr.bin/truss/amd64-freebsd.c head/usr.bin/truss/amd64-freebsd32.c head/usr.bin/truss/amd64-linux.c head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/arm-freebsd.c head/usr.bin/truss/extern.h head/usr.bin/truss/i386-freebsd.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/main.c head/usr.bin/truss/mips-freebsd.c head/usr.bin/truss/powerpc-freebsd.c head/usr.bin/truss/powerpc64-freebsd.c head/usr.bin/truss/powerpc64-freebsd32.c head/usr.bin/truss/setup.c head/usr.bin/truss/sparc64-freebsd.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/lib/libsysdecode/Makefile ============================================================================== --- head/lib/libsysdecode/Makefile Mon Oct 17 22:36:37 2016 (r307537) +++ head/lib/libsysdecode/Makefile Mon Oct 17 22:37:07 2016 (r307538) @@ -5,20 +5,94 @@ PACKAGE=lib${LIB} LIB= sysdecode -SRCS= errno.c ioctl.c syscallnames.c utrace.c +SRCS= errno.c flags.c ioctl.c signal.c syscallnames.c utrace.c INCS= sysdecode.h +CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR}/../../libexec/rtld-elf -MAN+= sysdecode.3 \ +MAN= sysdecode.3 \ sysdecode_abi_to_freebsd_errno.3 \ + sysdecode_cap_rights.3 \ + sysdecode_enum.3 \ + sysdecode_fcntl_arg.3 \ sysdecode_ioctlname.3 \ + sysdecode_mask.3 \ + sysdecode_quotactl_cmd.3 \ + sysdecode_sigcode.3 \ + sysdecode_sockopt_name.3 \ sysdecode_syscallnames.3 \ sysdecode_utrace.3 -MLINKS+= sysdecode_abi_to_freebsd_errno.3 sysdecode_freebsd_to_abi_errno.3 +MLINKS= sysdecode_abi_to_freebsd_errno.3 sysdecode_freebsd_to_abi_errno.3 +MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \ + sysdecode_enum.3 sysdecode_atfd.3 \ + sysdecode_enum.3 sysdecode_extattrnamespace.3 \ + sysdecode_enum.3 sysdecode_fadvice.3 \ + sysdecode_enum.3 sysdecode_fcntl_cmd.3 \ + sysdecode_enum.3 sysdecode_idtype.3 \ + sysdecode_enum.3 sysdecode_ipproto.3 \ + sysdecode_enum.3 sysdecode_kldsym_cmd.3 \ + sysdecode_enum.3 sysdecode_kldunload_flags.3 \ + sysdecode_enum.3 sysdecode_lio_listio_mode.3 \ + sysdecode_enum.3 sysdecode_madvice.3 \ + sysdecode_enum.3 sysdecode_minherit_flags.3 \ + sysdecode_enum.3 sysdecode_msgctl_cmd.3 \ + sysdecode_enum.3 sysdecode_nfssvc_flags.3 \ + sysdecode_enum.3 sysdecode_prio_which.3 \ + sysdecode_enum.3 sysdecode_procctl_cmd.3 \ + sysdecode_enum.3 sysdecode_ptrace_request.3 \ + sysdecode_enum.3 sysdecode_rlimit.3 \ + sysdecode_enum.3 sysdecode_rtprio_function.3 \ + sysdecode_enum.3 sysdecode_scheduler_policy.3 \ + sysdecode_enum.3 sysdecode_semctl_cmd.3 \ + sysdecode_enum.3 sysdecode_shmctl_cmd.3 \ + sysdecode_enum.3 sysdecode_shutdown_how.3 \ + sysdecode_enum.3 sysdecode_sigbus_code.3 \ + sysdecode_enum.3 sysdecode_sigchld_code.3 \ + sysdecode_enum.3 sysdecode_sigfpe_code.3 \ + sysdecode_enum.3 sysdecode_sigill_code.3 \ + sysdecode_enum.3 sysdecode_signal.3 \ + sysdecode_enum.3 sysdecode_sigprocmask_how.3 \ + sysdecode_enum.3 sysdecode_sigsegv_code.3 \ + sysdecode_enum.3 sysdecode_sigtrap_code.3 \ + sysdecode_enum.3 sysdecode_sockaddr_family.3 \ + sysdecode_enum.3 sysdecode_socketdomain.3 \ + sysdecode_enum.3 sysdecode_sockettype.3 \ + sysdecode_enum.3 sysdecode_sockopt_level.3 \ + sysdecode_enum.3 sysdecode_umtx_op.3 \ + sysdecode_enum.3 sysdecode_vmresult.3 \ + sysdecode_enum.3 sysdecode_whence.3 +MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3 +MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \ + sysdecode_mask.3 sysdecode_capfcntlrights.3 \ + sysdecode_mask.3 sysdecode_fcntl_fileflags.3 \ + sysdecode_mask.3 sysdecode_fileflags.3 \ + sysdecode_mask.3 sysdecode_filemode.3 \ + sysdecode_mask.3 sysdecode_flock_operation.3 \ + sysdecode_mask.3 sysdecode_getfsstat_flags.3 \ + sysdecode_mask.3 sysdecode_mlockall_flags.3 \ + sysdecode_mask.3 sysdecode_mmap_flags.3 \ + sysdecode_mask.3 sysdecode_mmap_prot.3 \ + sysdecode_mask.3 sysdecode_mount_flags.3 \ + sysdecode_mask.3 sysdecode_msg_flags.3 \ + sysdecode_mask.3 sysdecode_msync_flags.3 \ + sysdecode_mask.3 sysdecode_open_flags.3 \ + sysdecode_mask.3 sysdecode_pipe2_flags.3 \ + sysdecode_mask.3 sysdecode_reboot_howto.3 \ + sysdecode_mask.3 sysdecode_rfork_flags.3 \ + sysdecode_mask.3 sysdecode_semget_flags.3 \ + sysdecode_mask.3 sysdecode_sendfile_flags.3 \ + sysdecode_mask.3 sysdecode_shmat_flags.3 \ + sysdecode_mask.3 sysdecode_socket_type.3 \ + sysdecode_mask.3 sysdecode_thr_create_flags.3 \ + sysdecode_mask.3 sysdecode_umtx_cvwait_flags.3 \ + sysdecode_mask.3 sysdecode_umtx_rwlock_flags.3 \ + sysdecode_mask.3 sysdecode_vmprot.3 \ + sysdecode_mask.3 sysdecode_wait4_options.3 \ + sysdecode_mask.3 sysdecode_wait6_options.3 -CLEANFILES= ioctl.c +CLEANFILES= ioctl.c tables.h .if defined(COMPAT_32BIT) CPP+= -m32 @@ -36,10 +110,13 @@ CFLAGS.gcc.ioctl.c+= -Wno-unused CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}} +tables.h: mktables + sh ${.CURDIR}/mktables ${DESTDIR}${INCLUDEDIR} > ${.TARGET} + ioctl.c: mkioctls env MACHINE=${MACHINE} CPP="${CPP}" \ /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET} -beforedepend: ioctl.c +beforedepend: ioctl.c tables.h .include Modified: head/lib/libsysdecode/errno.c ============================================================================== --- head/lib/libsysdecode/errno.c Mon Oct 17 22:36:37 2016 (r307537) +++ head/lib/libsysdecode/errno.c Mon Oct 17 22:37:07 2016 (r307538) @@ -28,8 +28,11 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include #include +#include #include #include Copied and modified: head/lib/libsysdecode/flags.c (from r307534, head/usr.bin/kdump/mksubr) ============================================================================== --- head/usr.bin/kdump/mksubr Mon Oct 17 21:49:54 2016 (r307534, copy source) +++ head/lib/libsysdecode/flags.c Mon Oct 17 22:37:07 2016 (r307538) @@ -1,198 +1,92 @@ -#!/bin/sh -# -# Copyright (c) 2006 "David Kirchner" . 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$ -# -# Generates kdump_subr.c -# mkioctls is a special-purpose script, and works fine as it is -# now, so it remains independent. The idea behind how it generates -# its list was heavily borrowed here. -# -# Some functions here are automatically generated. This can mean -# the user will see unusual kdump output or errors while building -# if the underlying .h files are changed significantly. -# -# Key: -# AUTO: Completely auto-generated with either the "or" or the "switch" -# method. -# AUTO - Special: Generated automatically, but with some extra commands -# that the auto_*_type() functions are inappropriate for. -# MANUAL: Manually entered and must therefore be manually updated. - -set -e - -LC_ALL=C; export LC_ALL - -if [ -z "$1" ] -then - echo "usage: sh $0 include-dir" - exit 1 -fi -include_dir=$1 - -# -# Automatically generates a C function that will print out the -# numeric input as a pipe-delimited string of the appropriate -# #define keys. ex: -# S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH -# The XOR is necessary to prevent including the "0"-value in every -# line. -# -auto_or_type () { - local name grep file - name=$1 - grep=$2 - file=$3 - - cat <<_EOF_ -/* AUTO */ -void -$name(intmax_t arg) -{ - int or = 0; - printf("%#jx<", (uintmax_t)arg); -_EOF_ - egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ - $include_dir/$file | \ - awk '{ for (i = 1; i <= NF; i++) \ - if ($i ~ /define/) \ - break; \ - ++i; \ - printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }' -cat <<_EOF_ - printf(">"); - if (or == 0) - printf("%jd", arg); -} - -_EOF_ -} - -# -# Automatically generates a C function used when the argument -# maps to a single, specific #definition -# -auto_switch_type () { - local name grep file - name=$1 - grep=$2 - file=$3 - - cat <<_EOF_ -/* AUTO */ -void -$name(intmax_t arg) -{ - switch (arg) { -_EOF_ - egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ - $include_dir/$file | \ - awk '{ for (i = 1; i <= NF; i++) \ - if ($i ~ /define/) \ - break; \ - ++i; \ - printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }' -cat <<_EOF_ - default: /* Should not reach */ - printf("", arg); - } -} - -_EOF_ -} - -# -# Automatically generates a C function used when the argument -# maps to a #definition -# -auto_if_type () { - local name grep file - name=$1 - grep=$2 - file=$3 - - cat <<_EOF_ -/* AUTO */ -void -$name(intmax_t arg) -{ -_EOF_ - egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ - $include_dir/$file | \ - awk '{ printf "\t"; \ - if (NR > 1) \ - printf "else " ; \ - printf "if (arg == %s) \n\t\tprintf(\"%s\");\n", $2, $2 }' -cat <<_EOF_ - else /* Should not reach */ - printf("", arg); -} +/* + * Copyright (c) 2006 "David Kirchner" . 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. + */ -_EOF_ -} +#include +__FBSDID("$FreeBSD$"); -# C start +#define L2CAP_SOCKET_CHECKED -cat <<_EOF_ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include -#define _KERNEL -#include -#undef _KERNEL -#include -#include #include #include #include -#include #include -#include -#include -#define _KERNEL -#include -#undef _KERNEL -#include -#include -#include -#include -#include +#include #include +#include #include +#include +#include +#include #include +#include +#include +#include #include #include -#include -#include #include - -#include "kdump_subr.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * This is taken from the xlat tables originally in truss which were + * in turn taken from strace. + */ +struct name_table { + uintmax_t val; + const char *str; +}; + +#define X(a) { a, #a }, +#define XEND { 0, NULL } + +#define TABLE_START(n) static struct name_table n[] = { +#define TABLE_ENTRY X +#define TABLE_END XEND }; + +#include "tables.h" + +#undef TABLE_START +#undef TABLE_ENTRY +#undef TABLE_END /* * These are simple support macros. print_or utilizes a variable @@ -201,559 +95,888 @@ cat <<_EOF_ * simply handles the necessary "if" statement used in many lines * of this file. */ -#define print_or(str,orflag) do { \\ - if (orflag) putchar('|'); else orflag = 1; \\ - printf (str); } \\ +#define print_or(fp,str,orflag) do { \ + if (orflag) fputc(fp, '|'); else orflag = true; \ + fprintf(fp, str); } \ while (0) -#define if_print_or(i,flag,orflag) do { \\ - if ((i & flag) == flag) \\ - print_or(#flag,orflag); } \\ +#define if_print_or(fp,i,flag,orflag) do { \ + if ((i & flag) == flag) \ + print_or(fp,#flag,orflag); } \ while (0) -/* MANUAL */ -void -atfdname(int fd, int decimal) +static const char * +lookup_value(struct name_table *table, uintmax_t val) { - if (fd == AT_FDCWD) - printf("AT_FDCWD"); - else if (decimal) - printf("%d", fd); - else - printf("%#x", fd); + + for (; table->str != NULL; table++) + if (table->val == val) + return (table->str); + return (NULL); } -/* MANUAL */ -extern char *signames[]; /* from kdump.c */ -void -signame(int sig) +/* + * Used when the value maps to a bitmask of #definition values in the + * table. This is a helper routine which outputs a symbolic mask of + * matched masks. Multiple masks are separated by a pipe ('|'). + * The value is modified on return to only hold unmatched bits. + */ +static void +print_mask_part(FILE *fp, struct name_table *table, uintmax_t *valp, + bool *printed) +{ + uintmax_t rem; + + rem = *valp; + for (; table->str != NULL; table++) { + if ((table->val & rem) == table->val) { + /* + * Only print a zero mask if the raw value is + * zero. + */ + if (table->val == 0 && *valp != 0) + continue; + fprintf(fp, "%s%s", *printed ? "|" : "", table->str); + *printed = true; + rem &= ~table->val; + } + } + + *valp = rem; +} + +/* + * Used when the value maps to a bitmask of #definition values in the + * table. The return value is true if something was printed. If + * rem is not NULL, *rem holds any bits not decoded if something was + * printed. If nothing was printed and rem is not NULL, *rem holds + * the original value. + */ +static bool +print_mask_int(FILE *fp, struct name_table *table, int ival, int *rem) { - if (sig > 0 && sig < NSIG) - printf("SIG%s",signames[sig]); - else - printf("SIG %d", sig); + uintmax_t val; + bool printed; + + printed = false; + val = (unsigned)ival; + print_mask_part(fp, table, &val, &printed); + if (rem != NULL) + *rem = val; + return (printed); } -/* MANUAL */ -void -semctlname(int cmd) +/* + * Used for a mask of optional flags where a value of 0 is valid. + */ +static bool +print_mask_0(FILE *fp, struct name_table *table, int val, int *rem) { - switch (cmd) { - case GETNCNT: - printf("GETNCNT"); - break; - case GETPID: - printf("GETPID"); - break; - case GETVAL: - printf("GETVAL"); - break; - case GETALL: - printf("GETALL"); - break; - case GETZCNT: - printf("GETZCNT"); - break; - case SETVAL: - printf("SETVAL"); - break; - case SETALL: - printf("SETALL"); + + if (val == 0) { + fputs("0", fp); + if (rem != NULL) + *rem = 0; + return (true); + } + return (print_mask_int(fp, table, val, rem)); +} + +/* + * Like print_mask_0 but for a unsigned long instead of an int. + */ +static bool +print_mask_0ul(FILE *fp, struct name_table *table, u_long lval, u_long *rem) +{ + uintmax_t val; + bool printed; + + if (lval == 0) { + fputs("0", fp); + if (rem != NULL) + *rem = 0; + return (true); + } + + printed = false; + val = lval; + print_mask_part(fp, table, &val, &printed); + if (rem != NULL) + *rem = val; + return (printed); +} + +static void +print_integer(FILE *fp, int val, int base) +{ + + switch (base) { + case 8: + fprintf(fp, "0%o", val); break; - case IPC_RMID: - printf("IPC_RMID"); + case 10: + fprintf(fp, "%d", val); break; - case IPC_SET: - printf("IPC_SET"); + case 16: + fprintf(fp, "0x%x", val); break; - case IPC_STAT: - printf("IPC_STAT"); + default: + abort2("bad base", 0, NULL); break; - default: /* Should not reach */ - printf("", cmd); } } -/* MANUAL */ -void -shmctlname(int cmd) +static bool +print_value(FILE *fp, struct name_table *table, uintmax_t val) { - switch (cmd) { - case IPC_RMID: - printf("IPC_RMID"); - break; - case IPC_SET: - printf("IPC_SET"); - break; - case IPC_STAT: - printf("IPC_STAT"); - break; - default: /* Should not reach */ - printf("", cmd); + const char *str; + + str = lookup_value(table, val); + if (str != NULL) { + fputs(str, fp); + return (true); } + return (false); } -/* MANUAL */ -void -semgetname(int flag) +const char * +sysdecode_atfd(int fd) +{ + + if (fd == AT_FDCWD) + return ("AT_FDCWD"); + return (NULL); +} + +static struct name_table semctlops[] = { + X(GETNCNT) X(GETPID) X(GETVAL) X(GETALL) X(GETZCNT) X(SETVAL) X(SETALL) + X(IPC_RMID) X(IPC_SET) X(IPC_STAT) XEND +}; + +const char * +sysdecode_semctl_cmd(int cmd) +{ + + return (lookup_value(semctlops, cmd)); +} + +static struct name_table shmctlops[] = { + X(IPC_RMID) X(IPC_SET) X(IPC_STAT) XEND +}; + +const char * +sysdecode_shmctl_cmd(int cmd) +{ + + return (lookup_value(shmctlops, cmd)); +} + +const char * +sysdecode_msgctl_cmd(int cmd) +{ + + return (sysdecode_shmctl_cmd(cmd)); +} + +static struct name_table semgetflags[] = { + X(IPC_CREAT) X(IPC_EXCL) X(SEM_R) X(SEM_A) X((SEM_R>>3)) X((SEM_A>>3)) + X((SEM_R>>6)) X((SEM_A>>6)) XEND +}; + +bool +sysdecode_semget_flags(FILE *fp, int flag, int *rem) { - int or = 0; - if_print_or(flag, IPC_CREAT, or); - if_print_or(flag, IPC_EXCL, or); - if_print_or(flag, SEM_R, or); - if_print_or(flag, SEM_A, or); - if_print_or(flag, (SEM_R>>3), or); - if_print_or(flag, (SEM_A>>3), or); - if_print_or(flag, (SEM_R>>6), or); - if_print_or(flag, (SEM_A>>6), or); + + return (print_mask_int(fp, semgetflags, flag, rem)); +} + +static struct name_table idtypes[] = { + X(P_PID) X(P_PPID) X(P_PGID) X(P_SID) X(P_CID) X(P_UID) X(P_GID) + X(P_ALL) X(P_LWPID) X(P_TASKID) X(P_PROJID) X(P_POOLID) X(P_JAILID) + X(P_CTID) X(P_CPUID) X(P_PSETID) XEND +}; + +/* XXX: idtype is really an idtype_t */ +const char * +sysdecode_idtype(int idtype) +{ + + return (lookup_value(idtypes, idtype)); } /* - * MANUAL - * - * Only used by SYS_open. Unless O_CREAT is set in flags, the - * mode argument is unused (and often bogus and misleading). + * [g|s]etsockopt's level argument can either be SOL_SOCKET or a + * protocol-specific value. */ -void -flagsandmodename(int flags, int mode, int decimal) +const char * +sysdecode_sockopt_level(int level) +{ + const char *str; + + if (level == SOL_SOCKET) + return ("SOL_SOCKET"); + + /* SOL_* constants for Bluetooth sockets. */ + str = lookup_value(ngbtsolevel, level); + if (str != NULL) + return (str); + + /* + * IP and Infiniband sockets use IP protocols as levels. Not all + * protocols are valid but it is simpler to just allow all of them. + * + * XXX: IPPROTO_IP == 0, but UNIX domain sockets use a level of 0 + * for private options. + */ + str = sysdecode_ipproto(level); + if (str != NULL) + return (str); + + return (NULL); +} + +bool +sysdecode_vmprot(FILE *fp, int type, int *rem) +{ + + return (print_mask_int(fp, vmprot, type, rem)); +} + +static struct name_table sockflags[] = { + X(SOCK_CLOEXEC) X(SOCK_NONBLOCK) XEND +}; + +bool +sysdecode_socket_type(FILE *fp, int type, int *rem) { - flagsname(flags); - putchar(','); - if ((flags & O_CREAT) == O_CREAT) { - modename (mode); + const char *str; + uintmax_t val; + bool printed; + + str = lookup_value(socktype, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)); + if (str != NULL) { + fputs(str, fp); + *rem = 0; + printed = true; } else { - if (decimal) { - printf("%d", mode); - } else { - printf("%#x", (unsigned int)mode); - } + *rem = type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK); + printed = false; } + val = type & (SOCK_CLOEXEC | SOCK_NONBLOCK); + print_mask_part(fp, sockflags, &val, &printed); + return (printed); } -/* MANUAL */ -void -idtypename(idtype_t idtype, int decimal) +bool +sysdecode_access_mode(FILE *fp, int mode, int *rem) { - switch(idtype) { - case P_PID: - printf("P_PID"); - break; - case P_PPID: - printf("P_PPID"); - break; - case P_PGID: - printf("P_PGID"); - break; - case P_SID: - printf("P_SID"); - break; - case P_CID: - printf("P_CID"); - break; - case P_UID: - printf("P_UID"); - break; - case P_GID: - printf("P_GID"); - break; - case P_ALL: - printf("P_ALL"); - break; - case P_LWPID: - printf("P_LWPID"); - break; - case P_TASKID: - printf("P_TASKID"); - break; - case P_PROJID: - printf("P_PROJID"); - break; - case P_POOLID: - printf("P_POOLID"); - break; - case P_JAILID: - printf("P_JAILID"); - break; - case P_CTID: - printf("P_CTID"); + + return (print_mask_int(fp, accessmode, mode, rem)); +} + +/* XXX: 'type' is really an acl_type_t. */ +const char * +sysdecode_acltype(int type) +{ + + return (lookup_value(acltype, type)); +} + +bool +sysdecode_cap_fcntlrights(FILE *fp, uint32_t rights, uint32_t *rem) +{ + + return (print_mask_int(fp, capfcntl, rights, rem)); +} + +const char * +sysdecode_extattrnamespace(int namespace) +{ + + return (lookup_value(extattrns, namespace)); +} + +const char * +sysdecode_fadvice(int advice) +{ + + return (lookup_value(fadvisebehav, advice)); +} + +bool +sysdecode_open_flags(FILE *fp, int flags, int *rem) +{ + bool printed; + int mode; + uintmax_t val; + + mode = flags & O_ACCMODE; + flags &= ~O_ACCMODE; + switch (mode) { + case O_RDONLY: + if (flags & O_EXEC) { + flags &= ~O_EXEC; + fputs("O_EXEC", fp); + } else + fputs("O_RDONLY", fp); + printed = true; + mode = 0; break; - case P_CPUID: - printf("P_CPUID"); + case O_WRONLY: + fputs("O_WRONLY", fp); + printed = true; + mode = 0; break; - case P_PSETID: - printf("P_PSETID"); + case O_RDWR: + fputs("O_RDWR", fp); + printed = true; + mode = 0; break; default: - if (decimal) { - printf("%d", idtype); - } else { - printf("%#x", idtype); - } + printed = false; } + val = (unsigned)flags; + print_mask_part(fp, openflags, &val, &printed); + if (rem != NULL) + *rem = val | mode; + return (printed); } -/* - * MANUAL - * - * [g|s]etsockopt's level argument can either be SOL_SOCKET or a value - * referring to a line in /etc/protocols . It might be appropriate - * to use getprotoent(3) here. - */ -void -sockoptlevelname(int level, int decimal) +bool +sysdecode_fcntl_fileflags(FILE *fp, int flags, int *rem) { - if (level == SOL_SOCKET) { - printf("SOL_SOCKET"); - } else { - if (decimal) { - printf("%d", level); - } else { - printf("%#x", (unsigned int)level); - } + bool printed; + int oflags; + + /* + * The file flags used with F_GETFL/F_SETFL mostly match the + * flags passed to open(2). However, a few open-only flag + * bits have been repurposed for fcntl-only flags. + */ + oflags = flags & ~(O_NOFOLLOW | FRDAHEAD); + printed = sysdecode_open_flags(fp, oflags, rem); + if (flags & O_NOFOLLOW) { + fprintf(fp, "%sFPOIXSHM", printed ? "|" : ""); + printed = true; + } + if (flags & FRDAHEAD) { + fprintf(fp, "%sFRDAHEAD", printed ? "|" : ""); + printed = true; } + return (printed); } -/* - * MANUAL - * - * Used for page fault type. Cannot use auto_or_type since the macro - * values contain a cast. Also, VM_PROT_NONE has to be handled specially. - */ -void -vmprotname (int type) +bool +sysdecode_flock_operation(FILE *fp, int operation, int *rem) { - int or = 0; - if (type == VM_PROT_NONE) { - (void)printf("VM_PROT_NONE"); - return; - } - if_print_or(type, VM_PROT_READ, or); - if_print_or(type, VM_PROT_WRITE, or); - if_print_or(type, VM_PROT_EXECUTE, or); - if_print_or(type, VM_PROT_COPY, or); + return (print_mask_int(fp, flockops, operation, rem)); } -/* - * MANUAL - */ -void -socktypenamewithflags(int type) +bool +sysdecode_getfsstat_flags(FILE *fp, int flags, int *rem) { - if (type & SOCK_CLOEXEC) - printf("SOCK_CLOEXEC|"), type &= ~SOCK_CLOEXEC; - if (type & SOCK_NONBLOCK) - printf("SOCK_NONBLOCK|"), type &= ~SOCK_NONBLOCK; - socktypename(type); -} -_EOF_ - -auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h" -auto_switch_type "acltypename" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h" -auto_or_type "capfcntlname" "CAP_FCNTL_[A-Z]+[[:space:]]+\(1" "sys/capsicum.h" -auto_switch_type "extattrctlname" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/extattr.h" -auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" -auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h" -auto_or_type "flockname" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h" -auto_or_type "getfsstatflagsname" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h" -auto_switch_type "kldsymcmdname" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" -auto_switch_type "kldunloadfflagsname" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" -auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h" -auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 17 22:48:30 2016 Return-Path: Delivered-To: svn-src-all@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 4011FC15C9B; Mon, 17 Oct 2016 22:48:30 +0000 (UTC) (envelope-from bjk@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 11F6FF62; Mon, 17 Oct 2016 22:48:30 +0000 (UTC) (envelope-from bjk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HMmT0r065181; Mon, 17 Oct 2016 22:48:29 GMT (envelope-from bjk@FreeBSD.org) Received: (from bjk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HMmT3n065180; Mon, 17 Oct 2016 22:48:29 GMT (envelope-from bjk@FreeBSD.org) Message-Id: <201610172248.u9HMmT3n065180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bjk set sender to bjk@FreeBSD.org using -f From: Benjamin Kaduk Date: Mon, 17 Oct 2016 22:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307539 - head/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:48:30 -0000 Author: bjk (doc committer) Date: Mon Oct 17 22:48:29 2016 New Revision: 307539 URL: https://svnweb.freebsd.org/changeset/base/307539 Log: Fix relnotes build of supported hardware list after r307529 urtwn is merged into rtwn, so there is not a separate hardware list to include anymore. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Mon Oct 17 22:37:07 2016 (r307538) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Mon Oct 17 22:48:29 2016 (r307539) @@ -1013,8 +1013,6 @@ &hwlist.urtw; - &hwlist.urtwn; - [&arch.amd64;, &arch.i386;, &arch.pc98;] Lucent Technologies WaveLAN/IEEE 802.11b wireless network adapters and workalikes using the Lucent Hermes, Intersil PRISM-II, From owner-svn-src-all@freebsd.org Mon Oct 17 22:57:42 2016 Return-Path: Delivered-To: svn-src-all@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 B7EFAC15E21; Mon, 17 Oct 2016 22:57:42 +0000 (UTC) (envelope-from stevek@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 7EF1F5F9; Mon, 17 Oct 2016 22:57:42 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HMvfpI068914; Mon, 17 Oct 2016 22:57:41 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HMvfdH068913; Mon, 17 Oct 2016 22:57:41 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201610172257.u9HMvfdH068913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Mon, 17 Oct 2016 22:57:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307540 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 22:57:42 -0000 Author: stevek Date: Mon Oct 17 22:57:41 2016 New Revision: 307540 URL: https://svnweb.freebsd.org/changeset/base/307540 Log: Add sysctl to make amd64 minidump retry count tunable at runtime. PR: 213462 Submitted by: RaviPrakash Darbha Reviewed by: cemi, markj Approved by: sjg (mentor) Obtained from: Juniper Networks Differential Revision: https://reviews.freebsd.org/D8254 Modified: head/sys/amd64/amd64/minidump_machdep.c Modified: head/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- head/sys/amd64/amd64/minidump_machdep.c Mon Oct 17 22:48:29 2016 (r307539) +++ head/sys/amd64/amd64/minidump_machdep.c Mon Oct 17 22:57:41 2016 (r307540) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -68,6 +69,9 @@ static void *dump_va; static size_t counter, progress, dumpsize; CTASSERT(sizeof(*vm_page_dump) == 8); +static int dump_retry_count = 5; +SYSCTL_INT(_machdep, OID_AUTO, dump_retry_count, CTLFLAG_RWTUN, + &dump_retry_count, 0, "Number of times dump has to retry before bailing out"); static int is_dumpable(vm_paddr_t pa) @@ -447,7 +451,7 @@ minidumpsys(struct dumperinfo *di) printf("\n"); if (error == ENOSPC) { printf("Dump map grown while dumping. "); - if (retry_count < 5) { + if (retry_count < dump_retry_count) { printf("Retrying...\n"); goto retry; } From owner-svn-src-all@freebsd.org Mon Oct 17 23:25:32 2016 Return-Path: Delivered-To: svn-src-all@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 ED9FCC164E5; Mon, 17 Oct 2016 23:25:32 +0000 (UTC) (envelope-from gnn@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 BFA4361C; Mon, 17 Oct 2016 23:25:32 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9HNPV1p080226; Mon, 17 Oct 2016 23:25:31 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9HNPV91080225; Mon, 17 Oct 2016 23:25:31 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201610172325.u9HNPV91080225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Mon, 17 Oct 2016 23:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307541 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 23:25:33 -0000 Author: gnn Date: Mon Oct 17 23:25:31 2016 New Revision: 307541 URL: https://svnweb.freebsd.org/changeset/base/307541 Log: Limit the number of mbufs that can be allocated for IPV6_2292PKTOPTIONS (and IPV6_PKTOPTIONS). PR: 100219 Submitted by: Joseph Kong MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D5157 Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Mon Oct 17 22:57:41 2016 (r307540) +++ head/sys/netinet6/ip6_output.c Mon Oct 17 23:25:31 2016 (r307541) @@ -1393,6 +1393,15 @@ ip6_ctloutput(struct socket *so, struct int retval; #endif +/* + * Don't use more than a quarter of mbuf clusters. N.B.: + * nmbclusters is an int, but nmbclusters * MCLBYTES may overflow + * on LP64 architectures, so cast to u_long to avoid undefined + * behavior. ILP32 architectures cannot have nmbclusters + * large enough to overflow for other reasons. + */ +#define IPV6_PKTOPTIONS_MBUF_LIMIT ((u_long)nmbclusters * MCLBYTES / 4) + level = sopt->sopt_level; op = sopt->sopt_dir; optname = sopt->sopt_name; @@ -1448,6 +1457,12 @@ ip6_ctloutput(struct socket *so, struct { struct mbuf *m; + if (optlen > IPV6_PKTOPTIONS_MBUF_LIMIT) { + printf("ip6_ctloutput: mbuf limit hit\n"); + error = ENOBUFS; + break; + } + error = soopt_getm(sopt, &m); /* XXX */ if (error != 0) break; From owner-svn-src-all@freebsd.org Tue Oct 18 00:55:17 2016 Return-Path: Delivered-To: svn-src-all@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 EAA98C15994; Tue, 18 Oct 2016 00:55:17 +0000 (UTC) (envelope-from jhibbits@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 8C21BE12; Tue, 18 Oct 2016 00:55:17 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I0tGNw014760; Tue, 18 Oct 2016 00:55:16 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I0tFCH014745; Tue, 18 Oct 2016 00:55:15 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610180055.u9I0tFCH014745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 18 Oct 2016 00:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307542 - in head/sys: contrib/ncsw/Peripherals/BM contrib/ncsw/Peripherals/QM contrib/ncsw/inc contrib/ncsw/inc/Peripherals contrib/ncsw/user/env dev/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 00:55:18 -0000 Author: jhibbits Date: Tue Oct 18 00:55:15 2016 New Revision: 307542 URL: https://svnweb.freebsd.org/changeset/base/307542 Log: Use proper integer-pointer type conversions. As part of an effort to extend Book-E to the 64-bit world, make the necessary changes to the DPAA/dTSEC driver set to be integer-pointer conversion clean. This means no more casts to int, and use uintptr_t where needed. Since the NCSW source is effectively obsolete, direct changes to the source tree are safe. Modified: head/sys/contrib/ncsw/Peripherals/BM/bman_low.c head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c head/sys/contrib/ncsw/Peripherals/QM/qman_low.h head/sys/contrib/ncsw/inc/Peripherals/bm_ext.h head/sys/contrib/ncsw/inc/Peripherals/fm_ext.h head/sys/contrib/ncsw/inc/Peripherals/qm_ext.h head/sys/contrib/ncsw/inc/error_ext.h head/sys/contrib/ncsw/inc/xx_ext.h head/sys/contrib/ncsw/user/env/xx.c head/sys/dev/dpaa/bman.c head/sys/dev/dpaa/bman_portals.c head/sys/dev/dpaa/fman.c head/sys/dev/dpaa/portals_common.c head/sys/dev/dpaa/qman.c head/sys/dev/dpaa/qman_portals.c Modified: head/sys/contrib/ncsw/Peripherals/BM/bman_low.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/BM/bman_low.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/Peripherals/BM/bman_low.c Tue Oct 18 00:55:15 2016 (r307542) @@ -51,45 +51,45 @@ /***************************/ /* Cache-inhibited register offsets */ -#define REG_RCR_PI_CINH (void *)0x0000 -#define REG_RCR_CI_CINH (void *)0x0004 -#define REG_RCR_ITR (void *)0x0008 -#define REG_CFG (void *)0x0100 -#define REG_SCN(n) ((void *)(0x0200 + ((n) << 2))) -#define REG_ISR (void *)0x0e00 -#define REG_IER (void *)0x0e04 -#define REG_ISDR (void *)0x0e08 -#define REG_IIR (void *)0x0e0c +#define REG_RCR_PI_CINH 0x0000 +#define REG_RCR_CI_CINH 0x0004 +#define REG_RCR_ITR 0x0008 +#define REG_CFG 0x0100 +#define REG_SCN(n) (0x0200 + ((n) << 2)) +#define REG_ISR 0x0e00 +#define REG_IER 0x0e04 +#define REG_ISDR 0x0e08 +#define REG_IIR 0x0e0c /* Cache-enabled register offsets */ -#define CL_CR (void *)0x0000 -#define CL_RR0 (void *)0x0100 -#define CL_RR1 (void *)0x0140 -#define CL_RCR (void *)0x1000 -#define CL_RCR_PI_CENA (void *)0x3000 -#define CL_RCR_CI_CENA (void *)0x3100 +#define CL_CR 0x0000 +#define CL_RR0 0x0100 +#define CL_RR1 0x0140 +#define CL_RCR 0x1000 +#define CL_RCR_PI_CENA 0x3000 +#define CL_RCR_CI_CENA 0x3100 /* The h/w design requires mappings to be size-aligned so that "add"s can be * reduced to "or"s. The primitives below do the same for s/w. */ -static __inline__ void *ptr_ADD(void *a, void *b) +static __inline__ void *ptr_ADD(void *a, uintptr_t b) { - return (void *)((uintptr_t)a + (uintptr_t)b); + return (void *)((uintptr_t)a + b); } /* Bitwise-OR two pointers */ -static __inline__ void *ptr_OR(void *a, void *b) +static __inline__ void *ptr_OR(void *a, uintptr_t b) { - return (void *)((uintptr_t)a | (uintptr_t)b); + return (void *)((uintptr_t)a | b); } /* Cache-inhibited register access */ -static __inline__ uint32_t __bm_in(struct bm_addr *bm, void *offset) +static __inline__ uint32_t __bm_in(struct bm_addr *bm, uintptr_t offset) { uint32_t *tmp = (uint32_t *)ptr_ADD(bm->addr_ci, offset); return GET_UINT32(*tmp); } -static __inline__ void __bm_out(struct bm_addr *bm, void *offset, uint32_t val) +static __inline__ void __bm_out(struct bm_addr *bm, uintptr_t offset, uint32_t val) { uint32_t *tmp = (uint32_t *)ptr_ADD(bm->addr_ci, offset); WRITE_UINT32(*tmp, val); @@ -101,26 +101,26 @@ static __inline__ void __bm_out(struct b #define bm_cl(n) (void *)((n) << 6) /* Cache-enabled (index) register access */ -static __inline__ void __bm_cl_touch_ro(struct bm_addr *bm, void *offset) +static __inline__ void __bm_cl_touch_ro(struct bm_addr *bm, uintptr_t offset) { dcbt_ro(ptr_ADD(bm->addr_ce, offset)); } -static __inline__ void __bm_cl_touch_rw(struct bm_addr *bm, void *offset) +static __inline__ void __bm_cl_touch_rw(struct bm_addr *bm, uintptr_t offset) { dcbt_rw(ptr_ADD(bm->addr_ce, offset)); } -static __inline__ uint32_t __bm_cl_in(struct bm_addr *bm, void *offset) +static __inline__ uint32_t __bm_cl_in(struct bm_addr *bm, uintptr_t offset) { uint32_t *tmp = (uint32_t *)ptr_ADD(bm->addr_ce, offset); return GET_UINT32(*tmp); } -static __inline__ void __bm_cl_out(struct bm_addr *bm, void *offset, uint32_t val) +static __inline__ void __bm_cl_out(struct bm_addr *bm, uintptr_t offset, uint32_t val) { uint32_t *tmp = (uint32_t *)ptr_ADD(bm->addr_ce, offset); WRITE_UINT32(*tmp, val); dcbf(tmp); } -static __inline__ void __bm_cl_invalidate(struct bm_addr *bm, void *offset) +static __inline__ void __bm_cl_invalidate(struct bm_addr *bm, uintptr_t offset) { dcbi(ptr_ADD(bm->addr_ce, offset)); } @@ -156,7 +156,7 @@ static __inline__ uint8_t cyc_diff(uint8 /* Bit-wise logic to convert a ring pointer to a ring index */ static __inline__ uint8_t RCR_PTR2IDX(struct bm_rcr_entry *e) { - return (uint8_t)(((uint32_t)e >> 6) & (BM_RCR_SIZE - 1)); + return (uint8_t)(((uintptr_t)e >> 6) & (BM_RCR_SIZE - 1)); } /* Increment the 'cursor' ring pointer, taking 'vbit' into account */ @@ -483,12 +483,12 @@ void bm_isr_bscn_mask(struct bm_portal * uint32_t __bm_isr_read(struct bm_portal *portal, enum bm_isr_reg n) { - return __bm_in(&portal->addr, PTR_MOVE(REG_ISR, (n << 2))); + return __bm_in(&portal->addr, REG_ISR + (n << 2)); } void __bm_isr_write(struct bm_portal *portal, enum bm_isr_reg n, uint32_t val) { - __bm_out(&portal->addr, PTR_MOVE(REG_ISR, (n << 2)), val); + __bm_out(&portal->addr, REG_ISR + (n << 2), val); } Modified: head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c Tue Oct 18 00:55:15 2016 (r307542) @@ -568,8 +568,8 @@ mr_loop: qmPortalMrPvbUpdate(p_QmPortal->p_LowQmPortal); p_Msg = qm_mr_current(p_QmPortal->p_LowQmPortal); if (p_Msg) { - struct qman_fq *p_FqFqs = (void *)p_Msg->fq.contextB; - struct qman_fq *p_FqErn = (void *)p_Msg->ern.tag; + struct qman_fq *p_FqFqs = UINT_TO_PTR(p_Msg->fq.contextB); + struct qman_fq *p_FqErn = UINT_TO_PTR(p_Msg->ern.tag); uint8_t verb =(uint8_t)(p_Msg->verb & QM_MR_VERB_TYPE_MASK); t_QmRejectedFrameInfo rejectedFrameInfo; @@ -646,7 +646,7 @@ static void LoopDequeueRing(t_Handle h_Q p_Dq = qm_dqrr_current(p_QmPortal->p_LowQmPortal); if (!p_Dq) break; - p_Fq = (void *)p_Dq->contextB; + p_Fq = UINT_TO_PTR(p_Dq->contextB); if (p_Dq->stat & QM_DQRR_STAT_UNSCHEDULED) { /* We only set QMAN_FQ_STATE_NE when retiring, so we only need * to check for clearing it when doing volatile dequeues. It's @@ -728,7 +728,7 @@ static void LoopDequeueRingDcaOptimized( p_Dq = qm_dqrr_current(p_QmPortal->p_LowQmPortal); if (!p_Dq) break; - p_Fq = (void *)p_Dq->contextB; + p_Fq = UINT_TO_PTR(p_Dq->contextB); if (p_Dq->stat & QM_DQRR_STAT_UNSCHEDULED) { /* We only set QMAN_FQ_STATE_NE when retiring, so we only need * to check for clearing it when doing volatile dequeues. It's @@ -802,7 +802,7 @@ static void LoopDequeueRingOptimized(t_H p_Dq = qm_dqrr_current(p_QmPortal->p_LowQmPortal); if (!p_Dq) break; - p_Fq = (void *)p_Dq->contextB; + p_Fq = UINT_TO_PTR(p_Dq->contextB); if (p_Dq->stat & QM_DQRR_STAT_UNSCHEDULED) { /* We only set QMAN_FQ_STATE_NE when retiring, so we only need * to check for clearing it when doing volatile dequeues. It's @@ -1483,7 +1483,7 @@ static t_Error QmPortalPullFrame(t_Handl p_Dq = qm_dqrr_current(p_QmPortal->p_LowQmPortal); if (!p_Dq) continue; - p_Fq = (void *)p_Dq->contextB; + p_Fq = UINT_TO_PTR(p_Dq->contextB); ASSERT_COND(p_Dq->fqid); p_Dst = (uint32_t *)p_Frame; p_Src = (uint32_t *)&p_Dq->fd; @@ -1811,7 +1811,7 @@ t_Error QM_PORTAL_PollFrame(t_Handle h_Q PUNLOCK(p_QmPortal); return ERROR_CODE(E_EMPTY); } - p_Fq = (void *)p_Dq->contextB; + p_Fq = UINT_TO_PTR(p_Dq->contextB); ASSERT_COND(p_Dq->fqid); if (p_Fq) { @@ -2141,7 +2141,7 @@ t_Error QM_FQR_Enqueue(t_Handle h_QmFqr, } p_Eq->fqid = p_Fq->fqid; - p_Eq->tag = (uint32_t)p_Fq; + p_Eq->tag = (uintptr_t)p_Fq; /* gcc does a dreadful job of the following; * eq->fd = *fd; * It causes the entire function to save/restore a wider range of Modified: head/sys/contrib/ncsw/Peripherals/QM/qman_low.h ============================================================================== --- head/sys/contrib/ncsw/Peripherals/QM/qman_low.h Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/Peripherals/QM/qman_low.h Tue Oct 18 00:55:15 2016 (r307542) @@ -51,61 +51,61 @@ /***************************/ /* Cache-inhibited register offsets */ -#define REG_EQCR_PI_CINH (void *)0x0000 -#define REG_EQCR_CI_CINH (void *)0x0004 -#define REG_EQCR_ITR (void *)0x0008 -#define REG_DQRR_PI_CINH (void *)0x0040 -#define REG_DQRR_CI_CINH (void *)0x0044 -#define REG_DQRR_ITR (void *)0x0048 -#define REG_DQRR_DCAP (void *)0x0050 -#define REG_DQRR_SDQCR (void *)0x0054 -#define REG_DQRR_VDQCR (void *)0x0058 -#define REG_DQRR_PDQCR (void *)0x005c -#define REG_MR_PI_CINH (void *)0x0080 -#define REG_MR_CI_CINH (void *)0x0084 -#define REG_MR_ITR (void *)0x0088 -#define REG_CFG (void *)0x0100 -#define REG_ISR (void *)0x0e00 -#define REG_IER (void *)0x0e04 -#define REG_ISDR (void *)0x0e08 -#define REG_IIR (void *)0x0e0c -#define REG_ITPR (void *)0x0e14 +#define REG_EQCR_PI_CINH 0x0000 +#define REG_EQCR_CI_CINH 0x0004 +#define REG_EQCR_ITR 0x0008 +#define REG_DQRR_PI_CINH 0x0040 +#define REG_DQRR_CI_CINH 0x0044 +#define REG_DQRR_ITR 0x0048 +#define REG_DQRR_DCAP 0x0050 +#define REG_DQRR_SDQCR 0x0054 +#define REG_DQRR_VDQCR 0x0058 +#define REG_DQRR_PDQCR 0x005c +#define REG_MR_PI_CINH 0x0080 +#define REG_MR_CI_CINH 0x0084 +#define REG_MR_ITR 0x0088 +#define REG_CFG 0x0100 +#define REG_ISR 0x0e00 +#define REG_IER 0x0e04 +#define REG_ISDR 0x0e08 +#define REG_IIR 0x0e0c +#define REG_ITPR 0x0e14 /* Cache-enabled register offsets */ -#define CL_EQCR (void *)0x0000 -#define CL_DQRR (void *)0x1000 -#define CL_MR (void *)0x2000 -#define CL_EQCR_PI_CENA (void *)0x3000 -#define CL_EQCR_CI_CENA (void *)0x3100 -#define CL_DQRR_PI_CENA (void *)0x3200 -#define CL_DQRR_CI_CENA (void *)0x3300 -#define CL_MR_PI_CENA (void *)0x3400 -#define CL_MR_CI_CENA (void *)0x3500 -#define CL_RORI_CENA (void *)0x3600 -#define CL_CR (void *)0x3800 -#define CL_RR0 (void *)0x3900 -#define CL_RR1 (void *)0x3940 +#define CL_EQCR 0x0000 +#define CL_DQRR 0x1000 +#define CL_MR 0x2000 +#define CL_EQCR_PI_CENA 0x3000 +#define CL_EQCR_CI_CENA 0x3100 +#define CL_DQRR_PI_CENA 0x3200 +#define CL_DQRR_CI_CENA 0x3300 +#define CL_MR_PI_CENA 0x3400 +#define CL_MR_CI_CENA 0x3500 +#define CL_RORI_CENA 0x3600 +#define CL_CR 0x3800 +#define CL_RR0 0x3900 +#define CL_RR1 0x3940 -static __inline__ void *ptr_ADD(void *a, void *b) +static __inline__ void *ptr_ADD(void *a, uintptr_t b) { - return (void *)((uintptr_t)a + (uintptr_t)b); + return (void *)((uintptr_t)a + b); } /* The h/w design requires mappings to be size-aligned so that "add"s can be * reduced to "or"s. The primitives below do the same for s/w. */ /* Bitwise-OR two pointers */ -static __inline__ void *ptr_OR(void *a, void *b) +static __inline__ void *ptr_OR(void *a, uintptr_t b) { - return (void *)((uintptr_t)a + (uintptr_t)b); + return (void *)((uintptr_t)a + b); } /* Cache-inhibited register access */ -static __inline__ uint32_t __qm_in(struct qm_addr *qm, void *offset) +static __inline__ uint32_t __qm_in(struct qm_addr *qm, uintptr_t offset) { uint32_t *tmp = (uint32_t *)ptr_ADD(qm->addr_ci, offset); return GET_UINT32(*tmp); } -static __inline__ void __qm_out(struct qm_addr *qm, void *offset, uint32_t val) +static __inline__ void __qm_out(struct qm_addr *qm, uintptr_t offset, uint32_t val) { uint32_t *tmp = (uint32_t *)ptr_ADD(qm->addr_ci, offset); WRITE_UINT32(*tmp, val); @@ -114,29 +114,29 @@ static __inline__ void __qm_out(struct q #define qm_out(reg, val) __qm_out(&portal->addr, REG_##reg, (uint32_t)val) /* Convert 'n' cachelines to a pointer value for bitwise OR */ -#define qm_cl(n) (void *)((n) << 6) +#define qm_cl(n) ((n) << 6) /* Cache-enabled (index) register access */ -static __inline__ void __qm_cl_touch_ro(struct qm_addr *qm, void *offset) +static __inline__ void __qm_cl_touch_ro(struct qm_addr *qm, uintptr_t offset) { dcbt_ro(ptr_ADD(qm->addr_ce, offset)); } -static __inline__ void __qm_cl_touch_rw(struct qm_addr *qm, void *offset) +static __inline__ void __qm_cl_touch_rw(struct qm_addr *qm, uintptr_t offset) { dcbt_rw(ptr_ADD(qm->addr_ce, offset)); } -static __inline__ uint32_t __qm_cl_in(struct qm_addr *qm, void *offset) +static __inline__ uint32_t __qm_cl_in(struct qm_addr *qm, uintptr_t offset) { uint32_t *tmp = (uint32_t *)ptr_ADD(qm->addr_ce, offset); return GET_UINT32(*tmp); } -static __inline__ void __qm_cl_out(struct qm_addr *qm, void *offset, uint32_t val) +static __inline__ void __qm_cl_out(struct qm_addr *qm, uintptr_t offset, uint32_t val) { uint32_t *tmp = (uint32_t *)ptr_ADD(qm->addr_ce, offset); WRITE_UINT32(*tmp, val); dcbf(tmp); } -static __inline__ void __qm_cl_invalidate(struct qm_addr *qm, void *offset) +static __inline__ void __qm_cl_invalidate(struct qm_addr *qm, uintptr_t offset) { dcbi(ptr_ADD(qm->addr_ce, offset)); } @@ -190,7 +190,7 @@ static __inline__ void __qm_portal_unbin /* Bit-wise logic to convert a ring pointer to a ring index */ static __inline__ uint8_t EQCR_PTR2IDX(struct qm_eqcr_entry *e) { - return (uint8_t)(((uint32_t)e >> 6) & (QM_EQCR_SIZE - 1)); + return (uint8_t)(((uintptr_t)e >> 6) & (QM_EQCR_SIZE - 1)); } /* Increment the 'cursor' ring pointer, taking 'vbit' into account */ @@ -459,7 +459,7 @@ static __inline__ uint8_t qm_eqcr_get_fi static __inline__ uint8_t DQRR_PTR2IDX(struct qm_dqrr_entry *e) { - return (uint8_t)(((uint32_t)e >> 6) & (QM_DQRR_SIZE - 1)); + return (uint8_t)(((uintptr_t)e >> 6) & (QM_DQRR_SIZE - 1)); } static __inline__ struct qm_dqrr_entry *DQRR_INC(struct qm_dqrr_entry *e) @@ -829,7 +829,7 @@ static __inline__ uint8_t qm_dqrr_get_ma static __inline__ uint8_t MR_PTR2IDX(struct qm_mr_entry *e) { - return (uint8_t)(((uint32_t)e >> 6) & (QM_MR_SIZE - 1)); + return (uint8_t)(((uintptr_t)e >> 6) & (QM_MR_SIZE - 1)); } static __inline__ struct qm_mr_entry *MR_INC(struct qm_mr_entry *e) @@ -1139,10 +1139,10 @@ static __inline__ void qm_isr_set_iperio static __inline__ uint32_t __qm_isr_read(struct qm_portal *portal, enum qm_isr_reg n) { - return __qm_in(&portal->addr, PTR_MOVE(REG_ISR, (n << 2))); + return __qm_in(&portal->addr, REG_ISR + (n << 2)); } static __inline__ void __qm_isr_write(struct qm_portal *portal, enum qm_isr_reg n, uint32_t val) { - __qm_out(&portal->addr, PTR_MOVE(REG_ISR, (n << 2)), val); + __qm_out(&portal->addr, REG_ISR + (n << 2), val); } Modified: head/sys/contrib/ncsw/inc/Peripherals/bm_ext.h ============================================================================== --- head/sys/contrib/ncsw/inc/Peripherals/bm_ext.h Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/inc/Peripherals/bm_ext.h Tue Oct 18 00:55:15 2016 (r307542) @@ -124,7 +124,7 @@ typedef struct { t_Handle h_App; /**< A handle to an application layer object; This handle will be passed by the driver upon calling the above callbacks. NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */ - int errIrq; /**< BM error interrupt line; NO_IRQ if interrupts not used. + uintptr_t errIrq; /**< BM error interrupt line; NO_IRQ if interrupts not used. NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */ uint8_t partBpidBase; /**< The first buffer-pool-id dedicated to this partition. Modified: head/sys/contrib/ncsw/inc/Peripherals/fm_ext.h ============================================================================== --- head/sys/contrib/ncsw/inc/Peripherals/fm_ext.h Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/inc/Peripherals/fm_ext.h Tue Oct 18 00:55:15 2016 (r307542) @@ -322,9 +322,9 @@ typedef struct t_FmParams { t_Handle h_App; /**< Relevant when guestId = NCSW_MASSTER_ID only. A handle to an application layer object; This handle will be passed by the driver upon calling the above callbacks */ - int irq; /**< Relevant when guestId = NCSW_MASSTER_ID only. + uintptr_t irq; /**< Relevant when guestId = NCSW_MASSTER_ID only. FM interrupt source for normal events */ - int errIrq; /**< Relevant when guestId = NCSW_MASSTER_ID only. + uintptr_t errIrq; /**< Relevant when guestId = NCSW_MASSTER_ID only. FM interrupt source for errors */ t_FmPcdFirmwareParams firmware; /**< Relevant when guestId = NCSW_MASSTER_ID only. Ucode */ Modified: head/sys/contrib/ncsw/inc/Peripherals/qm_ext.h ============================================================================== --- head/sys/contrib/ncsw/inc/Peripherals/qm_ext.h Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/inc/Peripherals/qm_ext.h Tue Oct 18 00:55:15 2016 (r307542) @@ -249,7 +249,7 @@ typedef struct { t_QmExceptionsCallback *f_Exception; /**< An application callback routine to handle exceptions.*/ t_Handle h_App; /**< A handle to an application layer object; This handle will be passed by the driver upon calling the above callbacks */ - int errIrq; /**< error interrupt line; NO_IRQ if interrupts not used */ + uintptr_t errIrq; /**< error interrupt line; NO_IRQ if interrupts not used */ uint32_t partFqidBase; /**< The first frame-queue-id dedicated to this partition. NOTE: this parameter relevant only when working with multiple partitions. */ uint32_t partNumOfFqids; /**< Number of frame-queue-ids dedicated to this partition. Modified: head/sys/contrib/ncsw/inc/error_ext.h ============================================================================== --- head/sys/contrib/ncsw/inc/error_ext.h Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/inc/error_ext.h Tue Oct 18 00:55:15 2016 (r307542) @@ -353,7 +353,8 @@ int ERROR_DYNAMIC_LEVEL = ERROR_GLOBAL_L #define PRINT_FORMAT "[CPU%02d, %s:%d %s]" #define PRINT_FMT_PARAMS CORE_GetId(), __FILE__, __LINE__, __FUNCTION__ -#define ERR_STRING(err) #err +#define _ERR_STRING(err) #err +#define ERR_STRING(err) _ERR_STRING(err) #if (!(defined(DEBUG_ERRORS)) || (DEBUG_ERRORS == 0)) /* No debug/error/event messages at all */ Modified: head/sys/contrib/ncsw/inc/xx_ext.h ============================================================================== --- head/sys/contrib/ncsw/inc/xx_ext.h Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/inc/xx_ext.h Tue Oct 18 00:55:15 2016 (r307542) @@ -197,7 +197,7 @@ char XX_GetChar(void); @Return E_OK on success; error code otherwise.. *//***************************************************************************/ -t_Error XX_PreallocAndBindIntr(int irq, unsigned int cpu); +t_Error XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu); /**************************************************************************//** @Function XX_DeallocIntr @@ -208,7 +208,7 @@ t_Error XX_PreallocAndBindIntr(int irq, @Return E_OK on success; error code otherwise.. *//***************************************************************************/ -t_Error XX_DeallocIntr(int irq); +t_Error XX_DeallocIntr(uintptr_t irq); /**************************************************************************//** @Function XX_SetIntr @@ -221,7 +221,7 @@ t_Error XX_DeallocIntr(int irq); @Return E_OK on success; error code otherwise.. *//***************************************************************************/ -t_Error XX_SetIntr(int irq, t_Isr *f_Isr, t_Handle handle); +t_Error XX_SetIntr(uintptr_t irq, t_Isr *f_Isr, t_Handle handle); /**************************************************************************//** @Function XX_FreeIntr @@ -232,7 +232,7 @@ t_Error XX_SetIntr(int irq, t_Isr *f_Isr @Return E_OK on success; error code otherwise.. *//***************************************************************************/ -t_Error XX_FreeIntr(int irq); +t_Error XX_FreeIntr(uintptr_t irq); /**************************************************************************//** @Function XX_EnableIntr @@ -243,7 +243,7 @@ t_Error XX_FreeIntr(int irq); @Return E_OK on success; error code otherwise.. *//***************************************************************************/ -t_Error XX_EnableIntr(int irq); +t_Error XX_EnableIntr(uintptr_t irq); /**************************************************************************//** @Function XX_DisableIntr @@ -254,7 +254,7 @@ t_Error XX_EnableIntr(int irq); @Return E_OK on success; error code otherwise.. *//***************************************************************************/ -t_Error XX_DisableIntr(int irq); +t_Error XX_DisableIntr(uintptr_t irq); #if !(defined(__MWERKS__) && defined(OPTIMIZED_FOR_SPEED)) /**************************************************************************//** Modified: head/sys/contrib/ncsw/user/env/xx.c ============================================================================== --- head/sys/contrib/ncsw/user/env/xx.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/contrib/ncsw/user/env/xx.c Tue Oct 18 00:55:15 2016 (r307542) @@ -368,7 +368,7 @@ XX_Dispatch(void *arg) } t_Error -XX_PreallocAndBindIntr(int irq, unsigned int cpu) +XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu) { struct resource *r; unsigned int inum; @@ -388,7 +388,7 @@ XX_PreallocAndBindIntr(int irq, unsigned } t_Error -XX_DeallocIntr(int irq) +XX_DeallocIntr(uintptr_t irq) { struct resource *r; unsigned int inum; @@ -404,7 +404,7 @@ XX_DeallocIntr(int irq) } t_Error -XX_SetIntr(int irq, t_Isr *f_Isr, t_Handle handle) +XX_SetIntr(uintptr_t irq, t_Isr *f_Isr, t_Handle handle) { device_t dev; struct resource *r; @@ -453,7 +453,7 @@ finish: } t_Error -XX_FreeIntr(int irq) +XX_FreeIntr(uintptr_t irq) { device_t dev; struct resource *r; @@ -477,7 +477,7 @@ XX_FreeIntr(int irq) } t_Error -XX_EnableIntr(int irq) +XX_EnableIntr(uintptr_t irq) { struct resource *r; @@ -490,7 +490,7 @@ XX_EnableIntr(int irq) } t_Error -XX_DisableIntr(int irq) +XX_DisableIntr(uintptr_t irq) { struct resource *r; Modified: head/sys/dev/dpaa/bman.c ============================================================================== --- head/sys/dev/dpaa/bman.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/dev/dpaa/bman.c Tue Oct 18 00:55:15 2016 (r307542) @@ -114,7 +114,7 @@ bman_attach(device_t dev) bp.totalNumOfBuffers = BMAN_MAX_BUFFERS; bp.f_Exception = bman_exception; bp.h_App = sc; - bp.errIrq = (int)sc->sc_ires; + bp.errIrq = (uintptr_t)sc->sc_ires; bp.partBpidBase = 0; bp.partNumOfPools = BM_MAX_NUM_OF_POOLS; printf("base address: %llx\n", (uint64_t)bp.baseAddress); Modified: head/sys/dev/dpaa/bman_portals.c ============================================================================== --- head/sys/dev/dpaa/bman_portals.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/dev/dpaa/bman_portals.c Tue Oct 18 00:55:15 2016 (r307542) @@ -95,7 +95,7 @@ bman_portals_detach(device_t dev) } if (sc->sc_dp[i].dp_ires != NULL) { - XX_DeallocIntr((int)sc->sc_dp[i].dp_ires); + XX_DeallocIntr((uintptr_t)sc->sc_dp[i].dp_ires); bus_release_resource(dev, SYS_RES_IRQ, sc->sc_dp[i].dp_irid, sc->sc_dp[i].dp_ires); } @@ -116,7 +116,8 @@ bman_portal_setup(struct bman_softc *bsc struct dpaa_portals_softc *sc; t_BmPortalParam bpp; t_Handle portal; - unsigned int cpu, p; + unsigned int cpu; + uintptr_t p; /* Return NULL if we're not ready or while detach */ if (bp_sc == NULL) @@ -129,9 +130,9 @@ bman_portal_setup(struct bman_softc *bsc cpu = PCPU_GET(cpuid); /* Check if portal is ready */ - while (atomic_cmpset_acq_32((uint32_t *)&sc->sc_dp[cpu].dp_ph, + while (atomic_cmpset_acq_ptr((uintptr_t *)&sc->sc_dp[cpu].dp_ph, 0, -1) == 0) { - p = atomic_load_acq_32((uint32_t *)&sc->sc_dp[cpu].dp_ph); + p = atomic_load_acq_ptr((uintptr_t *)&sc->sc_dp[cpu].dp_ph); /* Return if portal is already initialized */ if (p != 0 && p != -1) { @@ -153,7 +154,7 @@ bman_portal_setup(struct bman_softc *bsc bpp.ciBaseAddress = rman_get_bushandle(sc->sc_rres[1]); bpp.h_Bm = bsc->sc_bh; bpp.swPortalId = cpu; - bpp.irq = (int)sc->sc_dp[cpu].dp_ires; + bpp.irq = (uintptr_t)sc->sc_dp[cpu].dp_ires; portal = BM_PORTAL_Config(&bpp); if (portal == NULL) @@ -162,8 +163,7 @@ bman_portal_setup(struct bman_softc *bsc if (BM_PORTAL_Init(portal) != E_OK) goto err; - atomic_store_rel_32((uint32_t *)&sc->sc_dp[cpu].dp_ph, - (uint32_t)portal); + atomic_store_rel_ptr((uintptr_t *)&sc->sc_dp[cpu].dp_ph, (uintptr_t)portal); sched_unpin(); @@ -173,7 +173,7 @@ err: if (portal != NULL) BM_PORTAL_Free(portal); - atomic_store_rel_32((uint32_t *)&sc->sc_dp[cpu].dp_ph, 0); + atomic_store_rel_ptr((uintptr_t *)&sc->sc_dp[cpu].dp_ph, 0); sched_unpin(); return (NULL); Modified: head/sys/dev/dpaa/fman.c ============================================================================== --- head/sys/dev/dpaa/fman.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/dev/dpaa/fman.c Tue Oct 18 00:55:15 2016 (r307542) @@ -66,8 +66,8 @@ enum fman_mu_ram_map { struct fman_config { device_t fman_device; uintptr_t mem_base_addr; - int irq_num; - int err_irq_num; + uintptr_t irq_num; + uintptr_t err_irq_num; uint8_t fm_id; t_FmExceptionsCallback *exception_callback; t_FmBusErrorCallback *bus_error_callback; @@ -282,8 +282,8 @@ fman_attach(device_t dev) cfg.fman_device = dev; cfg.fm_id = device_get_unit(dev); cfg.mem_base_addr = rman_get_bushandle(sc->mem_res); - cfg.irq_num = (int)sc->irq_res; - cfg.err_irq_num = (int)sc->err_irq_res; + cfg.irq_num = (uintptr_t)sc->irq_res; + cfg.err_irq_num = (uintptr_t)sc->err_irq_res; cfg.exception_callback = fman_exception_callback; cfg.bus_error_callback = fman_error_callback; Modified: head/sys/dev/dpaa/portals_common.c ============================================================================== --- head/sys/dev/dpaa/portals_common.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/dev/dpaa/portals_common.c Tue Oct 18 00:55:15 2016 (r307542) @@ -121,7 +121,7 @@ dpaa_portal_alloc_res(device_t dev, stru return (ENXIO); } - err = XX_PreallocAndBindIntr((int)sc->sc_dp[cpu].dp_ires, cpu); + err = XX_PreallocAndBindIntr((uintptr_t)sc->sc_dp[cpu].dp_ires, cpu); if (err != E_OK) { device_printf(dev, "Could not prealloc and bind interrupt\n"); Modified: head/sys/dev/dpaa/qman.c ============================================================================== --- head/sys/dev/dpaa/qman.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/dev/dpaa/qman.c Tue Oct 18 00:55:15 2016 (r307542) @@ -205,7 +205,7 @@ qman_attach(device_t dev) qp.pfdrMemPartitionId = NCSW_MASTER_ID; qp.f_Exception = qman_exception; qp.h_App = sc; - qp.errIrq = (int)sc->sc_ires; + qp.errIrq = (uintptr_t)sc->sc_ires; qp.partFqidBase = QMAN_FQID_BASE; qp.partNumOfFqids = QMAN_MAX_FQIDS; qp.partCgsBase = 0; @@ -255,7 +255,7 @@ qman_detach(device_t dev) QM_Free(sc->sc_qh); if (sc->sc_ires != NULL) - XX_DeallocIntr((int)sc->sc_ires); + XX_DeallocIntr((uintptr_t)sc->sc_ires); if (sc->sc_ires != NULL) bus_release_resource(dev, SYS_RES_IRQ, Modified: head/sys/dev/dpaa/qman_portals.c ============================================================================== --- head/sys/dev/dpaa/qman_portals.c Mon Oct 17 23:25:31 2016 (r307541) +++ head/sys/dev/dpaa/qman_portals.c Tue Oct 18 00:55:15 2016 (r307542) @@ -100,7 +100,7 @@ qman_portals_detach(device_t dev) } if (sc->sc_dp[i].dp_ires != NULL) { - XX_DeallocIntr((int)sc->sc_dp[i].dp_ires); + XX_DeallocIntr((uintptr_t)sc->sc_dp[i].dp_ires); bus_release_resource(dev, SYS_RES_IRQ, sc->sc_dp[i].dp_irid, sc->sc_dp[i].dp_ires); } @@ -120,7 +120,8 @@ qman_portal_setup(struct qman_softc *qsc { struct dpaa_portals_softc *sc; t_QmPortalParam qpp; - unsigned int cpu, p; + unsigned int cpu; + uintptr_t p; t_Handle portal; /* Return NULL if we're not ready or while detach */ @@ -134,9 +135,9 @@ qman_portal_setup(struct qman_softc *qsc cpu = PCPU_GET(cpuid); /* Check if portal is ready */ - while (atomic_cmpset_acq_32((uint32_t *)&sc->sc_dp[cpu].dp_ph, + while (atomic_cmpset_acq_ptr((uintptr_t *)&sc->sc_dp[cpu].dp_ph, 0, -1) == 0) { - p = atomic_load_acq_32((uint32_t *)&sc->sc_dp[cpu].dp_ph); + p = atomic_load_acq_ptr((uintptr_t *)&sc->sc_dp[cpu].dp_ph); /* Return if portal is already initialized */ if (p != 0 && p != -1) { @@ -158,7 +159,7 @@ qman_portal_setup(struct qman_softc *qsc qpp.ciBaseAddress = rman_get_bushandle(sc->sc_rres[1]); qpp.h_Qm = qsc->sc_qh; qpp.swPortalId = cpu; - qpp.irq = (int)sc->sc_dp[cpu].dp_ires; + qpp.irq = (uintptr_t)sc->sc_dp[cpu].dp_ires; qpp.fdLiodnOffset = 0; qpp.f_DfltFrame = qman_received_frame_callback; qpp.f_RejectedFrame = qman_rejected_frame_callback; @@ -174,8 +175,8 @@ qman_portal_setup(struct qman_softc *qsc if (QM_PORTAL_AddPoolChannel(portal, QMAN_COMMON_POOL_CHANNEL) != E_OK) goto err; - atomic_store_rel_32((uint32_t *)&sc->sc_dp[cpu].dp_ph, - (uint32_t)portal); + atomic_store_rel_ptr((uintptr_t *)&sc->sc_dp[cpu].dp_ph, + (uintptr_t)portal); sched_unpin(); return (portal); From owner-svn-src-all@freebsd.org Tue Oct 18 01:28:10 2016 Return-Path: Delivered-To: svn-src-all@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 C0D94C15EFB; Tue, 18 Oct 2016 01:28:10 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22d.google.com (mail-qk0-x22d.google.com [IPv6:2607:f8b0:400d:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6EDCFB4F; Tue, 18 Oct 2016 01:28:10 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22d.google.com with SMTP id o68so312102664qkf.3; Mon, 17 Oct 2016 18:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=iFsBrXEtyh+ZxOLQmTxC5bIW3J0KsifhjXjaDDURPyg=; b=yEu2pwcEZ8bfGKCEMGPAShtvaA/WXCZL8tf6nD5YKXlGind4gq5y1ftLV/EKVzfxnJ KeWlZ+CpmKfG5FOyxIc5jTXuBL9cbmm05T9FncWq4UXbl9fTiCTFIxJEXBCKbTXa5/Cp 9taefNTk3dRkvQJKT/q3ZSggc6DeTik/MrGhQlJFX5VuACaInbINyKbKAs77Us6b6x9U iec9wUeyNMtvrL/PZr4nuKx6lXHN1zy8zZgsKMwyQ4oyJLZamguc2cij+1WgX1c+reoV oVDmczqOgP66cAmjT7xAHvvNfrIF7YiR5lD+nQPnp7RjMvteU8egBXhBF64EehSFMecJ Afyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=iFsBrXEtyh+ZxOLQmTxC5bIW3J0KsifhjXjaDDURPyg=; b=XObcrKwoe6E7O76PFKP5gmvCZQW33QQ4kL2lBLBB8TQv0N9HkIEs0huq6vrShjSWrQ 643zdrL3yiZm+RnvHne8gjro54W6HacagkuXxUes/n6Axvp8LVcoNh4qXcqku/pLHgKk c3nCqPRVrtxne3Ngaf3gXbkQLPDWf7dZ0+ENTgHgwztwncUcVEIRDywczOE623+ZcYe3 OgsfHmTGO9ioBXuqaTgq02zSt6vpycHykg+s8H6tMzF/+yoOOpEA6tyaKGLt8WtZoca6 tRPfpH2ChIPh4Cqu6LXWV0s1yvNetHWgrheUJUEwB4T95ZGoQ/jpTX5b3V5lGbnjxmo4 +qLw== X-Gm-Message-State: AA6/9RkLadomM8kw2v7+LCr25OOrcYWwA5ChPmRVBXXUBfUkC3W/akkLh7LTOPHWubGeqn4quoBPfD0Z5nTZrw== X-Received: by 10.55.215.93 with SMTP id m90mr321549qki.40.1476754089383; Mon, 17 Oct 2016 18:28:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.29.33 with HTTP; Mon, 17 Oct 2016 18:28:08 -0700 (PDT) In-Reply-To: <201610081857.u98IvB7l012374@repo.freebsd.org> References: <201610081857.u98IvB7l012374@repo.freebsd.org> From: Ngie Cooper Date: Mon, 17 Oct 2016 18:28:08 -0700 Message-ID: Subject: Re: svn commit: r306864 - head To: Baptiste Daroussin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 01:28:10 -0000 On Sat, Oct 8, 2016 at 11:57 AM, Baptiste Daroussin wrote: > Author: bapt > Date: Sat Oct 8 18:57:11 2016 > New Revision: 306864 > URL: https://svnweb.freebsd.org/changeset/base/306864 > > Log: > groff is not needed in the bootstrap tools if the system is built > WITHOUT_SHAREDOCS > > MFC after: 2 weeks > > Modified: > head/Makefile.inc1 This breaks buildworld when WITHOUT_GROFF is set and WITHOUT_SHAREDOCS isn't set. Thanks, -Ngie From owner-svn-src-all@freebsd.org Tue Oct 18 01:42:44 2016 Return-Path: Delivered-To: svn-src-all@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 4AE9EC1530A; Tue, 18 Oct 2016 01:42:44 +0000 (UTC) (envelope-from marcel@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 F1F84388; Tue, 18 Oct 2016 01:42:43 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I1ghgF033296; Tue, 18 Oct 2016 01:42:43 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I1ggaj033294; Tue, 18 Oct 2016 01:42:42 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610180142.u9I1ggaj033294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Tue, 18 Oct 2016 01:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307543 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 01:42:44 -0000 Author: marcel Date: Tue Oct 18 01:42:42 2016 New Revision: 307543 URL: https://svnweb.freebsd.org/changeset/base/307543 Log: Add LORDER, TSORT and TSORTFLAGS variables and replace the hardcoded utility names and tsort flags. Modified: head/share/mk/bsd.lib.mk head/share/mk/sys.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Oct 18 00:55:15 2016 (r307542) +++ head/share/mk/bsd.lib.mk Tue Oct 18 01:42:42 2016 (r307543) @@ -178,7 +178,8 @@ _LIBS= lib${LIB_PRIVATE}${LIB}.a lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS} @${ECHO} building static ${LIB} library @rm -f ${.TARGET} - ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} + ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \ + ${LORDER} ${OBJS} ${STATICOBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD} ${RANLIB} ${RANLIBFLAGS} ${.TARGET} .endif @@ -193,7 +194,8 @@ CLEANFILES+= ${POBJS} lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS} @${ECHO} building profiled ${LIB} library @rm -f ${.TARGET} - ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' lorder ${POBJS} | tsort -q` ${ARADD} + ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \ + ${LORDER} ${POBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD} ${RANLIB} ${RANLIBFLAGS} ${.TARGET} .endif @@ -241,7 +243,8 @@ ${SHLIB_NAME_FULL}: ${SOBJS} .endif ${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ - `NM='${NM}' NMFLAGS='${NMFLAGS}' lorder ${SOBJS} | tsort -q` ${LDADD} + `NM='${NM}' NMFLAGS='${NMFLAGS}' ${LORDER} ${SOBJS} | \ + ${TSORT} ${TSORTFLAGS}` ${LDADD} .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} .endif Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Tue Oct 18 00:55:15 2016 (r307542) +++ head/share/mk/sys.mk Tue Oct 18 01:42:42 2016 (r307543) @@ -229,6 +229,8 @@ LINTLIBFLAGS ?= -cghapbxu -C ${LIB} MAKE ?= make .if !defined(%POSIX) +LORDER ?= lorder + NM ?= nm NMFLAGS ?= @@ -242,6 +244,9 @@ PFLAGS ?= RC ?= f77 RFLAGS ?= + +TSORT ?= tsort +TSORTFLAGS ?= -q .endif SHELL ?= sh From owner-svn-src-all@freebsd.org Tue Oct 18 01:55:09 2016 Return-Path: Delivered-To: svn-src-all@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 8CD6CC156EC; Tue, 18 Oct 2016 01:55:09 +0000 (UTC) (envelope-from marcel@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 5AE0DBBE; Tue, 18 Oct 2016 01:55:09 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I1t8O1037298; Tue, 18 Oct 2016 01:55:08 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I1t79S037286; Tue, 18 Oct 2016 01:55:07 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610180155.u9I1t79S037286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Tue, 18 Oct 2016 01:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307544 - head/usr.bin/mkimg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 01:55:09 -0000 Author: marcel Date: Tue Oct 18 01:55:07 2016 New Revision: 307544 URL: https://svnweb.freebsd.org/changeset/base/307544 Log: o Provide a private definition for UUIDs (mkimg_uuid_t) because UUIDs are not portable. o Move mkimg_uuid() to a new file and merge both gpt_uuid_enc() and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives in the same file. o Move the OS-specific implementation of generating a UUID to osdep_uuidgen() and provide the implementations for FreeBSD, macOS and Linux. o Expect the partitioning scheme headers to be found by having a search to the directory in which the headers live. This avoids conflicts on non-FreeBSD machines. Added: head/usr.bin/mkimg/uuid.c (contents, props changed) Modified: head/usr.bin/mkimg/Makefile head/usr.bin/mkimg/apm.c head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/mkimg.c head/usr.bin/mkimg/mkimg.h head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/vhd.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/Makefile ============================================================================== --- head/usr.bin/mkimg/Makefile Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/Makefile Tue Oct 18 01:55:07 2016 (r307544) @@ -3,15 +3,15 @@ .include PROG= mkimg -SRCS= format.c image.c mkimg.c scheme.c +SRCS= format.c image.c mkimg.c scheme.c uuid.c MAN= mkimg.1 -MKIMG_VERSION=20151211 +MKIMG_VERSION=20161016 mkimg.o: Makefile CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION} CFLAGS+=-DSPARSE_WRITE -CFLAGS+=-I${.CURDIR:H:H}/sys +CFLAGS+=-I${SRCTOP}/sys/sys/disk # List of formats to support SRCS+= \ Modified: head/usr.bin/mkimg/apm.c ============================================================================== --- head/usr.bin/mkimg/apm.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/apm.c Tue Oct 18 01:55:07 2016 (r307544) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" Modified: head/usr.bin/mkimg/bsd.c ============================================================================== --- head/usr.bin/mkimg/bsd.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/bsd.c Tue Oct 18 01:55:07 2016 (r307544) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" Modified: head/usr.bin/mkimg/ebr.c ============================================================================== --- head/usr.bin/mkimg/ebr.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/ebr.c Tue Oct 18 01:55:07 2016 (r307544) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" Modified: head/usr.bin/mkimg/gpt.c ============================================================================== --- head/usr.bin/mkimg/gpt.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/gpt.c Tue Oct 18 01:55:07 2016 (r307544) @@ -33,26 +33,25 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include +#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -static uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; -static uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; -static uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; -static uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS; -static uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; -static uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; -static uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; -static uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; -static uuid_t gpt_uuid_mbr = GPT_ENT_TYPE_MBR; -static uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; +static mkimg_uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; +static mkimg_uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; +static mkimg_uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; +static mkimg_uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS; +static mkimg_uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; +static mkimg_uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS; +static mkimg_uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; +static mkimg_uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; +static mkimg_uuid_t gpt_uuid_mbr = GPT_ENT_TYPE_MBR; +static mkimg_uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; static struct mkimg_alias gpt_aliases[] = { { ALIAS_EFI, ALIAS_PTR2TYPE(&gpt_uuid_efi) }, @@ -126,21 +125,6 @@ crc32(const void *buf, size_t sz) return (crc ^ ~0U); } -static void -gpt_uuid_enc(void *buf, const uuid_t *uuid) -{ - uint8_t *p = buf; - int i; - - le32enc(p, uuid->time_low); - le16enc(p + 4, uuid->time_mid); - le16enc(p + 6, uuid->time_hi_and_version); - p[8] = uuid->clock_seq_hi_and_reserved; - p[9] = uuid->clock_seq_low; - for (i = 0; i < _UUID_NODE_LEN; i++) - p[10 + i] = uuid->node[i]; -} - static u_int gpt_tblsz(void) { @@ -194,7 +178,7 @@ gpt_write_pmbr(lba_t blks, void *bootcod static struct gpt_ent * gpt_mktbl(u_int tblsz) { - uuid_t uuid; + mkimg_uuid_t uuid; struct gpt_ent *tbl, *ent; struct part *part; int c, idx; @@ -205,9 +189,9 @@ gpt_mktbl(u_int tblsz) TAILQ_FOREACH(part, &partlist, link) { ent = tbl + part->index; - gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); + mkimg_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); mkimg_uuid(&uuid); - gpt_uuid_enc(&ent->ent_uuid, &uuid); + mkimg_uuid_enc(&ent->ent_uuid, &uuid); le64enc(&ent->ent_lba_start, part->block); le64enc(&ent->ent_lba_end, part->block + part->size - 1); if (part->label != NULL) { @@ -238,7 +222,7 @@ gpt_write_hdr(struct gpt_hdr *hdr, uint6 static int gpt_write(lba_t imgsz, void *bootcode) { - uuid_t uuid; + mkimg_uuid_t uuid; struct gpt_ent *tbl; struct gpt_hdr *hdr; uint32_t crc; @@ -275,7 +259,7 @@ gpt_write(lba_t imgsz, void *bootcode) le64enc(&hdr->hdr_lba_start, 2 + tblsz); le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2); mkimg_uuid(&uuid); - gpt_uuid_enc(&hdr->hdr_uuid, &uuid); + mkimg_uuid_enc(&hdr->hdr_uuid, &uuid); le32enc(&hdr->hdr_entries, nparts); le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent)); crc = crc32(tbl, nparts * sizeof(struct gpt_ent)); Modified: head/usr.bin/mkimg/mbr.c ============================================================================== --- head/usr.bin/mkimg/mbr.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/mbr.c Tue Oct 18 01:55:07 2016 (r307544) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" Modified: head/usr.bin/mkimg/mkimg.c ============================================================================== --- head/usr.bin/mkimg/mkimg.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/mkimg.c Tue Oct 18 01:55:07 2016 (r307544) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -374,22 +373,6 @@ mkimg_chs(lba_t lba, u_int maxcyl, u_int *secp = sec; } -void -mkimg_uuid(struct uuid *uuid) -{ - static uint8_t gen[sizeof(struct uuid)]; - u_int i; - - if (!unit_testing) { - uuidgen(uuid, 1); - return; - } - - for (i = 0; i < sizeof(gen); i++) - gen[i]++; - memcpy(uuid, gen, sizeof(uuid_t)); -} - static int capacity_resize(lba_t end) { Modified: head/usr.bin/mkimg/mkimg.h ============================================================================== --- head/usr.bin/mkimg/mkimg.h Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/mkimg.h Tue Oct 18 01:55:07 2016 (r307544) @@ -30,6 +30,7 @@ #define _MKIMG_MKIMG_H_ #include +#include struct part { TAILQ_ENTRY(part) link; @@ -89,7 +90,17 @@ ssize_t sparse_write(int, const void *, void mkimg_chs(lba_t, u_int, u_int *, u_int *, u_int *); -struct uuid; -void mkimg_uuid(struct uuid *); +struct mkimg_uuid { + uint32_t time_low; + uint16_t time_mid; + uint16_t time_hi_and_version; + uint8_t clock_seq_hi_and_reserved; + uint8_t clock_seq_low; + uint8_t node[6]; +}; +typedef struct mkimg_uuid mkimg_uuid_t; + +void mkimg_uuid(mkimg_uuid_t *); +void mkimg_uuid_enc(void *, const mkimg_uuid_t *); #endif /* _MKIMG_MKIMG_H_ */ Modified: head/usr.bin/mkimg/pc98.c ============================================================================== --- head/usr.bin/mkimg/pc98.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/pc98.c Tue Oct 18 01:55:07 2016 (r307544) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" Added: head/usr.bin/mkimg/uuid.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/uuid.c Tue Oct 18 01:55:07 2016 (r307544) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2016 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "endian.h" +#include "image.h" +#include "mkimg.h" + +static void osdep_uuidgen(mkimg_uuid_t *); + +#ifdef __APPLE__ +#include + +static void +osdep_uuidgen(mkimg_uuid_t *uuid) +{ + + uuid_generate_time((void *)uuid); +} +#endif /* __APPLE__ */ + +#ifdef __FreeBSD__ +#include + +static void +osdep_uuidgen(mkimg_uuid_t *uuid) +{ + + uuidgen((void *)uuid, 1); +} +#endif /* __FreeBSD__ */ + +#ifdef __linux__ +#include +#include + +static void +osdep_uuidgen(mkimg_uuid_t *uuid) +{ + struct timespec tp; + uint64_t time = 0x01B21DD213814000LL; + u_int i; + uint16_t seq; + + if (clock_gettime(CLOCK_REALTIME, &tp) == -1) + abort(); + + time += (uint64_t)tp.tv_sec * 10000000LL; + time += tp.tv_nsec / 100; + + uuid->time_low = (uint32_t)time; + uuid->time_mid = (uint16_t)(time >> 32); + uuid->time_hi_and_version = (uint16_t)(time >> 48) & 0xfff; + uuid->time_hi_and_version |= 1 << 12; + + seq = random(); + + uuid->clock_seq_hi_and_reserved = (uint8_t)(seq >> 8) & 0x3f; + uuid->clock_seq_low = (uint8_t)seq; + + for (i = 0; i < 6; i++) + uuid->node[i] = (uint8_t)random(); + uuid->node[0] |= 0x01; +} +#endif /* __linux__ */ + +void +mkimg_uuid(mkimg_uuid_t *uuid) +{ + static uint8_t gen[sizeof(mkimg_uuid_t)]; + u_int i; + + if (!unit_testing) { + osdep_uuidgen(uuid); + return; + } + + for (i = 0; i < sizeof(gen); i++) + gen[i]++; + memcpy(uuid, gen, sizeof(*uuid)); +} + +void +mkimg_uuid_enc(void *buf, const mkimg_uuid_t *uuid) +{ + uint8_t *p = buf; + u_int i; + + le32enc(p, uuid->time_low); + le16enc(p + 4, uuid->time_mid); + le16enc(p + 6, uuid->time_hi_and_version); + p[8] = uuid->clock_seq_hi_and_reserved; + p[9] = uuid->clock_seq_low; + for (i = 0; i < 6; i++) + p[10 + i] = uuid->node[i]; +} Modified: head/usr.bin/mkimg/vhd.c ============================================================================== --- head/usr.bin/mkimg/vhd.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/vhd.c Tue Oct 18 01:55:07 2016 (r307544) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include "endian.h" #include "image.h" @@ -92,7 +91,7 @@ struct vhd_footer { #define VHD_DISK_TYPE_DYNAMIC 3 #define VHD_DISK_TYPE_DIFF 4 uint32_t checksum; - uuid_t id; + mkimg_uuid_t id; uint8_t saved_state; uint8_t _reserved[427]; }; @@ -201,25 +200,10 @@ vhd_timestamp(void) } static void -vhd_uuid_enc(void *buf, const uuid_t *uuid) -{ - uint8_t *p = buf; - int i; - - be32enc(p, uuid->time_low); - be16enc(p + 4, uuid->time_mid); - be16enc(p + 6, uuid->time_hi_and_version); - p[8] = uuid->clock_seq_hi_and_reserved; - p[9] = uuid->clock_seq_low; - for (i = 0; i < _UUID_NODE_LEN; i++) - p[10 + i] = uuid->node[i]; -} - -static void vhd_make_footer(struct vhd_footer *footer, uint64_t image_size, uint32_t disk_type, uint64_t data_offset) { - uuid_t id; + mkimg_uuid_t id; memset(footer, 0, sizeof(*footer)); be64enc(&footer->cookie, VHD_FOOTER_COOKIE); @@ -236,7 +220,7 @@ vhd_make_footer(struct vhd_footer *foote be16enc(&footer->geometry.cylinders, footer->geometry.cylinders); be32enc(&footer->disk_type, disk_type); mkimg_uuid(&id); - vhd_uuid_enc(&footer->id, &id); + mkimg_uuid_enc(&footer->id, &id); be32enc(&footer->checksum, vhd_checksum(footer, sizeof(*footer))); } @@ -261,7 +245,7 @@ struct vhd_dyn_header { uint32_t max_entries; uint32_t block_size; uint32_t checksum; - uuid_t parent_id; + mkimg_uuid_t parent_id; uint32_t parent_timestamp; char _reserved1[4]; uint16_t parent_name[256]; /* UTF-16 */ Modified: head/usr.bin/mkimg/vtoc8.c ============================================================================== --- head/usr.bin/mkimg/vtoc8.c Tue Oct 18 01:42:42 2016 (r307543) +++ head/usr.bin/mkimg/vtoc8.c Tue Oct 18 01:55:07 2016 (r307544) @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" From owner-svn-src-all@freebsd.org Tue Oct 18 02:40:26 2016 Return-Path: Delivered-To: svn-src-all@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 63AD2C16639; Tue, 18 Oct 2016 02:40:26 +0000 (UTC) (envelope-from hiren@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 358C3FEB; Tue, 18 Oct 2016 02:40:26 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I2eP0Z052448; Tue, 18 Oct 2016 02:40:25 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I2ePK9052447; Tue, 18 Oct 2016 02:40:25 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201610180240.u9I2ePK9052447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Tue, 18 Oct 2016 02:40:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307545 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 02:40:26 -0000 Author: hiren Date: Tue Oct 18 02:40:25 2016 New Revision: 307545 URL: https://svnweb.freebsd.org/changeset/base/307545 Log: Make sure tcp_mss() has the same check as tcp_mss_update() to have t_maxseg set to at least 64. This is still just a coverup to avoid kernel panic and not an actual fix. PR: 213232 Reviewed by: glebius MFC after: 1 week Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D8272 Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Oct 18 01:55:07 2016 (r307544) +++ head/sys/netinet/tcp_input.c Tue Oct 18 02:40:25 2016 (r307545) @@ -3758,7 +3758,15 @@ tcp_mss(struct tcpcb *tp, int offer) (void)sbreserve_locked(&so->so_snd, bufsize, so, NULL); } SOCKBUF_UNLOCK(&so->so_snd); - tp->t_maxseg = mss; + /* + * Sanity check: make sure that maxseg will be large + * enough to allow some data on segments even if the + * all the option space is used (40bytes). Otherwise + * funny things may happen in tcp_output. + * + * XXXGL: shouldn't we reserve space for IP/IPv6 options? + */ + tp->t_maxseg = max(mss, 64); SOCKBUF_LOCK(&so->so_rcv); if ((so->so_rcv.sb_hiwat == V_tcp_recvspace) && metrics.rmx_recvpipe) From owner-svn-src-all@freebsd.org Tue Oct 18 03:34:09 2016 Return-Path: Delivered-To: svn-src-all@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 BD5F0C15748; Tue, 18 Oct 2016 03:34:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x235.google.com (mail-pf0-x235.google.com [IPv6:2607:f8b0:400e:c00::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E3AAEFB; Tue, 18 Oct 2016 03:34:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x235.google.com with SMTP id 128so87406330pfz.0; Mon, 17 Oct 2016 20:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=K4VqSCuaFnafuc8YOXSBxZIzruEhgc0Zv1eW90u+AFU=; b=c0W6BpKOiqWnlyctZJOusp9FXgiBfePT6lN2DIEtxsjSCicAESGl1WA1Yh9OpNS7NU Q4oL0EUHRVdN7Fuaf8ban6OHCoe8qUdGu+GUS4DWsE3jYU3BVqB7hYxyDdR3UsC46o8s o4JDZzmaWmvGLJE99NuhlBJDNMchAdv5eZ38J0B1k/ekv0Puwt3sGmnM7ePTQXoYmztv spjmPPx3wvy0sihBryCiRanKOYVfa9grQsqMgxAxjlGEFPv55YGqgPXlM/ZQxzBiZh1j jngeyUrFwmJLVtJB7CdRaekMWgwtbnlRIxzLn1A3VKmmtia4H4HwRY1/gdQhzjtj6dNB 5tgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=K4VqSCuaFnafuc8YOXSBxZIzruEhgc0Zv1eW90u+AFU=; b=W/ZTG5HXkekxkGdx26Z+LybFawQmDMifiCBljFrK4bpA3RSsiMnXeHsBRWIsJEygRf qcVF+GOC0zGz7byPoeySuSQSl5pTT8pvg7E62BNTMwSaNVq8H7rfhYxPtrnzrjN0Pr7q LTU+D/cwZUWp5YFwCSDWfBOA1Fgzl9FpWQHWuqsLhMEjWMUqHop0KGWqKmLE+uRDchUA drObOoO+H2B7hdM8JUJjjuSauHiDIPifrj6Io+ONwXKTU3u1r79gt0CV80YyimNHixyl kfGT90Bb5aXT4SiOe9JX7LpfvZPGTVOHPMoCNlNd5VwxglJWIqHJ7Fd8Hv8EMdkA+pP1 +lXw== X-Gm-Message-State: AA6/9RnZP6Or6kjXWOK/eduyPN28jEvK5bY4SLj4vnNGs0OgmZNvz0Ha4qo4v5iLGuypFw== X-Received: by 10.98.35.220 with SMTP id q89mr1121317pfj.141.1476761648877; Mon, 17 Oct 2016 20:34:08 -0700 (PDT) Received: from ?IPv6:2607:fb90:80a0:ea79:64a1:846c:3aca:6fda? ([2607:fb90:80a0:ea79:64a1:846c:3aca:6fda]) by smtp.gmail.com with ESMTPSA id z87sm761877pfk.67.2016.10.17.20.34.07 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 20:34:08 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r307544 - head/usr.bin/mkimg From: Ngie Cooper X-Mailer: iPhone Mail (14A456) In-Reply-To: <201610180155.u9I1t79S037286@repo.freebsd.org> Date: Mon, 17 Oct 2016 20:34:06 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201610180155.u9I1t79S037286@repo.freebsd.org> To: Marcel Moolenaar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 03:34:09 -0000 > On Oct 17, 2016, at 18:55, Marcel Moolenaar wrote: >=20 > Author: marcel > Date: Tue Oct 18 01:55:07 2016 > New Revision: 307544 > URL: https://svnweb.freebsd.org/changeset/base/307544 >=20 > Log: > o Provide a private definition for UUIDs (mkimg_uuid_t) because > UUIDs are not portable. > o Move mkimg_uuid() to a new file and merge both gpt_uuid_enc() > and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives > in the same file. > o Move the OS-specific implementation of generating a UUID to > osdep_uuidgen() and provide the implementations for FreeBSD, > macOS and Linux. > o Expect the partitioning scheme headers to be found by having > a search to the directory in which the headers live. This > avoids conflicts on non-FreeBSD machines. >=20 > Added: > head/usr.bin/mkimg/uuid.c (contents, props changed) > Modified: > head/usr.bin/mkimg/Makefile > head/usr.bin/mkimg/apm.c > head/usr.bin/mkimg/bsd.c > head/usr.bin/mkimg/ebr.c > head/usr.bin/mkimg/gpt.c > head/usr.bin/mkimg/mbr.c > head/usr.bin/mkimg/mkimg.c > head/usr.bin/mkimg/mkimg.h > head/usr.bin/mkimg/pc98.c > head/usr.bin/mkimg/vhd.c > head/usr.bin/mkimg/vtoc8.c >=20 > Modified: head/usr.bin/mkimg/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/usr.bin/mkimg/Makefile Tue Oct 18 01:42:42 2016 (r307543) > +++ head/usr.bin/mkimg/Makefile Tue Oct 18 01:55:07 2016 (r307544) > @@ -3,15 +3,15 @@ > .include >=20 > PROG=3D mkimg > -SRCS=3D format.c image.c mkimg.c scheme.c > +SRCS=3D format.c image.c mkimg.c scheme.c uuid.c > MAN=3D mkimg.1 >=20 > -MKIMG_VERSION=3D20151211 > +MKIMG_VERSION=3D20161016 > mkimg.o: Makefile >=20 > CFLAGS+=3D-DMKIMG_VERSION=3D${MKIMG_VERSION} > CFLAGS+=3D-DSPARSE_WRITE > -CFLAGS+=3D-I${.CURDIR:H:H}/sys > +CFLAGS+=3D-I${SRCTOP}/sys/sys/disk Isn't it a better app idea to maintain the disk/ namespace for includes?= Thanks! -Ngie= From owner-svn-src-all@freebsd.org Tue Oct 18 04:01:55 2016 Return-Path: Delivered-To: svn-src-all@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 BF0F3C140E8; Tue, 18 Oct 2016 04:01:55 +0000 (UTC) (envelope-from imp@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 90EC3D8E; Tue, 18 Oct 2016 04:01:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I41sa8085765; Tue, 18 Oct 2016 04:01:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I41s94085764; Tue, 18 Oct 2016 04:01:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610180401.u9I41s94085764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 18 Oct 2016 04:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307546 - head/tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 04:01:55 -0000 Author: imp Date: Tue Oct 18 04:01:54 2016 New Revision: 307546 URL: https://svnweb.freebsd.org/changeset/base/307546 Log: Skip the checks in mtools. They are false positive for errors. Modified: head/tools/tools/nanobsd/embedded/common Modified: head/tools/tools/nanobsd/embedded/common ============================================================================== --- head/tools/tools/nanobsd/embedded/common Tue Oct 18 02:40:25 2016 (r307545) +++ head/tools/tools/nanobsd/embedded/common Tue Oct 18 04:01:54 2016 (r307546) @@ -207,6 +207,8 @@ create_diskimage_mbr ( ) ( ( local extra i sz fmt fmtarg bootmbr bootbsd skiparg set -o xtrace + # Tell mtools not to be too picky + export MTOOLS_SKIP_CHECK=1 [ -z ${NANO_DISKIMAGE_FORMAT} ] || fmtarg="-f ${NANO_DISKIMAGE_FORMAT}" [ -z ${NANO_DISKIMAGE_FORMAT} ] || fmt=".${NANO_DISKIMAGE_FORMAT}" From owner-svn-src-all@freebsd.org Tue Oct 18 04:01:58 2016 Return-Path: Delivered-To: svn-src-all@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 20C4EC1410C; Tue, 18 Oct 2016 04:01:58 +0000 (UTC) (envelope-from imp@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 CC91DDA7; Tue, 18 Oct 2016 04:01:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I41u8D085810; Tue, 18 Oct 2016 04:01:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I41uxe085809; Tue, 18 Oct 2016 04:01:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610180401.u9I41uxe085809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 18 Oct 2016 04:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307547 - head/tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 04:01:58 -0000 Author: imp Date: Tue Oct 18 04:01:56 2016 New Revision: 307547 URL: https://svnweb.freebsd.org/changeset/base/307547 Log: Add support for building pandaboard images with nanobsd. Added: head/tools/tools/nanobsd/embedded/pandaboard.cfg (contents, props changed) Added: head/tools/tools/nanobsd/embedded/pandaboard.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/nanobsd/embedded/pandaboard.cfg Tue Oct 18 04:01:56 2016 (r307547) @@ -0,0 +1,36 @@ +# $FreeBSD$ + +#- +# Copyright (c) 2016 Warner Losh. All Rights Reserved. +# Copyright (c) 2010-2011 iXsystems, Inc., All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE 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 iXsystems, Inc. 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. +# + +NANO_ARCH=armv6 +NANO_KERNEL=PANDABOARD +NANO_DRIVE=mmcsd0 +NANO_NAME=pandaboard +NANO_BOOT_PKG=u-boot-pandaboard +NANO_CPUTYPE=cortex-a9 + +. common # Pull in common definitions, keep last From owner-svn-src-all@freebsd.org Tue Oct 18 04:01:59 2016 Return-Path: Delivered-To: svn-src-all@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 8D02BC14113; Tue, 18 Oct 2016 04:01:59 +0000 (UTC) (envelope-from imp@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 574F4DE2; Tue, 18 Oct 2016 04:01:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I41w4f085853; Tue, 18 Oct 2016 04:01:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I41wOb085852; Tue, 18 Oct 2016 04:01:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610180401.u9I41wOb085852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 18 Oct 2016 04:01:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307548 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 04:01:59 -0000 Author: imp Date: Tue Oct 18 04:01:58 2016 New Revision: 307548 URL: https://svnweb.freebsd.org/changeset/base/307548 Log: Also include the DTBs in /boot/dtb for omap4 systems. Modified: head/sys/arm/conf/PANDABOARD Modified: head/sys/arm/conf/PANDABOARD ============================================================================== --- head/sys/arm/conf/PANDABOARD Tue Oct 18 04:01:56 2016 (r307547) +++ head/sys/arm/conf/PANDABOARD Tue Oct 18 04:01:58 2016 (r307548) @@ -30,6 +30,8 @@ hints "PANDABOARD.hints" include "std.armv6" include "../ti/omap4/pandaboard/std.pandaboard" +makeoptions MODULES_OVERRIDE=dtb/omap4 + options SCHED_ULE # ULE scheduler options PLATFORM options SMP # Enable multiple cores From owner-svn-src-all@freebsd.org Tue Oct 18 04:02:01 2016 Return-Path: Delivered-To: svn-src-all@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 E1FF1C14135; Tue, 18 Oct 2016 04:02:01 +0000 (UTC) (envelope-from imp@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 A3190E7E; Tue, 18 Oct 2016 04:02:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I4206J085901; Tue, 18 Oct 2016 04:02:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I420q2085899; Tue, 18 Oct 2016 04:02:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610180402.u9I420q2085899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 18 Oct 2016 04:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307549 - in head: sys/modules/dtb/omap4 tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 04:02:02 -0000 Author: imp Date: Tue Oct 18 04:02:00 2016 New Revision: 307549 URL: https://svnweb.freebsd.org/changeset/base/307549 Log: Add preliminary support for Raspberry PI3 images to nanobsd. Added: head/sys/modules/dtb/omap4/ head/sys/modules/dtb/omap4/Makefile (contents, props changed) head/tools/tools/nanobsd/embedded/rpi3.cfg - copied, changed from r307548, head/tools/tools/nanobsd/embedded/rpi2.cfg Added: head/sys/modules/dtb/omap4/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/dtb/omap4/Makefile Tue Oct 18 04:02:00 2016 (r307549) @@ -0,0 +1,8 @@ +# $FreeBSD$ +# All the dts files for omap4 systems we support. +DTS= \ + omap4-duovero-parlor.dts \ + pandaboard.dts \ + pandaboard-es.dts + +.include Copied and modified: head/tools/tools/nanobsd/embedded/rpi3.cfg (from r307548, head/tools/tools/nanobsd/embedded/rpi2.cfg) ============================================================================== --- head/tools/tools/nanobsd/embedded/rpi2.cfg Tue Oct 18 04:01:58 2016 (r307548, copy source) +++ head/tools/tools/nanobsd/embedded/rpi3.cfg Tue Oct 18 04:02:00 2016 (r307549) @@ -26,11 +26,10 @@ # SUCH DAMAGE. # -NANO_ARCH=armv6 -NANO_KERNEL=RPI2 +NANO_ARCH=aarch64 +NANO_KERNEL=RPI3 NANO_DRIVE=mmcsd0 -NANO_NAME=rpi2 -NANO_BOOT_PKG=u-boot-rpi2 -NANO_CPUTYPE=cortex-a7 +NANO_NAME=rpi3 +NANO_BOOT_PKG=u-boot-rpi3 . common # Pull in common definitions, keep last From owner-svn-src-all@freebsd.org Tue Oct 18 05:26:24 2016 Return-Path: Delivered-To: svn-src-all@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 E5C0FC168DE; Tue, 18 Oct 2016 05:26:24 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.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 ADB6B199; Tue, 18 Oct 2016 05:26:24 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from Marcels-MacBook-Pro.local.mail (cerberus.brkt.com [208.185.168.138]) (authenticated bits=0) by mail.xcllnt.net (8.15.2/8.15.2) with ESMTPSA id u9I53ANZ068032 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Mon, 17 Oct 2016 22:03:11 -0700 (PDT) (envelope-from marcel@xcllnt.net) Date: Mon, 17 Oct 2016 22:03:04 -0700 From: Marcel Moolenaar To: Ngie Cooper , Marcel Moolenaar Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org, src-committers@freebsd.org Message-ID: In-Reply-To: References: <201610180155.u9I1t79S037286@repo.freebsd.org> Subject: Re: svn commit: r307544 - head/usr.bin/mkimg X-Mailer: Airmail (390) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="0376CE22-CEC3-4DF8-A583-3DD8D34EABCF"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.xcllnt.net [50.0.150.214]); Mon, 17 Oct 2016 22:03:11 -0700 (PDT) X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 05:26:25 -0000 --0376CE22-CEC3-4DF8-A583-3DD8D34EABCF Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On October 17, 2016 at 8:34:11 PM, Ngie Cooper (yaneurabeya=40gmail.com) = wrote: > On Oct 17, 2016, at 18:55, Marcel Moolenaar wr= ote:=C2=A0 > *snip* > +C=46LAGS+=3D-I=24=7BSRCTOP=7D/sys/sys/disk=C2=A0 Isn't it a better app idea to maintain the disk/ namespace for includes=3F= =C2=A0 Thanks=21=C2=A0 You mean, add -I=24=7BSRCTOP=7D//sys/sys on the compile line and change t= he code to use =23include =3F Unfortunately, that creates conflicts with header files that are included= as and match headers we have under sys/sys. --0376CE22-CEC3-4DF8-A583-3DD8D34EABCF Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using AMPGpg -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYBa0IAAoJEIda8t8f0tjjl2AP/3NaWuvqH10XP/DrbOLimUP5 f9qbjU42j0KkyUHAg2lDSneufGD9HQXrDmdzaMbBU9McYJcLIJU2WICB7EoFP/gS /0C2fZAIDFZ1sw3oEKUVeyx8Vyv9hoJy+c0rk/ijhTVKlOCkT+hlVjeF8jo4y9KB z7X/ustX+gjM7OuPadPlzR84Isqw57mfd5kjbytJ/clxCGaZSJwbLbY0uhZbC8w1 /6aQQsLD5QEYj0minJEkCYhhl1WGXS76BJJYfMeS0FtnY2L6oc3RKgAgxWxkwmRB qJWLBmTZ4LnNElsejGXl8+t8X9+f1YNzL4mCWMhRdcD6SH4vQIPuqa6akQTTsbdj zHp7QpMn2/XYfmuuVrspzuQq1JNLkKb7VplcvSFO5aMhe3VvGL/w0TwS1hNJvMFM /g3JKwAkH/V+cdOGC1d4deVTdiG8HzDYPy5K5mFcylT62oV4B6UvurcNy4QQ0tN7 rLMCJJiTwlJbWxcBxePU6uuoA4LsuoEuI9FbYfg8lQteSuUBr6EN/flgjXKT5lTT 9pXoLso2L4n9YtN/5Ea1PDf1NaPZf9LtTweUczwU1MYI9srrmfH/0eDCrS4faLrp txoGllJPCXITMcrsmgZZb9z6lmcqZs26mriTyBK7aJ/RZZnksMcOwaN83dTsDVh2 ItSJjc+sN77mlCnXipED -----END PGP SIGNATURE----- --0376CE22-CEC3-4DF8-A583-3DD8D34EABCF-- From owner-svn-src-all@freebsd.org Tue Oct 18 05:43:14 2016 Return-Path: Delivered-To: svn-src-all@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 84694C16F6B; Tue, 18 Oct 2016 05:43:14 +0000 (UTC) (envelope-from imp@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 5F742CB2; Tue, 18 Oct 2016 05:43:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I5hD65023919; Tue, 18 Oct 2016 05:43:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I5hDHJ023915; Tue, 18 Oct 2016 05:43:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610180543.u9I5hDHJ023915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 18 Oct 2016 05:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307550 - head/usr.bin/mkimg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 05:43:14 -0000 Author: imp Date: Tue Oct 18 05:43:12 2016 New Revision: 307550 URL: https://svnweb.freebsd.org/changeset/base/307550 Log: Add a new flag to mkimg (-a num) to specify the active partition for those partitioning schemes that have this concept. Implement it as an override for mbr's setting 0x80 in the flags for the first partition when we have boot code. Differential Revision: https://reviews.freebsd.org/D4403 Modified: head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/mkimg.1 head/usr.bin/mkimg/mkimg.c head/usr.bin/mkimg/mkimg.h Modified: head/usr.bin/mkimg/mbr.c ============================================================================== --- head/usr.bin/mkimg/mbr.c Tue Oct 18 04:02:00 2016 (r307549) +++ head/usr.bin/mkimg/mbr.c Tue Oct 18 05:43:12 2016 (r307550) @@ -92,7 +92,12 @@ mbr_write(lba_t imgsz __unused, void *bo TAILQ_FOREACH(part, &partlist, link) { size = round_track(part->size); dp = dpbase + part->index; - dp->dp_flag = (part->index == 0 && bootcode != NULL) ? 0x80 : 0; + if (active_partition != 0) + dp->dp_flag = + (part->index + 1 == active_partition) ? 0x80 : 0; + else + dp->dp_flag = + (part->index == 0 && bootcode != NULL) ? 0x80 : 0; mbr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect, part->block); dp->dp_typ = ALIAS_TYPE2INT(part->type); Modified: head/usr.bin/mkimg/mkimg.1 ============================================================================== --- head/usr.bin/mkimg/mkimg.1 Tue Oct 18 04:02:00 2016 (r307549) +++ head/usr.bin/mkimg/mkimg.1 Tue Oct 18 05:43:12 2016 (r307550) @@ -40,6 +40,7 @@ .Op Fl c Ar capacity .Op Fl f Ar format .Op Fl o Ar outfile +.Op Fl a Ar active .Op Fl v .Op Fl y .Op Fl s Ar scheme Op Fl p Ar partition ... @@ -119,7 +120,7 @@ An empty partition table can be written partitioning scheme with the .Fl s option, but without specifying any partitions. -When the size required to for all the partitions is larger than the +When the size required for all the partitions is larger than the given capacity, then the disk image will be larger than the capacity given. .Pp @@ -139,6 +140,26 @@ utility will generate predictable values .Nm utility will create images that are identical. .Pp +The +.Ar active +option marks a partition as active, if the partitioning +scheme supports it. +Currently, only the +.Ar mbr +scheme supports this concept. +By default, +.Nm +will only mark the first partition as active when boot code is +specified. +Use the +.Ar active +option to override the active partition. +The number specified corresponds to the number after the 's' in the +partition's +.Xr geom 8 +name. +No partitions are marked active when the value is 0. +.Pp A set of long options exist to query about the .Nm utility itself. Modified: head/usr.bin/mkimg/mkimg.c ============================================================================== --- head/usr.bin/mkimg/mkimg.c Tue Oct 18 04:02:00 2016 (r307549) +++ head/usr.bin/mkimg/mkimg.c Tue Oct 18 05:43:12 2016 (r307550) @@ -70,6 +70,7 @@ u_int nheads = 1; u_int nsecs = 1; u_int secsz = 512; u_int blksz = 0; +uint32_t active_partition = 0; static void print_formats(int usage) @@ -145,6 +146,7 @@ usage(const char *why) fprintf(stderr, "\t--schemes\t- list partition schemes\n"); fprintf(stderr, "\t--version\t- show version information\n"); fputc('\n', stderr); + fprintf(stderr, "\t-a \t- mark num'th partion as active\n"); fprintf(stderr, "\t-b \t- file containing boot code\n"); fprintf(stderr, "\t-c \t- capacity (in bytes) of the disk\n"); fprintf(stderr, "\t-f \n"); @@ -468,9 +470,14 @@ main(int argc, char *argv[]) bcfd = -1; outfd = 1; /* Write to stdout by default */ - while ((c = getopt_long(argc, argv, "b:c:f:o:p:s:vyH:P:S:T:", + while ((c = getopt_long(argc, argv, "a:b:c:f:o:p:s:vyH:P:S:T:", longopts, NULL)) != -1) { switch (c) { + case 'a': /* ACTIVE PARTITION, if supported */ + error = parse_uint32(&active_partition, 1, 100, optarg); + if (error) + errc(EX_DATAERR, error, "Partition ordinal"); + break; case 'b': /* BOOT CODE */ if (bcfd != -1) usage("multiple bootcode given"); Modified: head/usr.bin/mkimg/mkimg.h ============================================================================== --- head/usr.bin/mkimg/mkimg.h Tue Oct 18 04:02:00 2016 (r307549) +++ head/usr.bin/mkimg/mkimg.h Tue Oct 18 05:43:12 2016 (r307550) @@ -59,6 +59,7 @@ extern u_int nheads; extern u_int nsecs; extern u_int secsz; /* Logical block size. */ extern u_int blksz; /* Physical block size. */ +extern uint32_t active_partition; static inline lba_t round_block(lba_t n) From owner-svn-src-all@freebsd.org Tue Oct 18 06:17:59 2016 Return-Path: Delivered-To: svn-src-all@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 45993C16C4E; Tue, 18 Oct 2016 06:17:59 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B906AF31; Tue, 18 Oct 2016 06:17:58 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-lf0-x242.google.com with SMTP id x79so30687338lff.2; Mon, 17 Oct 2016 23:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=af/NE6DVbubFXlfawUUpF08VMeqTSTZadgI9P10DCww=; b=t+BGO2B6wfREWJsySZOhI09ZGuxDqvW+aLQVA2uzLjlCe7cI3w/gWo8nhHdRV8dfvJ w10mUG+fcTwigN1uhLyc8SGBimzjbP5W2GEEh1/nlR2OaX+5VNUR1l6paekcbuPM/XGq WR1kI8SFSDBDlG8tK+hkKiWKrX2ygwGJlSeQ5JcQVB0rwgEqau8nItUVjFiBrk92EsbR TO50WuEt1STYbs+oqlei2UpGA5KME+9nG2ykcKl4X+sCaIlTc5ffdKYT4kvHZenqO9m6 nRUmz8yp3L6en+/6sUfqqX7TAJ2f9IORQeJZLVZkf1k/j3jPRERN1nTdF6SoGeE4JQE5 BnOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=af/NE6DVbubFXlfawUUpF08VMeqTSTZadgI9P10DCww=; b=S0Ufs9AlwCsJu3EG7wMJ+uHdqdyhuKhgsKdF/4B8hihUEuQtVVLNshU6WWdur0WlT2 dKGx1QGWWb/TFES1Sxx/D0udA6NAt5BVFrCZ6GP/FuhJQvyjxl4K8EsQbacmuKV2F7oH DEr7/wiy28V9nH3dARY4zxm9J2XpqFoX9SKaxFaVoRvwnLnwl04yPDyWtDq1ynEVPSo7 FeqvX924oTHC0JCR7GGpf3B0mZAJv2/RHG4NEPviGZYbOAr8LpcBW+KFBqInw+OPci8b u1B+GkdAXIh6o9y0ymaKsVJl7zHylCD8a6dA75be890GyHMaKA9jT7xtOP9h2hYqThZ0 H0kQ== X-Gm-Message-State: AA6/9RmU8clGBFtFRlPBZ1cMSrFUQOqvciuiNSa7tBZtKafb2xm1RO+SLqt4pEFp/1A1QQ== X-Received: by 10.28.12.7 with SMTP id 7mr10864435wmm.125.1476771476814; Mon, 17 Oct 2016 23:17:56 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id qo8sm59922538wjc.46.2016.10.17.23.17.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 23:17:56 -0700 (PDT) Sender: Baptiste Daroussin Date: Tue, 18 Oct 2016 08:17:55 +0200 From: Baptiste Daroussin To: Ngie Cooper Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r306864 - head Message-ID: <20161018061755.makbm4tvtb5i6rc4@ivaldir.etoilebsd.net> References: <201610081857.u98IvB7l012374@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rts6hrqscnh4jtq3" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161014 (1.7.1) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 06:17:59 -0000 --rts6hrqscnh4jtq3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 17, 2016 at 06:28:08PM -0700, Ngie Cooper wrote: > On Sat, Oct 8, 2016 at 11:57 AM, Baptiste Daroussin wr= ote: > > Author: bapt > > Date: Sat Oct 8 18:57:11 2016 > > New Revision: 306864 > > URL: https://svnweb.freebsd.org/changeset/base/306864 > > > > Log: > > groff is not needed in the bootstrap tools if the system is built > > WITHOUT_SHAREDOCS > > > > MFC after: 2 weeks > > > > Modified: > > head/Makefile.inc1 >=20 > This breaks buildworld when WITHOUT_GROFF is set and > WITHOUT_SHAREDOCS isn't set. Really do you have logs of that? Best regards, Bapt --rts6hrqscnh4jtq3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYBb5TAAoJEGOJi9zxtz5akfcP/jxVxqxU7BpP3SCQCQKG8uxs NL8PFhAhycjNpHwKvOKPSDeT8Ggi/+DPEE+V7vg395F1+XTPfJK+PMbpgqKIt131 JT/DfoyvCtL0tGxr+d7e4NJuNl8rRtaGLOAByqPhr/ZCXS9NfmmyVc0VhqMySfcr RD9flduU+BBsrm33YZHt+PNiDWUx69NQCdVm9+jB+pqoNPxfnGrDNRmYJZekjyz6 xiqCdNCqhtWDRChje8KIIHOhSVHkX0qxiDmiR9r+YP3E7Qm4XR4ogniiWcKt/EeS pTcdeYfNano5tCA/FJphvMtzKjhLozr2YcIVSo23r5skBmYs1CtmXJDqArc8+acX ICL0Fpz+m6opAC8MtzVLdbzEgPoFAo67fWk5tMkOZX05vXq3Sp3wS2NDYMcPufVe otU5OnzkiXegAAIZzM9vHkH6ZmDCCuGbeo4DZLlHGg+I6cNu+tb9yFTMsuFAyXRh Sqg1P7vxlnk4bzi9LKD2oT/27Um26ZxRR0lIMWdY6Quj76jK1TkXSbhEi2USBVYx qwobx/mF+VfJZYV3uBF1zSDq54b1uYtbcg/UbCC630Sg829xoPfUwkGnHCFWGIAq E1ltz7mJRnSzhfDdzZUjo2trQmPT9wPPA3Um8IfGINh6NpI4PNd8helmk+TzrUMk f3SedublC754WNcfncgz =9AQJ -----END PGP SIGNATURE----- --rts6hrqscnh4jtq3-- From owner-svn-src-all@freebsd.org Tue Oct 18 07:16:51 2016 Return-Path: Delivered-To: svn-src-all@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 5991AC1614C; Tue, 18 Oct 2016 07:16:51 +0000 (UTC) (envelope-from jch@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 33DF829; Tue, 18 Oct 2016 07:16:51 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9I7GoYI057682; Tue, 18 Oct 2016 07:16:50 GMT (envelope-from jch@FreeBSD.org) Received: (from jch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9I7GoOU057679; Tue, 18 Oct 2016 07:16:50 GMT (envelope-from jch@FreeBSD.org) Message-Id: <201610180716.u9I7GoOU057679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jch set sender to jch@FreeBSD.org using -f From: Julien Charbon Date: Tue, 18 Oct 2016 07:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307551 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 07:16:51 -0000 Author: jch Date: Tue Oct 18 07:16:49 2016 New Revision: 307551 URL: https://svnweb.freebsd.org/changeset/base/307551 Log: Fix a double-free when an inp transitions to INP_TIMEWAIT state after having been dropped. This fixes enforces in_pcbdrop() logic in tcp_input(): "in_pcbdrop() is used by TCP to mark an inpcb as unused and avoid future packet delivery or event notification when a socket remains open but TCP has closed." PR: 203175 Reported by: Palle Girgensohn, Slawa Olhovchenkov Tested by: Slawa Olhovchenkov Reviewed by: Slawa Olhovchenkov Approved by: gnn, Slawa Olhovchenkov Differential Revision: https://reviews.freebsd.org/D8211 MFC after: 1 week Sponsored by: Verisign, inc Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Oct 18 05:43:12 2016 (r307550) +++ head/sys/netinet/tcp_input.c Tue Oct 18 07:16:49 2016 (r307551) @@ -920,6 +920,16 @@ findpcb: goto dropwithreset; } INP_WLOCK_ASSERT(inp); + /* + * While waiting for inp lock during the lookup, another thread + * can have dropped the inpcb, in which case we need to loop back + * and try to find a new inpcb to deliver to. + */ + if (inp->inp_flags & INP_DROPPED) { + INP_WUNLOCK(inp); + inp = NULL; + goto findpcb; + } if ((inp->inp_flowtype == M_HASHTYPE_NONE) && (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) && ((inp->inp_socket == NULL) || @@ -980,6 +990,10 @@ relocked: if (in_pcbrele_wlocked(inp)) { inp = NULL; goto findpcb; + } else if (inp->inp_flags & INP_DROPPED) { + INP_WUNLOCK(inp); + inp = NULL; + goto findpcb; } } else ti_locked = TI_RLOCKED; @@ -1039,6 +1053,10 @@ relocked: if (in_pcbrele_wlocked(inp)) { inp = NULL; goto findpcb; + } else if (inp->inp_flags & INP_DROPPED) { + INP_WUNLOCK(inp); + inp = NULL; + goto findpcb; } goto relocked; } else Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Tue Oct 18 05:43:12 2016 (r307550) +++ head/sys/netinet/tcp_timewait.c Tue Oct 18 07:16:49 2016 (r307551) @@ -231,6 +231,10 @@ tcp_twstart(struct tcpcb *tp) INP_INFO_RLOCK_ASSERT(&V_tcbinfo); INP_WLOCK_ASSERT(inp); + /* A dropped inp should never transition to TIME_WAIT state. */ + KASSERT((inp->inp_flags & INP_DROPPED) == 0, ("tcp_twstart: " + "(inp->inp_flags & INP_DROPPED) != 0")); + if (V_nolocaltimewait) { int error = 0; #ifdef INET6 Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Tue Oct 18 05:43:12 2016 (r307550) +++ head/sys/netinet/tcp_usrreq.c Tue Oct 18 07:16:49 2016 (r307551) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef DDB #include @@ -210,10 +211,26 @@ tcp_detach(struct socket *so, struct inp * In all three cases the tcptw should not be freed here. */ if (inp->inp_flags & INP_DROPPED) { - KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && " - "INP_DROPPED && tp != NULL")); in_pcbdetach(inp); - in_pcbfree(inp); + if (__predict_true(tp == NULL)) { + in_pcbfree(inp); + } else { + /* + * This case should not happen as in TIMEWAIT + * state the inp should not be destroyed before + * its tcptw. If INVARIANTS is defined, panic. + */ +#ifdef INVARIANTS + panic("%s: Panic before an inp double-free: " + "INP_TIMEWAIT && INP_DROPPED && tp != NULL" + , __func__); +#else + log(LOG_ERR, "%s: Avoid an inp double-free: " + "INP_TIMEWAIT && INP_DROPPED && tp != NULL" + , __func__); +#endif + INP_WUNLOCK(inp); + } } else { in_pcbdetach(inp); INP_WUNLOCK(inp); From owner-svn-src-all@freebsd.org Tue Oct 18 10:12:57 2016 Return-Path: Delivered-To: svn-src-all@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 30C55C1757F; Tue, 18 Oct 2016 10:12:57 +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 F397CACA; Tue, 18 Oct 2016 10:12: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 u9IACuLl025078; Tue, 18 Oct 2016 10:12:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IACu9b025077; Tue, 18 Oct 2016 10:12:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610181012.u9IACu9b025077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 18 Oct 2016 10:12: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: r307552 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 10:12:57 -0000 Author: kib Date: Tue Oct 18 10:12:55 2016 New Revision: 307552 URL: https://svnweb.freebsd.org/changeset/base/307552 Log: MFC r307064: When downgrading exclusively busied page to shared-busy state, wakeup waiters. Modified: stable/11/sys/vm/vm_page.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Tue Oct 18 07:16:49 2016 (r307551) +++ stable/11/sys/vm/vm_page.c Tue Oct 18 10:12:55 2016 (r307552) @@ -657,15 +657,26 @@ void vm_page_busy_downgrade(vm_page_t m) { u_int x; + bool locked; vm_page_assert_xbusied(m); + locked = mtx_owned(vm_page_lockptr(m)); for (;;) { x = m->busy_lock; x &= VPB_BIT_WAITERS; + if (x != 0 && !locked) + vm_page_lock(m); if (atomic_cmpset_rel_int(&m->busy_lock, - VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1) | x)) + VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1))) break; + if (x != 0 && !locked) + vm_page_unlock(m); + } + if (x != 0) { + wakeup(m); + if (!locked) + vm_page_unlock(m); } } From owner-svn-src-all@freebsd.org Tue Oct 18 10:13:55 2016 Return-Path: Delivered-To: svn-src-all@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 7AFB3C17601; Tue, 18 Oct 2016 10:13:55 +0000 (UTC) (envelope-from br@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 4D043C4C; Tue, 18 Oct 2016 10:13:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IADsXH025158; Tue, 18 Oct 2016 10:13:54 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IADs1j025157; Tue, 18 Oct 2016 10:13:54 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610181013.u9IADs1j025157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 18 Oct 2016 10:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307553 - head/contrib/netbsd-tests/lib/libpthread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 10:13:55 -0000 Author: br Date: Tue Oct 18 10:13:54 2016 New Revision: 307553 URL: https://svnweb.freebsd.org/changeset/base/307553 Log: Skip test on MIPS as it modifies TLS pointer in set_mcontext(). Discussed with: kib Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Modified: head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c ============================================================================== --- head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 10:12:55 2016 (r307552) +++ head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 10:13:54 2016 (r307553) @@ -97,6 +97,15 @@ ATF_TC_BODY(swapcontext1, tc) { pthread_t thread; +#ifdef __mips__ + /* + * MIPS modifies TLS pointer in set_mcontext(), so + * swapping contexts obtained from different threads + * gives us different pthread_self() return value. + */ + atf_tc_skip("Platform is not supported."); +#endif + oself = (void *)&val1; nself = (void *)&val2; From owner-svn-src-all@freebsd.org Tue Oct 18 10:20:59 2016 Return-Path: Delivered-To: svn-src-all@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 736CDC17809; Tue, 18 Oct 2016 10:20:59 +0000 (UTC) (envelope-from br@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 45BF7EAB; Tue, 18 Oct 2016 10:20:59 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IAKwNA025486; Tue, 18 Oct 2016 10:20:58 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IAKwmi025485; Tue, 18 Oct 2016 10:20:58 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610181020.u9IAKwmi025485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 18 Oct 2016 10:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307554 - head/tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 10:20:59 -0000 Author: br Date: Tue Oct 18 10:20:58 2016 New Revision: 307554 URL: https://svnweb.freebsd.org/changeset/base/307554 Log: Fix comment. We have different VM layout on MIPS, so test is skipped. Requested by: kib Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/tests/sys/kern/kern_copyin.c Modified: head/tests/sys/kern/kern_copyin.c ============================================================================== --- head/tests/sys/kern/kern_copyin.c Tue Oct 18 10:13:54 2016 (r307553) +++ head/tests/sys/kern/kern_copyin.c Tue Oct 18 10:20:58 2016 (r307554) @@ -60,7 +60,12 @@ ATF_TC_BODY(kern_copyin, tc) char template[] = "copyin.XXXXXX"; #ifdef __mips__ - /* MIPS has no shared page implemented yet. */ + /* + * MIPS has different VM layout: the UVA map on mips ends the + * highest mapped entry at the VM_MAXUSER_ADDRESS - PAGE_SIZE, + * while all other arches map either stack or shared page up + * to the VM_MAXUSER_ADDRESS. + */ atf_tc_skip("Platform is not supported."); #endif From owner-svn-src-all@freebsd.org Tue Oct 18 10:33:30 2016 Return-Path: Delivered-To: svn-src-all@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 215B6C17A90; Tue, 18 Oct 2016 10:33:30 +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 DCB0E1597; Tue, 18 Oct 2016 10:33:29 +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 u9IAXSuq032728; Tue, 18 Oct 2016 10:33:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IAXSxm032727; Tue, 18 Oct 2016 10:33:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610181033.u9IAXSxm032727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 18 Oct 2016 10:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307555 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 10:33:30 -0000 Author: kib Date: Tue Oct 18 10:33:28 2016 New Revision: 307555 URL: https://svnweb.freebsd.org/changeset/base/307555 Log: MFC r307064: When downgrading exclusively busied page to shared-busy state, wakeup waiters. Modified: stable/10/sys/vm/vm_page.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_page.c ============================================================================== --- stable/10/sys/vm/vm_page.c Tue Oct 18 10:20:58 2016 (r307554) +++ stable/10/sys/vm/vm_page.c Tue Oct 18 10:33:28 2016 (r307555) @@ -515,15 +515,26 @@ void vm_page_busy_downgrade(vm_page_t m) { u_int x; + bool locked; vm_page_assert_xbusied(m); + locked = mtx_owned(vm_page_lockptr(m)); for (;;) { x = m->busy_lock; x &= VPB_BIT_WAITERS; + if (x != 0 && !locked) + vm_page_lock(m); if (atomic_cmpset_rel_int(&m->busy_lock, - VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1) | x)) + VPB_SINGLE_EXCLUSIVER | x, VPB_SHARERS_WORD(1))) break; + if (x != 0 && !locked) + vm_page_unlock(m); + } + if (x != 0) { + wakeup(m); + if (!locked) + vm_page_unlock(m); } } From owner-svn-src-all@freebsd.org Tue Oct 18 12:21:47 2016 Return-Path: Delivered-To: svn-src-all@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 159A7C14751; Tue, 18 Oct 2016 12:21:47 +0000 (UTC) (envelope-from mmel@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 DBAEBA9D; Tue, 18 Oct 2016 12:21:46 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ICLkbH073738; Tue, 18 Oct 2016 12:21:46 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ICLkNc073737; Tue, 18 Oct 2016 12:21:46 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610181221.u9ICLkNc073737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 18 Oct 2016 12:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307556 - head/sys/arm/nvidia/tegra124 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 12:21:47 -0000 Author: mmel Date: Tue Oct 18 12:21:45 2016 New Revision: 307556 URL: https://svnweb.freebsd.org/changeset/base/307556 Log: TEGRA: Really implement early printf. The original version was cut&pasted from another SoC. Pointy-hat to: mmel MFC after: 2 weeks Modified: head/sys/arm/nvidia/tegra124/tegra124_machdep.c Modified: head/sys/arm/nvidia/tegra124/tegra124_machdep.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_machdep.c Tue Oct 18 10:33:28 2016 (r307555) +++ head/sys/arm/nvidia/tegra124/tegra124_machdep.c Tue Oct 18 12:21:45 2016 (r307556) @@ -120,18 +120,18 @@ tegra124_cpu_reset(platform_t plat) /* * Early putc routine for EARLY_PRINTF support. To use, add to kernel config: - * option SOCDEV_PA=0x02000000 - * option SOCDEV_VA=0x02000000 + * option SOCDEV_PA=0x70000000 + * option SOCDEV_VA=0x70000000 * option EARLY_PRINTF */ -#if 0 +#ifdef EARLY_PRINTF static void tegra124_early_putc(int c) { - volatile uint32_t * UART_STAT_REG = (uint32_t *)0x02020098; - volatile uint32_t * UART_TX_REG = (uint32_t *)0x02020040; - const uint32_t UART_TXRDY = (1 << 3); + volatile uint32_t * UART_STAT_REG = (uint32_t *)(0x70006314); + volatile uint32_t * UART_TX_REG = (uint32_t *)(0x70006300); + const uint32_t UART_TXRDY = (1 << 6); while ((*UART_STAT_REG & UART_TXRDY) == 0) continue; *UART_TX_REG = c; From owner-svn-src-all@freebsd.org Tue Oct 18 12:26:23 2016 Return-Path: Delivered-To: svn-src-all@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 91F7FC14A2A; Tue, 18 Oct 2016 12:26:23 +0000 (UTC) (envelope-from mmel@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 44907E4D; Tue, 18 Oct 2016 12:26:23 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ICQMXF074625; Tue, 18 Oct 2016 12:26:22 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ICQMug074623; Tue, 18 Oct 2016 12:26:22 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610181226.u9ICQMug074623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 18 Oct 2016 12:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307557 - head/sys/arm/nvidia/tegra124 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 12:26:23 -0000 Author: mmel Date: Tue Oct 18 12:26:22 2016 New Revision: 307557 URL: https://svnweb.freebsd.org/changeset/base/307557 Log: TEGRA: Attach cpufreq and coretemp drivers only on tegra124 SoC. It's needed by GENERIC kernel. MFC after: 2 weeks Modified: head/sys/arm/nvidia/tegra124/tegra124_coretemp.c head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Modified: head/sys/arm/nvidia/tegra124/tegra124_coretemp.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_coretemp.c Tue Oct 18 12:21:45 2016 (r307556) +++ head/sys/arm/nvidia/tegra124/tegra124_coretemp.c Tue Oct 18 12:26:22 2016 (r307557) @@ -178,10 +178,14 @@ tegra124_coretemp_ofw_parse(struct tegra static void tegra124_coretemp_identify(driver_t *driver, device_t parent) { + phandle_t root; - if (device_find_child(parent, "coretemp", -1) != NULL) + root = OF_finddevice("/"); + if (!ofw_bus_node_is_compatible(root, "nvidia,tegra124")) return; - if (BUS_ADD_CHILD(parent, 0, "coretemp", -1) == NULL) + if (device_find_child(parent, "tegra124_coretemp", -1) != NULL) + return; + if (BUS_ADD_CHILD(parent, 0, "tegra124_coretemp", -1) == NULL) device_printf(parent, "add child failed\n"); } @@ -262,7 +266,7 @@ static device_method_t tegra124_coretemp }; static devclass_t tegra124_coretemp_devclass; -static DEFINE_CLASS_0(coretemp, tegra124_coretemp_driver, +static DEFINE_CLASS_0(tegra124_coretemp, tegra124_coretemp_driver, tegra124_coretemp_methods, sizeof(struct tegra124_coretemp_softc)); DRIVER_MODULE(tegra124_coretemp, cpu, tegra124_coretemp_driver, tegra124_coretemp_devclass, NULL, NULL); Modified: head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Tue Oct 18 12:21:45 2016 (r307556) +++ head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Tue Oct 18 12:26:22 2016 (r307557) @@ -475,6 +475,11 @@ get_fdt_resources(struct tegra124_cpufre static void tegra124_cpufreq_identify(driver_t *driver, device_t parent) { + phandle_t root; + + root = OF_finddevice("/"); + if (!ofw_bus_node_is_compatible(root, "nvidia,tegra124")) + return; if (device_get_unit(parent) != 0) return; From owner-svn-src-all@freebsd.org Tue Oct 18 12:27:48 2016 Return-Path: Delivered-To: svn-src-all@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 33775C14AB8; Tue, 18 Oct 2016 12:27:48 +0000 (UTC) (envelope-from mmel@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 0DD11FDE; Tue, 18 Oct 2016 12:27:47 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ICRlHG074715; Tue, 18 Oct 2016 12:27:47 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ICRkHV074711; Tue, 18 Oct 2016 12:27:46 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610181227.u9ICRkHV074711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 18 Oct 2016 12:27:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307558 - in head/sys: arm/nvidia dev/extres/regulator X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 12:27:48 -0000 Author: mmel Date: Tue Oct 18 12:27:46 2016 New Revision: 307558 URL: https://svnweb.freebsd.org/changeset/base/307558 Log: REGULATOR: Move functions for handling with regulator ranges to common file. They can be useful for other PMICs. MFC after: 2 weeks Modified: head/sys/arm/nvidia/as3722_regulators.c head/sys/dev/extres/regulator/regulator.c head/sys/dev/extres/regulator/regulator.h Modified: head/sys/arm/nvidia/as3722_regulators.c ============================================================================== --- head/sys/arm/nvidia/as3722_regulators.c Tue Oct 18 12:26:22 2016 (r307557) +++ head/sys/arm/nvidia/as3722_regulators.c Tue Oct 18 12:27:46 2016 (r307558) @@ -71,13 +71,6 @@ enum as3722_reg_id { AS3722_REG_ID_LDO11, }; -struct regulator_range { - u_int min_uvolt; - u_int step_uvolt; - u_int min_sel; - u_int max_sel; -}; - /* Regulator HW definition. */ struct reg_def { @@ -107,40 +100,32 @@ struct as3722_reg_sc { int enable_usec; }; -#define RANGE_INIT(_min_sel, _max_sel, _min_uvolt, _step_uvolt) \ -{ \ - .min_sel = _min_sel, \ - .max_sel = _max_sel, \ - .min_uvolt = _min_uvolt, \ - .step_uvolt = _step_uvolt, \ -} - static struct regulator_range as3722_sd016_ranges[] = { - RANGE_INIT(0x00, 0x00, 0, 0), - RANGE_INIT(0x01, 0x5A, 610000, 10000), + REG_RANGE_INIT(0x00, 0x00, 0, 0), + REG_RANGE_INIT(0x01, 0x5A, 610000, 10000), }; static struct regulator_range as3722_sd0_lv_ranges[] = { - RANGE_INIT(0x00, 0x00, 0, 0), - RANGE_INIT(0x01, 0x6E, 410000, 10000), + REG_RANGE_INIT(0x00, 0x00, 0, 0), + REG_RANGE_INIT(0x01, 0x6E, 410000, 10000), }; static struct regulator_range as3722_sd_ranges[] = { - RANGE_INIT(0x00, 0x00, 0, 0), - RANGE_INIT(0x01, 0x40, 612500, 12500), - RANGE_INIT(0x41, 0x70, 1425000, 25000), - RANGE_INIT(0x71, 0x7F, 2650000, 50000), + REG_RANGE_INIT(0x00, 0x00, 0, 0), + REG_RANGE_INIT(0x01, 0x40, 612500, 12500), + REG_RANGE_INIT(0x41, 0x70, 1425000, 25000), + REG_RANGE_INIT(0x71, 0x7F, 2650000, 50000), }; static struct regulator_range as3722_ldo3_ranges[] = { - RANGE_INIT(0x00, 0x00, 0, 0), - RANGE_INIT(0x01, 0x2D, 620000, 20000), + REG_RANGE_INIT(0x00, 0x00, 0, 0), + REG_RANGE_INIT(0x01, 0x2D, 620000, 20000), }; static struct regulator_range as3722_ldo_ranges[] = { - RANGE_INIT(0x00, 0x00, 0, 0), - RANGE_INIT(0x01, 0x24, 825000, 25000), - RANGE_INIT(0x40, 0x7F, 1725000, 25000), + REG_RANGE_INIT(0x00, 0x00, 0, 0), + REG_RANGE_INIT(0x01, 0x24, 825000, 25000), + REG_RANGE_INIT(0x40, 0x7F, 1725000, 25000), }; static struct reg_def as3722s_def[] = { @@ -402,87 +387,6 @@ DEFINE_CLASS_1(as3722_regnode, as3722_re sizeof(struct as3722_reg_sc), regnode_class); static int -regulator_range_sel_to_volt(struct as3722_reg_sc *sc, uint8_t sel, int *volt) -{ - struct regulator_range *range; - struct reg_def *def; - int i; - - def = sc->def; - if (def->nranges == 0) - panic("Voltage regulator have zero ranges\n"); - - for (i = 0; i < def->nranges ; i++) { - range = def->ranges + i; - - if (!(sel >= range->min_sel && - sel <= range->max_sel)) - continue; - - sel -= range->min_sel; - - *volt = range->min_uvolt + sel * range->step_uvolt; - return (0); - } - - return (ERANGE); -} - -static int -regulator_range_volt_to_sel(struct as3722_reg_sc *sc, int min_uvolt, - int max_uvolt, uint8_t *out_sel) -{ - struct regulator_range *range; - struct reg_def *def; - uint8_t sel; - int uvolt; - int rv, i; - - def = sc->def; - if (def->nranges == 0) - panic("Voltage regulator have zero ranges\n"); - - for (i = 0; i < def->nranges; i++) { - range = def->ranges + i; - uvolt = range->min_uvolt + - (range->max_sel - range->min_sel) * range->step_uvolt; - - if ((min_uvolt > uvolt) || - (max_uvolt < range->min_uvolt)) - continue; - - if (min_uvolt <= range->min_uvolt) - min_uvolt = range->min_uvolt; - - /* If step is zero then range is fixed voltage range. */ - if (range->step_uvolt == 0) - sel = 0; - else - sel = DIV_ROUND_UP(min_uvolt - range->min_uvolt, - range->step_uvolt); - - - sel += range->min_sel; - - break; - } - - if (i >= def->nranges) - return (ERANGE); - - /* Verify new settings. */ - rv = regulator_range_sel_to_volt(sc, sel, &uvolt); - if (rv != 0) - return (rv); - if ((uvolt < min_uvolt) || (uvolt > max_uvolt)) - return (ERANGE); - - *out_sel = sel; - return (0); -} - - -static int as3722_read_sel(struct as3722_reg_sc *sc, uint8_t *sel) { int rv; @@ -783,7 +687,8 @@ as3722_regnode_set_volt(struct regnode * sc = regnode_get_softc(regnode); *udelay = 0; - rv = regulator_range_volt_to_sel(sc, min_uvolt, max_uvolt, &sel); + rv = regulator_range_volt_to_sel8(sc->def->ranges, sc->def->nranges, + min_uvolt, max_uvolt, &sel); if (rv != 0) return (rv); rv = as3722_write_sel(sc, sel); @@ -806,6 +711,7 @@ as3722_regnode_get_volt(struct regnode * /* LDO6 have bypass. */ if (sc->def->id == AS3722_REG_ID_LDO6 && sel == AS3722_LDO6_SEL_BYPASS) return (ENOENT); - rv = regulator_range_sel_to_volt(sc, sel, uvolt); + rv = regulator_range_sel8_to_volt(sc->def->ranges, sc->def->nranges, + sel, uvolt); return (rv); } Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Tue Oct 18 12:26:22 2016 (r307557) +++ head/sys/dev/extres/regulator/regulator.c Tue Oct 18 12:27:46 2016 (r307558) @@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_REGULATOR, "regulator", "Regulator framework"); +#define DIV_ROUND_UP(n,d) howmany(n, d) + /* Forward declarations. */ struct regulator; struct regnode; @@ -984,3 +986,87 @@ regulator_get_by_ofw_property(device_t c return (regulator_get_by_id(cdev, regdev, id, reg)); } #endif + +/* -------------------------------------------------------------------------- + * + * Regulator utility functions. + * + */ + +/* Convert raw selector value to real voltage */ +int +regulator_range_sel8_to_volt(struct regulator_range *ranges, int nranges, + uint8_t sel, int *volt) +{ + struct regulator_range *range; + int i; + + if (nranges == 0) + panic("Voltage regulator have zero ranges\n"); + + for (i = 0; i < nranges ; i++) { + range = ranges + i; + + if (!(sel >= range->min_sel && + sel <= range->max_sel)) + continue; + + sel -= range->min_sel; + + *volt = range->min_uvolt + sel * range->step_uvolt; + return (0); + } + + return (ERANGE); +} + +int +regulator_range_volt_to_sel8(struct regulator_range *ranges, int nranges, + int min_uvolt, int max_uvolt, uint8_t *out_sel) +{ + struct regulator_range *range; + uint8_t sel; + int uvolt; + int rv, i; + + if (nranges == 0) + panic("Voltage regulator have zero ranges\n"); + + for (i = 0; i < nranges; i++) { + range = ranges + i; + uvolt = range->min_uvolt + + (range->max_sel - range->min_sel) * range->step_uvolt; + + if ((min_uvolt > uvolt) || + (max_uvolt < range->min_uvolt)) + continue; + + if (min_uvolt <= range->min_uvolt) + min_uvolt = range->min_uvolt; + + /* if step == 0 -> fixed voltage range. */ + if (range->step_uvolt == 0) + sel = 0; + else + sel = DIV_ROUND_UP(min_uvolt - range->min_uvolt, + range->step_uvolt); + + + sel += range->min_sel; + + break; + } + + if (i >= nranges) + return (ERANGE); + + /* Verify new settings. */ + rv = regulator_range_sel8_to_volt(ranges, nranges, sel, &uvolt); + if (rv != 0) + return (rv); + if ((uvolt < min_uvolt) || (uvolt > max_uvolt)) + return (ERANGE); + + *out_sel = sel; + return (0); +} Modified: head/sys/dev/extres/regulator/regulator.h ============================================================================== --- head/sys/dev/extres/regulator/regulator.h Tue Oct 18 12:26:22 2016 (r307557) +++ head/sys/dev/extres/regulator/regulator.h Tue Oct 18 12:27:46 2016 (r307558) @@ -67,9 +67,22 @@ struct regnode_init_def { #ifdef FDT phandle_t ofw_node; /* OFW node of regulator */ #endif +}; +struct regulator_range { + int min_uvolt; + int step_uvolt; + uint8_t min_sel; + uint8_t max_sel; }; +#define REG_RANGE_INIT(_min_sel, _max_sel, _min_uvolt, _step_uvolt) { \ + .min_sel = _min_sel, \ + .max_sel = _max_sel, \ + .min_uvolt = _min_uvolt, \ + .step_uvolt = _step_uvolt, \ +} + /* * Shorthands for constructing method tables. */ @@ -125,4 +138,10 @@ int regulator_parse_ofw_stdparam(device_ struct regnode_init_def *def); #endif +/* Utility functions */ +int regulator_range_volt_to_sel8(struct regulator_range *ranges, int nranges, + int min_uvolt, int max_uvolt, uint8_t *out_sel); +int regulator_range_sel8_to_volt(struct regulator_range *ranges, int nranges, + uint8_t sel, int *volt); + #endif /* _DEV_EXTRES_REGULATOR_H_ */ From owner-svn-src-all@freebsd.org Tue Oct 18 12:58:19 2016 Return-Path: Delivered-To: svn-src-all@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 2D41BC15744; Tue, 18 Oct 2016 12:58:19 +0000 (UTC) (envelope-from br@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 F0F061E0; Tue, 18 Oct 2016 12:58:18 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ICwIfD086375; Tue, 18 Oct 2016 12:58:18 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ICwId0086374; Tue, 18 Oct 2016 12:58:18 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610181258.u9ICwId0086374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 18 Oct 2016 12:58:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307559 - head/usr.sbin/fstyp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 12:58:19 -0000 Author: br Date: Tue Oct 18 12:58:17 2016 New Revision: 307559 URL: https://svnweb.freebsd.org/changeset/base/307559 Log: fstyp tests comes with pre-created EL filesystems, but fstyp cannot detect EL filesystem on EB machine, so exclude test files from distribution and skip the test. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/usr.sbin/fstyp/Makefile Modified: head/usr.sbin/fstyp/Makefile ============================================================================== --- head/usr.sbin/fstyp/Makefile Tue Oct 18 12:27:46 2016 (r307558) +++ head/usr.sbin/fstyp/Makefile Tue Oct 18 12:58:17 2016 (r307559) @@ -14,8 +14,9 @@ MAN= fstyp.8 WARNS?= 2 .include +.include -.if ${MK_TESTS} != "no" +.if ${MK_TESTS} != "no" && ${TARGET_ENDIANNESS} == 1234 SUBDIR+= tests .endif From owner-svn-src-all@freebsd.org Tue Oct 18 13:12:20 2016 Return-Path: Delivered-To: svn-src-all@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 B1C37C15BE7; Tue, 18 Oct 2016 13:12:20 +0000 (UTC) (envelope-from sbruno@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 820B0CA8; Tue, 18 Oct 2016 13:12:20 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IDCJTP093706; Tue, 18 Oct 2016 13:12:19 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IDCJxc093705; Tue, 18 Oct 2016 13:12:19 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181312.u9IDCJxc093705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 13:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307560 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:12:20 -0000 Author: sbruno Date: Tue Oct 18 13:12:19 2016 New Revision: 307560 URL: https://svnweb.freebsd.org/changeset/base/307560 Log: Fix misusage of CPU_FFS when binding queues to cpus ref: https://github.com/NextBSD/NextBSD/commit/922d0bdf2277f30954f143107d2a3eddb02abd2d Submitted by: mmacy@nextbsd.org Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Oct 18 12:58:17 2016 (r307559) +++ head/sys/net/iflib.c Tue Oct 18 13:12:19 2016 (r307560) @@ -4294,17 +4294,23 @@ iflib_irq_alloc(if_ctx_t ctx, if_irq_t i return (_iflib_irq_alloc(ctx, irq, rid, filter, handler, arg, name)); } -static void +static int find_nth(if_ctx_t ctx, cpuset_t *cpus, int qid) { - int i, cpuid; + int i, cpuid, eqid, count; CPU_COPY(&ctx->ifc_cpus, cpus); + count = CPU_COUNT(&ctx->ifc_cpus); + eqid = qid % count; /* clear up to the qid'th bit */ - for (i = 0; i < qid; i++) { + for (i = 0; i < eqid; i++) { cpuid = CPU_FFS(cpus); - CPU_CLR(cpuid, cpus); + MPASS(cpuid != 0); + CPU_CLR(cpuid-1, cpus); } + cpuid = CPU_FFS(cpus); + MPASS(cpuid != 0); + return (cpuid-1); } int @@ -4317,7 +4323,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if iflib_filter_info_t info; cpuset_t cpus; gtask_fn_t *fn; - int tqrid, err; + int tqrid, err, cpuid; void *q; info = &ctx->ifc_filter_info; @@ -4363,11 +4369,11 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if if (err != 0) return (err); if (tqrid != -1) { - find_nth(ctx, &cpus, qid); - taskqgroup_attach_cpu(tqg, gtask, q, CPU_FFS(&cpus), irq->ii_rid, name); - } else + cpuid = find_nth(ctx, &cpus, qid); + taskqgroup_attach_cpu(tqg, gtask, q, cpuid, irq->ii_rid, name); + } else { taskqgroup_attach(tqg, gtask, q, tqrid, name); - + } return (0); } From owner-svn-src-all@freebsd.org Tue Oct 18 13:16:28 2016 Return-Path: Delivered-To: svn-src-all@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 8F101C15CDC; Tue, 18 Oct 2016 13:16:28 +0000 (UTC) (envelope-from sbruno@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 5E7F9FAC; Tue, 18 Oct 2016 13:16:28 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IDGRns094021; Tue, 18 Oct 2016 13:16:27 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IDGR0A094020; Tue, 18 Oct 2016 13:16:27 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181316.u9IDGR0A094020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 13:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307561 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:16:28 -0000 Author: sbruno Date: Tue Oct 18 13:16:27 2016 New Revision: 307561 URL: https://svnweb.freebsd.org/changeset/base/307561 Log: Tell gtask to what we've been bound. ref: https://github.com/NextBSD/NextBSD/commit/54414984cfebb920bbc40aadeb601bdce448d8d7 Submitted by: mmacy@nextbsd.org Modified: head/sys/kern/subr_gtaskqueue.c Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue Oct 18 13:12:19 2016 (r307560) +++ head/sys/kern/subr_gtaskqueue.c Tue Oct 18 13:16:27 2016 (r307561) @@ -633,6 +633,7 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; if (irq != -1 && smp_started) { CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); From owner-svn-src-all@freebsd.org Tue Oct 18 13:22:45 2016 Return-Path: Delivered-To: svn-src-all@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 66FB0C1604A; Tue, 18 Oct 2016 13:22:45 +0000 (UTC) (envelope-from sbruno@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 35F7A7FC; Tue, 18 Oct 2016 13:22:45 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IDMi1R097606; Tue, 18 Oct 2016 13:22:44 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IDMi1l097605; Tue, 18 Oct 2016 13:22:44 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181322.u9IDMi1l097605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 13:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307562 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:22:45 -0000 Author: sbruno Date: Tue Oct 18 13:22:44 2016 New Revision: 307562 URL: https://svnweb.freebsd.org/changeset/base/307562 Log: Toggle v4/v6 rxcsum together Only re-init if driver is running ref: https://github.com/NextBSD/NextBSD/commit/106518e874ec9a61daf4c09894170d24e2f4d60d Submitted by: mmacy@nextbsd.org Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Oct 18 13:16:27 2016 (r307561) +++ head/sys/net/iflib.c Tue Oct 18 13:22:44 2016 (r307562) @@ -3162,8 +3162,6 @@ iflib_if_qflush(if_t ifp) IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | \ IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | IFCAP_VLAN_HWTSO) -#define IFCAP_REINIT IFCAP_FLAGS - static int iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) { @@ -3288,6 +3286,8 @@ iflib_if_ioctl(if_t ifp, u_long command, #endif setmask |= (mask & IFCAP_FLAGS); + if (setmask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) + setmask |= (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); if ((mask & IFCAP_WOL) && (if_getcapabilities(ifp) & IFCAP_WOL) != 0) setmask |= (mask & (IFCAP_WOL_MCAST|IFCAP_WOL_MAGIC)); @@ -3298,10 +3298,10 @@ iflib_if_ioctl(if_t ifp, u_long command, if (setmask) { CTX_LOCK(ctx); bits = if_getdrvflags(ifp); - if (setmask & IFCAP_REINIT) + if (bits & IFF_DRV_RUNNING) iflib_stop(ctx); if_togglecapenable(ifp, setmask); - if (setmask & IFCAP_REINIT) + if (bits & IFF_DRV_RUNNING) iflib_init_locked(ctx); if_setdrvflags(ifp, bits); CTX_UNLOCK(ctx); From owner-svn-src-all@freebsd.org Tue Oct 18 13:29:32 2016 Return-Path: Delivered-To: svn-src-all@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 1A605C16336; Tue, 18 Oct 2016 13:29:32 +0000 (UTC) (envelope-from sbruno@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 DA1D3C42; Tue, 18 Oct 2016 13:29:31 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IDTUeW098024; Tue, 18 Oct 2016 13:29:30 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IDTU8f098023; Tue, 18 Oct 2016 13:29:30 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181329.u9IDTU8f098023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 13:29:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307563 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:29:32 -0000 Author: sbruno Date: Tue Oct 18 13:29:30 2016 New Revision: 307563 URL: https://svnweb.freebsd.org/changeset/base/307563 Log: When deciding whether or not to call tqg_attach_cpu(), reference rid directly. ref: https://github.com/NextBSD/NextBSD/commit/c9b47b468b8a3350811acfd9e167a8b91dc8f0c6 Submitted by: mmacy@nextbsd.org Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Oct 18 13:22:44 2016 (r307562) +++ head/sys/net/iflib.c Tue Oct 18 13:29:30 2016 (r307563) @@ -4327,6 +4327,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if void *q; info = &ctx->ifc_filter_info; + tqrid = rid; switch (type) { /* XXX merge tx/rx for netmap? */ @@ -4335,7 +4336,6 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if info = &ctx->ifc_txqs[qid].ift_filter_info; gtask = &ctx->ifc_txqs[qid].ift_task; tqg = qgroup_if_io_tqg; - tqrid = irq->ii_rid; fn = _task_fn_tx; break; case IFLIB_INTR_RX: @@ -4343,7 +4343,6 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if info = &ctx->ifc_rxqs[qid].ifr_filter_info; gtask = &ctx->ifc_rxqs[qid].ifr_task; tqg = qgroup_if_io_tqg; - tqrid = irq->ii_rid; fn = _task_fn_rx; break; case IFLIB_INTR_ADMIN: @@ -4351,7 +4350,6 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if info = &ctx->ifc_filter_info; gtask = &ctx->ifc_admin_task; tqg = qgroup_if_config_tqg; - tqrid = -1; fn = _task_fn_admin; break; default: From owner-svn-src-all@freebsd.org Tue Oct 18 13:38:01 2016 Return-Path: Delivered-To: svn-src-all@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 321B5C16792; Tue, 18 Oct 2016 13:38:01 +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 0411C25E; Tue, 18 Oct 2016 13:38:00 +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 u9IDc0EG001802; Tue, 18 Oct 2016 13:38:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IDc0e1001801; Tue, 18 Oct 2016 13:38:00 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610181338.u9IDc0e1001801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 18 Oct 2016 13:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307564 - head/contrib/mdocml X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:38:01 -0000 Author: emaste Date: Tue Oct 18 13:37:59 2016 New Revision: 307564 URL: https://svnweb.freebsd.org/changeset/base/307564 Log: makewhatis: avoid skipping another page after one with no mlinks Submitted by: Ingo Schwarze MFC after: 3 weeks MFC with: r307003 Modified: head/contrib/mdocml/mandocdb.c Modified: head/contrib/mdocml/mandocdb.c ============================================================================== --- head/contrib/mdocml/mandocdb.c Tue Oct 18 13:29:30 2016 (r307563) +++ head/contrib/mdocml/mandocdb.c Tue Oct 18 13:37:59 2016 (r307564) @@ -1146,10 +1146,8 @@ mpages_merge(struct mparse *mp) for (mpage = mpage_head; mpage != NULL; mpage = mpage->next) { mlinks_undupe(mpage); - if ((mlink = mpage->mlinks) == NULL) { - mpage = mpage->next; + if ((mlink = mpage->mlinks) == NULL) continue; - } name_mask = NAME_MASK; mandoc_ohash_init(&names, 4, offsetof(struct str, key)); From owner-svn-src-all@freebsd.org Tue Oct 18 13:39:57 2016 Return-Path: Delivered-To: svn-src-all@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 85BDFC1685D; Tue, 18 Oct 2016 13:39:57 +0000 (UTC) (envelope-from andrew@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 3BD8569D; Tue, 18 Oct 2016 13:39:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IDduDw001900; Tue, 18 Oct 2016 13:39:56 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IDduRp001897; Tue, 18 Oct 2016 13:39:56 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610181339.u9IDduRp001897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 18 Oct 2016 13:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307565 - in head/sys/arm64: arm64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:39:57 -0000 Author: andrew Date: Tue Oct 18 13:39:55 2016 New Revision: 307565 URL: https://svnweb.freebsd.org/changeset/base/307565 Log: Add PCB_FP_USERMASK so we can mask off floating point flags that should not be sent to userspace, for example the future flag to tell when we are using floating point in the kernel. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/trap.c head/sys/arm64/include/pcb.h Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Tue Oct 18 13:37:59 2016 (r307564) +++ head/sys/arm64/arm64/machdep.c Tue Oct 18 13:39:55 2016 (r307565) @@ -341,6 +341,8 @@ get_fpcontext(struct thread *td, mcontex KASSERT(curpcb->pcb_fpusaved == &curpcb->pcb_fpustate, ("Called get_fpcontext while the kernel is using the VFP")); + KASSERT((curpcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, + ("Non-userspace FPU flags set in get_fpcontext")); memcpy(mcp->mc_fpregs.fp_q, curpcb->pcb_fpustate.vfp_regs, sizeof(mcp->mc_fpregs)); mcp->mc_fpregs.fp_cr = curpcb->pcb_fpustate.vfp_fpcr; @@ -376,7 +378,7 @@ set_fpcontext(struct thread *td, mcontex sizeof(mcp->mc_fpregs)); curpcb->pcb_fpustate.vfp_fpcr = mcp->mc_fpregs.fp_cr; curpcb->pcb_fpustate.vfp_fpsr = mcp->mc_fpregs.fp_sr; - curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags; + curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK; } critical_exit(); Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Tue Oct 18 13:37:59 2016 (r307564) +++ head/sys/arm64/arm64/trap.c Tue Oct 18 13:39:55 2016 (r307565) @@ -409,6 +409,9 @@ do_el0_sync(struct trapframe *frame) userret(td, frame); break; } + + KASSERT((curthread->td_pcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, + ("Kernel VFP flags set while entering userspace")); } void Modified: head/sys/arm64/include/pcb.h ============================================================================== --- head/sys/arm64/include/pcb.h Tue Oct 18 13:37:59 2016 (r307564) +++ head/sys/arm64/include/pcb.h Tue Oct 18 13:39:55 2016 (r307565) @@ -54,6 +54,8 @@ struct pcb { struct vfpstate *pcb_fpusaved; int pcb_fpflags; #define PCB_FP_STARTED 0x01 +/* The bits passed to userspace in get_fpcontext */ +#define PCB_FP_USERMASK (PCB_FP_STARTED) u_int pcb_vfpcpu; /* Last cpu this thread ran VFP code */ /* From owner-svn-src-all@freebsd.org Tue Oct 18 13:55:35 2016 Return-Path: Delivered-To: svn-src-all@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 66755C1607C; Tue, 18 Oct 2016 13:55:35 +0000 (UTC) (envelope-from sbruno@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 3DD52262; Tue, 18 Oct 2016 13:55:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IDtYDY009500; Tue, 18 Oct 2016 13:55:34 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IDtYNh009499; Tue, 18 Oct 2016 13:55:34 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181355.u9IDtYNh009499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 13:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307566 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 13:55:35 -0000 Author: sbruno Date: Tue Oct 18 13:55:34 2016 New Revision: 307566 URL: https://svnweb.freebsd.org/changeset/base/307566 Log: Ensure that tasks with a specific cpu set prior to smp starting get re-attached to a thread running on that cpu. ref: https://github.com/NextBSD/NextBSD/commit/fcc20e306bc93ebbbe51f3775d1afb527970a2e9 Submitted by: mmacy@nextbsd.org Modified: head/sys/kern/subr_gtaskqueue.c Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue Oct 18 13:39:55 2016 (r307565) +++ head/sys/kern/subr_gtaskqueue.c Tue Oct 18 13:55:34 2016 (r307566) @@ -554,7 +554,7 @@ struct taskq_bind_task { }; static void -taskqgroup_cpu_create(struct taskqgroup *qgroup, int idx) +taskqgroup_cpu_create(struct taskqgroup *qgroup, int idx, int cpu) { struct taskqgroup_cpu *qcpu; @@ -564,7 +564,7 @@ taskqgroup_cpu_create(struct taskqgroup taskqueue_thread_enqueue, &qcpu->tgc_taskq); gtaskqueue_start_threads(&qcpu->tgc_taskq, 1, PI_SOFT, "%s_%d", qgroup->tqg_name, idx); - qcpu->tgc_cpu = idx * qgroup->tqg_stride; + qcpu->tgc_cpu = cpu; } static void @@ -633,8 +633,8 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; if (irq != -1 && smp_started) { + gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); mtx_unlock(&qgroup->tqg_lock); @@ -643,6 +643,32 @@ taskqgroup_attach(struct taskqgroup *qgr mtx_unlock(&qgroup->tqg_lock); } +static void +taskqgroup_attach_deferred(struct taskqgroup *qgroup, struct grouptask *gtask) +{ + cpuset_t mask; + int qid, cpu; + + mtx_lock(&qgroup->tqg_lock); + qid = taskqgroup_find(qgroup, gtask->gt_uniq); + cpu = qgroup->tqg_queue[qid].tgc_cpu; + if (gtask->gt_irq != -1) { + mtx_unlock(&qgroup->tqg_lock); + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + intr_setaffinity(gtask->gt_irq, &mask); + + mtx_lock(&qgroup->tqg_lock); + } + qgroup->tqg_queue[qid].tgc_cnt++; + + LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, + gt_list); + gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + mtx_unlock(&qgroup->tqg_lock); +} + int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, void *uniq, int cpu, int irq, char *name) @@ -671,13 +697,46 @@ taskqgroup_attach_cpu(struct taskqgroup qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && smp_started) { - CPU_ZERO(&mask); - CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); - mtx_unlock(&qgroup->tqg_lock); + cpu = qgroup->tqg_queue[qid].tgc_cpu; + mtx_unlock(&qgroup->tqg_lock); + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + if (irq != -1 && smp_started) intr_setaffinity(irq, &mask); - } else + return (0); +} + +static int +taskqgroup_attach_cpu_deferred(struct taskqgroup *qgroup, struct grouptask *gtask) +{ + cpuset_t mask; + int i, qid, irq, cpu; + + qid = -1; + irq = gtask->gt_irq; + cpu = gtask->gt_cpu; + MPASS(smp_started); + mtx_lock(&qgroup->tqg_lock); + for (i = 0; i < qgroup->tqg_cnt; i++) + if (qgroup->tqg_queue[i].tgc_cpu == cpu) { + qid = i; + break; + } + if (qid == -1) { mtx_unlock(&qgroup->tqg_lock); + return (EINVAL); + } + qgroup->tqg_queue[qid].tgc_cnt++; + LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; + mtx_unlock(&qgroup->tqg_lock); + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + + if (irq != -1) + intr_setaffinity(irq, &mask); return (0); } @@ -741,9 +800,8 @@ static int _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride) { LIST_HEAD(, grouptask) gtask_head = LIST_HEAD_INITIALIZER(NULL); - cpuset_t mask; struct grouptask *gtask; - int i, k, old_cnt, qid, cpu; + int i, k, old_cnt, old_cpu, cpu; mtx_assert(&qgroup->tqg_lock, MA_OWNED); @@ -758,6 +816,9 @@ _taskqgroup_adjust(struct taskqgroup *qg } qgroup->tqg_adjusting = 1; old_cnt = qgroup->tqg_cnt; + old_cpu = 0; + if (old_cnt < cnt) + old_cpu = qgroup->tqg_queue[old_cnt].tgc_cpu; mtx_unlock(&qgroup->tqg_lock); /* * Set up queue for tasks added before boot. @@ -771,8 +832,13 @@ _taskqgroup_adjust(struct taskqgroup *qg /* * If new taskq threads have been added. */ - for (i = old_cnt; i < cnt; i++) - taskqgroup_cpu_create(qgroup, i); + cpu = old_cpu; + for (i = old_cnt; i < cnt; i++) { + for (k = 0; k < qgroup->tqg_stride; k++) + cpu = CPU_NEXT(cpu); + + taskqgroup_cpu_create(qgroup, i, cpu); + } mtx_lock(&qgroup->tqg_lock); qgroup->tqg_cnt = cnt; qgroup->tqg_stride = stride; @@ -788,39 +854,15 @@ _taskqgroup_adjust(struct taskqgroup *qg } } + mtx_unlock(&qgroup->tqg_lock); + while ((gtask = LIST_FIRST(>ask_head))) { LIST_REMOVE(gtask, gt_list); if (gtask->gt_cpu == -1) - qid = taskqgroup_find(qgroup, gtask->gt_uniq); - else { - for (i = 0; i < qgroup->tqg_cnt; i++) - if (qgroup->tqg_queue[i].tgc_cpu == gtask->gt_cpu) { - qid = i; - break; - } - } - qgroup->tqg_queue[qid].tgc_cnt++; - LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, - gt_list); - gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - } - /* - * Set new CPU and IRQ affinity - */ - cpu = CPU_FIRST(); - for (i = 0; i < cnt; i++) { - qgroup->tqg_queue[i].tgc_cpu = cpu; - for (k = 0; k < qgroup->tqg_stride; k++) - cpu = CPU_NEXT(cpu); - CPU_ZERO(&mask); - CPU_SET(qgroup->tqg_queue[i].tgc_cpu, &mask); - LIST_FOREACH(gtask, &qgroup->tqg_queue[i].tgc_tasks, gt_list) { - if (gtask->gt_irq == -1) - continue; - intr_setaffinity(gtask->gt_irq, &mask); - } + taskqgroup_attach_deferred(qgroup, gtask); + else if (taskqgroup_attach_cpu_deferred(qgroup, gtask)) + taskqgroup_attach_deferred(qgroup, gtask); } - mtx_unlock(&qgroup->tqg_lock); /* * If taskq thread count has been reduced. @@ -837,12 +879,12 @@ _taskqgroup_adjust(struct taskqgroup *qg } int -taskqgroup_adjust(struct taskqgroup *qgroup, int cpu, int stride) +taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride) { int error; mtx_lock(&qgroup->tqg_lock); - error = _taskqgroup_adjust(qgroup, cpu, stride); + error = _taskqgroup_adjust(qgroup, cnt, stride); mtx_unlock(&qgroup->tqg_lock); return (error); From owner-svn-src-all@freebsd.org Tue Oct 18 14:00:28 2016 Return-Path: Delivered-To: svn-src-all@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 1099AC162C3; Tue, 18 Oct 2016 14:00:28 +0000 (UTC) (envelope-from sbruno@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 B6E637E4; Tue, 18 Oct 2016 14:00:27 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IE0QJw009740; Tue, 18 Oct 2016 14:00:26 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IE0QO1009739; Tue, 18 Oct 2016 14:00:26 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181400.u9IE0QO1009739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 14:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307567 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 14:00:28 -0000 Author: sbruno Date: Tue Oct 18 14:00:26 2016 New Revision: 307567 URL: https://svnweb.freebsd.org/changeset/base/307567 Log: Assert that we're assigning a non-null taskqueue. ref: https://github.com/NextBSD/NextBSD/commit/535865d02c162e415d7436899cd6db5000a0cc7b Fix cpu assignment by assuring stride is non-zero, assert that all tasks have a valid taskqueue. ref: https://github.com/NextBSD/NextBSD/commit/db398176234fe3ce9f8e8b671f56000f8276feba Start cpu assignment from zero. ref: https://github.com/NextBSD/NextBSD/commit/d99d39b6b6c5dfac1eb440c41e36ebf4c897198e Submitted by: mmacy@nextbsd.org Modified: head/sys/kern/subr_gtaskqueue.c Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue Oct 18 13:55:34 2016 (r307566) +++ head/sys/kern/subr_gtaskqueue.c Tue Oct 18 14:00:26 2016 (r307567) @@ -665,6 +665,7 @@ taskqgroup_attach_deferred(struct taskqg LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + MPASS(qgroup->tqg_queue[qid].tgc_taskq != NULL); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; mtx_unlock(&qgroup->tqg_lock); } @@ -729,6 +730,7 @@ taskqgroup_attach_cpu_deferred(struct ta } qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); + MPASS(qgroup->tqg_queue[qid].tgc_taskq != NULL); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; mtx_unlock(&qgroup->tqg_lock); @@ -834,10 +836,10 @@ _taskqgroup_adjust(struct taskqgroup *qg */ cpu = old_cpu; for (i = old_cnt; i < cnt; i++) { - for (k = 0; k < qgroup->tqg_stride; k++) - cpu = CPU_NEXT(cpu); - taskqgroup_cpu_create(qgroup, i, cpu); + + for (k = 0; k < stride; k++) + cpu = CPU_NEXT(cpu); } mtx_lock(&qgroup->tqg_lock); qgroup->tqg_cnt = cnt; @@ -864,6 +866,15 @@ _taskqgroup_adjust(struct taskqgroup *qg taskqgroup_attach_deferred(qgroup, gtask); } +#ifdef INVARIANTS + mtx_lock(&qgroup->tqg_lock); + for (i = 0; i < qgroup->tqg_cnt; i++) { + MPASS(qgroup->tqg_queue[i].tgc_taskq != NULL); + LIST_FOREACH(gtask, &qgroup->tqg_queue[i].tgc_tasks, gt_list) + MPASS(gtask->gt_taskqueue != NULL); + } + mtx_unlock(&qgroup->tqg_lock); +#endif /* * If taskq thread count has been reduced. */ From owner-svn-src-all@freebsd.org Tue Oct 18 14:02:46 2016 Return-Path: Delivered-To: svn-src-all@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 96D87C1644C; Tue, 18 Oct 2016 14:02:46 +0000 (UTC) (envelope-from sbruno@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 68D98BD3; Tue, 18 Oct 2016 14:02:46 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IE2jah013345; Tue, 18 Oct 2016 14:02:45 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IE2j5I013344; Tue, 18 Oct 2016 14:02:45 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181402.u9IE2j5I013344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 14:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307568 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 14:02:46 -0000 Author: sbruno Date: Tue Oct 18 14:02:45 2016 New Revision: 307568 URL: https://svnweb.freebsd.org/changeset/base/307568 Log: Set default capabilities at attach. ref: https://github.com/NextBSD/NextBSD/commit/6425f45e5fc89f64925995bbcfc09c7558d896ea Submitted by: mmacy@nextbsd.org Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Oct 18 14:00:26 2016 (r307567) +++ head/sys/net/iflib.c Tue Oct 18 14:02:45 2016 (r307568) @@ -3903,6 +3903,10 @@ _iflib_assert(if_shared_ctx_t sctx) MPASS(sctx->isc_ntxd_default[0]); } +#define DEFAULT_CAPS (IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6 | IFCAP_HWCSUM | IFCAP_LRO | \ + IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | \ + IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | IFCAP_VLAN_HWTSO | IFCAP_HWSTATS) + static int iflib_register(if_ctx_t ctx) { @@ -3937,8 +3941,9 @@ iflib_register(if_ctx_t ctx) if_setqflushfn(ifp, iflib_if_qflush); if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); - if_setcapabilities(ifp, 0); - if_setcapenable(ifp, 0); + /* XXX - move this in to the driver for non-default settings */ + if_setcapabilities(ifp, DEFAULT_CAPS); + if_setcapenable(ifp, DEFAULT_CAPS); ctx->ifc_vlan_attach_event = EVENTHANDLER_REGISTER(vlan_config, iflib_vlan_register, ctx, From owner-svn-src-all@freebsd.org Tue Oct 18 14:48:42 2016 Return-Path: Delivered-To: svn-src-all@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 8726BC1788B; Tue, 18 Oct 2016 14:48:42 +0000 (UTC) (envelope-from sbruno@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 555BCF68; Tue, 18 Oct 2016 14:48:42 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IEmfC1029194; Tue, 18 Oct 2016 14:48:41 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IEmfsi029193; Tue, 18 Oct 2016 14:48:41 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610181448.u9IEmfsi029193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 18 Oct 2016 14:48:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307569 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 14:48:42 -0000 Author: sbruno Date: Tue Oct 18 14:48:41 2016 New Revision: 307569 URL: https://svnweb.freebsd.org/changeset/base/307569 Log: Restore svn r306772 that was overwritten by netmap import at svn r307394 #include should be here as all drivers that support netmap need to use this file regardless. Modified: head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Tue Oct 18 14:02:45 2016 (r307568) +++ head/sys/dev/netmap/netmap_kern.h Tue Oct 18 14:48:41 2016 (r307569) @@ -73,6 +73,7 @@ #endif #if defined(__FreeBSD__) +#include #define likely(x) __builtin_expect((long)!!(x), 1L) #define unlikely(x) __builtin_expect((long)!!(x), 0L) From owner-svn-src-all@freebsd.org Tue Oct 18 15:14:47 2016 Return-Path: Delivered-To: svn-src-all@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 A36AFC172AF; Tue, 18 Oct 2016 15:14:47 +0000 (UTC) (envelope-from ae@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 79E7CAE4; Tue, 18 Oct 2016 15:14:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IFEk4f041120; Tue, 18 Oct 2016 15:14:46 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IFEk88041118; Tue, 18 Oct 2016 15:14:46 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201610181514.u9IFEk88041118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 18 Oct 2016 15:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307570 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 15:14:47 -0000 Author: ae Date: Tue Oct 18 15:14:46 2016 New Revision: 307570 URL: https://svnweb.freebsd.org/changeset/base/307570 Log: Add support for non-contiguous IPv6 masks in ipfw(8) rules. For example fe::640:0:0/ffff::ffff:ffff:0:0 will match addresses fe:*:*:*:0:640:*:* Submitted by: Eugene Mamchits Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Tue Oct 18 14:48:41 2016 (r307569) +++ head/sbin/ipfw/ipfw.8 Tue Oct 18 15:14:46 2016 (r307570) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2016 +.Dd October 18, 2016 .Dt IPFW 8 .Os .Sh NAME @@ -1357,6 +1357,24 @@ or a hostname) and mask width of .Cm masklen bits. +.It Ar addr Ns / Ns Ar mask +Matches all IPv6 addresses with base +.Ar addr +(specified as allowed by +.Xr inet_pton +or a hostname) +and the mask of +.Ar mask , +specified as allowed by +.Xr inet_pton. +As an example, fe::640:0:0/ffff::ffff:ffff:0:0 will match +fe:*:*:*:0:640:*:*. +This form is advised only for non-contiguous +masks. +It is better to resort to the +.Ar addr Ns / Ns Ar masklen +format for contiguous masks, which is more compact and less +error-prone. .El .Pp No support for sets of IPv6 addresses is provided because IPv6 addresses Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Tue Oct 18 14:48:41 2016 (r307569) +++ head/sbin/ipfw/ipv6.c Tue Oct 18 15:14:46 2016 (r307570) @@ -124,8 +124,8 @@ print_ip6(struct buf_pr *bp, ipfw_insn_i if (inet_ntop(AF_INET6, a, trad, sizeof( trad ) ) == NULL) bprintf(bp, "Error ntop in print_ip6\n"); bprintf(bp, "%s", trad ); - if (mb < 0) /* XXX not really legal... */ - bprintf(bp, ":%s", + if (mb < 0) /* mask not contiguous */ + bprintf(bp, "/%s", inet_ntop(AF_INET6, &a[1], trad, sizeof(trad))); else if (mb < 128) bprintf(bp, "/%d", mb); @@ -325,9 +325,10 @@ lookup_host6 (char *host, struct in6_add * any matches any IP6. Actually returns an empty instruction. * me returns O_IP6_*_ME * - * 03f1::234:123:0342 single IP6 address - * 03f1::234:123:0342/24 address/mask - * 03f1::234:123:0342/24,03f1::234:123:0343/ List of address + * 03f1::234:123:0342 single IP6 address + * 03f1::234:123:0342/24 address/masklen + * 03f1::234:123:0342/ffff::ffff:ffff address/mask + * 03f1::234:123:0342/24,03f1::234:123:0343/ List of address * * Set of address (as in ipv6) not supported because ipv6 address * are typically random past the initial prefix. @@ -382,13 +383,18 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, i * or ',' indicating another address follows. */ - char *p; + char *p, *q; int masklen; char md = '\0'; CHECK_LENGTH(cblen, 1 + len + 2 * F_INSN_SIZE(struct in6_addr)); - if ((p = strpbrk(av, "/,")) ) { + if ((q = strchr(av, ',')) ) { + *q = '\0'; + q++; + } + + if ((p = strchr(av, '/')) ) { md = *p; /* save the separator */ *p = '\0'; /* terminate address string */ p++; /* and skip past it */ @@ -401,22 +407,22 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, i errx(EX_DATAERR, "bad address \"%s\"", av); } /* next, look at the mask, if any */ - masklen = (md == '/') ? atoi(p) : 128; - if (masklen > 128 || masklen < 0) - errx(EX_DATAERR, "bad width \"%s\''", p); - else - n2mask(&d[1], masklen); + if (md == '/' && strchr(p, ':')) { + if (!inet_pton(AF_INET6, p, &d[1])) + errx(EX_DATAERR, "bad mask \"%s\"", p); + + masklen = contigmask((uint8_t *)&(d[1]), 128); + } else { + masklen = (md == '/') ? atoi(p) : 128; + if (masklen > 128 || masklen < 0) + errx(EX_DATAERR, "bad width \"%s\''", p); + else + n2mask(&d[1], masklen); + } APPLY_MASK(d, &d[1]) /* mask base address with mask */ - /* find next separator */ - - if (md == '/') { /* find separator past the mask */ - p = strpbrk(p, ","); - if (p != NULL) - p++; - } - av = p; + av = q; /* Check this entry */ if (masklen == 0) { From owner-svn-src-all@freebsd.org Tue Oct 18 15:24:57 2016 Return-Path: Delivered-To: svn-src-all@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 4C088C175EC; Tue, 18 Oct 2016 15:24:57 +0000 (UTC) (envelope-from luigi@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 1E082222; Tue, 18 Oct 2016 15:24:57 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IFOur2045063; Tue, 18 Oct 2016 15:24:56 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IFOutA045062; Tue, 18 Oct 2016 15:24:56 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610181524.u9IFOutA045062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Tue, 18 Oct 2016 15:24:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307571 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 15:24:57 -0000 Author: luigi Date: Tue Oct 18 15:24:56 2016 New Revision: 307571 URL: https://svnweb.freebsd.org/changeset/base/307571 Log: fix a stale sentence in the manpage Modified: head/share/man/man4/netmap.4 Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Tue Oct 18 15:14:46 2016 (r307570) +++ head/share/man/man4/netmap.4 Tue Oct 18 15:24:56 2016 (r307571) @@ -828,9 +828,9 @@ Performance is inferior to native netmap mode but still significantly higher than various raw socket types (bpf, PF_PACKET, etc.). Note that for slow devices (such as 1 Gbit/s and slower NICs, -or several 10 Gbit/s NICs whose hardware is unable -that of in-kernel solutions such as Linux's -.Xr pktgen . +or several 10 Gbit/s NICs whose hardware is unable to sustain line rate), +emulated and native mode will likely have similar or same throughput. +.br When emulation is in use, packet sniffer programs such as tcpdump could see received packets before they are diverted by netmap. This behaviour is not intentional, being just an artifact of the implementation of emulation. From owner-svn-src-all@freebsd.org Tue Oct 18 15:41:59 2016 Return-Path: Delivered-To: svn-src-all@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 A7088C17ACB; Tue, 18 Oct 2016 15:41:59 +0000 (UTC) (envelope-from luigi@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 7B2C0F01; Tue, 18 Oct 2016 15:41:59 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IFfwmf052889; Tue, 18 Oct 2016 15:41:58 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IFfwtK052883; Tue, 18 Oct 2016 15:41:58 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610181541.u9IFfwtK052883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Tue, 18 Oct 2016 15:41:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307572 - in head/sys: dev/netmap net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 15:41:59 -0000 Author: luigi Date: Tue Oct 18 15:41:57 2016 New Revision: 307572 URL: https://svnweb.freebsd.org/changeset/base/307572 Log: remove trailing whitespace. No code changes. Modified: head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_vale.c head/sys/net/netmap_user.h Modified: head/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- head/sys/dev/netmap/if_vtnet_netmap.h Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/if_vtnet_netmap.h Tue Oct 18 15:41:57 2016 (r307572) @@ -127,7 +127,7 @@ vtnet_netmap_txsync(struct netmap_kring * First part: process new packets to send. */ rmb(); - + nm_i = kring->nr_hwcur; if (nm_i != head) { /* we have new packets to send */ struct sglist *sg = txq->vtntx_sg; @@ -182,7 +182,7 @@ vtnet_netmap_txsync(struct netmap_kring virtqueue_enable_intr(vq); // like postpone with 0 } - + /* Free used slots. We only consider our own used buffers, recognized * by the token we passed to virtqueue_add_outbuf. */ Modified: head/sys/dev/netmap/netmap_monitor.c ============================================================================== --- head/sys/dev/netmap/netmap_monitor.c Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/netmap_monitor.c Tue Oct 18 15:41:57 2016 (r307572) @@ -191,7 +191,7 @@ nm_monitor_alloc(struct netmap_kring *kr if (n <= kring->max_monitors) /* we already have more entries that requested */ return 0; - + len = sizeof(struct netmap_kring *) * n; #ifndef _WIN32 nm = realloc(kring->monitors, len, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -301,7 +301,7 @@ netmap_monitor_del(struct netmap_kring * kring->nm_sync = kring->mon_sync; kring->mon_sync = NULL; if (kring->tx == NR_RX) { - ND("%s: restoring notify on %s: %p", + ND("%s: restoring notify on %s: %p", mkring->name, kring->name, kring->mon_notify); kring->nm_notify = kring->mon_notify; kring->mon_notify = NULL; @@ -406,7 +406,7 @@ netmap_monitor_reg_common(struct netmap_ /* **************************************************************** - * functions specific for zero-copy monitors + * functions specific for zero-copy monitors **************************************************************** */ @@ -554,7 +554,7 @@ netmap_zmon_dtor(struct netmap_adapter * /* **************************************************************** - * functions specific for copy monitors + * functions specific for copy monitors **************************************************************** */ @@ -729,7 +729,7 @@ netmap_get_monitor_na(struct nmreq *nmr, if ((nmr->nr_flags & (NR_MONITOR_TX | NR_MONITOR_RX)) == 0) { if (nmr->nr_flags & NR_ZCOPY_MON) { - /* the flag makes no sense unless you are + /* the flag makes no sense unless you are * creating a monitor */ return EINVAL; Modified: head/sys/dev/netmap/netmap_pipe.c ============================================================================== --- head/sys/dev/netmap/netmap_pipe.c Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/netmap_pipe.c Tue Oct 18 15:41:57 2016 (r307572) @@ -92,7 +92,7 @@ nm_pipe_alloc(struct netmap_adapter *na, if (npipes <= na->na_max_pipes) /* we already have more entries that requested */ return 0; - + if (npipes < na->na_next_pipe || npipes > NM_MAXPIPES) return EINVAL; @@ -402,7 +402,7 @@ netmap_pipe_reg(struct netmap_adapter *n } } } - + /* create all missing needed rings on the other end */ error = netmap_mem_rings_create(ona); if (error) Modified: head/sys/dev/netmap/netmap_vale.c ============================================================================== --- head/sys/dev/netmap/netmap_vale.c Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/dev/netmap/netmap_vale.c Tue Oct 18 15:41:57 2016 (r307572) @@ -906,7 +906,7 @@ nm_bdg_create_kthreads(struct nm_bdg_pol int affinity = bps->cpu_from + i; t->bps = bps; - t->qfirst = all ? bps->qfirst /* must be 0 */: affinity; + t->qfirst = all ? bps->qfirst /* must be 0 */: affinity; t->qlast = all ? bps->qlast : t->qfirst + 1; D("kthread %d a:%u qf:%u ql:%u", i, affinity, t->qfirst, t->qlast); @@ -2540,7 +2540,7 @@ netmap_bwrap_notify(struct netmap_kring struct netmap_kring *hw_kring; int error; - ND("%s: na %s hwna %s", + ND("%s: na %s hwna %s", (kring ? kring->name : "NULL!"), (na ? na->name : "NULL!"), (hwna ? hwna->name : "NULL!")); Modified: head/sys/net/netmap_user.h ============================================================================== --- head/sys/net/netmap_user.h Tue Oct 18 15:24:56 2016 (r307571) +++ head/sys/net/netmap_user.h Tue Oct 18 15:41:57 2016 (r307572) @@ -391,8 +391,8 @@ struct win_netmap_fd_list { HANDLE win_netmap_handle; }; -/* - * list head containing all the netmap opened fd and their +/* + * list head containing all the netmap opened fd and their * windows HANDLE counterparts */ static struct win_netmap_fd_list *win_netmap_fd_list_head; @@ -453,7 +453,7 @@ win_get_netmap_handle(int fd) /* * use this function only from netmap_user.h internal functions - * same as ioctl, returns 0 on success and -1 on error + * same as ioctl, returns 0 on success and -1 on error */ static int win_nm_ioctl_internal(HANDLE h, int32_t ctlCode, void *arg) @@ -499,9 +499,9 @@ win_nm_ioctl_internal(HANDLE h, int32_t return ioctlReturnStatus ? 0 : -1; } -/* +/* * this function is what must be called from user-space programs - * same as ioctl, returns 0 on success and -1 on error + * same as ioctl, returns 0 on success and -1 on error */ static int win_nm_ioctl(int fd, int32_t ctlCode, void *arg) @@ -541,7 +541,7 @@ win32_mmap_emulated(void *addr, size_t l #include /* XXX needed to use the structure pollfd */ -static int +static int win_nm_poll(struct pollfd *fds, int nfds, int timeout) { HANDLE h; @@ -564,7 +564,7 @@ win_nm_poll(struct pollfd *fds, int nfds #define poll win_nm_poll -static int +static int win_nm_open(char* pathname, int flags) { @@ -583,7 +583,7 @@ win_nm_open(char* pathname, int flags) #define open win_nm_open -static int +static int win_nm_close(int fd) { if (fd != -1) { @@ -919,7 +919,7 @@ nm_close(struct nm_desc *d) if (d->fd != -1) { close(d->fd); } - + bzero(d, sizeof(*d)); free(d); return 0; From owner-svn-src-all@freebsd.org Tue Oct 18 15:50:21 2016 Return-Path: Delivered-To: svn-src-all@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 63875C17E1E; Tue, 18 Oct 2016 15:50:21 +0000 (UTC) (envelope-from luigi@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 3DFC7673; Tue, 18 Oct 2016 15:50:21 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IFoK3B053268; Tue, 18 Oct 2016 15:50:20 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IFoKAW053267; Tue, 18 Oct 2016 15:50:20 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610181550.u9IFoKAW053267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Tue, 18 Oct 2016 15:50:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307573 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 15:50:21 -0000 Author: luigi Date: Tue Oct 18 15:50:20 2016 New Revision: 307573 URL: https://svnweb.freebsd.org/changeset/base/307573 Log: remove conditional code for an obsolete feature. if_ptnet now does better. Modified: head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Tue Oct 18 15:41:57 2016 (r307572) +++ head/sys/dev/e1000/if_lem.c Tue Oct 18 15:50:20 2016 (r307573) @@ -39,7 +39,6 @@ */ // #define BATCH_DISPATCH // #define NIC_SEND_COMBINING -// #define NIC_PARAVIRT /* enable virtio-like synchronization */ #include "opt_inet.h" #include "opt_inet6.h" @@ -486,10 +485,6 @@ lem_attach(device_t dev) lem_add_rx_process_limit(adapter, "batch_enable", "driver rx batch", &adapter->batch_enable, 0); #endif /* BATCH_DISPATCH */ -#ifdef NIC_PARAVIRT - lem_add_rx_process_limit(adapter, "rx_retries", - "driver rx retries", &adapter->rx_retries, 0); -#endif /* NIC_PARAVIRT */ /* Sysctl for setting the interface flow control */ lem_set_flow_cntrl(adapter, "flow_control", @@ -548,49 +543,6 @@ lem_attach(device_t dev) */ adapter->hw.mac.report_tx_early = 1; -#ifdef NIC_PARAVIRT - device_printf(dev, "driver supports paravirt, subdev 0x%x\n", - adapter->hw.subsystem_device_id); - if (adapter->hw.subsystem_device_id == E1000_PARA_SUBDEV) { - uint64_t bus_addr; - - device_printf(dev, "paravirt support on dev %p\n", adapter); - tsize = 4096; // XXX one page for the csb - if (lem_dma_malloc(adapter, tsize, &adapter->csb_mem, BUS_DMA_NOWAIT)) { - device_printf(dev, "Unable to allocate csb memory\n"); - error = ENOMEM; - goto err_csb; - } - /* Setup the Base of the CSB */ - adapter->csb = (struct paravirt_csb *)adapter->csb_mem.dma_vaddr; - /* force the first kick */ - adapter->csb->host_need_txkick = 1; /* txring empty */ - adapter->csb->guest_need_rxkick = 1; /* no rx packets */ - bus_addr = adapter->csb_mem.dma_paddr; - lem_add_rx_process_limit(adapter, "csb_on", - "enable paravirt.", &adapter->csb->guest_csb_on, 0); - lem_add_rx_process_limit(adapter, "txc_lim", - "txc_lim", &adapter->csb->host_txcycles_lim, 1); - - /* some stats */ -#define PA_SC(name, var, val) \ - lem_add_rx_process_limit(adapter, name, name, var, val) - PA_SC("host_need_txkick",&adapter->csb->host_need_txkick, 1); - PA_SC("host_rxkick_at",&adapter->csb->host_rxkick_at, ~0); - PA_SC("guest_need_txkick",&adapter->csb->guest_need_txkick, 0); - PA_SC("guest_need_rxkick",&adapter->csb->guest_need_rxkick, 1); - PA_SC("tdt_reg_count",&adapter->tdt_reg_count, 0); - PA_SC("tdt_csb_count",&adapter->tdt_csb_count, 0); - PA_SC("tdt_int_count",&adapter->tdt_int_count, 0); - PA_SC("guest_need_kick_count",&adapter->guest_need_kick_count, 0); - /* tell the host where the block is */ - E1000_WRITE_REG(&adapter->hw, E1000_CSBAH, - (u32)(bus_addr >> 32)); - E1000_WRITE_REG(&adapter->hw, E1000_CSBAL, - (u32)bus_addr); - } -#endif /* NIC_PARAVIRT */ - tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); @@ -749,11 +701,6 @@ err_hw_init: err_rx_desc: lem_dma_free(adapter, &adapter->txdma); err_tx_desc: -#ifdef NIC_PARAVIRT - lem_dma_free(adapter, &adapter->csb_mem); -err_csb: -#endif /* NIC_PARAVIRT */ - err_pci: if (adapter->ifp != (void *)NULL) if_free(adapter->ifp); @@ -841,12 +788,6 @@ lem_detach(device_t dev) adapter->rx_desc_base = NULL; } -#ifdef NIC_PARAVIRT - if (adapter->csb) { - lem_dma_free(adapter, &adapter->csb_mem); - adapter->csb = NULL; - } -#endif /* NIC_PARAVIRT */ lem_release_hw_control(adapter); free(adapter->mta, M_DEVBUF); EM_TX_LOCK_DESTROY(adapter); @@ -956,16 +897,6 @@ lem_start_locked(if_t ifp) } if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD) if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); -#ifdef NIC_PARAVIRT - if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE && adapter->csb && - adapter->csb->guest_csb_on && - !(adapter->csb->guest_need_txkick & 1)) { - adapter->csb->guest_need_txkick = 1; - adapter->guest_need_kick_count++; - // XXX memory barrier - lem_txeof(adapter); // XXX possibly clear IFF_DRV_OACTIVE - } -#endif /* NIC_PARAVIRT */ return; } @@ -1813,24 +1744,6 @@ lem_xmit(struct adapter *adapter, struct bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifdef NIC_PARAVIRT - if (adapter->csb) { - adapter->csb->guest_tdt = i; - /* XXX memory barrier ? */ - if (adapter->csb->guest_csb_on && - !(adapter->csb->host_need_txkick & 1)) { - /* XXX maybe useless - * clean the ring. maybe do it before ? - * maybe a little bit of histeresys ? - */ - if (adapter->num_tx_desc_avail <= 64) {// XXX - lem_txeof(adapter); - } - return (0); - } - } -#endif /* NIC_PARAVIRT */ - #ifdef NIC_SEND_COMBINING if (adapter->sc_enable) { if (adapter->shadow_tdt & MIT_PENDING_INT) { @@ -2086,20 +1999,6 @@ lem_local_timer(void *arg) lem_smartspeed(adapter); -#ifdef NIC_PARAVIRT - /* recover space if needed */ - if (adapter->csb && adapter->csb->guest_csb_on && - (adapter->watchdog_check == TRUE) && - (ticks - adapter->watchdog_time > EM_WATCHDOG) && - (adapter->num_tx_desc_avail != adapter->num_tx_desc) ) { - lem_txeof(adapter); - /* - * lem_txeof() normally (except when space in the queue - * runs low XXX) cleans watchdog_check so that - * we do not hung. - */ - } -#endif /* NIC_PARAVIRT */ /* * We check the watchdog: the time since * the last TX descriptor was cleaned. @@ -3176,12 +3075,6 @@ lem_txeof(struct adapter *adapter) */ if (adapter->num_tx_desc_avail > EM_TX_CLEANUP_THRESHOLD) { if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); -#ifdef NIC_PARAVIRT - if (adapter->csb) { // XXX also csb_on ? - adapter->csb->guest_need_txkick = 2; /* acked */ - // XXX memory barrier - } -#endif /* NIC_PARAVIRT */ if (adapter->num_tx_desc_avail == adapter->num_tx_desc) { adapter->watchdog_check = FALSE; return; @@ -3570,15 +3463,6 @@ lem_rxeof(struct adapter *adapter, int c #ifdef BATCH_DISPATCH struct mbuf *mh = NULL, *mt = NULL; #endif /* BATCH_DISPATCH */ -#ifdef NIC_PARAVIRT - int retries = 0; - struct paravirt_csb* csb = adapter->csb; - int csb_mode = csb && csb->guest_csb_on; - - //ND("clear guest_rxkick at %d", adapter->next_rx_desc_to_check); - if (csb_mode && csb->guest_need_rxkick) - csb->guest_need_rxkick = 0; -#endif /* NIC_PARAVIRT */ EM_RX_LOCK(adapter); #ifdef BATCH_DISPATCH @@ -3596,45 +3480,20 @@ lem_rxeof(struct adapter *adapter, int c } #endif /* DEV_NETMAP */ -#if 1 // XXX optimization ? if (!((current_desc->status) & E1000_RXD_STAT_DD)) { if (done != NULL) *done = rx_sent; EM_RX_UNLOCK(adapter); return (FALSE); } -#endif /* 0 */ while (count != 0 && if_getdrvflags(ifp) & IFF_DRV_RUNNING) { struct mbuf *m = NULL; status = current_desc->status; if ((status & E1000_RXD_STAT_DD) == 0) { -#ifdef NIC_PARAVIRT - if (csb_mode) { - /* buffer not ready yet. Retry a few times before giving up */ - if (++retries <= adapter->rx_retries) { - continue; - } - if (csb->guest_need_rxkick == 0) { - // ND("set guest_rxkick at %d", adapter->next_rx_desc_to_check); - csb->guest_need_rxkick = 1; - // XXX memory barrier, status volatile ? - continue; /* double check */ - } - } - /* no buffer ready, give up */ -#endif /* NIC_PARAVIRT */ break; } -#ifdef NIC_PARAVIRT - if (csb_mode) { - if (csb->guest_need_rxkick) - // ND("clear again guest_rxkick at %d", adapter->next_rx_desc_to_check); - csb->guest_need_rxkick = 0; - retries = 0; - } -#endif /* NIC_PARAVIRT */ mp = adapter->rx_buffer_area[i].m_head; /* @@ -3759,18 +3618,6 @@ discard: bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifdef NIC_PARAVIRT - if (csb_mode) { - /* the buffer at i has been already replaced by lem_get_buf() - * so it is safe to set guest_rdt = i and possibly send a kick. - * XXX see if we can optimize it later. - */ - csb->guest_rdt = i; - // XXX memory barrier - if (i == csb->host_rxkick_at) - E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), i); - } -#endif /* NIC_PARAVIRT */ /* Advance our pointers to the next descriptor. */ if (++i == adapter->num_rx_desc) i = 0; @@ -3817,9 +3664,6 @@ discard: /* Advance the E1000's Receive Queue #0 "Tail Pointer". */ if (--i < 0) i = adapter->num_rx_desc - 1; -#ifdef NIC_PARAVIRT - if (!csb_mode) /* filter out writes */ -#endif /* NIC_PARAVIRT */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), i); if (done != NULL) *done = rx_sent; From owner-svn-src-all@freebsd.org Tue Oct 18 16:18:27 2016 Return-Path: Delivered-To: svn-src-all@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 4DD6DC16871; Tue, 18 Oct 2016 16:18:27 +0000 (UTC) (envelope-from luigi@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 0C057CC7; Tue, 18 Oct 2016 16:18:26 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IGIQsi064549; Tue, 18 Oct 2016 16:18:26 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IGIPbG064539; Tue, 18 Oct 2016 16:18:25 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201610181618.u9IGIPbG064539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Tue, 18 Oct 2016 16:18:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307574 - in head/sys: dev/netmap net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 16:18:27 -0000 Author: luigi Date: Tue Oct 18 16:18:25 2016 New Revision: 307574 URL: https://svnweb.freebsd.org/changeset/base/307574 Log: remove stale and unused code from various files fix build on 32 bit platforms simplify logic in netmap_virt.h The commands (in net/netmap.h) to configure communication with the hypervisor may be revised soon. At the moment they are unused so this will not be a change of API. Modified: head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_ptnet.c head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_pt.c head/sys/net/netmap.h head/sys/net/netmap_virt.h Modified: head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- head/sys/dev/netmap/if_lem_netmap.h Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/if_lem_netmap.h Tue Oct 18 16:18:25 2016 (r307574) @@ -35,12 +35,8 @@ #include #include -#include -#include /* vtophys ? */ #include -extern int netmap_adaptive_io; - /* * Register/unregister. We are already under netmap lock. */ Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/if_ptnet.c Tue Oct 18 16:18:25 2016 (r307574) @@ -341,7 +341,11 @@ ptnet_attach(device_t dev) } { - vm_paddr_t paddr = vtophys(sc->csb); + /* + * We use uint64_t rather than vm_paddr_t since we + * need 64 bit addresses even on 32 bit platforms. + */ + uint64_t paddr = vtophys(sc->csb); bus_write_4(sc->iomem, PTNET_IO_CSBBAH, (paddr >> 32) & 0xffffffff); @@ -1139,9 +1143,11 @@ ptnet_sync_from_csb(struct ptnet_softc * static void ptnet_update_vnet_hdr(struct ptnet_softc *sc) { - sc->vnet_hdr_len = ptnet_vnet_hdr ? PTNET_HDR_SIZE : 0; + unsigned int wanted_hdr_len = ptnet_vnet_hdr ? PTNET_HDR_SIZE : 0; + + bus_write_4(sc->iomem, PTNET_IO_VNET_HDR_LEN, wanted_hdr_len); + sc->vnet_hdr_len = bus_read_4(sc->iomem, PTNET_IO_VNET_HDR_LEN); sc->ptna->hwup.up.virt_hdr_len = sc->vnet_hdr_len; - bus_write_4(sc->iomem, PTNET_IO_VNET_HDR_LEN, sc->vnet_hdr_len); } static int Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/netmap.c Tue Oct 18 16:18:25 2016 (r307574) @@ -483,7 +483,6 @@ static int netmap_no_timestamp; /* don't int netmap_mitigate = 1; int netmap_no_pendintr = 1; int netmap_txsync_retry = 2; -int netmap_adaptive_io = 0; int netmap_flags = 0; /* debug flags */ static int netmap_fwd = 0; /* force transparent mode */ @@ -540,8 +539,6 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, no_pen CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received packets."); SYSCTL_INT(_dev_netmap, OID_AUTO, txsync_retry, CTLFLAG_RW, &netmap_txsync_retry, 0 , "Number of txsync loops in bridge's flush."); -SYSCTL_INT(_dev_netmap, OID_AUTO, adaptive_io, CTLFLAG_RW, - &netmap_adaptive_io, 0 , "Adaptive I/O on paravirt"); SYSCTL_INT(_dev_netmap, OID_AUTO, flags, CTLFLAG_RW, &netmap_flags, 0 , ""); SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &netmap_fwd, 0 , ""); @@ -1559,7 +1556,7 @@ nm_txsync_prologue(struct netmap_kring * } } if (ring->tail != kring->rtail) { - RD(5, "tail overwritten was %d need %d", + RD(5, "%s tail overwritten was %d need %d", kring->name, ring->tail, kring->rtail); ring->tail = kring->rtail; } Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/netmap_freebsd.c Tue Oct 18 16:18:25 2016 (r307574) @@ -353,7 +353,7 @@ nm_os_generic_xmit_frame(struct nm_os_ge bcopy(a->addr, m->m_data, len); #else /* __FreeBSD_version >= 1100000 */ /* New FreeBSD versions. Link the external storage to - * the netmap buffer, so that no copy is necessary. */ + * the netmap buffer, so that no copy is necessary. */ m->m_ext.ext_buf = m->m_data = a->addr; m->m_ext.ext_size = len; #endif /* __FreeBSD_version >= 1100000 */ @@ -644,7 +644,8 @@ DRIVER_MODULE_ORDERED(ptn_memdev, pci, p * of the netmap memory mapped in the guest. */ int -nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr, void **nm_addr) +nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr, + void **nm_addr) { uint32_t mem_size; int rid; @@ -668,8 +669,8 @@ nm_os_pt_memdev_iomap(struct ptnetmap_me D("=== BAR %d start %lx len %lx mem_size %x ===", PTNETMAP_MEM_PCI_BAR, - *nm_paddr, - rman_get_size(ptn_dev->pci_mem), + (unsigned long)(*nm_paddr), + (unsigned long)rman_get_size(ptn_dev->pci_mem), mem_size); return (0); } Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/netmap_generic.c Tue Oct 18 16:18:25 2016 (r307574) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); /* * For older versions of FreeBSD: - * + * * We allocate EXT_PACKET mbuf+clusters, but need to set M_NOFREE * so that the destructor, if invoked, will not free the packet. * In principle we should set the destructor only on demand, @@ -628,8 +628,6 @@ generic_mbuf_destructor(struct mbuf *m) #endif } -extern int netmap_adaptive_io; - /* Record completed transmissions and update hwtail. * * The oldest tx buffer not yet completed is at nr_hwtail + 1, @@ -690,23 +688,6 @@ generic_netmap_tx_clean(struct netmap_kr n++; nm_i = nm_next(nm_i, lim); -#if 0 /* rate adaptation */ - if (netmap_adaptive_io > 1) { - if (n >= netmap_adaptive_io) - break; - } else if (netmap_adaptive_io) { - /* if hwcur - nm_i < lim/8 do an early break - * so we prevent the sender from stalling. See CVT. - */ - if (hwcur >= nm_i) { - if (hwcur - nm_i < lim/2) - break; - } else { - if (hwcur + lim + 1 - nm_i < lim/2) - break; - } - } -#endif } kring->nr_hwtail = nm_prev(nm_i, lim); ND("tx completed [%d] -> hwtail %d", n, kring->nr_hwtail); Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/netmap_kern.h Tue Oct 18 16:18:25 2016 (r307574) @@ -1512,9 +1512,9 @@ int netmap_adapter_put(struct netmap_ada */ #define NETMAP_BUF_BASE(_na) ((_na)->na_lut.lut[0].vaddr) #define NETMAP_BUF_SIZE(_na) ((_na)->na_lut.objsize) -extern int netmap_mitigate; // XXX not really used extern int netmap_no_pendintr; -extern int netmap_verbose; // XXX debugging +extern int netmap_mitigate; +extern int netmap_verbose; /* for debugging */ enum { /* verbose flags */ NM_VERB_ON = 1, /* generic verbose */ NM_VERB_HOST = 0x2, /* verbose host stack */ @@ -1527,7 +1527,6 @@ enum { }; extern int netmap_txsync_retry; -extern int netmap_adaptive_io; extern int netmap_flags; extern int netmap_generic_mit; extern int netmap_generic_ringsize; Modified: head/sys/dev/netmap/netmap_pt.c ============================================================================== --- head/sys/dev/netmap/netmap_pt.c Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/dev/netmap/netmap_pt.c Tue Oct 18 16:18:25 2016 (r307574) @@ -64,13 +64,10 @@ * results in random drops in the VALE txsync. */ //#define PTN_TX_BATCH_LIM(_n) ((_n >> 1)) -/* XXX: avoid nm_*sync_prologue(). XXX-vin: this should go away, - * we should never trust the guest. */ -#define PTN_AVOID_NM_PROLOGUE //#define BUSY_WAIT -#define DEBUG /* Enables communication debugging. */ -#ifdef DEBUG +#define NETMAP_PT_DEBUG /* Enables communication debugging. */ +#ifdef NETMAP_PT_DEBUG #define DBG(x) x #else #define DBG(x) @@ -196,22 +193,6 @@ ptnetmap_kring_dump(const char *title, c kring->ring->head, kring->ring->cur, kring->ring->tail); } -#if 0 -static inline void -ptnetmap_ring_reinit(struct netmap_kring *kring, uint32_t g_head, uint32_t g_cur) -{ - struct netmap_ring *ring = kring->ring; - - //XXX: trust guest? - ring->head = g_head; - ring->cur = g_cur; - ring->tail = NM_ACCESS_ONCE(kring->nr_hwtail); - - netmap_ring_reinit(kring); - ptnetmap_kring_dump("kring reinit", kring); -} -#endif - /* * TX functions to set/get and to handle host/guest kick. */ @@ -251,7 +232,7 @@ ptnetmap_tx_handler(void *data) (struct netmap_pt_host_adapter *)kring->na->na_private; struct ptnetmap_state *ptns = pth_na->ptns; struct ptnet_ring __user *ptring; - struct netmap_ring g_ring; /* guest ring pointer, copied from CSB */ + struct netmap_ring shadow_ring; /* shadow copy of the netmap_ring */ bool more_txspace = false; struct nm_kthread *kth; uint32_t num_slots; @@ -281,18 +262,18 @@ ptnetmap_tx_handler(void *data) kth = ptns->kthreads[kring->ring_id]; num_slots = kring->nkr_num_slots; - g_ring.head = kring->rhead; - g_ring.cur = kring->rcur; + shadow_ring.head = kring->rhead; + shadow_ring.cur = kring->rcur; /* Disable guest --> host notifications. */ ptring_kick_enable(ptring, 0); /* Copy the guest kring pointers from the CSB */ - ptnetmap_host_read_kring_csb(ptring, &g_ring, num_slots); + ptnetmap_host_read_kring_csb(ptring, &shadow_ring, num_slots); for (;;) { /* If guest moves ahead too fast, let's cut the move so * that we don't exceed our batch limit. */ - batch = g_ring.head - kring->nr_hwcur; + batch = shadow_ring.head - kring->nr_hwcur; if (batch < 0) batch += num_slots; @@ -302,37 +283,35 @@ ptnetmap_tx_handler(void *data) if (head_lim >= num_slots) head_lim -= num_slots; - ND(1, "batch: %d head: %d head_lim: %d", batch, g_ring.head, + ND(1, "batch: %d head: %d head_lim: %d", batch, shadow_ring.head, head_lim); - g_ring.head = head_lim; + shadow_ring.head = head_lim; batch = PTN_TX_BATCH_LIM(num_slots); } #endif /* PTN_TX_BATCH_LIM */ if (nm_kr_txspace(kring) <= (num_slots >> 1)) { - g_ring.flags |= NAF_FORCE_RECLAIM; + shadow_ring.flags |= NAF_FORCE_RECLAIM; } -#ifndef PTN_AVOID_NM_PROLOGUE + /* Netmap prologue */ - if (unlikely(nm_txsync_prologue(kring, &g_ring) >= num_slots)) { - ptnetmap_ring_reinit(kring, g_ring.head, g_ring.cur); - /* Reenable notifications. */ + shadow_ring.tail = kring->rtail; + if (unlikely(nm_txsync_prologue(kring, &shadow_ring) >= num_slots)) { + /* Reinit ring and enable notifications. */ + netmap_ring_reinit(kring); ptring_kick_enable(ptring, 1); break; } -#else /* PTN_AVOID_NM_PROLOGUE */ - kring->rhead = g_ring.head; - kring->rcur = g_ring.cur; -#endif /* !PTN_AVOID_NM_PROLOGUE */ + if (unlikely(netmap_verbose & NM_VERB_TXSYNC)) { ptnetmap_kring_dump("pre txsync", kring); } IFRATE(pre_tail = kring->rtail); - if (unlikely(kring->nm_sync(kring, g_ring.flags))) { + if (unlikely(kring->nm_sync(kring, shadow_ring.flags))) { /* Reenable notifications. */ ptring_kick_enable(ptring, 1); - D("ERROR txsync"); + D("ERROR txsync()"); break; } @@ -350,7 +329,7 @@ ptnetmap_tx_handler(void *data) } IFRATE(rate_batch_stats_update(&ptns->rate_ctx.new.txbs, pre_tail, - kring->rtail, num_slots)); + kring->rtail, num_slots)); if (unlikely(netmap_verbose & NM_VERB_TXSYNC)) { ptnetmap_kring_dump("post txsync", kring); @@ -367,9 +346,9 @@ ptnetmap_tx_handler(void *data) } #endif /* Read CSB to see if there is more work to do. */ - ptnetmap_host_read_kring_csb(ptring, &g_ring, num_slots); + ptnetmap_host_read_kring_csb(ptring, &shadow_ring, num_slots); #ifndef BUSY_WAIT - if (g_ring.head == kring->rhead) { + if (shadow_ring.head == kring->rhead) { /* * No more packets to transmit. We enable notifications and * go to sleep, waiting for a kick from the guest when new @@ -379,8 +358,8 @@ ptnetmap_tx_handler(void *data) /* Reenable notifications. */ ptring_kick_enable(ptring, 1); /* Doublecheck. */ - ptnetmap_host_read_kring_csb(ptring, &g_ring, num_slots); - if (g_ring.head != kring->rhead) { + ptnetmap_host_read_kring_csb(ptring, &shadow_ring, num_slots); + if (shadow_ring.head != kring->rhead) { /* We won the race condition, there are more packets to * transmit. Disable notifications and do another cycle */ ptring_kick_enable(ptring, 0); @@ -433,7 +412,7 @@ ptnetmap_rx_handler(void *data) (struct netmap_pt_host_adapter *)kring->na->na_private; struct ptnetmap_state *ptns = pth_na->ptns; struct ptnet_ring __user *ptring; - struct netmap_ring g_ring; /* guest ring pointer, copied from CSB */ + struct netmap_ring shadow_ring; /* shadow copy of the netmap_ring */ struct nm_kthread *kth; uint32_t num_slots; int dry_cycles = 0; @@ -464,36 +443,32 @@ ptnetmap_rx_handler(void *data) kth = ptns->kthreads[pth_na->up.num_tx_rings + kring->ring_id]; num_slots = kring->nkr_num_slots; - g_ring.head = kring->rhead; - g_ring.cur = kring->rcur; + shadow_ring.head = kring->rhead; + shadow_ring.cur = kring->rcur; /* Disable notifications. */ ptring_kick_enable(ptring, 0); /* Copy the guest kring pointers from the CSB */ - ptnetmap_host_read_kring_csb(ptring, &g_ring, num_slots); + ptnetmap_host_read_kring_csb(ptring, &shadow_ring, num_slots); for (;;) { uint32_t hwtail; -#ifndef PTN_AVOID_NM_PROLOGUE /* Netmap prologue */ - if (unlikely(nm_rxsync_prologue(kring, &g_ring) >= num_slots)) { - ptnetmap_ring_reinit(kring, g_ring.head, g_ring.cur); - /* Reenable notifications. */ + shadow_ring.tail = kring->rtail; + if (unlikely(nm_rxsync_prologue(kring, &shadow_ring) >= num_slots)) { + /* Reinit ring and enable notifications. */ + netmap_ring_reinit(kring); ptring_kick_enable(ptring, 1); break; } -#else /* PTN_AVOID_NM_PROLOGUE */ - kring->rhead = g_ring.head; - kring->rcur = g_ring.cur; -#endif /* !PTN_AVOID_NM_PROLOGUE */ - if (unlikely(netmap_verbose & NM_VERB_RXSYNC)) + if (unlikely(netmap_verbose & NM_VERB_RXSYNC)) { ptnetmap_kring_dump("pre rxsync", kring); + } IFRATE(pre_tail = kring->rtail); - - if (unlikely(kring->nm_sync(kring, g_ring.flags))) { + if (unlikely(kring->nm_sync(kring, shadow_ring.flags))) { /* Reenable notifications. */ ptring_kick_enable(ptring, 1); D("ERROR rxsync()"); @@ -516,8 +491,9 @@ ptnetmap_rx_handler(void *data) IFRATE(rate_batch_stats_update(&ptns->rate_ctx.new.rxbs, pre_tail, kring->rtail, num_slots)); - if (unlikely(netmap_verbose & NM_VERB_RXSYNC)) + if (unlikely(netmap_verbose & NM_VERB_RXSYNC)) { ptnetmap_kring_dump("post rxsync", kring); + } #ifndef BUSY_WAIT /* Interrupt the guest if needed. */ @@ -530,9 +506,9 @@ ptnetmap_rx_handler(void *data) } #endif /* Read CSB to see if there is more work to do. */ - ptnetmap_host_read_kring_csb(ptring, &g_ring, num_slots); + ptnetmap_host_read_kring_csb(ptring, &shadow_ring, num_slots); #ifndef BUSY_WAIT - if (ptnetmap_norxslots(kring, g_ring.head)) { + if (ptnetmap_norxslots(kring, shadow_ring.head)) { /* * No more slots available for reception. We enable notification and * go to sleep, waiting for a kick from the guest when new receive @@ -542,8 +518,8 @@ ptnetmap_rx_handler(void *data) /* Reenable notifications. */ ptring_kick_enable(ptring, 1); /* Doublecheck. */ - ptnetmap_host_read_kring_csb(ptring, &g_ring, num_slots); - if (!ptnetmap_norxslots(kring, g_ring.head)) { + ptnetmap_host_read_kring_csb(ptring, &shadow_ring, num_slots); + if (!ptnetmap_norxslots(kring, shadow_ring.head)) { /* We won the race condition, more slots are available. Disable * notifications and do another cycle. */ ptring_kick_enable(ptring, 0); @@ -578,7 +554,7 @@ ptnetmap_rx_handler(void *data) } } -#ifdef DEBUG +#ifdef NETMAP_PT_DEBUG static void ptnetmap_print_configuration(struct ptnetmap_cfg *cfg) { @@ -594,7 +570,7 @@ ptnetmap_print_configuration(struct ptne } } -#endif +#endif /* NETMAP_PT_DEBUG */ /* Copy actual state of the host ring into the CSB for the guest init */ static int Modified: head/sys/net/netmap.h ============================================================================== --- head/sys/net/netmap.h Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/net/netmap.h Tue Oct 18 16:18:25 2016 (r307574) @@ -655,8 +655,8 @@ struct ptn_vmm_ioctl_msix { /* IOCTL parameters */ struct nm_kth_ioctl { - u_long com; - /* TODO: use union */ + uint64_t com; + /* We use union to support more ioctl commands. */ union { struct ptn_vmm_ioctl_msix msix; } data; @@ -667,5 +667,6 @@ struct ptnet_ring_cfg { uint64_t ioeventfd; /* eventfd in linux, tsleep() parameter in FreeBSD */ uint64_t irqfd; /* eventfd in linux, ioctl fd in FreeBSD */ struct nm_kth_ioctl ioctl; /* ioctl parameter to send irq (only used in bhyve/FreeBSD) */ + uint64_t reserved[4]; /* reserved to support of more hypervisors */ }; #endif /* _NET_NETMAP_H_ */ Modified: head/sys/net/netmap_virt.h ============================================================================== --- head/sys/net/netmap_virt.h Tue Oct 18 15:50:20 2016 (r307573) +++ head/sys/net/netmap_virt.h Tue Oct 18 16:18:25 2016 (r307574) @@ -58,13 +58,11 @@ /* Registers for the ptnetmap memdev */ /* 32 bit r/o */ -#define PTNETMAP_IO_PCI_FEATURES 0 /* XXX should be removed */ -/* 32 bit r/o */ -#define PTNETMAP_IO_PCI_MEMSIZE 4 /* size of the netmap memory shared +#define PTNETMAP_IO_PCI_MEMSIZE 0 /* size of the netmap memory shared * between guest and host */ /* 16 bit r/o */ -#define PTNETMAP_IO_PCI_HOSTID 8 /* memory allocator ID in netmap host */ -#define PTNETMAP_IO_SIZE 10 +#define PTNETMAP_IO_PCI_HOSTID 4 /* memory allocator ID in netmap host */ +#define PTNETMAP_IO_SIZE 6 /* * ptnetmap configuration @@ -115,18 +113,17 @@ ptnetmap_write_cfg(struct nmreq *nmr, st #define PTNET_IO_PTFEAT 0 #define PTNET_IO_PTCTL 4 #define PTNET_IO_PTSTS 8 -/* hole */ -#define PTNET_IO_MAC_LO 16 -#define PTNET_IO_MAC_HI 20 -#define PTNET_IO_CSBBAH 24 -#define PTNET_IO_CSBBAL 28 -#define PTNET_IO_NIFP_OFS 32 -#define PTNET_IO_NUM_TX_RINGS 36 -#define PTNET_IO_NUM_RX_RINGS 40 -#define PTNET_IO_NUM_TX_SLOTS 44 -#define PTNET_IO_NUM_RX_SLOTS 48 -#define PTNET_IO_VNET_HDR_LEN 52 -#define PTNET_IO_END 56 +#define PTNET_IO_MAC_LO 12 +#define PTNET_IO_MAC_HI 16 +#define PTNET_IO_CSBBAH 20 +#define PTNET_IO_CSBBAL 24 +#define PTNET_IO_NIFP_OFS 28 +#define PTNET_IO_NUM_TX_RINGS 32 +#define PTNET_IO_NUM_RX_RINGS 36 +#define PTNET_IO_NUM_TX_SLOTS 40 +#define PTNET_IO_NUM_RX_SLOTS 44 +#define PTNET_IO_VNET_HDR_LEN 48 +#define PTNET_IO_END 52 #define PTNET_IO_KICK_BASE 128 #define PTNET_IO_MASK 0xff @@ -139,11 +136,11 @@ struct ptnet_ring { uint32_t head; /* GW+ HR+ the head of the guest netmap_ring */ uint32_t cur; /* GW+ HR+ the cur of the guest netmap_ring */ uint32_t guest_need_kick; /* GW+ HR+ host-->guest notification enable */ - char pad[4]; + uint32_t sync_flags; /* GW+ HR+ the flags of the guest [tx|rx]sync() */ uint32_t hwcur; /* GR+ HW+ the hwcur of the host netmap_kring */ uint32_t hwtail; /* GR+ HW+ the hwtail of the host netmap_kring */ uint32_t host_need_kick; /* GR+ HW+ guest-->host notification enable */ - uint32_t sync_flags; /* GW+ HR+ the flags of the guest [tx|rx]sync() */ + char pad[4]; }; /* CSB for the ptnet device. */ @@ -165,161 +162,119 @@ ptn_sub(uint32_t l_elem, uint32_t r_elem } #endif /* WITH_PTNETMAP_HOST || WITH_PTNETMAP_GUEST */ -#ifdef WITH_PTNETMAP_HOST -/* - * ptnetmap kernel thread routines - * */ - -/* Functions to read and write CSB fields in the host */ -#if defined (linux) -#define CSB_READ(csb, field, r) (get_user(r, &csb->field)) -#define CSB_WRITE(csb, field, v) (put_user(v, &csb->field)) -#else /* ! linux */ -#define CSB_READ(csb, field, r) (r = fuword32(&csb->field)) -#define CSB_WRITE(csb, field, v) (suword32(&csb->field, v)) -#endif /* ! linux */ +#ifdef WITH_PTNETMAP_GUEST -/* - * HOST read/write kring pointers from/in CSB - */ +/* ptnetmap_memdev routines used to talk with ptnetmap_memdev device driver */ +struct ptnetmap_memdev; +int nm_os_pt_memdev_iomap(struct ptnetmap_memdev *, vm_paddr_t *, void **); +void nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *); -/* Host: Read kring pointers (head, cur, sync_flags) from CSB */ +/* Guest driver: Write kring pointers (cur, head) to the CSB. + * This routine is coupled with ptnetmap_host_read_kring_csb(). */ static inline void -ptnetmap_host_read_kring_csb(struct ptnet_ring __user *ptr, - struct netmap_ring *g_ring, - uint32_t num_slots) +ptnetmap_guest_write_kring_csb(struct ptnet_ring *ptr, uint32_t cur, + uint32_t head) { - uint32_t old_head = g_ring->head, old_cur = g_ring->cur; - uint32_t d, inc_h, inc_c; - - //mb(); /* Force memory complete before read CSB */ - /* - * We must first read head and then cur with a barrier in the - * middle, because cur can exceed head, but not vice versa. - * The guest must first write cur and then head with a barrier. - * - * head <= cur - * - * guest host - * - * STORE(cur) LOAD(head) - * mb() ----------- mb() - * STORE(head) LOAD(cur) - * - * This approach ensures that every head that we read is - * associated with the correct cur. In this way head can not exceed cur. + * We need to write cur and head to the CSB but we cannot do it atomically. + * There is no way we can prevent the host from reading the updated value + * of one of the two and the old value of the other. However, if we make + * sure that the host never reads a value of head more recent than the + * value of cur we are safe. We can allow the host to read a value of cur + * more recent than the value of head, since in the netmap ring cur can be + * ahead of head and cur cannot wrap around head because it must be behind + * tail. Inverting the order of writes below could instead result into the + * host to think head went ahead of cur, which would cause the sync + * prologue to fail. + * + * The following memory barrier scheme is used to make this happen: + * + * Guest Host + * + * STORE(cur) LOAD(head) + * mb() <-----------> mb() + * STORE(head) LOAD(cur) */ - CSB_READ(ptr, head, g_ring->head); + ptr->cur = cur; mb(); - CSB_READ(ptr, cur, g_ring->cur); - CSB_READ(ptr, sync_flags, g_ring->flags); - - /* - * Even with the previous barrier, it is still possible that we read an - * updated cur and an old head. - * To detect this situation, we can check if the new cur overtakes - * the (apparently) new head. - */ - d = ptn_sub(old_cur, old_head, num_slots); /* previous distance */ - inc_c = ptn_sub(g_ring->cur, old_cur, num_slots); /* increase of cur */ - inc_h = ptn_sub(g_ring->head, old_head, num_slots); /* increase of head */ - - if (unlikely(inc_c > num_slots - d + inc_h)) { /* cur overtakes head */ - ND(1,"ERROR cur overtakes head - old_cur: %u cur: %u old_head: %u head: %u", - old_cur, g_ring->cur, old_head, g_ring->head); - g_ring->cur = nm_prev(g_ring->head, num_slots - 1); - //*g_cur = *g_head; - } + ptr->head = head; } -/* Host: Write kring pointers (hwcur, hwtail) into the CSB */ +/* Guest driver: Read kring pointers (hwcur, hwtail) from the CSB. + * This routine is coupled with ptnetmap_host_write_kring_csb(). */ static inline void -ptnetmap_host_write_kring_csb(struct ptnet_ring __user *ptr, uint32_t hwcur, - uint32_t hwtail) +ptnetmap_guest_read_kring_csb(struct ptnet_ring *ptr, struct netmap_kring *kring) { - /* We must write hwtail before hwcur (see below). */ - CSB_WRITE(ptr, hwtail, hwtail); + /* + * We place a memory barrier to make sure that the update of hwtail never + * overtakes the update of hwcur. + * (see explanation in ptnetmap_host_write_kring_csb). + */ + kring->nr_hwtail = ptr->hwtail; mb(); - CSB_WRITE(ptr, hwcur, hwcur); - - //mb(); /* Force memory complete before send notification */ + kring->nr_hwcur = ptr->hwcur; } -#endif /* WITH_PTNETMAP_HOST */ +#endif /* WITH_PTNETMAP_GUEST */ -#ifdef WITH_PTNETMAP_GUEST +#ifdef WITH_PTNETMAP_HOST /* - * GUEST read/write kring pointers from/in CSB. - * To use into device driver. - */ + * ptnetmap kernel thread routines + * */ + +/* Functions to read and write CSB fields in the host */ +#if defined (linux) +#define CSB_READ(csb, field, r) (get_user(r, &csb->field)) +#define CSB_WRITE(csb, field, v) (put_user(v, &csb->field)) +#else /* ! linux */ +#define CSB_READ(csb, field, r) (r = fuword32(&csb->field)) +#define CSB_WRITE(csb, field, v) (suword32(&csb->field, v)) +#endif /* ! linux */ -/* Guest: Write kring pointers (cur, head) into the CSB */ +/* Host netmap: Write kring pointers (hwcur, hwtail) to the CSB. + * This routine is coupled with ptnetmap_guest_read_kring_csb(). */ static inline void -ptnetmap_guest_write_kring_csb(struct ptnet_ring *ptr, uint32_t cur, - uint32_t head) +ptnetmap_host_write_kring_csb(struct ptnet_ring __user *ptr, uint32_t hwcur, + uint32_t hwtail) { - /* We must write cur before head for sync reason (see above) */ - ptr->cur = cur; + /* + * The same scheme used in ptnetmap_guest_write_kring_csb() applies here. + * We allow the guest to read a value of hwcur more recent than the value + * of hwtail, since this would anyway result in a consistent view of the + * ring state (and hwcur can never wraparound hwtail, since hwcur must be + * behind head). + * + * The following memory barrier scheme is used to make this happen: + * + * Guest Host + * + * STORE(hwcur) LOAD(hwtail) + * mb() <-------------> mb() + * STORE(hwtail) LOAD(hwcur) + */ + CSB_WRITE(ptr, hwcur, hwcur); mb(); - ptr->head = head; - - //mb(); /* Force memory complete before send notification */ + CSB_WRITE(ptr, hwtail, hwtail); } -/* Guest: Read kring pointers (hwcur, hwtail) from CSB */ +/* Host netmap: Read kring pointers (head, cur, sync_flags) from the CSB. + * This routine is coupled with ptnetmap_guest_write_kring_csb(). */ static inline void -ptnetmap_guest_read_kring_csb(struct ptnet_ring *ptr, struct netmap_kring *kring) +ptnetmap_host_read_kring_csb(struct ptnet_ring __user *ptr, + struct netmap_ring *shadow_ring, + uint32_t num_slots) { - uint32_t old_hwcur = kring->nr_hwcur, old_hwtail = kring->nr_hwtail; - uint32_t num_slots = kring->nkr_num_slots; - uint32_t d, inc_hc, inc_ht; - - //mb(); /* Force memory complete before read CSB */ - /* - * We must first read hwcur and then hwtail with a barrier in the - * middle, because hwtail can exceed hwcur, but not vice versa. - * The host must first write hwtail and then hwcur with a barrier. - * - * hwcur <= hwtail - * - * host guest - * - * STORE(hwtail) LOAD(hwcur) - * mb() --------- mb() - * STORE(hwcur) LOAD(hwtail) - * - * This approach ensures that every hwcur that the guest reads is - * associated with the correct hwtail. In this way hwcur can not exceed - * hwtail. + * We place a memory barrier to make sure that the update of head never + * overtakes the update of cur. + * (see explanation in ptnetmap_guest_write_kring_csb). */ - kring->nr_hwcur = ptr->hwcur; + CSB_READ(ptr, head, shadow_ring->head); mb(); - kring->nr_hwtail = ptr->hwtail; - - /* - * Even with the previous barrier, it is still possible that we read an - * updated hwtail and an old hwcur. - * To detect this situation, we can check if the new hwtail overtakes - * the (apparently) new hwcur. - */ - d = ptn_sub(old_hwtail, old_hwcur, num_slots); /* previous distance */ - inc_ht = ptn_sub(kring->nr_hwtail, old_hwtail, num_slots); /* increase of hwtail */ - inc_hc = ptn_sub(kring->nr_hwcur, old_hwcur, num_slots); /* increase of hwcur */ - - if (unlikely(inc_ht > num_slots - d + inc_hc)) { - ND(1, "ERROR hwtail overtakes hwcur - old_hwtail: %u hwtail: %u old_hwcur: %u hwcur: %u", - old_hwtail, kring->nr_hwtail, old_hwcur, kring->nr_hwcur); - kring->nr_hwtail = nm_prev(kring->nr_hwcur, num_slots - 1); - //kring->nr_hwtail = kring->nr_hwcur; - } + CSB_READ(ptr, cur, shadow_ring->cur); + CSB_READ(ptr, sync_flags, shadow_ring->flags); } -/* ptnetmap_memdev routines used to talk with ptnetmap_memdev device driver */ -struct ptnetmap_memdev; -int nm_os_pt_memdev_iomap(struct ptnetmap_memdev *, vm_paddr_t *, void **); -void nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *); -#endif /* WITH_PTNETMAP_GUEST */ +#endif /* WITH_PTNETMAP_HOST */ #endif /* NETMAP_VIRT_H */ From owner-svn-src-all@freebsd.org Tue Oct 18 17:22:36 2016 Return-Path: Delivered-To: svn-src-all@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 7F22BC17339; Tue, 18 Oct 2016 17:22:36 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) (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 465391B9; Tue, 18 Oct 2016 17:22:35 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:43446) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1bwY5s-0009x7-e7 (Exim 4.86_36-e07b163) (return-path ); Tue, 18 Oct 2016 18:22:28 +0100 Date: Tue, 18 Oct 2016 17:22:07 +0000 From: Ruslan Bukin To: Baptiste Daroussin Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r306864 - head Message-ID: <20161018172207.GA59150@bsdpad.com> References: <201610081857.u98IvB7l012374@repo.freebsd.org> <20161018061755.makbm4tvtb5i6rc4@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161018061755.makbm4tvtb5i6rc4@ivaldir.etoilebsd.net> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 17:22:36 -0000 On Tue, Oct 18, 2016 at 08:17:55AM +0200, Baptiste Daroussin wrote: > On Mon, Oct 17, 2016 at 06:28:08PM -0700, Ngie Cooper wrote: > > On Sat, Oct 8, 2016 at 11:57 AM, Baptiste Daroussin wrote: > > > Author: bapt > > > Date: Sat Oct 8 18:57:11 2016 > > > New Revision: 306864 > > > URL: https://svnweb.freebsd.org/changeset/base/306864 > > > > > > Log: > > > groff is not needed in the bootstrap tools if the system is built > > > WITHOUT_SHAREDOCS > > > > > > MFC after: 2 weeks > > > > > > Modified: > > > head/Makefile.inc1 > > > > This breaks buildworld when WITHOUT_GROFF is set and > > WITHOUT_SHAREDOCS isn't set. > > Really do you have logs of that? > Hi this breaks RISC-V world (we use external GNU toolchain) Here is log: https://people.freebsd.org/~br/riscv_wlog.txt Ruslan From owner-svn-src-all@freebsd.org Tue Oct 18 19:15:46 2016 Return-Path: Delivered-To: svn-src-all@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 49C86C170C3; Tue, 18 Oct 2016 19:15:46 +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 181AC2E4; Tue, 18 Oct 2016 19:15:46 +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 u9IJFjfg039758; Tue, 18 Oct 2016 19:15:45 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IJFh4T039744; Tue, 18 Oct 2016 19:15:43 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610181915.u9IJFh4T039744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 18 Oct 2016 19:15:43 +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: r307575 - in stable/11/sys: arm/broadcom/bcm2835 contrib/vchiq/interface/vchiq_arm dev/usb/controller X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 19:15:46 -0000 Author: gonzo Date: Tue Oct 18 19:15:43 2016 New Revision: 307575 URL: https://svnweb.freebsd.org/changeset/base/307575 Log: MFC r307067, r307068, r307087, r307088, r307089, r307091, r307092, r307093, r307095, r307098, r307115: r307067: Make intc driver compatible with upstream DTS - Fix compatibility strings - Properly decode upstream's two-cell interrupt specs. Our home-made dts does not have two-cell interrupts so no need to preserve backward compatibility r307068: Make Rapsberry Pi watchdog driver compatible with upstream DTS - Fix compatibility strings - Compensate the difference in base address for our custom DTS and upstream one (for backward compatibility) r307087: Make sure intc is attached before interrupt consumers If pass order is not specified devices are attached in the order they are defined in dts. Some interrupt consumers may be defined before intc. Also make sure intc interrupt-parent local_intc is attached before intc itself. r307088: Add compatible strings used in upstream dts files r307089: Make framebuffer driver compatible with upstream DT - Add compatibility string - Add simplebus as possible parent bus r307091: Add compatibility string from upstream DT r307092: Make BCM2835 GPIO driver compatible with upstream DT - Add compatibility string - Make reserverd and read-only properties optional r307093: Make BCM283x USB driver compatible with upstream DT - Make resource allocation logic depend on compatibility string to check what format of DTS node should be used - FreeBSD's or upstream r307095: Make VCHI driver compatible with upstream DT - Add compatibility string - Compensate difference in base address between our custom DTB and upstream one r307098: Make BCM28x USB driver compatible with upstream device tree This should have been committed in r307093: resource allocation depends on source of the device tree. upstream dts has extra interrupt that we can ignore r307115: Fix typo in comment Spotted by: loos Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_common.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_dma.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_gpio.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_intr.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_mbox.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c stable/11/sys/arm/broadcom/bcm2835/bcm2835_wdog.c stable/11/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c stable/11/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c stable/11/sys/dev/usb/controller/dwc_otg_fdt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Tue Oct 18 19:15:43 2016 (r307575) @@ -52,6 +52,12 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-bsc", 1}, + {"brcm,bcm2708-i2c", 1}, + {NULL, 0} +}; + static void bcm_bsc_intr(void *); static int bcm_bsc_detach(device_t); @@ -214,7 +220,7 @@ bcm_bsc_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-bsc")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "BCM2708/2835 BSC controller"); Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_common.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_common.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_common.c Tue Oct 18 19:15:43 2016 (r307575) @@ -56,7 +56,8 @@ fdt_intc_decode_ic(phandle_t node, pcell int *pol) { - if (fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic")) { + if (fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic") || + fdt_is_compatible(node, "brcm,bcm2836-armctrl-ic")) { *interrupt = fdt32_to_cpu(intr[0]); *trig = INTR_TRIGGER_CONFORM; *pol = INTR_POLARITY_CONFORM; Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_dma.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_dma.c Tue Oct 18 19:15:43 2016 (r307575) @@ -154,6 +154,12 @@ struct bcm_dma_softc { static struct bcm_dma_softc *bcm_dma_sc = NULL; static uint32_t bcm_dma_channel_mask; +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-dma", 1}, + {"brcm,bcm2835-dma", 1}, + {NULL, 0} +}; + static void bcm_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) @@ -658,7 +664,7 @@ bcm_dma_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-dma")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "BCM2835 DMA Controller"); Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_fb.c Tue Oct 18 19:15:43 2016 (r307575) @@ -111,6 +111,12 @@ struct bcmsc_softc { static struct bcmsc_softc bcmsc; +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-fb", 1}, + {"brcm,bcm2708-fb", 1}, + {NULL, 0} +}; + static int bcm_fb_probe(device_t); static int bcm_fb_attach(device_t); static void bcmfb_update_margins(video_adapter_t *adp); @@ -121,8 +127,9 @@ bcm_fb_probe(device_t dev) { int error; - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); + device_set_desc(dev, "BCM2835 framebuffer device"); error = sc_probe_unit(device_get_unit(dev), device_get_flags(dev) | SC_AUTODETECT_KBD); @@ -196,6 +203,7 @@ static driver_t bcm_fb_driver = { }; DRIVER_MODULE(bcm2835fb, ofwbus, bcm_fb_driver, bcm_fb_devclass, 0, 0); +DRIVER_MODULE(bcm2835fb, simplebus, bcm_fb_driver, bcm_fb_devclass, 0, 0); /* * Video driver routines and glue. Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Tue Oct 18 19:15:43 2016 (r307575) @@ -65,6 +65,12 @@ struct bcmsc_softc { device_t dev; }; +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-fb", 1}, + {"brcm,bcm2708-fb", 1}, + {NULL, 0} +}; + static int bcm_fb_probe(device_t); static int bcm_fb_attach(device_t); @@ -189,7 +195,8 @@ bcm_fb_sysctl_init(struct bcmsc_softc *s static int bcm_fb_probe(device_t dev) { - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb")) + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "BCM2835 VT framebuffer driver"); @@ -263,3 +270,4 @@ static driver_t bcm_fb_driver = { }; DRIVER_MODULE(bcm2835fb, ofwbus, bcm_fb_driver, bcm_fb_devclass, 0, 0); +DRIVER_MODULE(bcm2835fb, simplebus, bcm_fb_driver, bcm_fb_devclass, 0, 0); Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Oct 18 19:15:43 2016 (r307575) @@ -82,8 +82,6 @@ static struct resource_spec bcm_gpio_res { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, /* bank 0 interrupt */ { SYS_RES_IRQ, 1, RF_ACTIVE }, /* bank 1 interrupt */ - { SYS_RES_IRQ, 2, RF_ACTIVE }, /* bank 1 interrupt (mirrored) */ - { SYS_RES_IRQ, 3, RF_ACTIVE }, /* bank 0-1 interrupt (united) */ { -1, 0, 0 } }; @@ -159,6 +157,12 @@ enum bcm_gpio_pud { #define BCM_GPIO_GPPUD(_bank) (0x94) /* Pin Pull up/down */ #define BCM_GPIO_GPPUDCLK(_bank) (0x98 + _bank * 4) /* Pin Pull up clock */ +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-gpio", 1}, + {"brcm,bcm2835-gpio", 1}, + {NULL, 0} +}; + static struct bcm_gpio_softc *bcm_gpio_sc = NULL; #ifdef INTRNG @@ -672,11 +676,11 @@ bcm_gpio_get_reserved_pins(struct bcm_gp phandle_t gpio, node, reserved; ssize_t len; - /* Get read-only pins. */ + /* Get read-only pins if they're provided */ gpio = ofw_bus_get_node(sc->sc_dev); if (bcm_gpio_get_ro_pins(sc, gpio, "broadcom,read-only", "read-only") != 0) - return (-1); + return (0); /* Traverse the GPIO subnodes to find the reserved pins node. */ reserved = 0; node = OF_child(gpio); @@ -742,7 +746,7 @@ bcm_gpio_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-gpio")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "BCM2708/2835 GPIO controller"); Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_intr.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_intr.c Tue Oct 18 19:15:43 2016 (r307575) @@ -270,6 +270,7 @@ bcm_intc_map_intr(device_t dev, struct i u_int irq; struct intr_map_data_fdt *daf; struct bcm_intc_softc *sc; + bool valid; if (data->type != INTR_MAP_DATA_FDT) return (ENOTSUP); @@ -277,8 +278,36 @@ bcm_intc_map_intr(device_t dev, struct i daf = (struct intr_map_data_fdt *)data; if (daf->ncells == 1) irq = daf->cells[0]; - else if (daf->ncells == 2) - irq = daf->cells[0] * 32 + daf->cells[1]; + else if (daf->ncells == 2) { + valid = true; + switch (daf->cells[0]) { + case 0: + irq = daf->cells[1]; + if (irq >= BANK1_START) + valid = false; + break; + case 1: + irq = daf->cells[1] + BANK1_START; + if (irq > BANK1_END) + valid = false; + break; + case 2: + irq = daf->cells[1] + BANK2_START; + if (irq > BANK2_END) + valid = false; + break; + default: + valid = false; + break; + } + + if (!valid) { + device_printf(dev, + "invalid IRQ config: bank=%d, irq=%d\n", + daf->cells[0], daf->cells[1]); + return (EINVAL); + } + } else return (EINVAL); @@ -355,7 +384,8 @@ bcm_intc_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-armctrl-ic")) + if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-armctrl-ic") && + !ofw_bus_is_compatible(dev, "brcm,bcm2836-armctrl-ic")) return (ENXIO); device_set_desc(dev, "BCM2835 Interrupt Controller"); return (BUS_PROBE_DEFAULT); @@ -438,7 +468,8 @@ static driver_t bcm_intc_driver = { static devclass_t bcm_intc_devclass; -DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass, 0, 0); +EARLY_DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); #ifndef INTRNG int Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_mbox.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Tue Oct 18 19:15:43 2016 (r307575) @@ -92,6 +92,12 @@ struct bcm_mbox_softc { #define mbox_write_4(sc, reg, val) \ bus_space_write_4((sc)->bst, (sc)->bsh, reg, val) +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-mbox", 1}, + {"brcm,bcm2835-mbox", 1}, + {NULL, 0} +}; + static int bcm_mbox_read_msg(struct bcm_mbox_softc *sc, int *ochan) { @@ -138,12 +144,12 @@ bcm_mbox_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-mbox")) { - device_set_desc(dev, "BCM2835 VideoCore Mailbox"); - return(BUS_PROBE_DEFAULT); - } + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "BCM2835 VideoCore Mailbox"); - return (ENXIO); + return (BUS_PROBE_DEFAULT); } static int Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Tue Oct 18 19:15:43 2016 (r307575) @@ -71,6 +71,12 @@ __FBSDID("$FreeBSD$"); static int bcm2835_sdhci_hs = 1; static int bcm2835_sdhci_pio_mode = 0; +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-sdhci", 1}, + {"brcm,bcm2835-mmc", 1}, + {NULL, 0} +}; + TUNABLE_INT("hw.bcm2835.sdhci.hs", &bcm2835_sdhci_hs); TUNABLE_INT("hw.bcm2835.sdhci.pio_mode", &bcm2835_sdhci_pio_mode); @@ -126,10 +132,11 @@ bcm_sdhci_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-sdhci")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "Broadcom 2708 SDHCI controller"); + return (BUS_PROBE_DEFAULT); } Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c Tue Oct 18 19:15:43 2016 (r307575) @@ -58,6 +58,12 @@ __FBSDID("$FreeBSD$"); #include "spibus_if.h" +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-spi", 1}, + {"brcm,bcm2835-spi", 1}, + {NULL, 0} +}; + static void bcm_spi_intr(void *); #ifdef BCM_SPI_DEBUG @@ -233,7 +239,7 @@ bcm_spi_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-spi")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "BCM2708/2835 SPI controller"); Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_wdog.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_wdog.c Tue Oct 18 19:15:43 2016 (r307575) @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); #define BCM2835_WDOG_TIME_MASK 0x000fffff #define BCM2835_WDOG_TIME_SHIFT 0 -#define READ(_sc, _r) bus_space_read_4((_sc)->bst, (_sc)->bsh, (_r)) -#define WRITE(_sc, _r, _v) bus_space_write_4((_sc)->bst, (_sc)->bsh, (_r), (_v)) +#define READ(_sc, _r) bus_space_read_4((_sc)->bst, (_sc)->bsh, (_r) + (_sc)->regs_offset) +#define WRITE(_sc, _r, _v) bus_space_write_4((_sc)->bst, (_sc)->bsh, (_r) + (_sc)->regs_offset, (_v)) #define BCM2835_RSTC_WRCFG_CLR 0xffffffcf #define BCM2835_RSTC_WRCFG_SET 0x00000030 @@ -76,6 +76,17 @@ struct bcmwd_softc { int wdog_period; char wdog_passwd; struct mtx mtx; + int regs_offset; +}; + +#define BSD_DTB 1 +#define UPSTREAM_DTB 2 +#define UPSTREAM_DTB_REGS_OFFSET 0x1c + +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-wdt", BSD_DTB}, + {"brcm,bcm2835-pm-wdt", UPSTREAM_DTB}, + {NULL, 0} }; static void bcmwd_watchdog_fn(void *private, u_int cmd, int *error); @@ -87,12 +98,12 @@ bcmwd_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-wdt")) { - device_set_desc(dev, "BCM2708/2835 Watchdog"); - return (BUS_PROBE_DEFAULT); - } + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "BCM2708/2835 Watchdog"); - return (ENXIO); + return (BUS_PROBE_DEFAULT); } static int @@ -120,6 +131,11 @@ bcmwd_attach(device_t dev) sc->bst = rman_get_bustag(sc->res); sc->bsh = rman_get_bushandle(sc->res); + /* compensate base address difference */ + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data + == UPSTREAM_DTB) + sc->regs_offset = UPSTREAM_DTB_REGS_OFFSET; + bcmwd_lsc = sc; mtx_init(&sc->mtx, "BCM2835 Watchdog", "bcmwd", MTX_DEF); EVENTHANDLER_REGISTER(watchdog_list, bcmwd_watchdog_fn, sc, 0); Modified: stable/11/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c Tue Oct 18 19:15:43 2016 (r307575) @@ -51,6 +51,12 @@ __FBSDID("$FreeBSD$"); #include +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-usb", 1}, + {"brcm,bcm2708-usb", 1}, + {NULL, 0} +}; + static device_probe_t bcm283x_dwc_otg_probe; static device_attach_t bcm283x_dwc_otg_attach; @@ -61,7 +67,7 @@ bcm283x_dwc_otg_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-usb")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "DWC OTG 2.0 integrated USB controller (bcm283x)"); Modified: stable/11/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c ============================================================================== --- stable/11/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c Tue Oct 18 19:15:43 2016 (r307575) @@ -73,14 +73,25 @@ struct bcm_vchiq_softc { void* intr_hl; bus_space_tag_t bst; bus_space_handle_t bsh; + int regs_offset; }; static struct bcm_vchiq_softc *bcm_vchiq_sc = NULL; +#define BSD_DTB 1 +#define UPSTREAM_DTB 2 +static struct ofw_compat_data compat_data[] = { + {"broadcom,bcm2835-vchiq", BSD_DTB}, + {"brcm,bcm2835-vchiq", UPSTREAM_DTB}, + {NULL, 0} +}; + #define vchiq_read_4(reg) \ - bus_space_read_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, reg) + bus_space_read_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, (reg) + \ + bcm_vchiq_sc->regs_offset) #define vchiq_write_4(reg, val) \ - bus_space_write_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, reg, val) + bus_space_write_4(bcm_vchiq_sc->bst, bcm_vchiq_sc->bsh, (reg) + \ + bcm_vchiq_sc->regs_offset, val) /* * Extern functions */ @@ -122,12 +133,11 @@ static int bcm_vchiq_probe(device_t dev) { - if (ofw_bus_is_compatible(dev, "broadcom,bcm2835-vchiq")) { - device_set_desc(dev, "BCM2835 VCHIQ"); - return(BUS_PROBE_DEFAULT); - } + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); - return (ENXIO); + device_set_desc(dev, "BCM2835 VCHIQ"); + return (BUS_PROBE_DEFAULT); } static int @@ -157,6 +167,9 @@ bcm_vchiq_attach(device_t dev) return (ENXIO); } + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == UPSTREAM_DTB) + sc->regs_offset = -0x40; + node = ofw_bus_get_node(dev); if ((OF_getencprop(node, "cache-line-size", &cell, sizeof(cell))) > 0) g_cache_line_size = cell; Modified: stable/11/sys/dev/usb/controller/dwc_otg_fdt.c ============================================================================== --- stable/11/sys/dev/usb/controller/dwc_otg_fdt.c Tue Oct 18 16:18:25 2016 (r307574) +++ stable/11/sys/dev/usb/controller/dwc_otg_fdt.c Tue Oct 18 19:15:43 2016 (r307575) @@ -121,7 +121,12 @@ dwc_otg_attach(device_t dev) sc->sc_otg.sc_io_hdl = rman_get_bushandle(sc->sc_otg.sc_io_res); sc->sc_otg.sc_io_size = rman_get_size(sc->sc_otg.sc_io_res); - rid = 0; + + /* + * brcm,bcm2708-usb FDT provides two interrupts, + * we need only second one (VC_USB) + */ + rid = ofw_bus_is_compatible(dev, "brcm,bcm2708-usb") ? 1 : 0; sc->sc_otg.sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); if (sc->sc_otg.sc_irq_res == NULL) From owner-svn-src-all@freebsd.org Tue Oct 18 20:17:58 2016 Return-Path: Delivered-To: svn-src-all@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 EF4C1C1762C; Tue, 18 Oct 2016 20:17:58 +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 8B236A03; Tue, 18 Oct 2016 20:17:58 +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 u9IKHvCf063221; Tue, 18 Oct 2016 20:17:57 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IKHvTD063219; Tue, 18 Oct 2016 20:17:57 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610182017.u9IKHvTD063219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 18 Oct 2016 20:17:57 +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: r307576 - in stable/11/sys: dev/atkbdc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 20:17:59 -0000 Author: gonzo Date: Tue Oct 18 20:17:57 2016 New Revision: 307576 URL: https://svnweb.freebsd.org/changeset/base/307576 Log: MFC r306355, r306474, r306746: r306355: Add Elantech trackpad support Elantech trackpads are found in some laptops like the Asus UX31E. They are "synaptics compatible" but use a slightly different protocol. Elantech hardware support is not enabled by default and just like Synaptic or TrackPoint devices it should be enabled by setting tunable, in this case hw.psm.elantech_support, to non-zero value PR: 205690 Submitted by: Vladimir Kondratyev MFC after: 1 week r306474: Replace explicit TUNABLE_INT to sysctl with CTLFLAG_TUN - Replace tunables-only hw.psm.synaptics_support, hw.psm.trackpoint_support, and hw.psm.elantech_support with respective sysctls declared with CTLFLAG_TUN. It simplifies checking them in userland, also makes them easier to get discovered by user - Get rid of debug.psm.loglevel and hw.psm.tap_enabled TUNABLE_INT declaration by adding CTLFLAG_TUN to read/write sysctls that were already declared for these tunables. Suggested by: jhb r306746: Fix extended buttons support on synaptic clickpad Fix regression introduced by r306355 on synaptic clickpads with extended buttons (buttons stopped working) PR: 205690 Submitted by: Vladimir Kondratyev Modified: stable/11/sys/dev/atkbdc/psm.c stable/11/sys/sys/mouse.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/atkbdc/psm.c ============================================================================== --- stable/11/sys/dev/atkbdc/psm.c Tue Oct 18 19:15:43 2016 (r307575) +++ stable/11/sys/dev/atkbdc/psm.c Tue Oct 18 20:17:57 2016 (r307576) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -161,40 +162,6 @@ typedef struct packetbuf { #define PSM_PACKETQUEUE 128 #endif -enum { - SYNAPTICS_SYSCTL_MIN_PRESSURE, - SYNAPTICS_SYSCTL_MAX_PRESSURE, - SYNAPTICS_SYSCTL_MAX_WIDTH, - SYNAPTICS_SYSCTL_MARGIN_TOP, - SYNAPTICS_SYSCTL_MARGIN_RIGHT, - SYNAPTICS_SYSCTL_MARGIN_BOTTOM, - SYNAPTICS_SYSCTL_MARGIN_LEFT, - SYNAPTICS_SYSCTL_NA_TOP, - SYNAPTICS_SYSCTL_NA_RIGHT, - SYNAPTICS_SYSCTL_NA_BOTTOM, - SYNAPTICS_SYSCTL_NA_LEFT, - SYNAPTICS_SYSCTL_WINDOW_MIN, - SYNAPTICS_SYSCTL_WINDOW_MAX, - SYNAPTICS_SYSCTL_MULTIPLICATOR, - SYNAPTICS_SYSCTL_WEIGHT_CURRENT, - SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS, - SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS_NA, - SYNAPTICS_SYSCTL_WEIGHT_LEN_SQUARED, - SYNAPTICS_SYSCTL_DIV_MIN, - SYNAPTICS_SYSCTL_DIV_MAX, - SYNAPTICS_SYSCTL_DIV_MAX_NA, - SYNAPTICS_SYSCTL_DIV_LEN, - SYNAPTICS_SYSCTL_TAP_MAX_DELTA, - SYNAPTICS_SYSCTL_TAP_MIN_QUEUE, - SYNAPTICS_SYSCTL_TAPHOLD_TIMEOUT, - SYNAPTICS_SYSCTL_VSCROLL_HOR_AREA, - SYNAPTICS_SYSCTL_VSCROLL_VER_AREA, - SYNAPTICS_SYSCTL_VSCROLL_MIN_DELTA, - SYNAPTICS_SYSCTL_VSCROLL_DIV_MIN, - SYNAPTICS_SYSCTL_VSCROLL_DIV_MAX, - SYNAPTICS_SYSCTL_TOUCHPAD_OFF -}; - typedef struct synapticsinfo { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -231,6 +198,11 @@ typedef struct synapticsinfo { int vscroll_div_min; int vscroll_div_max; int touchpad_off; + int softbuttons_y; + int softbutton2_x; + int softbutton3_x; + int max_x; + int max_y; } synapticsinfo_t; typedef struct synapticspacket { @@ -246,22 +218,29 @@ typedef struct synapticspacket { ((synhw).infoMajor > (major) || \ ((synhw).infoMajor == (major) && (synhw).infoMinor >= (minor))) -typedef struct synapticsaction { +typedef struct smoother { synapticspacket_t queue[SYNAPTICS_PACKETQUEUE]; int queue_len; int queue_cursor; - int window_min; int start_x; int start_y; int avg_dx; int avg_dy; int squelch_x; int squelch_y; + int is_fuzzy; + int active; +} smoother_t; + +typedef struct gesture { + int window_min; int fingers_nb; int tap_button; int in_taphold; int in_vscroll; -} synapticsaction_t; + int zmax; /* maximum pressure value */ + struct timeval taptimeout; /* tap timeout for touchpads */ +} gesture_t; enum { TRACKPOINT_SYSCTL_SENSITIVITY, @@ -295,6 +274,100 @@ typedef struct trackpointinfo { int skipback; } trackpointinfo_t; +typedef struct finger { + int x; + int y; + int p; + int w; + int flags; +} finger_t; +#define PSM_FINGERS 2 /* # of processed fingers */ +#define PSM_FINGER_IS_PEN (1<<0) +#define PSM_FINGER_FUZZY (1<<1) +#define PSM_FINGER_DEFAULT_P tap_threshold +#define PSM_FINGER_DEFAULT_W 1 +#define PSM_FINGER_IS_SET(f) ((f).x != -1 && (f).y != -1 && (f).p != 0) +#define PSM_FINGER_RESET(f) do { \ + (f) = (finger_t) { .x = -1, .y = -1, .p = 0, .w = 0, .flags = 0 }; \ +} while (0) + +typedef struct elantechhw { + int hwversion; + int fwversion; + int sizex; + int sizey; + int dpmmx; + int dpmmy; + int ntracesx; + int ntracesy; + int issemimt; + int isclickpad; + int hascrc; + int hastrackpoint; + int haspressure; +} elantechhw_t; + +/* minimum versions supported by this driver */ +#define ELANTECH_HW_IS_V1(fwver) ((fwver) < 0x020030 || (fwver) == 0x020600) + +#define ELANTECH_MAGIC(magic) \ + ((magic)[0] == 0x3c && (magic)[1] == 0x03 && \ + ((magic)[2] == 0xc8 || (magic)[2] == 0x00)) + +#define ELANTECH_FW_ID 0x00 +#define ELANTECH_FW_VERSION 0x01 +#define ELANTECH_CAPABILITIES 0x02 +#define ELANTECH_SAMPLE 0x03 +#define ELANTECH_RESOLUTION 0x04 +#define ELANTECH_REG_READ 0x10 +#define ELANTECH_REG_WRITE 0x11 +#define ELANTECH_REG_RDWR 0x00 +#define ELANTECH_CUSTOM_CMD 0xf8 + +#define ELANTECH_MAX_FINGERS PSM_FINGERS + +#define ELANTECH_FINGER_SET_XYP(pb) (finger_t) { \ + .x = (((pb)->ipacket[1] & 0x0f) << 8) | (pb)->ipacket[2], \ + .y = (((pb)->ipacket[4] & 0x0f) << 8) | (pb)->ipacket[5], \ + .p = ((pb)->ipacket[1] & 0xf0) | (((pb)->ipacket[4] >> 4) & 0x0f), \ + .w = PSM_FINGER_DEFAULT_W, \ + .flags = 0 \ +} + +enum { + ELANTECH_PKT_NOP, + ELANTECH_PKT_TRACKPOINT, + ELANTECH_PKT_V2_COMMON, + ELANTECH_PKT_V2_2FINGER, + ELANTECH_PKT_V3, + ELANTECH_PKT_V4_STATUS, + ELANTECH_PKT_V4_HEAD, + ELANTECH_PKT_V4_MOTION +}; + +#define ELANTECH_PKT_IS_TRACKPOINT(pb) (((pb)->ipacket[3] & 0x0f) == 0x06) +#define ELANTECH_PKT_IS_DEBOUNCE(pb, hwversion) ((hwversion) == 4 ? 0 : \ + (pb)->ipacket[0] == ((hwversion) == 2 ? 0x84 : 0xc4) && \ + (pb)->ipacket[1] == 0xff && (pb)->ipacket[2] == 0xff && \ + (pb)->ipacket[3] == 0x02 && (pb)->ipacket[4] == 0xff && \ + (pb)->ipacket[5] == 0xff) +#define ELANTECH_PKT_IS_V2(pb) \ + (((pb)->ipacket[0] & 0x0c) == 0x04 && ((pb)->ipacket[3] & 0x0f) == 0x02) +#define ELANTECH_PKT_IS_V3_HEAD(pb, hascrc) ((hascrc) ? \ + ((pb)->ipacket[3] & 0x09) == 0x08 : \ + ((pb)->ipacket[0] & 0x0c) == 0x04 && ((pb)->ipacket[3] & 0xcf) == 0x02) +#define ELANTECH_PKT_IS_V3_TAIL(pb, hascrc) ((hascrc) ? \ + ((pb)->ipacket[3] & 0x09) == 0x09 : \ + ((pb)->ipacket[0] & 0x0c) == 0x0c && ((pb)->ipacket[3] & 0xce) == 0x0c) +#define ELANTECH_PKT_IS_V4(pb, hascrc) ((hascrc) ? \ + ((pb)->ipacket[3] & 0x08) == 0x00 : \ + ((pb)->ipacket[0] & 0x0c) == 0x04 && ((pb)->ipacket[3] & 0x1c) == 0x10) + +typedef struct elantechaction { + finger_t fingers[ELANTECH_MAX_FINGERS]; + int mask; +} elantechaction_t; + /* driver control block */ struct psm_softc { /* Driver status information */ int unit; @@ -308,7 +381,10 @@ struct psm_softc { /* Driver status inf mousehw_t hw; /* hardware information */ synapticshw_t synhw; /* Synaptics hardware information */ synapticsinfo_t syninfo; /* Synaptics configuration */ - synapticsaction_t synaction; /* Synaptics action context */ + smoother_t smoother[PSM_FINGERS]; /* Motion smoothing */ + gesture_t gesture; /* Gesture context */ + elantechhw_t elanhw; /* Elantech hardware information */ + elantechaction_t elanaction; /* Elantech action context */ int tphw; /* TrackPoint hardware information */ trackpointinfo_t tpinfo; /* TrackPoint configuration */ mousemode_t mode; /* operation mode */ @@ -324,13 +400,13 @@ struct psm_softc { /* Driver status inf int xaverage; /* average X position */ int yaverage; /* average Y position */ int squelch; /* level to filter movement at low speed */ - int zmax; /* maximum pressure value for touchpads */ int syncerrors; /* # of bytes discarded to synchronize */ int pkterrors; /* # of packets failed during quaranteen. */ struct timeval inputtimeout; struct timeval lastsoftintr; /* time of last soft interrupt */ struct timeval lastinputerr; /* time last sync error happened */ - struct timeval taptimeout; /* tap timeout for touchpads */ + struct timeval idletimeout; + packetbuf_t idlepacket; /* packet to send after idle timeout */ int watchdog; /* watchdog timer flag */ struct callout callout; /* watchdog timer call out */ struct callout softcallout; /* buffer timer call out */ @@ -381,16 +457,10 @@ static devclass_t psm_devclass; /* Tunables */ static int tap_enabled = -1; -TUNABLE_INT("hw.psm.tap_enabled", &tap_enabled); - +static int verbose = PSM_DEBUG; static int synaptics_support = 0; -TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support); - static int trackpoint_support = 0; -TUNABLE_INT("hw.psm.trackpoint_support", &trackpoint_support); - -static int verbose = PSM_DEBUG; -TUNABLE_INT("debug.psm.loglevel", &verbose); +static int elantech_support = 0; /* for backward compatibility */ #define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t) @@ -411,6 +481,44 @@ typedef struct old_mousemode { int accelfactor; } old_mousemode_t; +#define SYN_OFFSET(field) offsetof(struct psm_softc, syninfo.field) +enum { + SYNAPTICS_SYSCTL_MIN_PRESSURE = SYN_OFFSET(min_pressure), + SYNAPTICS_SYSCTL_MAX_PRESSURE = SYN_OFFSET(max_pressure), + SYNAPTICS_SYSCTL_MAX_WIDTH = SYN_OFFSET(max_width), + SYNAPTICS_SYSCTL_MARGIN_TOP = SYN_OFFSET(margin_top), + SYNAPTICS_SYSCTL_MARGIN_RIGHT = SYN_OFFSET(margin_right), + SYNAPTICS_SYSCTL_MARGIN_BOTTOM = SYN_OFFSET(margin_bottom), + SYNAPTICS_SYSCTL_MARGIN_LEFT = SYN_OFFSET(margin_left), + SYNAPTICS_SYSCTL_NA_TOP = SYN_OFFSET(na_top), + SYNAPTICS_SYSCTL_NA_RIGHT = SYN_OFFSET(na_right), + SYNAPTICS_SYSCTL_NA_BOTTOM = SYN_OFFSET(na_bottom), + SYNAPTICS_SYSCTL_NA_LEFT = SYN_OFFSET(na_left), + SYNAPTICS_SYSCTL_WINDOW_MIN = SYN_OFFSET(window_min), + SYNAPTICS_SYSCTL_WINDOW_MAX = SYN_OFFSET(window_max), + SYNAPTICS_SYSCTL_MULTIPLICATOR = SYN_OFFSET(multiplicator), + SYNAPTICS_SYSCTL_WEIGHT_CURRENT = SYN_OFFSET(weight_current), + SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS = SYN_OFFSET(weight_previous), + SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS_NA = SYN_OFFSET(weight_previous_na), + SYNAPTICS_SYSCTL_WEIGHT_LEN_SQUARED = SYN_OFFSET(weight_len_squared), + SYNAPTICS_SYSCTL_DIV_MIN = SYN_OFFSET(div_min), + SYNAPTICS_SYSCTL_DIV_MAX = SYN_OFFSET(div_max), + SYNAPTICS_SYSCTL_DIV_MAX_NA = SYN_OFFSET(div_max_na), + SYNAPTICS_SYSCTL_DIV_LEN = SYN_OFFSET(div_len), + SYNAPTICS_SYSCTL_TAP_MAX_DELTA = SYN_OFFSET(tap_max_delta), + SYNAPTICS_SYSCTL_TAP_MIN_QUEUE = SYN_OFFSET(tap_min_queue), + SYNAPTICS_SYSCTL_TAPHOLD_TIMEOUT = SYN_OFFSET(taphold_timeout), + SYNAPTICS_SYSCTL_VSCROLL_HOR_AREA = SYN_OFFSET(vscroll_hor_area), + SYNAPTICS_SYSCTL_VSCROLL_VER_AREA = SYN_OFFSET(vscroll_ver_area), + SYNAPTICS_SYSCTL_VSCROLL_MIN_DELTA = SYN_OFFSET(vscroll_min_delta), + SYNAPTICS_SYSCTL_VSCROLL_DIV_MIN = SYN_OFFSET(vscroll_div_min), + SYNAPTICS_SYSCTL_VSCROLL_DIV_MAX = SYN_OFFSET(vscroll_div_max), + SYNAPTICS_SYSCTL_TOUCHPAD_OFF = SYN_OFFSET(touchpad_off), + SYNAPTICS_SYSCTL_SOFTBUTTONS_Y = SYN_OFFSET(softbuttons_y), + SYNAPTICS_SYSCTL_SOFTBUTTON2_X = SYN_OFFSET(softbutton2_x), + SYNAPTICS_SYSCTL_SOFTBUTTON3_X = SYN_OFFSET(softbutton3_x), +}; + /* packet formatting function */ typedef int packetfunc_t(struct psm_softc *, u_char *, int *, int, mousestatus_t *); @@ -446,6 +554,7 @@ static int doopen(struct psm_softc *, in static int reinitialize(struct psm_softc *, int); static char *model_name(int); static void psmsoftintr(void *); +static void psmsoftintridle(void *); static void psmintr(void *); static void psmtimeout(void *); static int timeelapsed(const struct timeval *, int, int, @@ -458,6 +567,13 @@ static int proc_synaptics(struct psm_sof mousestatus_t *, int *, int *, int *); static void proc_versapad(struct psm_softc *, packetbuf_t *, mousestatus_t *, int *, int *, int *); +static int proc_elantech(struct psm_softc *, packetbuf_t *, + mousestatus_t *, int *, int *, int *); +static int psmpalmdetect(struct psm_softc *, finger_t *, int); +static void psmgestures(struct psm_softc *, finger_t *, int, + mousestatus_t *); +static void psmsmoother(struct psm_softc *, finger_t *, int, + mousestatus_t *, int *, int *); static int tame_mouse(struct psm_softc *, packetbuf_t *, mousestatus_t *, u_char *); @@ -480,6 +596,7 @@ static probefunc_t enable_mmanplus; static probefunc_t enable_synaptics; static probefunc_t enable_trackpoint; static probefunc_t enable_versapad; +static probefunc_t enable_elantech; static void set_trackpoint_parameters(struct psm_softc *sc); static void synaptics_passthrough_on(struct psm_softc *sc); @@ -511,6 +628,8 @@ static struct { 0xc8, MOUSE_4DPLUS_PACKETSIZE, enable_4dplus }, { MOUSE_MODEL_SYNAPTICS, /* Synaptics Touchpad */ 0xc0, MOUSE_SYNAPTICS_PACKETSIZE, enable_synaptics }, + { MOUSE_MODEL_ELANTECH, /* Elantech Touchpad */ + 0x04, MOUSE_ELANTECH_PACKETSIZE, enable_elantech }, { MOUSE_MODEL_INTELLI, /* Microsoft IntelliMouse */ 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_msintelli }, { MOUSE_MODEL_GLIDEPOINT, /* ALPS GlidePoint */ @@ -762,6 +881,7 @@ model_name(int model) { MOUSE_MODEL_4DPLUS, "4D+ Mouse" }, { MOUSE_MODEL_SYNAPTICS, "Synaptics Touchpad" }, { MOUSE_MODEL_TRACKPOINT, "IBM/Lenovo TrackPoint" }, + { MOUSE_MODEL_ELANTECH, "Elantech Touchpad" }, { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" }, { MOUSE_MODEL_UNKNOWN, "Unknown" }, }; @@ -1504,6 +1624,7 @@ psmattach(device_t dev) case MOUSE_MODEL_SYNAPTICS: case MOUSE_MODEL_GLIDEPOINT: case MOUSE_MODEL_VERSAPAD: + case MOUSE_MODEL_ELANTECH: sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; default: @@ -1512,6 +1633,11 @@ psmattach(device_t dev) break; } + /* Elantech trackpad`s sync bit differs from touchpad`s one */ + if (sc->hw.model == MOUSE_MODEL_ELANTECH && + (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) + sc->config |= PSM_CONFIG_NOCHECKSYNC; + if (!verbose) printf("psm%d: model %s, device ID %d\n", unit, model_name(sc->hw.model), sc->hw.hwid & 0x00ff); @@ -2165,20 +2291,6 @@ psmioctl(struct cdev *dev, u_long cmd, c (*(int *)addr > PSM_LEVEL_MAX)) return (EINVAL); sc->mode.level = *(int *)addr; - - if (sc->hw.model == MOUSE_MODEL_SYNAPTICS) { - /* - * If we are entering PSM_LEVEL_NATIVE, we want to - * enable sending of "extended W mode" packets to - * userland. Reset the mode of the touchpad so that the - * change in the level is picked up. - */ - error = block_mouse_data(sc, &command_byte); - if (error) - return (error); - synaptics_set_mode(sc, synaptics_preferred_mode(sc)); - unblock_mouse_data(sc, command_byte); - } break; case MOUSE_GETSTATUS: @@ -2339,7 +2451,7 @@ psmtimeout(void *arg) static SYSCTL_NODE(_debug, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); static SYSCTL_NODE(_hw, OID_AUTO, psm, CTLFLAG_RD, 0, "ps/2 mouse"); -SYSCTL_INT(_debug_psm, OID_AUTO, loglevel, CTLFLAG_RW, &verbose, 0, +SYSCTL_INT(_debug_psm, OID_AUTO, loglevel, CTLFLAG_RWTUN, &verbose, 0, "Verbosity level"); static int psmhz = 20; @@ -2361,7 +2473,7 @@ static int pkterrthresh = 2; SYSCTL_INT(_debug_psm, OID_AUTO, pkterrthresh, CTLFLAG_RW, &pkterrthresh, 0, "Number of error packets allowed before reinitializing the mouse"); -SYSCTL_INT(_hw_psm, OID_AUTO, tap_enabled, CTLFLAG_RW, &tap_enabled, 0, +SYSCTL_INT(_hw_psm, OID_AUTO, tap_enabled, CTLFLAG_RWTUN, &tap_enabled, 0, "Enable tap and drag gestures"); static int tap_threshold = PSM_TAP_THRESHOLD; SYSCTL_INT(_hw_psm, OID_AUTO, tap_threshold, CTLFLAG_RW, &tap_threshold, 0, @@ -2370,6 +2482,16 @@ static int tap_timeout = PSM_TAP_TIMEOUT SYSCTL_INT(_hw_psm, OID_AUTO, tap_timeout, CTLFLAG_RW, &tap_timeout, 0, "Tap timeout for touchpads"); +/* Tunables */ +SYSCTL_INT(_hw_psm, OID_AUTO, synaptics_support, CTLFLAG_RDTUN, + &synaptics_support, 0, "Enable support for Synaptics touchpads"); + +SYSCTL_INT(_hw_psm, OID_AUTO, trackpoint_support, CTLFLAG_RDTUN, + &trackpoint_support, 0, "Enable support for IBM/Lenovo TrackPoint"); + +SYSCTL_INT(_hw_psm, OID_AUTO, elantech_support, CTLFLAG_RDTUN, + &elantech_support, 0, "Enable support for Elantech touchpads"); + static void psmintr(void *arg) { @@ -2627,7 +2749,10 @@ proc_synaptics(struct psm_softc *sc, pac { static int touchpad_buttons; static int guest_buttons; - int w, x0, y0; + static finger_t f[PSM_FINGERS]; + int w, id, nfingers, ewcode, extended_buttons; + + extended_buttons = 0; /* TouchPad PS/2 absolute mode message format with capFourButtons: * @@ -2683,6 +2808,7 @@ proc_synaptics(struct psm_softc *sc, pac return (-1); *x = *y = 0; + ms->button = ms->obutton; /* * Pressure value. @@ -2718,34 +2844,80 @@ proc_synaptics(struct psm_softc *sc, pac w = 4; } - /* - * Handle packets from the guest device. See: - * Synaptics PS/2 TouchPad Interfacing Guide, Section 5.1 - */ - if (w == 3 && sc->synhw.capPassthrough) { - *x = ((pb->ipacket[1] & 0x10) ? - pb->ipacket[4] - 256 : pb->ipacket[4]); - *y = ((pb->ipacket[1] & 0x20) ? - pb->ipacket[5] - 256 : pb->ipacket[5]); - *z = 0; + switch (w) { + case 3: + /* + * Handle packets from the guest device. See: + * Synaptics PS/2 TouchPad Interfacing Guide, Section 5.1 + */ + if (sc->synhw.capPassthrough) { + *x = ((pb->ipacket[1] & 0x10) ? + pb->ipacket[4] - 256 : pb->ipacket[4]); + *y = ((pb->ipacket[1] & 0x20) ? + pb->ipacket[5] - 256 : pb->ipacket[5]); + *z = 0; + + guest_buttons = 0; + if (pb->ipacket[1] & 0x01) + guest_buttons |= MOUSE_BUTTON1DOWN; + if (pb->ipacket[1] & 0x04) + guest_buttons |= MOUSE_BUTTON2DOWN; + if (pb->ipacket[1] & 0x02) + guest_buttons |= MOUSE_BUTTON3DOWN; - guest_buttons = 0; - if (pb->ipacket[1] & 0x01) - guest_buttons |= MOUSE_BUTTON1DOWN; - if (pb->ipacket[1] & 0x04) - guest_buttons |= MOUSE_BUTTON2DOWN; - if (pb->ipacket[1] & 0x02) - guest_buttons |= MOUSE_BUTTON3DOWN; + ms->button = touchpad_buttons | guest_buttons | + sc->extended_buttons; + } + goto SYNAPTICS_END; - ms->button = touchpad_buttons | guest_buttons; + case 2: + /* Handle Extended W mode packets */ + ewcode = (pb->ipacket[5] & 0xf0) >> 4; +#if PSM_FINGERS > 1 + switch (ewcode) { + case 1: + /* Secondary finger */ + if (sc->synhw.capAdvancedGestures) + f[1] = (finger_t) { + .x = (((pb->ipacket[4] & 0x0f) << 8) | + pb->ipacket[1]) << 1, + .y = (((pb->ipacket[4] & 0xf0) << 4) | + pb->ipacket[2]) << 1, + .p = ((pb->ipacket[3] & 0x30) | + (pb->ipacket[5] & 0x0f)) << 1, + .w = PSM_FINGER_DEFAULT_W, + .flags = PSM_FINGER_FUZZY, + }; + else if (sc->synhw.capReportsV) + f[1] = (finger_t) { + .x = (((pb->ipacket[4] & 0x0f) << 8) | + (pb->ipacket[1] & 0xfe)) << 1, + .y = (((pb->ipacket[4] & 0xf0) << 4) | + (pb->ipacket[2] & 0xfe)) << 1, + .p = ((pb->ipacket[3] & 0x30) | + (pb->ipacket[5] & 0x0e)) << 1, + .w = (((pb->ipacket[5] & 0x01) << 2) | + ((pb->ipacket[2] & 0x01) << 1) | + (pb->ipacket[1] & 0x01)) + 8, + .flags = PSM_FINGER_FUZZY, + }; + default: + break; + } +#endif goto SYNAPTICS_END; + + case 1: + case 0: + nfingers = w + 2; + break; + + default: + nfingers = 1; } - if (sc->syninfo.touchpad_off) { - *x = *y = *z = 0; - ms->button = ms->obutton; + if (sc->syninfo.touchpad_off) goto SYNAPTICS_END; - } /* Button presses */ touchpad_buttons = 0; @@ -2769,21 +2941,21 @@ proc_synaptics(struct psm_softc *sc, pac if ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x02) { if (sc->syninfo.directional_scrolls) { if (pb->ipacket[4] & 0x01) - touchpad_buttons |= MOUSE_BUTTON4DOWN; + extended_buttons |= MOUSE_BUTTON4DOWN; if (pb->ipacket[5] & 0x01) - touchpad_buttons |= MOUSE_BUTTON5DOWN; + extended_buttons |= MOUSE_BUTTON5DOWN; if (pb->ipacket[4] & 0x02) - touchpad_buttons |= MOUSE_BUTTON6DOWN; + extended_buttons |= MOUSE_BUTTON6DOWN; if (pb->ipacket[5] & 0x02) - touchpad_buttons |= MOUSE_BUTTON7DOWN; + extended_buttons |= MOUSE_BUTTON7DOWN; } else { if (pb->ipacket[4] & 0x01) - touchpad_buttons |= MOUSE_BUTTON1DOWN; + extended_buttons |= MOUSE_BUTTON1DOWN; if (pb->ipacket[5] & 0x01) - touchpad_buttons |= MOUSE_BUTTON3DOWN; + extended_buttons |= MOUSE_BUTTON3DOWN; if (pb->ipacket[4] & 0x02) - touchpad_buttons |= MOUSE_BUTTON2DOWN; - sc->extended_buttons = touchpad_buttons; + extended_buttons |= MOUSE_BUTTON2DOWN; + sc->extended_buttons = extended_buttons; } /* @@ -2806,101 +2978,193 @@ proc_synaptics(struct psm_softc *sc, pac pb->ipacket[4] &= ~(mask); pb->ipacket[5] &= ~(mask); } else if (!sc->syninfo.directional_scrolls && - !sc->synaction.in_vscroll) { + !sc->gesture.in_vscroll) { /* * Keep reporting MOUSE DOWN until we get a new packet * indicating otherwise. */ - touchpad_buttons |= sc->extended_buttons; + extended_buttons |= sc->extended_buttons; } } - /* Handle ClickPad. */ + /* Handle ClickPad */ if (sc->synhw.capClickPad && ((pb->ipacket[0] ^ pb->ipacket[3]) & 0x01)) touchpad_buttons |= MOUSE_BUTTON1DOWN; - ms->button = touchpad_buttons | guest_buttons; + if (sc->synhw.capReportsV && nfingers > 1) + f[0] = (finger_t) { + .x = ((pb->ipacket[3] & 0x10) << 8) | + ((pb->ipacket[1] & 0x0f) << 8) | + (pb->ipacket[4] & 0xfd), + .y = ((pb->ipacket[3] & 0x20) << 7) | + ((pb->ipacket[1] & 0xf0) << 4) | + (pb->ipacket[5] & 0xfd), + .p = *z & 0xfe, + .w = (((pb->ipacket[2] & 0x01) << 2) | + (pb->ipacket[5] & 0x02) | + ((pb->ipacket[4] & 0x02) >> 1)) + 8, + .flags = PSM_FINGER_FUZZY, + }; + else + f[0] = (finger_t) { + .x = ((pb->ipacket[3] & 0x10) << 8) | + ((pb->ipacket[1] & 0x0f) << 8) | + pb->ipacket[4], + .y = ((pb->ipacket[3] & 0x20) << 7) | + ((pb->ipacket[1] & 0xf0) << 4) | + pb->ipacket[5], + .p = *z, + .w = w, + .flags = nfingers > 1 ? PSM_FINGER_FUZZY : 0, + }; + + /* Ignore hovering and unmeasurable touches */ + if (f[0].p < sc->syninfo.min_pressure || f[0].x < 2) + nfingers = 0; + + for (id = 0; id < PSM_FINGERS; id++) + if (id >= nfingers) + PSM_FINGER_RESET(f[id]); + + ms->button = touchpad_buttons; + + /* Palm detection doesn't terminate the current action. */ + if (!psmpalmdetect(sc, &f[0], nfingers)) { + psmgestures(sc, &f[0], nfingers, ms); + for (id = 0; id < PSM_FINGERS; id++) + psmsmoother(sc, &f[id], id, ms, x, y); + } else { + VLOG(2, (LOG_DEBUG, "synaptics: palm detected! (%d)\n", f[0].w)); + } + + ms->button |= extended_buttons | guest_buttons; + +SYNAPTICS_END: + /* + * Use the extra buttons as a scrollwheel + * + * XXX X.Org uses the Z axis for vertical wheel only, + * whereas moused(8) understands special values to differ + * vertical and horizontal wheels. + * + * xf86-input-mouse needs therefore a small patch to + * understand these special values. Without it, the + * horizontal wheel acts as a vertical wheel in X.Org. + * + * That's why the horizontal wheel is disabled by + * default for now. + */ + if (ms->button & MOUSE_BUTTON4DOWN) + *z = -1; + else if (ms->button & MOUSE_BUTTON5DOWN) + *z = 1; + else if (ms->button & MOUSE_BUTTON6DOWN) + *z = -2; + else if (ms->button & MOUSE_BUTTON7DOWN) + *z = 2; + else + *z = 0; + ms->button &= ~(MOUSE_BUTTON4DOWN | MOUSE_BUTTON5DOWN | + MOUSE_BUTTON6DOWN | MOUSE_BUTTON7DOWN); + + return (0); +} + +static int +psmpalmdetect(struct psm_softc *sc, finger_t *f, int nfingers) +{ + if (!( + ((sc->synhw.capMultiFinger || + sc->synhw.capAdvancedGestures) && nfingers > 1) || + (sc->synhw.capPalmDetect && f->w <= sc->syninfo.max_width) || + (!sc->synhw.capPalmDetect && f->p <= sc->syninfo.max_pressure) || + (sc->synhw.capPen && f->flags & PSM_FINGER_IS_PEN))) { + /* + * We consider the packet irrelevant for the current + * action when: + * - the width isn't comprised in: + * [1; max_width] + * - the pressure isn't comprised in: + * [min_pressure; max_pressure] + * - pen aren't supported but PSM_FINGER_IS_PEN is set + */ + return (1); + } + return (0); +} + +static void +psmgestures(struct psm_softc *sc, finger_t *fingers, int nfingers, + mousestatus_t *ms) +{ + smoother_t *smoother; + gesture_t *gest; + finger_t *f; + int y_ok, center_button, center_x, right_button, right_x, i; + + f = &fingers[0]; + smoother = &sc->smoother[0]; + gest = &sc->gesture; + + /* Find first active finger. */ + if (nfingers > 0) { + for (i = 0; i < PSM_FINGERS; i++) { + if (PSM_FINGER_IS_SET(fingers[i])) { + f = &fingers[i]; + smoother = &sc->smoother[i]; + break; + } + } + } /* * Check pressure to detect a real wanted action on the * touchpad. */ - if (*z >= sc->syninfo.min_pressure) { - synapticsaction_t *synaction; - int cursor, peer, window; - int dx, dy, dxp, dyp; - int max_width, max_pressure; + if (f->p >= sc->syninfo.min_pressure) { + int x0, y0; + int dxp, dyp; + int start_x, start_y; + int queue_len; int margin_top, margin_right, margin_bottom, margin_left; - int na_top, na_right, na_bottom, na_left; int window_min, window_max; - int multiplicator; - int weight_current, weight_previous, weight_len_squared; - int div_min, div_max, div_len; int vscroll_hor_area, vscroll_ver_area; int two_finger_scroll; - int len, weight_prev_x, weight_prev_y; - int div_max_x, div_max_y, div_x, div_y; - int exiting_scroll; + int max_x, max_y; /* Read sysctl. */ /* XXX Verify values? */ - max_width = sc->syninfo.max_width; - max_pressure = sc->syninfo.max_pressure; margin_top = sc->syninfo.margin_top; margin_right = sc->syninfo.margin_right; margin_bottom = sc->syninfo.margin_bottom; margin_left = sc->syninfo.margin_left; - na_top = sc->syninfo.na_top; - na_right = sc->syninfo.na_right; - na_bottom = sc->syninfo.na_bottom; - na_left = sc->syninfo.na_left; window_min = sc->syninfo.window_min; window_max = sc->syninfo.window_max; - multiplicator = sc->syninfo.multiplicator; - weight_current = sc->syninfo.weight_current; - weight_previous = sc->syninfo.weight_previous; - weight_len_squared = sc->syninfo.weight_len_squared; - div_min = sc->syninfo.div_min; - div_max = sc->syninfo.div_max; - div_len = sc->syninfo.div_len; vscroll_hor_area = sc->syninfo.vscroll_hor_area; vscroll_ver_area = sc->syninfo.vscroll_ver_area; two_finger_scroll = sc->syninfo.two_finger_scroll; - - exiting_scroll = 0; - - /* Palm detection. */ - if (!( - ((sc->synhw.capMultiFinger || - sc->synhw.capAdvancedGestures) && (w == 0 || w == 1)) || - (sc->synhw.capPalmDetect && w >= 4 && w <= max_width) || - (!sc->synhw.capPalmDetect && *z <= max_pressure) || - (sc->synhw.capPen && w == 2))) { - /* - * We consider the packet irrelevant for the current - * action when: - * - the width isn't comprised in: - * [4; max_width] - * - the pressure isn't comprised in: - * [min_pressure; max_pressure] - * - pen aren't supported but w is 2 - * - * Note that this doesn't terminate the current action. - */ - VLOG(2, (LOG_DEBUG, - "synaptics: palm detected! (%d)\n", w)); - goto SYNAPTICS_END; - } + max_x = sc->syninfo.max_x; + max_y = sc->syninfo.max_y; /* Read current absolute position. */ - x0 = ((pb->ipacket[3] & 0x10) << 8) | - ((pb->ipacket[1] & 0x0f) << 8) | - pb->ipacket[4]; - y0 = ((pb->ipacket[3] & 0x20) << 7) | - ((pb->ipacket[1] & 0xf0) << 4) | - pb->ipacket[5]; + x0 = f->x; + y0 = f->y; + + /* + * Limit the coordinates to the specified margins because + * this area isn't very reliable. + */ + if (x0 <= margin_left) + x0 = margin_left; + else if (x0 >= max_x - margin_right) + x0 = max_x - margin_right; + if (y0 <= margin_bottom) + y0 = margin_bottom; + else if (y0 >= max_y - margin_top) + y0 = max_y - margin_top; - synaction = &(sc->synaction); + VLOG(3, (LOG_DEBUG, "synaptics: ipacket: [%d, %d], %d, %d\n", + x0, y0, f->p, f->w)); /* * If the action is just beginning, init the structure and @@ -2909,107 +3173,82 @@ proc_synaptics(struct psm_softc *sc, pac if (!(sc->flags & PSM_FLAGS_FINGERDOWN)) { VLOG(3, (LOG_DEBUG, "synaptics: ----\n")); - /* Store the first point of this action. */ - synaction->start_x = x0; - synaction->start_y = y0; - dx = dy = 0; - /* Initialize queue. */ - synaction->queue_cursor = SYNAPTICS_PACKETQUEUE; - synaction->queue_len = 0; - synaction->window_min = window_min; - - /* Reset average. */ - synaction->avg_dx = 0; - synaction->avg_dy = 0; - - /* Reset squelch. */ - synaction->squelch_x = 0; - synaction->squelch_y = 0; + gest->window_min = window_min; /* Reset pressure peak. */ - sc->zmax = 0; + gest->zmax = 0; /* Reset fingers count. */ - synaction->fingers_nb = 0; + gest->fingers_nb = 0; /* Reset virtual scrolling state. */ - synaction->in_vscroll = 0; + gest->in_vscroll = 0; /* Compute tap timeout. */ - sc->taptimeout.tv_sec = tap_timeout / 1000000; - sc->taptimeout.tv_usec = tap_timeout % 1000000; - timevaladd(&sc->taptimeout, &sc->lastsoftintr); + gest->taptimeout.tv_sec = tap_timeout / 1000000; + gest->taptimeout.tv_usec = tap_timeout % 1000000; + timevaladd(&gest->taptimeout, &sc->lastsoftintr); sc->flags |= PSM_FLAGS_FINGERDOWN; + + /* Smoother has not been reset yet */ + queue_len = 1; + start_x = x0; + start_y = y0; } else { - /* Calculate the current delta. */ - cursor = synaction->queue_cursor; - dx = x0 - synaction->queue[cursor].x; - dy = y0 - synaction->queue[cursor].y; + queue_len = smoother->queue_len + 1; + start_x = smoother->start_x; + start_y = smoother->start_y; } - /* If in tap-hold, add the recorded button. */ - if (synaction->in_taphold) - ms->button |= synaction->tap_button; - - /* - * From now on, we can use the SYNAPTICS_END label to skip - * the current packet. - */ - - /* - * Limit the coordinates to the specified margins because - * this area isn't very reliable. - */ - if (x0 <= margin_left) - x0 = margin_left; - else if (x0 >= 6143 - margin_right) - x0 = 6143 - margin_right; - if (y0 <= margin_bottom) - y0 = margin_bottom; - else if (y0 >= 6143 - margin_top) - y0 = 6143 - margin_top; + /* Process ClickPad softbuttons */ + if (sc->synhw.capClickPad && ms->button & MOUSE_BUTTON1DOWN) { + y_ok = sc->syninfo.softbuttons_y >= 0 ? + start_y < sc->syninfo.softbuttons_y : + start_y > max_y - sc->syninfo.softbuttons_y; + + center_button = MOUSE_BUTTON2DOWN; + center_x = sc->syninfo.softbutton2_x; + right_button = MOUSE_BUTTON3DOWN; + right_x = sc->syninfo.softbutton3_x; + + if (center_x > 0 && right_x > 0 && center_x > right_x) { + center_button = MOUSE_BUTTON3DOWN; + center_x = sc->syninfo.softbutton3_x; + right_button = MOUSE_BUTTON2DOWN; + right_x = sc->syninfo.softbutton2_x; + } - VLOG(3, (LOG_DEBUG, "synaptics: ipacket: [%d, %d], %d, %d\n", - x0, y0, *z, w)); + if (right_x > 0 && start_x > right_x && y_ok) + ms->button = (ms->button & + ~MOUSE_BUTTON1DOWN) | right_button; + else if (center_x > 0 && start_x > center_x && y_ok) + ms->button = (ms->button & + ~MOUSE_BUTTON1DOWN) | center_button; + } - /* Queue this new packet. */ - cursor = SYNAPTICS_QUEUE_CURSOR(synaction->queue_cursor - 1); - synaction->queue[cursor].x = x0; - synaction->queue[cursor].y = y0; - synaction->queue_cursor = cursor; - if (synaction->queue_len < SYNAPTICS_PACKETQUEUE) - synaction->queue_len++; - VLOG(5, (LOG_DEBUG, - "synaptics: cursor[%d]: x=%d, y=%d, dx=%d, dy=%d\n", - cursor, x0, y0, dx, dy)); + /* If in tap-hold, add the recorded button. */ + if (gest->in_taphold) + ms->button |= gest->tap_button; /* * For tap, we keep the maximum number of fingers and the * pressure peak. Also with multiple fingers, we increase * the minimum window. */ - switch (w) { - case 1: /* Three or more fingers. */ - synaction->fingers_nb = imax(3, synaction->fingers_nb); - synaction->window_min = window_max; - break; - case 0: /* Two fingers. */ - synaction->fingers_nb = imax(2, synaction->fingers_nb); - synaction->window_min = window_max; - break; - default: /* One finger or undetectable. */ - synaction->fingers_nb = imax(1, synaction->fingers_nb); - } - sc->zmax = imax(*z, sc->zmax); - - /* Do we have enough packets to consider this a movement? */ - if (synaction->queue_len < synaction->window_min) - goto SYNAPTICS_END; + if (nfingers > 1) + gest->window_min = window_max; + gest->fingers_nb = imax(nfingers, gest->fingers_nb); + gest->zmax = imax(f->p, gest->zmax); + + /* Do we have enough packets to consider this a gesture? */ + if (queue_len < gest->window_min) + return; /* Is a scrolling action occurring? */ - if (!synaction->in_taphold && !synaction->in_vscroll) { + if (!gest->in_taphold && !ms->button && + (!gest->in_vscroll || two_finger_scroll)) { /* * A scrolling action must not conflict with a tap * action. Here are the conditions to consider a @@ -3020,12 +3259,10 @@ proc_synaptics(struct psm_softc *sc, pac * first should be above a configurable minimum * . tap timed out */ - dxp = abs(synaction->queue[synaction->queue_cursor].x - - synaction->start_x); - dyp = abs(synaction->queue[synaction->queue_cursor].y - - synaction->start_y); + dxp = abs(x0 - start_x); + dyp = abs(y0 - start_y); - if (timevalcmp(&sc->lastsoftintr, &sc->taptimeout, >) || + if (timevalcmp(&sc->lastsoftintr, &gest->taptimeout, >) || dxp >= sc->syninfo.vscroll_min_delta || dyp >= sc->syninfo.vscroll_min_delta) { /* @@ -3034,176 +3271,65 @@ proc_synaptics(struct psm_softc *sc, pac * as that keeps the maximum number of fingers. */ if (two_finger_scroll) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Oct 18 21:17:32 2016 Return-Path: Delivered-To: svn-src-all@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 9BAB2C17885; Tue, 18 Oct 2016 21:17:32 +0000 (UTC) (envelope-from avos@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 6DB80B24; Tue, 18 Oct 2016 21:17:32 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ILHVmL087006; Tue, 18 Oct 2016 21:17:31 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ILHVGS087004; Tue, 18 Oct 2016 21:17:31 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201610182117.u9ILHVGS087004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 18 Oct 2016 21:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307577 - head/sys/dev/rtwn/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 21:17:32 -0000 Author: avos Date: Tue Oct 18 21:17:31 2016 New Revision: 307577 URL: https://svnweb.freebsd.org/changeset/base/307577 Log: rtwn(4): fix build with 'options IEEE80211_SUPPORT_SUPERG' Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c head/sys/dev/rtwn/usb/rtwn_usb_tx.c Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Oct 18 20:17:57 2016 (r307576) +++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Oct 18 21:17:31 2016 (r307577) @@ -216,7 +216,7 @@ rtwn_report_intr(struct rtwn_usb_softc * * NB: this will executed only when 'report' bit is set. */ if (sc->sc_tx_n_active > 0 && --sc->sc_tx_n_active <= 1) - rtwn_cmd_sleepable(uc, NULL, 0, rtwn_ff_flush_all); + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); #endif break; case RTWN_RX_OTHER: @@ -327,7 +327,7 @@ finish: */ #ifdef IEEE80211_SUPPORT_SUPERG if (!(sc->sc_flags & RTWN_FW_LOADED)) - rtwn_cmd_sleepable(uc, NULL, 0, rtwn_ff_flush_all); + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); #endif /* Kick-start more transmit in case we stalled */ Modified: head/sys/dev/rtwn/usb/rtwn_usb_tx.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Oct 18 20:17:57 2016 (r307576) +++ head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Oct 18 21:17:31 2016 (r307577) @@ -207,7 +207,7 @@ finish: * XXX TODO: just make this a callout timer schedule so we can * flush the FF staging queue if we're approaching idle. */ - rtwn_cmd_sleepable(uc, NULL, 0, rtwn_ff_flush_all); + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); } #endif /* Kick-start more transmit */ From owner-svn-src-all@freebsd.org Tue Oct 18 21:33:58 2016 Return-Path: Delivered-To: svn-src-all@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 8315CC17DA2; Tue, 18 Oct 2016 21:33:58 +0000 (UTC) (envelope-from davidcs@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 518749B4; Tue, 18 Oct 2016 21:33:58 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9ILXvbC094396; Tue, 18 Oct 2016 21:33:57 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9ILXvJ8094393; Tue, 18 Oct 2016 21:33:57 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201610182133.u9ILXvJ8094393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 18 Oct 2016 21:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307578 - head/sys/dev/bxe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 21:33:58 -0000 Author: davidcs Date: Tue Oct 18 21:33:57 2016 New Revision: 307578 URL: https://svnweb.freebsd.org/changeset/base/307578 Log: 1. Use taskqueue_create() instead of taskqueue_create_fast() for both fastpath and slowpath taskqueues. 2. Service all transmits in taskqueue threads. 3. additional stats counters for keeping track of - bd availability - tx buf ring not emptied in the fp task queue. These are drained via timeout taskqueue. - tx attempts during link down. MFC after: 5 days Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe.h head/sys/dev/bxe/bxe_stats.h Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Tue Oct 18 21:17:31 2016 (r307577) +++ head/sys/dev/bxe/bxe.c Tue Oct 18 21:33:57 2016 (r307578) @@ -27,7 +27,7 @@ #include __FBSDID("$FreeBSD$"); -#define BXE_DRIVER_VERSION "1.78.81" +#define BXE_DRIVER_VERSION "1.78.89" #include "bxe.h" #include "ecore_sp.h" @@ -489,7 +489,14 @@ static const struct { { STATS_OFFSET32(mbuf_alloc_tpa), 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}, { STATS_OFFSET32(tx_queue_full_return), - 4, STATS_FLAGS_FUNC, "tx_queue_full_return"} + 4, STATS_FLAGS_FUNC, "tx_queue_full_return"}, + { STATS_OFFSET32(tx_request_link_down_failures), + 4, STATS_FLAGS_FUNC, "tx_request_link_down_failures"}, + { STATS_OFFSET32(bd_avail_too_less_failures), + 4, STATS_FLAGS_FUNC, "bd_avail_too_less_failures"}, + { STATS_OFFSET32(tx_mq_not_empty), + 4, STATS_FLAGS_FUNC, "tx_mq_not_empty"} + }; static const struct { @@ -602,7 +609,14 @@ static const struct { { Q_STATS_OFFSET32(mbuf_alloc_tpa), 4, "mbuf_alloc_tpa"}, { Q_STATS_OFFSET32(tx_queue_full_return), - 4, "tx_queue_full_return"} + 4, "tx_queue_full_return"}, + { Q_STATS_OFFSET32(tx_request_link_down_failures), + 4, "tx_request_link_down_failures"}, + { Q_STATS_OFFSET32(bd_avail_too_less_failures), + 4, "bd_avail_too_less_failures"}, + { Q_STATS_OFFSET32(tx_mq_not_empty), + 4, "tx_mq_not_empty"} + }; #define BXE_NUM_ETH_STATS ARRAY_SIZE(bxe_eth_stats_arr) @@ -5599,7 +5613,7 @@ bxe_tx_start(if_t ifp) BXE_FP_TX_UNLOCK(fp); } -#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 901504 static int bxe_tx_mq_start_locked(struct bxe_softc *sc, @@ -5621,11 +5635,16 @@ bxe_tx_mq_start_locked(struct bxe_softc return (EINVAL); } - if (!sc->link_vars.link_up || - (if_getdrvflags(ifp) & - (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) { - if (m != NULL) - rc = drbr_enqueue(ifp, tx_br, m); + if (m != NULL) { + rc = drbr_enqueue(ifp, tx_br, m); + if (rc != 0) { + fp->eth_q_stats.tx_soft_errors++; + goto bxe_tx_mq_start_locked_exit; + } + } + + if (!sc->link_vars.link_up || !(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + fp->eth_q_stats.tx_request_link_down_failures++; goto bxe_tx_mq_start_locked_exit; } @@ -5635,24 +5654,22 @@ bxe_tx_mq_start_locked(struct bxe_softc fp->eth_q_stats.tx_max_drbr_queue_depth = depth; } - if (m == NULL) { - /* no new work, check for pending frames */ - next = drbr_dequeue_drv(ifp, tx_br); - } else if (drbr_needs_enqueue_drv(ifp, tx_br)) { - /* have both new and pending work, maintain packet order */ - rc = drbr_enqueue(ifp, tx_br, m); - if (rc != 0) { - fp->eth_q_stats.tx_soft_errors++; - goto bxe_tx_mq_start_locked_exit; - } - next = drbr_dequeue_drv(ifp, tx_br); - } else { - /* new work only and nothing pending */ - next = m; - } - /* keep adding entries while there are frames to send */ - while (next != NULL) { + while ((next = drbr_peek(ifp, tx_br)) != NULL) { + /* handle any completions if we're running low */ + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail < BXE_TX_CLEANUP_THRESHOLD) { + /* bxe_txeof will set IFF_DRV_OACTIVE appropriately */ + bxe_txeof(sc, fp); + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail < (BXE_TSO_MAX_SEGMENTS + 1)) { + fp->eth_q_stats.bd_avail_too_less_failures++; + m_freem(next); + drbr_advance(ifp, tx_br); + rc = ENOBUFS; + break; + } + } /* the mbuf now belongs to us */ fp->eth_q_stats.mbuf_alloc_tx++; @@ -5668,11 +5685,11 @@ bxe_tx_mq_start_locked(struct bxe_softc if (next != NULL) { /* mark the TX queue as full and save the frame */ if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); - /* XXX this may reorder the frame */ - rc = drbr_enqueue(ifp, tx_br, next); + drbr_putback(ifp, tx_br, next); fp->eth_q_stats.mbuf_alloc_tx--; fp->eth_q_stats.tx_frames_deferred++; - } + } else + drbr_advance(ifp, tx_br); /* stop looking for more work */ break; @@ -5684,18 +5701,7 @@ bxe_tx_mq_start_locked(struct bxe_softc /* send a copy of the frame to any BPF listeners */ if_etherbpfmtap(ifp, next); - tx_bd_avail = bxe_tx_avail(sc, fp); - - /* handle any completions if we're running low */ - if (tx_bd_avail < BXE_TX_CLEANUP_THRESHOLD) { - /* bxe_txeof will set IFF_DRV_OACTIVE appropriately */ - bxe_txeof(sc, fp); - if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE) { - break; - } - } - - next = drbr_dequeue_drv(ifp, tx_br); + drbr_advance(ifp, tx_br); } /* all TX packets were dequeued and/or the tx ring is full */ @@ -5705,10 +5711,28 @@ bxe_tx_mq_start_locked(struct bxe_softc } bxe_tx_mq_start_locked_exit: + /* If we didn't drain the drbr, enqueue a task in the future to do it. */ + if (!drbr_empty(ifp, tx_br)) { + fp->eth_q_stats.tx_mq_not_empty++; + taskqueue_enqueue_timeout(fp->tq, &fp->tx_timeout_task, 1); + } return (rc); } +static void +bxe_tx_mq_start_deferred(void *arg, + int pending) +{ + struct bxe_fastpath *fp = (struct bxe_fastpath *)arg; + struct bxe_softc *sc = fp->sc; + if_t ifp = sc->ifp; + + BXE_FP_TX_LOCK(fp); + bxe_tx_mq_start_locked(sc, ifp, fp, NULL); + BXE_FP_TX_UNLOCK(fp); +} + /* Multiqueue (TSS) dispatch routine. */ static int bxe_tx_mq_start(struct ifnet *ifp, @@ -5730,8 +5754,10 @@ bxe_tx_mq_start(struct ifnet *ifp, if (BXE_FP_TX_TRYLOCK(fp)) { rc = bxe_tx_mq_start_locked(sc, ifp, fp, m); BXE_FP_TX_UNLOCK(fp); - } else + } else { rc = drbr_enqueue(ifp, fp->tx_br, m); + taskqueue_enqueue(fp->tq, &fp->tx_task); + } return (rc); } @@ -5766,7 +5792,7 @@ bxe_mq_flush(struct ifnet *ifp) if_qflush(ifp); } -#endif /* FreeBSD_version >= 800000 */ +#endif /* FreeBSD_version >= 901504 */ static uint16_t bxe_cid_ilt_lines(struct bxe_softc *sc) @@ -6126,7 +6152,7 @@ bxe_free_fp_buffers(struct bxe_softc *sc for (i = 0; i < sc->num_queues; i++) { fp = &sc->fp[i]; -#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 901504 if (fp->tx_br != NULL) { /* just in case bxe_mq_flush() wasn't called */ if (mtx_initialized(&fp->tx_mtx)) { @@ -6953,6 +6979,8 @@ bxe_link_attn(struct bxe_softc *sc) uint32_t pause_enabled = 0; struct host_port_stats *pstats; int cmng_fns; + struct bxe_fastpath *fp; + int i; /* Make sure that we are synced with the current statistics */ bxe_stats_handle(sc, STATS_EVENT_STOP); @@ -6984,6 +7012,12 @@ bxe_link_attn(struct bxe_softc *sc) if (sc->state == BXE_STATE_OPEN) { bxe_stats_handle(sc, STATS_EVENT_LINK_UP); } + + /* Restart tx when the link comes back. */ + FOR_EACH_ETH_QUEUE(sc, i) { + fp = &sc->fp[i]; + taskqueue_enqueue(fp->tq, &fp->tx_task); + } } if (sc->link_vars.link_up && sc->link_vars.line_speed) { @@ -9035,6 +9069,10 @@ bxe_interrupt_detach(struct bxe_softc *s fp = &sc->fp[i]; if (fp->tq) { taskqueue_drain(fp->tq, &fp->tq_task); + taskqueue_drain(fp->tq, &fp->tx_task); + while (taskqueue_cancel_timeout(fp->tq, &fp->tx_timeout_task, + NULL)) + taskqueue_drain_timeout(fp->tq, &fp->tx_timeout_task); taskqueue_free(fp->tq); fp->tq = NULL; } @@ -9067,9 +9105,9 @@ bxe_interrupt_attach(struct bxe_softc *s snprintf(sc->sp_tq_name, sizeof(sc->sp_tq_name), "bxe%d_sp_tq", sc->unit); TASK_INIT(&sc->sp_tq_task, 0, bxe_handle_sp_tq, sc); - sc->sp_tq = taskqueue_create_fast(sc->sp_tq_name, M_NOWAIT, - taskqueue_thread_enqueue, - &sc->sp_tq); + sc->sp_tq = taskqueue_create(sc->sp_tq_name, M_NOWAIT, + taskqueue_thread_enqueue, + &sc->sp_tq); taskqueue_start_threads(&sc->sp_tq, 1, PWAIT, /* lower priority */ "%s", sc->sp_tq_name); @@ -9079,9 +9117,12 @@ bxe_interrupt_attach(struct bxe_softc *s snprintf(fp->tq_name, sizeof(fp->tq_name), "bxe%d_fp%d_tq", sc->unit, i); TASK_INIT(&fp->tq_task, 0, bxe_handle_fp_tq, fp); - fp->tq = taskqueue_create_fast(fp->tq_name, M_NOWAIT, - taskqueue_thread_enqueue, - &fp->tq); + TASK_INIT(&fp->tx_task, 0, bxe_tx_mq_start_deferred, fp); + fp->tq = taskqueue_create(fp->tq_name, M_NOWAIT, + taskqueue_thread_enqueue, + &fp->tq); + TIMEOUT_TASK_INIT(fp->tq, &fp->tx_timeout_task, 0, + bxe_tx_mq_start_deferred, fp); taskqueue_start_threads(&fp->tq, 1, PI_NET, /* higher priority */ "%s", fp->tq_name); } @@ -12114,8 +12155,6 @@ static void bxe_periodic_callout_func(void *xsc) { struct bxe_softc *sc = (struct bxe_softc *)xsc; - struct bxe_fastpath *fp; - uint16_t tx_bd_avail; int i; if (!BXE_CORE_TRYLOCK(sc)) { @@ -12136,49 +12175,8 @@ bxe_periodic_callout_func(void *xsc) BLOGW(sc, "periodic callout exit (state=0x%x)\n", sc->state); BXE_CORE_UNLOCK(sc); return; - } - -#if __FreeBSD_version >= 800000 - - FOR_EACH_QUEUE(sc, i) { - fp = &sc->fp[i]; - - if (BXE_FP_TX_TRYLOCK(fp)) { - if_t ifp = sc->ifp; - /* - * If interface was stopped due to unavailable - * bds, try to process some tx completions - */ - (void) bxe_txeof(sc, fp); - - tx_bd_avail = bxe_tx_avail(sc, fp); - if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { - bxe_tx_mq_start_locked(sc, ifp, fp, NULL); - } - BXE_FP_TX_UNLOCK(fp); - } - } - -#else - - fp = &sc->fp[0]; - if (BXE_FP_TX_TRYLOCK(fp)) { - struct ifnet *ifp = sc->ifnet; - /* - * If interface was stopped due to unavailable - * bds, try to process some tx completions - */ - (void) bxe_txeof(sc, fp); - - tx_bd_avail = bxe_tx_avail(sc, fp); - if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { - bxe_tx_start_locked(sc, ifp, fp); } - - BXE_FP_TX_UNLOCK(fp); - } -#endif /* #if __FreeBSD_version >= 800000 */ /* Check for TX timeouts on any fastpath. */ FOR_EACH_QUEUE(sc, i) { @@ -12656,7 +12654,7 @@ bxe_init_ifnet(struct bxe_softc *sc) if_setioctlfn(ifp, bxe_ioctl); if_setstartfn(ifp, bxe_tx_start); if_setgetcounterfn(ifp, bxe_get_counter); -#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 901504 if_settransmitfn(ifp, bxe_tx_mq_start); if_setqflushfn(ifp, bxe_mq_flush); #endif @@ -15699,7 +15697,7 @@ bxe_add_sysctls(struct bxe_softc *sc) static int bxe_alloc_buf_rings(struct bxe_softc *sc) { -#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 901504 int i; struct bxe_fastpath *fp; @@ -15720,7 +15718,7 @@ bxe_alloc_buf_rings(struct bxe_softc *sc static void bxe_free_buf_rings(struct bxe_softc *sc) { -#if __FreeBSD_version >= 800000 +#if __FreeBSD_version >= 901504 int i; struct bxe_fastpath *fp; Modified: head/sys/dev/bxe/bxe.h ============================================================================== --- head/sys/dev/bxe/bxe.h Tue Oct 18 21:17:31 2016 (r307577) +++ head/sys/dev/bxe/bxe.h Tue Oct 18 21:33:57 2016 (r307578) @@ -644,6 +644,9 @@ struct bxe_fastpath { struct taskqueue *tq; char tq_name[32]; + struct task tx_task; + struct timeout_task tx_timeout_task; + /* ethernet client ID (each fastpath set of RX/TX/CQE is a client) */ uint8_t cl_id; #define FP_CL_ID(fp) (fp->cl_id) @@ -2300,7 +2303,8 @@ void bxe_dump_mbuf_data(struct bxe_softc extern int bxe_grc_dump(struct bxe_softc *sc); #if __FreeBSD_version >= 800000 -#if __FreeBSD_version >= 1000000 +#if (__FreeBSD_version >= 1001513 && __FreeBSD_version < 1100000) ||\ + __FreeBSD_version >= 1100048 #define BXE_SET_FLOWID(m) M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE) #define BXE_VALID_FLOWID(m) (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) #else Modified: head/sys/dev/bxe/bxe_stats.h ============================================================================== --- head/sys/dev/bxe/bxe_stats.h Tue Oct 18 21:17:31 2016 (r307577) +++ head/sys/dev/bxe/bxe_stats.h Tue Oct 18 21:33:57 2016 (r307578) @@ -266,6 +266,10 @@ struct bxe_eth_stats { /* num. of times tx queue full occurred */ uint32_t tx_queue_full_return; + /* debug stats */ + uint32_t tx_request_link_down_failures; + uint32_t bd_avail_too_less_failures; + uint32_t tx_mq_not_empty; }; @@ -372,6 +376,11 @@ struct bxe_eth_q_stats { /* num. of times tx queue full occurred */ uint32_t tx_queue_full_return; + + /* debug stats */ + uint32_t tx_request_link_down_failures; + uint32_t bd_avail_too_less_failures; + uint32_t tx_mq_not_empty; }; struct bxe_eth_stats_old { From owner-svn-src-all@freebsd.org Tue Oct 18 22:11:57 2016 Return-Path: Delivered-To: svn-src-all@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 87F61C1785D; Tue, 18 Oct 2016 22:11:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x230.google.com (mail-qk0-x230.google.com [IPv6:2607:f8b0:400d:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 437C5C16; Tue, 18 Oct 2016 22:11:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x230.google.com with SMTP id f128so10036834qkb.1; Tue, 18 Oct 2016 15:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=TIvQ3qYsDAThKXLyZ6MGj4rHmAaq9jOd243fJ3ZJ5yo=; b=ScsmUHd32tLV5YAgqwDh2KsVDOqTFxJuWpURFKfooD74qNZZFoCEvPEQHCEdgI6rNI lfeNzBjQ/C1H3k+RGm3Lm1VvHntKbLXtVPKPNODAC4qGYQFtA0lh4TSUyUGGJGvx1u// cF25aqCq7OK/TX7psAh54n3fWs2XSU/7IPQiRLILtmnd/W8MY3HiltGONRDCylOFz5f6 WUZsy5OSerEUC5RHRK6lkTwO/AepeYg9z/DX4veCjua9yHtH8Bl7LLEKsRS+i1SJEzjv Drpn5/dzPH45oqd0Ux5isBpfkfQ++sGH6kjbOS5nDC3R6BBotHrQCF50dexh55EhsEYt iBbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TIvQ3qYsDAThKXLyZ6MGj4rHmAaq9jOd243fJ3ZJ5yo=; b=QEcd5i+2Fe772VvRU013lzwUG0AJpfVaD7WbBgmnpEJDoiRnUJkHFdUqJsWQ/H3v1+ ssLRVoVeh9hAYDmjd1RdSvPnIo7+KXeXELyl7zvuiwBkymfZuvOcXxbFBPqJFPVhQ6FB ZxM4JYkxLARjYbAO4OCRoXne8az7vIBmcdxx6runQC3itj+G+aV0BP6bTsvpsKwh3jLL IgYOAqE5SW2lj6FS3ZPkumYAPV/clczc1fGS3fNRUBlbty11UtdJ5Hts56oSXl4Qing7 DrxxUjZFp2t5HTVBfNR3TJYtn39C3yYfsuNWZWGz1SM3ck72f+Bl/D6nZAzX3WuQdUOV GiZg== X-Gm-Message-State: AA6/9RlgX6Xdgh8+CMZaOP64xdmVK8KXR5p9lmMjty5Yin0K+QA6XbutQxx9K/TCmhD+fhOIhKX19K0ZoOEMeg== X-Received: by 10.55.41.39 with SMTP id p39mr3212798qkh.98.1476828716204; Tue, 18 Oct 2016 15:11:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.29.33 with HTTP; Tue, 18 Oct 2016 15:11:55 -0700 (PDT) In-Reply-To: <201610181013.u9IADs1j025157@repo.freebsd.org> References: <201610181013.u9IADs1j025157@repo.freebsd.org> From: Ngie Cooper Date: Tue, 18 Oct 2016 15:11:55 -0700 Message-ID: Subject: Re: svn commit: r307553 - head/contrib/netbsd-tests/lib/libpthread To: Ruslan Bukin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 22:11:57 -0000 (Picking a "random commit") On Tue, Oct 18, 2016 at 3:13 AM, Ruslan Bukin wrote: > Author: br > Date: Tue Oct 18 10:13:54 2016 > New Revision: 307553 > URL: https://svnweb.freebsd.org/changeset/base/307553 > > Log: > Skip test on MIPS as it modifies TLS pointer in set_mcontext(). > > Discussed with: kib > Sponsored by: DARPA, AFRL > Sponsored by: HEIF5 > > Modified: > head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c > > Modified: head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c > ============================================================================== > --- head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 10:12:55 2016 (r307552) > +++ head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 10:13:54 2016 (r307553) > @@ -97,6 +97,15 @@ ATF_TC_BODY(swapcontext1, tc) > { > pthread_t thread; > > +#ifdef __mips__ > + /* > + * MIPS modifies TLS pointer in set_mcontext(), so > + * swapping contexts obtained from different threads > + * gives us different pthread_self() return value. > + */ > + atf_tc_skip("Platform is not supported."); > +#endif > + > oself = (void *)&val1; > nself = (void *)&val2; Please add appropriate conditionals to the code, i.e. - "#ifdef __FreeBSD__" / "#endif" around all blocks that are FreeBSD-specific, or need to be upstreamed to NetBSD. - "#ifdef __NetBSD__" / "#endif" around all blocks that are NetBSD-specific (i.e. test specific NetBSD requirements), do not need to be upstreamed. This helps mere mortals (like me) keep track of what's our's, what's their's, and what should be their's, so I can push back everything that should be in NetBSD to NetBSD. If it's not resolved by tonight, I'll work through the queue of items that need to be cleaned up. Thank you, -Ngie From owner-svn-src-all@freebsd.org Tue Oct 18 22:24:04 2016 Return-Path: Delivered-To: svn-src-all@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 BB1B1C17B01; Tue, 18 Oct 2016 22:24:04 +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 7EE10302; Tue, 18 Oct 2016 22:24:04 +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 u9IMO3Of013623; Tue, 18 Oct 2016 22:24:03 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IMO3b0013622; Tue, 18 Oct 2016 22:24:03 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610182224.u9IMO3b0013622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 18 Oct 2016 22:24: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: r307579 - stable/11/usr.sbin/moused X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 22:24:04 -0000 Author: gonzo Date: Tue Oct 18 22:24:03 2016 New Revision: 307579 URL: https://svnweb.freebsd.org/changeset/base/307579 Log: MFC r306356: Add Elantech trackpad to the list of known models PR: 205690 Submitted by: Vladimir Kondratyev MFC after: 1 week Modified: stable/11/usr.sbin/moused/moused.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/moused/moused.c ============================================================================== --- stable/11/usr.sbin/moused/moused.c Tue Oct 18 21:33:57 2016 (r307578) +++ stable/11/usr.sbin/moused/moused.c Tue Oct 18 22:24:03 2016 (r307579) @@ -246,6 +246,7 @@ static symtab_t rmodels[] = { { "4D+ Mouse", MOUSE_MODEL_4DPLUS, 0 }, { "Synaptics Touchpad", MOUSE_MODEL_SYNAPTICS, 0 }, { "TrackPoint", MOUSE_MODEL_TRACKPOINT, 0 }, + { "Elantech Touchpad", MOUSE_MODEL_ELANTECH, 0 }, { "generic", MOUSE_MODEL_GENERIC, 0 }, { NULL, MOUSE_MODEL_UNKNOWN, 0 }, }; From owner-svn-src-all@freebsd.org Tue Oct 18 22:26:39 2016 Return-Path: Delivered-To: svn-src-all@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 B9752C17C50; Tue, 18 Oct 2016 22:26:39 +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 886797A0; Tue, 18 Oct 2016 22:26:39 +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 u9IMQcFm013798; Tue, 18 Oct 2016 22:26:38 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IMQcwc013797; Tue, 18 Oct 2016 22:26:38 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610182226.u9IMQcwc013797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 18 Oct 2016 22:26:38 +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: r307580 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 22:26:39 -0000 Author: gonzo Date: Tue Oct 18 22:26:38 2016 New Revision: 307580 URL: https://svnweb.freebsd.org/changeset/base/307580 Log: MFC r306357: Document hw.psm.elantech_support in psm(4) PR: 205690 Submitted by: Vladimir Kondratyev MFC after: 1 week Modified: stable/11/share/man/man4/psm.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/psm.4 ============================================================================== --- stable/11/share/man/man4/psm.4 Tue Oct 18 22:24:03 2016 (r307579) +++ stable/11/share/man/man4/psm.4 Tue Oct 18 22:26:38 2016 (r307580) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2013 +.Dd September 26, 2016 .Dt PSM 4 .Os .Sh NAME @@ -340,10 +340,12 @@ at boot-time. This will enable .Nm to handle packets from guest devices (sticks) and extra buttons. -Similarly, extended support for IBM/Lenovo TrackPoint can be enabled -by setting +Similarly, extended support for IBM/Lenovo TrackPoint and Elantech touchpads +can be enabled by setting .Va hw.psm.trackpoint_support -to +or +.Va hw.psm.elantech_support, +respectively, to .Em 1 at boot-time. .Pp From owner-svn-src-all@freebsd.org Tue Oct 18 22:40:14 2016 Return-Path: Delivered-To: svn-src-all@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 372B5C17EF7; Tue, 18 Oct 2016 22:40:14 +0000 (UTC) (envelope-from imp@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 06C92D33; Tue, 18 Oct 2016 22:40:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IMeDgn017914; Tue, 18 Oct 2016 22:40:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IMeDh7017913; Tue, 18 Oct 2016 22:40:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610182240.u9IMeDh7017913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 18 Oct 2016 22:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307581 - head/tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 22:40:14 -0000 Author: imp Date: Tue Oct 18 22:40:12 2016 New Revision: 307581 URL: https://svnweb.freebsd.org/changeset/base/307581 Log: Fix NANO_NAME Modified: head/tools/tools/nanobsd/embedded/beaglebone.cfg Modified: head/tools/tools/nanobsd/embedded/beaglebone.cfg ============================================================================== --- head/tools/tools/nanobsd/embedded/beaglebone.cfg Tue Oct 18 22:26:38 2016 (r307580) +++ head/tools/tools/nanobsd/embedded/beaglebone.cfg Tue Oct 18 22:40:12 2016 (r307581) @@ -29,7 +29,7 @@ NANO_ARCH=armv6 NANO_KERNEL=BEAGLEBONE NANO_DRIVE=mmcsd0 -NANO_NAME=rpi2 +NANO_NAME=beaglebone NANO_BOOT_PKG=u-boot-beaglebone NANO_CPUTYPE=cortex-a8 From owner-svn-src-all@freebsd.org Tue Oct 18 22:40:16 2016 Return-Path: Delivered-To: svn-src-all@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 0FC10C17F05; Tue, 18 Oct 2016 22:40:16 +0000 (UTC) (envelope-from imp@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 D3706D50; Tue, 18 Oct 2016 22:40:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IMeEWv017959; Tue, 18 Oct 2016 22:40:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IMeEL1017958; Tue, 18 Oct 2016 22:40:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610182240.u9IMeEL1017958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 18 Oct 2016 22:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307582 - head/tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 22:40:16 -0000 Author: imp Date: Tue Oct 18 22:40:14 2016 New Revision: 307582 URL: https://svnweb.freebsd.org/changeset/base/307582 Log: Announce where we've put the image too Modified: head/tools/tools/nanobsd/embedded/common Modified: head/tools/tools/nanobsd/embedded/common ============================================================================== --- head/tools/tools/nanobsd/embedded/common Tue Oct 18 22:40:12 2016 (r307581) +++ head/tools/tools/nanobsd/embedded/common Tue Oct 18 22:40:14 2016 (r307582) @@ -201,8 +201,13 @@ create_diskimage_gpt ( ) ( create_diskimage_mbr ( ) ( + local fmt + + [ -z ${NANO_DISKIMAGE_FORMAT} ] || fmt=".${NANO_DISKIMAGE_FORMAT}" + pprint 2 "build diskimage ${NANO_NAME}" pprint 3 "log: ${NANO_LOG}/_.di" + pprint 3 "image in: ${NANO_DISKIMGDIR}/_.disk.image.${NANO_NAME}${fmt}" ( local extra i sz fmt fmtarg bootmbr bootbsd skiparg From owner-svn-src-all@freebsd.org Tue Oct 18 22:53:59 2016 Return-Path: Delivered-To: svn-src-all@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 6C009C1749A; Tue, 18 Oct 2016 22:53:59 +0000 (UTC) (envelope-from br@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 32CF6973; Tue, 18 Oct 2016 22:53:59 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9IMrwCo025395; Tue, 18 Oct 2016 22:53:58 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9IMrwWU025394; Tue, 18 Oct 2016 22:53:58 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610182253.u9IMrwWU025394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 18 Oct 2016 22:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307583 - head/contrib/netbsd-tests/lib/libpthread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 22:53:59 -0000 Author: br Date: Tue Oct 18 22:53:58 2016 New Revision: 307583 URL: https://svnweb.freebsd.org/changeset/base/307583 Log: Skip test on FreeBSD only. So test can be upstreamed to NetBSD. Requested by: ngie Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Modified: head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c ============================================================================== --- head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 22:40:14 2016 (r307582) +++ head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 22:53:58 2016 (r307583) @@ -97,7 +97,7 @@ ATF_TC_BODY(swapcontext1, tc) { pthread_t thread; -#ifdef __mips__ +#if defined(__FreeBSD__) && defined(__mips__) /* * MIPS modifies TLS pointer in set_mcontext(), so * swapping contexts obtained from different threads From owner-svn-src-all@freebsd.org Tue Oct 18 22:57:49 2016 Return-Path: Delivered-To: svn-src-all@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 4B24FC1751F; Tue, 18 Oct 2016 22:57:49 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) (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 16234B12; Tue, 18 Oct 2016 22:57:48 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:35242) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1bwdKL-000eNB-fE (Exim 4.86_36-e07b163) (return-path ); Tue, 18 Oct 2016 23:57:45 +0100 Date: Tue, 18 Oct 2016 22:57:24 +0000 From: Ruslan Bukin To: Ngie Cooper Cc: Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r307553 - head/contrib/netbsd-tests/lib/libpthread Message-ID: <20161018225724.GA63157@bsdpad.com> References: <201610181013.u9IADs1j025157@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 22:57:49 -0000 On Tue, Oct 18, 2016 at 03:11:55PM -0700, Ngie Cooper wrote: > (Picking a "random commit") > > On Tue, Oct 18, 2016 at 3:13 AM, Ruslan Bukin wrote: > > Author: br > > Date: Tue Oct 18 10:13:54 2016 > > New Revision: 307553 > > URL: https://svnweb.freebsd.org/changeset/base/307553 > > > > Log: > > Skip test on MIPS as it modifies TLS pointer in set_mcontext(). > > > > Discussed with: kib > > Sponsored by: DARPA, AFRL > > Sponsored by: HEIF5 > > > > Modified: > > head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c > > > > Modified: head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c > > ============================================================================== > > --- head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 10:12:55 2016 (r307552) > > +++ head/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Tue Oct 18 10:13:54 2016 (r307553) > > @@ -97,6 +97,15 @@ ATF_TC_BODY(swapcontext1, tc) > > { > > pthread_t thread; > > > > +#ifdef __mips__ > > + /* > > + * MIPS modifies TLS pointer in set_mcontext(), so > > + * swapping contexts obtained from different threads > > + * gives us different pthread_self() return value. > > + */ > > + atf_tc_skip("Platform is not supported."); > > +#endif > > + > > oself = (void *)&val1; > > nself = (void *)&val2; > > Please add appropriate conditionals to the code, i.e. > - "#ifdef __FreeBSD__" / "#endif" around all blocks that are > FreeBSD-specific, or need to be upstreamed to NetBSD. > - "#ifdef __NetBSD__" / "#endif" around all blocks that are > NetBSD-specific (i.e. test specific NetBSD requirements), do not need > to be upstreamed. > This helps mere mortals (like me) keep track of what's our's, > what's their's, and what should be their's, so I can push back > everything that should be in NetBSD to NetBSD. > If it's not resolved by tonight, I'll work through the queue of > items that need to be cleaned up. Thanks. Is this rule for ./contrib/netbsd-tests only, or ./tests/ as well ? Ruslan From owner-svn-src-all@freebsd.org Tue Oct 18 23:01:48 2016 Return-Path: Delivered-To: svn-src-all@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 D3F52C1778C; Tue, 18 Oct 2016 23:01:48 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EDB7EA9; Tue, 18 Oct 2016 23:01:48 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22c.google.com with SMTP id f128so11207482qkb.1; Tue, 18 Oct 2016 16:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QEoX847PuRMHMWp+VaaXnRvKV72ypOzKD0AQsmyqyP0=; b=nIg7B8N9IzIROluwu6pxJqYIJlF18zCoge8LCirlA+upf6/WEWW9nDB8++kt/45+h8 qvzUsRL9faGzYc02VPCsa6N186BZWq9nGw5QcagZ4Zwnz3EZYIsAE4lKbhhppYbAzcWb Y4XAOgnexkbb1K+0vZEJ+U0sENdvcGZKCIcSCFmbIiBlTHpVVO1YDjM8JEyMMJj09DQZ hV5UwQSIlrMK0T1VOd1uzR3qctTRkjDC8dpyzVJjgl6zL/bcMU/uvA/SvbeDp4FU+1vE ITzwx5VHVGPJXBrHQNX2JQheYTFg/LpuGH9oDgmRjifIh3iGOKJG64+oFM3DuNHAv8Ub Ztdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QEoX847PuRMHMWp+VaaXnRvKV72ypOzKD0AQsmyqyP0=; b=cM3yt8SkeYwZZDkM0dQqZe9iHIAzuiqveHneQd+lj/GYbVEghMSMjr/mqS4lgWm1nO tyqiIO0U/61C70kGgM6O72YV2vqzOdkAAg7qTOWvq4MZnN5YFxSx91E0pQdMNYlWDtob KVfTji4lE/2o0zHnL04G5yHUeWp9doUIlVqaH+ND6PqH1szYBg3aPWSxQUld76/+foLM wXE60KaUoa7v21vEz9M1n3BDZuikcMgyTd/p8vLTEfakTImHKc6tOgLpNap1mmplkokl 4/nvGwq68OFoVnCrt/w+xOxiwZvIWoW/9URLgFXsfecf3DWFotTQuplZmXrY0/lFfmYP kWNA== X-Gm-Message-State: AA6/9RmSSuv+Rwq/LpNbxG0m7YOydr4FkIAgi7ArUJ191dOK5nuEQljGvcoT2yhG7plkim3W0si+cp4brsHzyQ== X-Received: by 10.55.215.93 with SMTP id m90mr3153403qki.40.1476831707726; Tue, 18 Oct 2016 16:01:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.29.33 with HTTP; Tue, 18 Oct 2016 16:01:47 -0700 (PDT) In-Reply-To: <20161018225724.GA63157@bsdpad.com> References: <201610181013.u9IADs1j025157@repo.freebsd.org> <20161018225724.GA63157@bsdpad.com> From: Ngie Cooper Date: Tue, 18 Oct 2016 16:01:47 -0700 Message-ID: Subject: Re: svn commit: r307553 - head/contrib/netbsd-tests/lib/libpthread To: Ruslan Bukin Cc: Ruslan Bukin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 23:01:49 -0000 On Tue, Oct 18, 2016 at 3:57 PM, Ruslan Bukin wrote: ... > Thanks. Is this rule for ./contrib/netbsd-tests only, or ./tests/ as well ? Just contrib/netbsd-tests as their upstream is NetBSD (hence the name, netbsd-tests). Thanks! -Ngie From owner-svn-src-all@freebsd.org Tue Oct 18 23:20:51 2016 Return-Path: Delivered-To: svn-src-all@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 81F99C17C13; Tue, 18 Oct 2016 23:20:51 +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 5D4D116BB; Tue, 18 Oct 2016 23:20:51 +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 u9INKobt036292; Tue, 18 Oct 2016 23:20:50 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9INKnT6034560; Tue, 18 Oct 2016 23:20:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201610182320.u9INKnT6034560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 18 Oct 2016 23:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307584 - in head: lib/libmd sys/crypto sys/crypto/aesni sys/crypto/sha2 sys/crypto/siphash sys/crypto/skein sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 23:20:51 -0000 Author: asomers Date: Tue Oct 18 23:20:49 2016 New Revision: 307584 URL: https://svnweb.freebsd.org/changeset/base/307584 Log: Fix C++ includability of crypto headers with static array sizes C99 allows array function parameters to use the static keyword for their sizes. This tells the compiler that the parameter will have at least the specified size, and calling code will fail to compile if that guarantee is not met. However, this syntax is not legal in C++. This commit reverts r300824, which worked around the problem for sys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can be used in headers as a static array size, but will still compile in C++ mode. Reviewed by: cem, ed MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8277 Modified: head/lib/libmd/md5.h head/sys/crypto/aesni/aesni.h head/sys/crypto/sha1.h head/sys/crypto/sha2/sha256.h head/sys/crypto/sha2/sha384.h head/sys/crypto/sha2/sha512.h head/sys/crypto/sha2/sha512t.h head/sys/crypto/siphash/siphash.h head/sys/crypto/skein/skein_freebsd.h head/sys/sys/cdefs.h head/sys/sys/md4.h head/sys/sys/md5.h Modified: head/lib/libmd/md5.h ============================================================================== --- head/lib/libmd/md5.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/lib/libmd/md5.h Tue Oct 18 23:20:49 2016 (r307584) @@ -43,13 +43,5 @@ #endif -#ifdef __cplusplus -#define static -#endif - #include - -#ifdef __cplusplus -#undef static -#endif #endif /* _MD5_H_ */ Modified: head/sys/crypto/aesni/aesni.h ============================================================================== --- head/sys/crypto/aesni/aesni.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/aesni/aesni.h Tue Oct 18 23:20:49 2016 (r307584) @@ -79,23 +79,25 @@ void aesni_set_deckey(const uint8_t *enc */ void aesni_encrypt_cbc(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to, - const uint8_t iv[static AES_BLOCK_LEN]); + const uint8_t iv[__min_size(AES_BLOCK_LEN)]); void aesni_decrypt_cbc(int rounds, const void *key_schedule /*__aligned(16)*/, - size_t len, uint8_t *buf, const uint8_t iv[static AES_BLOCK_LEN]); + size_t len, uint8_t *buf, const uint8_t iv[__min_size(AES_BLOCK_LEN)]); void aesni_encrypt_ecb(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to); void aesni_decrypt_ecb(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to); void aesni_encrypt_icm(int rounds, const void *key_schedule /*__aligned(16)*/, size_t len, const uint8_t *from, uint8_t *to, - const uint8_t iv[static AES_BLOCK_LEN]); + const uint8_t iv[__min_size(AES_BLOCK_LEN)]); void aesni_encrypt_xts(int rounds, const void *data_schedule /*__aligned(16)*/, const void *tweak_schedule /*__aligned(16)*/, size_t len, - const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]); + const uint8_t *from, uint8_t *to, + const uint8_t iv[__min_size(AES_BLOCK_LEN)]); void aesni_decrypt_xts(int rounds, const void *data_schedule /*__aligned(16)*/, const void *tweak_schedule /*__aligned(16)*/, size_t len, - const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]); + const uint8_t *from, uint8_t *to, + const uint8_t iv[__min_size(AES_BLOCK_LEN)]); /* GCM & GHASH functions */ void AES_GCM_encrypt(const unsigned char *in, unsigned char *out, Modified: head/sys/crypto/sha1.h ============================================================================== --- head/sys/crypto/sha1.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/sha1.h Tue Oct 18 23:20:49 2016 (r307584) @@ -61,7 +61,7 @@ typedef struct sha1_ctxt SHA1_CTX; extern void sha1_init(struct sha1_ctxt *); extern void sha1_pad(struct sha1_ctxt *); extern void sha1_loop(struct sha1_ctxt *, const u_int8_t *, size_t); -extern void sha1_result(struct sha1_ctxt *, char[static SHA1_RESULTLEN]); +extern void sha1_result(struct sha1_ctxt *, char[__min_size(SHA1_RESULTLEN)]); /* compatibilty with other SHA1 source codes */ #define SHA1Init(x) sha1_init((x)) Modified: head/sys/crypto/sha2/sha256.h ============================================================================== --- head/sys/crypto/sha2/sha256.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/sha2/sha256.h Tue Oct 18 23:20:49 2016 (r307584) @@ -84,7 +84,8 @@ __BEGIN_DECLS void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX *, const void *, size_t); -void SHA256_Final(unsigned char [static SHA256_DIGEST_LENGTH], SHA256_CTX *); +void SHA256_Final(unsigned char [__min_size(SHA256_DIGEST_LENGTH)], + SHA256_CTX *); #ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/sha2/sha384.h ============================================================================== --- head/sys/crypto/sha2/sha384.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/sha2/sha384.h Tue Oct 18 23:20:49 2016 (r307584) @@ -80,7 +80,8 @@ __BEGIN_DECLS void SHA384_Init(SHA384_CTX *); void SHA384_Update(SHA384_CTX *, const void *, size_t); -void SHA384_Final(unsigned char [static SHA384_DIGEST_LENGTH], SHA384_CTX *); +void SHA384_Final(unsigned char [__min_size(SHA384_DIGEST_LENGTH)], + SHA384_CTX *); #ifndef _KERNEL char *SHA384_End(SHA384_CTX *, char *); char *SHA384_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/sha2/sha512.h ============================================================================== --- head/sys/crypto/sha2/sha512.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/sha2/sha512.h Tue Oct 18 23:20:49 2016 (r307584) @@ -83,7 +83,8 @@ __BEGIN_DECLS void SHA512_Init(SHA512_CTX *); void SHA512_Update(SHA512_CTX *, const void *, size_t); -void SHA512_Final(unsigned char [static SHA512_DIGEST_LENGTH], SHA512_CTX *); +void SHA512_Final(unsigned char [__min_size(SHA512_DIGEST_LENGTH)], + SHA512_CTX *); #ifndef _KERNEL char *SHA512_End(SHA512_CTX *, char *); char *SHA512_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/sha2/sha512t.h ============================================================================== --- head/sys/crypto/sha2/sha512t.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/sha2/sha512t.h Tue Oct 18 23:20:49 2016 (r307584) @@ -115,7 +115,8 @@ __BEGIN_DECLS void SHA512_224_Init(SHA512_CTX *); void SHA512_224_Update(SHA512_CTX *, const void *, size_t); -void SHA512_224_Final(unsigned char [static SHA512_224_DIGEST_LENGTH], SHA512_CTX *); +void SHA512_224_Final(unsigned char [__min_size(SHA512_224_DIGEST_LENGTH)], + SHA512_CTX *); #ifndef _KERNEL char *SHA512_224_End(SHA512_CTX *, char *); char *SHA512_224_Data(const void *, unsigned int, char *); @@ -126,7 +127,8 @@ char *SHA512_224_FileChunk(const char #endif void SHA512_256_Init(SHA512_CTX *); void SHA512_256_Update(SHA512_CTX *, const void *, size_t); -void SHA512_256_Final(unsigned char [static SHA512_256_DIGEST_LENGTH], SHA512_CTX *); +void SHA512_256_Final(unsigned char [__min_size(SHA512_256_DIGEST_LENGTH)], + SHA512_CTX *); #ifndef _KERNEL char *SHA512_256_End(SHA512_CTX *, char *); char *SHA512_256_Data(const void *, unsigned int, char *); Modified: head/sys/crypto/siphash/siphash.h ============================================================================== --- head/sys/crypto/siphash/siphash.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/siphash/siphash.h Tue Oct 18 23:20:49 2016 (r307584) @@ -68,15 +68,16 @@ typedef struct _SIPHASH_CTX { #define SipHash24_Init(x) SipHash_InitX((x), 2, 4) #define SipHash48_Init(x) SipHash_InitX((x), 4, 8) void SipHash_InitX(SIPHASH_CTX *, int, int); -void SipHash_SetKey(SIPHASH_CTX *, const uint8_t[static SIPHASH_KEY_LENGTH]); +void SipHash_SetKey(SIPHASH_CTX *, + const uint8_t[__min_size(SIPHASH_KEY_LENGTH)]); void SipHash_Update(SIPHASH_CTX *, const void *, size_t); -void SipHash_Final(uint8_t[static SIPHASH_DIGEST_LENGTH], SIPHASH_CTX *); +void SipHash_Final(uint8_t[__min_size(SIPHASH_DIGEST_LENGTH)], SIPHASH_CTX *); uint64_t SipHash_End(SIPHASH_CTX *); #define SipHash24(x, y, z, i) SipHashX((x), 2, 4, (y), (z), (i)); #define SipHash48(x, y, z, i) SipHashX((x), 4, 8, (y), (z), (i)); -uint64_t SipHashX(SIPHASH_CTX *, int, int, const uint8_t[static SIPHASH_KEY_LENGTH], const void *, - size_t); +uint64_t SipHashX(SIPHASH_CTX *, int, int, + const uint8_t[__min_size(SIPHASH_KEY_LENGTH)], const void *, size_t); int SipHash24_TestVectors(void); Modified: head/sys/crypto/skein/skein_freebsd.h ============================================================================== --- head/sys/crypto/skein/skein_freebsd.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/crypto/skein/skein_freebsd.h Tue Oct 18 23:20:49 2016 (r307584) @@ -57,9 +57,12 @@ void SKEIN256_Update(SKEIN256_CTX *ctx, void SKEIN512_Update(SKEIN512_CTX *ctx, const void *in, size_t len); void SKEIN1024_Update(SKEIN1024_CTX *ctx, const void *in, size_t len); -void SKEIN256_Final(unsigned char digest[static SKEIN256_DIGEST_LENGTH], SKEIN256_CTX *ctx); -void SKEIN512_Final(unsigned char digest[static SKEIN512_DIGEST_LENGTH], SKEIN512_CTX *ctx); -void SKEIN1024_Final(unsigned char digest[static SKEIN1024_DIGEST_LENGTH], SKEIN1024_CTX *ctx); +void SKEIN256_Final(unsigned char digest[__min_size(SKEIN256_DIGEST_LENGTH)], + SKEIN256_CTX *ctx); +void SKEIN512_Final(unsigned char digest[__min_size(SKEIN512_DIGEST_LENGTH)], + SKEIN512_CTX *ctx); +void SKEIN1024_Final(unsigned char digest[__min_size(SKEIN1024_DIGEST_LENGTH)], + SKEIN1024_CTX *ctx); #ifndef _KERNEL char *SKEIN256_End(SKEIN256_CTX *, char *); Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/sys/cdefs.h Tue Oct 18 23:20:49 2016 (r307584) @@ -341,6 +341,20 @@ __builtin_types_compatible_p(__typeof(expr), t), yes, no) #endif +/* + * C99 Static array indices in function parameter declarations. Syntax such as: + * void bar(int myArray[static 10]); + * is allowed in C99 but not in C++. Define __min_size appropriately so + * headers using it can be compiled in either language. Use like this: + * void bar(int myArray[__min_size(10)]); + */ +#if !defined(__cplusplus) && \ + (!defined(__STDC_VERSION) || (__STDC_VERSION__ >= 199901)) +#define __min_size(x) static (x) +#else +#define __min_size(x) (x) +#endif + #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) Modified: head/sys/sys/md4.h ============================================================================== --- head/sys/sys/md4.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/sys/md4.h Tue Oct 18 23:20:49 2016 (r307584) @@ -39,7 +39,7 @@ __BEGIN_DECLS void MD4Init(MD4_CTX *); void MD4Update(MD4_CTX *, const unsigned char *, unsigned int); void MD4Pad(MD4_CTX *); -void MD4Final(unsigned char [static 16], MD4_CTX *); +void MD4Final(unsigned char [__min_size(16)], MD4_CTX *); #ifndef _KERNEL char * MD4End(MD4_CTX *, char *); char * MD4File(const char *, char *); Modified: head/sys/sys/md5.h ============================================================================== --- head/sys/sys/md5.h Tue Oct 18 22:53:58 2016 (r307583) +++ head/sys/sys/md5.h Tue Oct 18 23:20:49 2016 (r307584) @@ -44,7 +44,7 @@ typedef struct MD5Context { __BEGIN_DECLS void MD5Init (MD5_CTX *); void MD5Update (MD5_CTX *, const void *, unsigned int); -void MD5Final (unsigned char[static MD5_DIGEST_LENGTH], MD5_CTX *); +void MD5Final (unsigned char[__min_size(MD5_DIGEST_LENGTH)], MD5_CTX *); #ifndef _KERNEL char * MD5End(MD5_CTX *, char *); char * MD5Fd(int, char *); From owner-svn-src-all@freebsd.org Tue Oct 18 23:27:51 2016 Return-Path: Delivered-To: svn-src-all@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 5E7B0C17EF3; Tue, 18 Oct 2016 23:27:51 +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 1EBD41AA5; Tue, 18 Oct 2016 23:27:51 +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 u9INRoKE037342; Tue, 18 Oct 2016 23:27:50 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9INRovA037341; Tue, 18 Oct 2016 23:27:50 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610182327.u9INRovA037341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 18 Oct 2016 23:27:50 +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: r307585 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 23:27:51 -0000 Author: gonzo Date: Tue Oct 18 23:27:50 2016 New Revision: 307585 URL: https://svnweb.freebsd.org/changeset/base/307585 Log: MFC r307154: [fdt] Add one more heuristic to determine MAC address of the SMSC device - If check for net,ethernet/usb,device compatible node fails, try to find .../usb/hub/ethernet, where ... is bus path that can depend on actual HW. net,ethernet/usb,device compatibity strings are FreeBSD custom invention that is used only in RPi DTBs and since there is no other way to tie USB device to FDT node we just do our best effort here to work with upstream device tree - Use -1 value to indicate invalid phandle_t, 0 is valid phandle value and shouldn't be used as error signal 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 Tue Oct 18 23:20:49 2016 (r307584) +++ stable/11/sys/dev/usb/net/if_smsc.c Tue Oct 18 23:27:50 2016 (r307585) @@ -1556,6 +1556,9 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd } #ifdef FDT +/* + * This is FreeBSD-specific compatibility strings for RPi/RPi2 + */ static phandle_t smsc_fdt_find_eth_node(phandle_t start) { @@ -1567,11 +1570,68 @@ smsc_fdt_find_eth_node(phandle_t start) fdt_is_compatible(node, "usb,device")) return (node); child = smsc_fdt_find_eth_node(node); - if (child != 0) + if (child != -1) return (child); } - return (0); + return (-1); +} + +/* + * Check if node's path is <*>/usb/hub/ethernet + */ +static int +smsc_fdt_is_usb_eth(phandle_t node) +{ + char name[16]; + int len; + + memset(name, 0, sizeof(name)); + len = OF_getprop(node, "name", name, sizeof(name)); + if (len <= 0) + return (0); + + if (strcmp(name, "ethernet")) + return (0); + + node = OF_parent(node); + if (node == -1) + return (0); + len = OF_getprop(node, "name", name, sizeof(name)); + if (len <= 0) + return (0); + + if (strcmp(name, "hub")) + return (0); + + node = OF_parent(node); + if (node == -1) + return (0); + len = OF_getprop(node, "name", name, sizeof(name)); + if (len <= 0) + return (0); + + if (strcmp(name, "usb")) + return (0); + + return (1); +} + +static phandle_t +smsc_fdt_find_eth_node_by_path(phandle_t start) +{ + phandle_t child, node; + + /* Traverse through entire tree to find usb ethernet nodes. */ + for (node = OF_child(start); node != 0; node = OF_peer(node)) { + if (smsc_fdt_is_usb_eth(node)) + return (node); + child = smsc_fdt_find_eth_node_by_path(node); + if (child != -1) + return (child); + } + + return (-1); } /** @@ -1587,8 +1647,14 @@ smsc_fdt_find_mac(unsigned char *mac) root = OF_finddevice("/"); node = smsc_fdt_find_eth_node(root); - if (node != 0) { + /* + * If it's not FreeBSD FDT blob for RPi, try more + * generic .../usb/hub/ethernet + */ + if (node == -1) + node = smsc_fdt_find_eth_node_by_path(root); + if (node != -1) { /* Check if there is property */ if ((len = OF_getproplen(node, "local-mac-address")) > 0) { if (len != ETHER_ADDR_LEN) From owner-svn-src-all@freebsd.org Tue Oct 18 23:48:48 2016 Return-Path: Delivered-To: svn-src-all@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 68E24C12301; Tue, 18 Oct 2016 23:48:48 +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 4248B238; Tue, 18 Oct 2016 23:48:48 +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 u9INmlAG044832; Tue, 18 Oct 2016 23:48:47 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9INml34044830; Tue, 18 Oct 2016 23:48:47 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610182348.u9INml34044830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 18 Oct 2016 23:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307586 - head/sys/arm64/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 23:48:48 -0000 Author: gonzo Date: Tue Oct 18 23:48:47 2016 New Revision: 307586 URL: https://svnweb.freebsd.org/changeset/base/307586 Log: Retire RPI3 kernel config in favour of GENERIC-UP Policy for FreeBSD/arm64 kernel config is the same one as for x86 architectures: provide GENERIC kernel bootable on as many systems as possible. Since there is no SMP support for RPi 3 yet new kernel config was introduced: GENERIC-UP, which is effectively GENERIC with SMP option disabled Added: head/sys/arm64/conf/GENERIC-UP (contents, props changed) Deleted: head/sys/arm64/conf/RPI3 Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Tue Oct 18 23:27:50 2016 (r307585) +++ head/sys/arm64/conf/GENERIC Tue Oct 18 23:48:47 2016 (r307586) @@ -90,6 +90,7 @@ options MALLOC_DEBUG_MAXZONES=8 # Separ options SOC_ALLWINNER_A64 options SOC_CAVM_THUNDERX options SOC_HISI_HI6220 +options SOC_BRCM_BCM2837 # Annapurna Alpine drivers device al_ccu # Alpine Cache Coherency Unit @@ -129,6 +130,7 @@ device da device pass # Passthrough device (direct ATA/SCSI access) # MMC/SD/SDIO Card slot support +device sdhci device aw_mmc # Allwinner SD/MMC controller device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards @@ -152,13 +154,19 @@ device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da +# USB ethernet support +device smcphy +device smsc + # GPIO device aw_gpio # Allwinner GPIO controller device gpio +device gpioled device fdt_pinctrl # I2C device aw_rsb # Allwinner Reduced Serial Bus +device bcm2835_bsc # Broadcom BCM283x I2C bus device iicbus # Clock and reset controllers @@ -182,6 +190,14 @@ device aw_sid # Allwinner Secure ID EF # Thermal sensors device aw_thermal # Allwinner Thermal Sensor Controller +# SPI +device spibus +device bcm2835_spi # Broadcom BCM283x SPI bus + +# Console +device vt +device kbdmux + # Pseudo devices. device loop # Network loopback device random # Entropy device Added: head/sys/arm64/conf/GENERIC-UP ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/conf/GENERIC-UP Tue Oct 18 23:48:47 2016 (r307586) @@ -0,0 +1,23 @@ +# +# GENERIC -- Generic kernel configuration file for FreeBSD/arm64 with SMP disabled +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +include GENERIC +ident GENERIC-UP +nooptions SMP From owner-svn-src-all@freebsd.org Wed Oct 19 00:14:21 2016 Return-Path: Delivered-To: svn-src-all@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 6863AC12BE1; Wed, 19 Oct 2016 00:14:21 +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 2E676F6C; Wed, 19 Oct 2016 00:14:21 +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 u9J0EKX6055873; Wed, 19 Oct 2016 00:14:20 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J0EKqO055872; Wed, 19 Oct 2016 00:14:20 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201610190014.u9J0EKqO055872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 19 Oct 2016 00:14:20 +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: r307587 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 00:14:21 -0000 Author: vangyzen Date: Wed Oct 19 00:14:20 2016 New Revision: 307587 URL: https://svnweb.freebsd.org/changeset/base/307587 Log: MFC r306346 Make no assertions about mutex state when the scheduler is stopped. This changes the assert path to match the lock and unlock paths. Sponsored by: Dell EMC Modified: stable/11/sys/kern/kern_mutex.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_mutex.c ============================================================================== --- stable/11/sys/kern/kern_mutex.c Tue Oct 18 23:48:47 2016 (r307586) +++ stable/11/sys/kern/kern_mutex.c Wed Oct 19 00:14:20 2016 (r307587) @@ -887,7 +887,7 @@ __mtx_assert(const volatile uintptr_t *c { const struct mtx *m; - if (panicstr != NULL || dumping) + if (panicstr != NULL || dumping || SCHEDULER_STOPPED()) return; m = mtxlock2mtx(c); From owner-svn-src-all@freebsd.org Wed Oct 19 00:14:24 2016 Return-Path: Delivered-To: svn-src-all@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 2ACDAC12C03; Wed, 19 Oct 2016 00:14:24 +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 ECF4BF73; Wed, 19 Oct 2016 00:14: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 u9J0ENoa055921; Wed, 19 Oct 2016 00:14:23 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J0ENcq055920; Wed, 19 Oct 2016 00:14:23 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201610190014.u9J0ENcq055920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 19 Oct 2016 00:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307588 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 00:14:24 -0000 Author: vangyzen Date: Wed Oct 19 00:14:22 2016 New Revision: 307588 URL: https://svnweb.freebsd.org/changeset/base/307588 Log: MFC r306346 Make no assertions about mutex state when the scheduler is stopped. This changes the assert path to match the lock and unlock paths. Sponsored by: Dell EMC Modified: stable/10/sys/kern/kern_mutex.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_mutex.c ============================================================================== --- stable/10/sys/kern/kern_mutex.c Wed Oct 19 00:14:20 2016 (r307587) +++ stable/10/sys/kern/kern_mutex.c Wed Oct 19 00:14:22 2016 (r307588) @@ -848,7 +848,7 @@ __mtx_assert(const volatile uintptr_t *c { const struct mtx *m; - if (panicstr != NULL || dumping) + if (panicstr != NULL || dumping || SCHEDULER_STOPPED()) return; m = mtxlock2mtx(c); From owner-svn-src-all@freebsd.org Wed Oct 19 01:35:23 2016 Return-Path: Delivered-To: svn-src-all@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 33601C15E81; Wed, 19 Oct 2016 01:35:23 +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 DB73F397; Wed, 19 Oct 2016 01:35:22 +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 u9J1ZLPx085705; Wed, 19 Oct 2016 01:35:21 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J1ZLc9085703; Wed, 19 Oct 2016 01:35:21 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610190135.u9J1ZLc9085703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 19 Oct 2016 01:35: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: r307589 - in stable/11/sys: dev/fb 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 01:35:23 -0000 Author: gonzo Date: Wed Oct 19 01:35:21 2016 New Revision: 307589 URL: https://svnweb.freebsd.org/changeset/base/307589 Log: MFC r306555: Provide way for framebuffer driver to request mmap(2) mapping type On ARM if memattr is not overriden mmap(2) maps framebuffer memory as WBWA which means part of changes to content in userland end up in cache and appear on screen gradually as cache lines are evicted. This change adds configurable memattr that hardware fb implementation can set to get the memory mapping type it requires: - Add new flag FB_FLAG_MEMATTR that indicates that framebuffer driver overrides default memattr - Add new field fb_memattr to struct fb_info to specify requested memattr Reviewed by: ray Differential Revision: https://reviews.freebsd.org/D8064 Modified: stable/11/sys/dev/fb/fbd.c stable/11/sys/sys/fbio.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/fb/fbd.c ============================================================================== --- stable/11/sys/dev/fb/fbd.c Wed Oct 19 00:14:22 2016 (r307588) +++ stable/11/sys/dev/fb/fbd.c Wed Oct 19 01:35:21 2016 (r307589) @@ -178,6 +178,8 @@ fb_mmap(struct cdev *dev, vm_ooffset_t o *paddr = vtophys((uint8_t *)info->fb_vbase + offset); else *paddr = info->fb_pbase + offset; + if (info->fb_flags & FB_FLAG_MEMATTR) + *memattr = info->fb_memattr; return (0); } return (EINVAL); Modified: stable/11/sys/sys/fbio.h ============================================================================== --- stable/11/sys/sys/fbio.h Wed Oct 19 00:14:22 2016 (r307588) +++ stable/11/sys/sys/fbio.h Wed Oct 19 01:35:21 2016 (r307589) @@ -142,6 +142,8 @@ struct fb_info { uint32_t fb_flags; #define FB_FLAG_NOMMAP 1 /* mmap unsupported. */ #define FB_FLAG_NOWRITE 2 /* disable writes for the time being */ +#define FB_FLAG_MEMATTR 4 /* override memattr for mmap */ + vm_memattr_t fb_memattr; int fb_stride; int fb_bpp; /* bits per pixel */ uint32_t fb_cmap[16]; From owner-svn-src-all@freebsd.org Wed Oct 19 01:38:24 2016 Return-Path: Delivered-To: svn-src-all@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 9E2CFC15F7C; Wed, 19 Oct 2016 01:38:24 +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 6FDE17A6; Wed, 19 Oct 2016 01:38:24 +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 u9J1cNnU085860; Wed, 19 Oct 2016 01:38:23 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J1cNLW085859; Wed, 19 Oct 2016 01:38:23 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610190138.u9J1cNLW085859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 19 Oct 2016 01:38:23 +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: r307590 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 01:38:24 -0000 Author: gonzo Date: Wed Oct 19 01:38:23 2016 New Revision: 307590 URL: https://svnweb.freebsd.org/changeset/base/307590 Log: Bump __FreeBSD_version for struct fb_info change in r307589 Modified: stable/11/sys/sys/param.h Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Wed Oct 19 01:35:21 2016 (r307589) +++ stable/11/sys/sys/param.h Wed Oct 19 01:38:23 2016 (r307590) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100504 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100505 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Wed Oct 19 01:55:51 2016 Return-Path: Delivered-To: svn-src-all@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 E0804C173EC; Wed, 19 Oct 2016 01:55:51 +0000 (UTC) (envelope-from sephe@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 9E397E69; Wed, 19 Oct 2016 01:55:51 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J1toMS093177; Wed, 19 Oct 2016 01:55:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J1toMF093173; Wed, 19 Oct 2016 01:55:50 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190155.u9J1toMF093173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 01:55:50 +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: r307591 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 01:55:52 -0000 Author: sephe Date: Wed Oct 19 01:55:50 2016 New Revision: 307591 URL: https://svnweb.freebsd.org/changeset/base/307591 Log: MFC 305962,305964-305967 305962 hyperv/hn: Don't allow NVS and NDIS version change upon reinitailization NVS and NDIS version change would break too much assumption and static configuration. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7919 305964 hyperv/hn: Save capabilities for later use. And don't allow capability changes during reinitialization, which breaks too much static configuration. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7922 305965 hyperv/hn: Don't allow MTU change, if it is not supported by the NVS. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7923 305966 hyperv/hn: Stringent RSS sysctl checks - Don't change RNDIS RSS configuration for RSS key sysctl, if the interface is not capable of RSS yet. - Don't change RSS indirect table (both cached one and RNDIS RSS configuration), if the interface is not capable of RSS yet. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7924 305967 hyperv/hn: Allow RSS capability flipping upon attach/reinit. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7927 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Oct 19 01:38:23 2016 (r307590) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Oct 19 01:55:50 2016 (r307591) @@ -467,9 +467,15 @@ hn_nvs_conf_ndis(struct hn_softc *sc, in /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); - if (error) + if (error) { if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); - return (error); + return (error); + } + + if (bootverbose) + if_printf(sc->hn_ifp, "nvs ndis conf done\n"); + sc->hn_caps |= HN_CAP_MTU | HN_CAP_VLAN; + return (0); } static int @@ -495,6 +501,22 @@ hn_nvs_init(struct hn_softc *sc) { int i; + if (device_is_attached(sc->hn_dev)) { + /* + * NVS version and NDIS version MUST NOT be changed. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "reinit NVS version 0x%x, " + "NDIS version %u.%u\n", sc->hn_nvs_ver, + HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), + HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); + } + return (hn_nvs_doinit(sc, sc->hn_nvs_ver)); + } + + /* + * Find the supported NVS version and set NDIS version accordingly. + */ for (i = 0; i < nitems(hn_nvs_version); ++i) { int error; Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 01:38:23 2016 (r307590) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 01:55:50 2016 (r307591) @@ -228,7 +228,8 @@ struct hn_softc { struct vmbus_xact_ctx *hn_xact; uint32_t hn_nvs_ver; - uint32_t hn_flags; + uint32_t hn_caps; /* HN_CAP_ */ + uint32_t hn_flags; /* HN_FLAG_ */ void *hn_rxbuf; uint32_t hn_rxbuf_gpadl; struct hyperv_dma hn_rxbuf_dma; @@ -244,6 +245,18 @@ struct hn_softc { #define HN_FLAG_RXBUF_CONNECTED 0x0001 #define HN_FLAG_CHIM_CONNECTED 0x0002 +#define HN_FLAG_HAS_RSSKEY 0x0004 +#define HN_FLAG_HAS_RSSIND 0x0008 + +#define HN_CAP_VLAN 0x0001 +#define HN_CAP_MTU 0x0002 +#define HN_CAP_IPCS 0x0004 +#define HN_CAP_TCP4CS 0x0008 +#define HN_CAP_TCP6CS 0x0010 +#define HN_CAP_UDP4CS 0x0020 +#define HN_CAP_UDP6CS 0x0040 +#define HN_CAP_TSO4 0x0080 +#define HN_CAP_TSO6 0x0100 /* * Externs Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 01:38:23 2016 (r307590) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 01:55:50 2016 (r307591) @@ -325,6 +325,7 @@ static int hn_rx_stat_ulong_sysctl(SYSCT static int hn_tx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS); static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); @@ -434,6 +435,8 @@ hn_rss_ind_fixup(struct hn_softc *sc, in struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; int i; + KASSERT(nchan > 1, ("invalid # of channels %d", nchan)); + /* * Check indirect table to make sure that all channels in it * can be used. @@ -641,6 +644,9 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "ndis_version", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_ndis_version_sysctl, "A", "NDIS version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "caps", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_caps_sysctl, "A", "capabilities"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); @@ -1568,6 +1574,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, HN_LOCK(sc); + if ((sc->hn_caps & HN_CAP_MTU) == 0) { + /* Can't change MTU */ + HN_UNLOCK(sc); + error = EOPNOTSUPP; + break; + } + if (ifp->if_mtu == ifr->ifr_mtu) { HN_UNLOCK(sc); break; @@ -2095,6 +2108,30 @@ hn_ndis_version_sysctl(SYSCTL_HANDLER_AR } static int +hn_caps_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char caps_str[128]; + uint32_t caps; + + HN_LOCK(sc); + caps = sc->hn_caps; + HN_UNLOCK(sc); + snprintf(caps_str, sizeof(caps_str), "%b", caps, + "\020" + "\001VLAN" + "\002MTU" + "\003IPCS" + "\004TCP4CS" + "\005TCP6CS" + "\006UDP4CS" + "\007UDP6CS" + "\010TSO4" + "\011TSO6"); + return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req); +} + +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; @@ -2109,8 +2146,14 @@ hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS) error = SYSCTL_IN(req, sc->hn_rss.rss_key, sizeof(sc->hn_rss.rss_key)); if (error) goto back; + sc->hn_flags |= HN_FLAG_HAS_RSSKEY; - error = hn_rss_reconfig(sc); + if (sc->hn_rx_ring_inuse > 1) { + error = hn_rss_reconfig(sc); + } else { + /* Not RSS capable, at least for now; just save the RSS key. */ + error = 0; + } back: HN_UNLOCK(sc); return (error); @@ -2128,9 +2171,19 @@ hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS) if (error || req->newptr == NULL) goto back; + /* + * Don't allow RSS indirect table change, if this interface is not + * RSS capable currently. + */ + if (sc->hn_rx_ring_inuse == 1) { + error = EOPNOTSUPP; + goto back; + } + error = SYSCTL_IN(req, sc->hn_rss.rss_ind, sizeof(sc->hn_rss.rss_ind)); if (error) goto back; + sc->hn_flags |= HN_FLAG_HAS_RSSIND; hn_rss_ind_fixup(sc, sc->hn_rx_ring_inuse); error = hn_rss_reconfig(sc); @@ -3223,6 +3276,11 @@ hn_synth_attach(struct hn_softc *sc, int { struct ndis_rssprm_toeplitz *rss = &sc->hn_rss; int error, nsubch, nchan, i; + uint32_t old_caps; + + /* Save capabilities for later verification. */ + old_caps = sc->hn_caps; + sc->hn_caps = 0; /* * Attach the primary channel _before_ attaching NVS and RNDIS. @@ -3246,6 +3304,17 @@ hn_synth_attach(struct hn_softc *sc, int return (error); /* + * Make sure capabilities are not changed. + */ + if (device_is_attached(sc->hn_dev) && old_caps != sc->hn_caps) { + if_printf(sc->hn_ifp, "caps mismatch old 0x%08x, new 0x%08x\n", + old_caps, sc->hn_caps); + /* Restore old capabilities and abort. */ + sc->hn_caps = old_caps; + return ENXIO; + } + + /* * Allocate sub-channels for multi-TX/RX rings. * * NOTE: @@ -3268,24 +3337,29 @@ hn_synth_attach(struct hn_softc *sc, int * are allocated. */ - if (!device_is_attached(sc->hn_dev)) { + if ((sc->hn_flags & HN_FLAG_HAS_RSSKEY) == 0) { /* - * Setup default RSS key and indirect table for the - * attach DEVMETHOD. They can be altered later on, - * so don't mess them up once this interface is attached. + * RSS key is not set yet; set it to the default RSS key. */ - if (bootverbose) { - if_printf(sc->hn_ifp, "setup default RSS key and " - "indirect table\n"); - } - - /* Setup default RSS key. */ + if (bootverbose) + if_printf(sc->hn_ifp, "setup default RSS key\n"); memcpy(rss->rss_key, hn_rss_key_default, sizeof(rss->rss_key)); + sc->hn_flags |= HN_FLAG_HAS_RSSKEY; + } - /* Setup default RSS indirect table. */ + if ((sc->hn_flags & HN_FLAG_HAS_RSSIND) == 0) { + /* + * RSS indirect table is not set yet; set it up in round- + * robin fashion. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "setup default RSS indirect " + "table\n"); + } /* TODO: Take ndis_rss_caps.ndis_nind into account. */ for (i = 0; i < NDIS_HASH_INDCNT; ++i) rss->rss_ind[i] = i % nchan; + sc->hn_flags |= HN_FLAG_HAS_RSSIND; } else { /* * # of usable channels may be changed, so we have to Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 01:38:23 2016 (r307590) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 01:55:50 2016 (r307591) @@ -800,6 +800,7 @@ static int hn_rndis_conf_offload(struct hn_softc *sc) { struct ndis_offload_params params; + uint32_t caps; size_t paramsz; int error; @@ -816,24 +817,29 @@ hn_rndis_conf_offload(struct hn_softc *s } params.ndis_hdr.ndis_size = paramsz; + caps = HN_CAP_IPCS | HN_CAP_TCP4CS | HN_CAP_TCP6CS; params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { + caps |= HN_CAP_UDP4CS | HN_CAP_UDP6CS; params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; } + caps |= HN_CAP_TSO4; params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_ON; /* XXX ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON */ error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); if (error) { if_printf(sc->hn_ifp, "offload config failed: %d\n", error); - } else { - if (bootverbose) - if_printf(sc->hn_ifp, "offload config done\n"); + return (error); } - return (error); + + if (bootverbose) + if_printf(sc->hn_ifp, "offload config done\n"); + sc->hn_caps |= caps; + return (0); } int From owner-svn-src-all@freebsd.org Wed Oct 19 02:02:22 2016 Return-Path: Delivered-To: svn-src-all@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 563B8C17655; Wed, 19 Oct 2016 02:02:22 +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 2578E288; Wed, 19 Oct 2016 02:02:22 +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 u9J22Lbq096195; Wed, 19 Oct 2016 02:02:21 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J22LpG096194; Wed, 19 Oct 2016 02:02:21 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610190202.u9J22LpG096194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 19 Oct 2016 02:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307592 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:02:22 -0000 Author: gonzo Date: Wed Oct 19 02:02:21 2016 New Revision: 307592 URL: https://svnweb.freebsd.org/changeset/base/307592 Log: bcm2835_bsc.c should be compiled only if SOC_BRCM_BCM2837 is enabled Modified: head/sys/conf/files.arm64 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Wed Oct 19 01:55:50 2016 (r307591) +++ head/sys/conf/files.arm64 Wed Oct 19 02:02:21 2016 (r307592) @@ -47,7 +47,7 @@ arm/arm/gic_fdt.c optional fdt arm/arm/pmu.c standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" -arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc +arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc soc_brcm_bcm2837 arm/broadcom/bcm2835/bcm2835_common.c optional fdt soc_brcm_bcm2837 arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 From owner-svn-src-all@freebsd.org Wed Oct 19 02:03:31 2016 Return-Path: Delivered-To: svn-src-all@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 C41A9C176D7; Wed, 19 Oct 2016 02:03:31 +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 95F7666A; Wed, 19 Oct 2016 02:03:31 +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 u9J23ULA096872; Wed, 19 Oct 2016 02:03:30 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J23UAp096871; Wed, 19 Oct 2016 02:03:30 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610190203.u9J23UAp096871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 19 Oct 2016 02:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307593 - head/sys/arm64/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:03:31 -0000 Author: gonzo Date: Wed Oct 19 02:03:30 2016 New Revision: 307593 URL: https://svnweb.freebsd.org/changeset/base/307593 Log: Move SOC_BRCM_BCM2837 to GENERIC-UP since does not support SMP Modified: head/sys/arm64/conf/GENERIC head/sys/arm64/conf/GENERIC-UP Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Wed Oct 19 02:02:21 2016 (r307592) +++ head/sys/arm64/conf/GENERIC Wed Oct 19 02:03:30 2016 (r307593) @@ -90,7 +90,6 @@ options MALLOC_DEBUG_MAXZONES=8 # Separ options SOC_ALLWINNER_A64 options SOC_CAVM_THUNDERX options SOC_HISI_HI6220 -options SOC_BRCM_BCM2837 # Annapurna Alpine drivers device al_ccu # Alpine Cache Coherency Unit Modified: head/sys/arm64/conf/GENERIC-UP ============================================================================== --- head/sys/arm64/conf/GENERIC-UP Wed Oct 19 02:02:21 2016 (r307592) +++ head/sys/arm64/conf/GENERIC-UP Wed Oct 19 02:03:30 2016 (r307593) @@ -21,3 +21,5 @@ include GENERIC ident GENERIC-UP nooptions SMP + +options SOC_BRCM_BCM2837 From owner-svn-src-all@freebsd.org Wed Oct 19 02:08:05 2016 Return-Path: Delivered-To: svn-src-all@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 99D17C17849; Wed, 19 Oct 2016 02:08:05 +0000 (UTC) (envelope-from sephe@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 57BAF8DB; Wed, 19 Oct 2016 02:08:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J284Qo097107; Wed, 19 Oct 2016 02:08:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J284K6097104; Wed, 19 Oct 2016 02:08:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190208.u9J284K6097104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 02:08: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: r307594 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:08:05 -0000 Author: sephe Date: Wed Oct 19 02:08:04 2016 New Revision: 307594 URL: https://svnweb.freebsd.org/changeset/base/307594 Log: MFC 306013,306014 306013 hyperv/hn: Fix ifnet hwassist setup. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7948 306014 hyperv/hn: Let the caller of hn_nvs_doinit() do the error logging. So that NVS version probing failure does not look too scary. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7950 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Oct 19 02:03:30 2016 (r307593) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Oct 19 02:08:04 2016 (r307594) @@ -444,8 +444,15 @@ hn_nvs_doinit(struct hn_softc *sc, uint3 vmbus_xact_put(xact); if (status != HN_NVS_STATUS_OK) { - if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n", - nvs_ver); + if (bootverbose) { + /* + * Caller may try another NVS version, and will log + * error if there are no more NVS versions to try, + * so don't bark out loud here. + */ + if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n", + nvs_ver); + } return (EINVAL); } return (0); @@ -499,7 +506,7 @@ hn_nvs_init_ndis(struct hn_softc *sc) static int hn_nvs_init(struct hn_softc *sc) { - int i; + int i, error; if (device_is_attached(sc->hn_dev)) { /* @@ -511,15 +518,19 @@ hn_nvs_init(struct hn_softc *sc) HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } - return (hn_nvs_doinit(sc, sc->hn_nvs_ver)); + + error = hn_nvs_doinit(sc, sc->hn_nvs_ver); + if (error) { + if_printf(sc->hn_ifp, "reinit NVS version 0x%x " + "failed: %d\n", sc->hn_nvs_ver, error); + } + return (error); } /* * Find the supported NVS version and set NDIS version accordingly. */ for (i = 0; i < nitems(hn_nvs_version); ++i) { - int error; - error = hn_nvs_doinit(sc, hn_nvs_version[i]); if (!error) { sc->hn_nvs_ver = hn_nvs_version[i]; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 02:03:30 2016 (r307593) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 02:08:04 2016 (r307594) @@ -180,14 +180,6 @@ struct hn_txdesc { #define HN_TXD_FLAG_ONLIST 0x1 #define HN_TXD_FLAG_DMAMAP 0x2 -/* - * Only enable UDP checksum offloading when it is on 2012R2 or - * later. UDP checksum offloading doesn't work on earlier - * Windows releases. - */ -#define HN_CSUM_ASSIST_WIN8 (CSUM_IP | CSUM_TCP) -#define HN_CSUM_ASSIST (CSUM_IP | CSUM_UDP | CSUM_TCP) - #define HN_LRO_LENLIM_MULTIRX_DEF (12 * ETHERMTU) #define HN_LRO_LENLIM_DEF (25 * ETHERMTU) /* YYY 2*MTU is a bit rough, but should be good enough. */ @@ -202,6 +194,13 @@ struct hn_txdesc { #define HN_LOCK(sc) sx_xlock(&(sc)->hn_lock) #define HN_UNLOCK(sc) sx_xunlock(&(sc)->hn_lock) +#define HN_CSUM_IP_MASK (CSUM_IP | CSUM_IP_TCP | CSUM_IP_UDP) +#define HN_CSUM_IP6_MASK (CSUM_IP6_TCP | CSUM_IP6_UDP) +#define HN_CSUM_IP_HWASSIST(sc) \ + ((sc)->hn_tx_ring[0].hn_csum_assist & HN_CSUM_IP_MASK) +#define HN_CSUM_IP6_HWASSIST(sc) \ + ((sc)->hn_tx_ring[0].hn_csum_assist & HN_CSUM_IP6_MASK) + /* * Globals */ @@ -326,12 +325,14 @@ static int hn_tx_stat_ulong_sysctl(SYSCT static int hn_tx_conf_int_sysctl(SYSCTL_HANDLER_ARGS); static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS); static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); static int hn_check_iplen(const struct mbuf *, int); static int hn_create_tx_ring(struct hn_softc *, int); static void hn_destroy_tx_ring(struct hn_tx_ring *); static int hn_create_tx_data(struct hn_softc *, int); +static void hn_fixup_tx_data(struct hn_softc *); static void hn_destroy_tx_data(struct hn_softc *); static void hn_start_taskfunc(void *, int); static void hn_start_txeof_taskfunc(void *, int); @@ -632,10 +633,10 @@ netvsc_attach(device_t dev) } #endif - hn_set_chim_size(sc, sc->hn_chim_szmax); - if (hn_tx_chimney_size > 0 && - hn_tx_chimney_size < sc->hn_chim_szmax) - hn_set_chim_size(sc, hn_tx_chimney_size); + /* + * Fixup TX stuffs after synthetic parts are attached. + */ + hn_fixup_tx_data(sc); ctx = device_get_sysctl_ctx(dev); child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); @@ -647,6 +648,9 @@ netvsc_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "caps", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_caps_sysctl, "A", "capabilities"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_hwassist_sysctl, "A", "hwassist"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); @@ -681,13 +685,32 @@ netvsc_attach(device_t dev) ifp->if_qflush = hn_xmit_qflush; } - ifp->if_capabilities |= - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO | - IFCAP_LRO; - ifp->if_capenable |= - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO | - IFCAP_LRO; - ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist | CSUM_TSO; + ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO; +#ifdef foo + /* We can't diff IPv6 packets from IPv4 packets on RX path. */ + ifp->if_capabilities |= IFCAP_RXCSUM_IPV6; +#endif + if (sc->hn_caps & HN_CAP_VLAN) { + /* XXX not sure about VLAN_MTU. */ + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + } + + ifp->if_hwassist = sc->hn_tx_ring[0].hn_csum_assist; + if (ifp->if_hwassist & HN_CSUM_IP_MASK) + ifp->if_capabilities |= IFCAP_TXCSUM; + if (ifp->if_hwassist & HN_CSUM_IP6_MASK) + ifp->if_capabilities |= IFCAP_TXCSUM_IPV6; + if (sc->hn_caps & HN_CAP_TSO4) { + ifp->if_capabilities |= IFCAP_TSO4; + ifp->if_hwassist |= CSUM_IP_TSO; + } + if (sc->hn_caps & HN_CAP_TSO6) { + ifp->if_capabilities |= IFCAP_TSO6; + ifp->if_hwassist |= CSUM_IP6_TSO; + } + + /* Enable all available capabilities by default. */ + ifp->if_capenable = ifp->if_capabilities; tso_maxlen = hn_tso_maxlen; if (tso_maxlen <= 0 || tso_maxlen > IP_MAXPACKET) @@ -1041,14 +1064,19 @@ hn_encap(struct hn_tx_ring *txr, struct } else if (m_head->m_pkthdr.csum_flags & txr->hn_csum_assist) { pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, NDIS_TXCSUM_INFO_SIZE, NDIS_PKTINFO_TYPE_CSUM); - *pi_data = NDIS_TXCSUM_INFO_IPV4; - - if (m_head->m_pkthdr.csum_flags & CSUM_IP) - *pi_data |= NDIS_TXCSUM_INFO_IPCS; + if (m_head->m_pkthdr.csum_flags & + (CSUM_IP6_TCP | CSUM_IP6_UDP)) { + *pi_data = NDIS_TXCSUM_INFO_IPV6; + } else { + *pi_data = NDIS_TXCSUM_INFO_IPV4; + if (m_head->m_pkthdr.csum_flags & CSUM_IP) + *pi_data |= NDIS_TXCSUM_INFO_IPCS; + } - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) + if (m_head->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) *pi_data |= NDIS_TXCSUM_INFO_TCPCS; - else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) + else if (m_head->m_pkthdr.csum_flags & + (CSUM_IP_UDP | CSUM_IP6_UDP)) *pi_data |= NDIS_TXCSUM_INFO_UDPCS; } @@ -1665,21 +1693,31 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, case SIOCSIFCAP: HN_LOCK(sc); - mask = ifr->ifr_reqcap ^ ifp->if_capenable; + if (mask & IFCAP_TXCSUM) { ifp->if_capenable ^= IFCAP_TXCSUM; - if (ifp->if_capenable & IFCAP_TXCSUM) { - ifp->if_hwassist |= - sc->hn_tx_ring[0].hn_csum_assist; - } else { - ifp->if_hwassist &= - ~sc->hn_tx_ring[0].hn_csum_assist; - } + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= HN_CSUM_IP_HWASSIST(sc); + else + ifp->if_hwassist &= ~HN_CSUM_IP_HWASSIST(sc); + } + if (mask & IFCAP_TXCSUM_IPV6) { + ifp->if_capenable ^= IFCAP_TXCSUM_IPV6; + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + ifp->if_hwassist |= HN_CSUM_IP6_HWASSIST(sc); + else + ifp->if_hwassist &= ~HN_CSUM_IP6_HWASSIST(sc); } + /* TODO: flip RNDIS offload parameters for RXCSUM. */ if (mask & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; +#ifdef foo + /* We can't diff IPv6 packets from IPv4 packets on RX path. */ + if (mask & IFCAP_RXCSUM_IPV6) + ifp->if_capenable ^= IFCAP_RXCSUM_IPV6; +#endif if (mask & IFCAP_LRO) ifp->if_capenable ^= IFCAP_LRO; @@ -1691,7 +1729,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, else ifp->if_hwassist &= ~CSUM_IP_TSO; } - if (mask & IFCAP_TSO6) { ifp->if_capenable ^= IFCAP_TSO6; if (ifp->if_capenable & IFCAP_TSO6) @@ -2132,6 +2169,20 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char assist_str[128]; + uint32_t hwassist; + + HN_LOCK(sc); + hwassist = sc->hn_ifp->if_hwassist; + HN_UNLOCK(sc); + snprintf(assist_str, sizeof(assist_str), "%b", hwassist, CSUM_BITS); + return sysctl_handle_string(oidp, assist_str, sizeof(assist_str), req); +} + +static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; @@ -2488,7 +2539,6 @@ hn_create_tx_ring(struct hn_softc *sc, i device_t dev = sc->hn_dev; bus_dma_tag_t parent_dtag; int error, i; - uint32_t version; txr->hn_sc = sc; txr->hn_tx_idx = id; @@ -2527,18 +2577,6 @@ hn_create_tx_ring(struct hn_softc *sc, i } txr->hn_direct_tx_size = hn_direct_tx_size; - version = VMBUS_GET_VERSION(device_get_parent(dev), dev); - if (version >= VMBUS_VERSION_WIN8_1) { - txr->hn_csum_assist = HN_CSUM_ASSIST; - } else { - txr->hn_csum_assist = HN_CSUM_ASSIST_WIN8; - if (id == 0) { - device_printf(dev, "bus version %u.%u, " - "no UDP checksum offloading\n", - VMBUS_VERSION_MAJOR(version), - VMBUS_VERSION_MINOR(version)); - } - } /* * Always schedule transmission instead of trying to do direct @@ -2834,6 +2872,35 @@ hn_set_chim_size(struct hn_softc *sc, in } static void +hn_fixup_tx_data(struct hn_softc *sc) +{ + uint64_t csum_assist; + int i; + + hn_set_chim_size(sc, sc->hn_chim_szmax); + if (hn_tx_chimney_size > 0 && + hn_tx_chimney_size < sc->hn_chim_szmax) + hn_set_chim_size(sc, hn_tx_chimney_size); + + csum_assist = 0; + if (sc->hn_caps & HN_CAP_IPCS) + csum_assist |= CSUM_IP; + if (sc->hn_caps & HN_CAP_TCP4CS) + csum_assist |= CSUM_IP_TCP; + if (sc->hn_caps & HN_CAP_UDP4CS) + csum_assist |= CSUM_IP_UDP; +#ifdef notyet + if (sc->hn_caps & HN_CAP_TCP6CS) + csum_assist |= CSUM_IP6_TCP; + if (sc->hn_caps & HN_CAP_UDP6CS) + csum_assist |= CSUM_IP6_UDP; +#endif + + for (i = 0; i < sc->hn_tx_ring_cnt; ++i) + sc->hn_tx_ring[i].hn_csum_assist = csum_assist; +} + +static void hn_destroy_tx_data(struct hn_softc *sc) { int i; From owner-svn-src-all@freebsd.org Wed Oct 19 02:14:06 2016 Return-Path: Delivered-To: svn-src-all@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 05E94C17A6A; Wed, 19 Oct 2016 02:14:06 +0000 (UTC) (envelope-from sephe@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 C7F69CCA; Wed, 19 Oct 2016 02:14:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J2E4fS001169; Wed, 19 Oct 2016 02:14:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J2E4dj001165; Wed, 19 Oct 2016 02:14:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190214.u9J2E4dj001165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 02:14: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: r307595 - in stable/11/sys/dev/hyperv: include netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:14:06 -0000 Author: sephe Date: Wed Oct 19 02:14:04 2016 New Revision: 307595 URL: https://svnweb.freebsd.org/changeset/base/307595 Log: MFC 306072-306074,306076 306072 hyperv/vmbus: Allow bufrings preallocation. The assumption that the channel is only opened upon synthetic device attach time no longer holds, e.g. Hyper-V network device MTU changes. We have to allow device drivers to preallocate bufrings, e.g. in attach DEVMETHOD, to prevent bufring allocation failure once the system memory is fragmented after running for a while. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7960 306073 hyperv/hn: Allocate bufrings in attach DEVMETHOD. So that reinitialization, e.g. MTU change, will not fail when the system memory is excessively fragmented. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7961 306074 hyperv/vmbus: Assert that the bufring address is page aligned. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7962 306076 hyperv/hn: Put debug messages under bootverbose While I'm here, strip blank line. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7963 Modified: stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Wed Oct 19 02:08:04 2016 (r307594) +++ stable/11/sys/dev/hyperv/include/vmbus.h Wed Oct 19 02:14:04 2016 (r307595) @@ -108,6 +108,13 @@ struct vmbus_chanpkt_rxbuf { struct vmbus_rxbuf_desc cp_rxbuf[]; } __packed; +struct vmbus_chan_br { + void *cbr; + bus_addr_t cbr_paddr; + int cbr_txsz; + int cbr_rxsz; +}; + struct vmbus_channel; struct hyperv_guid; @@ -122,6 +129,9 @@ vmbus_get_channel(device_t dev) int vmbus_chan_open(struct vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg); +int vmbus_chan_open_br(struct vmbus_channel *chan, + const struct vmbus_chan_br *cbr, const void *udata, + int udlen, vmbus_chan_callback_t cb, void *cbarg); void vmbus_chan_close(struct vmbus_channel *chan); int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 02:08:04 2016 (r307594) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 02:14:04 2016 (r307595) @@ -136,6 +136,9 @@ struct hn_rx_ring { /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; int hn_rx_flags; + + void *hn_br; /* TX/RX bufring */ + struct hyperv_dma hn_br_dma; } __aligned(CACHE_LINE_SIZE); #define HN_TRUST_HCSUM_IP 0x0001 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 02:08:04 2016 (r307594) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 02:14:04 2016 (r307595) @@ -2358,7 +2358,8 @@ hn_create_rx_data(struct hn_softc *sc, i lroent_cnt = hn_lro_entry_count; if (lroent_cnt < TCP_LRO_ENTRIES) lroent_cnt = TCP_LRO_ENTRIES; - device_printf(dev, "LRO: entry count %d\n", lroent_cnt); + if (bootverbose) + device_printf(dev, "LRO: entry count %d\n", lroent_cnt); #endif #endif /* INET || INET6 */ @@ -2372,6 +2373,16 @@ hn_create_rx_data(struct hn_softc *sc, i for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; + rxr->hn_br = hyperv_dmamem_alloc(bus_get_dma_tag(dev), + PAGE_SIZE, 0, + NETVSC_DEVICE_RING_BUFFER_SIZE + + NETVSC_DEVICE_RING_BUFFER_SIZE, + &rxr->hn_br_dma, BUS_DMA_WAITOK); + if (rxr->hn_br == NULL) { + device_printf(dev, "allocate bufring failed\n"); + return (ENOMEM); + } + if (hn_trust_hosttcp) rxr->hn_trust_hcsum |= HN_TRUST_HCSUM_TCP; if (hn_trust_hostudp) @@ -2520,6 +2531,11 @@ hn_destroy_rx_data(struct hn_softc *sc) for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; + if (rxr->hn_br == NULL) + continue; + hyperv_dmamem_free(&rxr->hn_br_dma, rxr->hn_br); + rxr->hn_br = NULL; + #if defined(INET) || defined(INET6) tcp_lro_free(&rxr->hn_lro); #endif @@ -3125,6 +3141,7 @@ hn_xmit_txeof_taskfunc(void *xtxr, int p static int hn_chan_attach(struct hn_softc *sc, struct vmbus_channel *chan) { + struct vmbus_chan_br cbr; struct hn_rx_ring *rxr; struct hn_tx_ring *txr = NULL; int idx, error; @@ -3163,9 +3180,14 @@ hn_chan_attach(struct hn_softc *sc, stru /* Bind this channel to a proper CPU. */ vmbus_chan_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); - /* Open this channel */ - error = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, - NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hn_chan_callback, rxr); + /* + * Open this channel + */ + cbr.cbr = rxr->hn_br; + cbr.cbr_paddr = rxr->hn_br_dma.hv_paddr; + cbr.cbr_txsz = NETVSC_DEVICE_RING_BUFFER_SIZE; + cbr.cbr_rxsz = NETVSC_DEVICE_RING_BUFFER_SIZE; + error = vmbus_chan_open_br(chan, &cbr, NULL, 0, hn_chan_callback, rxr); if (error) { if_printf(sc->hn_ifp, "open chan%u failed: %d\n", vmbus_chan_id(chan), error); @@ -3308,8 +3330,10 @@ hn_synth_alloc_subchans(struct hn_softc *nsubch = 0; return (0); } - if_printf(sc->hn_ifp, "RX rings offered %u, requested %d\n", - rxr_cnt, nchan); + if (bootverbose) { + if_printf(sc->hn_ifp, "RX rings offered %u, requested %d\n", + rxr_cnt, nchan); + } if (nchan > rxr_cnt) nchan = rxr_cnt; @@ -3318,7 +3342,7 @@ hn_synth_alloc_subchans(struct hn_softc *nsubch = 0; return (0); } - + /* * Allocate sub-channels from NVS. */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 02:08:04 2016 (r307594) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 02:14:04 2016 (r307595) @@ -196,13 +196,45 @@ int vmbus_chan_open(struct vmbus_channel *chan, int txbr_size, int rxbr_size, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) { + struct vmbus_chan_br cbr; + int error; + + /* + * Allocate the TX+RX bufrings. + */ + KASSERT(chan->ch_bufring == NULL, ("bufrings are allocated")); + chan->ch_bufring = hyperv_dmamem_alloc(bus_get_dma_tag(chan->ch_dev), + PAGE_SIZE, 0, txbr_size + rxbr_size, &chan->ch_bufring_dma, + BUS_DMA_WAITOK); + if (chan->ch_bufring == NULL) { + device_printf(chan->ch_dev, "bufring allocation failed\n"); + return (ENOMEM); + } + + cbr.cbr = chan->ch_bufring; + cbr.cbr_paddr = chan->ch_bufring_dma.hv_paddr; + cbr.cbr_txsz = txbr_size; + cbr.cbr_rxsz = rxbr_size; + + error = vmbus_chan_open_br(chan, &cbr, udata, udlen, cb, cbarg); + if (error) { + hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); + chan->ch_bufring = NULL; + } + return (error); +} + +int +vmbus_chan_open_br(struct vmbus_channel *chan, const struct vmbus_chan_br *cbr, + const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) +{ struct vmbus_softc *sc = chan->ch_vmbus; const struct vmbus_chanmsg_chopen_resp *resp; const struct vmbus_message *msg; struct vmbus_chanmsg_chopen *req; struct vmbus_msghc *mh; uint32_t status; - int error; + int error, txbr_size, rxbr_size; uint8_t *br; if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { @@ -210,10 +242,21 @@ vmbus_chan_open(struct vmbus_channel *ch "invalid udata len %d for chan%u\n", udlen, chan->ch_id); return EINVAL; } + + br = cbr->cbr; + txbr_size = cbr->cbr_txsz; + rxbr_size = cbr->cbr_rxsz; KASSERT((txbr_size & PAGE_MASK) == 0, ("send bufring size is not multiple page")); KASSERT((rxbr_size & PAGE_MASK) == 0, ("recv bufring size is not multiple page")); + KASSERT((cbr->cbr_paddr & PAGE_MASK) == 0, + ("bufring is not page aligned")); + + /* + * Zero out the TX/RX bufrings, in case that they were used before. + */ + memset(br, 0, txbr_size + rxbr_size); if (atomic_testandset_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED_SHIFT)) @@ -230,20 +273,6 @@ vmbus_chan_open(struct vmbus_channel *ch else TASK_INIT(&chan->ch_task, 0, vmbus_chan_task_nobatch, chan); - /* - * Allocate the TX+RX bufrings. - * XXX should use ch_dev dtag - */ - br = hyperv_dmamem_alloc(bus_get_dma_tag(sc->vmbus_dev), - PAGE_SIZE, 0, txbr_size + rxbr_size, &chan->ch_bufring_dma, - BUS_DMA_WAITOK | BUS_DMA_ZERO); - if (br == NULL) { - device_printf(sc->vmbus_dev, "bufring allocation failed\n"); - error = ENOMEM; - goto failed; - } - chan->ch_bufring = br; - /* TX bufring comes first */ vmbus_txbr_setup(&chan->ch_txbr, br, txbr_size); /* RX bufring immediately follows TX bufring */ @@ -255,7 +284,7 @@ vmbus_chan_open(struct vmbus_channel *ch /* * Connect the bufrings, both RX and TX, to this channel. */ - error = vmbus_chan_gpadl_connect(chan, chan->ch_bufring_dma.hv_paddr, + error = vmbus_chan_gpadl_connect(chan, cbr->cbr_paddr, txbr_size + rxbr_size, &chan->ch_bufring_gpadl); if (error) { device_printf(sc->vmbus_dev, @@ -316,10 +345,6 @@ failed: vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); chan->ch_bufring_gpadl = 0; } - if (chan->ch_bufring != NULL) { - hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring); - chan->ch_bufring = NULL; - } atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); return error; } From owner-svn-src-all@freebsd.org Wed Oct 19 02:15:42 2016 Return-Path: Delivered-To: svn-src-all@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 E4574C17AEA; Wed, 19 Oct 2016 02:15:42 +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 B40D2E37; Wed, 19 Oct 2016 02:15:42 +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 u9J2Ffwh001289; Wed, 19 Oct 2016 02:15:41 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J2Ff2t001288; Wed, 19 Oct 2016 02:15:41 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610190215.u9J2Ff2t001288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 19 Oct 2016 02:15: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: r307596 - stable/11/sys/arm/broadcom/bcm2835 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:15:43 -0000 Author: gonzo Date: Wed Oct 19 02:15:41 2016 New Revision: 307596 URL: https://svnweb.freebsd.org/changeset/base/307596 Log: MFC r306557, r307240, r307241: r306557: Use VM_MEMATTR_WRITE_COMBINING memattr for mmap(2) on framebuffer VM_MEMATTR_WRITE_COMBINING sets write-through cache flag for framebuffer memory that prevents pixel data from being stuck in cache until evicition happens r307240: Fix BCM238x framebuffer driver build for ARM64 VM_MEMATTR_WRITE_COMBINING can be undefined for some platforms, use it only if it's defined r307241: Do not set FB_FLAG_MEMATTR if VM_MEMATTR_WRITE_COMBINING is not available Pintyhat to: gonzo Spotted by: jmallett Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed Oct 19 02:14:04 2016 (r307595) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed Oct 19 02:15:41 2016 (r307596) @@ -119,6 +119,10 @@ bcm_fb_setup_fbd(struct bcmsc_softc *sc) sc->info.fb_stride = fb.pitch; sc->info.fb_width = fb.xres; sc->info.fb_height = fb.yres; +#ifdef VM_MEMATTR_WRITE_COMBINING + sc->info.fb_flags = FB_FLAG_MEMATTR; + sc->info.fb_memattr = VM_MEMATTR_WRITE_COMBINING; +#endif if (sc->fbswap) { switch (sc->info.fb_bpp) { From owner-svn-src-all@freebsd.org Wed Oct 19 02:20:49 2016 Return-Path: Delivered-To: svn-src-all@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 E2E48C17D3D; Wed, 19 Oct 2016 02:20:49 +0000 (UTC) (envelope-from sephe@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 B199D114; Wed, 19 Oct 2016 02:20:49 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J2KmPf001546; Wed, 19 Oct 2016 02:20:48 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J2KmZ0001545; Wed, 19 Oct 2016 02:20:48 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190220.u9J2KmZ0001545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 02:20: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: r307597 - stable/11/sys/dev/pci X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:20:50 -0000 Author: sephe Date: Wed Oct 19 02:20:48 2016 New Revision: 307597 URL: https://svnweb.freebsd.org/changeset/base/307597 Log: MFC 306359 pci: Clear the MEM/PORT_EN bit when updating PCI BAR It's unsafe to update the BAR when the related EN bit is set. Submitted by: Dexuan Cui Reviewed by: jhb Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7914 Modified: stable/11/sys/dev/pci/pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pci/pci.c ============================================================================== --- stable/11/sys/dev/pci/pci.c Wed Oct 19 02:15:41 2016 (r307596) +++ stable/11/sys/dev/pci/pci.c Wed Oct 19 02:20:48 2016 (r307597) @@ -4999,6 +4999,7 @@ pci_reserve_map(device_t dev, device_t c struct resource_list *rl = &dinfo->resources; struct resource *res; struct pci_map *pm; + uint16_t cmd; pci_addr_t map, testval; int mapsize; @@ -5088,8 +5089,17 @@ pci_reserve_map(device_t dev, device_t c device_printf(child, "Lazy allocation of %#jx bytes rid %#x type %d at %#jx\n", count, *rid, type, rman_get_start(res)); + + /* Disable decoding via the CMD register before updating the BAR */ + cmd = pci_read_config(child, PCIR_COMMAND, 2); + pci_write_config(child, PCIR_COMMAND, + cmd & ~(PCI_BAR_MEM(map) ? PCIM_CMD_MEMEN : PCIM_CMD_PORTEN), 2); + map = rman_get_start(res); pci_write_bar(child, pm, map); + + /* Restore the original value of the CMD register */ + pci_write_config(child, PCIR_COMMAND, cmd, 2); out: return (res); } From owner-svn-src-all@freebsd.org Wed Oct 19 02:23:30 2016 Return-Path: Delivered-To: svn-src-all@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 CBF7DC17F39; Wed, 19 Oct 2016 02:23:30 +0000 (UTC) (envelope-from jhibbits@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 9853B6D6; Wed, 19 Oct 2016 02:23:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J2NT4n005011; Wed, 19 Oct 2016 02:23:29 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J2NTiS005010; Wed, 19 Oct 2016 02:23:29 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610190223.u9J2NTiS005010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 19 Oct 2016 02:23:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307598 - head/sys/powerpc/fpu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:23:30 -0000 Author: jhibbits Date: Wed Oct 19 02:23:29 2016 New Revision: 307598 URL: https://svnweb.freebsd.org/changeset/base/307598 Log: Un-static two local variables in the FPU emulator Static variables aren't MP-safe, and this was causing bizarre segfaults on a dual-core e500v2 system (P1022). Still left is one static variable, which should be moved into the pcb instead, but as illegal instructions haven't been hit yet, it's lower priority. MFC after: 1 week Modified: head/sys/powerpc/fpu/fpu_emu.c Modified: head/sys/powerpc/fpu/fpu_emu.c ============================================================================== --- head/sys/powerpc/fpu/fpu_emu.c Wed Oct 19 02:20:48 2016 (r307597) +++ head/sys/powerpc/fpu/fpu_emu.c Wed Oct 19 02:23:29 2016 (r307598) @@ -185,8 +185,8 @@ fpu_dumpfpn(struct fpn *fp) int fpu_emulate(struct trapframe *frame, struct fpu *fpf) { - static union instr insn; - static struct fpemu fe; + union instr insn; + struct fpemu fe; static int lastill = 0; int sig; From owner-svn-src-all@freebsd.org Wed Oct 19 02:24:19 2016 Return-Path: Delivered-To: svn-src-all@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 300BFC17F8F; Wed, 19 Oct 2016 02:24:19 +0000 (UTC) (envelope-from sephe@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 C06568A6; Wed, 19 Oct 2016 02:24:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J2OHEk005085; Wed, 19 Oct 2016 02:24:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J2OHhn005079; Wed, 19 Oct 2016 02:24:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190224.u9J2OHhn005079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 02:24:17 +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: r307599 - in stable/11/sys/dev/hyperv: include 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:24:19 -0000 Author: sephe Date: Wed Oct 19 02:24:17 2016 New Revision: 307599 URL: https://svnweb.freebsd.org/changeset/base/307599 Log: MFC 306360,306387,306389 306360 hyperv/vmbus: Add dynamic device add and remove support Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8008 306387 hyperv/vmbus: Add functions to test RX/TX bufring emptiness Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8044 306389 hyperv/vmbus: Add function to drain channel interrupt task. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8045 Modified: stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Wed Oct 19 02:23:29 2016 (r307598) +++ stable/11/sys/dev/hyperv/include/vmbus.h Wed Oct 19 02:24:17 2016 (r307599) @@ -133,6 +133,7 @@ int vmbus_chan_open_br(struct vmbus_cha const struct vmbus_chan_br *cbr, const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg); void vmbus_chan_close(struct vmbus_channel *chan); +void vmbus_chan_intr_drain(struct vmbus_channel *chan); int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl); @@ -173,5 +174,7 @@ const struct hyperv_guid * vmbus_chan_guid_inst(const struct vmbus_channel *chan); int vmbus_chan_prplist_nelem(int br_size, int prpcnt_max, int dlen_max); +bool vmbus_chan_rx_empty(const struct vmbus_channel *chan); +bool vmbus_chan_tx_empty(const struct vmbus_channel *chan); #endif /* !_VMBUS_H_ */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Wed Oct 19 02:23:29 2016 (r307598) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Wed Oct 19 02:24:17 2016 (r307599) @@ -83,9 +83,7 @@ static int vmbus_connect(struct vmbus_ static int vmbus_req_channels(struct vmbus_softc *sc); static void vmbus_disconnect(struct vmbus_softc *); static int vmbus_scan(struct vmbus_softc *); -static void vmbus_scan_wait(struct vmbus_softc *); -static void vmbus_scan_newchan(struct vmbus_softc *); -static void vmbus_scan_newdev(struct vmbus_softc *); +static void vmbus_scan_teardown(struct vmbus_softc *); static void vmbus_scan_done(struct vmbus_softc *, const struct vmbus_message *); static void vmbus_chanmsg_handle(struct vmbus_softc *, @@ -393,50 +391,22 @@ vmbus_req_channels(struct vmbus_softc *s } static void -vmbus_scan_newchan(struct vmbus_softc *sc) +vmbus_scan_done_task(void *xsc, int pending __unused) { - mtx_lock(&sc->vmbus_scan_lock); - if ((sc->vmbus_scan_chcnt & VMBUS_SCAN_CHCNT_DONE) == 0) - sc->vmbus_scan_chcnt++; - mtx_unlock(&sc->vmbus_scan_lock); + struct vmbus_softc *sc = xsc; + + mtx_lock(&Giant); + sc->vmbus_scandone = true; + mtx_unlock(&Giant); + wakeup(&sc->vmbus_scandone); } static void vmbus_scan_done(struct vmbus_softc *sc, const struct vmbus_message *msg __unused) { - mtx_lock(&sc->vmbus_scan_lock); - sc->vmbus_scan_chcnt |= VMBUS_SCAN_CHCNT_DONE; - mtx_unlock(&sc->vmbus_scan_lock); - wakeup(&sc->vmbus_scan_chcnt); -} - -static void -vmbus_scan_newdev(struct vmbus_softc *sc) -{ - mtx_lock(&sc->vmbus_scan_lock); - sc->vmbus_scan_devcnt++; - mtx_unlock(&sc->vmbus_scan_lock); - wakeup(&sc->vmbus_scan_devcnt); -} - -static void -vmbus_scan_wait(struct vmbus_softc *sc) -{ - uint32_t chancnt; - - mtx_lock(&sc->vmbus_scan_lock); - while ((sc->vmbus_scan_chcnt & VMBUS_SCAN_CHCNT_DONE) == 0) { - mtx_sleep(&sc->vmbus_scan_chcnt, &sc->vmbus_scan_lock, 0, - "waitch", 0); - } - chancnt = sc->vmbus_scan_chcnt & ~VMBUS_SCAN_CHCNT_DONE; - while (sc->vmbus_scan_devcnt != chancnt) { - mtx_sleep(&sc->vmbus_scan_devcnt, &sc->vmbus_scan_lock, 0, - "waitdev", 0); - } - mtx_unlock(&sc->vmbus_scan_lock); + taskqueue_enqueue(sc->vmbus_devtq, &sc->vmbus_scandone_task); } static int @@ -445,31 +415,71 @@ vmbus_scan(struct vmbus_softc *sc) int error; /* + * Identify, probe and attach for non-channel devices. + */ + bus_generic_probe(sc->vmbus_dev); + bus_generic_attach(sc->vmbus_dev); + + /* + * This taskqueue serializes vmbus devices' attach and detach + * for channel offer and rescind messages. + */ + sc->vmbus_devtq = taskqueue_create("vmbus dev", M_WAITOK, + taskqueue_thread_enqueue, &sc->vmbus_devtq); + taskqueue_start_threads(&sc->vmbus_devtq, 1, PI_NET, "vmbusdev"); + TASK_INIT(&sc->vmbus_scandone_task, 0, vmbus_scan_done_task, sc); + + /* + * This taskqueue handles sub-channel detach, so that vmbus + * device's detach running in vmbus_devtq can drain its sub- + * channels. + */ + sc->vmbus_subchtq = taskqueue_create("vmbus subch", M_WAITOK, + taskqueue_thread_enqueue, &sc->vmbus_subchtq); + taskqueue_start_threads(&sc->vmbus_subchtq, 1, PI_NET, "vmbussch"); + + /* * Start vmbus scanning. */ error = vmbus_req_channels(sc); if (error) { device_printf(sc->vmbus_dev, "channel request failed: %d\n", error); - return error; + return (error); } /* - * Wait for all devices are added to vmbus. + * Wait for all vmbus devices from the initial channel offers to be + * attached. */ - vmbus_scan_wait(sc); - - /* - * Identify, probe and attach. - */ - bus_generic_probe(sc->vmbus_dev); - bus_generic_attach(sc->vmbus_dev); + GIANT_REQUIRED; + while (!sc->vmbus_scandone) + mtx_sleep(&sc->vmbus_scandone, &Giant, 0, "vmbusdev", 0); if (bootverbose) { device_printf(sc->vmbus_dev, "device scan, probe and attach " "done\n"); } - return 0; + return (0); +} + +static void +vmbus_scan_teardown(struct vmbus_softc *sc) +{ + + GIANT_REQUIRED; + if (sc->vmbus_devtq != NULL) { + mtx_unlock(&Giant); + taskqueue_free(sc->vmbus_devtq); + mtx_lock(&Giant); + sc->vmbus_devtq = NULL; + } + if (sc->vmbus_subchtq != NULL) { + mtx_unlock(&Giant); + taskqueue_free(sc->vmbus_subchtq); + mtx_lock(&Giant); + sc->vmbus_subchtq = NULL; + } } static void @@ -918,45 +928,35 @@ vmbus_add_child(struct vmbus_channel *ch { struct vmbus_softc *sc = chan->ch_vmbus; device_t parent = sc->vmbus_dev; - int error = 0; - /* New channel has been offered */ - vmbus_scan_newchan(sc); + mtx_lock(&Giant); chan->ch_dev = device_add_child(parent, NULL, -1); if (chan->ch_dev == NULL) { + mtx_unlock(&Giant); device_printf(parent, "device_add_child for chan%u failed\n", chan->ch_id); - error = ENXIO; - goto done; + return (ENXIO); } device_set_ivars(chan->ch_dev, chan); + device_probe_and_attach(chan->ch_dev); -done: - /* New device has been/should be added to vmbus. */ - vmbus_scan_newdev(sc); - return error; + mtx_unlock(&Giant); + return (0); } int vmbus_delete_child(struct vmbus_channel *chan) { - int error; - - if (chan->ch_dev == NULL) { - /* Failed to add a device. */ - return 0; - } + int error = 0; - /* - * XXXKYS: Ensure that this is the opposite of - * device_add_child() - */ mtx_lock(&Giant); - error = device_delete_child(chan->ch_vmbus->vmbus_dev, chan->ch_dev); + if (chan->ch_dev != NULL) { + error = device_delete_child(chan->ch_vmbus->vmbus_dev, + chan->ch_dev); + } mtx_unlock(&Giant); - - return error; + return (error); } static int @@ -1028,10 +1028,11 @@ vmbus_doattach(struct vmbus_softc *sc) return (0); sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; - mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); sc->vmbus_gpadl = VMBUS_GPADL_START; mtx_init(&sc->vmbus_prichan_lock, "vmbus prichan", NULL, MTX_DEF); TAILQ_INIT(&sc->vmbus_prichans); + mtx_init(&sc->vmbus_chan_lock, "vmbus channel", NULL, MTX_DEF); + TAILQ_INIT(&sc->vmbus_chans); sc->vmbus_chmap = malloc( sizeof(struct vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF, M_WAITOK | M_ZERO); @@ -1095,6 +1096,7 @@ vmbus_doattach(struct vmbus_softc *sc) return (ret); cleanup: + vmbus_scan_teardown(sc); vmbus_intr_teardown(sc); vmbus_dma_free(sc); if (sc->vmbus_xc != NULL) { @@ -1102,8 +1104,8 @@ cleanup: sc->vmbus_xc = NULL; } free(sc->vmbus_chmap, M_DEVBUF); - mtx_destroy(&sc->vmbus_scan_lock); mtx_destroy(&sc->vmbus_prichan_lock); + mtx_destroy(&sc->vmbus_chan_lock); return (ret); } @@ -1146,8 +1148,11 @@ vmbus_detach(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); + bus_generic_detach(dev); vmbus_chan_destroy_all(sc); + vmbus_scan_teardown(sc); + vmbus_disconnect(sc); if (sc->vmbus_flags & VMBUS_FLAG_SYNIC) { @@ -1164,8 +1169,8 @@ vmbus_detach(device_t dev) } free(sc->vmbus_chmap, M_DEVBUF); - mtx_destroy(&sc->vmbus_scan_lock); mtx_destroy(&sc->vmbus_prichan_lock); + mtx_destroy(&sc->vmbus_chan_lock); return (0); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Wed Oct 19 02:23:29 2016 (r307598) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_brvar.h Wed Oct 19 02:24:17 2016 (r307599) @@ -83,6 +83,20 @@ vmbus_txbr_maxpktsz(const struct vmbus_t return (tbr->txbr_dsize - sizeof(uint64_t) - 1); } +static __inline bool +vmbus_txbr_empty(const struct vmbus_txbr *tbr) +{ + + return (tbr->txbr_windex == tbr->txbr_rindex ? true : false); +} + +static __inline bool +vmbus_rxbr_empty(const struct vmbus_rxbr *rbr) +{ + + return (rbr->rxbr_windex == rbr->rxbr_rindex ? true : false); +} + static __inline int vmbus_br_nelem(int br_size, int elem_size) { Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 02:23:29 2016 (r307598) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 02:24:17 2016 (r307599) @@ -59,10 +59,30 @@ static struct vmbus_channel *vmbus_chan_ static void vmbus_chan_free(struct vmbus_channel *); static int vmbus_chan_add(struct vmbus_channel *); static void vmbus_chan_cpu_default(struct vmbus_channel *); +static int vmbus_chan_release(struct vmbus_channel *); +static void vmbus_chan_set_chmap(struct vmbus_channel *); +static void vmbus_chan_clear_chmap(struct vmbus_channel *); + +static void vmbus_chan_ins_prilist(struct vmbus_softc *, + struct vmbus_channel *); +static void vmbus_chan_rem_prilist(struct vmbus_softc *, + struct vmbus_channel *); +static void vmbus_chan_ins_list(struct vmbus_softc *, + struct vmbus_channel *); +static void vmbus_chan_rem_list(struct vmbus_softc *, + struct vmbus_channel *); +static void vmbus_chan_ins_sublist(struct vmbus_channel *, + struct vmbus_channel *); +static void vmbus_chan_rem_sublist(struct vmbus_channel *, + struct vmbus_channel *); static void vmbus_chan_task(void *, int); static void vmbus_chan_task_nobatch(void *, int); -static void vmbus_chan_detach_task(void *, int); +static void vmbus_chan_clrchmap_task(void *, int); +static void vmbus_prichan_attach_task(void *, int); +static void vmbus_subchan_attach_task(void *, int); +static void vmbus_prichan_detach_task(void *, int); +static void vmbus_subchan_detach_task(void *, int); static void vmbus_chan_msgproc_choffer(struct vmbus_softc *, const struct vmbus_message *); @@ -96,6 +116,83 @@ vmbus_chan_signal_tx(const struct vmbus_ hypercall_signal_event(chan->ch_monprm_dma.hv_paddr); } +static void +vmbus_chan_ins_prilist(struct vmbus_softc *sc, struct vmbus_channel *chan) +{ + + mtx_assert(&sc->vmbus_prichan_lock, MA_OWNED); + if (atomic_testandset_int(&chan->ch_stflags, + VMBUS_CHAN_ST_ONPRIL_SHIFT)) + panic("channel is already on the prilist"); + TAILQ_INSERT_TAIL(&sc->vmbus_prichans, chan, ch_prilink); +} + +static void +vmbus_chan_rem_prilist(struct vmbus_softc *sc, struct vmbus_channel *chan) +{ + + mtx_assert(&sc->vmbus_prichan_lock, MA_OWNED); + if (atomic_testandclear_int(&chan->ch_stflags, + VMBUS_CHAN_ST_ONPRIL_SHIFT) == 0) + panic("channel is not on the prilist"); + TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); +} + +static void +vmbus_chan_ins_sublist(struct vmbus_channel *prichan, + struct vmbus_channel *chan) +{ + + mtx_assert(&prichan->ch_subchan_lock, MA_OWNED); + + if (atomic_testandset_int(&chan->ch_stflags, + VMBUS_CHAN_ST_ONSUBL_SHIFT)) + panic("channel is already on the sublist"); + TAILQ_INSERT_TAIL(&prichan->ch_subchans, chan, ch_sublink); + + /* Bump sub-channel count. */ + prichan->ch_subchan_cnt++; +} + +static void +vmbus_chan_rem_sublist(struct vmbus_channel *prichan, + struct vmbus_channel *chan) +{ + + mtx_assert(&prichan->ch_subchan_lock, MA_OWNED); + + KASSERT(prichan->ch_subchan_cnt > 0, + ("invalid subchan_cnt %d", prichan->ch_subchan_cnt)); + prichan->ch_subchan_cnt--; + + if (atomic_testandclear_int(&chan->ch_stflags, + VMBUS_CHAN_ST_ONSUBL_SHIFT) == 0) + panic("channel is not on the sublist"); + TAILQ_REMOVE(&prichan->ch_subchans, chan, ch_sublink); +} + +static void +vmbus_chan_ins_list(struct vmbus_softc *sc, struct vmbus_channel *chan) +{ + + mtx_assert(&sc->vmbus_chan_lock, MA_OWNED); + if (atomic_testandset_int(&chan->ch_stflags, + VMBUS_CHAN_ST_ONLIST_SHIFT)) + panic("channel is already on the list"); + TAILQ_INSERT_TAIL(&sc->vmbus_chans, chan, ch_link); +} + +static void +vmbus_chan_rem_list(struct vmbus_softc *sc, struct vmbus_channel *chan) +{ + + mtx_assert(&sc->vmbus_chan_lock, MA_OWNED); + if (atomic_testandclear_int(&chan->ch_stflags, + VMBUS_CHAN_ST_ONLIST_SHIFT) == 0) + panic("channel is not on the list"); + TAILQ_REMOVE(&sc->vmbus_chans, chan, ch_link); +} + static int vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS) { @@ -235,6 +332,7 @@ vmbus_chan_open_br(struct vmbus_channel struct vmbus_msghc *mh; uint32_t status; int error, txbr_size, rxbr_size; + task_fn_t *task_fn; uint8_t *br; if (udlen > VMBUS_CHANMSG_CHOPEN_UDATA_SIZE) { @@ -269,9 +367,10 @@ vmbus_chan_open_br(struct vmbus_channel chan->ch_tq = VMBUS_PCPU_GET(chan->ch_vmbus, event_tq, chan->ch_cpuid); if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) - TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan); + task_fn = vmbus_chan_task; else - TASK_INIT(&chan->ch_task, 0, vmbus_chan_task_nobatch, chan); + task_fn = vmbus_chan_task_nobatch; + TASK_INIT(&chan->ch_task, 0, task_fn, chan); /* TX bufring comes first */ vmbus_txbr_setup(&chan->ch_txbr, br, txbr_size); @@ -293,6 +392,12 @@ vmbus_chan_open_br(struct vmbus_channel } /* + * Install this channel, before it is opened, but after everything + * else has been setup. + */ + vmbus_chan_set_chmap(chan); + + /* * Open channel w/ the bufring GPADL on the target CPU. */ mh = vmbus_msghc_get(sc, sizeof(*req)); @@ -341,6 +446,7 @@ vmbus_chan_open_br(struct vmbus_channel error = ENXIO; failed: + vmbus_chan_clear_chmap(chan); if (chan->ch_bufring_gpadl) { vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl); chan->ch_bufring_gpadl = 0; @@ -517,12 +623,38 @@ vmbus_chan_gpadl_disconnect(struct vmbus } static void +vmbus_chan_clrchmap_task(void *xchan, int pending __unused) +{ + struct vmbus_channel *chan = xchan; + + critical_enter(); + chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL; + critical_exit(); +} + +static void +vmbus_chan_clear_chmap(struct vmbus_channel *chan) +{ + struct task chmap_task; + + TASK_INIT(&chmap_task, 0, vmbus_chan_clrchmap_task, chan); + taskqueue_enqueue(chan->ch_tq, &chmap_task); + taskqueue_drain(chan->ch_tq, &chmap_task); +} + +static void +vmbus_chan_set_chmap(struct vmbus_channel *chan) +{ + __compiler_membar(); + chan->ch_vmbus->vmbus_chmap[chan->ch_id] = chan; +} + +static void vmbus_chan_close_internal(struct vmbus_channel *chan) { struct vmbus_softc *sc = chan->ch_vmbus; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; - struct taskqueue *tq = chan->ch_tq; int error; /* TODO: stringent check */ @@ -535,12 +667,14 @@ vmbus_chan_close_internal(struct vmbus_c sysctl_ctx_free(&chan->ch_sysctl_ctx); /* - * Set ch_tq to NULL to avoid more requests be scheduled. - * XXX pretty broken; need rework. + * NOTE: + * Order is critical. This channel _must_ be uninstalled first, + * else the channel task may be enqueued by the IDT after it has + * been drained. */ + vmbus_chan_clear_chmap(chan); + taskqueue_drain(chan->ch_tq, &chan->ch_task); chan->ch_tq = NULL; - taskqueue_drain(tq, &chan->ch_task); - chan->ch_cb = NULL; /* * Close this channel. @@ -622,6 +756,13 @@ vmbus_chan_close(struct vmbus_channel *c vmbus_chan_close_internal(chan); } +void +vmbus_chan_intr_drain(struct vmbus_channel *chan) +{ + + taskqueue_drain(chan->ch_tq, &chan->ch_task); +} + int vmbus_chan_send(struct vmbus_channel *chan, uint16_t type, uint16_t flags, void *data, int dlen, uint64_t xactid) @@ -884,10 +1025,11 @@ vmbus_event_flags_proc(struct vmbus_soft flags &= ~(1UL << chid_ofs); chan = sc->vmbus_chmap[chid_base + chid_ofs]; - - /* if channel is closed or closing */ - if (chan == NULL || chan->ch_tq == NULL) + if (__predict_false(chan == NULL)) { + /* Channel is closed. */ continue; + } + __compiler_membar(); if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) vmbus_rxbr_intr_mask(&chan->ch_rxbr); @@ -968,7 +1110,6 @@ vmbus_chan_alloc(struct vmbus_softc *sc) chan->ch_vmbus = sc; mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF); TAILQ_INIT(&chan->ch_subchans); - TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan); vmbus_rxbr_init(&chan->ch_rxbr); vmbus_txbr_init(&chan->ch_txbr); @@ -978,9 +1119,14 @@ vmbus_chan_alloc(struct vmbus_softc *sc) static void vmbus_chan_free(struct vmbus_channel *chan) { - /* TODO: assert sub-channel list is empty */ - /* TODO: asset no longer on the primary channel's sub-channel list */ - /* TODO: asset no longer on the vmbus channel list */ + + KASSERT(TAILQ_EMPTY(&chan->ch_subchans) && chan->ch_subchan_cnt == 0, + ("still owns sub-channels")); + KASSERT((chan->ch_stflags & + (VMBUS_CHAN_ST_OPENED | + VMBUS_CHAN_ST_ONPRIL | + VMBUS_CHAN_ST_ONSUBL | + VMBUS_CHAN_ST_ONLIST)) == 0, ("free busy channel")); hyperv_dmamem_free(&chan->ch_monprm_dma, chan->ch_monprm); mtx_destroy(&chan->ch_subchan_lock); vmbus_rxbr_deinit(&chan->ch_rxbr); @@ -1007,7 +1153,6 @@ vmbus_chan_add(struct vmbus_channel *new newchan->ch_id); return EINVAL; } - sc->vmbus_chmap[newchan->ch_id] = newchan; if (bootverbose) { device_printf(sc->vmbus_dev, "chan%u subidx%u offer\n", @@ -1029,10 +1174,9 @@ vmbus_chan_add(struct vmbus_channel *new if (VMBUS_CHAN_ISPRIMARY(newchan)) { if (prichan == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL(&sc->vmbus_prichans, newchan, - ch_prilink); + vmbus_chan_ins_prilist(sc, newchan); mtx_unlock(&sc->vmbus_prichan_lock); - return 0; + goto done; } else { mtx_unlock(&sc->vmbus_prichan_lock); device_printf(sc->vmbus_dev, "duplicated primary " @@ -1066,16 +1210,20 @@ vmbus_chan_add(struct vmbus_channel *new newchan->ch_dev = prichan->ch_dev; mtx_lock(&prichan->ch_subchan_lock); - TAILQ_INSERT_TAIL(&prichan->ch_subchans, newchan, ch_sublink); + vmbus_chan_ins_sublist(prichan, newchan); + mtx_unlock(&prichan->ch_subchan_lock); /* - * Bump up sub-channel count and notify anyone that is - * interested in this sub-channel, after this sub-channel - * is setup. + * Notify anyone that is interested in this sub-channel, + * after this sub-channel is setup. */ - prichan->ch_subchan_cnt++; - mtx_unlock(&prichan->ch_subchan_lock); wakeup(prichan); - +done: + /* + * Hook this channel up for later rescind. + */ + mtx_lock(&sc->vmbus_chan_lock); + vmbus_chan_ins_list(sc, newchan); + mtx_unlock(&sc->vmbus_chan_lock); return 0; } @@ -1126,6 +1274,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_ { const struct vmbus_chanmsg_choffer *offer; struct vmbus_channel *chan; + task_fn_t *detach_fn, *attach_fn; int error; offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data; @@ -1174,6 +1323,21 @@ vmbus_chan_msgproc_choffer(struct vmbus_ &sc->vmbus_tx_evtflags[chan->ch_id >> VMBUS_EVTFLAG_SHIFT]; chan->ch_evtflag_mask = 1UL << (chan->ch_id & VMBUS_EVTFLAG_MASK); + /* + * Setup attach and detach tasks. + */ + if (VMBUS_CHAN_ISPRIMARY(chan)) { + chan->ch_mgmt_tq = sc->vmbus_devtq; + attach_fn = vmbus_prichan_attach_task; + detach_fn = vmbus_prichan_detach_task; + } else { + chan->ch_mgmt_tq = sc->vmbus_subchtq; + attach_fn = vmbus_subchan_attach_task; + detach_fn = vmbus_subchan_detach_task; + } + TASK_INIT(&chan->ch_attach_task, 0, attach_fn, chan); + TASK_INIT(&chan->ch_detach_task, 0, detach_fn, chan); + /* Select default cpu for this channel. */ vmbus_chan_cpu_default(chan); @@ -1184,22 +1348,9 @@ vmbus_chan_msgproc_choffer(struct vmbus_ vmbus_chan_free(chan); return; } - - if (VMBUS_CHAN_ISPRIMARY(chan)) { - /* - * Add device for this primary channel. - * - * NOTE: - * Error is ignored here; don't have much to do if error - * really happens. - */ - vmbus_add_child(chan); - } + taskqueue_enqueue(chan->ch_mgmt_tq, &chan->ch_attach_task); } -/* - * XXX pretty broken; need rework. - */ static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc, const struct vmbus_message *msg) @@ -1219,91 +1370,162 @@ vmbus_chan_msgproc_chrescind(struct vmbu note->chm_chanid); } - chan = sc->vmbus_chmap[note->chm_chanid]; - if (chan == NULL) + /* + * Find and remove the target channel from the channel list. + */ + mtx_lock(&sc->vmbus_chan_lock); + TAILQ_FOREACH(chan, &sc->vmbus_chans, ch_link) { + if (chan->ch_id == note->chm_chanid) + break; + } + if (chan == NULL) { + mtx_unlock(&sc->vmbus_chan_lock); + device_printf(sc->vmbus_dev, "chan%u is not offered\n", + note->chm_chanid); return; - sc->vmbus_chmap[note->chm_chanid] = NULL; + } + vmbus_chan_rem_list(sc, chan); + mtx_unlock(&sc->vmbus_chan_lock); + + if (VMBUS_CHAN_ISPRIMARY(chan)) { + /* + * The target channel is a primary channel; remove the + * target channel from the primary channel list now, + * instead of later, so that it will not be found by + * other sub-channel offers, which are processed in + * this thread. + */ + mtx_lock(&sc->vmbus_prichan_lock); + vmbus_chan_rem_prilist(sc, chan); + mtx_unlock(&sc->vmbus_prichan_lock); + } - taskqueue_enqueue(taskqueue_thread, &chan->ch_detach_task); + /* Detach the target channel. */ + taskqueue_enqueue(chan->ch_mgmt_tq, &chan->ch_detach_task); } -static void -vmbus_chan_detach_task(void *xchan, int pending __unused) +static int +vmbus_chan_release(struct vmbus_channel *chan) { - struct vmbus_channel *chan = xchan; + struct vmbus_softc *sc = chan->ch_vmbus; + struct vmbus_chanmsg_chfree *req; + struct vmbus_msghc *mh; + int error; - if (VMBUS_CHAN_ISPRIMARY(chan)) { - /* Only primary channel owns the device */ - vmbus_delete_child(chan); - /* NOTE: DO NOT free primary channel for now */ + mh = vmbus_msghc_get(sc, sizeof(*req)); + if (mh == NULL) { + device_printf(sc->vmbus_dev, "can not get msg hypercall for " + "chfree(chan%u)\n", chan->ch_id); + return (ENXIO); + } + + req = vmbus_msghc_dataptr(mh); + req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; + req->chm_chanid = chan->ch_id; + + error = vmbus_msghc_exec_noresult(mh); + vmbus_msghc_put(sc, mh); + + if (error) { + device_printf(sc->vmbus_dev, "chfree(chan%u) failed: %d", + chan->ch_id, error); } else { - struct vmbus_softc *sc = chan->ch_vmbus; - struct vmbus_channel *pri_chan = chan->ch_prichan; - struct vmbus_chanmsg_chfree *req; - struct vmbus_msghc *mh; - int error; - - mh = vmbus_msghc_get(sc, sizeof(*req)); - if (mh == NULL) { - device_printf(sc->vmbus_dev, - "can not get msg hypercall for chfree(chan%u)\n", + if (bootverbose) { + device_printf(sc->vmbus_dev, "chan%u freed\n", chan->ch_id); - goto remove; } + } + return (error); +} - req = vmbus_msghc_dataptr(mh); - req->chm_hdr.chm_type = VMBUS_CHANMSG_TYPE_CHFREE; - req->chm_chanid = chan->ch_id; +static void +vmbus_prichan_detach_task(void *xchan, int pending __unused) +{ + struct vmbus_channel *chan = xchan; - error = vmbus_msghc_exec_noresult(mh); - vmbus_msghc_put(sc, mh); + KASSERT(VMBUS_CHAN_ISPRIMARY(chan), + ("chan%u is not primary channel", chan->ch_id)); - if (error) { - device_printf(sc->vmbus_dev, - "chfree(chan%u) failed: %d", - chan->ch_id, error); - /* NOTE: Move on! */ - } else { - if (bootverbose) { - device_printf(sc->vmbus_dev, "chan%u freed\n", - chan->ch_id); - } - } -remove: - mtx_lock(&pri_chan->ch_subchan_lock); - TAILQ_REMOVE(&pri_chan->ch_subchans, chan, ch_sublink); - KASSERT(pri_chan->ch_subchan_cnt > 0, - ("invalid subchan_cnt %d", pri_chan->ch_subchan_cnt)); - pri_chan->ch_subchan_cnt--; - mtx_unlock(&pri_chan->ch_subchan_lock); - wakeup(pri_chan); + /* Delete and detach the device associated with this channel. */ + vmbus_delete_child(chan); - vmbus_chan_free(chan); - } + /* Release this channel (back to vmbus). */ + vmbus_chan_release(chan); + + /* Free this channel's resource. */ + vmbus_chan_free(chan); +} + +static void +vmbus_subchan_detach_task(void *xchan, int pending __unused) +{ + struct vmbus_channel *chan = xchan; + struct vmbus_channel *pri_chan = chan->ch_prichan; + + KASSERT(!VMBUS_CHAN_ISPRIMARY(chan), + ("chan%u is primary channel", chan->ch_id)); + + /* Release this channel (back to vmbus). */ + vmbus_chan_release(chan); + + /* Unlink from its primary channel's sub-channel list. */ + mtx_lock(&pri_chan->ch_subchan_lock); + vmbus_chan_rem_sublist(pri_chan, chan); + mtx_unlock(&pri_chan->ch_subchan_lock); + /* Notify anyone that is waiting for this sub-channel to vanish. */ + wakeup(pri_chan); + + /* Free this channel's resource. */ + vmbus_chan_free(chan); +} + +static void +vmbus_prichan_attach_task(void *xchan, int pending __unused) +{ + + /* + * Add device for this primary channel. + */ + vmbus_add_child(xchan); +} + +static void +vmbus_subchan_attach_task(void *xchan __unused, int pending __unused) +{ + + /* Nothing */ } -/* - * Detach all devices and destroy the corresponding primary channels. - */ void vmbus_chan_destroy_all(struct vmbus_softc *sc) { - struct vmbus_channel *chan; - mtx_lock(&sc->vmbus_prichan_lock); - while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) { - KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel")); - TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink); - mtx_unlock(&sc->vmbus_prichan_lock); + /* + * Detach all devices and destroy the corresponding primary + * channels. + */ + for (;;) { + struct vmbus_channel *chan; - vmbus_delete_child(chan); - vmbus_chan_free(chan); + mtx_lock(&sc->vmbus_chan_lock); + TAILQ_FOREACH(chan, &sc->vmbus_chans, ch_link) { + if (VMBUS_CHAN_ISPRIMARY(chan)) + break; + } + if (chan == NULL) { + /* No more primary channels; done. */ + mtx_unlock(&sc->vmbus_chan_lock); + break; + } + vmbus_chan_rem_list(sc, chan); + mtx_unlock(&sc->vmbus_chan_lock); mtx_lock(&sc->vmbus_prichan_lock); + vmbus_chan_rem_prilist(sc, chan); + mtx_unlock(&sc->vmbus_prichan_lock); + + taskqueue_enqueue(chan->ch_mgmt_tq, &chan->ch_detach_task); } - bzero(sc->vmbus_chmap, - sizeof(struct vmbus_channel *) * VMBUS_CHAN_MAX); - mtx_unlock(&sc->vmbus_prichan_lock); } /* @@ -1477,3 +1699,17 @@ vmbus_chan_prplist_nelem(int br_size, in return (vmbus_br_nelem(br_size, elem_size)); } + +bool +vmbus_chan_tx_empty(const struct vmbus_channel *chan) +{ + + return (vmbus_txbr_empty(&chan->ch_txbr)); +} + +bool +vmbus_chan_rx_empty(const struct vmbus_channel *chan) +{ + + return (vmbus_rxbr_empty(&chan->ch_rxbr)); +} Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Wed Oct 19 02:23:29 2016 (r307598) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chanvar.h Wed Oct 19 02:24:17 2016 (r307599) @@ -124,8 +124,14 @@ struct vmbus_channel { struct hyperv_dma ch_bufring_dma; uint32_t ch_bufring_gpadl; - struct task ch_detach_task; + struct task ch_attach_task; /* run in ch_mgmt_tq */ + struct task ch_detach_task; /* run in ch_mgmt_tq */ + struct taskqueue *ch_mgmt_tq; + + /* If this is a primary channel */ TAILQ_ENTRY(vmbus_channel) ch_prilink; /* primary chan link */ + + TAILQ_ENTRY(vmbus_channel) ch_link; /* channel link */ uint32_t ch_subidx; /* subchan index */ volatile uint32_t ch_stflags; /* atomic-op */ /* VMBUS_CHAN_ST_ */ @@ -150,7 +156,13 @@ struct vmbus_channel { #define VMBUS_CHAN_TXF_HASMNF 0x0001 #define VMBUS_CHAN_ST_OPENED_SHIFT 0 +#define VMBUS_CHAN_ST_ONPRIL_SHIFT 1 +#define VMBUS_CHAN_ST_ONSUBL_SHIFT 2 +#define VMBUS_CHAN_ST_ONLIST_SHIFT 3 #define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) +#define VMBUS_CHAN_ST_ONPRIL (1 << VMBUS_CHAN_ST_ONPRIL_SHIFT) +#define VMBUS_CHAN_ST_ONSUBL (1 << VMBUS_CHAN_ST_ONSUBL_SHIFT) +#define VMBUS_CHAN_ST_ONLIST (1 << VMBUS_CHAN_ST_ONLIST_SHIFT) struct vmbus_softc; struct vmbus_message; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Wed Oct 19 02:23:29 2016 (r307598) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Wed Oct 19 02:24:17 2016 (r307599) @@ -107,14 +107,19 @@ struct vmbus_softc { struct hyperv_dma vmbus_mnf1_dma; struct hyperv_dma vmbus_mnf2_dma; - struct mtx vmbus_scan_lock; - uint32_t vmbus_scan_chcnt; -#define VMBUS_SCAN_CHCNT_DONE 0x80000000 - uint32_t vmbus_scan_devcnt; + bool vmbus_scandone; + struct task vmbus_scandone_task; + + struct taskqueue *vmbus_devtq; /* for dev attach/detach */ + struct taskqueue *vmbus_subchtq; /* for sub-chan attach/detach */ /* Primary channels */ struct mtx vmbus_prichan_lock; TAILQ_HEAD(, vmbus_channel) vmbus_prichans; + + /* Complete channel list */ + struct mtx vmbus_chan_lock; + TAILQ_HEAD(, vmbus_channel) vmbus_chans; }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ From owner-svn-src-all@freebsd.org Wed Oct 19 02:24:58 2016 Return-Path: Delivered-To: svn-src-all@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 BCB94C17FFC; Wed, 19 Oct 2016 02:24:58 +0000 (UTC) (envelope-from kevlo@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 8C1CFA0A; Wed, 19 Oct 2016 02:24:58 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J2Ovf4005155; Wed, 19 Oct 2016 02:24:57 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J2OvSD005154; Wed, 19 Oct 2016 02:24:57 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201610190224.u9J2OvSD005154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Wed, 19 Oct 2016 02:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307600 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:24:58 -0000 Author: kevlo Date: Wed Oct 19 02:24:57 2016 New Revision: 307600 URL: https://svnweb.freebsd.org/changeset/base/307600 Log: Fix typo in comment. Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Wed Oct 19 02:24:17 2016 (r307599) +++ head/sys/net/if_var.h Wed Oct 19 02:24:57 2016 (r307600) @@ -496,7 +496,7 @@ extern struct sx ifnet_sxlock; /* * Look up an ifnet given its index; the _ref variant also acquires a * reference that must be freed using if_rele(). It is almost always a bug - * to call ifnet_byindex() instead if ifnet_byindex_ref(). + * to call ifnet_byindex() instead of ifnet_byindex_ref(). */ struct ifnet *ifnet_byindex(u_short idx); struct ifnet *ifnet_byindex_locked(u_short idx); From owner-svn-src-all@freebsd.org Wed Oct 19 02:39:26 2016 Return-Path: Delivered-To: svn-src-all@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 0CEE9C1827A; Wed, 19 Oct 2016 02:39:26 +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 B6D5FFC7; Wed, 19 Oct 2016 02:39:25 +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 u9J2dO68009309; Wed, 19 Oct 2016 02:39:24 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J2dOCV009308; Wed, 19 Oct 2016 02:39:24 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610190239.u9J2dOCV009308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 19 Oct 2016 02:39: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: r307601 - stable/11/sys/arm/broadcom/bcm2835 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 02:39:26 -0000 Author: gonzo Date: Wed Oct 19 02:39:24 2016 New Revision: 307601 URL: https://svnweb.freebsd.org/changeset/base/307601 Log: MFC r307239: Fix BCM283x(Raspberry Pi) SDHCI driver for ARM64 build - Revert BUS_SPACE_PHYSADDR back to rman_get_start. BUS_SPACE_PHYSADDR was introduced in 2013 as temporary wrapper until proper solution appears. It's ARM only and since we need this file for ARM64 build and no proper API has been introduced - just revert the change and make sure it's going to appear when people grep for BUS_SPACE_PHYSADDR in sources. - Fix printf format for size_t variables Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Wed Oct 19 02:24:57 2016 (r307600) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Wed Oct 19 02:39:24 2016 (r307601) @@ -246,8 +246,9 @@ bcm_sdhci_attach(device_t dev) goto fail; } - sc->sc_sdhci_buffer_phys = BUS_SPACE_PHYSADDR(sc->sc_mem_res, - SDHCI_BUFFER); + /* FIXME: Fix along with other BUS_SPACE_PHYSADDR instances */ + sc->sc_sdhci_buffer_phys = rman_get_start(sc->sc_mem_res) + + SDHCI_BUFFER; bus_generic_probe(dev); bus_generic_attach(dev); @@ -552,7 +553,7 @@ bcm_sdhci_read_dma(device_t dev, struct slot->curcmd->data->len - slot->offset); KASSERT((left & 3) == 0, - ("%s: len = %d, not word-aligned", __func__, left)); + ("%s: len = %zu, not word-aligned", __func__, left)); if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, (uint8_t *)slot->curcmd->data->data + slot->offset, left, @@ -581,7 +582,7 @@ bcm_sdhci_write_dma(device_t dev, struct slot->curcmd->data->len - slot->offset); KASSERT((left & 3) == 0, - ("%s: len = %d, not word-aligned", __func__, left)); + ("%s: len = %zu, not word-aligned", __func__, left)); if (bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, (uint8_t *)slot->curcmd->data->data + slot->offset, left, From owner-svn-src-all@freebsd.org Wed Oct 19 05:03:47 2016 Return-Path: Delivered-To: svn-src-all@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 823A0C170CC; Wed, 19 Oct 2016 05:03:47 +0000 (UTC) (envelope-from adrian@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 4EF821350; Wed, 19 Oct 2016 05:03:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J53kdB066162; Wed, 19 Oct 2016 05:03:46 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J53kIV066160; Wed, 19 Oct 2016 05:03:46 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201610190503.u9J53kIV066160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 19 Oct 2016 05:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307602 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 05:03:47 -0000 Author: adrian Date: Wed Oct 19 05:03:46 2016 New Revision: 307602 URL: https://svnweb.freebsd.org/changeset/base/307602 Log: [net80211] Initial full-offload scan support. This is a very simple addition to the net80211 scan support. It doesn't implement a replacement scan interface - it just disables the pieces that we should disable to make this lifecycle a bit more managable. There's more work to come before full scan offload support is available but it should be good enough for driver work. * add a flag to say "full offload" * don't do probe requests when scanning full-offload - firmware can do that * don't do powersave transitions and buffering - firmware can do that tested: * iwm(4) - STA mode * ath10k port (local, not in freebsd-head yet) Reviewed by: avos Differential Revision: https://reviews.freebsd.org/D8262 Modified: head/sys/net80211/ieee80211_scan_sw.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_scan_sw.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sw.c Wed Oct 19 02:39:24 2016 (r307601) +++ head/sys/net80211/ieee80211_scan_sw.c Wed Oct 19 05:03:46 2016 (r307602) @@ -412,6 +412,12 @@ ieee80211_swscan_bg_scan(const struct ie return (ic->ic_flags & IEEE80211_F_SCAN); } +/* + * Taskqueue work to cancel a scan. + * + * Note: for offload scan devices, we may want to call into the + * driver to try and cancel scanning, however it may not be cancelable. + */ static void cancel_scan(struct ieee80211vap *vap, int any, const char *func) { @@ -512,6 +518,12 @@ ieee80211_swscan_probe_curchan(struct ie int i; /* + * Full-offload scan devices don't require this. + */ + if (vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) + return; + + /* * Send directed probe requests followed by any * broadcast probe request. * XXX remove dependence on ic/vap->iv_bss @@ -617,7 +629,14 @@ scan_start(void *arg, int pending) return; } - if (vap->iv_opmode == IEEE80211_M_STA && + /* + * Put the station into power save mode. + * + * This is only required if we're not a full-offload devices; + * those devices manage scan/traffic differently. + */ + if (((vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) == 0) && + vap->iv_opmode == IEEE80211_M_STA && vap->iv_state == IEEE80211_S_RUN) { if ((vap->iv_bss->ni_flags & IEEE80211_NODE_PWR_MGT) == 0) { /* Enable station power save mode */ @@ -870,7 +889,12 @@ scan_done(struct ieee80211_scan_state *s * waiting for us. */ if (scandone) { - vap->iv_sta_ps(vap, 0); + /* + * If we're not a scan offload device, come back out of + * station powersave. Offload devices handle this themselves. + */ + if ((vap->iv_flags_ext & IEEE80211_FEXT_SCAN_OFFLOAD) == 0) + vap->iv_sta_ps(vap, 0); if (ss->ss_next >= ss->ss_last) ic->ic_flags_ext &= ~IEEE80211_FEXT_BGSCAN; Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Wed Oct 19 02:39:24 2016 (r307601) +++ head/sys/net80211/ieee80211_var.h Wed Oct 19 05:03:46 2016 (r307602) @@ -601,11 +601,12 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_WDSLEGACY 0x00010000 /* CONF: legacy WDS operation */ #define IEEE80211_FEXT_PROBECHAN 0x00020000 /* CONF: probe passive channel*/ #define IEEE80211_FEXT_UNIQMAC 0x00040000 /* CONF: user or computed mac */ +#define IEEE80211_FEXT_SCAN_OFFLOAD 0x00080000 /* CONF: scan is fully offloaded */ #define IEEE80211_FEXT_BITS \ "\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ "\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \ - "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC" + "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD" /* ic_flags_ht/iv_flags_ht */ #define IEEE80211_FHT_NONHT_PR 0x00000001 /* STATUS: non-HT sta present */ From owner-svn-src-all@freebsd.org Wed Oct 19 05:08:48 2016 Return-Path: Delivered-To: svn-src-all@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 71F92C17182; Wed, 19 Oct 2016 05:08:48 +0000 (UTC) (envelope-from sephe@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 319321595; Wed, 19 Oct 2016 05:08:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J58l1g066446; Wed, 19 Oct 2016 05:08:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J58kKo066439; Wed, 19 Oct 2016 05:08:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190508.u9J58kKo066439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 05:08: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: r307603 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 05:08:48 -0000 Author: sephe Date: Wed Oct 19 05:08:46 2016 New Revision: 307603 URL: https://svnweb.freebsd.org/changeset/base/307603 Log: MFC 306390-306392 306390 hyperv/hn: Suspend and resume the backend properly upon MTU change. Suspend: - Prevent the backend from being touched on TX path. - Clear the RNDIS RX filter, and wait for RX to drain. - Make sure that NVS see the chimney sending buffer and RXBUF disconnection, before unlink these buffers from the channel. Resume: - Reconfigure the RNDIS filter. - Allow TX path to work on the backend. - Kick start the TX eof task, in case the OACTIVE is set. This fixes various panics, when the interface has traffic and MTU is being changed. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8046 306391 hyperv/hn: Reorganize the synthetic parts detach. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8047 306392 hyperv/hn: Reorder the comment a little bit. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8048 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Oct 19 05:03:46 2016 (r307602) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Wed Oct 19 05:08:46 2016 (r307603) @@ -348,6 +348,16 @@ hn_nvs_disconn_rxbuf(struct hn_softc *sc return (error); } sc->hn_flags &= ~HN_FLAG_RXBUF_CONNECTED; + + /* + * Wait for the hypervisor to receive this NVS request. + */ + while (!vmbus_chan_tx_empty(sc->hn_prichan)) + pause("waittx", 1); + /* + * Linger long enough for NVS to disconnect RXBUF. + */ + pause("lingtx", (200 * hz) / 1000); } if (sc->hn_rxbuf_gpadl != 0) { @@ -389,6 +399,17 @@ hn_nvs_disconn_chim(struct hn_softc *sc) return (error); } sc->hn_flags &= ~HN_FLAG_CHIM_CONNECTED; + + /* + * Wait for the hypervisor to receive this NVS request. + */ + while (!vmbus_chan_tx_empty(sc->hn_prichan)) + pause("waittx", 1); + /* + * Linger long enough for NVS to disconnect chimney + * sending buffer. + */ + pause("lingtx", (200 * hz) / 1000); } if (sc->hn_chim_gpadl != 0) { @@ -597,27 +618,15 @@ hn_nvs_attach(struct hn_softc *sc, int m return (0); } -/* - * Net VSC disconnect from VSP - */ -static void -hv_nv_disconnect_from_vsp(struct hn_softc *sc) +void +hn_nvs_detach(struct hn_softc *sc) { + + /* NOTE: there are no requests to stop the NVS. */ hn_nvs_disconn_rxbuf(sc); hn_nvs_disconn_chim(sc); } -/* - * Net VSC on device remove - */ -int -hv_nv_on_device_remove(struct hn_softc *sc) -{ - - hv_nv_disconnect_from_vsp(sc); - return (0); -} - void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc __unused, struct vmbus_channel *chan __unused, Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 05:03:46 2016 (r307602) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 05:08:46 2016 (r307603) @@ -178,6 +178,7 @@ struct hn_tx_ring { bus_dma_tag_t hn_tx_data_dtag; uint64_t hn_csum_assist; + int hn_suspended; int hn_gpa_cnt; struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; @@ -268,8 +269,6 @@ extern int hv_promisc_mode; struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); -int hn_nvs_attach(struct hn_softc *sc, int mtu); -int hv_nv_on_device_remove(struct hn_softc *sc); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 05:03:46 2016 (r307602) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 05:08:46 2016 (r307603) @@ -348,6 +348,11 @@ static void hn_detach_allchans(struct hn static void hn_chan_callback(struct vmbus_channel *chan, void *xrxr); static void hn_set_ring_inuse(struct hn_softc *, int); static int hn_synth_attach(struct hn_softc *, int); +static void hn_synth_detach(struct hn_softc *); +static bool hn_tx_ring_pending(struct hn_tx_ring *); +static void hn_suspend(struct hn_softc *); +static void hn_resume(struct hn_softc *); +static void hn_tx_ring_qflush(struct hn_tx_ring *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -740,29 +745,19 @@ failed: } /* - * Standard detach entry point + * TODO: Use this for error handling on attach path. */ static int netvsc_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); - if (bootverbose) - printf("netvsc_detach\n"); - - /* - * XXXKYS: Need to clean up all our - * driver state; this is the driver - * unloading. - */ + /* TODO: ether_ifdetach */ - /* - * XXXKYS: Need to stop outgoing traffic and unregister - * the netdevice. - */ - - hv_rf_on_device_remove(sc); - hn_detach_allchans(sc); + HN_LOCK(sc); + /* TODO: hn_stop */ + hn_synth_detach(sc); + HN_UNLOCK(sc); hn_stop_tx_tasks(sc); @@ -775,6 +770,8 @@ netvsc_detach(device_t dev) vmbus_xact_ctx_destroy(sc->hn_xact); HN_LOCK_DESTROY(sc); + + /* TODO: if_free */ return (0); } @@ -905,6 +902,23 @@ hn_txdesc_hold(struct hn_txdesc *txd) atomic_add_int(&txd->refs, 1); } +static bool +hn_tx_ring_pending(struct hn_tx_ring *txr) +{ + bool pending = false; + +#ifndef HN_USE_TXDESC_BUFRING + mtx_lock_spin(&txr->hn_txlist_spin); + if (txr->hn_txdesc_avail != txr->hn_txdesc_cnt) + pending = true; + mtx_unlock_spin(&txr->hn_txlist_spin); +#else + if (!buf_ring_full(txr->hn_txdesc_br)) + pending = true; +#endif + return (pending); +} + static __inline void hn_txeof(struct hn_tx_ring *txr) { @@ -1241,6 +1255,9 @@ hn_start_locked(struct hn_tx_ring *txr, KASSERT(txr == &sc->hn_tx_ring[0], ("not the first TX ring")); mtx_assert(&txr->hn_tx_lock, MA_OWNED); + if (__predict_false(txr->hn_suspended)) + return 0; + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return 0; @@ -1627,23 +1644,17 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); #endif - /* We must remove and add back the device to cause the new - * MTU to take effect. This includes tearing down, but not - * deleting the channel, then bringing it back up. - */ - error = hv_rf_on_device_remove(sc); - if (error) { - HN_UNLOCK(sc); - break; - } + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_suspend(sc); /* - * Detach all of the channels. + * Detach the synthetics parts, i.e. NVS and RNDIS. */ - hn_detach_allchans(sc); + hn_synth_detach(sc); /* - * Attach the synthetic parts, i.e. NVS and RNDIS. + * Reattach the synthetic parts, i.e. NVS and RNDIS, + * with the new MTU setting. * XXX check error. */ hn_synth_attach(sc, ifr->ifr_mtu); @@ -1651,7 +1662,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_init_locked(sc); + /* All done! Resume now. */ + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_resume(sc); HN_UNLOCK(sc); break; @@ -2984,6 +2997,9 @@ hn_xmit(struct hn_tx_ring *txr, int len) KASSERT(hn_use_if_start == 0, ("hn_xmit is called, when if_start is enabled")); + if (__predict_false(txr->hn_suspended)) + return 0; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || txr->hn_oactive) return 0; @@ -3070,20 +3086,24 @@ do_sched: } static void +hn_tx_ring_qflush(struct hn_tx_ring *txr) +{ + struct mbuf *m; + + mtx_lock(&txr->hn_tx_lock); + while ((m = buf_ring_dequeue_sc(txr->hn_mbuf_br)) != NULL) + m_freem(m); + mtx_unlock(&txr->hn_tx_lock); +} + +static void hn_xmit_qflush(struct ifnet *ifp) { struct hn_softc *sc = ifp->if_softc; int i; - for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { - struct hn_tx_ring *txr = &sc->hn_tx_ring[i]; - struct mbuf *m; - - mtx_lock(&txr->hn_tx_lock); - while ((m = buf_ring_dequeue_sc(txr->hn_mbuf_br)) != NULL) - m_freem(m); - mtx_unlock(&txr->hn_tx_lock); - } + for (i = 0; i < sc->hn_tx_ring_inuse; ++i) + hn_tx_ring_qflush(&sc->hn_tx_ring[i]); if_qflush(ifp); } @@ -3484,6 +3504,26 @@ back: return (0); } +/* + * NOTE: + * The interface must have been suspended though hn_suspend(), before + * this function get called. + */ +static void +hn_synth_detach(struct hn_softc *sc) +{ + HN_LOCK_ASSERT(sc); + + /* Detach the RNDIS first. */ + hn_rndis_detach(sc); + + /* Detach NVS. */ + hn_nvs_detach(sc); + + /* Detach all of the channels. */ + hn_detach_allchans(sc); +} + static void hn_set_ring_inuse(struct hn_softc *sc, int ring_cnt) { @@ -3503,6 +3543,113 @@ hn_set_ring_inuse(struct hn_softc *sc, i } static void +hn_rx_drain(struct vmbus_channel *chan) +{ + + while (!vmbus_chan_rx_empty(chan) || !vmbus_chan_tx_empty(chan)) + pause("waitch", 1); + vmbus_chan_intr_drain(chan); +} + +static void +hn_suspend(struct hn_softc *sc) +{ + struct vmbus_channel **subch = NULL; + int i, nsubch; + + HN_LOCK_ASSERT(sc); + + /* + * Suspend TX. + */ + for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { + struct hn_tx_ring *txr = &sc->hn_tx_ring[i]; + + mtx_lock(&txr->hn_tx_lock); + txr->hn_suspended = 1; + mtx_unlock(&txr->hn_tx_lock); + /* No one is able send more packets now. */ + + /* Wait for all pending sends to finish. */ + while (hn_tx_ring_pending(txr)) + pause("hnwtx", 1 /* 1 tick */); + } + + /* + * Disable RX. + */ + hv_rf_on_close(sc); + + /* + * Give RNDIS enough time to flush all pending data packets. + */ + pause("waitrx", (200 * hz) / 1000); + + /* + * Drain RX/TX bufrings and interrupts. + */ + nsubch = sc->hn_rx_ring_inuse - 1; + if (nsubch > 0) + subch = vmbus_subchan_get(sc->hn_prichan, nsubch); + + if (subch != NULL) { + for (i = 0; i < nsubch; ++i) + hn_rx_drain(subch[i]); + } + hn_rx_drain(sc->hn_prichan); + + if (subch != NULL) + vmbus_subchan_rel(subch, nsubch); +} + +static void +hn_resume(struct hn_softc *sc) +{ + struct hn_tx_ring *txr; + int i; + + HN_LOCK_ASSERT(sc); + + /* + * Re-enable RX. + */ + hv_rf_on_open(sc); + + /* + * Make sure to clear suspend status on "all" TX rings, + * since hn_tx_ring_inuse can be changed after hn_suspend(). + */ + for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { + txr = &sc->hn_tx_ring[i]; + + mtx_lock(&txr->hn_tx_lock); + txr->hn_suspended = 0; + mtx_unlock(&txr->hn_tx_lock); + } + + if (!hn_use_if_start) { + /* + * Flush unused drbrs, since hn_tx_ring_inuse may be + * reduced. + */ + for (i = sc->hn_tx_ring_inuse; i < sc->hn_tx_ring_cnt; ++i) + hn_tx_ring_qflush(&sc->hn_tx_ring[i]); + } + + /* + * Kick start TX. + */ + for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { + txr = &sc->hn_tx_ring[i]; + /* + * Use txeof task, so that any pending oactive can be + * cleared properly. + */ + taskqueue_enqueue(txr->hn_tx_taskq, &txr->hn_txeof_task); + } +} + +static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { const struct hn_nvs_hdr *hdr; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 05:03:46 2016 (r307602) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 05:08:46 2016 (r307603) @@ -957,11 +957,8 @@ done: return (error); } -/* - * RNDIS filter halt device - */ static int -hv_rf_halt_device(struct hn_softc *sc) +hn_rndis_halt(struct hn_softc *sc) { struct vmbus_xact *xact; struct rndis_halt_req *halt; @@ -1008,21 +1005,12 @@ hn_rndis_attach(struct hn_softc *sc) return (0); } -/* - * RNDIS filter on device remove - */ -int -hv_rf_on_device_remove(struct hn_softc *sc) +void +hn_rndis_detach(struct hn_softc *sc) { - int ret; - - /* Halt and release the rndis device */ - ret = hv_rf_halt_device(sc); - - /* Pass control to inner driver to remove the device */ - ret |= hv_nv_on_device_remove(sc); - return (ret); + /* Halt the RNDIS. */ + hn_rndis_halt(sc); } /* Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Oct 19 05:03:46 2016 (r307602) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Oct 19 05:08:46 2016 (r307603) @@ -43,7 +43,6 @@ struct hn_rx_ring; void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); -int hv_rf_on_device_remove(struct hn_softc *sc); int hv_rf_on_open(struct hn_softc *sc); int hv_rf_on_close(struct hn_softc *sc); Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 05:03:46 2016 (r307602) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 05:08:46 2016 (r307603) @@ -118,6 +118,7 @@ uint32_t hn_chim_alloc(struct hn_softc * void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); int hn_rndis_attach(struct hn_softc *sc); +void hn_rndis_detach(struct hn_softc *sc); int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, size_t pktsize, size_t pi_dlen, uint32_t pi_type); @@ -127,6 +128,7 @@ int hn_rndis_get_linkstatus(struct hn_s uint32_t *link_status); int hn_nvs_attach(struct hn_softc *sc, int mtu); +void hn_nvs_detach(struct hn_softc *sc); int hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch); void hn_nvs_sent_xact(struct hn_send_ctx *sndc, struct hn_softc *sc, struct vmbus_channel *chan, const void *data, int dlen); From owner-svn-src-all@freebsd.org Wed Oct 19 05:38:52 2016 Return-Path: Delivered-To: svn-src-all@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 B6B83C178A1; Wed, 19 Oct 2016 05:38:52 +0000 (UTC) (envelope-from sephe@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 7798598D; Wed, 19 Oct 2016 05:38:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J5cpp7078044; Wed, 19 Oct 2016 05:38:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J5cpmp078039; Wed, 19 Oct 2016 05:38:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190538.u9J5cpmp078039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 05:38:51 +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: r307604 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 05:38:52 -0000 Author: sephe Date: Wed Oct 19 05:38:50 2016 New Revision: 307604 URL: https://svnweb.freebsd.org/changeset/base/307604 Log: MFC 306393 hyperv/hn: Flatten RX filter configuration. This paves way for more fixes. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8049 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 05:08:46 2016 (r307603) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 05:38:50 2016 (r307604) @@ -265,7 +265,6 @@ struct hn_softc { /* * Externs */ -extern int hv_promisc_mode; struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 05:08:46 2016 (r307603) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 05:38:50 2016 (r307604) @@ -205,8 +205,6 @@ struct hn_txdesc { * Globals */ -int hv_promisc_mode = 0; /* normal mode by default */ - SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Hyper-V network interface"); @@ -1779,7 +1777,7 @@ static void hn_stop(struct hn_softc *sc) { struct ifnet *ifp; - int ret, i; + int i; HN_LOCK_ASSERT(sc); @@ -1795,7 +1793,8 @@ hn_stop(struct hn_softc *sc) if_link_state_change(ifp, LINK_STATE_DOWN); - ret = hv_rf_on_close(sc); + /* Disable RX by clearing RX filter. */ + hn_rndis_set_rxfilter(sc, 0); } /* @@ -1870,9 +1869,8 @@ hn_init_locked(struct hn_softc *sc) return; } - hv_promisc_mode = 1; - - ret = hv_rf_on_open(sc); + /* TODO: add hn_rx_filter */ + ret = hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); if (ret != 0) return; @@ -3576,9 +3574,9 @@ hn_suspend(struct hn_softc *sc) } /* - * Disable RX. + * Disable RX by clearing RX filter. */ - hv_rf_on_close(sc); + hn_rndis_set_rxfilter(sc, 0); /* * Give RNDIS enough time to flush all pending data packets. @@ -3612,8 +3610,9 @@ hn_resume(struct hn_softc *sc) /* * Re-enable RX. + * TODO: add hn_rx_filter. */ - hv_rf_on_open(sc); + hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); /* * Make sure to clear suspend status on "all" TX rings, Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 05:08:46 2016 (r307603) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 05:38:50 2016 (r307604) @@ -887,7 +887,7 @@ hn_rndis_conf_rss(struct hn_softc *sc, u return (error); } -static int +int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter) { int error; @@ -1013,35 +1013,6 @@ hn_rndis_detach(struct hn_softc *sc) hn_rndis_halt(sc); } -/* - * RNDIS filter on open - */ -int -hv_rf_on_open(struct hn_softc *sc) -{ - uint32_t filter; - - /* XXX */ - if (hv_promisc_mode != 1) { - filter = NDIS_PACKET_TYPE_BROADCAST | - NDIS_PACKET_TYPE_ALL_MULTICAST | - NDIS_PACKET_TYPE_DIRECTED; - } else { - filter = NDIS_PACKET_TYPE_PROMISCUOUS; - } - return (hn_rndis_set_rxfilter(sc, filter)); -} - -/* - * RNDIS filter on close - */ -int -hv_rf_on_close(struct hn_softc *sc) -{ - - return (hn_rndis_set_rxfilter(sc, 0)); -} - void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr) { Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Oct 19 05:08:46 2016 (r307603) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.h Wed Oct 19 05:38:50 2016 (r307604) @@ -43,8 +43,6 @@ struct hn_rx_ring; void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); -int hv_rf_on_open(struct hn_softc *sc); -int hv_rf_on_close(struct hn_softc *sc); #endif /* __HV_RNDIS_FILTER_H__ */ Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 05:08:46 2016 (r307603) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 05:38:50 2016 (r307604) @@ -126,6 +126,8 @@ int hn_rndis_get_rsscaps(struct hn_soft int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); int hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status); +/* filter: NDIS_PACKET_TYPE_ or 0. */ +int hn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); int hn_nvs_attach(struct hn_softc *sc, int mtu); void hn_nvs_detach(struct hn_softc *sc); From owner-svn-src-all@freebsd.org Wed Oct 19 05:44:54 2016 Return-Path: Delivered-To: svn-src-all@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 0420BC17B54 for ; Wed, 19 Oct 2016 05:44:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BED4CEA1 for ; Wed, 19 Oct 2016 05:44:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id r30so21081903ioi.1 for ; Tue, 18 Oct 2016 22:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=KasjADQBHzug7wO6PMCJmyPL32KzppgyXdtHkkBRKdk=; b=EGUJ537E2uq2qBAZsZAleW03wkFzoP7DR/7Z1mAP3/Xf068IleszgFiqB1AtDBWaHi tmqR/qfZUlgEevwiZIZhvMj83W8Xfk5G3dAhZ4Iocuy3IJF4Wh8lH1oOhrIuvxLnUcc7 das9z+BPtGfMw6eqnN8IbbFNjIAR005tWqivCWEHDvGdhf5Y4SXEySQCafPhv472GUWi fVy/7RDYia725ppJ4GU/28rBpVkTbIig5u1BGG27Z9veWGpbzEtZtHH+AB5o9NNHSWIq usvFrhUKxSjT0ddkGFXca8JqIJ5VhDXtjzBicNeGVbaPZqmJyDEjWS6eLIYRu6sAptFC +0rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=KasjADQBHzug7wO6PMCJmyPL32KzppgyXdtHkkBRKdk=; b=HPcfrhgjBajyypC1zuwdOpP2yFG14rvYKFqJAcstRSBYQDV4wPrAi4OvL2jgplA51U fa0nT9qupdRUUaxeAjPQVPBvnIuEVdgZdIzx6OxdOnH4bF293TeLD2ZJTxrSYl0wRoqj Igiz5nAubr27o3MAkXiW5hjZ8rapOpexEzzjohF5vLYDZSC/PgR/GTDidqKM0YTRiWKt mpoKT5XFuG4OKk3LD8icPsXM+zXciMpbV/fCZvx0jClDYrWz6fQF02PKjZk4fcjMDe+U dLfB3bEvcAMa5zvk65Oos+57VNd4bnajl1jNOmHzxkY/7SOepJXuLv0B7FNte8x0OoBM acGg== X-Gm-Message-State: AA6/9Rn41h8w+oKjdv7WHqPnzL1q/6k/M9Zd7ZU2VkF/XbKI8Y7PQTmphAbtLWjqeiEZASHb+RC/F4kzWYtfsQ== X-Received: by 10.107.15.222 with SMTP id 91mr4989356iop.19.1476855893059; Tue, 18 Oct 2016 22:44:53 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.77.85 with HTTP; Tue, 18 Oct 2016 22:44:52 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <1950201.IjTl3rpdGP@ralph.baldwin.cx> References: <201610141710.u9EHArlL089412@repo.freebsd.org> <20161014175542.GB65545@ambrisko.com> <1950201.IjTl3rpdGP@ralph.baldwin.cx> From: Warner Losh Date: Tue, 18 Oct 2016 23:44:52 -0600 X-Google-Sender-Auth: 6WfqHbXHkzeIBclg_wH3Vl9c_No Message-ID: Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader To: John Baldwin Cc: Doug Ambrisko , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Doug Ambrisko , Ravi Pokala Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 05:44:54 -0000 On Mon, Oct 17, 2016 at 11:40 AM, John Baldwin wrote: > On Friday, October 14, 2016 12:25:54 PM Warner Losh wrote: >> On Oct 14, 2016 11:55 AM, "Doug Ambrisko" wrote: >> > >> > On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote: >> > | -----Original Message----- >> > | > From: on behalf of Doug Ambrisko < >> ambrisko@ambrisko.com> >> > | > Date: 2016-10-14, Friday at 10:27 >> > | > To: Warner Losh >> > | > Cc: Doug Ambrisko , src-committers < >> src-committers@freebsd.org>, "svn-src-all@freebsd.org" < >> svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" < >> svn-src-head@freebsd.org> >> > | > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader >> > | > >> > | > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote: >> > | > | Love the functionality, but don't like using the 'hint' namespace >> for >> > | > | this. Can we change it now before too many things depend on it? We >> had >> > | > | similar issues in ACPI and moved it to the 'acpi' space. Can we move >> > | > | this to the 'smbios' space please? >> > | > | >> > | > | The reason is that 'hint' is special and sometimes filtered out, so >> it >> > | > | is a poor choice to export data from the boot loader to the kernel. >> > | > >> > | > The reason I picked hint was it could be put /boot/device.hints >> > | > to make it work as well and that it was a hint. Other standards in >> the >> > | > future might use other methods. Looking back over the email I had >> > | > with John he had suggested hint.smbios.0.anchor to make this look >> > | > different. This code had been hanging around for so long I forgot >> > | > about that and we were using hint.smbios.0.mem in our shipping code >> base. >> > | > >> > | > However, I hope that nothing would use this except for smbios(4) and >> > | > for people to make smbios(4) useful for this info. >> > | >> > | Doug's looking at me when he says that. :-) >> > | >> > | We talked about this last night at BAFUG; right now, even if smbios(4) >> > | is able to find the SMBIOS info -- it currently only looks at the >> > | aforementioned 0xf0000 - 0xfffff range, so it can't find it on UEFI -- >> > | smbios(4) doesn't actually provide any interface for that information. >> > | Doug and I have talked about making smbios(4) useful, by parsing the >> > | data and providing KPIs and APIs, for years now; I think I'll *finally* >> > | have the time and motivation to do so "soon". >> > >> > I've actually talked to a few people. However, your the first to >> > step up. This needs to be designed and will take some time and >> > review. I would hope that except for smbios(4), nothing else would >> > use this kenv but there is nothing to prevent that :-( I could name >> > it super_secret_dont_use. >> > >> > BTW, to get you started this patch prevents smbios(4) from blowing chunks >> > when it gets a anchor in high memory and works on legacy machines. >> > >> > --- /sys/x86/bios/smbios.c 2013-10-01 14:28:25.000000000 -0700 >> > +++ ./smbios.c 2016-04-11 11:58:03.234969000 -0700 >> > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8 >> > #include >> > #include >> > #include >> > +#include >> > >> > #include >> > #include >> > @@ -59,7 +60,7 @@ struct smbios_softc { >> > }; >> > >> > #define RES2EPS(res) ((struct smbios_eps >> *)rman_get_virtual(res)) >> > -#define ADDR2EPS(addr) ((struct smbios_eps >> *)BIOS_PADDRTOVADDR(addr)) >> > +#define ADDR2EPS(addr) ((struct smbios_eps *)PHYS_TO_DMAP(addr)) >> > >> > static devclass_t smbios_devclass; >> > >> > @@ -71,19 +72,26 @@ static int smbios_modevent (module_t, in >> > >> > static int smbios_cksum (struct smbios_eps *); >> > >> > +static unsigned long addr; >> > +static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0, >> > + "SMBIOS driver parameters"); >> > +SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW, >> > + &addr, 0, ""); >> > + >> > static void >> > smbios_identify (driver_t *driver, device_t parent) >> > { >> > device_t child; >> > - u_int32_t addr; >> > int length; >> > int rid; >> > >> > if (!device_is_alive(parent)) >> > return; >> > >> > - addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, >> > - SMBIOS_STEP, SMBIOS_OFF); >> > + if (resource_long_value("smbios", 0, "mem", &addr) != 0 || >> > + addr == 0) >> > + addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, >> SMBIOS_LEN, >> > + SMBIOS_STEP, SMBIOS_OFF); >> > if (addr != 0) { >> > rid = 0; >> > length = ADDR2EPS(addr)->length; >> > >> > Note I don't plan to commit this since it doesn't really do much and we >> > need a lot more. >> >> I was planning on exporting all smbios stuff via sysctl. > > I'm a bit hesitant to do all the type parsing in the kernel vs userland. > However, I think having smbios(4) export a /dev/smbios that you can either > read() or mmap() to access the table would be very convenient and let you > keep the bits to parse the table in userland (and not require root if we > allow read-only access to mortals on /dev/foo). I'd support allowing this also, but we have them hidden in kenv how. Moving them to sysctl is trivial and adds no additional risk to the kernel. Having a /dev/smbios that also exports them and having userland tools to parse nodes that the loader doesn't export is also a good idea, but I don't think that would replace what I have in mind. sysctl is super easy to get data from in shell and other scripts. /dev/smbios would require another program to parse the blob that's exported. I think it would be cool to have that as well and wouldn't interfere with what I was planning on doing. Warner From owner-svn-src-all@freebsd.org Wed Oct 19 05:53:44 2016 Return-Path: Delivered-To: svn-src-all@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 6B925C17D5D; Wed, 19 Oct 2016 05:53:44 +0000 (UTC) (envelope-from imp@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 3006731D; Wed, 19 Oct 2016 05:53:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J5rhqS085414; Wed, 19 Oct 2016 05:53:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J5rhe3085413; Wed, 19 Oct 2016 05:53:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610190553.u9J5rhe3085413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 19 Oct 2016 05:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307605 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 05:53:44 -0000 Author: imp Date: Wed Oct 19 05:53:43 2016 New Revision: 307605 URL: https://svnweb.freebsd.org/changeset/base/307605 Log: Use MODULES_EXTRA rather than MODULES_OVERRIDE for dtb. Submitted by: Oleksandr Tymoshenko Modified: head/sys/arm/conf/PANDABOARD Modified: head/sys/arm/conf/PANDABOARD ============================================================================== --- head/sys/arm/conf/PANDABOARD Wed Oct 19 05:38:50 2016 (r307604) +++ head/sys/arm/conf/PANDABOARD Wed Oct 19 05:53:43 2016 (r307605) @@ -30,7 +30,7 @@ hints "PANDABOARD.hints" include "std.armv6" include "../ti/omap4/pandaboard/std.pandaboard" -makeoptions MODULES_OVERRIDE=dtb/omap4 +makeoptions MODULES_EXTRA=dtb/omap4 options SCHED_ULE # ULE scheduler options PLATFORM From owner-svn-src-all@freebsd.org Wed Oct 19 06:15:29 2016 Return-Path: Delivered-To: svn-src-all@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 10885C184AA; Wed, 19 Oct 2016 06:15:29 +0000 (UTC) (envelope-from sephe@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 B6AE6F5D; Wed, 19 Oct 2016 06:15:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J6FR4j092793; Wed, 19 Oct 2016 06:15:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J6FRCs092791; Wed, 19 Oct 2016 06:15:27 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190615.u9J6FRCs092791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 06:15:27 +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: r307606 - in stable/11/sys: cam/ata 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 06:15:29 -0000 Author: sephe Date: Wed Oct 19 06:15:27 2016 New Revision: 307606 URL: https://svnweb.freebsd.org/changeset/base/307606 Log: MFC 306396 cam/ata: Allow drivers to veto ATA disk attachment. This eventhandler is mainly used by VMs, e.g. Hyper-V, whose disk controllers share the disks with the simulated ATA controllers. Submitted by: Hongjiang Zhang Discussed with: mav Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7693 Modified: stable/11/sys/cam/ata/ata_xpt.c stable/11/sys/sys/eventhandler.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/11/sys/cam/ata/ata_xpt.c Wed Oct 19 05:53:43 2016 (r307605) +++ stable/11/sys/cam/ata/ata_xpt.c Wed Oct 19 06:15:27 2016 (r307606) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -824,12 +825,24 @@ noerror: { struct ccb_pathinq cpi; int16_t *ptr; + int veto = 0; ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { *ptr = le16toh(*ptr); } + + /* + * Allow others to veto this ATA disk attachment. This + * is mainly used by VMs, whose disk controllers may + * share the disks with the simulated ATA controllers. + */ + EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, &veto); + if (veto) { + goto device_fail; + } + if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && strncmp(ident_buf->model, "Pioneer", 7) && Modified: stable/11/sys/sys/eventhandler.h ============================================================================== --- stable/11/sys/sys/eventhandler.h Wed Oct 19 05:53:43 2016 (r307605) +++ stable/11/sys/sys/eventhandler.h Wed Oct 19 06:15:27 2016 (r307606) @@ -270,4 +270,11 @@ typedef void (*unregister_framebuffer_fn EVENTHANDLER_DECLARE(register_framebuffer, register_framebuffer_fn); EVENTHANDLER_DECLARE(unregister_framebuffer, unregister_framebuffer_fn); +/* Veto ada attachment */ +struct cam_path; +struct ata_params; +typedef void (*ada_probe_veto_fn)(void *, struct cam_path *, + struct ata_params *, int *); +EVENTHANDLER_DECLARE(ada_probe_veto, ada_probe_veto_fn); + #endif /* _SYS_EVENTHANDLER_H_ */ From owner-svn-src-all@freebsd.org Wed Oct 19 06:35:30 2016 Return-Path: Delivered-To: svn-src-all@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 CCE6DC18B07; Wed, 19 Oct 2016 06:35:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E8C2E9B; Wed, 19 Oct 2016 06:35:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 4FE6B10AF8F; Wed, 19 Oct 2016 02:35:29 -0400 (EDT) From: John Baldwin To: Warner Losh Cc: Doug Ambrisko , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Doug Ambrisko , Ravi Pokala Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader Date: Tue, 18 Oct 2016 23:20:14 -0700 Message-ID: <3841347.BNPZXPm7N3@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201610141710.u9EHArlL089412@repo.freebsd.org> <1950201.IjTl3rpdGP@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 19 Oct 2016 02:35:29 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 06:35:30 -0000 On Tuesday, October 18, 2016 11:44:52 PM Warner Losh wrote: > On Mon, Oct 17, 2016 at 11:40 AM, John Baldwin wrote: > > On Friday, October 14, 2016 12:25:54 PM Warner Losh wrote: > >> On Oct 14, 2016 11:55 AM, "Doug Ambrisko" wrote: > >> > > >> > On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote: > >> > | -----Original Message----- > >> > | > From: on behalf of Doug Ambrisko < > >> ambrisko@ambrisko.com> > >> > | > Date: 2016-10-14, Friday at 10:27 > >> > | > To: Warner Losh > >> > | > Cc: Doug Ambrisko , src-committers < > >> src-committers@freebsd.org>, "svn-src-all@freebsd.org" < > >> svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" < > >> svn-src-head@freebsd.org> > >> > | > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader > >> > | > > >> > | > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote: > >> > | > | Love the functionality, but don't like using the 'hint' namespace > >> for > >> > | > | this. Can we change it now before too many things depend on it? We > >> had > >> > | > | similar issues in ACPI and moved it to the 'acpi' space. Can we move > >> > | > | this to the 'smbios' space please? > >> > | > | > >> > | > | The reason is that 'hint' is special and sometimes filtered out, so > >> it > >> > | > | is a poor choice to export data from the boot loader to the kernel. > >> > | > > >> > | > The reason I picked hint was it could be put /boot/device.hints > >> > | > to make it work as well and that it was a hint. Other standards in > >> the > >> > | > future might use other methods. Looking back over the email I had > >> > | > with John he had suggested hint.smbios.0.anchor to make this look > >> > | > different. This code had been hanging around for so long I forgot > >> > | > about that and we were using hint.smbios.0.mem in our shipping code > >> base. > >> > | > > >> > | > However, I hope that nothing would use this except for smbios(4) and > >> > | > for people to make smbios(4) useful for this info. > >> > | > >> > | Doug's looking at me when he says that. :-) > >> > | > >> > | We talked about this last night at BAFUG; right now, even if smbios(4) > >> > | is able to find the SMBIOS info -- it currently only looks at the > >> > | aforementioned 0xf0000 - 0xfffff range, so it can't find it on UEFI -- > >> > | smbios(4) doesn't actually provide any interface for that information. > >> > | Doug and I have talked about making smbios(4) useful, by parsing the > >> > | data and providing KPIs and APIs, for years now; I think I'll *finally* > >> > | have the time and motivation to do so "soon". > >> > > >> > I've actually talked to a few people. However, your the first to > >> > step up. This needs to be designed and will take some time and > >> > review. I would hope that except for smbios(4), nothing else would > >> > use this kenv but there is nothing to prevent that :-( I could name > >> > it super_secret_dont_use. > >> > > >> > BTW, to get you started this patch prevents smbios(4) from blowing chunks > >> > when it gets a anchor in high memory and works on legacy machines. > >> > > >> > --- /sys/x86/bios/smbios.c 2013-10-01 14:28:25.000000000 -0700 > >> > +++ ./smbios.c 2016-04-11 11:58:03.234969000 -0700 > >> > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8 > >> > #include > >> > #include > >> > #include > >> > +#include > >> > > >> > #include > >> > #include > >> > @@ -59,7 +60,7 @@ struct smbios_softc { > >> > }; > >> > > >> > #define RES2EPS(res) ((struct smbios_eps > >> *)rman_get_virtual(res)) > >> > -#define ADDR2EPS(addr) ((struct smbios_eps > >> *)BIOS_PADDRTOVADDR(addr)) > >> > +#define ADDR2EPS(addr) ((struct smbios_eps *)PHYS_TO_DMAP(addr)) > >> > > >> > static devclass_t smbios_devclass; > >> > > >> > @@ -71,19 +72,26 @@ static int smbios_modevent (module_t, in > >> > > >> > static int smbios_cksum (struct smbios_eps *); > >> > > >> > +static unsigned long addr; > >> > +static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0, > >> > + "SMBIOS driver parameters"); > >> > +SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW, > >> > + &addr, 0, ""); > >> > + > >> > static void > >> > smbios_identify (driver_t *driver, device_t parent) > >> > { > >> > device_t child; > >> > - u_int32_t addr; > >> > int length; > >> > int rid; > >> > > >> > if (!device_is_alive(parent)) > >> > return; > >> > > >> > - addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, > >> > - SMBIOS_STEP, SMBIOS_OFF); > >> > + if (resource_long_value("smbios", 0, "mem", &addr) != 0 || > >> > + addr == 0) > >> > + addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, > >> SMBIOS_LEN, > >> > + SMBIOS_STEP, SMBIOS_OFF); > >> > if (addr != 0) { > >> > rid = 0; > >> > length = ADDR2EPS(addr)->length; > >> > > >> > Note I don't plan to commit this since it doesn't really do much and we > >> > need a lot more. > >> > >> I was planning on exporting all smbios stuff via sysctl. > > > > I'm a bit hesitant to do all the type parsing in the kernel vs userland. > > However, I think having smbios(4) export a /dev/smbios that you can either > > read() or mmap() to access the table would be very convenient and let you > > keep the bits to parse the table in userland (and not require root if we > > allow read-only access to mortals on /dev/foo). > > I'd support allowing this also, but we have them hidden in kenv how. > Moving them to sysctl is trivial and adds no additional risk to the > kernel. Having a /dev/smbios that also exports them and having > userland tools to parse nodes that the loader doesn't export is also a > good idea, but I don't think that would replace what I have in mind. > sysctl is super easy to get data from in shell and other scripts. > /dev/smbios would require another program to parse the blob that's > exported. I think it would be cool to have that as well and wouldn't > interfere with what I was planning on doing. Not everything is as sensible to export via sysctl, though a subset of things might be. I have patches to pciconf to let it parse the smbios table for describing physical slots and which new-bus devices are associated with physical slots (unfortunately the tables themselves aren't very reliable in my experience to date), and that sort of thing probably belongs in userland. dmidecode could be patched to use /dev/smbios rather than grovelling around in /dev/mem rather easily. Having a tool to parse the table isn't the end of the world. We do this with other tables (e.g. the SMAP and EFI memory maps are exported as "raw" sysctl nodes that the sysctl binary knows how to format, but that is still done in userland). acpidump -t, mptable, pirtool, etc. are all done in userland as well. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Oct 19 06:45:54 2016 Return-Path: Delivered-To: svn-src-all@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 B806AC18DB4; Wed, 19 Oct 2016 06:45:54 +0000 (UTC) (envelope-from sephe@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 7BAE769A; Wed, 19 Oct 2016 06:45:54 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J6jrpm004060; Wed, 19 Oct 2016 06:45:53 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J6jrjN004056; Wed, 19 Oct 2016 06:45:53 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190645.u9J6jrjN004056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 06:45:53 +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: r307607 - in stable/11/sys: conf dev/hyperv/stordisengage dev/hyperv/storvsc modules/hyperv modules/hyperv/stordisengage X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 06:45:54 -0000 Author: sephe Date: Wed Oct 19 06:45:53 2016 New Revision: 307607 URL: https://svnweb.freebsd.org/changeset/base/307607 Log: MFC 306426 hyperv/storvsc: Fix the blkvsc disk attachment issues. - The original 'disengage' ATA controller model does not work properly for all possible disk configurations. Use the newly added ATA disk veto eventhandler to fit into all possible disk configuration. - If the 'invalid LUN' happens on blkvsc controllers, return CAM_DEV_NOT_THERE so that CAM will not destroy attached disks under the blkvsc controllers. Submitted by: Hongjiang Zhang Discussed with: mav Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7693 Deleted: stable/11/sys/dev/hyperv/stordisengage/ stable/11/sys/modules/hyperv/stordisengage/ Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/11/sys/modules/hyperv/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Wed Oct 19 06:15:27 2016 (r307606) +++ stable/11/sys/conf/files.amd64 Wed Oct 19 06:45:53 2016 (r307607) @@ -294,7 +294,6 @@ dev/hwpmc/hwpmc_x86.c optional hwpmc dev/hyperv/netvsc/hv_net_vsc.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv -dev/hyperv/stordisengage/hv_ata_pci_disengage.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Wed Oct 19 06:15:27 2016 (r307606) +++ stable/11/sys/conf/files.i386 Wed Oct 19 06:45:53 2016 (r307607) @@ -251,7 +251,6 @@ dev/hwpmc/hwpmc_x86.c optional hwpmc dev/hyperv/netvsc/hv_net_vsc.c optional hyperv dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c optional hyperv dev/hyperv/netvsc/hv_rndis_filter.c optional hyperv -dev/hyperv/stordisengage/hv_ata_pci_disengage.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Oct 19 06:15:27 2016 (r307606) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Oct 19 06:45:53 2016 (r307607) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -202,6 +203,7 @@ struct storvsc_softc { struct vmbus_channel *hs_sel_chan[MAXCPU]; }; +static eventhandler_tag storvsc_handler_tag; /* * The size of the vmscsi_request has changed in win8. The * additional size is for the newly added elements in the @@ -898,21 +900,15 @@ hv_storvsc_on_channel_callback(struct vm static int storvsc_probe(device_t dev) { - int ata_disk_enable = 0; int ret = ENXIO; switch (storvsc_get_storage_type(dev)) { case DRIVER_BLKVSC: if(bootverbose) - device_printf(dev, "DRIVER_BLKVSC-Emulated ATA/IDE probe\n"); - if (!getenv_int("hw.ata.disk_enable", &ata_disk_enable)) { - if(bootverbose) - device_printf(dev, - "Enlightened ATA/IDE detected\n"); - device_set_desc(dev, g_drv_props_table[DRIVER_BLKVSC].drv_desc); - ret = BUS_PROBE_DEFAULT; - } else if(bootverbose) - device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); + device_printf(dev, + "Enlightened ATA/IDE detected\n"); + device_set_desc(dev, g_drv_props_table[DRIVER_BLKVSC].drv_desc); + ret = BUS_PROBE_DEFAULT; break; case DRIVER_STORVSC: if(bootverbose) @@ -2155,27 +2151,45 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; - + cmd = (const struct scsi_generic *) + ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); if (vm_srb->srb_status != SRB_STATUS_SUCCESS) { - if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) { - xpt_print(ccb->ccb_h.path, "invalid LUN %d\n", - vm_srb->lun); - } else { - xpt_print(ccb->ccb_h.path, "Unknown SRB flag: %d\n", - vm_srb->srb_status); - } /* * If there are errors, for example, invalid LUN, * host will inform VM through SRB status. */ - ccb->ccb_h.status |= CAM_SEL_TIMEOUT; + if (bootverbose) { + if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) { + xpt_print(ccb->ccb_h.path, + "invalid LUN %d for op: %s\n", + vm_srb->lun, + scsi_op_desc(cmd->opcode, NULL)); + } else { + xpt_print(ccb->ccb_h.path, + "Unknown SRB flag: %d for op: %s\n", + vm_srb->srb_status, + scsi_op_desc(cmd->opcode, NULL)); + } + } + + /* + * XXX For a selection timeout, all of the LUNs + * on the target will be gone. It works for SCSI + * disks, but does not work for IDE disks. + * + * For CAM_DEV_NOT_THERE, CAM will only get + * rid of the device(s) specified by the path. + */ + if (storvsc_get_storage_type(sc->hs_dev) == + DRIVER_STORVSC) + ccb->ccb_h.status |= CAM_SEL_TIMEOUT; + else + ccb->ccb_h.status |= CAM_DEV_NOT_THERE; } else { ccb->ccb_h.status |= CAM_REQ_CMP; } - cmd = (const struct scsi_generic *) - ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? - csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); if (cmd->opcode == INQUIRY) { struct scsi_inquiry_data *inq_data = (struct scsi_inquiry_data *)csio->data_ptr; @@ -2287,3 +2301,58 @@ storvsc_get_storage_type(device_t dev) return DRIVER_STORVSC; return DRIVER_UNKNOWN; } + +#define PCI_VENDOR_INTEL 0x8086 +#define PCI_PRODUCT_PIIX4 0x7111 + +static void +storvsc_ada_probe_veto(void *arg __unused, struct cam_path *path, + struct ata_params *ident_buf __unused, int *veto) +{ + + /* + * The ATA disks are shared with the controllers managed + * by this driver, so veto the ATA disks' attachment; the + * ATA disks will be attached as SCSI disks once this driver + * attached. + */ + if (path->device->protocol == PROTO_ATA) { + struct ccb_pathinq cpi; + + bzero(&cpi, sizeof(cpi)); + xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); + cpi.ccb_h.func_code = XPT_PATH_INQ; + xpt_action((union ccb *)&cpi); + if (cpi.ccb_h.status == CAM_REQ_CMP && + cpi.hba_vendor == PCI_VENDOR_INTEL && + cpi.hba_device == PCI_PRODUCT_PIIX4) { + (*veto)++; + if (bootverbose) { + xpt_print(path, + "Disable ATA disks on " + "simulated ATA controller (0x%04x%04x)\n", + cpi.hba_device, cpi.hba_vendor); + } + } + } +} + +static void +storvsc_sysinit(void *arg __unused) +{ + if (vm_guest == VM_GUEST_HV) { + storvsc_handler_tag = EVENTHANDLER_REGISTER(ada_probe_veto, + storvsc_ada_probe_veto, NULL, EVENTHANDLER_PRI_ANY); + } +} +SYSINIT(storvsc_sys_init, SI_SUB_DRIVERS, SI_ORDER_SECOND, storvsc_sysinit, + NULL); + +static void +storvsc_sysuninit(void *arg __unused) +{ + if (storvsc_handler_tag != NULL) + EVENTHANDLER_DEREGISTER(ada_probe_veto, storvsc_handler_tag); +} +SYSUNINIT(storvsc_sys_uninit, SI_SUB_DRIVERS, SI_ORDER_SECOND, + storvsc_sysuninit, NULL); Modified: stable/11/sys/modules/hyperv/Makefile ============================================================================== --- stable/11/sys/modules/hyperv/Makefile Wed Oct 19 06:15:27 2016 (r307606) +++ stable/11/sys/modules/hyperv/Makefile Wed Oct 19 06:45:53 2016 (r307607) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = vmbus netvsc stordisengage storvsc utilities +SUBDIR = vmbus netvsc storvsc utilities .include From owner-svn-src-all@freebsd.org Wed Oct 19 06:57:20 2016 Return-Path: Delivered-To: svn-src-all@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 266D8C16278; Wed, 19 Oct 2016 06:57:20 +0000 (UTC) (envelope-from sephe@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 DAD92DE8; Wed, 19 Oct 2016 06:57:19 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J6vIQM007812; Wed, 19 Oct 2016 06:57:18 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J6vIdA007811; Wed, 19 Oct 2016 06:57:18 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190657.u9J6vIdA007811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 06:57: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: r307608 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 06:57:20 -0000 Author: sephe Date: Wed Oct 19 06:57:18 2016 New Revision: 307608 URL: https://svnweb.freebsd.org/changeset/base/307608 Log: MFC 306431,306432 306431 hyperv/hn: Move TX tasks' draining into hn_suspend(). This prepares to consolidate hn_stop() and netvsc_detach(). Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8055 306432 hyperv/hn: Consolidate hn_init() and hn_stop() Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8056 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 06:45:53 2016 (r307607) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 06:57:18 2016 (r307608) @@ -334,7 +334,6 @@ static void hn_fixup_tx_data(struct hn_s static void hn_destroy_tx_data(struct hn_softc *); static void hn_start_taskfunc(void *, int); static void hn_start_txeof_taskfunc(void *, int); -static void hn_stop_tx_tasks(struct hn_softc *); static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); @@ -350,6 +349,8 @@ static void hn_synth_detach(struct hn_so static bool hn_tx_ring_pending(struct hn_tx_ring *); static void hn_suspend(struct hn_softc *); static void hn_resume(struct hn_softc *); +static void hn_rx_drain(struct vmbus_channel *); +static void hn_tx_resume(struct hn_softc *, int); static void hn_tx_ring_qflush(struct hn_tx_ring *); static void hn_nvs_handle_notify(struct hn_softc *sc, @@ -757,8 +758,6 @@ netvsc_detach(device_t dev) hn_synth_detach(sc); HN_UNLOCK(sc); - hn_stop_tx_tasks(sc); - ifmedia_removeall(&sc->hn_media); hn_destroy_rx_data(sc); hn_destroy_tx_data(sc); @@ -1776,25 +1775,19 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, static void hn_stop(struct hn_softc *sc) { - struct ifnet *ifp; + struct ifnet *ifp = sc->hn_ifp; int i; HN_LOCK_ASSERT(sc); - ifp = sc->hn_ifp; - - if (bootverbose) - printf(" Closing Device ...\n"); + /* Clear RUNNING bit _before_ hn_suspend() */ + atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + hn_suspend(sc); - atomic_clear_int(&ifp->if_drv_flags, - (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)); + /* Clear OACTIVE bit. */ + atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); for (i = 0; i < sc->hn_tx_ring_inuse; ++i) sc->hn_tx_ring[i].hn_oactive = 0; - - if_link_state_change(ifp, LINK_STATE_DOWN); - - /* Disable RX by clearing RX filter. */ - hn_rndis_set_rxfilter(sc, 0); } /* @@ -1858,27 +1851,29 @@ do_sched: static void hn_init_locked(struct hn_softc *sc) { - struct ifnet *ifp; - int ret, i; + struct ifnet *ifp = sc->hn_ifp; + int i; HN_LOCK_ASSERT(sc); - ifp = sc->hn_ifp; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; - } /* TODO: add hn_rx_filter */ - ret = hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); - if (ret != 0) - return; + hn_rndis_set_rxfilter(sc, NDIS_PACKET_TYPE_PROMISCUOUS); + /* Clear OACTIVE bit. */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); for (i = 0; i < sc->hn_tx_ring_inuse; ++i) sc->hn_tx_ring[i].hn_oactive = 0; + /* Clear TX 'suspended' bit. */ + hn_tx_resume(sc, sc->hn_tx_ring_inuse); + + /* Everything is ready; unleash! */ atomic_set_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + + /* TODO: check RNDIS link status. */ if_link_state_change(ifp, LINK_STATE_UP); } @@ -2971,19 +2966,6 @@ hn_start_txeof_taskfunc(void *xtxr, int mtx_unlock(&txr->hn_tx_lock); } -static void -hn_stop_tx_tasks(struct hn_softc *sc) -{ - int i; - - for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { - struct hn_tx_ring *txr = &sc->hn_tx_ring[i]; - - taskqueue_drain(txr->hn_tx_taskq, &txr->hn_tx_task); - taskqueue_drain(txr->hn_tx_taskq, &txr->hn_txeof_task); - } -} - static int hn_xmit(struct hn_tx_ring *txr, int len) { @@ -3571,6 +3553,9 @@ hn_suspend(struct hn_softc *sc) /* Wait for all pending sends to finish. */ while (hn_tx_ring_pending(txr)) pause("hnwtx", 1 /* 1 tick */); + + taskqueue_drain(txr->hn_tx_taskq, &txr->hn_tx_task); + taskqueue_drain(txr->hn_tx_taskq, &txr->hn_txeof_task); } /* @@ -3601,9 +3586,25 @@ hn_suspend(struct hn_softc *sc) } static void +hn_tx_resume(struct hn_softc *sc, int tx_ring_cnt) +{ + int i; + + KASSERT(tx_ring_cnt <= sc->hn_tx_ring_cnt, + ("invalid TX ring count %d", tx_ring_cnt)); + + for (i = 0; i < tx_ring_cnt; ++i) { + struct hn_tx_ring *txr = &sc->hn_tx_ring[i]; + + mtx_lock(&txr->hn_tx_lock); + txr->hn_suspended = 0; + mtx_unlock(&txr->hn_tx_lock); + } +} + +static void hn_resume(struct hn_softc *sc) { - struct hn_tx_ring *txr; int i; HN_LOCK_ASSERT(sc); @@ -3618,13 +3619,7 @@ hn_resume(struct hn_softc *sc) * Make sure to clear suspend status on "all" TX rings, * since hn_tx_ring_inuse can be changed after hn_suspend(). */ - for (i = 0; i < sc->hn_tx_ring_cnt; ++i) { - txr = &sc->hn_tx_ring[i]; - - mtx_lock(&txr->hn_tx_lock); - txr->hn_suspended = 0; - mtx_unlock(&txr->hn_tx_lock); - } + hn_tx_resume(sc, sc->hn_tx_ring_cnt); if (!hn_use_if_start) { /* @@ -3639,7 +3634,8 @@ hn_resume(struct hn_softc *sc) * Kick start TX. */ for (i = 0; i < sc->hn_tx_ring_inuse; ++i) { - txr = &sc->hn_tx_ring[i]; + struct hn_tx_ring *txr = &sc->hn_tx_ring[i]; + /* * Use txeof task, so that any pending oactive can be * cleared properly. From owner-svn-src-all@freebsd.org Wed Oct 19 06:59:46 2016 Return-Path: Delivered-To: svn-src-all@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 E35FDC16421; Wed, 19 Oct 2016 06:59:46 +0000 (UTC) (envelope-from sephe@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 A3CC0FF; Wed, 19 Oct 2016 06:59:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J6xjKj007948; Wed, 19 Oct 2016 06:59:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J6xjgC007946; Wed, 19 Oct 2016 06:59:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190659.u9J6xjgC007946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 06:59: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: r307609 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 06:59:47 -0000 Author: sephe Date: Wed Oct 19 06:59:45 2016 New Revision: 307609 URL: https://svnweb.freebsd.org/changeset/base/307609 Log: MFC 306433 hyperv/hn: Don't set HASHVAL pktinfo for NDIS < 6.30 This unbreaks packet sending on WS2008R2. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8057 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 06:57:18 2016 (r307608) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 06:59:45 2016 (r307609) @@ -168,6 +168,7 @@ struct hn_tx_ring { struct buf_ring *hn_mbuf_br; int hn_oactive; int hn_tx_idx; + int hn_tx_flags; struct mtx hn_tx_lock; struct hn_softc *hn_sc; @@ -194,10 +195,10 @@ struct hn_tx_ring { struct hn_txdesc *hn_txdesc; bus_dma_tag_t hn_tx_rndis_dtag; struct sysctl_oid *hn_tx_sysctl_tree; - int hn_tx_flags; } __aligned(CACHE_LINE_SIZE); #define HN_TX_FLAG_ATTACHED 0x1 +#define HN_TX_FLAG_HASHVAL 0x2 /* support HASHVAL pktinfo */ /* * Device-specific softc structure Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 06:57:18 2016 (r307608) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 06:59:45 2016 (r307609) @@ -1006,14 +1006,16 @@ hn_encap(struct hn_tx_ring *txr, struct pkt->rm_pktinfooffset = sizeof(*pkt); pkt->rm_pktinfolen = 0; - /* - * Set the hash value for this packet, so that the host could - * dispatch the TX done event for this packet back to this TX - * ring's channel. - */ - pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, - HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); - *pi_data = txr->hn_tx_idx; + if (txr->hn_tx_flags & HN_TX_FLAG_HASHVAL) { + /* + * Set the hash value for this packet, so that the host could + * dispatch the TX done event for this packet back to this TX + * ring's channel. + */ + pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, + HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); + *pi_data = txr->hn_tx_idx; + } if (m_head->m_flags & M_VLANTAG) { pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, @@ -2920,6 +2922,12 @@ hn_fixup_tx_data(struct hn_softc *sc) for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_csum_assist = csum_assist; + + if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { + /* Support HASHVAL pktinfo on TX path. */ + for (i = 0; i < sc->hn_tx_ring_cnt; ++i) + sc->hn_tx_ring[i].hn_tx_flags |= HN_TX_FLAG_HASHVAL; + } } static void From owner-svn-src-all@freebsd.org Wed Oct 19 07:03:56 2016 Return-Path: Delivered-To: svn-src-all@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 113D2C16759; Wed, 19 Oct 2016 07:03:56 +0000 (UTC) (envelope-from sephe@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 D453C920; Wed, 19 Oct 2016 07:03:55 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J73smP011576; Wed, 19 Oct 2016 07:03:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J73sni011575; Wed, 19 Oct 2016 07:03:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190703.u9J73sni011575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:03:54 +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: r307610 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:03:56 -0000 Author: sephe Date: Wed Oct 19 07:03:54 2016 New Revision: 307610 URL: https://svnweb.freebsd.org/changeset/base/307610 Log: MFC 306481 x86/ioapic: Fix destination cpu for Hyper-V On Hyper-V: - Stick to the first cpu for all I/O APIC pins. - And don't allow destination cpu changes. Reviewed by: jhb Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7949 Modified: stable/11/sys/x86/x86/io_apic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/io_apic.c ============================================================================== --- stable/11/sys/x86/x86/io_apic.c Wed Oct 19 06:59:45 2016 (r307609) +++ stable/11/sys/x86/x86/io_apic.c Wed Oct 19 07:03:54 2016 (r307610) @@ -412,6 +412,18 @@ ioapic_assign_cpu(struct intsrc *isrc, u u_int old_id; /* + * On Hyper-V: + * - Stick to the first cpu for all I/O APIC pins. + * - And don't allow destination cpu changes. + */ + if (vm_guest == VM_GUEST_HV) { + if (intpin->io_vector) + return (EINVAL); + else + apic_id = 0; + } + + /* * keep 1st core as the destination for NMI */ if (intpin->io_irq == IRQ_NMI) From owner-svn-src-all@freebsd.org Wed Oct 19 07:08:29 2016 Return-Path: Delivered-To: svn-src-all@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 A4862C168C3; Wed, 19 Oct 2016 07:08:29 +0000 (UTC) (envelope-from sephe@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 6789CB3C; Wed, 19 Oct 2016 07:08:29 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J78S1X011786; Wed, 19 Oct 2016 07:08:28 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J78SKF011784; Wed, 19 Oct 2016 07:08:28 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190708.u9J78SKF011784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:08:28 +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: r307611 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:08:29 -0000 Author: sephe Date: Wed Oct 19 07:08:28 2016 New Revision: 307611 URL: https://svnweb.freebsd.org/changeset/base/307611 Log: MFC 306482,306483 306482 hyperv/hn: If synthetic parts are detached, don't touch them. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8065 306483 hyperv/hn: Fix detach and attach error handling. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8066 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 07:03:54 2016 (r307610) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 07:08:28 2016 (r307611) @@ -252,6 +252,7 @@ struct hn_softc { #define HN_FLAG_CHIM_CONNECTED 0x0002 #define HN_FLAG_HAS_RSSKEY 0x0004 #define HN_FLAG_HAS_RSSIND 0x0008 +#define HN_FLAG_SYNTH_ATTACHED 0x0010 #define HN_CAP_VLAN 0x0001 #define HN_CAP_MTU 0x0002 Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 07:03:54 2016 (r307610) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 07:08:28 2016 (r307611) @@ -352,6 +352,7 @@ static void hn_resume(struct hn_softc *) static void hn_rx_drain(struct vmbus_channel *); static void hn_tx_resume(struct hn_softc *, int); static void hn_tx_ring_qflush(struct hn_tx_ring *); +static int netvsc_detach(device_t dev); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -405,6 +406,9 @@ hn_rss_reconfig(struct hn_softc *sc) HN_LOCK_ASSERT(sc); + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) + return (ENXIO); + /* * Disable RSS first. * @@ -736,27 +740,28 @@ netvsc_attach(device_t dev) return (0); failed: - /* TODO: reuse netvsc_detach() */ - hn_destroy_tx_data(sc); - if (ifp != NULL) - if_free(ifp); + if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) + hn_synth_detach(sc); + netvsc_detach(dev); return (error); } -/* - * TODO: Use this for error handling on attach path. - */ static int netvsc_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); + struct ifnet *ifp = sc->hn_ifp; - /* TODO: ether_ifdetach */ - - HN_LOCK(sc); - /* TODO: hn_stop */ - hn_synth_detach(sc); - HN_UNLOCK(sc); + if (device_is_attached(dev)) { + HN_LOCK(sc); + if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_stop(sc); + hn_synth_detach(sc); + } + HN_UNLOCK(sc); + ether_ifdetach(ifp); + } ifmedia_removeall(&sc->hn_media); hn_destroy_rx_data(sc); @@ -765,10 +770,12 @@ netvsc_detach(device_t dev) if (sc->hn_tx_taskq != hn_tx_taskq) taskqueue_free(sc->hn_tx_taskq); - vmbus_xact_ctx_destroy(sc->hn_xact); - HN_LOCK_DESTROY(sc); + if (sc->hn_xact != NULL) + vmbus_xact_ctx_destroy(sc->hn_xact); + + if_free(ifp); - /* TODO: if_free */ + HN_LOCK_DESTROY(sc); return (0); } @@ -1618,6 +1625,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, HN_LOCK(sc); + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) { + HN_UNLOCK(sc); + break; + } + if ((sc->hn_caps & HN_CAP_MTU) == 0) { /* Can't change MTU */ HN_UNLOCK(sc); @@ -1671,6 +1683,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, case SIOCSIFFLAGS: HN_LOCK(sc); + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) { + HN_UNLOCK(sc); + break; + } + if (ifp->if_flags & IFF_UP) { /* * If only the state of the PROMISC flag changed, @@ -1782,6 +1799,9 @@ hn_stop(struct hn_softc *sc) HN_LOCK_ASSERT(sc); + KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, + ("synthetic parts were not attached")); + /* Clear RUNNING bit _before_ hn_suspend() */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); hn_suspend(sc); @@ -1858,6 +1878,9 @@ hn_init_locked(struct hn_softc *sc) HN_LOCK_ASSERT(sc); + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) + return; + if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; @@ -3377,6 +3400,9 @@ hn_synth_attach(struct hn_softc *sc, int int error, nsubch, nchan, i; uint32_t old_caps; + KASSERT((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0, + ("synthetic parts were attached")); + /* Save capabilities for later verification. */ old_caps = sc->hn_caps; sc->hn_caps = 0; @@ -3489,6 +3515,8 @@ back: error = hn_attach_subchans(sc); if (error) return (error); + + sc->hn_flags |= HN_FLAG_SYNTH_ATTACHED; return (0); } @@ -3502,6 +3530,9 @@ hn_synth_detach(struct hn_softc *sc) { HN_LOCK_ASSERT(sc); + KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, + ("synthetic parts were not attached")); + /* Detach the RNDIS first. */ hn_rndis_detach(sc); @@ -3510,6 +3541,8 @@ hn_synth_detach(struct hn_softc *sc) /* Detach all of the channels. */ hn_detach_allchans(sc); + + sc->hn_flags &= ~HN_FLAG_SYNTH_ATTACHED; } static void From owner-svn-src-all@freebsd.org Wed Oct 19 07:16:28 2016 Return-Path: Delivered-To: svn-src-all@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 67358C16CE3; Wed, 19 Oct 2016 07:16:28 +0000 (UTC) (envelope-from sephe@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 1BC6419C; Wed, 19 Oct 2016 07:16:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J7GRMA015427; Wed, 19 Oct 2016 07:16:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J7GQ8H015424; Wed, 19 Oct 2016 07:16:26 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190716.u9J7GQ8H015424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:16: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: r307612 - in stable/11/sys: dev/hyperv/netvsc modules/hyperv/vmbus 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:16:28 -0000 Author: sephe Date: Wed Oct 19 07:16:26 2016 New Revision: 307612 URL: https://svnweb.freebsd.org/changeset/base/307612 Log: MFC 306484,306485 306484 hyperv/vmbus: Add missing vmbus_if.c to module build. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8067 306485 hyperv/hn: Add stubs for OFFLOAD_CURRENT_CONFIG and NETWORK_CHANGE status Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8068 Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/modules/hyperv/vmbus/Makefile stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 07:08:28 2016 (r307611) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 07:16:26 2016 (r307612) @@ -155,6 +155,15 @@ hv_rf_receive_indicate_status(struct hn_ netvsc_linkstatus_callback(sc, 0); break; + case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: + /* Not really useful; ignore. */ + break; + + case RNDIS_STATUS_NETWORK_CHANGE: + /* TODO */ + if_printf(sc->hn_ifp, "network changed\n"); + break; + default: /* TODO: */ if_printf(sc->hn_ifp, "unknown RNDIS status 0x%08x\n", Modified: stable/11/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/11/sys/modules/hyperv/vmbus/Makefile Wed Oct 19 07:08:28 2016 (r307611) +++ stable/11/sys/modules/hyperv/vmbus/Makefile Wed Oct 19 07:16:26 2016 (r307612) @@ -11,6 +11,7 @@ SRCS= hyperv.c \ vmbus_br.c \ vmbus_chan.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 Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Wed Oct 19 07:08:28 2016 (r307611) +++ stable/11/sys/net/rndis.h Wed Oct 19 07:16:26 2016 (r307612) @@ -31,6 +31,8 @@ #define RNDIS_STATUS_PENDING 0x00000103L #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL +#define RNDIS_STATUS_NETWORK_CHANGE 0x40010018L +#define RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG 0x40020006L #define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L #define RNDIS_STATUS_FAILURE 0xC0000001L #define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBL From owner-svn-src-all@freebsd.org Wed Oct 19 07:24:34 2016 Return-Path: Delivered-To: svn-src-all@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 8C73AC17086; Wed, 19 Oct 2016 07:24:34 +0000 (UTC) (envelope-from sephe@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 54485AFD; Wed, 19 Oct 2016 07:24:34 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J7OX4U019374; Wed, 19 Oct 2016 07:24:33 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J7OXto019368; Wed, 19 Oct 2016 07:24:33 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190724.u9J7OXto019368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:24: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: r307613 - in stable/11/sys: dev/hyperv/netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:24:34 -0000 Author: sephe Date: Wed Oct 19 07:24:32 2016 New Revision: 307613 URL: https://svnweb.freebsd.org/changeset/base/307613 Log: MFC 306936-306939 306936 hyperv/hn: Fix checksum offload settings The _correct_ way to identify the supported checksum offloading and TSO parameters is to query OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8088 306937 hyperv/hn: Fix if_hw_tsomax setup. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8089 306938 hyperv/hn: Generalize RSS capabilities query. - Support NDIS < 6.30. - Stringent response checks. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8090 306939 hyperv/hn: Suffix NDIS offload size with NDIS version. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8091 Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/netvsc/ndis.h stable/11/sys/net/rndis.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 07:16:26 2016 (r307612) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 07:24:32 2016 (r307613) @@ -244,6 +244,8 @@ struct hn_softc { uint32_t hn_rndis_rid; uint32_t hn_ndis_ver; + int hn_ndis_tso_szmax; + int hn_ndis_tso_sgmin; struct ndis_rssprm_toeplitz hn_rss; }; Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 07:16:26 2016 (r307612) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 07:24:32 2016 (r307613) @@ -230,7 +230,7 @@ SYSCTL_INT(_hw_hn, OID_AUTO, trust_hosti "when csum info is missing (global setting)"); /* Limit TSO burst size */ -static int hn_tso_maxlen = 0; +static int hn_tso_maxlen = IP_MAXPACKET; SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, &hn_tso_maxlen, 0, "TSO burst limit"); @@ -338,6 +338,7 @@ static int hn_encap(struct hn_tx_ring *, static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_chim_size(struct hn_softc *, int); +static void hn_set_tso_maxsize(struct hn_softc *, int, int); static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); static void hn_chan_detach(struct hn_softc *, struct vmbus_channel *); static int hn_attach_subchans(struct hn_softc *); @@ -520,7 +521,6 @@ netvsc_attach(device_t dev) uint32_t link_status; struct ifnet *ifp = NULL; int error, ring_cnt, tx_ring_cnt; - int tso_maxlen; sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); @@ -720,18 +720,16 @@ netvsc_attach(device_t dev) /* Enable all available capabilities by default. */ ifp->if_capenable = ifp->if_capabilities; - tso_maxlen = hn_tso_maxlen; - if (tso_maxlen <= 0 || tso_maxlen > IP_MAXPACKET) - tso_maxlen = IP_MAXPACKET; - ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; - ifp->if_hw_tsomaxsegsize = PAGE_SIZE; - ifp->if_hw_tsomax = tso_maxlen - - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) { + hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU); + ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; + ifp->if_hw_tsomaxsegsize = PAGE_SIZE; + } ether_ifattach(ifp, eaddr); - if (bootverbose) { - if_printf(ifp, "TSO: %u/%u/%u\n", ifp->if_hw_tsomax, + if ((ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) && bootverbose) { + if_printf(ifp, "TSO segcnt %u segsz %u\n", ifp->if_hw_tsomaxsegcount, ifp->if_hw_tsomaxsegsize); } @@ -1672,6 +1670,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu); /* All done! Resume now. */ if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -2919,6 +2918,34 @@ hn_set_chim_size(struct hn_softc *sc, in } static void +hn_set_tso_maxsize(struct hn_softc *sc, int tso_maxlen, int mtu) +{ + struct ifnet *ifp = sc->hn_ifp; + int tso_minlen; + + if ((ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) == 0) + return; + + KASSERT(sc->hn_ndis_tso_sgmin >= 2, + ("invalid NDIS tso sgmin %d", sc->hn_ndis_tso_sgmin)); + tso_minlen = sc->hn_ndis_tso_sgmin * mtu; + + KASSERT(sc->hn_ndis_tso_szmax >= tso_minlen && + sc->hn_ndis_tso_szmax <= IP_MAXPACKET, + ("invalid NDIS tso szmax %d", sc->hn_ndis_tso_szmax)); + + if (tso_maxlen < tso_minlen) + tso_maxlen = tso_minlen; + else if (tso_maxlen > IP_MAXPACKET) + tso_maxlen = IP_MAXPACKET; + if (tso_maxlen > sc->hn_ndis_tso_szmax) + tso_maxlen = sc->hn_ndis_tso_szmax; + ifp->if_hw_tsomax = tso_maxlen - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + if (bootverbose) + if_printf(ifp, "TSO size max %u\n", ifp->if_hw_tsomax); +} + +static void hn_fixup_tx_data(struct hn_softc *sc) { uint64_t csum_assist; @@ -3424,7 +3451,7 @@ hn_synth_attach(struct hn_softc *sc, int /* * Attach RNDIS _after_ NVS is attached. */ - error = hn_rndis_attach(sc); + error = hn_rndis_attach(sc, mtu); if (error) return (error); Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 07:16:26 2016 (r307612) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 07:24:32 2016 (r307613) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -68,6 +70,18 @@ __FBSDID("$FreeBSD$"); #define HN_RNDIS_XFER_SIZE 2048 +#define HN_NDIS_TXCSUM_CAP_IP4 \ + (NDIS_TXCSUM_CAP_IP4 | NDIS_TXCSUM_CAP_IP4OPT) +#define HN_NDIS_TXCSUM_CAP_TCP4 \ + (NDIS_TXCSUM_CAP_TCP4 | NDIS_TXCSUM_CAP_TCP4OPT) +#define HN_NDIS_TXCSUM_CAP_TCP6 \ + (NDIS_TXCSUM_CAP_TCP6 | NDIS_TXCSUM_CAP_TCP6OPT | \ + NDIS_TXCSUM_CAP_IP6EXT) +#define HN_NDIS_TXCSUM_CAP_UDP6 \ + (NDIS_TXCSUM_CAP_UDP6 | NDIS_TXCSUM_CAP_IP6EXT) +#define HN_NDIS_LSOV2_CAP_IP6 \ + (NDIS_LSOV2_CAP_IP6EXT | NDIS_LSOV2_CAP_TCP6OPT) + /* * Forward declarations */ @@ -78,9 +92,14 @@ static void hv_rf_receive_data(struct hn static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0); +static int hn_rndis_query2(struct hn_softc *sc, uint32_t oid, + const void *idata, size_t idlen, void *odata, size_t *odlen0, + size_t min_odlen); static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen); -static int hn_rndis_conf_offload(struct hn_softc *sc); +static int hn_rndis_conf_offload(struct hn_softc *sc, int mtu); +static int hn_rndis_query_hwcaps(struct hn_softc *sc, + struct ndis_offload *caps); static __inline uint32_t hn_rndis_rid(struct hn_softc *sc) @@ -624,6 +643,15 @@ static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0) { + + return (hn_rndis_query2(sc, oid, idata, idlen, odata, odlen0, *odlen0)); +} + +static int +hn_rndis_query2(struct hn_softc *sc, uint32_t oid, + const void *idata, size_t idlen, void *odata, size_t *odlen0, + size_t min_odlen) +{ struct rndis_query_req *req; const struct rndis_query_comp *comp; struct vmbus_xact *xact; @@ -661,7 +689,7 @@ hn_rndis_query(struct hn_softc *sc, uint memcpy(req + 1, idata, idlen); } - comp_len = sizeof(*comp) + odlen; + comp_len = sizeof(*comp) + min_odlen; comp = hn_rndis_xact_execute(sc, xact, rid, reqlen, &comp_len, REMOTE_NDIS_QUERY_CMPLT); if (comp == NULL) { @@ -717,26 +745,44 @@ hn_rndis_get_rsscaps(struct hn_softc *sc size_t caps_len; int error; - /* - * Only NDIS 6.30+ is supported. - */ - KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, - ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); *rxr_cnt = 0; memset(&in, 0, sizeof(in)); in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS; - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) { + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_1; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE_6_0; + } else { + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; + } caps_len = NDIS_RSS_CAPS_SIZE; - error = hn_rndis_query(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, - &in, NDIS_RSS_CAPS_SIZE, &caps, &caps_len); + error = hn_rndis_query2(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, + &in, NDIS_RSS_CAPS_SIZE, &caps, &caps_len, NDIS_RSS_CAPS_SIZE_6_0); if (error) return (error); - if (caps_len < NDIS_RSS_CAPS_SIZE_6_0) { - if_printf(sc->hn_ifp, "invalid NDIS RSS caps len %zu", - caps_len); + + /* + * Preliminary verification. + */ + if (caps.ndis_hdr.ndis_type != NDIS_OBJTYPE_RSS_CAPS) { + if_printf(sc->hn_ifp, "invalid NDIS objtype 0x%02x\n", + caps.ndis_hdr.ndis_type); + return (EINVAL); + } + if (caps.ndis_hdr.ndis_rev < NDIS_RSS_CAPS_REV_1) { + if_printf(sc->hn_ifp, "invalid NDIS objrev 0x%02x\n", + caps.ndis_hdr.ndis_rev); + return (EINVAL); + } + if (caps.ndis_hdr.ndis_size > caps_len) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u, " + "data size %zu\n", caps.ndis_hdr.ndis_size, caps_len); + return (EINVAL); + } else if (caps.ndis_hdr.ndis_size < NDIS_RSS_CAPS_SIZE_6_0) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", + caps.ndis_hdr.ndis_size); return (EINVAL); } @@ -746,7 +792,7 @@ hn_rndis_get_rsscaps(struct hn_softc *sc } *rxr_cnt = caps.ndis_nrxr; - if (caps_len == NDIS_RSS_CAPS_SIZE) { + if (caps.ndis_hdr.ndis_size == NDIS_RSS_CAPS_SIZE) { if (bootverbose) { if_printf(sc->hn_ifp, "RSS indirect table size %u\n", caps.ndis_nind); @@ -806,12 +852,19 @@ done: } static int -hn_rndis_conf_offload(struct hn_softc *sc) +hn_rndis_conf_offload(struct hn_softc *sc, int mtu) { + struct ndis_offload hwcaps; struct ndis_offload_params params; - uint32_t caps; + uint32_t caps = 0; size_t paramsz; - int error; + int error, tso_maxsz, tso_minsg; + + error = hn_rndis_query_hwcaps(sc, &hwcaps); + if (error) { + if_printf(sc->hn_ifp, "hwcaps query failed: %d\n", error); + return (error); + } /* NOTE: 0 means "no change" */ memset(¶ms, 0, sizeof(params)); @@ -826,18 +879,136 @@ hn_rndis_conf_offload(struct hn_softc *s } params.ndis_hdr.ndis_size = paramsz; - caps = HN_CAP_IPCS | HN_CAP_TCP4CS | HN_CAP_TCP6CS; - params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; - params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; - params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; - if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { - caps |= HN_CAP_UDP4CS | HN_CAP_UDP6CS; - params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; - params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; - } - caps |= HN_CAP_TSO4; - params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_ON; - /* XXX ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON */ + /* + * TSO4/TSO6 setup. + */ + tso_maxsz = IP_MAXPACKET; + tso_minsg = 2; + if (hwcaps.ndis_lsov2.ndis_ip4_encap & NDIS_OFFLOAD_ENCAP_8023) { + caps |= HN_CAP_TSO4; + params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_ON; + + if (hwcaps.ndis_lsov2.ndis_ip4_maxsz < tso_maxsz) + tso_maxsz = hwcaps.ndis_lsov2.ndis_ip4_maxsz; + if (hwcaps.ndis_lsov2.ndis_ip4_minsg > tso_minsg) + tso_minsg = hwcaps.ndis_lsov2.ndis_ip4_minsg; + } + if ((hwcaps.ndis_lsov2.ndis_ip6_encap & NDIS_OFFLOAD_ENCAP_8023) && + (hwcaps.ndis_lsov2.ndis_ip6_opts & HN_NDIS_LSOV2_CAP_IP6) == + HN_NDIS_LSOV2_CAP_IP6) { +#ifdef notyet + caps |= HN_CAP_TSO6; + params.ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON; + + if (hwcaps.ndis_lsov2.ndis_ip6_maxsz < tso_maxsz) + tso_maxsz = hwcaps.ndis_lsov2.ndis_ip6_maxsz; + if (hwcaps.ndis_lsov2.ndis_ip6_minsg > tso_minsg) + tso_minsg = hwcaps.ndis_lsov2.ndis_ip6_minsg; +#endif + } + sc->hn_ndis_tso_szmax = 0; + sc->hn_ndis_tso_sgmin = 0; + if (caps & (HN_CAP_TSO4 | HN_CAP_TSO6)) { + KASSERT(tso_maxsz <= IP_MAXPACKET, + ("invalid NDIS TSO maxsz %d", tso_maxsz)); + KASSERT(tso_minsg >= 2, + ("invalid NDIS TSO minsg %d", tso_minsg)); + if (tso_maxsz < tso_minsg * mtu) { + if_printf(sc->hn_ifp, "invalid NDIS TSO config: " + "maxsz %d, minsg %d, mtu %d; " + "disable TSO4 and TSO6\n", + tso_maxsz, tso_minsg, mtu); + caps &= ~(HN_CAP_TSO4 | HN_CAP_TSO6); + params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_OFF; + params.ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_OFF; + } else { + sc->hn_ndis_tso_szmax = tso_maxsz; + sc->hn_ndis_tso_sgmin = tso_minsg; + if (bootverbose) { + if_printf(sc->hn_ifp, "NDIS TSO " + "szmax %d sgmin %d\n", + sc->hn_ndis_tso_szmax, + sc->hn_ndis_tso_sgmin); + } + } + } + + /* IPv4 checksum */ + if ((hwcaps.ndis_csum.ndis_ip4_txcsum & HN_NDIS_TXCSUM_CAP_IP4) == + HN_NDIS_TXCSUM_CAP_IP4) { + caps |= HN_CAP_IPCS; + params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip4_rxcsum & NDIS_RXCSUM_CAP_IP4) { + if (params.ndis_ip4csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* TCP4 checksum */ + if ((hwcaps.ndis_csum.ndis_ip4_txcsum & HN_NDIS_TXCSUM_CAP_TCP4) == + HN_NDIS_TXCSUM_CAP_TCP4) { + caps |= HN_CAP_TCP4CS; + params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip4_rxcsum & NDIS_RXCSUM_CAP_TCP4) { + if (params.ndis_tcp4csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* UDP4 checksum */ + if (hwcaps.ndis_csum.ndis_ip4_txcsum & NDIS_TXCSUM_CAP_UDP4) { + caps |= HN_CAP_UDP4CS; + params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip4_rxcsum & NDIS_RXCSUM_CAP_UDP4) { + if (params.ndis_udp4csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* TCP6 checksum */ + if ((hwcaps.ndis_csum.ndis_ip6_txcsum & HN_NDIS_TXCSUM_CAP_TCP6) == + HN_NDIS_TXCSUM_CAP_TCP6) { + caps |= HN_CAP_TCP6CS; + params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip6_rxcsum & NDIS_RXCSUM_CAP_TCP6) { + if (params.ndis_tcp6csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* UDP6 checksum */ + if ((hwcaps.ndis_csum.ndis_ip6_txcsum & HN_NDIS_TXCSUM_CAP_UDP6) == + HN_NDIS_TXCSUM_CAP_UDP6) { + caps |= HN_CAP_UDP6CS; + params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip6_rxcsum & NDIS_RXCSUM_CAP_UDP6) { + if (params.ndis_udp6csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_RX; + } + + if (bootverbose) { + if_printf(sc->hn_ifp, "offload csum: " + "ip4 %u, tcp4 %u, udp4 %u, tcp6 %u, udp6 %u\n", + params.ndis_ip4csum, + params.ndis_tcp4csum, + params.ndis_udp4csum, + params.ndis_tcp6csum, + params.ndis_udp6csum); + if_printf(sc->hn_ifp, "offload lsov2: ip4 %u, ip6 %u\n", + params.ndis_lsov2_ip4, + params.ndis_lsov2_ip6); + } error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); if (error) { @@ -994,8 +1165,92 @@ hn_rndis_halt(struct hn_softc *sc) return (0); } +static int +hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) +{ + struct ndis_offload in; + size_t caps_len, size; + int error; + + memset(&in, 0, sizeof(in)); + in.ndis_hdr.ndis_type = NDIS_OBJTYPE_OFFLOAD; + if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { + in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_3; + size = NDIS_OFFLOAD_SIZE; + } else if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_1) { + in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_2; + size = NDIS_OFFLOAD_SIZE_6_1; + } else { + in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_1; + size = NDIS_OFFLOAD_SIZE_6_0; + } + in.ndis_hdr.ndis_size = size; + + caps_len = NDIS_OFFLOAD_SIZE; + error = hn_rndis_query2(sc, OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES, + &in, size, caps, &caps_len, NDIS_OFFLOAD_SIZE_6_0); + if (error) + return (error); + + /* + * Preliminary verification. + */ + if (caps->ndis_hdr.ndis_type != NDIS_OBJTYPE_OFFLOAD) { + if_printf(sc->hn_ifp, "invalid NDIS objtype 0x%02x\n", + caps->ndis_hdr.ndis_type); + return (EINVAL); + } + if (caps->ndis_hdr.ndis_rev < NDIS_OFFLOAD_REV_1) { + if_printf(sc->hn_ifp, "invalid NDIS objrev 0x%02x\n", + caps->ndis_hdr.ndis_rev); + return (EINVAL); + } + if (caps->ndis_hdr.ndis_size > caps_len) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u, " + "data size %zu\n", caps->ndis_hdr.ndis_size, caps_len); + return (EINVAL); + } else if (caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE_6_0) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", + caps->ndis_hdr.ndis_size); + return (EINVAL); + } + + if (bootverbose) { + /* + * NOTE: + * caps->ndis_hdr.ndis_size MUST be checked before accessing + * NDIS 6.1+ specific fields. + */ + if_printf(sc->hn_ifp, "hwcaps rev %u\n", + caps->ndis_hdr.ndis_rev); + + if_printf(sc->hn_ifp, "hwcaps csum: " + "ip4 tx 0x%x/0x%x rx 0x%x/0x%x, " + "ip6 tx 0x%x/0x%x rx 0x%x/0x%x\n", + caps->ndis_csum.ndis_ip4_txcsum, + caps->ndis_csum.ndis_ip4_txenc, + caps->ndis_csum.ndis_ip4_rxcsum, + caps->ndis_csum.ndis_ip4_rxenc, + caps->ndis_csum.ndis_ip6_txcsum, + caps->ndis_csum.ndis_ip6_txenc, + caps->ndis_csum.ndis_ip6_rxcsum, + caps->ndis_csum.ndis_ip6_rxenc); + if_printf(sc->hn_ifp, "hwcaps lsov2: " + "ip4 maxsz %u minsg %u encap 0x%x, " + "ip6 maxsz %u minsg %u encap 0x%x opts 0x%x\n", + caps->ndis_lsov2.ndis_ip4_maxsz, + caps->ndis_lsov2.ndis_ip4_minsg, + caps->ndis_lsov2.ndis_ip4_encap, + caps->ndis_lsov2.ndis_ip6_maxsz, + caps->ndis_lsov2.ndis_ip6_minsg, + caps->ndis_lsov2.ndis_ip6_encap, + caps->ndis_lsov2.ndis_ip6_opts); + } + return (0); +} + int -hn_rndis_attach(struct hn_softc *sc) +hn_rndis_attach(struct hn_softc *sc, int mtu) { int error; @@ -1010,7 +1265,7 @@ hn_rndis_attach(struct hn_softc *sc) * Configure NDIS offload settings. * XXX no offloading, if error happened? */ - hn_rndis_conf_offload(sc); + hn_rndis_conf_offload(sc, mtu); return (0); } Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 07:16:26 2016 (r307612) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 07:24:32 2016 (r307613) @@ -117,7 +117,7 @@ struct rndis_packet_msg; uint32_t hn_chim_alloc(struct hn_softc *sc); void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); -int hn_rndis_attach(struct hn_softc *sc); +int hn_rndis_attach(struct hn_softc *sc, int mtu); void hn_rndis_detach(struct hn_softc *sc); int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, Modified: stable/11/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/ndis.h Wed Oct 19 07:16:26 2016 (r307612) +++ stable/11/sys/dev/hyperv/netvsc/ndis.h Wed Oct 19 07:24:32 2016 (r307613) @@ -59,6 +59,7 @@ #define NDIS_OBJTYPE_DEFAULT 0x80 #define NDIS_OBJTYPE_RSS_CAPS 0x88 #define NDIS_OBJTYPE_RSS_PARAMS 0x89 +#define NDIS_OBJTYPE_OFFLOAD 0xa7 struct ndis_object_hdr { uint8_t ndis_type; /* NDIS_OBJTYPE_ */ @@ -205,6 +206,129 @@ struct ndis_rssprm_toeplitz { }; /* + * OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES + * ndis_type: NDIS_OBJTYPE_OFFLOAD + */ + +#define NDIS_OFFLOAD_ENCAP_NONE 0x0000 +#define NDIS_OFFLOAD_ENCAP_NULL 0x0001 +#define NDIS_OFFLOAD_ENCAP_8023 0x0002 +#define NDIS_OFFLOAD_ENCAP_8023PQ 0x0004 +#define NDIS_OFFLOAD_ENCAP_8023PQ_OOB 0x0008 +#define NDIS_OFFLOAD_ENCAP_RFC1483 0x0010 + +struct ndis_csum_offload { + uint32_t ndis_ip4_txenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip4_txcsum; +#define NDIS_TXCSUM_CAP_IP4OPT 0x001 +#define NDIS_TXCSUM_CAP_TCP4OPT 0x004 +#define NDIS_TXCSUM_CAP_TCP4 0x010 +#define NDIS_TXCSUM_CAP_UDP4 0x040 +#define NDIS_TXCSUM_CAP_IP4 0x100 + uint32_t ndis_ip4_rxenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip4_rxcsum; +#define NDIS_RXCSUM_CAP_IP4OPT 0x001 +#define NDIS_RXCSUM_CAP_TCP4OPT 0x004 +#define NDIS_RXCSUM_CAP_TCP4 0x010 +#define NDIS_RXCSUM_CAP_UDP4 0x040 +#define NDIS_RXCSUM_CAP_IP4 0x100 + uint32_t ndis_ip6_txenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip6_txcsum; +#define NDIS_TXCSUM_CAP_IP6EXT 0x001 +#define NDIS_TXCSUM_CAP_TCP6OPT 0x004 +#define NDIS_TXCSUM_CAP_TCP6 0x010 +#define NDIS_TXCSUM_CAP_UDP6 0x040 + uint32_t ndis_ip6_rxenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip6_rxcsum; +#define NDIS_RXCSUM_CAP_IP6EXT 0x001 +#define NDIS_RXCSUM_CAP_TCP6OPT 0x004 +#define NDIS_RXCSUM_CAP_TCP6 0x010 +#define NDIS_RXCSUM_CAP_UDP6 0x040 +}; + +struct ndis_lsov1_offload { + uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_maxsize; + uint32_t ndis_minsegs; + uint32_t ndis_opts; +}; + +struct ndis_ipsecv1_offload { + uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ah_esp; + uint32_t ndis_xport_tun; + uint32_t ndis_ip4_opts; + uint32_t ndis_flags; + uint32_t ndis_ip4_ah; + uint32_t ndis_ip4_esp; +}; + +struct ndis_lsov2_offload { + uint32_t ndis_ip4_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip4_maxsz; + uint32_t ndis_ip4_minsg; + uint32_t ndis_ip6_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip6_maxsz; + uint32_t ndis_ip6_minsg; + uint32_t ndis_ip6_opts; +#define NDIS_LSOV2_CAP_IP6EXT 0x001 +#define NDIS_LSOV2_CAP_TCP6OPT 0x004 +}; + +struct ndis_ipsecv2_offload { + uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint16_t ndis_ip6; + uint16_t ndis_ip4opt; + uint16_t ndis_ip6ext; + uint16_t ndis_ah; + uint16_t ndis_esp; + uint16_t ndis_ah_esp; + uint16_t ndis_xport; + uint16_t ndis_tun; + uint16_t ndis_xport_tun; + uint16_t ndis_lso; + uint16_t ndis_extseq; + uint32_t ndis_udp_esp; + uint32_t ndis_auth; + uint32_t ndis_crypto; + uint32_t ndis_sa_caps; +}; + +struct ndis_rsc_offload { + uint16_t ndis_ip4; + uint16_t ndis_ip6; +}; + +struct ndis_encap_offload { + uint32_t ndis_flags; + uint32_t ndis_maxhdr; +}; + +struct ndis_offload { + struct ndis_object_hdr ndis_hdr; + struct ndis_csum_offload ndis_csum; + struct ndis_lsov1_offload ndis_lsov1; + struct ndis_ipsecv1_offload ndis_ipsecv1; + struct ndis_lsov2_offload ndis_lsov2; + uint32_t ndis_flags; + /* NDIS >= 6.1 */ + struct ndis_ipsecv2_offload ndis_ipsecv2; + /* NDIS >= 6.30 */ + struct ndis_rsc_offload ndis_rsc; + struct ndis_encap_offload ndis_encap_gre; +}; + +#define NDIS_OFFLOAD_SIZE sizeof(struct ndis_offload) +#define NDIS_OFFLOAD_SIZE_6_0 \ + __offsetof(struct ndis_offload, ndis_ipsecv2) +#define NDIS_OFFLOAD_SIZE_6_1 \ + __offsetof(struct ndis_offload, ndis_rsc) + +#define NDIS_OFFLOAD_REV_1 1 /* NDIS 6.0 */ +#define NDIS_OFFLOAD_REV_2 2 /* NDIS 6.1 */ +#define NDIS_OFFLOAD_REV_3 3 /* NDIS 6.30 */ + +/* * Per-packet-info */ Modified: stable/11/sys/net/rndis.h ============================================================================== --- stable/11/sys/net/rndis.h Wed Oct 19 07:16:26 2016 (r307612) +++ stable/11/sys/net/rndis.h Wed Oct 19 07:24:32 2016 (r307613) @@ -87,6 +87,7 @@ #define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 #define OID_TCP_OFFLOAD_PARAMETERS 0xFC01020C +#define OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES 0xFC01020D #define RNDIS_MEDIUM_802_3 0x00000000 From owner-svn-src-all@freebsd.org Wed Oct 19 07:27:47 2016 Return-Path: Delivered-To: svn-src-all@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 399AAC1713D; Wed, 19 Oct 2016 07:27:47 +0000 (UTC) (envelope-from sephe@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 1129DCB8; Wed, 19 Oct 2016 07:27:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J7Rk1f019558; Wed, 19 Oct 2016 07:27:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J7RjvC019552; Wed, 19 Oct 2016 07:27:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190727.u9J7RjvC019552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:27: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: r307614 - in stable/11/sys/dev/hyperv: include netvsc 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:27:47 -0000 Author: sephe Date: Wed Oct 19 07:27:45 2016 New Revision: 307614 URL: https://svnweb.freebsd.org/changeset/base/307614 Log: MFC 307012,307013,307262 307012 hyperv/vmbus: Allow driver to inject synchronous task into channel taskq. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8208 307013 hyperv/hn: Rework link status support. This is the preamble for network device SR-IOV and NDIS_STATUS_NETWORK_CHANGE handling. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8209 307262 hyperv/hn: Management parts always need suspend and resume. Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/include/vmbus.h stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/11/sys/dev/hyperv/include/vmbus.h Wed Oct 19 07:24:32 2016 (r307613) +++ stable/11/sys/dev/hyperv/include/vmbus.h Wed Oct 19 07:27:45 2016 (r307614) @@ -117,6 +117,7 @@ struct vmbus_chan_br { struct vmbus_channel; struct hyperv_guid; +struct task; typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *); @@ -134,6 +135,8 @@ int vmbus_chan_open_br(struct vmbus_cha int udlen, vmbus_chan_callback_t cb, void *cbarg); void vmbus_chan_close(struct vmbus_channel *chan); void vmbus_chan_intr_drain(struct vmbus_channel *chan); +void vmbus_chan_run_task(struct vmbus_channel *chan, + struct task *task); int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl); Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 07:24:32 2016 (r307613) +++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 07:27:45 2016 (r307614) @@ -233,6 +233,10 @@ struct hn_softc { struct vmbus_xact_ctx *hn_xact; uint32_t hn_nvs_ver; + struct taskqueue *hn_mgmt_taskq; + struct taskqueue *hn_mgmt_taskq0; + struct task hn_link_task; + uint32_t hn_caps; /* HN_CAP_ */ uint32_t hn_flags; /* HN_FLAG_ */ void *hn_rxbuf; @@ -271,7 +275,6 @@ struct hn_softc { */ struct hn_send_ctx; -void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 07:24:32 2016 (r307613) +++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 07:27:45 2016 (r307614) @@ -334,6 +334,8 @@ static void hn_fixup_tx_data(struct hn_s static void hn_destroy_tx_data(struct hn_softc *); static void hn_start_taskfunc(void *, int); static void hn_start_txeof_taskfunc(void *, int); +static void hn_link_taskfunc(void *, int); +static void hn_suspend_mgmt_taskfunc(void *, int); static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); @@ -349,7 +351,11 @@ static int hn_synth_attach(struct hn_sof static void hn_synth_detach(struct hn_softc *); static bool hn_tx_ring_pending(struct hn_tx_ring *); static void hn_suspend(struct hn_softc *); +static void hn_suspend_data(struct hn_softc *); +static void hn_suspend_mgmt(struct hn_softc *); static void hn_resume(struct hn_softc *); +static void hn_resume_data(struct hn_softc *); +static void hn_resume_mgmt(struct hn_softc *); static void hn_rx_drain(struct vmbus_channel *); static void hn_tx_resume(struct hn_softc *, int); static void hn_tx_ring_qflush(struct hn_tx_ring *); @@ -518,7 +524,6 @@ netvsc_attach(device_t dev) struct sysctl_oid_list *child; struct sysctl_ctx_list *ctx; uint8_t eaddr[ETHER_ADDR_LEN]; - uint32_t link_status; struct ifnet *ifp = NULL; int error, ring_cnt, tx_ring_cnt; @@ -551,6 +556,15 @@ netvsc_attach(device_t dev) } /* + * Setup taskqueue for mangement tasks, e.g. link status. + */ + sc->hn_mgmt_taskq0 = taskqueue_create("hn_mgmt", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_mgmt_taskq0); + taskqueue_start_threads(&sc->hn_mgmt_taskq0, 1, PI_NET, "%s mgmt", + device_get_nameunit(dev)); + TASK_INIT(&sc->hn_link_task, 0, hn_link_taskfunc, sc); + + /* * Allocate ifnet and setup its name earlier, so that if_printf * can be used by functions, which will be called after * ether_ifattach(). @@ -621,12 +635,6 @@ netvsc_attach(device_t dev) if (error) goto failed; - error = hn_rndis_get_linkstatus(sc, &link_status); - if (error) - goto failed; - if (link_status == NDIS_MEDIA_STATE_CONNECTED) - sc->hn_carrier = 1; - error = hn_rndis_get_eaddr(sc, eaddr); if (error) goto failed; @@ -736,6 +744,12 @@ netvsc_attach(device_t dev) /* Inform the upper layer about the long frame support. */ ifp->if_hdrlen = sizeof(struct ether_vlan_header); + /* + * Kick off link status check. + */ + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + hn_link_status_update(sc); + return (0); failed: if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) @@ -755,6 +769,12 @@ netvsc_detach(device_t dev) if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) hn_stop(sc); + /* + * NOTE: + * hn_stop() only suspends data, so managment + * stuffs have to be suspended manually here. + */ + hn_suspend_mgmt(sc); hn_synth_detach(sc); } HN_UNLOCK(sc); @@ -767,6 +787,7 @@ netvsc_detach(device_t dev) if (sc->hn_tx_taskq != hn_tx_taskq) taskqueue_free(sc->hn_tx_taskq); + taskqueue_free(sc->hn_mgmt_taskq0); if (sc->hn_xact != NULL) vmbus_xact_ctx_destroy(sc->hn_xact); @@ -786,6 +807,36 @@ netvsc_shutdown(device_t dev) return (0); } +static void +hn_link_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + struct ifnet *ifp = sc->hn_ifp; + uint32_t link_status; + int error; + + error = hn_rndis_get_linkstatus(sc, &link_status); + if (error) { + /* XXX what to do? */ + return; + } + + if (link_status == NDIS_MEDIA_STATE_CONNECTED) + sc->hn_carrier = 1; + else + sc->hn_carrier = 0; + if_link_state_change(ifp, + sc->hn_carrier ? LINK_STATE_UP : LINK_STATE_DOWN); +} + +void +hn_link_status_update(struct hn_softc *sc) +{ + + if (sc->hn_mgmt_taskq != NULL) + taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_link_task); +} + static __inline int hn_txdesc_dmamap_load(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head, bus_dma_segment_t *segs, int *nsegs) @@ -1311,19 +1362,6 @@ hn_start_locked(struct hn_tx_ring *txr, } /* - * Link up/down notification - */ -void -netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status) -{ - if (status == 1) { - sc->hn_carrier = 1; - } else { - sc->hn_carrier = 0; - } -} - -/* * Append the specified data to the indicated mbuf chain, * Extend the mbuf chain if the new data does not fit in * existing space. @@ -1653,8 +1691,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); #endif - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - hn_suspend(sc); + /* + * Suspend this interface before the synthetic parts + * are ripped. + */ + hn_suspend(sc); /* * Detach the synthetics parts, i.e. NVS and RNDIS. @@ -1672,9 +1713,10 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_set_chim_size(sc, sc->hn_chim_szmax); hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu); - /* All done! Resume now. */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - hn_resume(sc); + /* + * All done! Resume the interface now. + */ + hn_resume(sc); HN_UNLOCK(sc); break; @@ -1801,9 +1843,9 @@ hn_stop(struct hn_softc *sc) KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, ("synthetic parts were not attached")); - /* Clear RUNNING bit _before_ hn_suspend() */ + /* Clear RUNNING bit _before_ hn_suspend_data() */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); - hn_suspend(sc); + hn_suspend_data(sc); /* Clear OACTIVE bit. */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); @@ -1896,9 +1938,6 @@ hn_init_locked(struct hn_softc *sc) /* Everything is ready; unleash! */ atomic_set_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); - - /* TODO: check RNDIS link status. */ - if_link_state_change(ifp, LINK_STATE_UP); } static void @@ -3600,7 +3639,7 @@ hn_rx_drain(struct vmbus_channel *chan) } static void -hn_suspend(struct hn_softc *sc) +hn_suspend_data(struct hn_softc *sc) { struct vmbus_channel **subch = NULL; int i, nsubch; @@ -3654,6 +3693,42 @@ hn_suspend(struct hn_softc *sc) } static void +hn_suspend_mgmt_taskfunc(void *xsc, int pending __unused) +{ + + ((struct hn_softc *)xsc)->hn_mgmt_taskq = NULL; +} + +static void +hn_suspend_mgmt(struct hn_softc *sc) +{ + struct task task; + + HN_LOCK_ASSERT(sc); + + /* + * Make sure that hn_mgmt_taskq0 can nolonger be accessed + * through hn_mgmt_taskq. + */ + TASK_INIT(&task, 0, hn_suspend_mgmt_taskfunc, sc); + vmbus_chan_run_task(sc->hn_prichan, &task); + + /* + * Make sure that all pending management tasks are completed. + */ + taskqueue_drain_all(sc->hn_mgmt_taskq0); +} + +static void +hn_suspend(struct hn_softc *sc) +{ + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_suspend_data(sc); + hn_suspend_mgmt(sc); +} + +static void hn_tx_resume(struct hn_softc *sc, int tx_ring_cnt) { int i; @@ -3671,7 +3746,7 @@ hn_tx_resume(struct hn_softc *sc, int tx } static void -hn_resume(struct hn_softc *sc) +hn_resume_data(struct hn_softc *sc) { int i; @@ -3685,7 +3760,8 @@ hn_resume(struct hn_softc *sc) /* * Make sure to clear suspend status on "all" TX rings, - * since hn_tx_ring_inuse can be changed after hn_suspend(). + * since hn_tx_ring_inuse can be changed after + * hn_suspend_data(). */ hn_tx_resume(sc, sc->hn_tx_ring_cnt); @@ -3713,6 +3789,26 @@ hn_resume(struct hn_softc *sc) } static void +hn_resume_mgmt(struct hn_softc *sc) +{ + + /* + * Kick off link status check. + */ + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + hn_link_status_update(sc); +} + +static void +hn_resume(struct hn_softc *sc) +{ + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_resume_data(sc); + hn_resume_mgmt(sc); +} + +static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { const struct hn_nvs_hdr *hdr; Modified: stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 07:24:32 2016 (r307613) +++ stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 07:27:45 2016 (r307614) @@ -167,11 +167,8 @@ hv_rf_receive_indicate_status(struct hn_ switch (msg->rm_status) { case RNDIS_STATUS_MEDIA_CONNECT: - netvsc_linkstatus_callback(sc, 1); - break; - case RNDIS_STATUS_MEDIA_DISCONNECT: - netvsc_linkstatus_callback(sc, 0); + hn_link_status_update(sc); break; case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 07:24:32 2016 (r307613) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 07:27:45 2016 (r307614) @@ -138,6 +138,7 @@ void hn_nvs_sent_xact(struct hn_send_ct int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info); void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); +void hn_link_status_update(struct hn_softc *sc); extern struct hn_send_ctx hn_send_ctx_none; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 07:24:32 2016 (r307613) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 07:27:45 2016 (r307614) @@ -1713,3 +1713,11 @@ vmbus_chan_rx_empty(const struct vmbus_c return (vmbus_rxbr_empty(&chan->ch_rxbr)); } + +void +vmbus_chan_run_task(struct vmbus_channel *chan, struct task *task) +{ + + taskqueue_enqueue(chan->ch_tq, task); + taskqueue_drain(chan->ch_tq, task); +} From owner-svn-src-all@freebsd.org Wed Oct 19 07:33:44 2016 Return-Path: Delivered-To: svn-src-all@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 55592C173DC; Wed, 19 Oct 2016 07:33:44 +0000 (UTC) (envelope-from sephe@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 245D01ED; Wed, 19 Oct 2016 07:33:44 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J7Xh5b023128; Wed, 19 Oct 2016 07:33:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J7Xh98023127; Wed, 19 Oct 2016 07:33:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190733.u9J7Xh98023127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:33:43 +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: r307615 - stable/11/sys/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:33:44 -0000 Author: sephe Date: Wed Oct 19 07:33:43 2016 New Revision: 307615 URL: https://svnweb.freebsd.org/changeset/base/307615 Log: MFC 307078 ifnet: Use if_link_state snapshot to invoke ifnet_link_event So that everyone in this task have consistent view of link state. Reviewed by: ae Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8214 Modified: stable/11/sys/net/if.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if.c ============================================================================== --- stable/11/sys/net/if.c Wed Oct 19 07:27:45 2016 (r307614) +++ stable/11/sys/net/if.c Wed Oct 19 07:33:43 2016 (r307615) @@ -2206,7 +2206,7 @@ do_link_state_change(void *arg, int pend if (log_link_state_change) log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname, (link_state == LINK_STATE_UP) ? "UP" : "DOWN" ); - EVENTHANDLER_INVOKE(ifnet_link_event, ifp, ifp->if_link_state); + EVENTHANDLER_INVOKE(ifnet_link_event, ifp, link_state); CURVNET_RESTORE(); } From owner-svn-src-all@freebsd.org Wed Oct 19 07:40:53 2016 Return-Path: Delivered-To: svn-src-all@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 34755C17755; Wed, 19 Oct 2016 07:40:53 +0000 (UTC) (envelope-from imp@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 031CB869; Wed, 19 Oct 2016 07:40:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J7eqGl025439; Wed, 19 Oct 2016 07:40:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J7eqO1025438; Wed, 19 Oct 2016 07:40:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610190740.u9J7eqO1025438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 19 Oct 2016 07:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307616 - head/tools/tools/nanobsd/embedded X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:40:53 -0000 Author: imp Date: Wed Oct 19 07:40:51 2016 New Revision: 307616 URL: https://svnweb.freebsd.org/changeset/base/307616 Log: RPI3 is retired in preference to GENERIC-UP. Use that instead. Modified: head/tools/tools/nanobsd/embedded/rpi3.cfg Modified: head/tools/tools/nanobsd/embedded/rpi3.cfg ============================================================================== --- head/tools/tools/nanobsd/embedded/rpi3.cfg Wed Oct 19 07:33:43 2016 (r307615) +++ head/tools/tools/nanobsd/embedded/rpi3.cfg Wed Oct 19 07:40:51 2016 (r307616) @@ -27,7 +27,7 @@ # NANO_ARCH=aarch64 -NANO_KERNEL=RPI3 +NANO_KERNEL=GENERIC-UP NANO_DRIVE=mmcsd0 NANO_NAME=rpi3 NANO_BOOT_PKG=u-boot-rpi3 From owner-svn-src-all@freebsd.org Wed Oct 19 07:43:41 2016 Return-Path: Delivered-To: svn-src-all@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 20365C17929; Wed, 19 Oct 2016 07:43:41 +0000 (UTC) (envelope-from sephe@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 E254CC1F; Wed, 19 Oct 2016 07:43:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J7hdIH026846; Wed, 19 Oct 2016 07:43:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J7hdOq026845; Wed, 19 Oct 2016 07:43:39 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190743.u9J7hdOq026845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:43: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: r307617 - stable/11/sys/dev/hyperv/storvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:43:41 -0000 Author: sephe Date: Wed Oct 19 07:43:39 2016 New Revision: 307617 URL: https://svnweb.freebsd.org/changeset/base/307617 Log: MFC 307261 hyperv/stor: Fix off-by-one bug; this brings back TRIM support. Submitted by: Hongjiang Zhang Reported by: Lili Deng Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8238 Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Oct 19 07:40:51 2016 (r307616) +++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Oct 19 07:43:39 2016 (r307617) @@ -2210,7 +2210,7 @@ storvsc_io_done(struct hv_storvsc_reques resp_buf[3], resp_buf[4]); } if (vm_srb->srb_status == SRB_STATUS_SUCCESS && - data_len > SHORT_INQUIRY_LENGTH) { + data_len >= SHORT_INQUIRY_LENGTH) { char vendor[16]; cam_strvis(vendor, inq_data->vendor, From owner-svn-src-all@freebsd.org Wed Oct 19 07:46:21 2016 Return-Path: Delivered-To: svn-src-all@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 90704C179E1; Wed, 19 Oct 2016 07:46:21 +0000 (UTC) (envelope-from sephe@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 5759FDD7; Wed, 19 Oct 2016 07:46:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J7kKPX027017; Wed, 19 Oct 2016 07:46:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J7kKp2027016; Wed, 19 Oct 2016 07:46:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190746.u9J7kKp2027016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 07:46:20 +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: r307618 - stable/11/sys/dev/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 07:46:21 -0000 Author: sephe Date: Wed Oct 19 07:46:20 2016 New Revision: 307618 URL: https://svnweb.freebsd.org/changeset/base/307618 Log: MFC 307263 hyperv/vmbus: Add __FBSDID Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_br.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_br.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_br.c Wed Oct 19 07:43:39 2016 (r307617) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_br.c Wed Oct 19 07:46:20 2016 (r307618) @@ -26,6 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include From owner-svn-src-all@freebsd.org Wed Oct 19 08:01:20 2016 Return-Path: Delivered-To: svn-src-all@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 BB0C6C180A3 for ; Wed, 19 Oct 2016 08:01:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A06C8CD for ; Wed, 19 Oct 2016 08:01:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22d.google.com with SMTP id 139so97305064itm.1 for ; Wed, 19 Oct 2016 01:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=DCcYOFqQiRSNqQNrHqlaI9tDvk6zXs4G6H/zz9Tlu+0=; b=KJ9fp8QiWKke4rNs/+dB/IQV6p/FPFoVa7DvcmgsCj3GRn4arKBb/pg7xQC4f3rz0N pMTFpjcN1dipOpHuJR440Na3sU9duMor6ibbEwbfJL4DhJpb0SivNuqhHLHQ/IBHnErd p1Zc4LUQ5UScuYXhBmlfcoE619AUWX+GqDYMudtK1y3RqxgPpOBM2CRZ/UEK7f+z6GuS 4NIu8vI5S47Ye8m1rJ+rjCo0JjUCfMSW8WjBbsOSE9kRbVTIv1dUewkuF/H3EaQSFleO eX9R6fmjFsOn90gMM9ws/xt98SDHklNXqqAxXkWqq9eUo8f53ksZfiB7VTlzMY8bHvMX yVHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=DCcYOFqQiRSNqQNrHqlaI9tDvk6zXs4G6H/zz9Tlu+0=; b=FBU8SLdibP4MUkUP1rNpRwEz8/HFLTrtmAxtgUcAhJEIZSSfHlfH1LApxE+uziigla rz3KfAmDbICrRQJUrrAVrsjGErQzLvxs4xeRFyrXDzS8g2Gqgmi24vR5aOX6Ag7Gj/qa gsIeAiBSO0iXGyeYRha8r/okm7xQpwRBFlDMT313IXC5b0BRphL8dB2xUO+EwLdQ+HzP aA5OHlVjTdOEyuFOXWtaUOSx6/hZycbz+3Aw9Fy55EqpfOQW7NYWhx60DojVVmb5R7z7 TckALiLWEJ/uPit7E0QcCBaCEJlSaa3ngY6K0PuAIuwBGQpqCIAw7otCUChCWZliEpMJ B9ZA== X-Gm-Message-State: AA6/9RlJjm37UlMVFmvFYfREaFofsL8I61NObkCLe0ea+TCPOLRyDyLNXX2Fz5ESD7UVJhbPHOksNTWkQAntnQ== X-Received: by 10.36.19.147 with SMTP id 141mr1563835itz.85.1476864078889; Wed, 19 Oct 2016 01:01:18 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.77.85 with HTTP; Wed, 19 Oct 2016 01:01:18 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <3841347.BNPZXPm7N3@ralph.baldwin.cx> References: <201610141710.u9EHArlL089412@repo.freebsd.org> <1950201.IjTl3rpdGP@ralph.baldwin.cx> <3841347.BNPZXPm7N3@ralph.baldwin.cx> From: Warner Losh Date: Wed, 19 Oct 2016 02:01:18 -0600 X-Google-Sender-Auth: FCc-kRIVpB84iYnBqjufMtj9TLs Message-ID: Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader To: John Baldwin Cc: Doug Ambrisko , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Doug Ambrisko , Ravi Pokala Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 08:01:20 -0000 On Wed, Oct 19, 2016 at 12:20 AM, John Baldwin wrote: > On Tuesday, October 18, 2016 11:44:52 PM Warner Losh wrote: >> On Mon, Oct 17, 2016 at 11:40 AM, John Baldwin wrote: >> > On Friday, October 14, 2016 12:25:54 PM Warner Losh wrote: >> >> On Oct 14, 2016 11:55 AM, "Doug Ambrisko" wrote: >> >> > >> >> > On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote: >> >> > | -----Original Message----- >> >> > | > From: on behalf of Doug Ambrisko < >> >> ambrisko@ambrisko.com> >> >> > | > Date: 2016-10-14, Friday at 10:27 >> >> > | > To: Warner Losh >> >> > | > Cc: Doug Ambrisko , src-committers < >> >> src-committers@freebsd.org>, "svn-src-all@freebsd.org" < >> >> svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" < >> >> svn-src-head@freebsd.org> >> >> > | > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader >> >> > | > >> >> > | > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote: >> >> > | > | Love the functionality, but don't like using the 'hint' namespace >> >> for >> >> > | > | this. Can we change it now before too many things depend on it? We >> >> had >> >> > | > | similar issues in ACPI and moved it to the 'acpi' space. Can we move >> >> > | > | this to the 'smbios' space please? >> >> > | > | >> >> > | > | The reason is that 'hint' is special and sometimes filtered out, so >> >> it >> >> > | > | is a poor choice to export data from the boot loader to the kernel. >> >> > | > >> >> > | > The reason I picked hint was it could be put /boot/device.hints >> >> > | > to make it work as well and that it was a hint. Other standards in >> >> the >> >> > | > future might use other methods. Looking back over the email I had >> >> > | > with John he had suggested hint.smbios.0.anchor to make this look >> >> > | > different. This code had been hanging around for so long I forgot >> >> > | > about that and we were using hint.smbios.0.mem in our shipping code >> >> base. >> >> > | > >> >> > | > However, I hope that nothing would use this except for smbios(4) and >> >> > | > for people to make smbios(4) useful for this info. >> >> > | >> >> > | Doug's looking at me when he says that. :-) >> >> > | >> >> > | We talked about this last night at BAFUG; right now, even if smbios(4) >> >> > | is able to find the SMBIOS info -- it currently only looks at the >> >> > | aforementioned 0xf0000 - 0xfffff range, so it can't find it on UEFI -- >> >> > | smbios(4) doesn't actually provide any interface for that information. >> >> > | Doug and I have talked about making smbios(4) useful, by parsing the >> >> > | data and providing KPIs and APIs, for years now; I think I'll *finally* >> >> > | have the time and motivation to do so "soon". >> >> > >> >> > I've actually talked to a few people. However, your the first to >> >> > step up. This needs to be designed and will take some time and >> >> > review. I would hope that except for smbios(4), nothing else would >> >> > use this kenv but there is nothing to prevent that :-( I could name >> >> > it super_secret_dont_use. >> >> > >> >> > BTW, to get you started this patch prevents smbios(4) from blowing chunks >> >> > when it gets a anchor in high memory and works on legacy machines. >> >> > >> >> > --- /sys/x86/bios/smbios.c 2013-10-01 14:28:25.000000000 -0700 >> >> > +++ ./smbios.c 2016-04-11 11:58:03.234969000 -0700 >> >> > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8 >> >> > #include >> >> > #include >> >> > #include >> >> > +#include >> >> > >> >> > #include >> >> > #include >> >> > @@ -59,7 +60,7 @@ struct smbios_softc { >> >> > }; >> >> > >> >> > #define RES2EPS(res) ((struct smbios_eps >> >> *)rman_get_virtual(res)) >> >> > -#define ADDR2EPS(addr) ((struct smbios_eps >> >> *)BIOS_PADDRTOVADDR(addr)) >> >> > +#define ADDR2EPS(addr) ((struct smbios_eps *)PHYS_TO_DMAP(addr)) >> >> > >> >> > static devclass_t smbios_devclass; >> >> > >> >> > @@ -71,19 +72,26 @@ static int smbios_modevent (module_t, in >> >> > >> >> > static int smbios_cksum (struct smbios_eps *); >> >> > >> >> > +static unsigned long addr; >> >> > +static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0, >> >> > + "SMBIOS driver parameters"); >> >> > +SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW, >> >> > + &addr, 0, ""); >> >> > + >> >> > static void >> >> > smbios_identify (driver_t *driver, device_t parent) >> >> > { >> >> > device_t child; >> >> > - u_int32_t addr; >> >> > int length; >> >> > int rid; >> >> > >> >> > if (!device_is_alive(parent)) >> >> > return; >> >> > >> >> > - addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, >> >> > - SMBIOS_STEP, SMBIOS_OFF); >> >> > + if (resource_long_value("smbios", 0, "mem", &addr) != 0 || >> >> > + addr == 0) >> >> > + addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, >> >> SMBIOS_LEN, >> >> > + SMBIOS_STEP, SMBIOS_OFF); >> >> > if (addr != 0) { >> >> > rid = 0; >> >> > length = ADDR2EPS(addr)->length; >> >> > >> >> > Note I don't plan to commit this since it doesn't really do much and we >> >> > need a lot more. >> >> >> >> I was planning on exporting all smbios stuff via sysctl. >> > >> > I'm a bit hesitant to do all the type parsing in the kernel vs userland. >> > However, I think having smbios(4) export a /dev/smbios that you can either >> > read() or mmap() to access the table would be very convenient and let you >> > keep the bits to parse the table in userland (and not require root if we >> > allow read-only access to mortals on /dev/foo). >> >> I'd support allowing this also, but we have them hidden in kenv how. >> Moving them to sysctl is trivial and adds no additional risk to the >> kernel. Having a /dev/smbios that also exports them and having >> userland tools to parse nodes that the loader doesn't export is also a >> good idea, but I don't think that would replace what I have in mind. >> sysctl is super easy to get data from in shell and other scripts. >> /dev/smbios would require another program to parse the blob that's >> exported. I think it would be cool to have that as well and wouldn't >> interfere with what I was planning on doing. > > Not everything is as sensible to export via sysctl, though a subset of > things might be. I have patches to pciconf to let it parse the smbios > table for describing physical slots and which new-bus devices are > associated with physical slots (unfortunately the tables themselves aren't > very reliable in my experience to date), and that sort of thing probably > belongs in userland. Agreed. That sort of thing isn't exported via a kenv today anyway. > dmidecode could be patched to use /dev/smbios > rather than grovelling around in /dev/mem rather easily. Having a tool > to parse the table isn't the end of the world. We do this with other > tables (e.g. the SMAP and EFI memory maps are exported as "raw" sysctl > nodes that the sysctl binary knows how to format, but that is still > done in userland). acpidump -t, mptable, pirtool, etc. are all done in > userland as well. Understood. And I aagree. I think there's useful info that we should put in sysctl as well. It's also useful to have it in the sysctl -a output. The sysctl info I'm planning is about the system, and not any of these tables. One of my systems would export these as sysctls: smbios.bios.reldate="07/05/2013" smbios.bios.vendor="American Megatrends Inc." smbios.bios.version="3.00" smbios.chassis.maker="Supermicro" smbios.chassis.serial="0123456789" smbios.chassis.tag="To Be Filled By O.E.M." smbios.chassis.version="0123456789" smbios.memory.enabled="268435456" smbios.planar.location="To be filled by O.E.M." smbios.planar.maker="Supermicro" smbios.planar.product="X9SRH-7F/7TF" smbios.planar.serial="VM13CS028237" smbios.planar.tag="To be filled by O.E.M." smbios.planar.version="0123456789" smbios.socket.enabled="1" smbios.socket.populated="1" smbios.system.family="To be filled by O.E.M." smbios.system.maker="Supermicro" smbios.system.product="X9SRH-7F/7TF" smbios.system.serial="0123456789" smbios.system.sku="To be filled by O.E.M." smbios.system.uuid="00000000-0000-0000-0000-002590e4d0ec" smbios.system.version="0123456789" smbios.version="2.7" though some of them are silly due to the BIOS writer being silly... Warner From owner-svn-src-all@freebsd.org Wed Oct 19 08:23:56 2016 Return-Path: Delivered-To: svn-src-all@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 30477C18844; Wed, 19 Oct 2016 08:23:56 +0000 (UTC) (envelope-from gahr@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 0A4A09C9; Wed, 19 Oct 2016 08:23:55 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J8NtEO042123; Wed, 19 Oct 2016 08:23:55 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J8NttB042122; Wed, 19 Oct 2016 08:23:55 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201610190823.u9J8NttB042122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Wed, 19 Oct 2016 08:23: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: r307619 - stable/11/usr.bin/ul X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 08:23:56 -0000 Author: gahr (ports committer) Date: Wed Oct 19 08:23:54 2016 New Revision: 307619 URL: https://svnweb.freebsd.org/changeset/base/307619 Log: MFC r302558: Do not truncate lines longer than 512 chars. PR: 210344 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6881 Modified: stable/11/usr.bin/ul/ul.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/ul/ul.c ============================================================================== --- stable/11/usr.bin/ul/ul.c Wed Oct 19 07:46:20 2016 (r307618) +++ stable/11/usr.bin/ul/ul.c Wed Oct 19 08:23:54 2016 (r307619) @@ -78,7 +78,9 @@ struct CHAR { int c_width; /* width or -1 if multi-column char. filler */ } ; -static struct CHAR obuf[MAXBUF]; +static struct CHAR sobuf[MAXBUF]; /* static output buffer */ +static struct CHAR *obuf = sobuf; +static int buflen = MAXBUF; static int col, maxcol; static int mode; static int halfpos; @@ -151,6 +153,9 @@ main(int argc, char **argv) else filter(f); } + if (obuf != sobuf) { + free(obuf); + } exit(0); } @@ -166,128 +171,148 @@ filter(FILE *f) { wint_t c; int i, w; + int copy; + + copy = 0; + + while ((c = getwc(f)) != WEOF) { + if (col == buflen) { + if (obuf == sobuf) { + obuf = NULL; + copy = 1; + } + obuf = realloc(obuf, sizeof(*obuf) * 2 * buflen); + if (obuf == NULL) { + obuf = sobuf; + break; + } else if (copy) { + memcpy(obuf, sobuf, sizeof(*obuf) * buflen); + copy = 0; + } + bzero((char *)(obuf + buflen), sizeof(*obuf) * buflen); + buflen *= 2; + } + switch(c) { + case '\b': + if (col > 0) + col--; + continue; - while ((c = getwc(f)) != WEOF && col < MAXBUF) switch(c) { + case '\t': + col = (col+8) & ~07; + if (col > maxcol) + maxcol = col; + continue; - case '\b': - if (col > 0) - col--; - continue; - - case '\t': - col = (col+8) & ~07; - if (col > maxcol) - maxcol = col; - continue; - - case '\r': - col = 0; - continue; - - case SO: - mode |= ALTSET; - continue; - - case SI: - mode &= ~ALTSET; - continue; - - case IESC: - switch (c = getwc(f)) { - - case HREV: - if (halfpos == 0) { - mode |= SUPERSC; - halfpos--; - } else if (halfpos > 0) { - mode &= ~SUBSC; - halfpos--; - } else { - halfpos = 0; - reverse(); - } + case '\r': + col = 0; continue; - case HFWD: - if (halfpos == 0) { - mode |= SUBSC; - halfpos++; - } else if (halfpos < 0) { - mode &= ~SUPERSC; - halfpos++; - } else { - halfpos = 0; - fwd(); - } + case SO: + mode |= ALTSET; continue; - case FREV: - reverse(); + case SI: + mode &= ~ALTSET; continue; - default: - errx(1, "unknown escape sequence in input: %o, %o", IESC, c); - } - continue; + case IESC: + switch (c = getwc(f)) { - case '_': - if (obuf[col].c_char || obuf[col].c_width < 0) { - while (col > 0 && obuf[col].c_width < 0) - col--; - w = obuf[col].c_width; - for (i = 0; i < w; i++) - obuf[col++].c_mode |= UNDERL | mode; + case HREV: + if (halfpos == 0) { + mode |= SUPERSC; + halfpos--; + } else if (halfpos > 0) { + mode &= ~SUBSC; + halfpos--; + } else { + halfpos = 0; + reverse(); + } + continue; + + case HFWD: + if (halfpos == 0) { + mode |= SUBSC; + halfpos++; + } else if (halfpos < 0) { + mode &= ~SUPERSC; + halfpos++; + } else { + halfpos = 0; + fwd(); + } + continue; + + case FREV: + reverse(); + continue; + + default: + errx(1, "unknown escape sequence in input: %o, %o", IESC, c); + } + continue; + + case '_': + if (obuf[col].c_char || obuf[col].c_width < 0) { + while (col > 0 && obuf[col].c_width < 0) + col--; + w = obuf[col].c_width; + for (i = 0; i < w; i++) + obuf[col++].c_mode |= UNDERL | mode; + if (col > maxcol) + maxcol = col; + continue; + } + obuf[col].c_char = '_'; + obuf[col].c_width = 1; + /* FALLTHROUGH */ + case ' ': + col++; if (col > maxcol) maxcol = col; continue; - } - obuf[col].c_char = '_'; - obuf[col].c_width = 1; - /* FALLTHROUGH */ - case ' ': - col++; - if (col > maxcol) - maxcol = col; - continue; - case '\n': - flushln(); - continue; + case '\n': + flushln(); + continue; - case '\f': - flushln(); - putwchar('\f'); - continue; + case '\f': + flushln(); + putwchar('\f'); + continue; - default: - if ((w = wcwidth(c)) <= 0) /* non printing */ + default: + if ((w = wcwidth(c)) <= 0) /* non printing */ + continue; + if (obuf[col].c_char == '\0') { + obuf[col].c_char = c; + for (i = 0; i < w; i++) + obuf[col + i].c_mode = mode; + obuf[col].c_width = w; + for (i = 1; i < w; i++) + obuf[col + i].c_width = -1; + } else if (obuf[col].c_char == '_') { + obuf[col].c_char = c; + for (i = 0; i < w; i++) + obuf[col + i].c_mode |= UNDERL|mode; + obuf[col].c_width = w; + for (i = 1; i < w; i++) + obuf[col + i].c_width = -1; + } else if ((wint_t)obuf[col].c_char == c) { + for (i = 0; i < w; i++) + obuf[col + i].c_mode |= BOLD|mode; + } else { + w = obuf[col].c_width; + for (i = 0; i < w; i++) + obuf[col + i].c_mode = mode; + } + col += w; + if (col > maxcol) + maxcol = col; continue; - if (obuf[col].c_char == '\0') { - obuf[col].c_char = c; - for (i = 0; i < w; i++) - obuf[col + i].c_mode = mode; - obuf[col].c_width = w; - for (i = 1; i < w; i++) - obuf[col + i].c_width = -1; - } else if (obuf[col].c_char == '_') { - obuf[col].c_char = c; - for (i = 0; i < w; i++) - obuf[col + i].c_mode |= UNDERL|mode; - obuf[col].c_width = w; - for (i = 1; i < w; i++) - obuf[col + i].c_width = -1; - } else if ((wint_t)obuf[col].c_char == c) { - for (i = 0; i < w; i++) - obuf[col + i].c_mode |= BOLD|mode; - } else { - w = obuf[col].c_width; - for (i = 0; i < w; i++) - obuf[col + i].c_mode = mode; } - col += w; - if (col > maxcol) - maxcol = col; - continue; } if (ferror(f)) err(1, NULL); @@ -405,7 +430,7 @@ static void initbuf(void) { - bzero((char *)obuf, sizeof (obuf)); /* depends on NORMAL == 0 */ + bzero((char *)obuf, buflen * sizeof(*obuf)); /* depends on NORMAL == 0 */ col = 0; maxcol = 0; mode &= ALTSET; From owner-svn-src-all@freebsd.org Wed Oct 19 08:32:26 2016 Return-Path: Delivered-To: svn-src-all@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 1C992C18B0E; Wed, 19 Oct 2016 08:32:26 +0000 (UTC) (envelope-from sephe@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 DC8ECF1C; Wed, 19 Oct 2016 08:32:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J8WP1Y045793; Wed, 19 Oct 2016 08:32:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J8WOOG045787; Wed, 19 Oct 2016 08:32:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190832.u9J8WOOG045787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 08:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307620 - in stable/10/sys: dev/hyperv/netvsc net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 08:32:26 -0000 Author: sephe Date: Wed Oct 19 08:32:24 2016 New Revision: 307620 URL: https://svnweb.freebsd.org/changeset/base/307620 Log: MFC 306936-306939 306936 hyperv/hn: Fix checksum offload settings The _correct_ way to identify the supported checksum offloading and TSO parameters is to query OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8088 306937 hyperv/hn: Fix if_hw_tsomax setup. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8089 306938 hyperv/hn: Generalize RSS capabilities query. - Support NDIS < 6.30. - Stringent response checks. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8090 306939 hyperv/hn: Suffix NDIS offload size with NDIS version. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8091 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h stable/10/sys/dev/hyperv/netvsc/ndis.h stable/10/sys/net/rndis.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 08:23:54 2016 (r307619) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 08:32:24 2016 (r307620) @@ -245,6 +245,8 @@ struct hn_softc { uint32_t hn_rndis_rid; uint32_t hn_ndis_ver; + int hn_ndis_tso_szmax; + int hn_ndis_tso_sgmin; struct ndis_rssprm_toeplitz hn_rss; }; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 08:23:54 2016 (r307619) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 08:32:24 2016 (r307620) @@ -232,7 +232,7 @@ SYSCTL_INT(_hw_hn, OID_AUTO, trust_hosti "when csum info is missing (global setting)"); /* Limit TSO burst size */ -static int hn_tso_maxlen = 0; +static int hn_tso_maxlen = IP_MAXPACKET; SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, &hn_tso_maxlen, 0, "TSO burst limit"); @@ -340,6 +340,7 @@ static int hn_encap(struct hn_tx_ring *, static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); static void hn_set_chim_size(struct hn_softc *, int); +static void hn_set_tso_maxsize(struct hn_softc *, int, int); static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); static void hn_chan_detach(struct hn_softc *, struct vmbus_channel *); static int hn_attach_subchans(struct hn_softc *); @@ -535,7 +536,6 @@ netvsc_attach(device_t dev) uint32_t link_status; struct ifnet *ifp = NULL; int error, ring_cnt, tx_ring_cnt; - int tso_maxlen; sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); @@ -736,18 +736,16 @@ netvsc_attach(device_t dev) /* Enable all available capabilities by default. */ ifp->if_capenable = ifp->if_capabilities; - tso_maxlen = hn_tso_maxlen; - if (tso_maxlen <= 0 || tso_maxlen > IP_MAXPACKET) - tso_maxlen = IP_MAXPACKET; - ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; - ifp->if_hw_tsomaxsegsize = PAGE_SIZE; - ifp->if_hw_tsomax = tso_maxlen - - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) { + hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU); + ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; + ifp->if_hw_tsomaxsegsize = PAGE_SIZE; + } ether_ifattach(ifp, eaddr); - if (bootverbose) { - if_printf(ifp, "TSO: %u/%u/%u\n", ifp->if_hw_tsomax, + if ((ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) && bootverbose) { + if_printf(ifp, "TSO segcnt %u segsz %u\n", ifp->if_hw_tsomaxsegcount, ifp->if_hw_tsomaxsegsize); } @@ -1692,6 +1690,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu); /* All done! Resume now. */ if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -2939,6 +2938,34 @@ hn_set_chim_size(struct hn_softc *sc, in } static void +hn_set_tso_maxsize(struct hn_softc *sc, int tso_maxlen, int mtu) +{ + struct ifnet *ifp = sc->hn_ifp; + int tso_minlen; + + if ((ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) == 0) + return; + + KASSERT(sc->hn_ndis_tso_sgmin >= 2, + ("invalid NDIS tso sgmin %d", sc->hn_ndis_tso_sgmin)); + tso_minlen = sc->hn_ndis_tso_sgmin * mtu; + + KASSERT(sc->hn_ndis_tso_szmax >= tso_minlen && + sc->hn_ndis_tso_szmax <= IP_MAXPACKET, + ("invalid NDIS tso szmax %d", sc->hn_ndis_tso_szmax)); + + if (tso_maxlen < tso_minlen) + tso_maxlen = tso_minlen; + else if (tso_maxlen > IP_MAXPACKET) + tso_maxlen = IP_MAXPACKET; + if (tso_maxlen > sc->hn_ndis_tso_szmax) + tso_maxlen = sc->hn_ndis_tso_szmax; + ifp->if_hw_tsomax = tso_maxlen - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + if (bootverbose) + if_printf(ifp, "TSO size max %u\n", ifp->if_hw_tsomax); +} + +static void hn_fixup_tx_data(struct hn_softc *sc) { uint64_t csum_assist; @@ -3444,7 +3471,7 @@ hn_synth_attach(struct hn_softc *sc, int /* * Attach RNDIS _after_ NVS is attached. */ - error = hn_rndis_attach(sc); + error = hn_rndis_attach(sc, mtu); if (error) return (error); Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 08:23:54 2016 (r307619) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 08:32:24 2016 (r307620) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -69,6 +71,18 @@ __FBSDID("$FreeBSD$"); #define HN_RNDIS_XFER_SIZE 2048 +#define HN_NDIS_TXCSUM_CAP_IP4 \ + (NDIS_TXCSUM_CAP_IP4 | NDIS_TXCSUM_CAP_IP4OPT) +#define HN_NDIS_TXCSUM_CAP_TCP4 \ + (NDIS_TXCSUM_CAP_TCP4 | NDIS_TXCSUM_CAP_TCP4OPT) +#define HN_NDIS_TXCSUM_CAP_TCP6 \ + (NDIS_TXCSUM_CAP_TCP6 | NDIS_TXCSUM_CAP_TCP6OPT | \ + NDIS_TXCSUM_CAP_IP6EXT) +#define HN_NDIS_TXCSUM_CAP_UDP6 \ + (NDIS_TXCSUM_CAP_UDP6 | NDIS_TXCSUM_CAP_IP6EXT) +#define HN_NDIS_LSOV2_CAP_IP6 \ + (NDIS_LSOV2_CAP_IP6EXT | NDIS_LSOV2_CAP_TCP6OPT) + /* * Forward declarations */ @@ -79,9 +93,14 @@ static void hv_rf_receive_data(struct hn static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0); +static int hn_rndis_query2(struct hn_softc *sc, uint32_t oid, + const void *idata, size_t idlen, void *odata, size_t *odlen0, + size_t min_odlen); static int hn_rndis_set(struct hn_softc *sc, uint32_t oid, const void *data, size_t dlen); -static int hn_rndis_conf_offload(struct hn_softc *sc); +static int hn_rndis_conf_offload(struct hn_softc *sc, int mtu); +static int hn_rndis_query_hwcaps(struct hn_softc *sc, + struct ndis_offload *caps); static __inline uint32_t hn_rndis_rid(struct hn_softc *sc) @@ -625,6 +644,15 @@ static int hn_rndis_query(struct hn_softc *sc, uint32_t oid, const void *idata, size_t idlen, void *odata, size_t *odlen0) { + + return (hn_rndis_query2(sc, oid, idata, idlen, odata, odlen0, *odlen0)); +} + +static int +hn_rndis_query2(struct hn_softc *sc, uint32_t oid, + const void *idata, size_t idlen, void *odata, size_t *odlen0, + size_t min_odlen) +{ struct rndis_query_req *req; const struct rndis_query_comp *comp; struct vmbus_xact *xact; @@ -662,7 +690,7 @@ hn_rndis_query(struct hn_softc *sc, uint memcpy(req + 1, idata, idlen); } - comp_len = sizeof(*comp) + odlen; + comp_len = sizeof(*comp) + min_odlen; comp = hn_rndis_xact_execute(sc, xact, rid, reqlen, &comp_len, REMOTE_NDIS_QUERY_CMPLT); if (comp == NULL) { @@ -718,26 +746,44 @@ hn_rndis_get_rsscaps(struct hn_softc *sc size_t caps_len; int error; - /* - * Only NDIS 6.30+ is supported. - */ - KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, - ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); *rxr_cnt = 0; memset(&in, 0, sizeof(in)); in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS; - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) { + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_1; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE_6_0; + } else { + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; + } caps_len = NDIS_RSS_CAPS_SIZE; - error = hn_rndis_query(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, - &in, NDIS_RSS_CAPS_SIZE, &caps, &caps_len); + error = hn_rndis_query2(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, + &in, NDIS_RSS_CAPS_SIZE, &caps, &caps_len, NDIS_RSS_CAPS_SIZE_6_0); if (error) return (error); - if (caps_len < NDIS_RSS_CAPS_SIZE_6_0) { - if_printf(sc->hn_ifp, "invalid NDIS RSS caps len %zu", - caps_len); + + /* + * Preliminary verification. + */ + if (caps.ndis_hdr.ndis_type != NDIS_OBJTYPE_RSS_CAPS) { + if_printf(sc->hn_ifp, "invalid NDIS objtype 0x%02x\n", + caps.ndis_hdr.ndis_type); + return (EINVAL); + } + if (caps.ndis_hdr.ndis_rev < NDIS_RSS_CAPS_REV_1) { + if_printf(sc->hn_ifp, "invalid NDIS objrev 0x%02x\n", + caps.ndis_hdr.ndis_rev); + return (EINVAL); + } + if (caps.ndis_hdr.ndis_size > caps_len) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u, " + "data size %zu\n", caps.ndis_hdr.ndis_size, caps_len); + return (EINVAL); + } else if (caps.ndis_hdr.ndis_size < NDIS_RSS_CAPS_SIZE_6_0) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", + caps.ndis_hdr.ndis_size); return (EINVAL); } @@ -747,7 +793,7 @@ hn_rndis_get_rsscaps(struct hn_softc *sc } *rxr_cnt = caps.ndis_nrxr; - if (caps_len == NDIS_RSS_CAPS_SIZE) { + if (caps.ndis_hdr.ndis_size == NDIS_RSS_CAPS_SIZE) { if (bootverbose) { if_printf(sc->hn_ifp, "RSS indirect table size %u\n", caps.ndis_nind); @@ -807,12 +853,19 @@ done: } static int -hn_rndis_conf_offload(struct hn_softc *sc) +hn_rndis_conf_offload(struct hn_softc *sc, int mtu) { + struct ndis_offload hwcaps; struct ndis_offload_params params; - uint32_t caps; + uint32_t caps = 0; size_t paramsz; - int error; + int error, tso_maxsz, tso_minsg; + + error = hn_rndis_query_hwcaps(sc, &hwcaps); + if (error) { + if_printf(sc->hn_ifp, "hwcaps query failed: %d\n", error); + return (error); + } /* NOTE: 0 means "no change" */ memset(¶ms, 0, sizeof(params)); @@ -827,18 +880,136 @@ hn_rndis_conf_offload(struct hn_softc *s } params.ndis_hdr.ndis_size = paramsz; - caps = HN_CAP_IPCS | HN_CAP_TCP4CS | HN_CAP_TCP6CS; - params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; - params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; - params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; - if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { - caps |= HN_CAP_UDP4CS | HN_CAP_UDP6CS; - params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; - params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; - } - caps |= HN_CAP_TSO4; - params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_ON; - /* XXX ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON */ + /* + * TSO4/TSO6 setup. + */ + tso_maxsz = IP_MAXPACKET; + tso_minsg = 2; + if (hwcaps.ndis_lsov2.ndis_ip4_encap & NDIS_OFFLOAD_ENCAP_8023) { + caps |= HN_CAP_TSO4; + params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_ON; + + if (hwcaps.ndis_lsov2.ndis_ip4_maxsz < tso_maxsz) + tso_maxsz = hwcaps.ndis_lsov2.ndis_ip4_maxsz; + if (hwcaps.ndis_lsov2.ndis_ip4_minsg > tso_minsg) + tso_minsg = hwcaps.ndis_lsov2.ndis_ip4_minsg; + } + if ((hwcaps.ndis_lsov2.ndis_ip6_encap & NDIS_OFFLOAD_ENCAP_8023) && + (hwcaps.ndis_lsov2.ndis_ip6_opts & HN_NDIS_LSOV2_CAP_IP6) == + HN_NDIS_LSOV2_CAP_IP6) { +#ifdef notyet + caps |= HN_CAP_TSO6; + params.ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_ON; + + if (hwcaps.ndis_lsov2.ndis_ip6_maxsz < tso_maxsz) + tso_maxsz = hwcaps.ndis_lsov2.ndis_ip6_maxsz; + if (hwcaps.ndis_lsov2.ndis_ip6_minsg > tso_minsg) + tso_minsg = hwcaps.ndis_lsov2.ndis_ip6_minsg; +#endif + } + sc->hn_ndis_tso_szmax = 0; + sc->hn_ndis_tso_sgmin = 0; + if (caps & (HN_CAP_TSO4 | HN_CAP_TSO6)) { + KASSERT(tso_maxsz <= IP_MAXPACKET, + ("invalid NDIS TSO maxsz %d", tso_maxsz)); + KASSERT(tso_minsg >= 2, + ("invalid NDIS TSO minsg %d", tso_minsg)); + if (tso_maxsz < tso_minsg * mtu) { + if_printf(sc->hn_ifp, "invalid NDIS TSO config: " + "maxsz %d, minsg %d, mtu %d; " + "disable TSO4 and TSO6\n", + tso_maxsz, tso_minsg, mtu); + caps &= ~(HN_CAP_TSO4 | HN_CAP_TSO6); + params.ndis_lsov2_ip4 = NDIS_OFFLOAD_LSOV2_OFF; + params.ndis_lsov2_ip6 = NDIS_OFFLOAD_LSOV2_OFF; + } else { + sc->hn_ndis_tso_szmax = tso_maxsz; + sc->hn_ndis_tso_sgmin = tso_minsg; + if (bootverbose) { + if_printf(sc->hn_ifp, "NDIS TSO " + "szmax %d sgmin %d\n", + sc->hn_ndis_tso_szmax, + sc->hn_ndis_tso_sgmin); + } + } + } + + /* IPv4 checksum */ + if ((hwcaps.ndis_csum.ndis_ip4_txcsum & HN_NDIS_TXCSUM_CAP_IP4) == + HN_NDIS_TXCSUM_CAP_IP4) { + caps |= HN_CAP_IPCS; + params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip4_rxcsum & NDIS_RXCSUM_CAP_IP4) { + if (params.ndis_ip4csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_ip4csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* TCP4 checksum */ + if ((hwcaps.ndis_csum.ndis_ip4_txcsum & HN_NDIS_TXCSUM_CAP_TCP4) == + HN_NDIS_TXCSUM_CAP_TCP4) { + caps |= HN_CAP_TCP4CS; + params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip4_rxcsum & NDIS_RXCSUM_CAP_TCP4) { + if (params.ndis_tcp4csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_tcp4csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* UDP4 checksum */ + if (hwcaps.ndis_csum.ndis_ip4_txcsum & NDIS_TXCSUM_CAP_UDP4) { + caps |= HN_CAP_UDP4CS; + params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip4_rxcsum & NDIS_RXCSUM_CAP_UDP4) { + if (params.ndis_udp4csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_udp4csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* TCP6 checksum */ + if ((hwcaps.ndis_csum.ndis_ip6_txcsum & HN_NDIS_TXCSUM_CAP_TCP6) == + HN_NDIS_TXCSUM_CAP_TCP6) { + caps |= HN_CAP_TCP6CS; + params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip6_rxcsum & NDIS_RXCSUM_CAP_TCP6) { + if (params.ndis_tcp6csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_tcp6csum = NDIS_OFFLOAD_PARAM_RX; + } + + /* UDP6 checksum */ + if ((hwcaps.ndis_csum.ndis_ip6_txcsum & HN_NDIS_TXCSUM_CAP_UDP6) == + HN_NDIS_TXCSUM_CAP_UDP6) { + caps |= HN_CAP_UDP6CS; + params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TX; + } + if (hwcaps.ndis_csum.ndis_ip6_rxcsum & NDIS_RXCSUM_CAP_UDP6) { + if (params.ndis_udp6csum == NDIS_OFFLOAD_PARAM_TX) + params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_TXRX; + else + params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_RX; + } + + if (bootverbose) { + if_printf(sc->hn_ifp, "offload csum: " + "ip4 %u, tcp4 %u, udp4 %u, tcp6 %u, udp6 %u\n", + params.ndis_ip4csum, + params.ndis_tcp4csum, + params.ndis_udp4csum, + params.ndis_tcp6csum, + params.ndis_udp6csum); + if_printf(sc->hn_ifp, "offload lsov2: ip4 %u, ip6 %u\n", + params.ndis_lsov2_ip4, + params.ndis_lsov2_ip6); + } error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); if (error) { @@ -995,8 +1166,92 @@ hn_rndis_halt(struct hn_softc *sc) return (0); } +static int +hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) +{ + struct ndis_offload in; + size_t caps_len, size; + int error; + + memset(&in, 0, sizeof(in)); + in.ndis_hdr.ndis_type = NDIS_OBJTYPE_OFFLOAD; + if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { + in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_3; + size = NDIS_OFFLOAD_SIZE; + } else if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_1) { + in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_2; + size = NDIS_OFFLOAD_SIZE_6_1; + } else { + in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_1; + size = NDIS_OFFLOAD_SIZE_6_0; + } + in.ndis_hdr.ndis_size = size; + + caps_len = NDIS_OFFLOAD_SIZE; + error = hn_rndis_query2(sc, OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES, + &in, size, caps, &caps_len, NDIS_OFFLOAD_SIZE_6_0); + if (error) + return (error); + + /* + * Preliminary verification. + */ + if (caps->ndis_hdr.ndis_type != NDIS_OBJTYPE_OFFLOAD) { + if_printf(sc->hn_ifp, "invalid NDIS objtype 0x%02x\n", + caps->ndis_hdr.ndis_type); + return (EINVAL); + } + if (caps->ndis_hdr.ndis_rev < NDIS_OFFLOAD_REV_1) { + if_printf(sc->hn_ifp, "invalid NDIS objrev 0x%02x\n", + caps->ndis_hdr.ndis_rev); + return (EINVAL); + } + if (caps->ndis_hdr.ndis_size > caps_len) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u, " + "data size %zu\n", caps->ndis_hdr.ndis_size, caps_len); + return (EINVAL); + } else if (caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE_6_0) { + if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", + caps->ndis_hdr.ndis_size); + return (EINVAL); + } + + if (bootverbose) { + /* + * NOTE: + * caps->ndis_hdr.ndis_size MUST be checked before accessing + * NDIS 6.1+ specific fields. + */ + if_printf(sc->hn_ifp, "hwcaps rev %u\n", + caps->ndis_hdr.ndis_rev); + + if_printf(sc->hn_ifp, "hwcaps csum: " + "ip4 tx 0x%x/0x%x rx 0x%x/0x%x, " + "ip6 tx 0x%x/0x%x rx 0x%x/0x%x\n", + caps->ndis_csum.ndis_ip4_txcsum, + caps->ndis_csum.ndis_ip4_txenc, + caps->ndis_csum.ndis_ip4_rxcsum, + caps->ndis_csum.ndis_ip4_rxenc, + caps->ndis_csum.ndis_ip6_txcsum, + caps->ndis_csum.ndis_ip6_txenc, + caps->ndis_csum.ndis_ip6_rxcsum, + caps->ndis_csum.ndis_ip6_rxenc); + if_printf(sc->hn_ifp, "hwcaps lsov2: " + "ip4 maxsz %u minsg %u encap 0x%x, " + "ip6 maxsz %u minsg %u encap 0x%x opts 0x%x\n", + caps->ndis_lsov2.ndis_ip4_maxsz, + caps->ndis_lsov2.ndis_ip4_minsg, + caps->ndis_lsov2.ndis_ip4_encap, + caps->ndis_lsov2.ndis_ip6_maxsz, + caps->ndis_lsov2.ndis_ip6_minsg, + caps->ndis_lsov2.ndis_ip6_encap, + caps->ndis_lsov2.ndis_ip6_opts); + } + return (0); +} + int -hn_rndis_attach(struct hn_softc *sc) +hn_rndis_attach(struct hn_softc *sc, int mtu) { int error; @@ -1011,7 +1266,7 @@ hn_rndis_attach(struct hn_softc *sc) * Configure NDIS offload settings. * XXX no offloading, if error happened? */ - hn_rndis_conf_offload(sc); + hn_rndis_conf_offload(sc, mtu); return (0); } Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 08:23:54 2016 (r307619) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 08:32:24 2016 (r307620) @@ -117,7 +117,7 @@ struct rndis_packet_msg; uint32_t hn_chim_alloc(struct hn_softc *sc); void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx); -int hn_rndis_attach(struct hn_softc *sc); +int hn_rndis_attach(struct hn_softc *sc, int mtu); void hn_rndis_detach(struct hn_softc *sc); int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, Modified: stable/10/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/ndis.h Wed Oct 19 08:23:54 2016 (r307619) +++ stable/10/sys/dev/hyperv/netvsc/ndis.h Wed Oct 19 08:32:24 2016 (r307620) @@ -59,6 +59,7 @@ #define NDIS_OBJTYPE_DEFAULT 0x80 #define NDIS_OBJTYPE_RSS_CAPS 0x88 #define NDIS_OBJTYPE_RSS_PARAMS 0x89 +#define NDIS_OBJTYPE_OFFLOAD 0xa7 struct ndis_object_hdr { uint8_t ndis_type; /* NDIS_OBJTYPE_ */ @@ -205,6 +206,129 @@ struct ndis_rssprm_toeplitz { }; /* + * OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES + * ndis_type: NDIS_OBJTYPE_OFFLOAD + */ + +#define NDIS_OFFLOAD_ENCAP_NONE 0x0000 +#define NDIS_OFFLOAD_ENCAP_NULL 0x0001 +#define NDIS_OFFLOAD_ENCAP_8023 0x0002 +#define NDIS_OFFLOAD_ENCAP_8023PQ 0x0004 +#define NDIS_OFFLOAD_ENCAP_8023PQ_OOB 0x0008 +#define NDIS_OFFLOAD_ENCAP_RFC1483 0x0010 + +struct ndis_csum_offload { + uint32_t ndis_ip4_txenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip4_txcsum; +#define NDIS_TXCSUM_CAP_IP4OPT 0x001 +#define NDIS_TXCSUM_CAP_TCP4OPT 0x004 +#define NDIS_TXCSUM_CAP_TCP4 0x010 +#define NDIS_TXCSUM_CAP_UDP4 0x040 +#define NDIS_TXCSUM_CAP_IP4 0x100 + uint32_t ndis_ip4_rxenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip4_rxcsum; +#define NDIS_RXCSUM_CAP_IP4OPT 0x001 +#define NDIS_RXCSUM_CAP_TCP4OPT 0x004 +#define NDIS_RXCSUM_CAP_TCP4 0x010 +#define NDIS_RXCSUM_CAP_UDP4 0x040 +#define NDIS_RXCSUM_CAP_IP4 0x100 + uint32_t ndis_ip6_txenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip6_txcsum; +#define NDIS_TXCSUM_CAP_IP6EXT 0x001 +#define NDIS_TXCSUM_CAP_TCP6OPT 0x004 +#define NDIS_TXCSUM_CAP_TCP6 0x010 +#define NDIS_TXCSUM_CAP_UDP6 0x040 + uint32_t ndis_ip6_rxenc; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip6_rxcsum; +#define NDIS_RXCSUM_CAP_IP6EXT 0x001 +#define NDIS_RXCSUM_CAP_TCP6OPT 0x004 +#define NDIS_RXCSUM_CAP_TCP6 0x010 +#define NDIS_RXCSUM_CAP_UDP6 0x040 +}; + +struct ndis_lsov1_offload { + uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_maxsize; + uint32_t ndis_minsegs; + uint32_t ndis_opts; +}; + +struct ndis_ipsecv1_offload { + uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ah_esp; + uint32_t ndis_xport_tun; + uint32_t ndis_ip4_opts; + uint32_t ndis_flags; + uint32_t ndis_ip4_ah; + uint32_t ndis_ip4_esp; +}; + +struct ndis_lsov2_offload { + uint32_t ndis_ip4_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip4_maxsz; + uint32_t ndis_ip4_minsg; + uint32_t ndis_ip6_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint32_t ndis_ip6_maxsz; + uint32_t ndis_ip6_minsg; + uint32_t ndis_ip6_opts; +#define NDIS_LSOV2_CAP_IP6EXT 0x001 +#define NDIS_LSOV2_CAP_TCP6OPT 0x004 +}; + +struct ndis_ipsecv2_offload { + uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ + uint16_t ndis_ip6; + uint16_t ndis_ip4opt; + uint16_t ndis_ip6ext; + uint16_t ndis_ah; + uint16_t ndis_esp; + uint16_t ndis_ah_esp; + uint16_t ndis_xport; + uint16_t ndis_tun; + uint16_t ndis_xport_tun; + uint16_t ndis_lso; + uint16_t ndis_extseq; + uint32_t ndis_udp_esp; + uint32_t ndis_auth; + uint32_t ndis_crypto; + uint32_t ndis_sa_caps; +}; + +struct ndis_rsc_offload { + uint16_t ndis_ip4; + uint16_t ndis_ip6; +}; + +struct ndis_encap_offload { + uint32_t ndis_flags; + uint32_t ndis_maxhdr; +}; + +struct ndis_offload { + struct ndis_object_hdr ndis_hdr; + struct ndis_csum_offload ndis_csum; + struct ndis_lsov1_offload ndis_lsov1; + struct ndis_ipsecv1_offload ndis_ipsecv1; + struct ndis_lsov2_offload ndis_lsov2; + uint32_t ndis_flags; + /* NDIS >= 6.1 */ + struct ndis_ipsecv2_offload ndis_ipsecv2; + /* NDIS >= 6.30 */ + struct ndis_rsc_offload ndis_rsc; + struct ndis_encap_offload ndis_encap_gre; +}; + +#define NDIS_OFFLOAD_SIZE sizeof(struct ndis_offload) +#define NDIS_OFFLOAD_SIZE_6_0 \ + __offsetof(struct ndis_offload, ndis_ipsecv2) +#define NDIS_OFFLOAD_SIZE_6_1 \ + __offsetof(struct ndis_offload, ndis_rsc) + +#define NDIS_OFFLOAD_REV_1 1 /* NDIS 6.0 */ +#define NDIS_OFFLOAD_REV_2 2 /* NDIS 6.1 */ +#define NDIS_OFFLOAD_REV_3 3 /* NDIS 6.30 */ + +/* * Per-packet-info */ Modified: stable/10/sys/net/rndis.h ============================================================================== --- stable/10/sys/net/rndis.h Wed Oct 19 08:23:54 2016 (r307619) +++ stable/10/sys/net/rndis.h Wed Oct 19 08:32:24 2016 (r307620) @@ -87,6 +87,7 @@ #define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 #define OID_TCP_OFFLOAD_PARAMETERS 0xFC01020C +#define OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES 0xFC01020D #define RNDIS_MEDIUM_802_3 0x00000000 From owner-svn-src-all@freebsd.org Wed Oct 19 08:40:26 2016 Return-Path: Delivered-To: svn-src-all@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 15246C18CE6; Wed, 19 Oct 2016 08:40:26 +0000 (UTC) (envelope-from sephe@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 E31C02FA; Wed, 19 Oct 2016 08:40:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J8ePmf046150; Wed, 19 Oct 2016 08:40:25 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J8eOrc046144; Wed, 19 Oct 2016 08:40:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190840.u9J8eOrc046144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 08:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307621 - in stable/10/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 08:40:26 -0000 Author: sephe Date: Wed Oct 19 08:40:24 2016 New Revision: 307621 URL: https://svnweb.freebsd.org/changeset/base/307621 Log: MFC 307012,307013,307262 307012 hyperv/vmbus: Allow driver to inject synchronous task into channel taskq. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8208 307013 hyperv/hn: Rework link status support. This is the preamble for network device SR-IOV and NDIS_STATUS_NETWORK_CHANGE handling. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8209 307262 hyperv/hn: Management parts always need suspend and resume. Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/include/vmbus.h stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/vmbus.h ============================================================================== --- stable/10/sys/dev/hyperv/include/vmbus.h Wed Oct 19 08:32:24 2016 (r307620) +++ stable/10/sys/dev/hyperv/include/vmbus.h Wed Oct 19 08:40:24 2016 (r307621) @@ -118,6 +118,7 @@ struct vmbus_chan_br { struct vmbus_channel; struct hyperv_guid; +struct task; typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *); @@ -135,6 +136,8 @@ int vmbus_chan_open_br(struct vmbus_cha int udlen, vmbus_chan_callback_t cb, void *cbarg); void vmbus_chan_close(struct vmbus_channel *chan); void vmbus_chan_intr_drain(struct vmbus_channel *chan); +void vmbus_chan_run_task(struct vmbus_channel *chan, + struct task *task); int vmbus_chan_gpadl_connect(struct vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl); Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 08:32:24 2016 (r307620) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h Wed Oct 19 08:40:24 2016 (r307621) @@ -234,6 +234,10 @@ struct hn_softc { struct vmbus_xact_ctx *hn_xact; uint32_t hn_nvs_ver; + struct taskqueue *hn_mgmt_taskq; + struct taskqueue *hn_mgmt_taskq0; + struct task hn_link_task; + uint32_t hn_caps; /* HN_CAP_ */ uint32_t hn_flags; /* HN_FLAG_ */ void *hn_rxbuf; @@ -272,7 +276,6 @@ struct hn_softc { */ struct hn_send_ctx; -void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 08:32:24 2016 (r307620) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Oct 19 08:40:24 2016 (r307621) @@ -336,6 +336,8 @@ static void hn_fixup_tx_data(struct hn_s static void hn_destroy_tx_data(struct hn_softc *); static void hn_start_taskfunc(void *, int); static void hn_start_txeof_taskfunc(void *, int); +static void hn_link_taskfunc(void *, int); +static void hn_suspend_mgmt_taskfunc(void *, int); static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); static int hn_create_rx_data(struct hn_softc *sc, int); static void hn_destroy_rx_data(struct hn_softc *sc); @@ -351,7 +353,11 @@ static int hn_synth_attach(struct hn_sof static void hn_synth_detach(struct hn_softc *); static bool hn_tx_ring_pending(struct hn_tx_ring *); static void hn_suspend(struct hn_softc *); +static void hn_suspend_data(struct hn_softc *); +static void hn_suspend_mgmt(struct hn_softc *); static void hn_resume(struct hn_softc *); +static void hn_resume_data(struct hn_softc *); +static void hn_resume_mgmt(struct hn_softc *); static void hn_rx_drain(struct vmbus_channel *); static void hn_tx_resume(struct hn_softc *, int); static void hn_tx_ring_qflush(struct hn_tx_ring *); @@ -533,7 +539,6 @@ netvsc_attach(device_t dev) struct sysctl_oid_list *child; struct sysctl_ctx_list *ctx; uint8_t eaddr[ETHER_ADDR_LEN]; - uint32_t link_status; struct ifnet *ifp = NULL; int error, ring_cnt, tx_ring_cnt; @@ -567,6 +572,15 @@ netvsc_attach(device_t dev) } /* + * Setup taskqueue for mangement tasks, e.g. link status. + */ + sc->hn_mgmt_taskq0 = taskqueue_create("hn_mgmt", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_mgmt_taskq0); + taskqueue_start_threads(&sc->hn_mgmt_taskq0, 1, PI_NET, "%s mgmt", + device_get_nameunit(dev)); + TASK_INIT(&sc->hn_link_task, 0, hn_link_taskfunc, sc); + + /* * Allocate ifnet and setup its name earlier, so that if_printf * can be used by functions, which will be called after * ether_ifattach(). @@ -637,12 +651,6 @@ netvsc_attach(device_t dev) if (error) goto failed; - error = hn_rndis_get_linkstatus(sc, &link_status); - if (error) - goto failed; - if (link_status == NDIS_MEDIA_STATE_CONNECTED) - sc->hn_carrier = 1; - error = hn_rndis_get_eaddr(sc, eaddr); if (error) goto failed; @@ -752,6 +760,12 @@ netvsc_attach(device_t dev) /* Inform the upper layer about the long frame support. */ ifp->if_hdrlen = sizeof(struct ether_vlan_header); + /* + * Kick off link status check. + */ + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + hn_link_status_update(sc); + return (0); failed: if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) @@ -771,6 +785,12 @@ netvsc_detach(device_t dev) if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) hn_stop(sc); + /* + * NOTE: + * hn_stop() only suspends data, so managment + * stuffs have to be suspended manually here. + */ + hn_suspend_mgmt(sc); hn_synth_detach(sc); } HN_UNLOCK(sc); @@ -783,6 +803,7 @@ netvsc_detach(device_t dev) if (sc->hn_tx_taskq != hn_tx_taskq) taskqueue_free(sc->hn_tx_taskq); + taskqueue_free(sc->hn_mgmt_taskq0); if (sc->hn_xact != NULL) vmbus_xact_ctx_destroy(sc->hn_xact); @@ -802,6 +823,36 @@ netvsc_shutdown(device_t dev) return (0); } +static void +hn_link_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + struct ifnet *ifp = sc->hn_ifp; + uint32_t link_status; + int error; + + error = hn_rndis_get_linkstatus(sc, &link_status); + if (error) { + /* XXX what to do? */ + return; + } + + if (link_status == NDIS_MEDIA_STATE_CONNECTED) + sc->hn_carrier = 1; + else + sc->hn_carrier = 0; + if_link_state_change(ifp, + sc->hn_carrier ? LINK_STATE_UP : LINK_STATE_DOWN); +} + +void +hn_link_status_update(struct hn_softc *sc) +{ + + if (sc->hn_mgmt_taskq != NULL) + taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_link_task); +} + static __inline int hn_txdesc_dmamap_load(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head, bus_dma_segment_t *segs, int *nsegs) @@ -1333,19 +1384,6 @@ hn_start_locked(struct hn_tx_ring *txr, } /* - * Link up/down notification - */ -void -netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status) -{ - if (status == 1) { - sc->hn_carrier = 1; - } else { - sc->hn_carrier = 0; - } -} - -/* * Append the specified data to the indicated mbuf chain, * Extend the mbuf chain if the new data does not fit in * existing space. @@ -1673,8 +1711,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); #endif - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - hn_suspend(sc); + /* + * Suspend this interface before the synthetic parts + * are ripped. + */ + hn_suspend(sc); /* * Detach the synthetics parts, i.e. NVS and RNDIS. @@ -1692,9 +1733,10 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, hn_set_chim_size(sc, sc->hn_chim_szmax); hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu); - /* All done! Resume now. */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - hn_resume(sc); + /* + * All done! Resume the interface now. + */ + hn_resume(sc); HN_UNLOCK(sc); break; @@ -1821,9 +1863,9 @@ hn_stop(struct hn_softc *sc) KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, ("synthetic parts were not attached")); - /* Clear RUNNING bit _before_ hn_suspend() */ + /* Clear RUNNING bit _before_ hn_suspend_data() */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); - hn_suspend(sc); + hn_suspend_data(sc); /* Clear OACTIVE bit. */ atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE); @@ -1916,9 +1958,6 @@ hn_init_locked(struct hn_softc *sc) /* Everything is ready; unleash! */ atomic_set_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); - - /* TODO: check RNDIS link status. */ - if_link_state_change(ifp, LINK_STATE_UP); } static void @@ -3620,7 +3659,7 @@ hn_rx_drain(struct vmbus_channel *chan) } static void -hn_suspend(struct hn_softc *sc) +hn_suspend_data(struct hn_softc *sc) { struct vmbus_channel **subch = NULL; int i, nsubch; @@ -3674,6 +3713,42 @@ hn_suspend(struct hn_softc *sc) } static void +hn_suspend_mgmt_taskfunc(void *xsc, int pending __unused) +{ + + ((struct hn_softc *)xsc)->hn_mgmt_taskq = NULL; +} + +static void +hn_suspend_mgmt(struct hn_softc *sc) +{ + struct task task; + + HN_LOCK_ASSERT(sc); + + /* + * Make sure that hn_mgmt_taskq0 can nolonger be accessed + * through hn_mgmt_taskq. + */ + TASK_INIT(&task, 0, hn_suspend_mgmt_taskfunc, sc); + vmbus_chan_run_task(sc->hn_prichan, &task); + + /* + * Make sure that all pending management tasks are completed. + */ + taskqueue_drain_all(sc->hn_mgmt_taskq0); +} + +static void +hn_suspend(struct hn_softc *sc) +{ + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_suspend_data(sc); + hn_suspend_mgmt(sc); +} + +static void hn_tx_resume(struct hn_softc *sc, int tx_ring_cnt) { int i; @@ -3691,7 +3766,7 @@ hn_tx_resume(struct hn_softc *sc, int tx } static void -hn_resume(struct hn_softc *sc) +hn_resume_data(struct hn_softc *sc) { int i; @@ -3705,7 +3780,8 @@ hn_resume(struct hn_softc *sc) /* * Make sure to clear suspend status on "all" TX rings, - * since hn_tx_ring_inuse can be changed after hn_suspend(). + * since hn_tx_ring_inuse can be changed after + * hn_suspend_data(). */ hn_tx_resume(sc, sc->hn_tx_ring_cnt); @@ -3733,6 +3809,26 @@ hn_resume(struct hn_softc *sc) } static void +hn_resume_mgmt(struct hn_softc *sc) +{ + + /* + * Kick off link status check. + */ + sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; + hn_link_status_update(sc); +} + +static void +hn_resume(struct hn_softc *sc) +{ + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + hn_resume_data(sc); + hn_resume_mgmt(sc); +} + +static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) { const struct hn_nvs_hdr *hdr; Modified: stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 08:32:24 2016 (r307620) +++ stable/10/sys/dev/hyperv/netvsc/hv_rndis_filter.c Wed Oct 19 08:40:24 2016 (r307621) @@ -168,11 +168,8 @@ hv_rf_receive_indicate_status(struct hn_ switch (msg->rm_status) { case RNDIS_STATUS_MEDIA_CONNECT: - netvsc_linkstatus_callback(sc, 1); - break; - case RNDIS_STATUS_MEDIA_DISCONNECT: - netvsc_linkstatus_callback(sc, 0); + hn_link_status_update(sc); break; case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 08:32:24 2016 (r307620) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Wed Oct 19 08:40:24 2016 (r307621) @@ -138,6 +138,7 @@ void hn_nvs_sent_xact(struct hn_send_ct int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_recvinfo *info); void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); +void hn_link_status_update(struct hn_softc *sc); extern struct hn_send_ctx hn_send_ctx_none; Modified: stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 08:32:24 2016 (r307620) +++ stable/10/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 08:40:24 2016 (r307621) @@ -1713,3 +1713,11 @@ vmbus_chan_rx_empty(const struct vmbus_c return (vmbus_rxbr_empty(&chan->ch_rxbr)); } + +void +vmbus_chan_run_task(struct vmbus_channel *chan, struct task *task) +{ + + taskqueue_enqueue(chan->ch_tq, task); + taskqueue_drain(chan->ch_tq, task); +} From owner-svn-src-all@freebsd.org Wed Oct 19 08:43:21 2016 Return-Path: Delivered-To: svn-src-all@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 9C3ADC18E21; Wed, 19 Oct 2016 08:43:21 +0000 (UTC) (envelope-from sephe@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 62DCF927; Wed, 19 Oct 2016 08:43:21 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J8hKrN049580; Wed, 19 Oct 2016 08:43:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J8hKw2049579; Wed, 19 Oct 2016 08:43:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190843.u9J8hKw2049579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 08:43:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307622 - stable/10/sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 08:43:21 -0000 Author: sephe Date: Wed Oct 19 08:43:20 2016 New Revision: 307622 URL: https://svnweb.freebsd.org/changeset/base/307622 Log: MFC 307078 ifnet: Use if_link_state snapshot to invoke ifnet_link_event So that everyone in this task have consistent view of link state. Reviewed by: ae Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8214 Modified: stable/10/sys/net/if.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Wed Oct 19 08:40:24 2016 (r307621) +++ stable/10/sys/net/if.c Wed Oct 19 08:43:20 2016 (r307622) @@ -2171,7 +2171,7 @@ do_link_state_change(void *arg, int pend if (log_link_state_change) log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname, (link_state == LINK_STATE_UP) ? "UP" : "DOWN" ); - EVENTHANDLER_INVOKE(ifnet_link_event, ifp, ifp->if_link_state); + EVENTHANDLER_INVOKE(ifnet_link_event, ifp, link_state); CURVNET_RESTORE(); } From owner-svn-src-all@freebsd.org Wed Oct 19 08:45:20 2016 Return-Path: Delivered-To: svn-src-all@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 8FBA5C18E8C; Wed, 19 Oct 2016 08:45:20 +0000 (UTC) (envelope-from sephe@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 61057AA4; Wed, 19 Oct 2016 08:45:20 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J8jJ9A049725; Wed, 19 Oct 2016 08:45:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J8jJnl049724; Wed, 19 Oct 2016 08:45:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190845.u9J8jJnl049724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 08:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307623 - stable/10/sys/dev/hyperv/storvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 08:45:20 -0000 Author: sephe Date: Wed Oct 19 08:45:19 2016 New Revision: 307623 URL: https://svnweb.freebsd.org/changeset/base/307623 Log: MFC 307261 hyperv/stor: Fix off-by-one bug; this brings back TRIM support. Submitted by: Hongjiang Zhang Reported by: Lili Deng Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8238 Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Oct 19 08:43:20 2016 (r307622) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Oct 19 08:45:19 2016 (r307623) @@ -2210,7 +2210,7 @@ storvsc_io_done(struct hv_storvsc_reques resp_buf[3], resp_buf[4]); } if (vm_srb->srb_status == SRB_STATUS_SUCCESS && - data_len > SHORT_INQUIRY_LENGTH) { + data_len >= SHORT_INQUIRY_LENGTH) { char vendor[16]; cam_strvis(vendor, inq_data->vendor, From owner-svn-src-all@freebsd.org Wed Oct 19 09:12:15 2016 Return-Path: Delivered-To: svn-src-all@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 D73F6C18C1A; Wed, 19 Oct 2016 09:12:15 +0000 (UTC) (envelope-from sephe@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 A90E0DB; Wed, 19 Oct 2016 09:12:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9J9CEqh060305; Wed, 19 Oct 2016 09:12:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9J9CEGS060303; Wed, 19 Oct 2016 09:12:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610190912.u9J9CEGS060303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 19 Oct 2016 09:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307624 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 09:12:15 -0000 Author: sephe Date: Wed Oct 19 09:12:14 2016 New Revision: 307624 URL: https://svnweb.freebsd.org/changeset/base/307624 Log: hyperv/vmbus: Expose channel management taskqueue for driver to use. MFC after: 3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Wed Oct 19 08:45:19 2016 (r307623) +++ head/sys/dev/hyperv/include/vmbus.h Wed Oct 19 09:12:14 2016 (r307624) @@ -118,6 +118,7 @@ struct vmbus_chan_br { struct vmbus_channel; struct hyperv_guid; struct task; +struct taskqueue; typedef void (*vmbus_chan_callback_t)(struct vmbus_channel *, void *); @@ -179,5 +180,7 @@ int vmbus_chan_prplist_nelem(int br_siz int dlen_max); bool vmbus_chan_rx_empty(const struct vmbus_channel *chan); bool vmbus_chan_tx_empty(const struct vmbus_channel *chan); +struct taskqueue * + vmbus_chan_mgmt_tq(const struct vmbus_channel *chan); #endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 08:45:19 2016 (r307623) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Oct 19 09:12:14 2016 (r307624) @@ -1721,3 +1721,10 @@ vmbus_chan_run_task(struct vmbus_channel taskqueue_enqueue(chan->ch_tq, task); taskqueue_drain(chan->ch_tq, task); } + +struct taskqueue * +vmbus_chan_mgmt_tq(const struct vmbus_channel *chan) +{ + + return (chan->ch_mgmt_tq); +} From owner-svn-src-all@freebsd.org Wed Oct 19 10:01:06 2016 Return-Path: Delivered-To: svn-src-all@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 29980C15EAA; Wed, 19 Oct 2016 10:01:06 +0000 (UTC) (envelope-from br@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 EB35615A; Wed, 19 Oct 2016 10:01:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JA15YY078366; Wed, 19 Oct 2016 10:01:05 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JA14uU078362; Wed, 19 Oct 2016 10:01:04 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610191001.u9JA14uU078362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 19 Oct 2016 10:01:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307625 - head/tests/sys/geom/class/uzip X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 10:01:06 -0000 Author: br Date: Wed Oct 19 10:01:04 2016 New Revision: 307625 URL: https://svnweb.freebsd.org/changeset/base/307625 Log: Add big-endian uzip file system and choose right file system to proceed tests with. Reviewed by: jmmv, ngie Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D8073 Added: head/tests/sys/geom/class/uzip/1_endian_big.img.uzip.uue (contents, props changed) head/tests/sys/geom/class/uzip/1_endian_little.img.uzip.uue (contents, props changed) Deleted: head/tests/sys/geom/class/uzip/test-1.img.uzip.uue Modified: head/tests/sys/geom/class/uzip/1_test.sh head/tests/sys/geom/class/uzip/Makefile Added: head/tests/sys/geom/class/uzip/1_endian_big.img.uzip.uue ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/uzip/1_endian_big.img.uzip.uue Wed Oct 19 10:01:04 2016 (r307625) @@ -0,0 +1,87 @@ +# +# $FreeBSD$ +# + +begin 644 1_endian_big.img.uzip +M(R$O8FEN+W-H"B-6,BXP($9OFEP?'QK +M;&1L;V%D(&=E;VU?=7II<"D^)BTF)FUO=6YT7V-D.38V,"`O9&5V+V!M9&-O +M;F9I9R`M868@)#!@+G5Z:7`@)#$*97AI="`D/PH``````````````$`````` +M0`````````*0`````````I`````````"D`````````*0`````````I`````` +M```#;P````````-O````````!#$````````$,0````````2H````````!*@` +M```````&T@````````B4````````",4````````(Q0````````NZ```````` +M"[H````````,@0````````R!````````#($````````,@0````````R!```` +M````#($````````,@0````````R!````````#($````````,@0````````R! +M````````#($````````,@0````````R!````````#($````````,@0`````` +M``R!````````#($````````,@0````````R!````````#($````````,@0`` +M``````R!````````#($````````,@0````````R!````````#($````````, +M@0````````R!````````#($````````,@0````````R!````````#($````` +M```,@0````````R!````````#($````````,@0````````R!````````#($` +M```````,@0````````R!````````#($````````,@0````````R!```````` +M#($````````,@0````````R!````````#*UXVNW4/0Z",!3`\3:B,FA@A,W1 +MN,C@`3R$":?0R<'!Q.H)3+R0DZOQ(L3%N1:H:``3'=#E_TM>WX.TI7P4(0J! +MB8&)H8E(U)-"*)/\M'9M9+16)JYIZ9GHF7!LOU8>_LLT6:WJ+A`GVU/G,IH\ +M^_EOEI*.EW4K5./Y8BF`!AW3YK!W\JP>Q]5/M+Q]F.SI^L&A3,9LE,````` +M``````````````````````#PC3L712#(>-KMU#T*PD`0AN$)_FTA)*7I+,4J +MA0?P$()7L=+UKTEQMTT]]JD'K,_[P_`T7]SF%4^.$M=GJ1-Z +M`?Z"[[9/P_WD.-UV*:UNK8Y>V2;VZ,.&1ZO59U]@V5Z^3/]ELK$OY]T@A.;V +MSFH>4HO*55;2`P```````````````````````````'C'%6?Y%ZQXVNW.L0W" +M,!"&40A?'7CLTVGM*Z+?5J6>=WXN>K3-3W2+=W3+IUKC?:&UN;G]/T:9DSNFLX` +M``````````````````#@;WP`XC\HZGC:Y=MY*`11'`?PL>[<-AN28\D5Y:I= +M(6W:+<+F_H-"RLZ?8TV;&?F%;IF_Q*5\TJ;\4<,[[E=_91Y!XUZWRJ*L +M<$K35O_P<,OY"]L)!?G+E`S?C/_B1Y%*ICI1/<]L'Z-X7X$MCOE"'NZ_Y%?\ +MZ0[OY[GW0C^\?6)YG(_K:2/%-DO\V4S2"R +MO\/\7!_9?U1<3V6VEVG2#[!;OQ5&1_(N9#^;EXS,)Z+NI'7(_HMID039K[RW,(_L]Y+< +M'R+[&Q.VKI#]Z3-NT.L?NI1>"SW_N7[5R'[.,C\$V<\=K[%#]AM'%A@@^V-3 +M3M.1_;D<6SKT^F\V"WK_V\+1-1S9+^S7O$7VVY.COLC^B#D&]/^/`=D;P\C^ +MX++F*F1_4\8Z]/-KEVETK@V$8 +M!_!E88@LG]"&FQ"]K.>-")D_X+/58OL%Z<.C2#[OYY)`MF_&]+F(ON9L3W0]]^H +M?HE']MN,!CJRGU]^487L3UP[IB'[3Z/9M\A^1_*;'=E?[XUV(OMK.`-"9'^: +M2O&*[%^G;EY"Y_^5&GK^HW]86Y#]#7WN'62_/Y!Q@NR_OF'HD/WV$I*![-_8 +M]YC^_][H\2#[+"[O_DMP5Z_U7ML[F1_33=L`#9S\YI +M2T+V?W8'>,C^>\%D,[*_B`P_(/MMH?PPLM\M<\XC^\<.%,A\"FM+/([L=R0P +MOS7!#@6 +M9+_><`C]_F-4RJ'K'Z&_@_[_W-M^#KW_JSO3SB+[4\3T?F1_ZVK,"K(_(E$Z +MH><_JBL$7?]DI5/(_J/':>C^/Q/A%B/[V:I1_G\Z[R\+%8'F>-KMPS$-`"`0 +M`+%#`#MB$<^K8&J35JLZ\\X=````````````````````\-T#NY8`HWC:[91+ +M;]0P$,=WRR(J"PFNE3C,TDJ`M%T!%Q`E%2"$Q/,P/VGC9.P9C_\SWL%@L#0X/QI.!XFEP:71TK3[ +M.#.X.#H[]14_Z.9&PX_+3`2N;34-AV%`$,0/>?O5]_#X9?F?I#/\QK+2CZ_[ +M\=S/A-G]].[]5P$_]./U/WN`^U\>?YD1_@[[RKU=/GMTU)G?]..%H^\YK[.YM/7S"V+1KE89,[ +M9[5F5PMG# +MB3ML0VLPRO@6&HR=)C+K;!F])VRCCVFL$>!XD!YL'4J'KE/&+L]$PWNG)SS+ +MA&OL8G\"I@5OJS'#=&&/-QX7X$$R%3#WN':AOQ@7/"SDF)T.5&=[=8:K7=Z= +MRWT\+A7#KR1 +MZEC+Y(]ZX"RF[*.Q+@KEY?%NE%TD?O*>$NI% +MRS3/<6-1!?"56NP+MXXB+_;'46$MBA"WR`7O"Y-25\'CZ7@>ER3/DNO:',B8 +M>(:^L4V2+I+[)`?V)^\[\$2'>VPS%B38V#O<&9^:*!/<1!4SVX[9#M:?9WNQ +M_CEOQWB1M+96=B]HN!(S6$CK0I0C5AZ[8<^VT]]R4>[^RD6A?T:"(`B"(`B" +M(`B"(`B"(`B"(`B"(`B"(`B"(`B"(`B"^/_X#/X6=T5XVNW7+0H"01B`X=EQ +M004Q>@3!,B`8A$V#;#$+1@4/(=C4H,VD[@FT>`9ABPB;-GD$,6@0L_B#)L$@ +MIOW>)\Q/?&>FC%(JI7*N8]23=BZN-J\-DL\>[_?_0;\7FZOE5G+_ +M-:^'DOO]TF@FN7]=LT7)_8U@UY'-KMT#$!```,`B"C&]T*>_9!!!(```````````````````!X405W +M`]:``($````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +=```````````````````````````````````````` +` +end Added: head/tests/sys/geom/class/uzip/1_endian_little.img.uzip.uue ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/uzip/1_endian_little.img.uzip.uue Wed Oct 19 10:01:04 2016 (r307625) @@ -0,0 +1,110 @@ +# +# $FreeBSD$ +# + +begin 644 1_endian_little.img.uzip +M(R$O8FEN+W-H"B-6,BXP($9OFEP?'QK +M;&1L;V%D(&=E;VU?=7II<"D^)BTF)FUO=6YT7V-D.38V,"`O9&5V+V!M9&-O +M;F9I9R`M868@)#!@+G5Z:7`@)#$*97AI="`D/PH``````````````$`````` +M0`````````*0`````````W<````````$G@````````>&````````!ZT````` +M```'U`````````?[````````""(````````(20````````AP````````")<` +M```````(O@````````CE````````"0P````````),P````````E:```````` +M"8$````````)J`````````G/````````"?8````````*'0````````I$```` +M````"FL````````*D@````````JY````````"N`````````+!P````````LN +M````````"U4````````+?`````````NC````````"\H````````+\0`````` +M``P8````````##\````````,9@````````R-````````#+0````````,VP`` +M``````T"````````#2D````````-4`````````UW````````#9X````````- +MQ0````````WL````````#A,````````..@````````YA````````#H@````` +M```.KP````````[6````````#OT````````/)`````````]+````````#W(` +M```````/F0````````_`````````#^<````````0#@```````!`U```````` +M$%P````````0@P```````!"J````````$-9XVNW4L0K",!"`X8LM$@1!!T$G +M.[JZ.W3Q#1Q\`P??H(LZ^T@^B*L/(L1+>L6L#E:0_X-KKTU"C[8Y$0`````` +M````````\"\F&G.-2F-E]X*ZK8=[*47NA8@3FZ#77MJ(-O'P"$&>(8PU'75C +M>M!E[3J?/4SS6D^#[-I9&I]WV%Z/J8;2HEMO\V+4-A[SQFI(4YV<^9KHS?3B +MTJ\]LW.NRO+RQW5:+=T^:_*]^T%YJ1]D"V)?D*QG?%5M^[YGWMY3[%?AY)S7 +M(L+2>F3QGN>R]QOM%H[]`0``````````@%Z]`'B8&[EXVNW9,4H#013&\?>2 +M1=:`J(6@E2G3"I86VW@#A=Q`P1ND,:ESD13!TB9-;F'K$3R`,+ZW^U8'42$$ +M-\W_!]_N;':&?0R9:4:D<60YM0PMH_@MF=7%WE@*D9>^B$ITL.=2FK@KO[RF +M).\I'5AST+ZSBPUKQK6=HUW9K9<]:S3]>W?7\X>ZAB+2CH]^GBK>>WL2-=1= +M5:8"=.5XIO5?^R3NN6'6+G9<9]32KK-)OG8W**_>#[(!OB](MF?\JRK6?-KMFL]/%#$4QQ3'Q3_"UL[`<](07X7V2V7;:OA_]OLY< +M9GN]V\W/T9VN,VV^;]Q[%]M?W[X<76U7KQ-DX=)];^U!=UWP^=-<:A?GN_NO +MBW^.OW;-^/-_B4\0!$$0!$$0!$$0!$$0!$$0!$$0!$'<#.+7YX]X/>_-OA$3 +M!'$[B/]+N=^;GQO.^G>&>',7^S_F%I@(7-MJ&,X#:440-XUEM@PK.TZ(\<'V +M"EMF;'[2_]>8]8WNB41ZVN'-6:_:H<-;`H72V+B4$*6#/VA-5E>NO +M-/<>>)7#D>0!1EI-!.S8&@<.I7!B`!M/GSQ>9>S#8<,]9$YIK%^!&,A4P +M][AVHB\')SQ,9)]==51GQW6&JUW>[7DQEZ)$LT': +MR%6M&BP6B%:@L`44FAN,LH6_@/Z+0JN8]Y5#$FI="JQ5\A6SR6J'-P\\5D_)305+=,\Q\"B"N`K-3D1;AU%GISTH\):%"&& +MR`6?%B:EKH+'W?$\+DF6)=>U.94Q\0QMXS%)NDCNDQQX/OGT!,YT>,&V8D&" +MC6>'.^/3(-KMP3$!```` +MPJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT, +M'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````` +M``````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````` +M``````"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"` +MMP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````! +M>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$! +M````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U +M3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`` +M``````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````` +M``````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````````` +M``"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%` +M```!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KM +MP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!```` +MPJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT, +M'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````` +M``````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````` +M``````"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"` +MMP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````! +M>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$! +M````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U +M3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`` +M``````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````` +M``````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````````` +M``"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%` +M```!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KM +MP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!```` +MPJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT, +M'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````` +M``````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````` +M``````"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"` +MMP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````! +M>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$! +M````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U +M3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`` +M``````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````` +M``````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````````` +M``"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%` +M```!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KM +MP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!```` +MPJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT, +M'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````` +M``````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````` +M``````"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"` +MMP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````! +M>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$! +M````PJ#U3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U +M3VT,'Z````````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`` +M``````````````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````` +M``````````"`MP%````!>-KMP3$!````PJ#U3VT,'Z`````````````````` +M``"`MP%````!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%` +M```!>-KMP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KM +MP3$!````PJ#U3VT,'Z````````````````````"`MP%````!>-KMT#$!```, +M`B"C&]T*>_9!!!(```````````````````!X405W`]:``($````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +2```````````````````````` +` +end Modified: head/tests/sys/geom/class/uzip/1_test.sh ============================================================================== --- head/tests/sys/geom/class/uzip/1_test.sh Wed Oct 19 09:12:14 2016 (r307624) +++ head/tests/sys/geom/class/uzip/1_test.sh Wed Oct 19 10:01:04 2016 (r307625) @@ -4,9 +4,21 @@ testsdir=$(dirname $0) . $testsdir/conf.sh +# Check host endianness +ret=$(echo I | tr -d "[:space:]" | od -to2 | head -n1 | awk '{print $2}' | cut -c6) +if [ "$ret" = "1" ]; then + # Little endian + UUE=$testsdir/1_endian_little.img.uzip.uue +elif [ "$ret" = "0" ]; then + # Big endian + UUE=$testsdir/1_endian_big.img.uzip.uue +else + echo "Couldn't detect host endianness" + exit 2 +fi + echo "1..1" -UUE=$testsdir/1.img.uzip.uue uudecode $UUE us0=$(attach_md -f $(basename $UUE .uue)) || exit 1 sleep 1 Modified: head/tests/sys/geom/class/uzip/Makefile ============================================================================== --- head/tests/sys/geom/class/uzip/Makefile Wed Oct 19 09:12:14 2016 (r307624) +++ head/tests/sys/geom/class/uzip/Makefile Wed Oct 19 10:01:04 2016 (r307625) @@ -8,7 +8,7 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -IMAGE= 1.img +IMAGE= 1_endian_little.img ZIMAGE= ${IMAGE}.uzip UZIMAGE= ${ZIMAGE}.uue @@ -25,7 +25,7 @@ ${UZIMAGE}: ${IMAGE} ${ZIMAGE} printf "FreeBSD$$\n#\n\n" >> ${.TARGET} uuencode ${ZIMAGE} ${ZIMAGE} >>${.TARGET} -${PACKAGE}FILES+= conf.sh \ +${PACKAGE}FILES+= conf.sh 1_endian_big.img.uzip.uue \ ${UZIMAGE} FILESGROUPS+= etalon From owner-svn-src-all@freebsd.org Wed Oct 19 11:09:31 2016 Return-Path: Delivered-To: svn-src-all@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 11E8AC18457; Wed, 19 Oct 2016 11:09:31 +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 C82C2BF2; Wed, 19 Oct 2016 11:09:30 +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 u9JB9Tmi002728; Wed, 19 Oct 2016 11:09:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JB9TTC002727; Wed, 19 Oct 2016 11:09:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610191109.u9JB9TTC002727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 19 Oct 2016 11:09:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307626 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 11:09:31 -0000 Author: kib Date: Wed Oct 19 11:09:29 2016 New Revision: 307626 URL: https://svnweb.freebsd.org/changeset/base/307626 Log: Add FFS pager, which uses buffer cache read operation to validate pages. See the comments for more detailed description of the algorithm. The pager is used unconditionally when the block size of the underlying device is larger than the machine page size, since local vnode pager cannot handle the configuration [1]. Otherwise, the vfs.ffs.use_buf_pager sysctl allows to switch to the local pager. Measurements demonstrated no regression in the ever-important buildworld benchmark, and small (~5%) throughput improvements in the special microbenchmark configuration for dbench over swap-backed md(4). Code can be generalized and reused for other filesystems which use buffer cache. Reported by: Anton Yuzhaninov [1] Tested by: pho Benchmarked by: mjg, pho Reviewed by: alc, markj, mckusick (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D8198 Modified: head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Wed Oct 19 10:01:04 2016 (r307625) +++ head/sys/ufs/ffs/ffs_vnops.c Wed Oct 19 11:09:29 2016 (r307626) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -86,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -102,8 +104,9 @@ __FBSDID("$FreeBSD$"); #ifdef DIRECTIO extern int ffs_rawread(struct vnode *vp, struct uio *uio, int *workdone); #endif -static vop_fsync_t ffs_fsync; static vop_fdatasync_t ffs_fdatasync; +static vop_fsync_t ffs_fsync; +static vop_getpages_t ffs_getpages; static vop_lock1_t ffs_lock; static vop_read_t ffs_read; static vop_write_t ffs_write; @@ -119,13 +122,12 @@ static vop_openextattr_t ffs_openextattr static vop_setextattr_t ffs_setextattr; static vop_vptofh_t ffs_vptofh; - /* Global vfs data structures for ufs. */ struct vop_vector ffs_vnodeops1 = { .vop_default = &ufs_vnodeops, .vop_fsync = ffs_fsync, .vop_fdatasync = ffs_fdatasync, - .vop_getpages = vnode_pager_local_getpages, + .vop_getpages = ffs_getpages, .vop_getpages_async = vnode_pager_local_getpages_async, .vop_lock1 = ffs_lock, .vop_read = ffs_read, @@ -147,7 +149,7 @@ struct vop_vector ffs_vnodeops2 = { .vop_default = &ufs_vnodeops, .vop_fsync = ffs_fsync, .vop_fdatasync = ffs_fdatasync, - .vop_getpages = vnode_pager_local_getpages, + .vop_getpages = ffs_getpages, .vop_getpages_async = vnode_pager_local_getpages_async, .vop_lock1 = ffs_lock, .vop_read = ffs_read, @@ -1784,3 +1786,165 @@ vop_vptofh { ufhp->ufid_gen = ip->i_gen; return (0); } + +SYSCTL_DECL(_vfs_ffs); +static int use_buf_pager = 1; +SYSCTL_INT(_vfs_ffs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, &use_buf_pager, 0, + "Always use buffer pager instead of bmap"); +static int buf_pager_relbuf; +SYSCTL_INT(_vfs_ffs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, + &buf_pager_relbuf, 0, + "Make buffer pager release buffers after reading"); + +/* + * The FFS pager. It uses buffer reads to validate pages. + * + * In contrast to the generic local pager from vm/vnode_pager.c, this + * pager correctly and easily handles volumes where the underlying + * device block size is greater than the machine page size. The + * buffer cache transparently extends the requested page run to be + * aligned at the block boundary, and does the necessary bogus page + * replacements in the addends to avoid obliterating already valid + * pages. + * + * The only non-trivial issue is that the exclusive busy state for + * pages, which is assumed by the vm_pager_getpages() interface, is + * incompatible with the VMIO buffer cache's desire to share-busy the + * pages. This function performs a trivial downgrade of the pages' + * state before reading buffers, and a less trivial upgrade from the + * shared-busy to excl-busy state after the read. + */ +static int +ffs_getpages(struct vop_getpages_args *ap) +{ + struct vnode *vp; + vm_page_t *ma, m; + vm_object_t object; + struct buf *bp; + struct ufsmount *um; + ufs_lbn_t lbn, lbnp; + vm_ooffset_t la, lb; + long bsize; + int bo_bs, count, error, i; + bool redo, lpart; + + vp = ap->a_vp; + ma = ap->a_m; + count = ap->a_count; + + um = VFSTOUFS(ap->a_vp->v_mount); + bo_bs = um->um_devvp->v_bufobj.bo_bsize; + if (!use_buf_pager && bo_bs <= PAGE_SIZE) + return (vnode_pager_generic_getpages(vp, ma, count, + ap->a_rbehind, ap->a_rahead, NULL, NULL)); + + object = vp->v_object; + la = IDX_TO_OFF(ma[count - 1]->pindex); + if (la >= object->un_pager.vnp.vnp_size) + return (VM_PAGER_BAD); + lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size; + if (ap->a_rbehind != NULL) { + lb = IDX_TO_OFF(ma[0]->pindex); + *ap->a_rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); + } + if (ap->a_rahead != NULL) { + *ap->a_rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la); + if (la + IDX_TO_OFF(*ap->a_rahead) >= + object->un_pager.vnp.vnp_size) { + *ap->a_rahead = OFF_TO_IDX(roundup2(object->un_pager. + vnp.vnp_size, PAGE_SIZE) - la); + } + } + VM_OBJECT_WLOCK(object); +again: + for (i = 0; i < count; i++) + vm_page_busy_downgrade(ma[i]); + VM_OBJECT_WUNLOCK(object); + + lbnp = -1; + for (i = 0; i < count; i++) { + m = ma[i]; + + /* + * Pages are shared busy and the object lock is not + * owned, which together allow for the pages' + * invalidation. The racy test for validity avoids + * useless creation of the buffer for the most typical + * case when invalidation is not used in redo or for + * parallel read. The shared->excl upgrade loop at + * the end of the function catches the race in a + * reliable way (protected by the object lock). + */ + if (m->valid == VM_PAGE_BITS_ALL) + continue; + + lbn = lblkno(um->um_fs, IDX_TO_OFF(m->pindex)); + if (lbn != lbnp) { + bsize = blksize(um->um_fs, VTOI(vp), lbn); + error = bread_gb(vp, lbn, bsize, NOCRED, GB_UNMAPPED, + &bp); + if (error != 0) + break; + KASSERT(1 /* racy, enable for debugging */ || + m->valid == VM_PAGE_BITS_ALL || i == count - 1, + ("buf %d %p invalid", i, m)); + if (i == count - 1 && lpart) { + VM_OBJECT_WLOCK(object); + if (m->valid != 0 && + m->valid != VM_PAGE_BITS_ALL) + vm_page_zero_invalid(m, TRUE); + VM_OBJECT_WUNLOCK(object); + } + if (LIST_EMPTY(&bp->b_dep)) { + /* + * Invalidation clears m->valid, but + * may leave B_CACHE flag if the + * buffer existed at the invalidation + * time. In this case, recycle the + * buffer to do real read on next + * bread() after redo. + * + * Otherwise B_RELBUF is not strictly + * necessary, enable to reduce buf + * cache pressure. + */ + if (buf_pager_relbuf || + m->valid != VM_PAGE_BITS_ALL) + bp->b_flags |= B_RELBUF; + + bp->b_flags &= ~B_NOCACHE; + brelse(bp); + } else { + bqrelse(bp); + } + lbnp = lbn; + } + } + + VM_OBJECT_WLOCK(object); + redo = false; + for (i = 0; i < count; i++) { + vm_page_sunbusy(ma[i]); + ma[i] = vm_page_grab(object, ma[i]->pindex, VM_ALLOC_NORMAL); + + /* + * Since the pages were only sbusy while neither the + * buffer nor the object lock was held by us, or + * reallocated while vm_page_grab() slept for busy + * relinguish, they could have been invalidated. + * Recheck the valid bits and re-read as needed. + * + * Note that the last page is made fully valid in the + * read loop, and partial validity for the page at + * index count - 1 could mean that the page was + * invalidated or removed, so we must restart for + * safety as well. + */ + if (ma[i]->valid != VM_PAGE_BITS_ALL) + redo = true; + } + if (redo && error == 0) + goto again; + VM_OBJECT_WUNLOCK(object); + return (error != 0 ? VM_PAGER_ERROR : VM_PAGER_OK); +} From owner-svn-src-all@freebsd.org Wed Oct 19 11:51:19 2016 Return-Path: Delivered-To: svn-src-all@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 4C64DC18173; Wed, 19 Oct 2016 11:51:19 +0000 (UTC) (envelope-from ae@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 15B589E3; Wed, 19 Oct 2016 11:51:19 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JBpINM020521; Wed, 19 Oct 2016 11:51:18 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JBpIr2020520; Wed, 19 Oct 2016 11:51:18 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201610191151.u9JBpIr2020520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 19 Oct 2016 11:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307628 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 11:51:19 -0000 Author: ae Date: Wed Oct 19 11:51:17 2016 New Revision: 307628 URL: https://svnweb.freebsd.org/changeset/base/307628 Log: Fix `ipfw table lookup` handler to return entry value, but not its index. Submitted by: loos MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw_table.c Modified: head/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table.c Wed Oct 19 11:21:23 2016 (r307627) +++ head/sys/netpfil/ipfw/ip_fw_table.c Wed Oct 19 11:51:17 2016 (r307628) @@ -1087,6 +1087,7 @@ find_table_entry(struct ip_fw_chain *ch, struct table_config *tc; struct table_algo *ta; struct table_info *kti; + struct table_value *pval; struct namedobj_instance *ni; int error; size_t sz; @@ -1132,7 +1133,10 @@ find_table_entry(struct ip_fw_chain *ch, return (ENOTSUP); error = ta->find_tentry(tc->astate, kti, tent); - + if (error == 0) { + pval = get_table_value(ch, tc, tent->v.kidx); + ipfw_export_table_value_v1(pval, &tent->v.value); + } IPFW_UH_RUNLOCK(ch); return (error); From owner-svn-src-all@freebsd.org Wed Oct 19 12:23:03 2016 Return-Path: Delivered-To: svn-src-all@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 92C4AC1733F; Wed, 19 Oct 2016 12:23:03 +0000 (UTC) (envelope-from br@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 4A839E13; Wed, 19 Oct 2016 12:23:03 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JCN216033128; Wed, 19 Oct 2016 12:23:02 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JCN27P033126; Wed, 19 Oct 2016 12:23:02 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610191223.u9JCN27P033126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 19 Oct 2016 12:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307629 - head/bin/pkill/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 12:23:03 -0000 Author: br Date: Wed Oct 19 12:23:02 2016 New Revision: 307629 URL: https://svnweb.freebsd.org/changeset/base/307629 Log: Increase timeouts so tests have more chances to succeed on MIPS64EB in QEMU. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/bin/pkill/tests/pgrep-j_test.sh head/bin/pkill/tests/pkill-j_test.sh Modified: head/bin/pkill/tests/pgrep-j_test.sh ============================================================================== --- head/bin/pkill/tests/pgrep-j_test.sh Wed Oct 19 11:51:17 2016 (r307628) +++ head/bin/pkill/tests/pgrep-j_test.sh Wed Oct 19 12:23:02 2016 (r307629) @@ -54,7 +54,7 @@ fi wait name="pgrep -j any" -sleep_amount=6 +sleep_amount=16 jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & @@ -75,7 +75,7 @@ fi wait name="pgrep -j none" -sleep_amount=7 +sleep_amount=17 daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount & jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount & @@ -92,7 +92,7 @@ wait # test 4 is like test 1 except with jname instead of jid. name="pgrep -j " -sleep_amount=8 +sleep_amount=18 jail -c path=/ name=${base}_4_1 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_4_1.pid $sleep $sleep_amount & Modified: head/bin/pkill/tests/pkill-j_test.sh ============================================================================== --- head/bin/pkill/tests/pkill-j_test.sh Wed Oct 19 11:51:17 2016 (r307628) +++ head/bin/pkill/tests/pkill-j_test.sh Wed Oct 19 12:23:02 2016 (r307629) @@ -20,7 +20,7 @@ sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep name="pkill -j " -sleep_amount=5 +sleep_amount=15 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & @@ -54,7 +54,7 @@ fi 2>/dev/null wait name="pkill -j any" -sleep_amount=6 +sleep_amount=16 jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & @@ -76,7 +76,7 @@ fi 2>/dev/null wait name="pkill -j none" -sleep_amount=7 +sleep_amount=17 daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount & @@ -94,7 +94,7 @@ wait # test 4 is like test 1 except with jname instead of jid. name="pkill -j " -sleep_amount=8 +sleep_amount=18 jail -c path=/ name=${base}_4_1 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_4_1.pid $sleep $sleep_amount & From owner-svn-src-all@freebsd.org Wed Oct 19 13:19:46 2016 Return-Path: Delivered-To: svn-src-all@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 8C10FC17D6A; Wed, 19 Oct 2016 13:19:46 +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 4197C9FF; Wed, 19 Oct 2016 13:19:46 +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 u9JDJj2s052185; Wed, 19 Oct 2016 13:19:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JDJjYb052183; Wed, 19 Oct 2016 13:19:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610191319.u9JDJjYb052183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 13: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: r307631 - stable/11/gnu/usr.bin/groff X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 13:19:46 -0000 Author: emaste Date: Wed Oct 19 13:19:45 2016 New Revision: 307631 URL: https://svnweb.freebsd.org/changeset/base/307631 Log: MFC r306740, r307150: groff: use changelog date in man pages r306740: groff: use changelog date rather than file modification date in man pages The source checkout date is not particularly relevant, and this makes groff man pages build reproducibly. r307150: Avoid using 'head' in generating groff doc date It may not be available in certain cross build cases. Note that this is a slight change in functionality, in that now only the first line of the source ChangeLog file is processed. This is acceptable as groff will be retired and we won't encounter a possibly-different ChangeLog format. Added: stable/11/gnu/usr.bin/groff/mdate.sh - copied, changed from r306740, head/gnu/usr.bin/groff/mdate.sh Modified: stable/11/gnu/usr.bin/groff/Makefile.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/gnu/usr.bin/groff/Makefile.inc ============================================================================== --- stable/11/gnu/usr.bin/groff/Makefile.inc Wed Oct 19 12:33:58 2016 (r307630) +++ stable/11/gnu/usr.bin/groff/Makefile.inc Wed Oct 19 13:19:45 2016 (r307631) @@ -119,7 +119,7 @@ revision=`sed -e 's/^0$$//' -e 's/^[1-9] -e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \ -e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \ -e "s;@VERSION@;$(version)$(revision);g" \ - -e "s;@MDATE@;`$(SHELL) ${GROFF_DIST}/mdate.sh $<`;g" \ + -e "s;@MDATE@;$(MDATE);g" \ -e "s;@g@;$(g);g" \ -e "s;@G@;`echo $(g) | LC_ALL=C tr a-z A-Z`;g" \ $< >$@ @@ -141,4 +141,5 @@ TOPREL?= .. GROFF_DIST= ${.CURDIR}/${TOPREL}/../../../contrib/groff DIST_SUBDIR?= ${.CURDIR:T} DIST_DIR= ${GROFF_DIST}/${DIST_SUBDIR} +MDATE!= sh ${.CURDIR}/${TOPREL}/mdate.sh ${GROFF_DIST}/ChangeLog .PATH: ${DIST_DIR} Copied and modified: stable/11/gnu/usr.bin/groff/mdate.sh (from r306740, head/gnu/usr.bin/groff/mdate.sh) ============================================================================== --- head/gnu/usr.bin/groff/mdate.sh Wed Oct 5 23:25:29 2016 (r306740, copy source) +++ stable/11/gnu/usr.bin/groff/mdate.sh Wed Oct 19 13:19:45 2016 (r307631) @@ -4,6 +4,5 @@ set -e test -r "$1" export LC_ALL=C -changelog_date=$(sed -E -n 's/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/\1/p' "$1" |\ - head -n 1) +changelog_date=$(sed -E -n '1s/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/\1/p' "$1") echo $(date -j -f %Y-%m-%d +"%e %B %Y" $changelog_date) From owner-svn-src-all@freebsd.org Wed Oct 19 13:26:10 2016 Return-Path: Delivered-To: svn-src-all@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 1436BC18020; Wed, 19 Oct 2016 13:26:10 +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 E2A08E9D; Wed, 19 Oct 2016 13:26:09 +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 u9JDQ94U055778; Wed, 19 Oct 2016 13:26:09 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JDQ7pm055767; Wed, 19 Oct 2016 13:26:07 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610191326.u9JDQ7pm055767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 19 Oct 2016 13:26:07 +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: r307632 - in stable/11: lib/libstand sys/boot/common sys/boot/efi/loader sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/pc98/loader X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 13:26:10 -0000 Author: bapt Date: Wed Oct 19 13:26:07 2016 New Revision: 307632 URL: https://svnweb.freebsd.org/changeset/base/307632 Log: MFC: 304677, 304680, 305125, 305770, 305769 r304677: Add tftpfs support for the EFI loader Allow netbooting on efi without having to setup any NFS server by rebuilding the loader with LOADER_TFTP_SUPPORT like for the i386 pxeloader r305125: Netboot: allow both tftpfs and nfs in both pxeboot and loader.efi Add a new 'netproto' variable which can be set for now to NET_TFTP or NET_NFS (default to NET_NONE) From the dhcp options if one sets the root-path option to: "ip:path", the loader will consider it is booting over NFS (meaning same behaviour as the default current behaviour) if the dhcp option "tftp server address" is set (option 150) the loader will consider it is booting over tftpfs, it will then consider the root-path options with 2 possible case 1. "path" then the IP of the tftp server will be the one passed by the option 150, and the files will be retrieved under "path" on the tftp server 2. "ip:path" then the IP of the tftp server will be the one passed in the option "overwritting the IP from the option 150. We could not "abuse" the rootpath option in the form or tftp://ip:path because this is already used for other purpose by iPXE preventing any chainload from iPXE to the FreeBSD loader. Given at each open(), the loader loops over all available filesystems and keep the "best" error, we needed to prevent tftpfs to fallback on nfs and vice versa. the tftpfs and nfs implementation in libstand now return EINVAL early if 'netproto' for that purpose. Relnotes: yes Sponsored by: Gandi.net Modified: stable/11/lib/libstand/bootp.c stable/11/lib/libstand/bootp.h stable/11/lib/libstand/globals.c stable/11/lib/libstand/net.h stable/11/lib/libstand/nfs.c stable/11/lib/libstand/tftp.c stable/11/sys/boot/common/dev_net.c stable/11/sys/boot/efi/loader/conf.c stable/11/sys/boot/i386/libi386/pxe.c stable/11/sys/boot/i386/loader/conf.c stable/11/sys/boot/pc98/loader/conf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libstand/bootp.c ============================================================================== --- stable/11/lib/libstand/bootp.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/lib/libstand/bootp.c Wed Oct 19 13:26:07 2016 (r307632) @@ -411,6 +411,10 @@ vend_rfc1048(cp, len) bcopy(cp, &dhcp_serverip.s_addr, sizeof(dhcp_serverip.s_addr)); } + if (tag == TAG_TFTP_SERVER) { + bcopy(cp, &tftpip.s_addr, + sizeof(tftpip.s_addr)); + } #endif cp += size; } Modified: stable/11/lib/libstand/bootp.h ============================================================================== --- stable/11/lib/libstand/bootp.h Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/lib/libstand/bootp.h Wed Oct 19 13:26:07 2016 (r307632) @@ -106,6 +106,7 @@ struct bootp { #define TAG_T2 ((unsigned char) 59) #define TAG_CLASSID ((unsigned char) 60) #define TAG_CLIENTID ((unsigned char) 61) +#define TAG_TFTP_SERVER ((unsigned char) 150) #endif #define TAG_END ((unsigned char) 255) Modified: stable/11/lib/libstand/globals.c ============================================================================== --- stable/11/lib/libstand/globals.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/lib/libstand/globals.c Wed Oct 19 13:26:07 2016 (r307632) @@ -25,12 +25,14 @@ char hostname[FNAME_SIZE]; /* our hostn int hostnamelen; char domainname[FNAME_SIZE]; /* our DNS domain */ int domainnamelen; +int netproto = NET_NONE; /* Network prototol */ char ifname[IFNAME_SIZE]; /* name of interface (e.g. "le0") */ struct in_addr myip; /* my ip address */ struct in_addr nameip; /* DNS server ip address */ struct in_addr rootip; /* root ip address */ struct in_addr swapip; /* swap ip address */ struct in_addr gateip; /* gateway ip address */ +struct in_addr tftpip; /* TFTP ip address */ n_long netmask = 0xffffff00; /* subnet or net mask */ u_int intf_mtu; /* interface mtu from bootp/dhcp */ int errno; /* our old friend */ Modified: stable/11/lib/libstand/net.h ============================================================================== --- stable/11/lib/libstand/net.h Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/lib/libstand/net.h Wed Oct 19 13:26:07 2016 (r307632) @@ -36,6 +36,8 @@ * $FreeBSD$ */ +#ifndef _STAND_NET_H +#define _STAND_NET_H #ifndef _KERNEL /* XXX - see */ #undef __IPADDR #define __IPADDR(x) htonl((u_int32_t)(x)) @@ -45,6 +47,12 @@ #define BA { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } +enum net_proto { + NET_NONE, + NET_NFS, + NET_TFTP +}; + /* Returns true if n_long's on the same net */ #define SAMENET(a1, a2, m) ((a1.s_addr & m) == (a2.s_addr & m)) @@ -74,6 +82,7 @@ extern char hostname[FNAME_SIZE]; extern int hostnamelen; extern char domainname[FNAME_SIZE]; extern int domainnamelen; +extern int netproto; extern char ifname[IFNAME_SIZE]; /* All of these are in network order. */ @@ -82,6 +91,7 @@ extern struct in_addr rootip; extern struct in_addr swapip; extern struct in_addr gateip; extern struct in_addr nameip; +extern struct in_addr tftpip; extern n_long netmask; extern u_int intf_mtu; @@ -120,3 +130,4 @@ n_long inet_addr(char *); /* Machine-dependent functions: */ time_t getsecs(void); +#endif /* ! _STAND_NET_H */ Modified: stable/11/lib/libstand/nfs.c ============================================================================== --- stable/11/lib/libstand/nfs.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/lib/libstand/nfs.c Wed Oct 19 13:26:07 2016 (r307632) @@ -473,6 +473,9 @@ nfs_open(const char *upath, struct open_ int error; char *path; + if (netproto != NET_NFS) + return (EINVAL); + #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); @@ -1115,6 +1118,9 @@ nfs_open(const char *upath, struct open_ int error; char *path; + if (netproto != NET_NFS) + return (EINVAL); + #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); Modified: stable/11/lib/libstand/tftp.c ============================================================================== --- stable/11/lib/libstand/tftp.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/lib/libstand/tftp.c Wed Oct 19 13:26:07 2016 (r307632) @@ -402,6 +402,9 @@ tftp_open(const char *path, struct open_ size_t pathsize; const char *extraslash; + if (netproto != NET_TFTP) + return (EINVAL); + if (strcmp(f->f_dev->dv_name, "net") != 0) { #ifdef __i386__ if (strcmp(f->f_dev->dv_name, "pxe") != 0) Modified: stable/11/sys/boot/common/dev_net.c ============================================================================== --- stable/11/sys/boot/common/dev_net.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/sys/boot/common/dev_net.c Wed Oct 19 13:26:07 2016 (r307632) @@ -167,8 +167,14 @@ net_open(struct open_file *f, ...) setenv("boot.netif.ip", inet_ntoa(myip), 1); setenv("boot.netif.netmask", intoa(netmask), 1); setenv("boot.netif.gateway", inet_ntoa(gateip), 1); - setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); - setenv("boot.nfsroot.path", rootpath, 1); + setenv("boot.netif.server", inet_ntoa(rootip), 1); + if (netproto == NET_TFTP) { + setenv("boot.tftproot.server", inet_ntoa(rootip), 1); + setenv("boot.tftproot.path", rootpath, 1); + } else if (netproto == NET_NFS) { + setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); + setenv("boot.nfsroot.path", rootpath, 1); + } if (intf_mtu != 0) { char mtu[16]; sprintf(mtu, "%u", intf_mtu); @@ -365,6 +371,13 @@ net_parse_rootpath() int i; n_long addr = INADDR_NONE; + netproto = NET_NFS; + + if (tftpip.s_addr != 0) { + netproto = NET_TFTP; + addr = tftpip.s_addr; + } + for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) if (rootpath[i] == ':') break; @@ -373,5 +386,6 @@ net_parse_rootpath() addr = inet_addr(&rootpath[0]); bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1); } + return (addr); } Modified: stable/11/sys/boot/efi/loader/conf.c ============================================================================== --- stable/11/sys/boot/efi/loader/conf.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/sys/boot/efi/loader/conf.c Wed Oct 19 13:26:07 2016 (r307632) @@ -51,6 +51,7 @@ struct fs_ops *file_system[] = { &dosfs_fsops, &ufs_fsops, &cd9660_fsops, + &tftp_fsops, &nfs_fsops, &gzipfs_fsops, &bzipfs_fsops, Modified: stable/11/sys/boot/i386/libi386/pxe.c ============================================================================== --- stable/11/sys/boot/i386/libi386/pxe.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/sys/boot/i386/libi386/pxe.c Wed Oct 19 13:26:07 2016 (r307632) @@ -288,10 +288,15 @@ pxe_open(struct open_file *f, ...) bootp(pxe_sock, BOOTP_PXE); if (rootip.s_addr == 0) rootip.s_addr = bootplayer.sip; -#ifdef LOADER_NFS_SUPPORT - if (!rootpath[0]) + + netproto = NET_NFS; + if (tftpip.s_addr != 0) { + netproto = NET_TFTP; + rootip.s_addr = tftpip.s_addr; + } + + if (netproto == NET_NFS && !rootpath[0]) strcpy(rootpath, PXENFSROOTPATH); -#endif for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) if (rootpath[i] == ':') @@ -315,17 +320,17 @@ pxe_open(struct open_file *f, ...) sprintf(mtu, "%u", intf_mtu); setenv("boot.netif.mtu", mtu, 1); } -#ifdef LOADER_NFS_SUPPORT printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); printf("pxe_open: server path: %s\n", rootpath); printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); - setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); - setenv("boot.nfsroot.path", rootpath, 1); -#else - setenv("boot.netif.server", inet_ntoa(rootip), 1); - setenv("boot.tftproot.path", rootpath, 1); -#endif + if (netproto == NET_NFS) { + setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); + setenv("boot.nfsroot.path", rootpath, 1); + } else if (netproto == NET_TFTP) { + setenv("boot.netif.server", inet_ntoa(rootip), 1); + setenv("boot.tftproot.path", rootpath, 1); + } setenv("dhcp.host-name", hostname, 1); setenv("pxeboot.ip", inet_ntoa(myip), 1); @@ -359,10 +364,10 @@ pxe_close(struct open_file *f) if (pxe_opens > 0) return(0); -#ifdef LOADER_NFS_SUPPORT - /* get an NFS filehandle for our root filesystem */ - pxe_setnfshandle(rootpath); -#endif + if (netproto == NET_NFS) { + /* get an NFS filehandle for our root filesystem */ + pxe_setnfshandle(rootpath); + } if (pxe_sock >= 0) { @@ -422,7 +427,6 @@ pxe_perror(int err) return; } -#ifdef LOADER_NFS_SUPPORT /* * Reach inside the libstand NFS code and dig out an NFS handle * for the root filesystem. @@ -533,7 +537,6 @@ pxe_setnfshandle(char *rootpath) setenv("boot.nfsroot.nfshandlelen", buf, 1); } #endif /* OLD_NFSV2 */ -#endif /* LOADER_NFS_SUPPORT */ void pxenv_call(int func) Modified: stable/11/sys/boot/i386/loader/conf.c ============================================================================== --- stable/11/sys/boot/i386/loader/conf.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/sys/boot/i386/loader/conf.c Wed Oct 19 13:26:07 2016 (r307632) @@ -45,10 +45,6 @@ __FBSDID("$FreeBSD$"); * XXX as libi386 and biosboot merge, some of these can become linker sets. */ -#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT) -#error "Cannot have both tftp and nfs support yet." -#endif - #if defined(LOADER_FIREWIRE_SUPPORT) extern struct devsw fwohci; #endif Modified: stable/11/sys/boot/pc98/loader/conf.c ============================================================================== --- stable/11/sys/boot/pc98/loader/conf.c Wed Oct 19 13:19:45 2016 (r307631) +++ stable/11/sys/boot/pc98/loader/conf.c Wed Oct 19 13:26:07 2016 (r307632) @@ -42,10 +42,6 @@ __FBSDID("$FreeBSD$"); * XXX as libi386 and biosboot merge, some of these can become linker sets. */ -#if defined(LOADER_NFS_SUPPORT) && defined(LOADER_TFTP_SUPPORT) -#error "Cannot have both tftp and nfs support yet." -#endif - /* Exported for libstand */ struct devsw *devsw[] = { &bioscd, From owner-svn-src-all@freebsd.org Wed Oct 19 13:36:53 2016 Return-Path: Delivered-To: svn-src-all@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 511D7C18409; Wed, 19 Oct 2016 13:36:53 +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 1FF38986; Wed, 19 Oct 2016 13:36:53 +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 u9JDaqew059641; Wed, 19 Oct 2016 13:36:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JDaqdb059640; Wed, 19 Oct 2016 13:36:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610191336.u9JDaqdb059640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 13:36: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: r307633 - stable/11/sys/mips/conf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 13:36:53 -0000 Author: emaste Date: Wed Oct 19 13:36:52 2016 New Revision: 307633 URL: https://svnweb.freebsd.org/changeset/base/307633 Log: MFC r307152: Add COMPAT_FREEBSD10 to the MIPS ERL kernel config As of r302092, pipe is a wrapper around pipe2 and the pipe syscall is no longer used. It is included only with the COMPAT_FREEBSD10 kernel option. Add the compat option to support upgrades from systems with an earlier userland. Modified: stable/11/sys/mips/conf/ERL Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/mips/conf/ERL ============================================================================== --- stable/11/sys/mips/conf/ERL Wed Oct 19 13:26:07 2016 (r307632) +++ stable/11/sys/mips/conf/ERL Wed Oct 19 13:36:52 2016 (r307633) @@ -73,6 +73,7 @@ options PSEUDOFS # Pseudo-filesystem f options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization options COMPAT_FREEBSD32 # Compatible with o32 binaries +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support From owner-svn-src-all@freebsd.org Wed Oct 19 13:37:45 2016 Return-Path: Delivered-To: svn-src-all@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 358EAC184B4; Wed, 19 Oct 2016 13:37:45 +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 F2E53AF4; Wed, 19 Oct 2016 13:37:44 +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 u9JDbi2t059727; Wed, 19 Oct 2016 13:37:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JDbimb059726; Wed, 19 Oct 2016 13:37:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610191337.u9JDbimb059726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 13:37: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: r307634 - stable/11/sys/dev/kbd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 13:37:45 -0000 Author: emaste Date: Wed Oct 19 13:37:43 2016 New Revision: 307634 URL: https://svnweb.freebsd.org/changeset/base/307634 Log: MFC r307145: Use M_WAITOK in PIO_KEYMAP ioctl The malloc return value is not checked. Modified: stable/11/sys/dev/kbd/kbd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/kbd/kbd.c ============================================================================== --- stable/11/sys/dev/kbd/kbd.c Wed Oct 19 13:36:52 2016 (r307633) +++ stable/11/sys/dev/kbd/kbd.c Wed Oct 19 13:37:43 2016 (r307634) @@ -888,7 +888,7 @@ genkbd_commonioctl(keyboard_t *kbd, u_lo case PIO_KEYMAP: /* set keyboard translation table */ case OPIO_KEYMAP: /* set keyboard translation table (compat) */ #ifndef KBD_DISABLE_KEYMAP_LOAD - mapp = malloc(sizeof *mapp, M_TEMP, M_NOWAIT); + mapp = malloc(sizeof *mapp, M_TEMP, M_WAITOK); if (cmd == OPIO_KEYMAP) { omapp = (okeymap_t *)arg; mapp->n_keys = omapp->n_keys; From owner-svn-src-all@freebsd.org Wed Oct 19 13:42:42 2016 Return-Path: Delivered-To: svn-src-all@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 43C1DC18879; Wed, 19 Oct 2016 13:42:42 +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 1373E8B; Wed, 19 Oct 2016 13:42:42 +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 u9JDgfA2063457; Wed, 19 Oct 2016 13:42:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JDgfL7063456; Wed, 19 Oct 2016 13:42:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610191342.u9JDgfL7063456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 13:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307635 - stable/10/sys/dev/kbd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 13:42:42 -0000 Author: emaste Date: Wed Oct 19 13:42:40 2016 New Revision: 307635 URL: https://svnweb.freebsd.org/changeset/base/307635 Log: MFC r307145: Use M_WAITOK in PIO_KEYMAP ioctl The malloc return value is not checked. Modified: stable/10/sys/dev/kbd/kbd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/kbd/kbd.c ============================================================================== --- stable/10/sys/dev/kbd/kbd.c Wed Oct 19 13:37:43 2016 (r307634) +++ stable/10/sys/dev/kbd/kbd.c Wed Oct 19 13:42:40 2016 (r307635) @@ -888,7 +888,7 @@ genkbd_commonioctl(keyboard_t *kbd, u_lo case PIO_KEYMAP: /* set keyboard translation table */ case OPIO_KEYMAP: /* set keyboard translation table (compat) */ #ifndef KBD_DISABLE_KEYMAP_LOAD - mapp = malloc(sizeof *mapp, M_TEMP, M_NOWAIT); + mapp = malloc(sizeof *mapp, M_TEMP, M_WAITOK); if (cmd == OPIO_KEYMAP) { omapp = (okeymap_t *)arg; mapp->n_keys = omapp->n_keys; From owner-svn-src-all@freebsd.org Wed Oct 19 13:45:53 2016 Return-Path: Delivered-To: svn-src-all@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 1198DC18927; Wed, 19 Oct 2016 13:45:53 +0000 (UTC) (envelope-from imp@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 E0FD4267; Wed, 19 Oct 2016 13:45:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JDjqkg063634; Wed, 19 Oct 2016 13:45:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JDjqsl063633; Wed, 19 Oct 2016 13:45:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610191345.u9JDjqsl063633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 19 Oct 2016 13:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307636 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 13:45:53 -0000 Author: imp Date: Wed Oct 19 13:45:51 2016 New Revision: 307636 URL: https://svnweb.freebsd.org/changeset/base/307636 Log: Document the unique requirements for upgrading more prominently. Unlike in the past (dating back to the 4.x branch point), you cannot upgrade from any point on the past couple of stable branches to -current. Due to a bug in clang that existed before r286035 in stable/9 or r286033 in stable/10, we cannot compile llvm that's in 11.x or -current. Unfortunately, these revisions are after 9.3R and 10.3R on their respective branches. stable/11 and 11.0R are not affected. This also affects the upgrade path to 11 (including 11.0R) from stable/9 and stable/10 (which would otherwise work, were it not for this bug). We also need to amend the 11.0R release notes. MFC After: 3 days Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Oct 19 13:42:40 2016 (r307635) +++ head/UPDATING Wed Oct 19 13:45:51 2016 (r307636) @@ -29,7 +29,23 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 machines to maximize performance. (To completely disable malloc debugging, define MALLOC_PRODUCTION in /etc/make.conf, or to merely disable the most expensive debugging functionality run - "ln -s 'abort:false,junk:false' /etc/malloc.conf".) + "ln -s 'abort:false,junk:false' /etc/malloc. + + +****************************** SPECIAL WARNING: ****************************** + + Due to a bug in some versions of clang that's very hard to workaround in + the upgrade process, to upgrade to -current you must first upgrade + either stable/9 after r286035 or stable/10 after r286033 or current + after r286007 (including stable/11 and 11.0-RELEASE). These revisions + post-date 10.3-RELEASE and 9.3-RELEASE, so you'll need to take the + unusual step of upgrading to the tip of the stable branch before moving + to 11 or -current via a source upgrade. stable/11 and 11.0-RELEASE + post-date the fix so you can move from them to -current. This differs + from the historical situation where one coule upgrade from anywhere on + the last couple of stable branches, so be careful. + +****************************** SPECIAL WARNING: ****************************** 20161017: The urtwn(4) driver was merged into rtwn(4) and now consists of @@ -1467,11 +1483,15 @@ COMMON ITEMS: your build attempts in an "environmental clean room", prefix all make commands with 'env -i '. See the env(1) manual page for more details. - When upgrading from one major version to another it is generally best - to upgrade to the latest code in the currently installed branch first, - then do an upgrade to the new branch. This is the best-tested upgrade - path, and has the highest probability of being successful. Please try - this approach before reporting problems with a major version upgrade. + When upgrading from one major version to another it is generally best to + upgrade to the latest code in the currently installed branch first, then + do an upgrade to the new branch. This is the best-tested upgrade path, + and has the highest probability of being successful. Please try this + approach if you encounter problems with a major version upgrade. Since + the stable 4.x branch point, one has generally been able to upgade from + anywhere in the most recent stable branch to head / current (or even the + last couple of stable branches). See the top of this file when there's + an exception. When upgrading a live system, having a root shell around before installing anything can help undo problems. Not having a root shell From owner-svn-src-all@freebsd.org Wed Oct 19 14:28:53 2016 Return-Path: Delivered-To: svn-src-all@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 173D6C1867C; Wed, 19 Oct 2016 14:28:53 +0000 (UTC) (envelope-from mmel@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 D0DB49D2; Wed, 19 Oct 2016 14:28:52 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JESpRO080244; Wed, 19 Oct 2016 14:28:51 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JESpoK080243; Wed, 19 Oct 2016 14:28:51 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201610191428.u9JESpoK080243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 19 Oct 2016 14:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307637 - head/sys/arm/nvidia/tegra124 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 14:28:53 -0000 Author: mmel Date: Wed Oct 19 14:28:51 2016 New Revision: 307637 URL: https://svnweb.freebsd.org/changeset/base/307637 Log: TEGRA: Raise minimum voltage for CPU, original 0.9 V was too optimistic. While I'm in, remove duplicated line from CPU frequency table. MFC after: 2 weeks Modified: head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Modified: head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Wed Oct 19 13:45:51 2016 (r307636) +++ head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c Wed Oct 19 14:28:51 2016 (r307637) @@ -141,7 +141,7 @@ static struct speedo_entry tegra124_spee static struct cpu_volt_def tegra124_cpu_volt_pllx_def = { - .min_uvolt = 900000, /* 0.9 V */ + .min_uvolt = 1000000, /* XXX 0.9 V doesn't work on all boards */ .max_uvolt = 1260000, /* 1.26 */ .step_uvolt = 10000, /* 10 mV */ .speedo_scale = 100, @@ -172,7 +172,6 @@ static uint64_t cpu_freq_tbl[] = { 2116000000ULL, 2218000000ULL, 2320000000ULL, - 2320000000ULL, 2422000000ULL, 2524000000ULL, }; From owner-svn-src-all@freebsd.org Wed Oct 19 14:51:26 2016 Return-Path: Delivered-To: svn-src-all@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 46D7FC18D18; Wed, 19 Oct 2016 14:51:26 +0000 (UTC) (envelope-from gahr@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 18F99C2A; Wed, 19 Oct 2016 14:51:26 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JEpPKW097479; Wed, 19 Oct 2016 14:51:25 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JEpP3v097478; Wed, 19 Oct 2016 14:51:25 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201610191451.u9JEpP3v097478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Wed, 19 Oct 2016 14:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307638 - head/usr.bin/printenv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 14:51:26 -0000 Author: gahr (ports committer) Date: Wed Oct 19 14:51:25 2016 New Revision: 307638 URL: https://svnweb.freebsd.org/changeset/base/307638 Log: Chase a cornercase in printenv and sync its behaviour with builtin's The cornercase is when printenv is passed a parameter in the form VAR=val, where VAR=val exists in the environment. In this case, printenv would print a spurious newline and returns 0. Approved by: cognet MFC after: 1 week Modified: head/usr.bin/printenv/printenv.c Modified: head/usr.bin/printenv/printenv.c ============================================================================== --- head/usr.bin/printenv/printenv.c Wed Oct 19 14:28:51 2016 (r307637) +++ head/usr.bin/printenv/printenv.c Wed Oct 19 14:51:25 2016 (r307638) @@ -83,8 +83,8 @@ main(int argc, char *argv[]) for (ep = environ; *ep; ep++) if (!memcmp(*ep, *argv, len)) { cp = *ep + len; - if (!*cp || *cp == '=') { - (void)printf("%s\n", *cp ? cp + 1 : cp); + if (*cp == '=') { + (void)printf("%s\n", cp + 1); exit(0); } } From owner-svn-src-all@freebsd.org Wed Oct 19 15:13:09 2016 Return-Path: Delivered-To: svn-src-all@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 87C36C183BC; Wed, 19 Oct 2016 15:13:09 +0000 (UTC) (envelope-from imp@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 3FB37E44; Wed, 19 Oct 2016 15:13:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JFD8GQ006477; Wed, 19 Oct 2016 15:13:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JFD853006476; Wed, 19 Oct 2016 15:13:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610191513.u9JFD853006476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 19 Oct 2016 15:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307639 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 15:13:09 -0000 Author: imp Date: Wed Oct 19 15:13:08 2016 New Revision: 307639 URL: https://svnweb.freebsd.org/changeset/base/307639 Log: After deeper software archaeology, reports that 10.3R was affected turned out to be mistaken. Adjust the entry and fix a few typos. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Oct 19 14:51:25 2016 (r307638) +++ head/UPDATING Wed Oct 19 15:13:08 2016 (r307639) @@ -29,21 +29,22 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 machines to maximize performance. (To completely disable malloc debugging, define MALLOC_PRODUCTION in /etc/make.conf, or to merely disable the most expensive debugging functionality run - "ln -s 'abort:false,junk:false' /etc/malloc. + "ln -s 'abort:false,junk:false' /etc/malloc.conf".) ****************************** SPECIAL WARNING: ****************************** Due to a bug in some versions of clang that's very hard to workaround in the upgrade process, to upgrade to -current you must first upgrade - either stable/9 after r286035 or stable/10 after r286033 or current - after r286007 (including stable/11 and 11.0-RELEASE). These revisions - post-date 10.3-RELEASE and 9.3-RELEASE, so you'll need to take the - unusual step of upgrading to the tip of the stable branch before moving - to 11 or -current via a source upgrade. stable/11 and 11.0-RELEASE - post-date the fix so you can move from them to -current. This differs - from the historical situation where one coule upgrade from anywhere on - the last couple of stable branches, so be careful. + either stable/9 after r286035 or stable/10 after r286033 (including + 10.3-RELEASE) or current after r286007 (including stable/11 and + 11.0-RELEASE). These revisions post-date the 10.2 and 9.3 releases, so + you'll need to take the unusual step of upgrading to the tip of the + stable branch before moving to 11 or -current via a source upgrade. + stable/11 and 11.0-RELEASE post-date the fix so you can move from them + to -current. This differs from the historical situation where one could + upgrade from anywhere on the last couple of stable branches, so be + careful. ****************************** SPECIAL WARNING: ****************************** From owner-svn-src-all@freebsd.org Wed Oct 19 16:23:29 2016 Return-Path: Delivered-To: svn-src-all@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 22658C1830D for ; Wed, 19 Oct 2016 16:23:29 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk0-x231.google.com (mail-qk0-x231.google.com [IPv6:2607:f8b0:400d:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAA94FE9 for ; Wed, 19 Oct 2016 16:23:28 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk0-x231.google.com with SMTP id o68so44602937qkf.3 for ; Wed, 19 Oct 2016 09:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=opn8KNIMBVPC/fkcW2TQ4CSux44wGRjk5Iba5RX/kZs=; b=FzhG1Eq74kU7Mxb7r6KK9oxf+vtrWUqiqA5bhASXIxk7ThNZGCtWiTul30WqSswNk8 +9QQINC3CyvAp/B/GjFRgEQZlRpph6rmSQeYEx6LmqBBW8ITR+vw7fRHUriKBuLjQVYg sFG0/vYx+MKK3nPdL8w/GLsO8hrdcJhTQORAw/azIvSkjtWVFeaOsMmZo0fwd+f63Hs6 rhp8D4H7XgJnkZXWP9C0U165XypXsI2sMItEX8B+Yo3wwUsbiBNZbpxAE8uGYN2TueQ8 luTpeNsz3MHe2ClHy6tra2VIkM8Uwys/r+03iSw0NmMFl1O8+U3idBB8rfYm/tyVsf4J 0PIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=opn8KNIMBVPC/fkcW2TQ4CSux44wGRjk5Iba5RX/kZs=; b=ZoitHto9rMUH7x/XZ0qEAIRoCa3wNbGVD7eSKqu9/+rxkGFUVQpisDB0usJxEy1qOI SI70V+GAamzZ+dVrpWT4OERwCV3RD/yH4JMwzo64GJiuFt6sJroWfSUUp30MgRVuKkQv nTJVAvljjBuMk/4rW/jFyRBOCjEJg2RjVPyRv4CY47uCVGnkHGpiNiIr5FlIFPhxYyC8 7CyhO940uy0x4qlkVD/tDOPWvyLV4ppJEFIgHFrASLK4TB62c41EqkNb004pzf1EV5Mu bY/YCZjqR3GgsKggMM4hVqbwppzA622rGSGQuTW+xkSHrHuN/h7zAWd/g6h6LEShp01s ncng== X-Gm-Message-State: ABUngvcqgSZ0d8GGIPR5Qjd3+ftMNSjJsoLR8FYHVu0b8U2wVtsCvm3SR+I2jUpcyTquc6vh X-Received: by 10.55.212.85 with SMTP id l82mr6983360qki.214.1476894207878; Wed, 19 Oct 2016 09:23:27 -0700 (PDT) Received: from mutt-hardenedbsd ([63.88.83.66]) by smtp.gmail.com with ESMTPSA id x35sm21137769qte.40.2016.10.19.09.23.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Oct 2016 09:23:26 -0700 (PDT) Date: Wed, 19 Oct 2016 12:23:24 -0400 From: Shawn Webb To: Luigi Rizzo Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap Message-ID: <20161019162324.GA94803@mutt-hardenedbsd> References: <201610161413.u9GEDW91013522@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <201610161413.u9GEDW91013522@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 16:23:29 -0000 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 16, 2016 at 02:13:32PM +0000, Luigi Rizzo wrote: > Author: luigi > Date: Sun Oct 16 14:13:32 2016 > New Revision: 307394 > URL: https://svnweb.freebsd.org/changeset/base/307394 >=20 > Log: > Import the current version of netmap, aligned with the one on github. > =20 > This commit, long overdue, contains contributions in the last 2 years > from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, includin= g: > + fixes on monitor ports > + the 'ptnet' virtual device driver, and ptnetmap backend, for > high speed virtual passthrough on VMs (bhyve fixes in an upcoming com= mit) > + improved emulated netmap mode > + more robust error handling > + removal of stale code > + various fixes to code and documentation (some mixup between RX and TX > parameters, and private and public variables) > =20 > We also include an additional tool, nmreplay, which is functionally > equivalent to tcpreplay but operating on netmap ports. >=20 > Added: > head/tools/tools/netmap/ctrs.h (contents, props changed) > head/tools/tools/netmap/nmreplay.8 (contents, props changed) > head/tools/tools/netmap/nmreplay.c (contents, props changed) > Modified: > head/share/man/man4/netmap.4 > head/sys/conf/files > head/sys/dev/netmap/if_ixl_netmap.h > head/sys/dev/netmap/if_lem_netmap.h > head/sys/dev/netmap/ixgbe_netmap.h > head/sys/dev/netmap/netmap.c > head/sys/dev/netmap/netmap_freebsd.c > head/sys/dev/netmap/netmap_generic.c > head/sys/dev/netmap/netmap_kern.h > head/sys/dev/netmap/netmap_mbq.c > head/sys/dev/netmap/netmap_mbq.h > head/sys/dev/netmap/netmap_mem2.c > head/sys/dev/netmap/netmap_mem2.h > head/sys/dev/netmap/netmap_monitor.c > head/sys/dev/netmap/netmap_offloadings.c > head/sys/dev/netmap/netmap_pipe.c > head/sys/dev/netmap/netmap_vale.c > head/sys/modules/netmap/Makefile > head/sys/net/netmap.h > head/sys/net/netmap_user.h > head/tools/tools/netmap/Makefile > head/tools/tools/netmap/bridge.c > head/tools/tools/netmap/pkt-gen.c > head/tools/tools/netmap/vale-ctl.c Looks like this broke VIMAGE builds: /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared = identifier 'rd' CURVNET_SET(TD_TO_VNET(rd)); ^ /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared = identifier 'rd' /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared = identifier 'rd' /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclared = identifier 'rd' 4 errors generated. --- netmap_freebsd.o --- *** [netmap_freebsd.o] Error code 1 Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --ZPt4rx8FFjLCG7dd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYB536AAoJEGqEZY9SRW7u5lIP/3wxJ1MjsM+GbBUYTQMv2pAW RHY8f+hqAq1B9KEenx8HomCmwrgmfId24/QFFr62LL6McG5Q3//d63W2gMIyGqj8 a7gOn+ZK79lCedsiYckPARY8CpkJ3q4X+qtDKJYWTvWzBkJsYnhRmNVm7yRP+c3W phE0DQQg+PIQMZyGxoWN+A0+Hir8u0RH4Xl1FfW2BnpaZvMLFQ2HnYh7xMaS3emS PR4II140aOn2SLvGhy04NY01HetMc4dZ8PdLspaeJYAQrH5qF/RB+KB8PUISJQPf RD21Bws1rAsahddQNv49iGtw7rit+CbP3992EYAM8xOkc0WLGFKOe5OmyBElW2Z7 r0l6Vml+JtYoLB++2TbnStJD76mk0PTMxvxwXPqK74N5uRDEB13ju7LNRlnuL8YG +3Pzv9jNG4g6ribIPF7Xz3D4tbB459Gl3UBqr4Ji4jtlVQKpDQqXzTR3JpFtukes AM0GiirOWd4q1kIBPqoc5bXk3OK1AnMwb3sdFHabtTLEBQD8Cxjys41DeZsq4Drg yWXXF3y/R7msDF8giiVFxzv9CL3cO6pY7OuSh8xgkkMuI/sCiBEwwLEaDu4bj794 5xAoJ7Ii/E671b5mAVskCiPHFn2qXR6tZFbzfP8aDwB01PVqvrcByGkNkpkX2R6l pphGFf4D9pq05ZvBYE/e =9Qvk -----END PGP SIGNATURE----- --ZPt4rx8FFjLCG7dd-- From owner-svn-src-all@freebsd.org Wed Oct 19 16:33:44 2016 Return-Path: Delivered-To: svn-src-all@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 C66CAC189A9; Wed, 19 Oct 2016 16:33:44 +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 9805ABAA; Wed, 19 Oct 2016 16:33:44 +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 u9JGXhVB038488; Wed, 19 Oct 2016 16:33:43 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JGXhDb038487; Wed, 19 Oct 2016 16:33:43 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201610191633.u9JGXhDb038487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 19 Oct 2016 16:33:43 +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: r307640 - stable/11/lib/libc/db/btree X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 16:33:44 -0000 Author: pfg Date: Wed Oct 19 16:33:43 2016 New Revision: 307640 URL: https://svnweb.freebsd.org/changeset/base/307640 Log: MFC r306332: btree(3): don't shortcut closing if the metadata is dirty. Obtained from: NetBSD (from krb5 tree) Modified: stable/11/lib/libc/db/btree/bt_close.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/db/btree/bt_close.c ============================================================================== --- stable/11/lib/libc/db/btree/bt_close.c Wed Oct 19 15:13:08 2016 (r307639) +++ stable/11/lib/libc/db/btree/bt_close.c Wed Oct 19 16:33:43 2016 (r307640) @@ -134,7 +134,8 @@ __bt_sync(const DB *dbp, u_int flags) return (RET_ERROR); } - if (F_ISSET(t, B_INMEM | B_RDONLY) || !F_ISSET(t, B_MODIFIED)) + if (F_ISSET(t, B_INMEM | B_RDONLY) || + !F_ISSET(t, B_MODIFIED | B_METADIRTY)) return (RET_SUCCESS); if (F_ISSET(t, B_METADIRTY) && bt_meta(t) == RET_ERROR) From owner-svn-src-all@freebsd.org Wed Oct 19 16:40:40 2016 Return-Path: Delivered-To: svn-src-all@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 DE959C18DB7; Wed, 19 Oct 2016 16:40:40 +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 81765220; Wed, 19 Oct 2016 16:40:39 +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 u9JGeckN038768; Wed, 19 Oct 2016 16:40:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JGecRs038767; Wed, 19 Oct 2016 16:40:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201610191640.u9JGecRs038767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 19 Oct 2016 16:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307641 - stable/10/lib/libc/db/btree X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 16:40:41 -0000 Author: pfg Date: Wed Oct 19 16:40:38 2016 New Revision: 307641 URL: https://svnweb.freebsd.org/changeset/base/307641 Log: MFC r306332: btree(3): don't shortcut closing if the metadata is dirty. Obtained from: NetBSD (from krb5 tree) Modified: stable/10/lib/libc/db/btree/bt_close.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/db/btree/bt_close.c ============================================================================== --- stable/10/lib/libc/db/btree/bt_close.c Wed Oct 19 16:33:43 2016 (r307640) +++ stable/10/lib/libc/db/btree/bt_close.c Wed Oct 19 16:40:38 2016 (r307641) @@ -134,7 +134,8 @@ __bt_sync(const DB *dbp, u_int flags) return (RET_ERROR); } - if (F_ISSET(t, B_INMEM | B_RDONLY) || !F_ISSET(t, B_MODIFIED)) + if (F_ISSET(t, B_INMEM | B_RDONLY) || + !F_ISSET(t, B_MODIFIED | B_METADIRTY)) return (RET_SUCCESS); if (F_ISSET(t, B_METADIRTY) && bt_meta(t) == RET_ERROR) From owner-svn-src-all@freebsd.org Wed Oct 19 17:18:49 2016 Return-Path: Delivered-To: svn-src-all@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 CF76EC19A40; Wed, 19 Oct 2016 17:18:49 +0000 (UTC) (envelope-from markj@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 9F314C7A; Wed, 19 Oct 2016 17:18:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JHImFr053790; Wed, 19 Oct 2016 17:18:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JHIm6t053789; Wed, 19 Oct 2016 17:18:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610191718.u9JHIm6t053789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Oct 2016 17:18: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: r307642 - stable/11/libexec/ypxfr X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:18:49 -0000 Author: markj Date: Wed Oct 19 17:18:48 2016 New Revision: 307642 URL: https://svnweb.freebsd.org/changeset/base/307642 Log: MFC r307398: Reference the libc symbols ypresp_{allfn,data} instead of local symbols. PR: 213506 Modified: stable/11/libexec/ypxfr/ypxfr_getmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/ypxfr/ypxfr_getmap.c ============================================================================== --- stable/11/libexec/ypxfr/ypxfr_getmap.c Wed Oct 19 16:40:38 2016 (r307641) +++ stable/11/libexec/ypxfr/ypxfr_getmap.c Wed Oct 19 17:18:48 2016 (r307642) @@ -43,8 +43,8 @@ __FBSDID("$FreeBSD$"); extern bool_t xdr_ypresp_all_seq(XDR *, unsigned long *); -static int (*ypresp_allfn)(); -static void *ypresp_data; +extern int (*ypresp_allfn)(); +extern void *ypresp_data; extern DB *specdbp; extern enum ypstat yp_errno; From owner-svn-src-all@freebsd.org Wed Oct 19 17:21:40 2016 Return-Path: Delivered-To: svn-src-all@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 80FF3C19BE7; Wed, 19 Oct 2016 17:21:40 +0000 (UTC) (envelope-from markj@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 50ECFF99; Wed, 19 Oct 2016 17:21:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JHLdtB056581; Wed, 19 Oct 2016 17:21:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JHLdhS056580; Wed, 19 Oct 2016 17:21:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610191721.u9JHLdhS056580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Oct 2016 17:21: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: r307643 - stable/11/usr.sbin/pmcstat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:21:40 -0000 Author: markj Date: Wed Oct 19 17:21:39 2016 New Revision: 307643 URL: https://svnweb.freebsd.org/changeset/base/307643 Log: MFC r307384: Remove an unused field from struct pmcstat_image. Modified: stable/11/usr.sbin/pmcstat/pmcstat_log.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pmcstat/pmcstat_log.h ============================================================================== --- stable/11/usr.sbin/pmcstat/pmcstat_log.h Wed Oct 19 17:18:48 2016 (r307642) +++ stable/11/usr.sbin/pmcstat/pmcstat_log.h Wed Oct 19 17:21:39 2016 (r307643) @@ -76,7 +76,6 @@ enum pmcstat_image_type { struct pmcstat_image { LIST_ENTRY(pmcstat_image) pi_next; /* hash link */ - TAILQ_ENTRY(pmcstat_image) pi_lru; /* LRU list */ pmcstat_interned_string pi_execpath; /* cookie */ pmcstat_interned_string pi_samplename; /* sample path name */ pmcstat_interned_string pi_fullpath; /* path to FS object */ From owner-svn-src-all@freebsd.org Wed Oct 19 17:23:51 2016 Return-Path: Delivered-To: svn-src-all@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 7177AC19C86; Wed, 19 Oct 2016 17:23:51 +0000 (UTC) (envelope-from markj@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 344DD33C; Wed, 19 Oct 2016 17:23:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JHNovM057412; Wed, 19 Oct 2016 17:23:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JHNo5h057410; Wed, 19 Oct 2016 17:23:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610191723.u9JHNo5h057410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Oct 2016 17:23:50 +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: r307644 - stable/11/sys/netinet6 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:23:51 -0000 Author: markj Date: Wed Oct 19 17:23:50 2016 New Revision: 307644 URL: https://svnweb.freebsd.org/changeset/base/307644 Log: MFC r306792-r306795, r306826, r306828: Miscellaneous ND6 code cleanups. Modified: stable/11/sys/netinet6/nd6.c stable/11/sys/netinet6/nd6_rtr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/nd6.c ============================================================================== --- stable/11/sys/netinet6/nd6.c Wed Oct 19 17:21:39 2016 (r307643) +++ stable/11/sys/netinet6/nd6.c Wed Oct 19 17:23:50 2016 (r307644) @@ -1227,7 +1227,7 @@ nd6_is_new_addr_neighbor(const struct so struct ifaddr *dstaddr; struct rt_addrinfo info; struct sockaddr_in6 rt_key; - struct sockaddr *dst6; + const struct sockaddr *dst6; int fibnum; /* @@ -1273,7 +1273,7 @@ nd6_is_new_addr_neighbor(const struct so if (!(pr->ndpr_stateflags & NDPRF_ONLINK)) { /* Always use the default FIB here. */ - dst6 = (struct sockaddr *)&pr->ndpr_prefix; + dst6 = (const struct sockaddr *)&pr->ndpr_prefix; /* Restore length field before retrying lookup */ rt_key.sin6_len = sizeof(rt_key); Modified: stable/11/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/11/sys/netinet6/nd6_rtr.c Wed Oct 19 17:21:39 2016 (r307643) +++ stable/11/sys/netinet6/nd6_rtr.c Wed Oct 19 17:23:50 2016 (r307644) @@ -76,17 +76,16 @@ static int prelist_update(struct nd_pref struct mbuf *, int); static struct in6_ifaddr *in6_ifadd(struct nd_prefixctl *, int); static struct nd_pfxrouter *pfxrtr_lookup(struct nd_prefix *, - struct nd_defrouter *); + struct nd_defrouter *); static void pfxrtr_add(struct nd_prefix *, struct nd_defrouter *); static void pfxrtr_del(struct nd_pfxrouter *); -static struct nd_pfxrouter *find_pfxlist_reachable_router -(struct nd_prefix *); +static struct nd_pfxrouter *find_pfxlist_reachable_router(struct nd_prefix *); static void defrouter_delreq(struct nd_defrouter *); static void nd6_rtmsg(int, struct rtentry *); static int in6_init_prefix_ltimes(struct nd_prefix *); static void in6_init_address_ltimes(struct nd_prefix *, - struct in6_addrlifetime *); + struct in6_addrlifetime *); static int nd6_prefix_onlink(struct nd_prefix *); static int nd6_prefix_offlink(struct nd_prefix *); @@ -1432,7 +1431,7 @@ find_pfxlist_reachable_router(struct nd_ * we have moved from the network but the lifetime of the prefix has not * expired yet. So we should not use the prefix if there is another prefix * that has an available router. - * But, if there is no prefix that has an available router, we still regards + * But, if there is no prefix that has an available router, we still regard * all the prefixes as on-link. This is because we can't tell if all the * routers are simply dead or if we really moved from the network and there * is no router around us. @@ -1485,40 +1484,26 @@ pfxlist_onlink_check(void) */ LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { /* XXX: a link-local prefix should never be detached */ - if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) - continue; - - /* - * we aren't interested in prefixes without the L bit - * set. - */ - if (pr->ndpr_raf_onlink == 0) - continue; - - if (pr->ndpr_raf_auto == 0) + if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr) || + pr->ndpr_raf_onlink == 0 || + pr->ndpr_raf_auto == 0) continue; if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 && find_pfxlist_reachable_router(pr) == NULL) pr->ndpr_stateflags |= NDPRF_DETACHED; - if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 && + else if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 && find_pfxlist_reachable_router(pr) != NULL) pr->ndpr_stateflags &= ~NDPRF_DETACHED; } } else { /* there is no prefix that has a reachable router */ LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { - if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) + if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr) || + pr->ndpr_raf_onlink == 0 || + pr->ndpr_raf_auto == 0) continue; - - if (pr->ndpr_raf_onlink == 0) - continue; - - if (pr->ndpr_raf_auto == 0) - continue; - - if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0) - pr->ndpr_stateflags &= ~NDPRF_DETACHED; + pr->ndpr_stateflags &= ~NDPRF_DETACHED; } } @@ -1531,16 +1516,12 @@ pfxlist_onlink_check(void) * so we don't have to care about them. */ LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { - int e; char ip6buf[INET6_ADDRSTRLEN]; + int e; - if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) - continue; - - if (pr->ndpr_raf_onlink == 0) - continue; - - if (pr->ndpr_raf_auto == 0) + if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr) || + pr->ndpr_raf_onlink == 0 || + pr->ndpr_raf_auto == 0) continue; if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 && @@ -1753,11 +1734,11 @@ nd6_prefix_onlink(struct nd_prefix *pr) /* XXX: freebsd does not have ifa_ifwithaf */ IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family == AF_INET6) + if (ifa->ifa_addr->sa_family == AF_INET6) { + ifa_ref(ifa); break; + } } - if (ifa != NULL) - ifa_ref(ifa); IF_ADDR_RUNLOCK(ifp); /* should we care about ia6_flags? */ } @@ -1844,17 +1825,12 @@ nd6_prefix_offlink(struct nd_prefix *pr) * interface. */ LIST_FOREACH(opr, &V_nd_prefix, ndpr_entry) { - if (opr == pr) - continue; - - if ((opr->ndpr_stateflags & NDPRF_ONLINK) != 0) - continue; - /* * KAME specific: detached prefixes should not be * on-link. */ - if ((opr->ndpr_stateflags & NDPRF_DETACHED) != 0) + if (opr == pr || (opr->ndpr_stateflags & + (NDPRF_ONLINK | NDPRF_DETACHED)) != 0) continue; if (opr->ndpr_plen == pr->ndpr_plen && From owner-svn-src-all@freebsd.org Wed Oct 19 17:24:37 2016 Return-Path: Delivered-To: svn-src-all@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 5F404C19CE3; Wed, 19 Oct 2016 17:24:37 +0000 (UTC) (envelope-from markj@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 170476E1; Wed, 19 Oct 2016 17:24:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JHOaAD057495; Wed, 19 Oct 2016 17:24:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JHOa6M057494; Wed, 19 Oct 2016 17:24:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610191724.u9JHOa6M057494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Oct 2016 17:24:36 +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: r307645 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:24:37 -0000 Author: markj Date: Wed Oct 19 17:24:36 2016 New Revision: 307645 URL: https://svnweb.freebsd.org/changeset/base/307645 Log: MFC r306742: gmirror: Use bool instead of boolean_t. Modified: stable/11/sys/geom/mirror/g_mirror.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Wed Oct 19 17:23:50 2016 (r307644) +++ stable/11/sys/geom/mirror/g_mirror.c Wed Oct 19 17:24:36 2016 (r307645) @@ -99,7 +99,7 @@ struct g_class g_mirror_class = { static void g_mirror_destroy_provider(struct g_mirror_softc *sc); static int g_mirror_update_disk(struct g_mirror_disk *disk, u_int state); -static void g_mirror_update_device(struct g_mirror_softc *sc, boolean_t force); +static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); static void g_mirror_sync_stop(struct g_mirror_disk *disk, int type); @@ -1822,7 +1822,7 @@ g_mirror_worker(void *arg) "Running event for device %s.", sc->sc_name); ep->e_error = 0; - g_mirror_update_device(sc, 1); + g_mirror_update_device(sc, true); } else { /* Update disk status. */ G_MIRROR_DEBUG(3, "Running event for disk %s.", @@ -1830,7 +1830,7 @@ g_mirror_worker(void *arg) ep->e_error = g_mirror_update_disk(ep->e_disk, ep->e_state); if (ep->e_error == 0) - g_mirror_update_device(sc, 0); + g_mirror_update_device(sc, false); } if ((ep->e_flags & G_MIRROR_EVENT_DONTWAIT) != 0) { KASSERT(ep->e_error == 0, @@ -2228,7 +2228,7 @@ g_mirror_determine_state(struct g_mirror * Update device state. */ static void -g_mirror_update_device(struct g_mirror_softc *sc, boolean_t force) +g_mirror_update_device(struct g_mirror_softc *sc, bool force) { struct g_mirror_disk *disk; u_int state; From owner-svn-src-all@freebsd.org Wed Oct 19 17:32:00 2016 Return-Path: Delivered-To: svn-src-all@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 A6BA4C19E5D; Wed, 19 Oct 2016 17:32:00 +0000 (UTC) (envelope-from markj@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 768D8C31; Wed, 19 Oct 2016 17:32:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JHVxIn059814; Wed, 19 Oct 2016 17:31:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JHVxYK059813; Wed, 19 Oct 2016 17:31:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610191731.u9JHVxYK059813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Oct 2016 17:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307646 - stable/10/usr.sbin/rtsold X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:32:00 -0000 Author: markj Date: Wed Oct 19 17:31:59 2016 New Revision: 307646 URL: https://svnweb.freebsd.org/changeset/base/307646 Log: MFC r306571: rtsold: Log messages about unexpected RAs at LOG_DEBUG. Modified: stable/10/usr.sbin/rtsold/rtsol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/10/usr.sbin/rtsold/rtsol.c Wed Oct 19 17:24:36 2016 (r307645) +++ stable/10/usr.sbin/rtsold/rtsol.c Wed Oct 19 17:31:59 2016 (r307646) @@ -347,7 +347,7 @@ rtsol_input(int s) /* xxx: more validation? */ if ((ifi = find_ifinfo(pi->ipi6_ifindex)) == NULL) { - warnmsg(LOG_INFO, __func__, + warnmsg(LOG_DEBUG, __func__, "received RA from %s on an unexpected IF(%s)", inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, sizeof(ntopbuf)), From owner-svn-src-all@freebsd.org Wed Oct 19 17:32:39 2016 Return-Path: Delivered-To: svn-src-all@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 D9EA4C19EB5; Wed, 19 Oct 2016 17:32:39 +0000 (UTC) (envelope-from markj@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 AB8AFE00; Wed, 19 Oct 2016 17:32:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JHWc7J061150; Wed, 19 Oct 2016 17:32:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JHWcgM061149; Wed, 19 Oct 2016 17:32:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610191732.u9JHWcgM061149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Oct 2016 17:32:38 +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: r307647 - stable/11/usr.sbin/rtsold X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:32:39 -0000 Author: markj Date: Wed Oct 19 17:32:38 2016 New Revision: 307647 URL: https://svnweb.freebsd.org/changeset/base/307647 Log: MFC r306571: rtsold: Log messages about unexpected RAs at LOG_DEBUG. Modified: stable/11/usr.sbin/rtsold/rtsol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/11/usr.sbin/rtsold/rtsol.c Wed Oct 19 17:31:59 2016 (r307646) +++ stable/11/usr.sbin/rtsold/rtsol.c Wed Oct 19 17:32:38 2016 (r307647) @@ -347,7 +347,7 @@ rtsol_input(int s) /* xxx: more validation? */ if ((ifi = find_ifinfo(pi->ipi6_ifindex)) == NULL) { - warnmsg(LOG_INFO, __func__, + warnmsg(LOG_DEBUG, __func__, "received RA from %s on an unexpected IF(%s)", inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, sizeof(ntopbuf)), From owner-svn-src-all@freebsd.org Wed Oct 19 17:42:46 2016 Return-Path: Delivered-To: svn-src-all@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 6984AC1908F; Wed, 19 Oct 2016 17:42:46 +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 3904565C; Wed, 19 Oct 2016 17:42:46 +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 u9JHgjKp065111; Wed, 19 Oct 2016 17:42:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JHgj65065110; Wed, 19 Oct 2016 17:42:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610191742.u9JHgj65065110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 17:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307648 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:42:46 -0000 Author: emaste Date: Wed Oct 19 17:42:45 2016 New Revision: 307648 URL: https://svnweb.freebsd.org/changeset/base/307648 Log: Fix MK_SHAREDOCS test from r306864 Groff is needed only if MK_GROFF and MK_SHAREDOCS are both true. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Oct 19 17:32:38 2016 (r307647) +++ head/Makefile.inc1 Wed Oct 19 17:42:45 2016 (r307648) @@ -1586,7 +1586,7 @@ _strfile= usr.bin/fortune/strfile _gperf= gnu/usr.bin/gperf .endif -.if ${MK_SHAREDOCS} != "no" || ${MK_GROFF} != "no" +.if ${MK_SHAREDOCS} != "no" && ${MK_GROFF} != "no" _groff= gnu/usr.bin/groff \ usr.bin/soelim .endif From owner-svn-src-all@freebsd.org Wed Oct 19 17:59:03 2016 Return-Path: Delivered-To: svn-src-all@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 6EC9FC19510; Wed, 19 Oct 2016 17:59:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22e.google.com (mail-pf0-x22e.google.com [IPv6:2607:f8b0:400e:c00::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F6FAB3; Wed, 19 Oct 2016 17:59:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22e.google.com with SMTP id 128so19917435pfz.0; Wed, 19 Oct 2016 10:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FeTqV8ws/n9oBArWy8lkxTiA9+qWcjIWPFo7Xr7sYns=; b=nhXV/d7wcAOeaJ2bFZ70NAtkfQKMuN6BIb8QzEplW3qgLgcc8Fao3Hc55V57L85Ikp WcjE8kE2tL/S8Tr9+eyqHvnKFHRxlaPaeEOz+F8YBXqsnL8eplZS+4KFQBUeA8pTvpmn V12/J7MdYNx+G884swIIDnPjKY/X/PenuGzBPzboOWk2xdTtXjTmE+ZFqsCuEqspDuS9 bejHx+nLA5vAKwHurn0tu/KRqITNk/GZ9FF8y+1LD5369CWuuMYRKAneG6qAmBqdqF7v 8X/nw6bDaaqxtLmkiAaTIqDWPcitHnlFdPWlrgse3gao1zZCUKEIAxvViJbysfXCb3Qy ChnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FeTqV8ws/n9oBArWy8lkxTiA9+qWcjIWPFo7Xr7sYns=; b=EKZo0gcWEnJJiJgcsjnSPZF7TUiw8cv3qM9odJLLzpBflRaBJm+yKGGfCJUqXS//O+ nVaE0dUTUCtZ8luIoZ2KvGr4eJ2dJMZtGRhNTbR8WbG6e7Nvnz/YJX9cURsMUR5eRqQX fDm+esJz+vdQmQVTUWuMFTPRTyj/iGR05bxP2q0uoxUZKAWJaw4GdnX6eel0jNlOzA9z iGwOPEHCAkAFLr8+816i6qiFxbJuE/vBNgqGv1V/T9OYvcTBuZZNIk+5r1CZzHRwpDvg opZMhq7fTwqGeXky0ns6AomMVZXZ8v6UtBGPrXJ8eZbge5Y3lIqG5+0OV80mTqk8Drf7 mKsQ== X-Gm-Message-State: AA6/9RkaJat9Xmq5ZS1wyOjtm1Nbwy5d4MLeOkOIcQy5pczm+dls8NF+BHmKzgdhxa+9PA== X-Received: by 10.99.121.133 with SMTP id u127mr11165052pgc.4.1476899942564; Wed, 19 Oct 2016 10:59:02 -0700 (PDT) Received: from ?IPv6:2607:fb90:80bb:5bf8:8135:9c53:abb9:3522? ([2607:fb90:80bb:5bf8:8135:9c53:abb9:3522]) by smtp.gmail.com with ESMTPSA id x190sm65461216pfd.20.2016.10.19.10.59.01 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Oct 2016 10:59:01 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r307648 - head From: Ngie Cooper X-Mailer: iPhone Mail (14A456) In-Reply-To: <201610191742.u9JHgj65065110@repo.freebsd.org> Date: Wed, 19 Oct 2016 10:59:00 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <5CC7C8B0-8D03-41C8-ACBD-37DCDCD7335B@gmail.com> References: <201610191742.u9JHgj65065110@repo.freebsd.org> To: Ed Maste X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 17:59:03 -0000 > On Oct 19, 2016, at 10:42, Ed Maste wrote: >=20 > Author: emaste > Date: Wed Oct 19 17:42:45 2016 > New Revision: 307648 > URL: https://svnweb.freebsd.org/changeset/base/307648 >=20 > Log: > Fix MK_SHAREDOCS test from r306864 >=20 > Groff is needed only if MK_GROFF and MK_SHAREDOCS are both true. Thank you!! -Ngie > Modified: > head/Makefile.inc1 >=20 > Modified: head/Makefile.inc1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/Makefile.inc1 Wed Oct 19 17:32:38 2016 (r307647) > +++ head/Makefile.inc1 Wed Oct 19 17:42:45 2016 (r307648) > @@ -1586,7 +1586,7 @@ _strfile=3D usr.bin/fortune/strfile > _gperf=3D gnu/usr.bin/gperf > .endif >=20 > -.if ${MK_SHAREDOCS} !=3D "no" || ${MK_GROFF} !=3D "no" > +.if ${MK_SHAREDOCS} !=3D "no" && ${MK_GROFF} !=3D "no" > _groff=3D gnu/usr.bin/groff \ > usr.bin/soelim > .endif >=20 From owner-svn-src-all@freebsd.org Wed Oct 19 18:05:47 2016 Return-Path: Delivered-To: svn-src-all@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 86910C197AB; Wed, 19 Oct 2016 18:05:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 632A1CB2; Wed, 19 Oct 2016 18:05:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 8B37110AF92; Wed, 19 Oct 2016 14:05:39 -0400 (EDT) From: John Baldwin To: Warner Losh Cc: Doug Ambrisko , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Doug Ambrisko , Ravi Pokala Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader Date: Wed, 19 Oct 2016 10:34:49 -0700 Message-ID: <1660864.e2huCtGy6v@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201610141710.u9EHArlL089412@repo.freebsd.org> <3841347.BNPZXPm7N3@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 19 Oct 2016 14:05:39 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 18:05:47 -0000 On Wednesday, October 19, 2016 02:01:18 AM Warner Losh wrote: > One of my systems would export these as sysctls: > > smbios.bios.reldate="07/05/2013" > smbios.bios.vendor="American Megatrends Inc." > smbios.bios.version="3.00" > smbios.chassis.maker="Supermicro" > smbios.chassis.serial="0123456789" > smbios.chassis.tag="To Be Filled By O.E.M." > smbios.chassis.version="0123456789" > smbios.memory.enabled="268435456" > smbios.planar.location="To be filled by O.E.M." > smbios.planar.maker="Supermicro" > smbios.planar.product="X9SRH-7F/7TF" > smbios.planar.serial="VM13CS028237" > smbios.planar.tag="To be filled by O.E.M." > smbios.planar.version="0123456789" > smbios.socket.enabled="1" > smbios.socket.populated="1" > smbios.system.family="To be filled by O.E.M." > smbios.system.maker="Supermicro" > smbios.system.product="X9SRH-7F/7TF" > smbios.system.serial="0123456789" > smbios.system.sku="To be filled by O.E.M." > smbios.system.uuid="00000000-0000-0000-0000-002590e4d0ec" > smbios.system.version="0123456789" > smbios.version="2.7" > > though some of them are silly due to the BIOS writer being silly... So are you planning to just duplicate the existing kenv vars as sysctl nodes? Can't you parse the output of kenv instead? -- John Baldwin From owner-svn-src-all@freebsd.org Wed Oct 19 18:15:45 2016 Return-Path: Delivered-To: svn-src-all@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 BD269C19C1D; Wed, 19 Oct 2016 18:15:45 +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 6C623924; Wed, 19 Oct 2016 18:15:45 +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 u9JIFiHt077438; Wed, 19 Oct 2016 18:15:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JIFi1d077437; Wed, 19 Oct 2016 18:15:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610191815.u9JIFi1d077437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 19 Oct 2016 18:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307649 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 18:15:45 -0000 Author: kib Date: Wed Oct 19 18:15:44 2016 New Revision: 307649 URL: https://svnweb.freebsd.org/changeset/base/307649 Log: Partial workaround for Intel PCI adapters reading past the end of the host-programmed DMA regions. This change seemingly fixes the descriptor fetches, but the packet memory accesses are left problematic. Reviewed by: emaste, erj, sbruno Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D8282 Modified: head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Wed Oct 19 17:42:45 2016 (r307648) +++ head/sys/dev/e1000/if_lem.c Wed Oct 19 18:15:44 2016 (r307649) @@ -543,8 +543,16 @@ lem_attach(device_t dev) */ adapter->hw.mac.report_tx_early = 1; - tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc), - EM_DBA_ALIGN); + /* + * It seems that the descriptor DMA engine on some PCI cards + * fetches memory past the end of the last descriptor in the + * ring. These reads are problematic when VT-d (DMAR) busdma + * is used. Allocate the scratch space to avoid getting + * faults from DMAR, by requesting scratch memory for one more + * descriptor. + */ + tsize = roundup2((adapter->num_tx_desc + 1) * + sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); /* Allocate Transmit Descriptor ring */ if (lem_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) { @@ -555,8 +563,11 @@ lem_attach(device_t dev) adapter->tx_desc_base = (struct e1000_tx_desc *)adapter->txdma.dma_vaddr; - rsize = roundup2(adapter->num_rx_desc * sizeof(struct e1000_rx_desc), - EM_DBA_ALIGN); + /* + * See comment above txdma allocation for rationale behind +1. + */ + rsize = roundup2((adapter->num_rx_desc + 1) * + sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); /* Allocate Receive Descriptor ring */ if (lem_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) { From owner-svn-src-all@freebsd.org Wed Oct 19 18:29:53 2016 Return-Path: Delivered-To: svn-src-all@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 5A246C18135; Wed, 19 Oct 2016 18:29:53 +0000 (UTC) (envelope-from mjg@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 204DF2D8; Wed, 19 Oct 2016 18:29:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JITqrt081247; Wed, 19 Oct 2016 18:29:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JITqhm081246; Wed, 19 Oct 2016 18:29:52 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201610191829.u9JITqhm081246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 19 Oct 2016 18:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307650 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 18:29:53 -0000 Author: mjg Date: Wed Oct 19 18:29:52 2016 New Revision: 307650 URL: https://svnweb.freebsd.org/changeset/base/307650 Log: cache: split negative entry LRU into multiple lists This splits the ncneg_mtx lock while preserving the hit ratio at least during buildworld. Create N dedicated lists for new negative entries. Entries with at least one hit get promoted to the hot list, where they get requeued every M hits. Shrinking demotes one hot entry and performs a round-robin shrinking of regular lists. Reviewed by: kib Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Oct 19 18:15:44 2016 (r307649) +++ head/sys/kern/vfs_cache.c Wed Oct 19 18:29:52 2016 (r307650) @@ -84,8 +84,10 @@ SDT_PROBE_DEFINE1(vfs, namecache, purge_ SDT_PROBE_DEFINE1(vfs, namecache, purgevfs, done, "struct mount *"); SDT_PROBE_DEFINE3(vfs, namecache, zap, done, "struct vnode *", "char *", "struct vnode *"); -SDT_PROBE_DEFINE2(vfs, namecache, zap_negative, done, "struct vnode *", - "char *"); +SDT_PROBE_DEFINE3(vfs, namecache, zap_negative, done, "struct vnode *", + "char *", "int"); +SDT_PROBE_DEFINE3(vfs, namecache, shrink_negative, done, "struct vnode *", + "char *", "int"); /* * This structure describes the elements in the cache of recent @@ -97,7 +99,10 @@ struct namecache { LIST_ENTRY(namecache) nc_src; /* source vnode list */ TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ struct vnode *nc_dvp; /* vnode of parent of name */ - struct vnode *nc_vp; /* vnode the name refers to */ + union { + struct vnode *nu_vp; /* vnode the name refers to */ + u_int nu_neghits; /* negative entry hits */ + } n_un; u_char nc_flag; /* flag bits */ u_char nc_nlen; /* length of name */ char nc_name[0]; /* segment name + nul */ @@ -116,7 +121,10 @@ struct namecache_ts { LIST_ENTRY(namecache) nc_src; /* source vnode list */ TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ struct vnode *nc_dvp; /* vnode of parent of name */ - struct vnode *nc_vp; /* vnode the name refers to */ + union { + struct vnode *nu_vp; /* vnode the name refers to */ + u_int nu_neghits; /* negative entry hits */ + } n_un; u_char nc_flag; /* flag bits */ u_char nc_nlen; /* length of name */ struct timespec nc_time; /* timespec provided by fs */ @@ -125,6 +133,9 @@ struct namecache_ts { char nc_name[0]; /* segment name + nul */ }; +#define nc_vp n_un.nu_vp +#define nc_neghits n_un.nu_neghits + /* * Flags in namecache.nc_flag */ @@ -133,6 +144,8 @@ struct namecache_ts { #define NCF_TS 0x04 #define NCF_DTS 0x08 #define NCF_DVDROP 0x10 +#define NCF_NEGATIVE 0x20 +#define NCF_HOTNEGATIVE 0x40 /* * Name caching works as follows: @@ -154,7 +167,7 @@ struct namecache_ts { * NAME TYPE ROLE * vnodelock mtx vnode lists and v_cache_dd field protection * bucketlock rwlock for access to given set of hash buckets - * ncneg_mtx mtx negative entry LRU management + * neglist mtx negative entry LRU management * * Additionally, ncneg_shrink_lock mtx is used to have at most one thread * shrinking the LRU list. @@ -188,7 +201,6 @@ struct namecache_ts { #define NCHHASH(hash) \ (&nchashtbl[(hash) & nchash]) static LIST_HEAD(nchashhead, namecache) *nchashtbl; /* Hash Table */ -static TAILQ_HEAD(, namecache) ncneg; /* Hash Table */ static u_long nchash; /* size of hash table */ SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0, "Size of namecache hash table"); @@ -210,6 +222,9 @@ SYSCTL_UINT(_vfs, OID_AUTO, ncsizefactor static u_int ncpurgeminvnodes; SYSCTL_UINT(_vfs, OID_AUTO, ncpurgeminvnodes, CTLFLAG_RW, &ncpurgeminvnodes, 0, "Number of vnodes below which purgevfs ignores the request"); +static u_int ncneghitsrequeue = 8; +SYSCTL_UINT(_vfs, OID_AUTO, ncneghitsrequeue, CTLFLAG_RW, &ncneghitsrequeue, 0, + "Number of hits to requeue a negative entry in the LRU list"); struct nchstats nchstats; /* cache effectiveness statistics */ @@ -217,8 +232,23 @@ static struct mtx ncneg_shrink_loc MTX_SYSINIT(vfscache_shrink_neg, &ncneg_shrink_lock, "Name Cache shrink neg", MTX_DEF); -static struct mtx_padalign ncneg_mtx; -MTX_SYSINIT(vfscache_neg, &ncneg_mtx, "ncneg", MTX_DEF); +struct neglist { + struct mtx nl_lock; + TAILQ_HEAD(, namecache) nl_list; +} __aligned(CACHE_LINE_SIZE); + +static struct neglist *neglists; +static struct neglist ncneg_hot; + +static int shrink_list_turn; + +static u_int numneglists; +static inline struct neglist * +NCP2NEGLIST(struct namecache *ncp) +{ + + return (&neglists[(((uintptr_t)(ncp) >> 8) % numneglists)]); +} static u_int numbucketlocks; static struct rwlock_padalign *bucketlocks; @@ -623,78 +653,187 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, n /* * Negative entries management + * + * A variation of LRU scheme is used. New entries are hashed into one of + * numneglists cold lists. Entries get promoted to the hot list on first hit. + * Partial LRU for the hot list is maintained by requeueing them every + * ncneghitsrequeue hits. + * + * The shrinker will demote hot list head and evict from the cold list in a + * round-robin manner. */ static void cache_negative_hit(struct namecache *ncp) { + struct neglist *neglist; + u_int hits; - MPASS(ncp->nc_vp == NULL); - mtx_lock(&ncneg_mtx); - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - mtx_unlock(&ncneg_mtx); + MPASS(ncp->nc_flag & NCF_NEGATIVE); + hits = atomic_fetchadd_int(&ncp->nc_neghits, 1); + if (ncp->nc_flag & NCF_HOTNEGATIVE) { + if ((hits % ncneghitsrequeue) != 0) + return; + mtx_lock(&ncneg_hot.nl_lock); + if (ncp->nc_flag & NCF_HOTNEGATIVE) { + TAILQ_REMOVE(&ncneg_hot.nl_list, ncp, nc_dst); + TAILQ_INSERT_TAIL(&ncneg_hot.nl_list, ncp, nc_dst); + mtx_unlock(&ncneg_hot.nl_lock); + return; + } + /* + * The shrinker cleared the flag and removed the entry from + * the hot list. Put it back. + */ + } else { + mtx_lock(&ncneg_hot.nl_lock); + } + neglist = NCP2NEGLIST(ncp); + mtx_lock(&neglist->nl_lock); + if (!(ncp->nc_flag & NCF_HOTNEGATIVE)) { + TAILQ_REMOVE(&neglist->nl_list, ncp, nc_dst); + TAILQ_INSERT_TAIL(&ncneg_hot.nl_list, ncp, nc_dst); + ncp->nc_flag |= NCF_HOTNEGATIVE; + } + mtx_unlock(&neglist->nl_lock); + mtx_unlock(&ncneg_hot.nl_lock); } static void -cache_negative_insert(struct namecache *ncp) +cache_negative_insert(struct namecache *ncp, bool neg_locked) { + struct neglist *neglist; - MPASS(ncp->nc_vp == NULL); + MPASS(ncp->nc_flag & NCF_NEGATIVE); cache_assert_bucket_locked(ncp, RA_WLOCKED); - mtx_lock(&ncneg_mtx); - TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - numneg++; - mtx_unlock(&ncneg_mtx); + neglist = NCP2NEGLIST(ncp); + if (!neg_locked) { + mtx_lock(&neglist->nl_lock); + } else { + mtx_assert(&neglist->nl_lock, MA_OWNED); + } + TAILQ_INSERT_TAIL(&neglist->nl_list, ncp, nc_dst); + if (!neg_locked) + mtx_unlock(&neglist->nl_lock); + atomic_add_rel_long(&numneg, 1); } static void cache_negative_remove(struct namecache *ncp, bool neg_locked) { + struct neglist *neglist; + bool hot_locked = false; + bool list_locked = false; - MPASS(ncp->nc_vp == NULL); + MPASS(ncp->nc_flag & NCF_NEGATIVE); cache_assert_bucket_locked(ncp, RA_WLOCKED); - if (!neg_locked) - mtx_lock(&ncneg_mtx); - else - mtx_assert(&ncneg_mtx, MA_OWNED); - TAILQ_REMOVE(&ncneg, ncp, nc_dst); - numneg--; - if (!neg_locked) - mtx_unlock(&ncneg_mtx); + neglist = NCP2NEGLIST(ncp); + if (!neg_locked) { + if (ncp->nc_flag & NCF_HOTNEGATIVE) { + hot_locked = true; + mtx_lock(&ncneg_hot.nl_lock); + if (!(ncp->nc_flag & NCF_HOTNEGATIVE)) { + list_locked = true; + mtx_lock(&neglist->nl_lock); + } + } else { + list_locked = true; + mtx_lock(&neglist->nl_lock); + } + } else { + mtx_assert(&neglist->nl_lock, MA_OWNED); + mtx_assert(&ncneg_hot.nl_lock, MA_OWNED); + } + if (ncp->nc_flag & NCF_HOTNEGATIVE) { + TAILQ_REMOVE(&ncneg_hot.nl_list, ncp, nc_dst); + } else { + TAILQ_REMOVE(&neglist->nl_list, ncp, nc_dst); + } + if (list_locked) + mtx_unlock(&neglist->nl_lock); + if (hot_locked) + mtx_unlock(&ncneg_hot.nl_lock); + atomic_subtract_rel_long(&numneg, 1); +} + +static void +cache_negative_shrink_select(int start, struct namecache **ncpp, + struct neglist **neglistpp) +{ + struct neglist *neglist; + struct namecache *ncp; + int i; + + for (i = start; i < numneglists; i++) { + neglist = &neglists[i]; + if (TAILQ_FIRST(&neglist->nl_list) == NULL) + continue; + mtx_lock(&neglist->nl_lock); + ncp = TAILQ_FIRST(&neglist->nl_list); + if (ncp != NULL) + break; + mtx_unlock(&neglist->nl_lock); + } + + *neglistpp = neglist; + *ncpp = ncp; } static void cache_negative_zap_one(void) { - struct namecache *ncp, *ncp2; + struct namecache *ncp, *ncp2, *ncpc; + struct neglist *neglist; struct mtx *dvlp; struct rwlock *blp; if (!mtx_trylock(&ncneg_shrink_lock)) return; - mtx_lock(&ncneg_mtx); - ncp = TAILQ_FIRST(&ncneg); + ncpc = NULL; + mtx_lock(&ncneg_hot.nl_lock); + ncp = TAILQ_FIRST(&ncneg_hot.nl_list); + if (ncp != NULL) { + neglist = NCP2NEGLIST(ncp); + mtx_lock(&neglist->nl_lock); + TAILQ_REMOVE(&ncneg_hot.nl_list, ncp, nc_dst); + TAILQ_INSERT_TAIL(&neglist->nl_list, ncp, nc_dst); + ncp->nc_flag &= ~NCF_HOTNEGATIVE; + mtx_unlock(&neglist->nl_lock); + } + + cache_negative_shrink_select(shrink_list_turn, &ncp, &neglist); + shrink_list_turn++; + if (shrink_list_turn == numneglists) + shrink_list_turn = 0; + if (ncp == NULL && shrink_list_turn == 0) + cache_negative_shrink_select(shrink_list_turn, &ncp, &neglist); if (ncp == NULL) { - mtx_unlock(&ncneg_mtx); + mtx_unlock(&ncneg_hot.nl_lock); goto out; } - MPASS(ncp->nc_vp == NULL); + + MPASS(ncp->nc_flag & NCF_NEGATIVE); dvlp = VP2VNODELOCK(ncp->nc_dvp); blp = NCP2BUCKETLOCK(ncp); - mtx_unlock(&ncneg_mtx); + mtx_unlock(&neglist->nl_lock); + mtx_unlock(&ncneg_hot.nl_lock); mtx_lock(dvlp); rw_wlock(blp); - mtx_lock(&ncneg_mtx); - ncp2 = TAILQ_FIRST(&ncneg); + mtx_lock(&ncneg_hot.nl_lock); + mtx_lock(&neglist->nl_lock); + ncp2 = TAILQ_FIRST(&neglist->nl_list); if (ncp != ncp2 || dvlp != VP2VNODELOCK(ncp2->nc_dvp) || - blp != NCP2BUCKETLOCK(ncp2) || ncp2->nc_vp != NULL) { + blp != NCP2BUCKETLOCK(ncp2) || !(ncp2->nc_flag & NCF_NEGATIVE)) { ncp = NULL; goto out_unlock_all; } + SDT_PROBE3(vfs, namecache, shrink_negative, done, ncp->nc_dvp, + nc_get_name(ncp), ncp->nc_neghits); + cache_zap_locked(ncp, true); out_unlock_all: - mtx_unlock(&ncneg_mtx); + mtx_unlock(&neglist->nl_lock); + mtx_unlock(&ncneg_hot.nl_lock); rw_wunlock(blp); mtx_unlock(dvlp); out: @@ -712,17 +851,19 @@ static void cache_zap_locked(struct namecache *ncp, bool neg_locked) { - cache_assert_vnode_locked(ncp->nc_vp); + if (!(ncp->nc_flag & NCF_NEGATIVE)) + cache_assert_vnode_locked(ncp->nc_vp); cache_assert_vnode_locked(ncp->nc_dvp); cache_assert_bucket_locked(ncp, RA_WLOCKED); - CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); - if (ncp->nc_vp != NULL) { + CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, + (ncp->nc_flag & NCF_NEGATIVE) ? NULL : ncp->nc_vp); + if (!(ncp->nc_flag & NCF_NEGATIVE)) { SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, nc_get_name(ncp), ncp->nc_vp); } else { - SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp, - nc_get_name(ncp)); + SDT_PROBE3(vfs, namecache, zap_negative, done, ncp->nc_dvp, + nc_get_name(ncp), ncp->nc_neghits); } LIST_REMOVE(ncp, nc_hash); if (ncp->nc_flag & NCF_ISDOTDOT) { @@ -735,7 +876,7 @@ cache_zap_locked(struct namecache *ncp, atomic_subtract_rel_long(&numcachehv, 1); } } - if (ncp->nc_vp) { + if (!(ncp->nc_flag & NCF_NEGATIVE)) { TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); if (ncp == ncp->nc_vp->v_cache_dd) ncp->nc_vp->v_cache_dd = NULL; @@ -751,7 +892,7 @@ cache_zap_negative_locked_vnode_kl(struc struct rwlock *blp; MPASS(ncp->nc_dvp == vp); - MPASS(ncp->nc_vp == NULL); + MPASS(ncp->nc_flag & NCF_NEGATIVE); cache_assert_vnode_locked(vp); blp = NCP2BUCKETLOCK(ncp); @@ -770,7 +911,7 @@ cache_zap_locked_vnode_kl2(struct nameca MPASS(vp == ncp->nc_dvp || vp == ncp->nc_vp); cache_assert_vnode_locked(vp); - if (ncp->nc_vp == NULL) { + if (ncp->nc_flag & NCF_NEGATIVE) { if (*vlpp != NULL) { mtx_unlock(*vlpp); *vlpp = NULL; @@ -829,7 +970,7 @@ cache_zap_locked_vnode(struct namecache cache_assert_vnode_locked(vp); pvlp = VP2VNODELOCK(vp); - if (ncp->nc_vp == NULL) { + if (ncp->nc_flag & NCF_NEGATIVE) { cache_zap_negative_locked_vnode_kl(ncp, vp); goto out; } @@ -865,7 +1006,9 @@ cache_zap_rlocked_bucket(struct namecach cache_assert_bucket_locked(ncp, RA_RLOCKED); dvlp = VP2VNODELOCK(ncp->nc_dvp); - vlp = VP2VNODELOCK(ncp->nc_vp); + vlp = NULL; + if (!(ncp->nc_flag & NCF_NEGATIVE)) + vlp = VP2VNODELOCK(ncp->nc_vp); if (cache_trylock_vnodes(dvlp, vlp) == 0) { rw_runlock(blp); rw_wlock(blp); @@ -888,7 +1031,9 @@ cache_zap_wlocked_bucket_kl(struct namec cache_assert_bucket_locked(ncp, RA_WLOCKED); dvlp = VP2VNODELOCK(ncp->nc_dvp); - vlp = VP2VNODELOCK(ncp->nc_vp); + vlp = NULL; + if (!(ncp->nc_flag & NCF_NEGATIVE)) + vlp = VP2VNODELOCK(ncp->nc_vp); cache_sort(&dvlp, &vlp); if (*vlpp1 == dvlp && *vlpp2 == vlp) { @@ -1034,9 +1179,12 @@ retry_dotdot: } return (0); } - if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) - *vpp = ncp->nc_vp; - else + if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) { + if (ncp->nc_flag & NCF_NEGATIVE) + *vpp = NULL; + else + *vpp = ncp->nc_vp; + } else *vpp = ncp->nc_dvp; /* Return failure if negative entry was found. */ if (*vpp == NULL) @@ -1084,7 +1232,7 @@ retry_dotdot: } /* We found a "positive" match, return the vnode */ - if (ncp->nc_vp) { + if (!(ncp->nc_flag & NCF_NEGATIVE)) { counter_u64_add(numposhits, 1); *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", @@ -1226,8 +1374,7 @@ cache_lock_vnodes_cel_3(struct celocksta MPASS(cel->vlp[2] == NULL); vlp = VP2VNODELOCK(vp); - if (vlp == NULL) - return (true); + MPASS(vlp != NULL); ret = true; if (vlp >= cel->vlp[1]) { @@ -1312,6 +1459,8 @@ cache_enter_lock(struct celockstate *cel break; MPASS(ncp->nc_dvp == vp); blps[1] = NCP2BUCKETLOCK(ncp); + if (ncp->nc_flag & NCF_NEGATIVE) + break; if (cache_lock_vnodes_cel_3(cel, ncp->nc_vp)) break; /* @@ -1349,6 +1498,8 @@ cache_enter_lock_dd(struct celockstate * break; MPASS(ncp->nc_dvp == dvp); blps[1] = NCP2BUCKETLOCK(ncp); + if (ncp->nc_flag & NCF_NEGATIVE) + break; if (cache_lock_vnodes_cel_3(cel, ncp->nc_vp)) break; if (ncp == dvp->v_cache_dd && @@ -1383,9 +1534,11 @@ cache_enter_time(struct vnode *dvp, stru struct namecache *ncp, *n2, *ndd; struct namecache_ts *n3; struct nchashhead *ncpp; + struct neglist *neglist; uint32_t hash; int flag; int len; + bool neg_locked; CTR3(KTR_VFS, "cache_enter(%p, %p, %s)", dvp, vp, cnp->cn_nameptr); VNASSERT(vp == NULL || (vp->v_iflag & VI_DOOMED) == 0, vp, @@ -1421,17 +1574,31 @@ cache_enter_time(struct vnode *dvp, stru ncp->nc_flag & NCF_ISDOTDOT) { KASSERT(ncp->nc_dvp == dvp, ("wrong isdotdot parent")); - if (ncp->nc_vp != NULL) { + neg_locked = false; + if (ncp->nc_flag & NCF_NEGATIVE || vp == NULL) { + neglist = NCP2NEGLIST(ncp); + mtx_lock(&ncneg_hot.nl_lock); + mtx_lock(&neglist->nl_lock); + neg_locked = true; + } + if (!(ncp->nc_flag & NCF_NEGATIVE)) { TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); } else { - cache_negative_remove(ncp, false); + cache_negative_remove(ncp, true); } if (vp != NULL) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); + ncp->nc_flag &= ~(NCF_NEGATIVE|NCF_HOTNEGATIVE); } else { - cache_negative_insert(ncp); + ncp->nc_flag &= ~(NCF_HOTNEGATIVE); + ncp->nc_flag |= NCF_NEGATIVE; + cache_negative_insert(ncp, true); + } + if (neg_locked) { + mtx_unlock(&neglist->nl_lock); + mtx_unlock(&ncneg_hot.nl_lock); } ncp->nc_vp = vp; cache_enter_unlock(&cel); @@ -1450,9 +1617,11 @@ cache_enter_time(struct vnode *dvp, stru * namecache entry as possible before acquiring the lock. */ ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); + ncp->nc_flag = flag; ncp->nc_vp = vp; + if (vp == NULL) + ncp->nc_flag |= NCF_NEGATIVE; ncp->nc_dvp = dvp; - ncp->nc_flag = flag; if (tsp != NULL) { n3 = (struct namecache_ts *)ncp; n3->nc_time = *tsp; @@ -1490,7 +1659,11 @@ cache_enter_time(struct vnode *dvp, stru n3->nc_dotdottime = ((struct namecache_ts *)ncp)-> nc_dotdottime; + if (ncp->nc_flag & NCF_NEGATIVE) + mtx_lock(&ncneg_hot.nl_lock); n3->nc_flag |= NCF_DTS; + if (ncp->nc_flag & NCF_NEGATIVE) + mtx_unlock(&ncneg_hot.nl_lock); } } goto out_unlock_free; @@ -1557,7 +1730,7 @@ cache_enter_time(struct vnode *dvp, stru } else { if (cnp->cn_flags & ISWHITEOUT) ncp->nc_flag |= NCF_WHITE; - cache_negative_insert(ncp); + cache_negative_insert(ncp, false); SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, nc_get_name(ncp)); } @@ -1591,8 +1764,6 @@ nchinit(void *dummy __unused) { u_int i; - TAILQ_INIT(&ncneg); - cache_zone_small = uma_zcreate("S VFS Cache", sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); @@ -1619,6 +1790,16 @@ nchinit(void *dummy __unused) mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE); ncpurgeminvnodes = numbucketlocks; + numneglists = 4; + neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE, + M_WAITOK | M_ZERO); + for (i = 0; i < numneglists; i++) { + mtx_init(&neglists[i].nl_lock, "ncnegl", NULL, MTX_DEF); + TAILQ_INIT(&neglists[i].nl_list); + } + mtx_init(&ncneg_hot.nl_lock, "ncneglh", NULL, MTX_DEF); + TAILQ_INIT(&ncneg_hot.nl_list); + numcalls = counter_u64_alloc(M_WAITOK); dothits = counter_u64_alloc(M_WAITOK); dotdothits = counter_u64_alloc(M_WAITOK); @@ -1741,7 +1922,7 @@ cache_purge_negative(struct vnode *vp) vlp = VP2VNODELOCK(vp); mtx_lock(vlp); LIST_FOREACH_SAFE(ncp, &vp->v_cache_src, nc_src, nnp) { - if (ncp->nc_vp != NULL) + if (!(ncp->nc_flag & NCF_NEGATIVE)) continue; cache_zap_negative_locked_vnode_kl(ncp, vp); TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); From owner-svn-src-all@freebsd.org Wed Oct 19 18:45:07 2016 Return-Path: Delivered-To: svn-src-all@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 CF2F3C1876F; Wed, 19 Oct 2016 18:45:07 +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 8688FFFE; Wed, 19 Oct 2016 18:45:07 +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 u9JIj6Cr088748; Wed, 19 Oct 2016 18:45:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JIj6p3088747; Wed, 19 Oct 2016 18:45:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201610191845.u9JIj6p3088747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Oct 2016 18:45:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307651 - head/sys/dev/sound/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 18:45:07 -0000 Author: hselasky Date: Wed Oct 19 18:45:06 2016 New Revision: 307651 URL: https://svnweb.freebsd.org/changeset/base/307651 Log: Add support for adjusting the hardware buffering delay for USB audio. Requested by: Goran Mekic MFC after: 1 week Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Wed Oct 19 18:29:52 2016 (r307650) +++ head/sys/dev/sound/usb/uaudio.c Wed Oct 19 18:45:06 2016 (r307651) @@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$"); static int uaudio_default_rate = 0; /* use rate list */ static int uaudio_default_bits = 32; static int uaudio_default_channels = 0; /* use default */ +static int uaudio_buffer_ms = 8; #ifdef USB_DEBUG static int uaudio_debug = 0; @@ -109,9 +110,32 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def &uaudio_default_bits, 0, "uaudio default sample bits"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RWTUN, &uaudio_default_channels, 0, "uaudio default sample channels"); + +static int +uaudio_buffer_ms_sysctl(SYSCTL_HANDLER_ARGS) +{ + int err, val; + + val = uaudio_buffer_ms; + err = sysctl_handle_int(oidp, &val, 0, req); + + if (err != 0 || req->newptr == NULL || val == uaudio_buffer_ms) + return (err); + + if (val > 8) + val = 8; + else if (val < 2) + val = 2; + + uaudio_buffer_ms = val; + + return (0); +} +SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN, + 0, sizeof(int), uaudio_buffer_ms_sysctl, "I", + "uaudio buffering delay from 2ms to 8ms"); #endif -#define UAUDIO_IRQS (8000 / UAUDIO_NFRAMES) /* interrupts per second */ #define UAUDIO_NFRAMES 64 /* must be factor of 8 due HS-USB */ #define UAUDIO_NCHANBUFS 2 /* number of outstanding request */ #define UAUDIO_RECURSE_LIMIT 255 /* rounds */ @@ -1278,10 +1302,10 @@ uaudio_configure_msg_sub(struct uaudio_s if (fps < 8000) { /* FULL speed USB */ - frames = 8; + frames = uaudio_buffer_ms; } else { /* HIGH speed USB */ - frames = UAUDIO_NFRAMES; + frames = uaudio_buffer_ms * 8; } fps_shift = usbd_xfer_get_fps_shift(chan->xfer[0]); @@ -2158,8 +2182,9 @@ tr_setup: } /* start the SYNC transfer one time per second, if any */ - if (++(ch->intr_counter) >= UAUDIO_IRQS) { - ch->intr_counter = 0; + ch->intr_counter += ch->intr_frames; + if (ch->intr_counter >= ch->frames_per_second) { + ch->intr_counter -= ch->frames_per_second; usbd_transfer_start(ch->xfer[UAUDIO_NCHANBUFS]); } From owner-svn-src-all@freebsd.org Wed Oct 19 19:32:08 2016 Return-Path: Delivered-To: svn-src-all@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 1F409C175E4; Wed, 19 Oct 2016 19:32:08 +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 E2E13FB5; Wed, 19 Oct 2016 19:32:07 +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 u9JJW7pM005034; Wed, 19 Oct 2016 19:32:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JJW7C4005033; Wed, 19 Oct 2016 19:32:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610191932.u9JJW7C4005033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 19:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307652 - head/gnu/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 19:32:08 -0000 Author: emaste Date: Wed Oct 19 19:32:06 2016 New Revision: 307652 URL: https://svnweb.freebsd.org/changeset/base/307652 Log: Switch gnu/lib/Makefile to SUBDIR.${MK_*} optional subdir style Compound conditions are left unchanged Modified: head/gnu/lib/Makefile Modified: head/gnu/lib/Makefile ============================================================================== --- head/gnu/lib/Makefile Wed Oct 19 18:45:06 2016 (r307651) +++ head/gnu/lib/Makefile Wed Oct 19 19:32:06 2016 (r307652) @@ -5,18 +5,9 @@ SUBDIR= csu libgcc libregex SUBDIR.${MK_DIALOG}+= libdialog - -.if ${MK_GCC} != "no" -SUBDIR+= libgcov libgomp -.endif - -.if ${MK_SSP} != "no" -SUBDIR+= libssp -.endif - -.if ${MK_TESTS} != "no" -SUBDIR+= tests -.endif +SUBDIR.${MK_GCC}+= libgcov libgomp +SUBDIR.${MK_SSP}+= libssp +SUBDIR.${MK_TESTS}+= tests .if ${MK_BINUTILS} != "no" && ${MK_GDB} != "no" SUBDIR+= libreadline From owner-svn-src-all@freebsd.org Wed Oct 19 19:42:02 2016 Return-Path: Delivered-To: svn-src-all@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 D1B1FC177B9; Wed, 19 Oct 2016 19:42:02 +0000 (UTC) (envelope-from mjg@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 A3ED5817; Wed, 19 Oct 2016 19:42:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JJg11K011584; Wed, 19 Oct 2016 19:42:01 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JJg1e9011581; Wed, 19 Oct 2016 19:42:01 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201610191942.u9JJg1e9011581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 19 Oct 2016 19:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307653 - in head/sys: kern x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 19:42:02 -0000 Author: mjg Date: Wed Oct 19 19:42:01 2016 New Revision: 307653 URL: https://svnweb.freebsd.org/changeset/base/307653 Log: Mark a bunch of mpsafe sysctls as such. This gives me a sysctl Giant-free buildworld. Modified: head/sys/kern/kern_exec.c head/sys/kern/kern_mib.c head/sys/x86/x86/identcpu.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Wed Oct 19 19:32:06 2016 (r307652) +++ head/sys/kern/kern_exec.c Wed Oct 19 19:42:01 2016 (r307653) @@ -118,14 +118,14 @@ static int do_execve(struct thread *td, struct mac *mac_p); /* XXX This should be vm_size_t. */ -SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD, - NULL, 0, sysctl_kern_ps_strings, "LU", ""); +SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD| + CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_ps_strings, "LU", ""); /* XXX This should be vm_size_t. */ SYSCTL_PROC(_kern, KERN_USRSTACK, usrstack, CTLTYPE_ULONG|CTLFLAG_RD| - CTLFLAG_CAPRD, NULL, 0, sysctl_kern_usrstack, "LU", ""); + CTLFLAG_CAPRD|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_usrstack, "LU", ""); -SYSCTL_PROC(_kern, OID_AUTO, stackprot, CTLTYPE_INT|CTLFLAG_RD, +SYSCTL_PROC(_kern, OID_AUTO, stackprot, CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, sysctl_kern_stackprot, "I", ""); u_long ps_arg_cache_limit = PAGE_SIZE / 16; Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Wed Oct 19 19:32:06 2016 (r307652) +++ head/sys/kern/kern_mib.c Wed Oct 19 19:42:01 2016 (r307653) @@ -135,7 +135,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */ -SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW, +SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE, kernelname, sizeof kernelname, "Name of kernel file booted"); SYSCTL_INT(_kern, KERN_MAXPHYS, maxphys, CTLFLAG_RD | CTLFLAG_CAPRD, @@ -257,8 +257,9 @@ sysctl_hw_machine_arch(SYSCTL_HANDLER_AR return (error); } -SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD, - NULL, 0, sysctl_hw_machine_arch, "A", "System architecture"); +SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD | + CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A", + "System architecture"); SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, #ifdef COMPAT_FREEBSD32 @@ -386,8 +387,8 @@ SYSCTL_PROC(_kern, KERN_SECURELVL, secur /* Actual kernel configuration options. */ extern char kernconfstring[]; -SYSCTL_STRING(_kern, OID_AUTO, conftxt, CTLFLAG_RD, kernconfstring, 0, - "Kernel configuration file"); +SYSCTL_STRING(_kern, OID_AUTO, conftxt, CTLFLAG_RD | CTLFLAG_MPSAFE, + kernconfstring, 0, "Kernel configuration file"); #endif static int Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Wed Oct 19 19:32:06 2016 (r307652) +++ head/sys/x86/x86/identcpu.c Wed Oct 19 19:42:01 2016 (r307653) @@ -148,15 +148,15 @@ sysctl_hw_machine(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD, - NULL, 0, sysctl_hw_machine, "A", "Machine class"); +SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD | + CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A", "Machine class"); #else SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "Machine class"); #endif static char cpu_model[128]; -SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, +SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_MPSAFE, cpu_model, 0, "Machine model"); static int hw_clockrate; @@ -165,8 +165,8 @@ SYSCTL_INT(_hw, OID_AUTO, clockrate, CTL u_int hv_high; char hv_vendor[16]; -SYSCTL_STRING(_hw, OID_AUTO, hv_vendor, CTLFLAG_RD, hv_vendor, 0, - "Hypervisor vendor"); +SYSCTL_STRING(_hw, OID_AUTO, hv_vendor, CTLFLAG_RD | CTLFLAG_MPSAFE, hv_vendor, + 0, "Hypervisor vendor"); static eventhandler_tag tsc_post_tag; From owner-svn-src-all@freebsd.org Wed Oct 19 19:50:10 2016 Return-Path: Delivered-To: svn-src-all@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 AD8E4C17A7D; Wed, 19 Oct 2016 19:50:10 +0000 (UTC) (envelope-from glebius@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 7A57AC31; Wed, 19 Oct 2016 19:50:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JJo9OC011927; Wed, 19 Oct 2016 19:50:09 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JJo9WN011926; Wed, 19 Oct 2016 19:50:09 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201610191950.u9JJo9WN011926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 19 Oct 2016 19:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307654 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 19:50:10 -0000 Author: glebius Date: Wed Oct 19 19:50:09 2016 New Revision: 307654 URL: https://svnweb.freebsd.org/changeset/base/307654 Log: Fix incorrect assertion that could miss overflows. Reviewed by: kib Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Oct 19 19:42:01 2016 (r307653) +++ head/sys/vm/vnode_pager.c Wed Oct 19 19:50:09 2016 (r307654) @@ -953,7 +953,7 @@ vnode_pager_generic_getpages(struct vnod if (a_rahead) *a_rahead = bp->b_pgafter; - KASSERT(bp->b_npages <= sizeof(bp->b_pages), + KASSERT(bp->b_npages <= nitems(bp->b_pages), ("%s: buf %p overflowed", __func__, bp)); /* From owner-svn-src-all@freebsd.org Wed Oct 19 19:57:37 2016 Return-Path: Delivered-To: svn-src-all@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 68C45C17D09; Wed, 19 Oct 2016 19:57:37 +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 3813F10DB; Wed, 19 Oct 2016 19:57:37 +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 u9JJvakL015708; Wed, 19 Oct 2016 19:57:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JJvaA2015707; Wed, 19 Oct 2016 19:57:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610191957.u9JJvaA2015707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 19:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307655 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 19:57:37 -0000 Author: emaste Date: Wed Oct 19 19:57:36 2016 New Revision: 307655 URL: https://svnweb.freebsd.org/changeset/base/307655 Log: Force MK_GDB to no if MK_BINUTILS == no This is currently encoded in conditional blocks in gnu/lib/Makefile and gnu/usr.bin/Makefile. Set it via src.opts.mk to make GDB's dependency on binutils more clear. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Oct 19 19:50:09 2016 (r307654) +++ head/share/mk/src.opts.mk Wed Oct 19 19:57:36 2016 (r307655) @@ -300,6 +300,10 @@ MK_${var}:= no MK_LLVM_LIBUNWIND:= no .endif +.if ${MK_BINUTILS} == "no" +MK_GDB:= no +.endif + .if ${MK_LIBPTHREAD} == "no" MK_LIBTHR:= no .endif From owner-svn-src-all@freebsd.org Wed Oct 19 20:26:59 2016 Return-Path: Delivered-To: svn-src-all@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 9831CC18495; Wed, 19 Oct 2016 20:26:59 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5925C1FB2; Wed, 19 Oct 2016 20:26:59 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id EB9BC35; Wed, 19 Oct 2016 22:26:56 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id DA93428494; Wed, 19 Oct 2016 22:26:56 +0200 (CEST) Date: Wed, 19 Oct 2016 22:26:56 +0200 From: Jilles Tjoelker To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307469 - head/etc Message-ID: <20161019202656.GA58917@stack.nl> References: <201610170407.u9H47D5n033011@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201610170407.u9H47D5n033011@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 20:26:59 -0000 On Mon, Oct 17, 2016 at 04:07:13AM +0000, Warner Losh wrote: > Author: imp > Date: Mon Oct 17 04:07:13 2016 > New Revision: 307469 > URL: https://svnweb.freebsd.org/changeset/base/307469 > Log: > Allow root_rw_mount to be both lower and upper case. Before, if it was > upper case, you'd wind up with a read-only filesystem when you should > sometimes. > PR: 213549 > Modified: > head/etc/rc > Modified: head/etc/rc > ============================================================================== > --- head/etc/rc Mon Oct 17 04:07:12 2016 (r307468) > +++ head/etc/rc Mon Oct 17 04:07:13 2016 (r307469) > @@ -135,16 +135,16 @@ done > # Note: this assumes firstboot_sentinel is on / when we have > # a read-only /, or that it is on media that's writable. > if [ -e ${firstboot_sentinel} ]; then > - [ ${root_rw_mount} = "yes" ] || mount -uw / > + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -uw / > chflags -R 0 ${firstboot_sentinel} > rm -rf ${firstboot_sentinel} > if [ -e ${firstboot_sentinel}-reboot ]; then > chflags -R 0 ${firstboot_sentinel}-reboot > rm -rf ${firstboot_sentinel}-reboot > - [ ${root_rw_mount} = "yes" ] || mount -ur / > + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / > kill -INT 1 > fi > - [ ${root_rw_mount} = "yes" ] || mount -ur / > + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / > fi > > echo '' Although I have not tested this, it looks like this will always do the remounts since the condition is either false or invalid due to missing quotes. Perhaps we can use the checkyesno function from rc.subr or use the same check that rc.d/root uses (case statement where [Nn][Oo] and the empty string are no and the rest is yes). -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Wed Oct 19 20:36:50 2016 Return-Path: Delivered-To: svn-src-all@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 2DE80C18A3C for ; Wed, 19 Oct 2016 20:36:50 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt0-f176.google.com (mail-qt0-f176.google.com [209.85.216.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD316BE1 for ; Wed, 19 Oct 2016 20:36:49 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt0-f176.google.com with SMTP id q7so35495195qtq.1 for ; Wed, 19 Oct 2016 13:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QIUePhRm8peZQ9kGZAv6AvA8nr0FLHN9R/QMOpNY/6Q=; b=u2FTgh4piVMhevBMe+q464oKAz6Xlr0vZdjd8yJoRbYX6oiydN1vJva4AnpJYNyXGM B4/LbYRk0EYlh+vBzIyS0xXMri37QQqnC5OYZojh6DXHsT/RephHlCw2lY04CVr/Abnj Zgyh0T/GdR3jbfs34Rrp+q3YHiptb2KOrAZ6oy2nhR+sepjrlmR7FJrpu02li+XN3HUp VZnzMJ0SC55tGF8V18SWwEBWVUgq/GFPrgZhmV9JI+lt7j7DOluqz6tdCFD5P2yIhbyg UPKyQ52Re65RzLp0jXLosZZjgr+MMMygxigoAnC5Vwj+YD/Ij9GzMxJvuqxqUavU29n5 0T0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QIUePhRm8peZQ9kGZAv6AvA8nr0FLHN9R/QMOpNY/6Q=; b=HSBryhWFIqtVzErM2c1cwf3Ev9AUCRooLeiG7VrmyMGvUglsiijFc8kqnUPbMbFC1R Okr+nvwCM9o4+zBD+K4W4uk5G2q2KDWRxm2QIqNGL5/uYCUgTk2yYhIaey1/ezilm2vb WLTCyKPseJ3fGhlnZa+8bSmGbhDaDDJlUl38r3MZ6m9G9IZ+9ND5o1Y3fj5vHbO3hiQ1 Nh1sr0C8d1hwE4Ma3cknQwau4uSFkqjipZtWWVzMy1n7XUwlkzydz5AgEEsdiRV7v6zg dHBsIJb73CAIG4YKAe9rxWnN4TiVh/0mbxmv2cWiYoY2304/r/KGSrLOJ+S28NfCT3ZW RJeA== X-Gm-Message-State: AA6/9RlJ0tFxllS9PPiRTkZM8RQKbxorbN8vG4fCPn690FSDOSKSvb8FdcS6GjQxAURYdEu8 X-Received: by 10.237.39.71 with SMTP id n65mr8330100qtd.9.1476909343587; Wed, 19 Oct 2016 13:35:43 -0700 (PDT) Received: from mutt-hardenedbsd ([63.88.83.66]) by smtp.gmail.com with ESMTPSA id f16sm10712207qta.9.2016.10.19.13.35.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Oct 2016 13:35:42 -0700 (PDT) Date: Wed, 19 Oct 2016 16:35:40 -0400 From: Shawn Webb To: Luigi Rizzo Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307394 - in head: share/man/man4 sys/conf sys/dev/netmap sys/modules/netmap sys/net tools/tools/netmap Message-ID: <20161019203540.GC94803@mutt-hardenedbsd> References: <201610161413.u9GEDW91013522@repo.freebsd.org> <20161019162324.GA94803@mutt-hardenedbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GyRA7555PLgSTuth" Content-Disposition: inline In-Reply-To: <20161019162324.GA94803@mutt-hardenedbsd> X-Operating-System: FreeBSD mutt-hardenedbsd 12.0-CURRENT-HBSD FreeBSD 12.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x6A84658F52456EEE User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 20:36:50 -0000 --GyRA7555PLgSTuth Content-Type: multipart/mixed; boundary="mvpLiMfbWzRoNl4x" Content-Disposition: inline --mvpLiMfbWzRoNl4x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 19, 2016 at 12:23:24PM -0400, Shawn Webb wrote: > On Sun, Oct 16, 2016 at 02:13:32PM +0000, Luigi Rizzo wrote: > > Author: luigi > > Date: Sun Oct 16 14:13:32 2016 > > New Revision: 307394 > > URL: https://svnweb.freebsd.org/changeset/base/307394 > >=20 > > Log: > > Import the current version of netmap, aligned with the one on github. > > =20 > > This commit, long overdue, contains contributions in the last 2 years > > from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, includ= ing: > > + fixes on monitor ports > > + the 'ptnet' virtual device driver, and ptnetmap backend, for > > high speed virtual passthrough on VMs (bhyve fixes in an upcoming c= ommit) > > + improved emulated netmap mode > > + more robust error handling > > + removal of stale code > > + various fixes to code and documentation (some mixup between RX and = TX > > parameters, and private and public variables) > > =20 > > We also include an additional tool, nmreplay, which is functionally > > equivalent to tcpreplay but operating on netmap ports. > >=20 > > Added: > > head/tools/tools/netmap/ctrs.h (contents, props changed) > > head/tools/tools/netmap/nmreplay.8 (contents, props changed) > > head/tools/tools/netmap/nmreplay.c (contents, props changed) > > Modified: > > head/share/man/man4/netmap.4 > > head/sys/conf/files > > head/sys/dev/netmap/if_ixl_netmap.h > > head/sys/dev/netmap/if_lem_netmap.h > > head/sys/dev/netmap/ixgbe_netmap.h > > head/sys/dev/netmap/netmap.c > > head/sys/dev/netmap/netmap_freebsd.c > > head/sys/dev/netmap/netmap_generic.c > > head/sys/dev/netmap/netmap_kern.h > > head/sys/dev/netmap/netmap_mbq.c > > head/sys/dev/netmap/netmap_mbq.h > > head/sys/dev/netmap/netmap_mem2.c > > head/sys/dev/netmap/netmap_mem2.h > > head/sys/dev/netmap/netmap_monitor.c > > head/sys/dev/netmap/netmap_offloadings.c > > head/sys/dev/netmap/netmap_pipe.c > > head/sys/dev/netmap/netmap_vale.c > > head/sys/modules/netmap/Makefile > > head/sys/net/netmap.h > > head/sys/net/netmap_user.h > > head/tools/tools/netmap/Makefile > > head/tools/tools/netmap/bridge.c > > head/tools/tools/netmap/pkt-gen.c > > head/tools/tools/netmap/vale-ctl.c >=20 > Looks like this broke VIMAGE builds: >=20 > /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclare= d identifier 'rd' > CURVNET_SET(TD_TO_VNET(rd)); > ^ > /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclare= d identifier 'rd' > /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclare= d identifier 'rd' > /usr/src/sys/dev/netmap/netmap_freebsd.c:1410:25: error: use of undeclare= d identifier 'rd' > 4 errors generated. > --- netmap_freebsd.o --- > *** [netmap_freebsd.o] Error code 1 The attached patch fixes the build. In case it doesn't make it to the list, it's also posted here: http://ix.io/1xFU Thanks, --=20 Shawn Webb Cofounder and Security Engineer HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --mvpLiMfbWzRoNl4x Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="2016-10-19_netmap.patch.txt" Content-Transfer-Encoding: quoted-printable diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebs= d.c index 50e2d0f..a3ad322 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -48,6 +48,7 @@ #include =20 =20 +#include #include #include /* sockaddrs */ #include @@ -1407,7 +1408,7 @@ freebsd_netmap_ioctl(struct cdev *dev __unused, u_lon= g cmd, caddr_t data, int error; struct netmap_priv_d *priv; =20 - CURVNET_SET(TD_TO_VNET(rd)); + CURVNET_SET(TD_TO_VNET(td)); error =3D devfs_get_cdevpriv((void **)&priv); if (error) { /* XXX ENOENT should be impossible, since the priv --mvpLiMfbWzRoNl4x-- --GyRA7555PLgSTuth Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYB9kaAAoJEGqEZY9SRW7uHL8P/i/c1AXw028FgoqFA+bWut9f 70q5EPIY2J426CVyMjZ3WYAN9tEmueTg4ImCWMMtu0xr344jUo7JEGehWcOEZiii jZb12H3QKA61Y7+8GyJO9N0FpGTbmNzq/qilZhq2JaG+mu8SFYfYJ36EAMAiIKzu HwVgbRcvlYrj6I1uWPgof24uBoyJSf/3rJ2QX+z8T9pBBETGm1ul070Eq9st/kAB gxzygZJyIu5pAh3GRgnyh3u9QlBpiNYiBcDOSSGM6dFuyGQH4SWIY7VF+D3pfEQl RI23MglT2baSjSVcTKnms3w7ZoHCxrxUZ11ww+yf+6WHtbthDUKXExIEWL6scIYu dxiNjO5yHa6jrDiW/iPyAYoumLmuet8tkXasWgTn6oYLcW3fDh2QGuJnCjvhFPkW K3LdMiWkSZJto9YHuSoKFrJUGFNW4BVtF/4IINWgYxFW3BtcJPvXJJpwmOeMCN35 aXG8xuASFJB4pgkHcawQOYwSYi+nyH2qVwBeMYEeXjOIQl0vQtodGOYMNR3ZlTD1 jVlqVn//Im8f4kDJtjU+wW3h7p8ZLAH1VtgoKJScyN6S2zF3cnAoNaowW/2CB357 ISHV1xSYX4cMG0u61DbiqmlHMx3HeSSMedPjfgmyteGwapmA5Y32QZ9zrobaKMkC eI9VWMvyDRo9MGamnY4B =49f7 -----END PGP SIGNATURE----- --GyRA7555PLgSTuth-- From owner-svn-src-all@freebsd.org Wed Oct 19 20:56:22 2016 Return-Path: Delivered-To: svn-src-all@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 6E0ACC18E07; Wed, 19 Oct 2016 20:56:22 +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 317F56CC; Wed, 19 Oct 2016 20:56:22 +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 u9JKuLTx039150; Wed, 19 Oct 2016 20:56:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JKuLjj039149; Wed, 19 Oct 2016 20:56:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610192056.u9JKuLjj039149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 20:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307656 - head/gnu/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 20:56:22 -0000 Author: emaste Date: Wed Oct 19 20:56:21 2016 New Revision: 307656 URL: https://svnweb.freebsd.org/changeset/base/307656 Log: Put each SUBDIR on a separate line for ease of maintenance Additional patches to this file are in progress, and having each SUBDIR entry on a separate line makes it easier to change the order in which the patches are reviewed, tested, and applied. Modified: head/gnu/lib/Makefile Modified: head/gnu/lib/Makefile ============================================================================== --- head/gnu/lib/Makefile Wed Oct 19 19:57:36 2016 (r307655) +++ head/gnu/lib/Makefile Wed Oct 19 20:56:21 2016 (r307656) @@ -2,7 +2,9 @@ .include -SUBDIR= csu libgcc libregex +SUBDIR= csu +SUBDIR+= libgcc +SUBDIR+= libregex SUBDIR.${MK_DIALOG}+= libdialog SUBDIR.${MK_GCC}+= libgcov libgomp From owner-svn-src-all@freebsd.org Wed Oct 19 21:01:26 2016 Return-Path: Delivered-To: svn-src-all@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 4A840C19061; Wed, 19 Oct 2016 21:01:26 +0000 (UTC) (envelope-from sbruno@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 1C965CE0; Wed, 19 Oct 2016 21:01:26 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JL1PFU042115; Wed, 19 Oct 2016 21:01:25 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JL1PW4042114; Wed, 19 Oct 2016 21:01:25 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610192101.u9JL1PW4042114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 19 Oct 2016 21:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307657 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 21:01:26 -0000 Author: sbruno Date: Wed Oct 19 21:01:24 2016 New Revision: 307657 URL: https://svnweb.freebsd.org/changeset/base/307657 Log: Resolve whitespace diff to NextBSD. Check to see that the taskqueue thread count requires us to acutally iterate over the thread count to bind to cpus. Submitted by: mmacy@nextbsd.org Modified: head/sys/kern/subr_gtaskqueue.c Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Wed Oct 19 20:56:21 2016 (r307656) +++ head/sys/kern/subr_gtaskqueue.c Wed Oct 19 21:01:24 2016 (r307657) @@ -52,7 +52,6 @@ static MALLOC_DEFINE(M_GTASKQUEUE, "task static void gtaskqueue_thread_enqueue(void *); static void gtaskqueue_thread_loop(void *arg); - struct gtaskqueue_busy { struct gtask *tb_running; TAILQ_ENTRY(gtaskqueue_busy) tb_link; @@ -655,11 +654,11 @@ taskqgroup_attach_deferred(struct taskqg if (gtask->gt_irq != -1) { mtx_unlock(&qgroup->tqg_lock); - CPU_ZERO(&mask); - CPU_SET(cpu, &mask); - intr_setaffinity(gtask->gt_irq, &mask); + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + intr_setaffinity(gtask->gt_irq, &mask); - mtx_lock(&qgroup->tqg_lock); + mtx_lock(&qgroup->tqg_lock); } qgroup->tqg_queue[qid].tgc_cnt++; @@ -789,6 +788,9 @@ taskqgroup_bind(struct taskqgroup *qgrou * Bind taskqueue threads to specific CPUs, if they have been assigned * one. */ + if (qgroup->tqg_cnt == 1) + return; + for (i = 0; i < qgroup->tqg_cnt; i++) { gtask = malloc(sizeof (*gtask), M_DEVBUF, M_WAITOK); GTASK_INIT(>ask->bt_task, 0, 0, taskqgroup_binder, gtask); @@ -855,7 +857,6 @@ _taskqgroup_adjust(struct taskqgroup *qg LIST_INSERT_HEAD(>ask_head, gtask, gt_list); } } - mtx_unlock(&qgroup->tqg_lock); while ((gtask = LIST_FIRST(>ask_head))) { From owner-svn-src-all@freebsd.org Wed Oct 19 21:07:18 2016 Return-Path: Delivered-To: svn-src-all@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 6AD08C1914E; Wed, 19 Oct 2016 21:07:18 +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 2B43BD7; Wed, 19 Oct 2016 21:07:18 +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 u9JL7H60043014; Wed, 19 Oct 2016 21:07:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JL7HOx043013; Wed, 19 Oct 2016 21:07:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610192107.u9JL7HOx043013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 21:07:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307658 - head/sbin/md5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 21:07:18 -0000 Author: emaste Date: Wed Oct 19 21:07:17 2016 New Revision: 307658 URL: https://svnweb.freebsd.org/changeset/base/307658 Log: md5: enter capability on last fd or when acting as a filter Reviewed by: allanjude, cem MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8271 Modified: head/sbin/md5/md5.c Modified: head/sbin/md5/md5.c ============================================================================== --- head/sbin/md5/md5.c Wed Oct 19 21:01:24 2016 (r307657) +++ head/sbin/md5/md5.c Wed Oct 19 21:07:17 2016 (r307658) @@ -21,8 +21,10 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include +#include #include #include #include @@ -74,7 +76,7 @@ typedef struct Algorithm_t { DIGEST_Update *Update; DIGEST_End *End; char *(*Data)(const void *, unsigned int, char *); - char *(*File)(const char *, char *); + char *(*Fd)(int, char *); } Algorithm_t; static void MD5_Update(MD5_CTX *, const unsigned char *, size_t); @@ -106,34 +108,34 @@ typedef union { static const struct Algorithm_t Algorithm[] = { { "md5", "MD5", &MD5TestOutput, (DIGEST_Init*)&MD5Init, (DIGEST_Update*)&MD5_Update, (DIGEST_End*)&MD5End, - &MD5Data, &MD5File }, + &MD5Data, &MD5Fd }, { "sha1", "SHA1", &SHA1_TestOutput, (DIGEST_Init*)&SHA1_Init, (DIGEST_Update*)&SHA1_Update, (DIGEST_End*)&SHA1_End, - &SHA1_Data, &SHA1_File }, + &SHA1_Data, &SHA1_Fd }, { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, - &SHA256_Data, &SHA256_File }, + &SHA256_Data, &SHA256_Fd }, { "sha384", "SHA384", &SHA384_TestOutput, (DIGEST_Init*)&SHA384_Init, (DIGEST_Update*)&SHA384_Update, (DIGEST_End*)&SHA384_End, - &SHA384_Data, &SHA384_File }, + &SHA384_Data, &SHA384_Fd }, { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, - &SHA512_Data, &SHA512_File }, + &SHA512_Data, &SHA512_Fd }, { "sha512t256", "SHA512t256", &SHA512t256_TestOutput, (DIGEST_Init*)&SHA512_256_Init, (DIGEST_Update*)&SHA512_256_Update, (DIGEST_End*)&SHA512_256_End, - &SHA512_256_Data, &SHA512_256_File }, + &SHA512_256_Data, &SHA512_256_Fd }, { "rmd160", "RMD160", &RIPEMD160_TestOutput, (DIGEST_Init*)&RIPEMD160_Init, (DIGEST_Update*)&RIPEMD160_Update, - (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File }, + (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_Fd }, { "skein256", "Skein256", &SKEIN256_TestOutput, (DIGEST_Init*)&SKEIN256_Init, (DIGEST_Update*)&SKEIN256_Update, - (DIGEST_End*)&SKEIN256_End, &SKEIN256_Data, &SKEIN256_File }, + (DIGEST_End*)&SKEIN256_End, &SKEIN256_Data, &SKEIN256_Fd }, { "skein512", "Skein512", &SKEIN512_TestOutput, (DIGEST_Init*)&SKEIN512_Init, (DIGEST_Update*)&SKEIN512_Update, - (DIGEST_End*)&SKEIN512_End, &SKEIN512_Data, &SKEIN512_File }, + (DIGEST_End*)&SKEIN512_End, &SKEIN512_Data, &SKEIN512_Fd }, { "skein1024", "Skein1024", &SKEIN1024_TestOutput, (DIGEST_Init*)&SKEIN1024_Init, (DIGEST_Update*)&SKEIN1024_Update, - (DIGEST_End*)&SKEIN1024_End, &SKEIN1024_Data, &SKEIN1024_File } + (DIGEST_End*)&SKEIN1024_End, &SKEIN1024_Data, &SKEIN1024_Fd } }; static void @@ -154,7 +156,8 @@ Arguments (may be any combination): int main(int argc, char *argv[]) { - int ch; + cap_rights_t rights; + int ch, fd; char *p; char buf[HEX_DIGEST_LENGTH]; int failed; @@ -206,10 +209,30 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (caph_limit_stdout() < 0 || caph_limit_stderr() < 0) + err(1, "unable to limit rights for stdio"); + if (*argv) { do { - p = Algorithm[digest].File(*argv, buf); - if (!p) { + if ((fd = open(*argv, O_RDONLY)) < 0) { + warn("%s", *argv); + failed++; + continue; + } + /* + * XXX Enter capability mode on the last argv file. + * When a casper file service or other approach is + * available, switch to that and enter capability mode + * earlier. + */ + if (*(argv + 1) == NULL) { + cap_rights_init(&rights, CAP_READ); + if ((cap_rights_limit(fd, &rights) < 0 && + errno != ENOSYS) || + (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); + } + if ((p = Algorithm[digest].Fd(fd, buf)) == NULL) { warn("%s", *argv); failed++; } else { @@ -229,8 +252,12 @@ main(int argc, char *argv[]) printf("\n"); } } while (*++argv); - } else if (!sflag && (optind == 1 || qflag || rflag)) + } else if (!sflag && (optind == 1 || qflag || rflag)) { + if (caph_limit_stdin() < 0 || + (cap_enter() < 0 && errno != ENOSYS)) + err(1, "capsicum"); MDFilter(&Algorithm[digest], 0); + } if (failed != 0) return (1); From owner-svn-src-all@freebsd.org Wed Oct 19 21:26:00 2016 Return-Path: Delivered-To: svn-src-all@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 C0988C1948F; Wed, 19 Oct 2016 21:26:00 +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 9223FBA3; Wed, 19 Oct 2016 21:26:00 +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 u9JLPxPJ050908; Wed, 19 Oct 2016 21:25:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JLPxcX050907; Wed, 19 Oct 2016 21:25:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610192125.u9JLPxcX050907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 19 Oct 2016 21:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307659 - head/gnu/usr.bin X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 21:26:00 -0000 Author: emaste Date: Wed Oct 19 21:25:59 2016 New Revision: 307659 URL: https://svnweb.freebsd.org/changeset/base/307659 Log: Switch gnu/usr.bin/Makefile to SUBDIR.${MK_*} optional subdir style Modified: head/gnu/usr.bin/Makefile Modified: head/gnu/usr.bin/Makefile ============================================================================== --- head/gnu/usr.bin/Makefile Wed Oct 19 21:07:17 2016 (r307658) +++ head/gnu/usr.bin/Makefile Wed Oct 19 21:25:59 2016 (r307659) @@ -2,48 +2,27 @@ .include -SUBDIR= ${_binutils} \ - ${_cc} \ - diff \ +SUBDIR= diff \ diff3 \ - ${_dtc} \ - ${_gdb} \ - ${_gperf} \ - grep \ - ${_groff} \ - ${_tests} + grep SUBDIR_DEPEND_gdb= ${_binutils} .if ${MK_CXX} != "no" -.if ${MK_GCC} != "no" -_gperf= gperf -.endif -.if ${MK_GROFF} != "no" -_groff= groff -.endif +SUBDIR.${MK_GCC}+= gperf +SUBDIR.${MK_GROFF}+= groff .endif -.if ${MK_GPL_DTC} != "no" -_dtc= dtc -.endif - -.if ${MK_TESTS} != "no" -_tests= tests -.endif +SUBDIR.${MK_BINUTILS}+= binutils +SUBDIR.${MK_DIALOG}+= dialog .if ${MK_BINUTILS} != "no" -_binutils= binutils -.if ${MK_GDB} != "no" -_gdb= gdb -.endif +SUBDIR.${MK_GDB}+= gdb .endif -.if ${MK_GCC} != "no" -_cc= cc -.endif - -SUBDIR.${MK_DIALOG}+= dialog +SUBDIR.${MK_GCC}+= cc +SUBDIR.${MK_GPL_DTC}+= dtc +SUBDIR.${MK_TESTS}+= tests SUBDIR_PARALLEL= From owner-svn-src-all@freebsd.org Wed Oct 19 21:44:02 2016 Return-Path: Delivered-To: svn-src-all@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 44793C1996B; Wed, 19 Oct 2016 21:44:02 +0000 (UTC) (envelope-from rionda@gmail.com) Received: from mail-qk0-x229.google.com (mail-qk0-x229.google.com [IPv6:2607:f8b0:400d:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1908998; Wed, 19 Oct 2016 21:44:01 +0000 (UTC) (envelope-from rionda@gmail.com) Received: by mail-qk0-x229.google.com with SMTP id z190so61694374qkc.2; Wed, 19 Oct 2016 14:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=u//Do35n1OwIHyaZX+vYxd96fsSMbtAKOGjhZHsZljc=; b=aNamfU0WZkrDeWN3QD/5pznywSjy9D0qK5195wyH+97qZWnN34OiEuqISNePCJiMTC 3GGW9UoURAeC5y7quTtCyH3lWp5RiBXrJBRp7TMje6whQqCUT0/ccqpMaRNECH8VqOlv if2eWd7BJ7t7NT/4/vNCaKE23K9jr2A9Haj0VPBFRzbRHLVKAmNfgD+/LxpZf+cpq8TG fR7EZ65wpM8HgQ7bkHnHSh1dF7cXo62QwVK/4Yg0tqKiLYyvM50VWT40imVPFUFup3v7 FjsprhLoL0BoVUUrI3EhHW47Pito+P0au8Y6bXi3585tr7K1v3+UqOfWbi7OeH0VFBhx 38RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:mime-version:subject:from:in-reply-to :date:cc:content-transfer-encoding:message-id:references:to; bh=u//Do35n1OwIHyaZX+vYxd96fsSMbtAKOGjhZHsZljc=; b=XWEDcG8G77pfx9G7iNiWnu+OApEa6+VOVWRKRhhdEGLhB9XoAhMMRwlXJVxxm0itfF vhwZzMK0u4IardDkj2FAUJXqBKO2bgbLdAEwo5p9Kx7hv/18VCthfwsUQfU1KlSW2+9m kr7Hxpgmf715gz4amnjwEYzDpT4HWj2KlbUMCK0KynmACKmzY+L+RSBdRj7vZv+vvHKp vcB+wKivBzgxnmXMshYWc7hEurAmvnESL5mNe3y7X0Lt27vpz9PQyk+7FrkdNWX2OLPQ skGeZaF5jC8i7nKlOdzAp4j7mzF6oEMn3oK6rqroJ1qTJ8GuE38V1H9vtainSW1RjXt5 EF6w== X-Gm-Message-State: ABUngvc4vkDxAmzxGzBy83+2+0ONXMD3IsUUAHB48HQHcFHn1n83A51C9BX7+14hkmR3Xg== X-Received: by 10.55.200.75 with SMTP id c72mr7752941qkj.85.1476913440916; Wed, 19 Oct 2016 14:44:00 -0700 (PDT) Received: from [172.31.26.254] (gzac12-mdf2-1.aoa.twosigma.com. [208.77.215.155]) by smtp.gmail.com with ESMTPSA id v10sm21914573qkg.20.2016.10.19.14.43.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 14:43:59 -0700 (PDT) Sender: Matteo Riondato Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Subject: Re: svn commit: r307659 - head/gnu/usr.bin From: Matteo Riondato In-Reply-To: <201610192125.u9JLPxcX050907@repo.freebsd.org> Date: Wed, 19 Oct 2016 17:43:58 -0400 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <69B71206-9305-4A8D-9589-3E9B22914D71@FreeBSD.org> References: <201610192125.u9JLPxcX050907@repo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3226) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 21:44:02 -0000 > On Oct 19, 2016, at 5:25 PM, Ed Maste wrote: > > Author: emaste > Date: Wed Oct 19 21:25:59 2016 > New Revision: 307659 > URL: https://svnweb.freebsd.org/changeset/base/307659 > > Log: > Switch gnu/usr.bin/Makefile to SUBDIR.${MK_*} optional subdir style This seems to have broken buildworld with WITHOUT_GPL_DTC=y in src.conf . Matteo From owner-svn-src-all@freebsd.org Wed Oct 19 21:50:58 2016 Return-Path: Delivered-To: svn-src-all@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 D6EF9C19B2E; Wed, 19 Oct 2016 21:50:58 +0000 (UTC) (envelope-from cem@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 A3388DDA; Wed, 19 Oct 2016 21:50:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9JLovRn059252; Wed, 19 Oct 2016 21:50:57 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9JLovcT059251; Wed, 19 Oct 2016 21:50:57 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610192150.u9JLovcT059251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 19 Oct 2016 21:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307660 - head/usr.bin/jot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 21:50:58 -0000 Author: cem Date: Wed Oct 19 21:50:57 2016 New Revision: 307660 URL: https://svnweb.freebsd.org/changeset/base/307660 Log: Capsicum support for jot(1) Limit descriptors and enter capability mode in jot(1). Submitted by: brueffer (earlier version) Reviewed by: emaste, jonathan (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D1345 Modified: head/usr.bin/jot/jot.c Modified: head/usr.bin/jot/jot.c ============================================================================== --- head/usr.bin/jot/jot.c Wed Oct 19 21:25:59 2016 (r307659) +++ head/usr.bin/jot/jot.c Wed Oct 19 21:50:57 2016 (r307660) @@ -47,8 +47,11 @@ __FBSDID("$FreeBSD$"); * Author: John Kunze, Office of Comp. Affairs, UCB */ +#include +#include #include #include +#include #include #include #include @@ -89,6 +92,7 @@ static void usage(void); int main(int argc, char **argv) { + cap_rights_t rights; bool have_format = false; bool infinity = false; bool nofinalnl = false; @@ -105,6 +109,21 @@ main(int argc, char **argv) long i; long reps = REPS_DEF; + if (caph_limit_stdio() < 0) + err(1, "unable to limit rights for stdio"); + cap_rights_init(&rights); + if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) + err(1, "unable to limit rights for stdin"); + + /* + * Cache NLS data, for strerror, for err(3), before entering capability + * mode. + */ + caph_cache_catpages(); + + if (cap_enter() < 0 && errno != ENOSYS) + err(1, "unable to enter capability mode"); + while ((ch = getopt(argc, argv, "b:cnp:rs:w:")) != -1) switch (ch) { case 'b': From owner-svn-src-all@freebsd.org Wed Oct 19 22:09:44 2016 Return-Path: Delivered-To: svn-src-all@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 4E3C7C19DB8; Wed, 19 Oct 2016 22:09:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AAA2881; Wed, 19 Oct 2016 22:09:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u9JM9gYa031141 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 19 Oct 2016 15:09:42 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u9JM9g6A031140; Wed, 19 Oct 2016 15:09:42 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 19 Oct 2016 15:09:42 -0700 From: Gleb Smirnoff To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307650 - head/sys/kern Message-ID: <20161019220942.GM27748@FreeBSD.org> References: <201610191829.u9JITqhm081246@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201610191829.u9JITqhm081246@repo.freebsd.org> User-Agent: Mutt/1.7.0 (2016-08-17) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 22:09:44 -0000 On Wed, Oct 19, 2016 at 06:29:52PM +0000, Mateusz Guzik wrote: M> Author: mjg M> Date: Wed Oct 19 18:29:52 2016 M> New Revision: 307650 M> URL: https://svnweb.freebsd.org/changeset/base/307650 M> M> Log: M> cache: split negative entry LRU into multiple lists M> M> This splits the ncneg_mtx lock while preserving the hit ratio at least M> during buildworld. M> M> Create N dedicated lists for new negative entries. M> M> Entries with at least one hit get promoted to the hot list, where they M> get requeued every M hits. M> M> Shrinking demotes one hot entry and performs a round-robin shrinking of M> regular lists. M> M> Reviewed by: kib This instapanics: panic: Assertion ncp->nc_flag & NCF_NEGATIVE failed at /usr/src/head/sys/kern/vfs_cache.c:815 -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Wed Oct 19 22:33:42 2016 Return-Path: Delivered-To: svn-src-all@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 36C05C19225 for ; Wed, 19 Oct 2016 22:33:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x231.google.com (mail-it0-x231.google.com [IPv6:2607:f8b0:4001:c0b::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1E9E845 for ; Wed, 19 Oct 2016 22:33:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x231.google.com with SMTP id m138so49770939itm.0 for ; Wed, 19 Oct 2016 15:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=bWJIeAVd9mLYwQYm4sth4APhKnVNOBvI1SPKLk1TTrE=; b=iAl2G/Dif+P3BQiF05GwjM7nramli+Ql+ApminHW36ywozwFRoJ/6mOlIt/MC4i4+u JumYk7fhQWM/LjfuLeZTTSDQS9KHjNKd6wMFIiv+pOGC3INILEPD5X0aWufw5p8uZJuA x0btfvGboGIQaliLBwP9EYkNz5mNhIeXa1dy/9oue9C/YFmJpmPJ2veM5V2C2SeTraYh LPPV13qywXylCBv5WFmjyerj1M9ZmUfAW/ihVl1AQjSce7RwHDvFXxF4kTNeGbCTe619 5Vw7aPi3CPdTIg3eOofPJXWvo7JC0OWfD0Bb0XkKWvvxYF59Uk80TA4iDHHc9mdODWzd WQbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=bWJIeAVd9mLYwQYm4sth4APhKnVNOBvI1SPKLk1TTrE=; b=X5Nv0bO2Qg/lK2L3yBWCbQKj07YG88q3bpcW87TjH81rM/qSCVNO0nnHd/csqX682Y jbNWDBwkOmoDM7M0KpNUcrBueLusuvTWwlhqv92nVKf3o/0E1umm8iGCL5QZ2WXmPdn4 vRCaiRgCD6LMQeyNmHva1l8cMJHAJNvMwzMihLHU4SD0xKyZUEixaLJbosYXmf7VkVVL smfsALO4reb6X8H3NS7EPQIiZ3zLJIqC3u2MrM0/so7MgqGdRGYcyXH7sEvhCXyJTzDt VOJr/E3J9bZYFcKKPk8e1Mk9v/qD7cPtG9DMBMe/LTA+uIPxFpzzPkyBNyFhooA3anPY 8BfQ== X-Gm-Message-State: AA6/9RlANlhpywOA1xmKyCrZrNevIgoU9aIKK4LSFmJIOfhapf1POQJA4F94pGahSFWjXzN0+eSP5UzpOG+1IQ== X-Received: by 10.36.112.199 with SMTP id f190mr5931993itc.60.1476916420386; Wed, 19 Oct 2016 15:33:40 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.77.85 with HTTP; Wed, 19 Oct 2016 15:33:39 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <1660864.e2huCtGy6v@ralph.baldwin.cx> References: <201610141710.u9EHArlL089412@repo.freebsd.org> <3841347.BNPZXPm7N3@ralph.baldwin.cx> <1660864.e2huCtGy6v@ralph.baldwin.cx> From: Warner Losh Date: Wed, 19 Oct 2016 16:33:39 -0600 X-Google-Sender-Auth: 1lyl0rJpDc1j4n6gdLvlXeQbM50 Message-ID: Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader To: John Baldwin Cc: Doug Ambrisko , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Doug Ambrisko , Ravi Pokala Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 22:33:42 -0000 On Wed, Oct 19, 2016 at 11:34 AM, John Baldwin wrote: > On Wednesday, October 19, 2016 02:01:18 AM Warner Losh wrote: >> One of my systems would export these as sysctls: >> >> smbios.bios.reldate="07/05/2013" >> smbios.bios.vendor="American Megatrends Inc." >> smbios.bios.version="3.00" >> smbios.chassis.maker="Supermicro" >> smbios.chassis.serial="0123456789" >> smbios.chassis.tag="To Be Filled By O.E.M." >> smbios.chassis.version="0123456789" >> smbios.memory.enabled="268435456" >> smbios.planar.location="To be filled by O.E.M." >> smbios.planar.maker="Supermicro" >> smbios.planar.product="X9SRH-7F/7TF" >> smbios.planar.serial="VM13CS028237" >> smbios.planar.tag="To be filled by O.E.M." >> smbios.planar.version="0123456789" >> smbios.socket.enabled="1" >> smbios.socket.populated="1" >> smbios.system.family="To be filled by O.E.M." >> smbios.system.maker="Supermicro" >> smbios.system.product="X9SRH-7F/7TF" >> smbios.system.serial="0123456789" >> smbios.system.sku="To be filled by O.E.M." >> smbios.system.uuid="00000000-0000-0000-0000-002590e4d0ec" >> smbios.system.version="0123456789" >> smbios.version="2.7" >> >> though some of them are silly due to the BIOS writer being silly... > > So are you planning to just duplicate the existing kenv vars as sysctl > nodes? Can't you parse the output of kenv instead? I often get sysctl -a from ailing systems. I never or rarely get kenv. This adds to the information available when I'm looking into problems since it gives me more data about the system where the problem occurs. Warner From owner-svn-src-all@freebsd.org Wed Oct 19 22:45:22 2016 Return-Path: Delivered-To: svn-src-all@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 7032DC194A2 for ; Wed, 19 Oct 2016 22:45:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38FC2E28 for ; Wed, 19 Oct 2016 22:45:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x236.google.com with SMTP id m138so50371423itm.0 for ; Wed, 19 Oct 2016 15:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Md3F7Z850xxv3DPYHfxf0ZxGnUmyZhpqHdo7hAHn59s=; b=aOW4MlZgRa0QUMEVzqWfo7Bb6wFFfteP+OVXVoYCw5agANfp11Vx6Y6G3r/2dBOC1M RUvIal2P48WJVrDDRJGPnv/5JNAqdSZQoL+RPzjQw6yHcY3Ltl3kwZxtLecxWL4y23B6 Xzjrzh214QdYySmV21dvgB6tIgbgeF2+jipcWsq1ob/RwLUY3toNdD+7GX1u+w0kFiX5 hH+qZs5b65++AdQBqm3CBr9NCDiS8lqXltbQwgc/XTiheQEyErP2fEWHrv+qTAzscPnN xkLXJQS8pIgsQRivzE68RslBGFO2UkYZp9270ipOay5a1PECEl4KVpg2qbkH5C3CHfEd I2ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Md3F7Z850xxv3DPYHfxf0ZxGnUmyZhpqHdo7hAHn59s=; b=O2mp9KlmOmkTV6OHA8r7VpZB57aBljbCHK3M2wV4L3kkSoaDofI9lFa1lUEjH6Q0sp evsnUFYtbyUJm10tRh+hl3m7ZitZrIKacLomKeHNb+FMvTUVR6ysS1aK69Jj0uEax497 wMbAAgCh5Zs832rc0xGXDuWtD8YuooiCS+5JTR5LoeGbKSiap2yRBZvhVadCcmAb6qht 8xxYGCbfV/PoaljRKB+3CHyf5r+YjLwG9xUx+5qNcCJpuc+G68/5OSGa7ojNlPH2VCFf bEhAi+xMuUPXbIdhkack8x/eOgqg434S2uDmkJQOUtF2+OI6fiLR5Y9FuJvVVXyXM4u3 4b4g== X-Gm-Message-State: AA6/9RmbCCqMB2XZrVCXbUNCnplzC4qnFZiNqzsJoEt728wuUcLgSiWbCmEBjDsmbDGxeI84Qc6vQfPA9NvllA== X-Received: by 10.36.112.199 with SMTP id f190mr5971283itc.60.1476917121650; Wed, 19 Oct 2016 15:45:21 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.77.85 with HTTP; Wed, 19 Oct 2016 15:45:21 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <20161019202656.GA58917@stack.nl> References: <201610170407.u9H47D5n033011@repo.freebsd.org> <20161019202656.GA58917@stack.nl> From: Warner Losh Date: Wed, 19 Oct 2016 16:45:21 -0600 X-Google-Sender-Auth: JWxJQXXBXdCbYe6P48I7jpn64hU Message-ID: Subject: Re: svn commit: r307469 - head/etc To: Jilles Tjoelker Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 22:45:22 -0000 What missing quotes? It seemed to work find on the system I brought up... I didn't do the case statement because it would be three extra big useless syntactical boogers in the code :) I do like the idea of using checkyesno. Warner On Wed, Oct 19, 2016 at 2:26 PM, Jilles Tjoelker wrote: > On Mon, Oct 17, 2016 at 04:07:13AM +0000, Warner Losh wrote: >> Author: imp >> Date: Mon Oct 17 04:07:13 2016 >> New Revision: 307469 >> URL: https://svnweb.freebsd.org/changeset/base/307469 > >> Log: >> Allow root_rw_mount to be both lower and upper case. Before, if it was >> upper case, you'd wind up with a read-only filesystem when you should >> sometimes. > >> PR: 213549 > >> Modified: >> head/etc/rc > >> Modified: head/etc/rc >> ============================================================================== >> --- head/etc/rc Mon Oct 17 04:07:12 2016 (r307468) >> +++ head/etc/rc Mon Oct 17 04:07:13 2016 (r307469) >> @@ -135,16 +135,16 @@ done >> # Note: this assumes firstboot_sentinel is on / when we have >> # a read-only /, or that it is on media that's writable. >> if [ -e ${firstboot_sentinel} ]; then >> - [ ${root_rw_mount} = "yes" ] || mount -uw / >> + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -uw / >> chflags -R 0 ${firstboot_sentinel} >> rm -rf ${firstboot_sentinel} >> if [ -e ${firstboot_sentinel}-reboot ]; then >> chflags -R 0 ${firstboot_sentinel}-reboot >> rm -rf ${firstboot_sentinel}-reboot >> - [ ${root_rw_mount} = "yes" ] || mount -ur / >> + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / >> kill -INT 1 >> fi >> - [ ${root_rw_mount} = "yes" ] || mount -ur / >> + [ ${root_rw_mount#[Yy][Ee][Ss]} = "" ] || mount -ur / >> fi >> >> echo '' > > Although I have not tested this, it looks like this will always do the > remounts since the condition is either false or invalid due to missing > quotes. > > Perhaps we can use the checkyesno function from rc.subr or use the same > check that rc.d/root uses (case statement where [Nn][Oo] and the empty > string are no and the rest is yes). > > -- > Jilles Tjoelker From owner-svn-src-all@freebsd.org Wed Oct 19 22:56:06 2016 Return-Path: Delivered-To: svn-src-all@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 65506C19768; Wed, 19 Oct 2016 22:56:06 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 383473D6; Wed, 19 Oct 2016 22:56:06 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x243.google.com with SMTP id e203so3112293itc.1; Wed, 19 Oct 2016 15:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6pN3f8upsBLK6iCoKdALwHSU/9SqSkh7dct+RQjLLhs=; b=vnJGqy6GkExUGHAxCZIMgE/o/lUFCXA2ISpV6WjlgIqsUFwFXTHHpooKixCoHSdlPP wCEYTTr9zTJx9GdIEdJKTVvNMjAgsIEsQCwl/FNSVj+ogZP62JZhCwDuJCn58KIRcpJU tlfhJFCHMea/sP3zFAIyl3s1e/IGJilEEh4L4Td39QRWX0lvzrlSyhy2VMHnSpHVJAtq +mulMt/AcQlDgqgA07pH+l01ORVLkcXKy0xC/6qvBvfafXSTjpoLihUYkJ0m4SaUh1cE pFxpgURZ6Is09Qb9t7kAaMvA8Ag/VLqDxiWlDMGKKyrlu1ehvfSGuVnULU2eHPlPWZAk oUpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=6pN3f8upsBLK6iCoKdALwHSU/9SqSkh7dct+RQjLLhs=; b=apk9uSaXBeNx/imzcBIP3uGqD812dO9zowXGq+TlE5CDsVkoEWloEEIux0z7T/Mq5t uJi6SxWus5Tb166qVQaZNaIr8b/Tr8PuwfSfKkNDj/lTHjY4cQbjJW4tXoeXpEVndmyy 6AE7J1rxlDIly3zDb/9I/VM5R+9LF4ipfK1j6rzyqGjdGkTgL/QO4YPsSmO3KqAREaoK KbpSPgdhczE5yAIsT4LSjsbc5N/XcygYZPARCo2Q5nUq+BTnuJbuhSJpi/dpTK6rQrf5 icfmZpwPvZX2j5vpGpRJX46+psk39ol0IzEpcrqmpAFdL6Axh+ngPz64joYU1+L7Z5B9 pWRQ== X-Gm-Message-State: AA6/9RlBgQtgKBumcWrWV1E1CL/mpqzi0EX6vrbb2l4Wn5TogwxRPFSk6GHjp9tj5mKlmYIScFN3JNVeYQ/RBQ== X-Received: by 10.36.10.135 with SMTP id 129mr5412175itw.108.1476917765304; Wed, 19 Oct 2016 15:56:05 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.180.211 with HTTP; Wed, 19 Oct 2016 15:55:44 -0700 (PDT) In-Reply-To: <69B71206-9305-4A8D-9589-3E9B22914D71@FreeBSD.org> References: <201610192125.u9JLPxcX050907@repo.freebsd.org> <69B71206-9305-4A8D-9589-3E9B22914D71@FreeBSD.org> From: Ed Maste Date: Wed, 19 Oct 2016 22:55:44 +0000 X-Google-Sender-Auth: ZHfS4MGpgxKfySTpQmauHSSjv1A Message-ID: Subject: Re: svn commit: r307659 - head/gnu/usr.bin To: Matteo Riondato Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 22:56:06 -0000 On 19 October 2016 at 21:43, Matteo Riondato wrote: > > This seems to have broken buildworld with WITHOUT_GPL_DTC=y in src.conf . What error do you get? From owner-svn-src-all@freebsd.org Wed Oct 19 23:27:58 2016 Return-Path: Delivered-To: svn-src-all@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 2E44AC19133; Wed, 19 Oct 2016 23:27:58 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4D8C97C; Wed, 19 Oct 2016 23:27:57 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-qt0-x229.google.com with SMTP id s49so37390458qta.0; Wed, 19 Oct 2016 16:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OpIgJifS+OCNaztcEJzBLLR9p1+24qNMwt3hLWLBhdw=; b=zx8XYwep7gO41qjEGdh1Fo4zlbpcTArmj2tS/wj6NOVkZN0SG+dgxJydFcqRjv9QWd dsyWyZ+cVQz8DuusLH93Wnn7dxKAftfybiLBvtcLC+pRVBWjQvJ7EtURNyuDfzkq0Xbo GITCl8Nbou5He8xl3TrOPn4FsQ2+6DXRb+Peaoqh9KGVTPfHQUxgegFmyMWDAJZlUOjQ RkyXDW5SwQ2VzfNheLShCh/43E/n5WNVEpiLeF4F9fVSrHNWwtZrS7pk6sqPTwRK1UIo ZJzgOo1Iaa3bw8uEdE0G9MOxHFj++P/LjWRzDLQmJwEv2NsRm4rWrYaUkZ99jOMOdQCR F93w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OpIgJifS+OCNaztcEJzBLLR9p1+24qNMwt3hLWLBhdw=; b=LvOkyehoDYhn/aRXsuk9qe8nD5O2Mmy9RKaBXK4UcSE2PtmVXhPdd9yfIXqRXY/AN4 IqQa/sYuQYHBurhGDFev9DXuCADzXGMNUG3uSBi0p7TGqFfoU8jt4rBq4PBqOASmSUSU PvOVxSF3Xg9T8ztkpJiHUeLXCPWBBaJ4kVOJrtRtCJd9L3Q7PdsemPcsvYE7V0ka58uH Zw24lx+XOkgY07k+7aS5KS7Y1OeSoceHFa1SqEtF7Z6+JUwd3oD8rPU8+8KQPEWtJZmU fHdgezp7t9Qs9P3hHsJdtpqfy7/W/PkgcdTe5YYhLny2l96dBsHxmwPGMYwpBR2ASetd lLvQ== X-Gm-Message-State: AA6/9Rk2m4Pm0XdWaJ0f9qY78vecpx0oIZDoMGzM+3s6thBl8nM5TUauXTrB75RYZubLBSyBCE6o0k5SKEJtyg== X-Received: by 10.200.33.201 with SMTP id 9mr9072954qtz.141.1476919676842; Wed, 19 Oct 2016 16:27:56 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.12.138.251 with HTTP; Wed, 19 Oct 2016 16:27:56 -0700 (PDT) In-Reply-To: <201409271357.s8RDvmTC072149@svn.freebsd.org> References: <201409271357.s8RDvmTC072149@svn.freebsd.org> From: Alan Somers Date: Wed, 19 Oct 2016 17:27:56 -0600 X-Google-Sender-Auth: 2BCkVO6Kxe5tax2jkGxKxUeyZuU Message-ID: Subject: Re: svn commit: r272211 - head/sys/net To: "Alexander V. Chernikov" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 23:27:58 -0000 On Sat, Sep 27, 2014 at 7:57 AM, Alexander V. Chernikov wrote: > Author: melifaro > Date: Sat Sep 27 13:57:48 2014 > New Revision: 272211 > URL: http://svnweb.freebsd.org/changeset/base/272211 > > Log: > Use underlying ports counters to get lagg statistics instead of > per-packet accounting. > This introduce user-visible changes like aggregating error counters. > > Reviewed by: asomers (prev.version), glebius > CR: D781 > MFC after: 2 weeks > Sponsored by: Yandex LLC > > Modified: > head/sys/net/if_lagg.c > head/sys/net/if_lagg.h > head/sys/net/if_var.h > I think this change is causing a LOR and deadlock. It happens if I create a lagg and then quickly destroy it. The deadlocked threads have these stack traces: Tracing command ifconfig pid 7334 tid 100823 td 0xfffff8014ff34000 sched_switch() at sched_switch+0x48a/frame 0xfffffe20b3771470 mi_switch() at mi_switch+0x167/frame 0xfffffe20b37714a0 turnstile_wait() at turnstile_wait+0x3be/frame 0xfffffe20b37714f0 __mtx_lock_sleep() at __mtx_lock_sleep+0x196/frame 0xfffffe20b3771570 __mtx_lock_flags() at __mtx_lock_flags+0x10d/frame 0xfffffe20b37715c0 _rm_rlock() at _rm_rlock+0x28b/frame 0xfffffe20b3771600 _rm_rlock_debug() at _rm_rlock_debug+0x11f/frame 0xfffffe20b3771640 lagg_get_counter() at lagg_get_counter+0x4c/frame 0xfffffe20b37716c0 if_data_copy() at if_data_copy+0xa1/frame 0xfffffe20b37716e0 sysctl_rtsock() at sysctl_rtsock+0x56c/frame 0xfffffe20b3771860 sysctl_root_handler_locked() at sysctl_root_handler_locked+0x8a/frame 0xfffffe20b37718a0 sysctl_root() at sysctl_root+0x188/frame 0xfffffe20b3771920 userland_sysctl() at userland_sysctl+0x16e/frame 0xfffffe20b37719c0 sys___sysctl() at sys___sysctl+0x74/frame 0xfffffe20b3771a70 amd64_syscall() at amd64_syscall+0x314/frame 0xfffffe20b3771bf0 Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe20b3771bf0 --- syscall (202, FreeBSD ELF64, sys___sysctl), rip = 0x800fceeea, rsp = 0x7fffffffe408, rbp = 0x7fffffffe440 --- Tracing command ifconfig pid 7331 tid 100796 td 0xfffff80066df5a00 sched_switch() at sched_switch+0x48a/frame 0xfffffe20b36ea630 mi_switch() at mi_switch+0x167/frame 0xfffffe20b36ea660 turnstile_wait() at turnstile_wait+0x3be/frame 0xfffffe20b36ea6b0 __rw_wlock_hard() at __rw_wlock_hard+0xb5/frame 0xfffffe20b36ea740 _rw_wlock_cookie() at _rw_wlock_cookie+0xbc/frame 0xfffffe20b36ea780 lagg_ether_cmdmulti() at lagg_ether_cmdmulti+0x5c/frame 0xfffffe20b36ea7c0 lagg_ioctl() at lagg_ioctl+0x115a/frame 0xfffffe20b36ea8a0 ifioctl() at ifioctl+0xdc1/frame 0xfffffe20b36ea930 kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe20b36ea990 sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe20b36eaa70 amd64_syscall() at amd64_syscall+0x314/frame 0xfffffe20b36eabf0 Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe20b36eabf0 --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x800fd417a, rsp = 0x7fffffffe228, rbp = 0x7fffffffe2a0 --- The problem is that lagg_get_counter calls LAGG_RLOCK after calling IF_ADDR_RLOCK at rtsock.c:1717. Meanwhile, another thread called IF_ADDR_WLOCK at if_lagg.c:1581 after having already called LAGG_WLOCK at f_lagg.c:1530. I think this revision introduced the problem because reading the lagg's counters did not previously require the LAGG_RLOCK. Do you have any ideas on how to fix it? -Alan From owner-svn-src-all@freebsd.org Thu Oct 20 00:05:09 2016 Return-Path: Delivered-To: svn-src-all@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 99613C19D18; Thu, 20 Oct 2016 00:05:09 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 55954F74; Thu, 20 Oct 2016 00:05:09 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1bx0r1-000JnU-Ju; Thu, 20 Oct 2016 03:05:03 +0300 Date: Thu, 20 Oct 2016 03:05:03 +0300 From: Slawa Olhovchenkov To: Warner Losh Cc: John Baldwin , Doug Ambrisko , src-committers , Doug Ambrisko , "svn-src-all@freebsd.org" , Ravi Pokala , "svn-src-head@freebsd.org" Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader Message-ID: <20161020000503.GG57876@zxy.spb.ru> References: <201610141710.u9EHArlL089412@repo.freebsd.org> <3841347.BNPZXPm7N3@ralph.baldwin.cx> <1660864.e2huCtGy6v@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 00:05:09 -0000 On Wed, Oct 19, 2016 at 04:33:39PM -0600, Warner Losh wrote: > On Wed, Oct 19, 2016 at 11:34 AM, John Baldwin wrote: > > On Wednesday, October 19, 2016 02:01:18 AM Warner Losh wrote: > >> One of my systems would export these as sysctls: > >> > >> smbios.bios.reldate="07/05/2013" > >> smbios.bios.vendor="American Megatrends Inc." > >> smbios.bios.version="3.00" > >> smbios.chassis.maker="Supermicro" > >> smbios.chassis.serial="0123456789" > >> smbios.chassis.tag="To Be Filled By O.E.M." > >> smbios.chassis.version="0123456789" > >> smbios.memory.enabled="268435456" > >> smbios.planar.location="To be filled by O.E.M." > >> smbios.planar.maker="Supermicro" > >> smbios.planar.product="X9SRH-7F/7TF" > >> smbios.planar.serial="VM13CS028237" > >> smbios.planar.tag="To be filled by O.E.M." > >> smbios.planar.version="0123456789" > >> smbios.socket.enabled="1" > >> smbios.socket.populated="1" > >> smbios.system.family="To be filled by O.E.M." > >> smbios.system.maker="Supermicro" > >> smbios.system.product="X9SRH-7F/7TF" > >> smbios.system.serial="0123456789" > >> smbios.system.sku="To be filled by O.E.M." > >> smbios.system.uuid="00000000-0000-0000-0000-002590e4d0ec" > >> smbios.system.version="0123456789" > >> smbios.version="2.7" > >> > >> though some of them are silly due to the BIOS writer being silly... > > > > So are you planning to just duplicate the existing kenv vars as sysctl > > nodes? Can't you parse the output of kenv instead? > > I often get sysctl -a from ailing systems. I never or rarely get kenv. > This adds to the information available when I'm looking into problems > since it gives me more data about the system where the problem occurs. Look like we need show-tech in base system :) From owner-svn-src-all@freebsd.org Thu Oct 20 01:19:38 2016 Return-Path: Delivered-To: svn-src-all@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 E84E1C18010; Thu, 20 Oct 2016 01:19:38 +0000 (UTC) (envelope-from kevlo@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 9C82D222; Thu, 20 Oct 2016 01:19:38 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9K1JbeM037672; Thu, 20 Oct 2016 01:19:37 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9K1JbFb037671; Thu, 20 Oct 2016 01:19:37 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201610200119.u9K1JbFb037671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Thu, 20 Oct 2016 01:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307662 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 01:19:39 -0000 Author: kevlo Date: Thu Oct 20 01:19:37 2016 New Revision: 307662 URL: https://svnweb.freebsd.org/changeset/base/307662 Log: Remove a sentence about putting initialization in init_proc.c or kern_proc.c and useless comment. Reviewed by: kib Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Oct 19 22:19:38 2016 (r307661) +++ head/sys/kern/init_main.c Thu Oct 20 01:19:37 2016 (r307662) @@ -316,15 +316,6 @@ restart: /* NOTREACHED*/ } - -/* - *************************************************************************** - **** - **** The following SYSINIT's belong elsewhere, but have not yet - **** been moved. - **** - *************************************************************************** - */ static void print_caddr_t(void *data) { @@ -418,17 +409,10 @@ struct sysentvec null_sysvec = { }; /* - *************************************************************************** - **** - **** The two following SYSINIT's are proc0 specific glue code. I am not - **** convinced that they can not be safely combined, but their order of - **** operation has been maintained as the same as the original init_main.c - **** for right now. - **** - **** These probably belong in init_proc.c or kern_proc.c, since they - **** deal with proc0 (the fork template process). - **** - *************************************************************************** + * The two following SYSINIT's are proc0 specific glue code. I am not + * convinced that they can not be safely combined, but their order of + * operation has been maintained as the same as the original init_main.c + * for right now. */ /* ARGSUSED*/ static void @@ -662,16 +646,6 @@ SYSINIT(random, SI_SUB_RANDOM, SI_ORDER_ *************************************************************************** */ - -/* - *************************************************************************** - **** - **** The following code probably belongs in another file, like - **** kern/init_init.c. - **** - *************************************************************************** - */ - /* * List of paths to try when searching for "init". */ From owner-svn-src-all@freebsd.org Thu Oct 20 01:21:11 2016 Return-Path: Delivered-To: svn-src-all@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 9B129C180D5; Thu, 20 Oct 2016 01:21:11 +0000 (UTC) (envelope-from kevlo@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 6D394666; Thu, 20 Oct 2016 01:21:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9K1LAch040588; Thu, 20 Oct 2016 01:21:10 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9K1LAuZ040587; Thu, 20 Oct 2016 01:21:10 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201610200121.u9K1LAuZ040587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Thu, 20 Oct 2016 01:21:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307663 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 01:21:11 -0000 Author: kevlo Date: Thu Oct 20 01:21:10 2016 New Revision: 307663 URL: https://svnweb.freebsd.org/changeset/base/307663 Log: Remove register keyword. Reviewed by: kib Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Oct 20 01:19:37 2016 (r307662) +++ head/sys/kern/init_main.c Thu Oct 20 01:21:10 2016 (r307663) @@ -204,9 +204,9 @@ void mi_startup(void) { - register struct sysinit **sipp; /* system initialization*/ - register struct sysinit **xipp; /* interior loop of sort*/ - register struct sysinit *save; /* bubble*/ + struct sysinit **sipp; /* system initialization*/ + struct sysinit **xipp; /* interior loop of sort*/ + struct sysinit *save; /* bubble*/ #if defined(VERBOSE_SYSINIT) int last; From owner-svn-src-all@freebsd.org Thu Oct 20 02:03:20 2016 Return-Path: Delivered-To: svn-src-all@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 E955FC193C0; Thu, 20 Oct 2016 02:03:20 +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 BABB2F93; Thu, 20 Oct 2016 02:03:20 +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 u9K23J3D056866; Thu, 20 Oct 2016 02:03:19 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9K23Jwx056865; Thu, 20 Oct 2016 02:03:19 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201610200203.u9K23Jwx056865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 20 Oct 2016 02:03: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: r307664 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 02:03:21 -0000 Author: rmacklem Date: Thu Oct 20 02:03:19 2016 New Revision: 307664 URL: https://svnweb.freebsd.org/changeset/base/307664 Log: MFC: r306559 r297225 broke udp_output() for the case where the "addr" argument is NULL and the function jumps to the "release:" label. For this case, the "inp" was write locked, but the code attempted to read unlock it. This patch fixes the problem. This case could occur for NFS over UDP mounts, where the server was down for a few minutes under certain circumstances. Modified: stable/11/sys/netinet/udp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/udp_usrreq.c ============================================================================== --- stable/11/sys/netinet/udp_usrreq.c Thu Oct 20 01:21:10 2016 (r307663) +++ stable/11/sys/netinet/udp_usrreq.c Thu Oct 20 02:03:19 2016 (r307664) @@ -1559,12 +1559,18 @@ udp_output(struct inpcb *inp, struct mbu release: if (unlock_udbinfo == UH_WLOCKED) { + KASSERT(unlock_inp == UH_WLOCKED, + ("%s: excl udbinfo lock, shared inp lock", __func__)); INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); } else if (unlock_udbinfo == UH_RLOCKED) { + KASSERT(unlock_inp == UH_RLOCKED, + ("%s: shared udbinfo lock, excl inp lock", __func__)); INP_HASH_RUNLOCK(pcbinfo); INP_RUNLOCK(inp); - } else + } else if (unlock_inp == UH_WLOCKED) + INP_WUNLOCK(inp); + else INP_RUNLOCK(inp); m_freem(m); return (error); From owner-svn-src-all@freebsd.org Thu Oct 20 08:49:00 2016 Return-Path: Delivered-To: svn-src-all@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 71F9DC19291; Thu, 20 Oct 2016 08:49:00 +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 3274A3BF; Thu, 20 Oct 2016 08:49:00 +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 u9K8mxQn008084; Thu, 20 Oct 2016 08:48:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9K8mxbx008081; Thu, 20 Oct 2016 08:48:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610200848.u9K8mxbx008081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 20 Oct 2016 08:48: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: r307665 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 08:49:00 -0000 Author: mav Date: Thu Oct 20 08:48:58 2016 New Revision: 307665 URL: https://svnweb.freebsd.org/changeset/base/307665 Log: MFC r306762: Fix possible geom destruction before final provider close. Introduce internal counter to track opens. Using provider's counters is not very successfull after calling g_wither_provider(). Modified: stable/11/sys/geom/mirror/g_mirror.c stable/11/sys/geom/mirror/g_mirror.h stable/11/sys/geom/mirror/g_mirror_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Thu Oct 20 02:03:19 2016 (r307664) +++ stable/11/sys/geom/mirror/g_mirror.c Thu Oct 20 08:48:58 2016 (r307665) @@ -2137,10 +2137,9 @@ g_mirror_destroy_provider(struct g_mirro } } mtx_unlock(&sc->sc_queue_mtx); - G_MIRROR_DEBUG(0, "Device %s: provider %s destroyed.", sc->sc_name, - sc->sc_provider->name); g_wither_provider(sc->sc_provider, ENXIO); sc->sc_provider = NULL; + G_MIRROR_DEBUG(0, "Device %s: provider destroyed.", sc->sc_name); g_topology_unlock(); LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) @@ -2866,7 +2865,7 @@ static int g_mirror_access(struct g_provider *pp, int acr, int acw, int ace) { struct g_mirror_softc *sc; - int dcr, dcw, dce, error = 0; + int error = 0; g_topology_assert(); G_MIRROR_DEBUG(2, "Access request for %s: r%dw%de%d.", pp->name, acr, @@ -2877,30 +2876,21 @@ g_mirror_access(struct g_provider *pp, i return (0); KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); - dcr = pp->acr + acr; - dcw = pp->acw + acw; - dce = pp->ace + ace; - g_topology_unlock(); sx_xlock(&sc->sc_lock); if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0 || + (sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0 || LIST_EMPTY(&sc->sc_disks)) { if (acr > 0 || acw > 0 || ace > 0) error = ENXIO; goto end; } - if (dcw == 0) - g_mirror_idle(sc, dcw); - if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0) { - if (acr > 0 || acw > 0 || ace > 0) { - error = ENXIO; - goto end; - } - if (dcr == 0 && dcw == 0 && dce == 0) { - g_post_event(g_mirror_destroy_delayed, sc, M_WAITOK, - sc, NULL); - } - } + sc->sc_provider_open += acr + acw + ace; + if (pp->acw + acw == 0) + g_mirror_idle(sc, 0); + if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0 && + sc->sc_provider_open == 0) + g_post_event(g_mirror_destroy_delayed, sc, M_WAITOK, sc, NULL); end: sx_xunlock(&sc->sc_lock); g_topology_lock(); @@ -2957,6 +2947,7 @@ g_mirror_create(struct g_class *mp, cons gp->softc = sc; sc->sc_geom = gp; sc->sc_provider = NULL; + sc->sc_provider_open = 0; /* * Synchronization geom. */ @@ -2997,26 +2988,23 @@ int g_mirror_destroy(struct g_mirror_softc *sc, int how) { struct g_mirror_disk *disk; - struct g_provider *pp; g_topology_assert_not(); if (sc == NULL) return (ENXIO); sx_assert(&sc->sc_lock, SX_XLOCKED); - pp = sc->sc_provider; - if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0 || - SCHEDULER_STOPPED())) { + if (sc->sc_provider_open != 0 || SCHEDULER_STOPPED()) { switch (how) { case G_MIRROR_DESTROY_SOFT: G_MIRROR_DEBUG(1, - "Device %s is still open (r%dw%de%d).", pp->name, - pp->acr, pp->acw, pp->ace); + "Device %s is still open (%d).", sc->sc_name, + sc->sc_provider_open); return (EBUSY); case G_MIRROR_DESTROY_DELAYED: G_MIRROR_DEBUG(1, "Device %s will be destroyed on last close.", - pp->name); + sc->sc_name); LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) { @@ -3027,7 +3015,7 @@ g_mirror_destroy(struct g_mirror_softc * return (EBUSY); case G_MIRROR_DESTROY_HARD: G_MIRROR_DEBUG(1, "Device %s is still open, so it " - "can't be definitely removed.", pp->name); + "can't be definitely removed.", sc->sc_name); } } Modified: stable/11/sys/geom/mirror/g_mirror.h ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.h Thu Oct 20 02:03:19 2016 (r307664) +++ stable/11/sys/geom/mirror/g_mirror.h Thu Oct 20 08:48:58 2016 (r307665) @@ -179,6 +179,7 @@ struct g_mirror_softc { struct g_geom *sc_geom; struct g_provider *sc_provider; + int sc_provider_open; uint32_t sc_id; /* Mirror unique ID. */ Modified: stable/11/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror_ctl.c Thu Oct 20 02:03:19 2016 (r307664) +++ stable/11/sys/geom/mirror/g_mirror_ctl.c Thu Oct 20 08:48:58 2016 (r307665) @@ -658,8 +658,7 @@ g_mirror_ctl_resize(struct gctl_req *req return; } /* Deny shrinking of an opened provider */ - if ((g_debugflags & 16) == 0 && (sc->sc_provider->acr > 0 || - sc->sc_provider->acw > 0 || sc->sc_provider->ace > 0)) { + if ((g_debugflags & 16) == 0 && sc->sc_provider_open > 0) { if (sc->sc_mediasize > mediasize) { gctl_error(req, "Device %s is busy.", sc->sc_provider->name); From owner-svn-src-all@freebsd.org Thu Oct 20 09:06:41 2016 Return-Path: Delivered-To: svn-src-all@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 4B8F3C1997C; Thu, 20 Oct 2016 09:06:41 +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 02FB7F21; Thu, 20 Oct 2016 09:06:40 +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 u9K96ecw015438; Thu, 20 Oct 2016 09:06:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9K96d7e015434; Thu, 20 Oct 2016 09:06:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610200906.u9K96d7e015434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 20 Oct 2016 09:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307666 - stable/10/sys/geom/mirror X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 09:06:41 -0000 Author: mav Date: Thu Oct 20 09:06:39 2016 New Revision: 307666 URL: https://svnweb.freebsd.org/changeset/base/307666 Log: MFC r306762: Fix possible geom destruction before final provider close. Introduce internal counter to track opens. Using provider's counters is not very successfull after calling g_wither_provider(). Modified: stable/10/sys/geom/mirror/g_mirror.c stable/10/sys/geom/mirror/g_mirror.h stable/10/sys/geom/mirror/g_mirror_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror.c Thu Oct 20 08:48:58 2016 (r307665) +++ stable/10/sys/geom/mirror/g_mirror.c Thu Oct 20 09:06:39 2016 (r307666) @@ -2143,10 +2143,9 @@ g_mirror_destroy_provider(struct g_mirro } } mtx_unlock(&sc->sc_queue_mtx); - G_MIRROR_DEBUG(0, "Device %s: provider %s destroyed.", sc->sc_name, - sc->sc_provider->name); g_wither_provider(sc->sc_provider, ENXIO); sc->sc_provider = NULL; + G_MIRROR_DEBUG(0, "Device %s: provider destroyed.", sc->sc_name); g_topology_unlock(); LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) @@ -2872,7 +2871,7 @@ static int g_mirror_access(struct g_provider *pp, int acr, int acw, int ace) { struct g_mirror_softc *sc; - int dcr, dcw, dce, error = 0; + int error = 0; g_topology_assert(); G_MIRROR_DEBUG(2, "Access request for %s: r%dw%de%d.", pp->name, acr, @@ -2883,30 +2882,21 @@ g_mirror_access(struct g_provider *pp, i return (0); KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); - dcr = pp->acr + acr; - dcw = pp->acw + acw; - dce = pp->ace + ace; - g_topology_unlock(); sx_xlock(&sc->sc_lock); if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0 || + (sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0 || LIST_EMPTY(&sc->sc_disks)) { if (acr > 0 || acw > 0 || ace > 0) error = ENXIO; goto end; } - if (dcw == 0) - g_mirror_idle(sc, dcw); - if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0) { - if (acr > 0 || acw > 0 || ace > 0) { - error = ENXIO; - goto end; - } - if (dcr == 0 && dcw == 0 && dce == 0) { - g_post_event(g_mirror_destroy_delayed, sc, M_WAITOK, - sc, NULL); - } - } + sc->sc_provider_open += acr + acw + ace; + if (pp->acw + acw == 0) + g_mirror_idle(sc, 0); + if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0 && + sc->sc_provider_open == 0) + g_post_event(g_mirror_destroy_delayed, sc, M_WAITOK, sc, NULL); end: sx_xunlock(&sc->sc_lock); g_topology_lock(); @@ -2963,6 +2953,7 @@ g_mirror_create(struct g_class *mp, cons gp->softc = sc; sc->sc_geom = gp; sc->sc_provider = NULL; + sc->sc_provider_open = 0; /* * Synchronization geom. */ @@ -3003,25 +2994,23 @@ int g_mirror_destroy(struct g_mirror_softc *sc, int how) { struct g_mirror_disk *disk; - struct g_provider *pp; g_topology_assert_not(); if (sc == NULL) return (ENXIO); sx_assert(&sc->sc_lock, SX_XLOCKED); - pp = sc->sc_provider; - if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) { + if (sc->sc_provider_open != 0) { switch (how) { case G_MIRROR_DESTROY_SOFT: G_MIRROR_DEBUG(1, - "Device %s is still open (r%dw%de%d).", pp->name, - pp->acr, pp->acw, pp->ace); + "Device %s is still open (%d).", sc->sc_name, + sc->sc_provider_open); return (EBUSY); case G_MIRROR_DESTROY_DELAYED: G_MIRROR_DEBUG(1, "Device %s will be destroyed on last close.", - pp->name); + sc->sc_name); LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) { @@ -3032,7 +3021,7 @@ g_mirror_destroy(struct g_mirror_softc * return (EBUSY); case G_MIRROR_DESTROY_HARD: G_MIRROR_DEBUG(1, "Device %s is still open, so it " - "can't be definitely removed.", pp->name); + "can't be definitely removed.", sc->sc_name); } } Modified: stable/10/sys/geom/mirror/g_mirror.h ============================================================================== --- stable/10/sys/geom/mirror/g_mirror.h Thu Oct 20 08:48:58 2016 (r307665) +++ stable/10/sys/geom/mirror/g_mirror.h Thu Oct 20 09:06:39 2016 (r307666) @@ -179,6 +179,7 @@ struct g_mirror_softc { struct g_geom *sc_geom; struct g_provider *sc_provider; + int sc_provider_open; uint32_t sc_id; /* Mirror unique ID. */ Modified: stable/10/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror_ctl.c Thu Oct 20 08:48:58 2016 (r307665) +++ stable/10/sys/geom/mirror/g_mirror_ctl.c Thu Oct 20 09:06:39 2016 (r307666) @@ -658,8 +658,7 @@ g_mirror_ctl_resize(struct gctl_req *req return; } /* Deny shrinking of an opened provider */ - if ((g_debugflags & 16) == 0 && (sc->sc_provider->acr > 0 || - sc->sc_provider->acw > 0 || sc->sc_provider->ace > 0)) { + if ((g_debugflags & 16) == 0 && sc->sc_provider_open > 0) { if (sc->sc_mediasize > mediasize) { gctl_error(req, "Device %s is busy.", sc->sc_provider->name); From owner-svn-src-all@freebsd.org Thu Oct 20 09:22:11 2016 Return-Path: Delivered-To: svn-src-all@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 E0778C19EC3; Thu, 20 Oct 2016 09:22:11 +0000 (UTC) (envelope-from andrew@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 BD4081818; Thu, 20 Oct 2016 09:22:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9K9MAmv023166; Thu, 20 Oct 2016 09:22:10 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9K9MACE023160; Thu, 20 Oct 2016 09:22:10 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201610200922.u9K9MACE023160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 20 Oct 2016 09:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307667 - in head: share/man/man9 sys/arm64/arm64 sys/arm64/include sys/opencrypto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 09:22:12 -0000 Author: andrew Date: Thu Oct 20 09:22:10 2016 New Revision: 307667 URL: https://svnweb.freebsd.org/changeset/base/307667 Log: Add support for the fpu_kern(9) KPI on arm64. It hooks into the existing VFP code to store the old context, with lazy loading of the new context when needed. FPU_KERN_NOCTX is missing as this is unused in the crypto code this has been tested with, and I am unsure on the requirements of the UEFI Runtime Services. Reviewed by: kib Obtained from: ABT Systeems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8276 Modified: head/share/man/man9/fpu_kern.9 head/sys/arm64/arm64/trap.c head/sys/arm64/arm64/vfp.c head/sys/arm64/include/pcb.h head/sys/arm64/include/vfp.h head/sys/opencrypto/crypto.c Modified: head/share/man/man9/fpu_kern.9 ============================================================================== --- head/share/man/man9/fpu_kern.9 Thu Oct 20 09:06:39 2016 (r307666) +++ head/share/man/man9/fpu_kern.9 Thu Oct 20 09:22:10 2016 (r307667) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2014 +.Dd October 20, 2016 .Dt FPU_KERN 9 .Os .Sh NAME @@ -134,11 +134,11 @@ of increased system latency. .El .Pp The function does not sleep or block. -It could cause the +It could cause an FPU trap during execution, and on the first FPU access +after the function returns, as well as after each context switch. +On i386 and amd64 this will be the .Nm Device Not Available -exception during execution, and on the first FPU access after the -function returns, as well as after each context switch -(see Intel Software Developer Manual for the reference). +exception (see Intel Software Developer Manual for the reference). Currently, no errors are defined which can be returned by .Fn fpu_kern_enter to the caller. @@ -190,7 +190,7 @@ and false otherwise. .Sh NOTES The .Nm -is currently implemented only for the i386 and amd64 architectures. +is currently implemented only for the i386, amd64, and arm64 architectures. .Pp There is no way to handle floating point exceptions raised from kernel mode. @@ -208,3 +208,5 @@ The .Nm facitily and this manual page were written by .An Konstantin Belousov Aq Mt kib@FreeBSD.org . +The arm64 support was added by +.An Andrew Turner Aq Mt andrew@FreeBSD.org . Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Oct 20 09:06:39 2016 (r307666) +++ head/sys/arm64/arm64/trap.c Thu Oct 20 09:22:10 2016 (r307667) @@ -282,9 +282,17 @@ do_el1h_sync(struct trapframe *frame) switch(exception) { case EXCP_FP_SIMD: case EXCP_TRAP_FP: - print_registers(frame); - printf(" esr: %.8lx\n", esr); - panic("VFP exception in the kernel"); +#ifdef VFP + if ((curthread->td_pcb->pcb_fpflags & PCB_FP_KERN) != 0) { + vfp_restore_state(); + } else +#endif + { + print_registers(frame); + printf(" esr: %.8lx\n", esr); + panic("VFP exception in the kernel"); + } + break; case EXCP_INSN_ABORT: case EXCP_DATA_ABORT: far = READ_SPECIALREG(far_el1); @@ -412,6 +420,9 @@ do_el0_sync(struct trapframe *frame) KASSERT((curthread->td_pcb->pcb_fpflags & ~PCB_FP_USERMASK) == 0, ("Kernel VFP flags set while entering userspace")); + KASSERT( + curthread->td_pcb->pcb_fpusaved == &curthread->td_pcb->pcb_fpustate, + ("Kernel VFP state in use when entering userspace")); } void Modified: head/sys/arm64/arm64/vfp.c ============================================================================== --- head/sys/arm64/arm64/vfp.c Thu Oct 20 09:06:39 2016 (r307666) +++ head/sys/arm64/arm64/vfp.c Thu Oct 20 09:22:10 2016 (r307667) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 The FreeBSD Foundation + * Copyright (c) 2015-2016 The FreeBSD Foundation * All rights reserved. * * This software was developed by Andrew Turner under @@ -48,6 +48,14 @@ CTASSERT(sizeof(((struct pcb *)0)->pcb_f static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", "Kernel contexts for VFP state"); +struct fpu_kern_ctx { + struct vfpstate *prev; +#define FPU_KERN_CTX_DUMMY 0x01 /* avoided save for the kern thread */ +#define FPU_KERN_CTX_INUSE 0x02 + uint32_t flags; + struct vfpstate state; +}; + static void vfp_enable(void) { @@ -71,9 +79,10 @@ vfp_disable(void) } /* - * Called when the thread is dying. If the thread was the last to use the - * VFP unit mark it as unused to tell the kernel the fp state is unowned. - * Ensure the VFP unit is off so we get an exception on the next access. + * Called when the thread is dying or when discarding the kernel VFP state. + * If the thread was the last to use the VFP unit mark it as unused to tell + * the kernel the fp state is unowned. Ensure the VFP unit is off so we get + * an exception on the next access. */ void vfp_discard(struct thread *td) @@ -226,4 +235,111 @@ vfp_init(void) SYSINIT(vfp, SI_SUB_CPU, SI_ORDER_ANY, vfp_init, NULL); +struct fpu_kern_ctx * +fpu_kern_alloc_ctx(u_int flags) +{ + struct fpu_kern_ctx *res; + size_t sz; + + sz = sizeof(struct fpu_kern_ctx); + res = malloc(sz, M_FPUKERN_CTX, ((flags & FPU_KERN_NOWAIT) ? + M_NOWAIT : M_WAITOK) | M_ZERO); + return (res); +} + +void +fpu_kern_free_ctx(struct fpu_kern_ctx *ctx) +{ + + KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) == 0, ("free'ing inuse ctx")); + /* XXXAndrew clear the memory ? */ + free(ctx, M_FPUKERN_CTX); +} + +int +fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) +{ + struct pcb *pcb; + + pcb = td->td_pcb; + KASSERT(ctx == NULL || (ctx->flags & FPU_KERN_CTX_INUSE) == 0, + ("using inuse ctx")); + + if ((flags & FPU_KERN_KTHR) != 0 && is_fpu_kern_thread(0)) { + ctx->flags = FPU_KERN_CTX_DUMMY | FPU_KERN_CTX_INUSE; + return (0); + } + /* + * Check either we are already using the VFP in the kernel, or + * the the saved state points to the default user space. + */ + KASSERT((pcb->pcb_fpflags & PCB_FP_KERN) != 0 || + pcb->pcb_fpusaved == &pcb->pcb_fpustate, + ("Mangled pcb_fpusaved %x %p %p", pcb->pcb_fpflags, pcb->pcb_fpusaved, &pcb->pcb_fpustate)); + ctx->flags = FPU_KERN_CTX_INUSE; + vfp_save_state(curthread, pcb); + ctx->prev = pcb->pcb_fpusaved; + pcb->pcb_fpusaved = &ctx->state; + pcb->pcb_fpflags |= PCB_FP_KERN; + pcb->pcb_fpflags &= ~PCB_FP_STARTED; + + return (0); +} + +int +fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx) +{ + struct pcb *pcb; + + pcb = td->td_pcb; + + KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) != 0, + ("FPU context not inuse")); + ctx->flags &= ~FPU_KERN_CTX_INUSE; + + if (is_fpu_kern_thread(0) && + (ctx->flags & FPU_KERN_CTX_DUMMY) != 0) + return (0); + KASSERT((ctx->flags & FPU_KERN_CTX_DUMMY) == 0, ("dummy ctx")); + critical_enter(); + vfp_discard(td); + critical_exit(); + pcb->pcb_fpflags &= ~PCB_FP_STARTED; + pcb->pcb_fpusaved = ctx->prev; + + if (pcb->pcb_fpusaved == &pcb->pcb_fpustate) { + pcb->pcb_fpflags &= ~PCB_FP_KERN; + } else { + KASSERT((pcb->pcb_fpflags & PCB_FP_KERN) != 0, + ("unpaired fpu_kern_leave")); + } + + return (0); +} + +int +fpu_kern_thread(u_int flags) +{ + struct pcb *pcb = curthread->td_pcb; + + KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, + ("Only kthread may use fpu_kern_thread")); + KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate, + ("Mangled pcb_fpusaved")); + KASSERT((pcb->pcb_fpflags & PCB_FP_KERN) == 0, + ("Thread already setup for the VFP")); + pcb->pcb_fpflags |= PCB_FP_KERN; + return (0); +} + +int +is_fpu_kern_thread(u_int flags) +{ + struct pcb *curpcb; + + if ((curthread->td_pflags & TDP_KTHREAD) == 0) + return (0); + curpcb = curthread->td_pcb; + return ((curpcb->pcb_fpflags & PCB_FP_KERN) != 0); +} #endif Modified: head/sys/arm64/include/pcb.h ============================================================================== --- head/sys/arm64/include/pcb.h Thu Oct 20 09:06:39 2016 (r307666) +++ head/sys/arm64/include/pcb.h Thu Oct 20 09:22:10 2016 (r307667) @@ -54,6 +54,7 @@ struct pcb { struct vfpstate *pcb_fpusaved; int pcb_fpflags; #define PCB_FP_STARTED 0x01 +#define PCB_FP_KERN 0x02 /* The bits passed to userspace in get_fpcontext */ #define PCB_FP_USERMASK (PCB_FP_STARTED) u_int pcb_vfpcpu; /* Last cpu this thread ran VFP code */ Modified: head/sys/arm64/include/vfp.h ============================================================================== --- head/sys/arm64/include/vfp.h Thu Oct 20 09:06:39 2016 (r307666) +++ head/sys/arm64/include/vfp.h Thu Oct 20 09:22:10 2016 (r307667) @@ -45,6 +45,23 @@ void vfp_init(void); void vfp_discard(struct thread *); void vfp_restore_state(void); void vfp_save_state(struct thread *, struct pcb *); + +struct fpu_kern_ctx; + +/* + * Flags for fpu_kern_alloc_ctx(), fpu_kern_enter() and fpu_kern_thread(). + */ +#define FPU_KERN_NORMAL 0x0000 +#define FPU_KERN_NOWAIT 0x0001 +#define FPU_KERN_KTHR 0x0002 + +struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int); +void fpu_kern_free_ctx(struct fpu_kern_ctx *); +int fpu_kern_enter(struct thread *, struct fpu_kern_ctx *, u_int); +int fpu_kern_leave(struct thread *, struct fpu_kern_ctx *); +int fpu_kern_thread(u_int); +int is_fpu_kern_thread(u_int); + #endif #endif Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Thu Oct 20 09:06:39 2016 (r307666) +++ head/sys/opencrypto/crypto.c Thu Oct 20 09:22:10 2016 (r307667) @@ -81,7 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include "cryptodev_if.h" -#if defined(__i386__) || defined(__amd64__) +#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) #include #endif @@ -1246,7 +1246,7 @@ crypto_proc(void) u_int32_t hid; int result, hint; -#if defined(__i386__) || defined(__amd64__) +#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) fpu_kern_thread(FPU_KERN_NORMAL); #endif From owner-svn-src-all@freebsd.org Thu Oct 20 11:24:00 2016 Return-Path: Delivered-To: svn-src-all@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 CE47DC1A9C5; Thu, 20 Oct 2016 11:24:00 +0000 (UTC) (envelope-from wma@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 9DAF7C36; Thu, 20 Oct 2016 11:24:00 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KBNxjx069076; Thu, 20 Oct 2016 11:23:59 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KBNxGU069072; Thu, 20 Oct 2016 11:23:59 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201610201123.u9KBNxGU069072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 20 Oct 2016 11:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307668 - in head/sys: arm/annapurna/alpine boot/fdt/dts/arm conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 11:24:00 -0000 Author: wma Date: Thu Oct 20 11:23:59 2016 New Revision: 307668 URL: https://svnweb.freebsd.org/changeset/base/307668 Log: Support for MSI-X on Annapurna Alpine This patch adds support for MSI-X interrupts on Annapurna Alpine platform. MSI-X on Alpine work similarly to GICv2m, i.e. some range of SPI interrupts is reserved in GIC and individual SPIs can be triggered by MSI-X messages. This SPI range is defined in FDT. Obtained from: Semihalf Submitted by: Michal Stanek Sponsored by: Annapurna Labs Reviewed by: nwhitehorn, wma Differential Revision: https://reviews.freebsd.org/D7579 Added: head/sys/arm/annapurna/alpine/alpine_pci_msix.c (contents, props changed) Modified: head/sys/boot/fdt/dts/arm/annapurna-alpine.dts head/sys/conf/files.arm head/sys/conf/files.arm64 Added: head/sys/arm/annapurna/alpine/alpine_pci_msix.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/annapurna/alpine/alpine_pci_msix.c Thu Oct 20 11:23:59 2016 (r307668) @@ -0,0 +1,394 @@ +/*- + * Copyright (c) 2015,2016 Annapurna Labs Ltd. and affiliates + * All rights reserved. + * + * Developed by Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "msi_if.h" +#include "pic_if.h" + +#define AL_SPI_INTR 0 +#define AL_EDGE_HIGH 1 +#define ERR_NOT_IN_MAP -1 +#define IRQ_OFFSET 1 +#define GIC_INTR_CELL_CNT 3 +#define INTR_RANGE_COUNT 2 +#define MAX_MSIX_COUNT 160 + +static int al_msix_attach(device_t); +static int al_msix_probe(device_t); + +static msi_alloc_msi_t al_msix_alloc_msi; +static msi_release_msi_t al_msix_release_msi; +static msi_alloc_msix_t al_msix_alloc_msix; +static msi_release_msix_t al_msix_release_msix; +static msi_map_msi_t al_msix_map_msi; + +static int al_find_intr_pos_in_map(device_t, struct intr_irqsrc *); + +static struct ofw_compat_data compat_data[] = { + {"annapurna-labs,al-msix", true}, + {"annapurna-labs,alpine-msix", true}, + {NULL, false} +}; + +/* + * Bus interface definitions. + */ +static device_method_t al_msix_methods[] = { + DEVMETHOD(device_probe, al_msix_probe), + DEVMETHOD(device_attach, al_msix_attach), + + /* Interrupt controller interface */ + DEVMETHOD(msi_alloc_msi, al_msix_alloc_msi), + DEVMETHOD(msi_release_msi, al_msix_release_msi), + DEVMETHOD(msi_alloc_msix, al_msix_alloc_msix), + DEVMETHOD(msi_release_msix, al_msix_release_msix), + DEVMETHOD(msi_map_msi, al_msix_map_msi), + + DEVMETHOD_END +}; + +struct al_msix_softc { + bus_addr_t base_addr; + struct resource *res; + uint32_t irq_min; + uint32_t irq_max; + uint32_t irq_count; + struct mtx msi_mtx; + vmem_t *irq_alloc; + device_t gic_dev; + /* Table of isrcs maps isrc pointer to vmem_alloc'd irq number */ + struct intr_irqsrc *isrcs[MAX_MSIX_COUNT]; +}; + +static driver_t al_msix_driver = { + "al_msix", + al_msix_methods, + sizeof(struct al_msix_softc), +}; + +devclass_t al_msix_devclass; + +DRIVER_MODULE(al_msix, ofwbus, al_msix_driver, al_msix_devclass, 0, 0); +DRIVER_MODULE(al_msix, simplebus, al_msix_driver, al_msix_devclass, 0, 0); + +MALLOC_DECLARE(M_AL_MSIX); +MALLOC_DEFINE(M_AL_MSIX, "al_msix", "Alpine MSIX"); + +static int +al_msix_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "Annapurna-Labs MSI-X Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +al_msix_attach(device_t dev) +{ + struct al_msix_softc *sc; + device_t gic_dev; + phandle_t iparent; + phandle_t node; + intptr_t xref; + int interrupts[INTR_RANGE_COUNT]; + int nintr, i, rid; + uint32_t icells, *intr; + + sc = device_get_softc(dev); + + node = ofw_bus_get_node(dev); + xref = OF_xref_from_node(node); + OF_device_register_xref(xref, dev); + + rid = 0; + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "Failed to allocate resource\n"); + return (ENXIO); + } + + sc->base_addr = (bus_addr_t)rman_get_start(sc->res); + + /* Register this device to handle MSI interrupts */ + if (intr_msi_register(dev, xref) != 0) { + device_printf(dev, "could not register MSI-X controller\n"); + return (ENXIO); + } + else + device_printf(dev, "MSI-X controller registered\n"); + + /* Find root interrupt controller */ + iparent = ofw_bus_find_iparent(node); + if (iparent == 0) { + device_printf(dev, "No interrupt-parrent found. " + "Error in DTB\n"); + return (ENXIO); + } else { + /* While at parent - store interrupt cells prop */ + if (OF_searchencprop(OF_node_from_xref(iparent), + "#interrupt-cells", &icells, sizeof(icells)) == -1) { + device_printf(dev, "DTB: Missing #interrupt-cells " + "property in GIC node\n"); + return (ENXIO); + } + } + + gic_dev = OF_device_from_xref(iparent); + if (gic_dev == NULL) { + device_printf(dev, "Cannot find GIC device\n"); + return (ENXIO); + } + sc->gic_dev = gic_dev; + + /* Manually read range of interrupts from DTB */ + nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), + (void **)&intr); + if (nintr == 0) { + device_printf(dev, "Cannot read interrupts prop from DTB\n"); + return (ENXIO); + } else if ((nintr / icells) != INTR_RANGE_COUNT) { + /* Supposed to have min and max value only */ + device_printf(dev, "Unexpected count of interrupts " + "in DTB node\n"); + return (EINVAL); + } + + /* Read interrupt range values */ + for (i = 0; i < INTR_RANGE_COUNT; i++) + interrupts[i] = intr[(i * icells) + IRQ_OFFSET]; + + sc->irq_min = interrupts[0]; + sc->irq_max = interrupts[1]; + sc->irq_count = (sc->irq_max - sc->irq_min + 1); + + if (sc->irq_count > MAX_MSIX_COUNT) { + device_printf(dev, "Available MSI-X count exceeds buffer size." + " Capping to %d\n", MAX_MSIX_COUNT); + sc->irq_count = MAX_MSIX_COUNT; + } + + mtx_init(&sc->msi_mtx, "msi_mtx", NULL, MTX_DEF); + + sc->irq_alloc = vmem_create("Alpine MSI-X IRQs", 0, sc->irq_count, + 1, 0, M_FIRSTFIT | M_WAITOK); + + device_printf(dev, "MSI-X SPI IRQ %d-%d\n", sc->irq_min, sc->irq_max); + + return (bus_generic_attach(dev)); +} + +static int +al_find_intr_pos_in_map(device_t dev, struct intr_irqsrc *isrc) +{ + struct al_msix_softc *sc; + int i; + + sc = device_get_softc(dev); + for (i = 0; i < MAX_MSIX_COUNT; i++) + if (sc->isrcs[i] == isrc) + return (i); + return (ERR_NOT_IN_MAP); +} + +static int +al_msix_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc, + uint64_t *addr, uint32_t *data) +{ + struct al_msix_softc *sc; + int i, spi; + + sc = device_get_softc(dev); + + i = al_find_intr_pos_in_map(dev, isrc); + if (i == ERR_NOT_IN_MAP) + return (EINVAL); + + spi = sc->irq_min + i; + + /* + * MSIX message address format: + * [63:20] - MSIx TBAR + * Same value as the MSIx Translation Base Address Register + * [19] - WFE_EXIT + * Once set by MSIx message, an EVENTI is signal to the CPUs + * cluster specified by ‘Local GIC Target List’ + * [18:17] - Target GIC ID + * Specifies which IO-GIC (external shared GIC) is targeted + * 0: Local GIC, as specified by the Local GIC Target List + * 1: IO-GIC 0 + * 2: Reserved + * 3: Reserved + * [16:13] - Local GIC Target List + * Specifies the Local GICs list targeted by this MSIx + * message. + * [16] If set, SPIn is set in Cluster 0 local GIC + * [15:13] Reserved + * [15] If set, SPIn is set in Cluster 1 local GIC + * [14] If set, SPIn is set in Cluster 2 local GIC + * [13] If set, SPIn is set in Cluster 3 local GIC + * [12:3] - SPIn + * Specifies the SPI (Shared Peripheral Interrupt) index to + * be set in target GICs + * Notes: + * If targeting any local GIC than only SPI[249:0] are valid + * [2] - Function vector + * MSI Data vector extension hint + * [1:0] - Reserved + * Must be set to zero + */ + *addr = (uint64_t)sc->base_addr + (uint64_t)((1 << 16) + (spi << 3)); + *data = 0; + + if (bootverbose) + device_printf(dev, "MSI mapping: SPI: %d addr: %jx data: %x\n", + spi, (uintmax_t)*addr, *data); + return (0); +} + +static int +al_msix_alloc_msi(device_t dev, device_t child, int count, int maxcount, + device_t *pic, struct intr_irqsrc **srcs) +{ + struct intr_map_data_fdt *fdt_data; + struct al_msix_softc *sc; + vmem_addr_t irq_base; + int error; + u_int i, j; + + sc = device_get_softc(dev); + + if ((powerof2(count) == 0) || (count > 8)) + return (EINVAL); + + if (vmem_alloc(sc->irq_alloc, count, M_FIRSTFIT | M_NOWAIT, + &irq_base) != 0) + return (ENOMEM); + + /* Fabricate OFW data to get ISRC from GIC and return it */ + fdt_data = malloc(sizeof(*fdt_data) + + GIC_INTR_CELL_CNT * sizeof(pcell_t), M_AL_MSIX, M_WAITOK); + fdt_data->hdr.type = INTR_MAP_DATA_FDT; + fdt_data->iparent = 0; + fdt_data->ncells = GIC_INTR_CELL_CNT; + fdt_data->cells[0] = AL_SPI_INTR; /* code for SPI interrupt */ + fdt_data->cells[1] = 0; /* SPI number (uninitialized) */ + fdt_data->cells[2] = AL_EDGE_HIGH; /* trig = edge, pol = high */ + + mtx_lock(&sc->msi_mtx); + + for (i = irq_base; i < irq_base + count; i++) { + fdt_data->cells[1] = sc->irq_min + i; + error = PIC_MAP_INTR(sc->gic_dev, + (struct intr_map_data *)fdt_data, srcs); + if (error) { + for (j = irq_base; j < i; j++) + sc->isrcs[j] = NULL; + mtx_unlock(&sc->msi_mtx); + vmem_free(sc->irq_alloc, irq_base, count); + free(fdt_data, M_AL_MSIX); + return (error); + } + + sc->isrcs[i] = *srcs; + srcs++; + } + + mtx_unlock(&sc->msi_mtx); + free(fdt_data, M_AL_MSIX); + + if (bootverbose) + device_printf(dev, + "MSI-X allocation: start SPI %d, count %d\n", + (int)irq_base + sc->irq_min, count); + + *pic = sc->gic_dev; + + return (0); +} + +static int +al_msix_release_msi(device_t dev, device_t child, int count, + struct intr_irqsrc **srcs) +{ + struct al_msix_softc *sc; + int i, pos; + + sc = device_get_softc(dev); + + mtx_lock(&sc->msi_mtx); + + pos = al_find_intr_pos_in_map(dev, *srcs); + vmem_free(sc->irq_alloc, pos, count); + for (i = 0; i < count; i++) { + pos = al_find_intr_pos_in_map(dev, *srcs); + if (pos != ERR_NOT_IN_MAP) + sc->isrcs[pos] = NULL; + srcs++; + } + + mtx_unlock(&sc->msi_mtx); + + return (0); +} + +static int +al_msix_alloc_msix(device_t dev, device_t child, device_t *pic, + struct intr_irqsrc **isrcp) +{ + + return (al_msix_alloc_msi(dev, child, 1, 1, pic, isrcp)); +} + +static int +al_msix_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) +{ + + return (al_msix_release_msi(dev, child, 1, &isrc)); +} Modified: head/sys/boot/fdt/dts/arm/annapurna-alpine.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/annapurna-alpine.dts Thu Oct 20 09:22:10 2016 (r307667) +++ head/sys/boot/fdt/dts/arm/annapurna-alpine.dts Thu Oct 20 11:23:59 2016 (r307668) @@ -170,6 +170,16 @@ }; }; + /* MSIX Configuration */ + msix: msix { + compatible = "annapurna-labs,al-msix"; + #address-cells = <2>; + #size-cells = <1>; + reg = <0xfbe00000 0x100000>; + interrupts = <0 96 1 0 159 1>; + interrupt-parent = <&MPIC>; + }; + pcie-internal { compatible = "annapurna-labs,al-internal-pcie"; device_type = "pci"; @@ -182,6 +192,7 @@ <0x3800 0 0 1 &MPIC 0 36 4>, <0x4000 0 0 1 &MPIC 0 43 4>, // SATA 0 (PCIe expander) <0x4800 0 0 1 &MPIC 0 44 1>; // SATA 1 (onboard) + msi-parent = <&msix>; // ranges: // - ECAM - non prefetchable config space Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Thu Oct 20 09:22:10 2016 (r307667) +++ head/sys/conf/files.arm Thu Oct 20 11:23:59 2016 (r307668) @@ -14,6 +14,7 @@ cloudabi32_vdso_blob.o optional compat_ arm/annapurna/alpine/alpine_ccu.c optional al_ccu fdt arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt arm/annapurna/alpine/alpine_pci.c optional al_pci fdt +arm/annapurna/alpine/alpine_pci_msix.c optional al_pci fdt arm/arm/autoconf.c standard arm/arm/bcopy_page.S standard arm/arm/bcopyinout.S standard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Oct 20 09:22:10 2016 (r307667) +++ head/sys/conf/files.arm64 Thu Oct 20 11:23:59 2016 (r307668) @@ -41,6 +41,7 @@ arm/allwinner/if_awg.c optional awg arm/annapurna/alpine/alpine_ccu.c optional al_ccu fdt arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt arm/annapurna/alpine/alpine_pci.c optional al_pci fdt +arm/annapurna/alpine/alpine_pci_msix.c optional al_pci fdt arm/arm/generic_timer.c standard arm/arm/gic.c standard arm/arm/gic_fdt.c optional fdt From owner-svn-src-all@freebsd.org Thu Oct 20 11:26:53 2016 Return-Path: Delivered-To: svn-src-all@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 0527DC1AA94; Thu, 20 Oct 2016 11:26:53 +0000 (UTC) (envelope-from wma@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 B9D67E5F; Thu, 20 Oct 2016 11:26:52 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KBQp3x069216; Thu, 20 Oct 2016 11:26:51 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KBQpX7069210; Thu, 20 Oct 2016 11:26:51 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201610201126.u9KBQpX7069210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 20 Oct 2016 11:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307669 - in head/sys: arm/annapurna/alpine boot/fdt/dts/arm conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 11:26:53 -0000 Author: wma Date: Thu Oct 20 11:26:51 2016 New Revision: 307669 URL: https://svnweb.freebsd.org/changeset/base/307669 Log: Support for Alpine Serializer/Deserializer. The exported functions will be used by Alpine Ethernet driver. Obtained from: Semihalf Submitted by: Michal Stanek Sponsored by: Annapurna Labs Reviewed by: wma Differential Revision: https://reviews.freebsd.org/D7763 Added: head/sys/arm/annapurna/alpine/alpine_serdes.c (contents, props changed) head/sys/arm/annapurna/alpine/alpine_serdes.h (contents, props changed) Modified: head/sys/boot/fdt/dts/arm/annapurna-alpine.dts head/sys/conf/files.arm head/sys/conf/files.arm64 Added: head/sys/arm/annapurna/alpine/alpine_serdes.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/annapurna/alpine/alpine_serdes.c Thu Oct 20 11:26:51 2016 (r307669) @@ -0,0 +1,225 @@ +/*- + * Copyright (c) 2015,2016 Annapurna Labs Ltd. and affiliates + * All rights reserved. + * + * Developed by Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "al_serdes.h" +#include "alpine_serdes.h" + +#define SERDES_NUM_GROUPS 5 + +static void *serdes_base; +static uint32_t serdes_grp_offset[] = {0, 0x400, 0x800, 0xc00, 0x2000}; + +static struct alpine_serdes_eth_group_mode { + struct mtx lock; + enum alpine_serdes_eth_mode mode; + bool mode_set; +} alpine_serdes_eth_group_mode[SERDES_NUM_GROUPS]; + +static int al_serdes_probe(device_t dev); +static int al_serdes_attach(device_t dev); +static int al_serdes_detach(device_t dev); + +static struct resource_spec al_serdes_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct al_serdes_softc { + struct resource *res; +}; + +static device_method_t al_serdes_methods[] = { + DEVMETHOD(device_probe, al_serdes_probe), + DEVMETHOD(device_attach, al_serdes_attach), + DEVMETHOD(device_detach, al_serdes_detach), + + DEVMETHOD_END +}; + +static driver_t al_serdes_driver = { + "serdes", + al_serdes_methods, + sizeof(struct al_serdes_softc) +}; + +static devclass_t al_serdes_devclass; + +DRIVER_MODULE(al_serdes, simplebus, al_serdes_driver, + al_serdes_devclass, 0, 0); +DRIVER_MODULE(al_serdes, ofwbus, al_serdes_driver, + al_serdes_devclass, 0, 0); + +static int +al_serdes_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "annapurna-labs,al-serdes")) + return (ENXIO); + + device_set_desc(dev, "Alpine Serdes"); + + return (BUS_PROBE_DEFAULT); +} + +static int +al_serdes_attach(device_t dev) +{ + struct al_serdes_softc *sc; + int err; + + sc = device_get_softc(dev); + + err = bus_alloc_resources(dev, al_serdes_spec, &sc->res); + if (err != 0) { + device_printf(dev, "could not allocate resources\n"); + return (err); + } + + /* Initialize Serdes group locks and mode */ + for (int i = 0; i < nitems(alpine_serdes_eth_group_mode); i++) { + mtx_init(&alpine_serdes_eth_group_mode[i].lock, "AlSerdesMtx", + NULL, MTX_DEF); + alpine_serdes_eth_group_mode[i].mode_set = false; + } + + serdes_base = (void *)rman_get_bushandle(sc->res); + + return (0); +} + +static int +al_serdes_detach(device_t dev) +{ + struct al_serdes_softc *sc; + + sc = device_get_softc(dev); + + bus_release_resources(dev, al_serdes_spec, &sc->res); + + for (int i = 0; i < nitems(alpine_serdes_eth_group_mode); i++) { + mtx_destroy(&alpine_serdes_eth_group_mode[i].lock); + alpine_serdes_eth_group_mode[i].mode_set = false; + } + + return (0); +} + +void * +alpine_serdes_resource_get(uint32_t group) +{ + void *base; + + base = NULL; + if (group >= SERDES_NUM_GROUPS) + return (NULL); + + if (serdes_base != NULL) + base = (void *)((uintptr_t)serdes_base + + serdes_grp_offset[group]); + + return (base); +} + +int +alpine_serdes_eth_mode_set(uint32_t group, enum alpine_serdes_eth_mode mode) +{ + struct alpine_serdes_eth_group_mode *group_mode; + + group_mode = &alpine_serdes_eth_group_mode[group]; + + if (serdes_base == NULL) + return (EINVAL); + + if (group >= SERDES_NUM_GROUPS) + return (EINVAL); + + mtx_lock(&group_mode->lock); + + if (!group_mode->mode_set || (group_mode->mode != mode)) { + struct al_serdes_grp_obj obj; + + al_serdes_handle_grp_init(alpine_serdes_resource_get(group), + group, &obj); + + if (mode == ALPINE_SERDES_ETH_MODE_SGMII) + obj.mode_set_sgmii(&obj); + else + obj.mode_set_kr(&obj); + + group_mode->mode = mode; + group_mode->mode_set = true; + } + + mtx_unlock(&group_mode->lock); + + return (0); +} + +void +alpine_serdes_eth_group_lock(uint32_t group) +{ + struct alpine_serdes_eth_group_mode *group_mode; + + group_mode = &alpine_serdes_eth_group_mode[group]; + + if (mtx_initialized(&group_mode->lock) == 0) + return; + + mtx_lock(&group_mode->lock); +} + +void +alpine_serdes_eth_group_unlock(uint32_t group) +{ + struct alpine_serdes_eth_group_mode *group_mode; + + group_mode = &alpine_serdes_eth_group_mode[group]; + + if (mtx_initialized(&group_mode->lock) == 0) + return; + + mtx_unlock(&group_mode->lock); +} Added: head/sys/arm/annapurna/alpine/alpine_serdes.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/annapurna/alpine/alpine_serdes.h Thu Oct 20 11:26:51 2016 (r307669) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2015,2016 Annapurna Labs Ltd. and affiliates + * All rights reserved. + * + * Developed by Semihalf. + * + * 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 __ALPINE_SERDES_H__ +#define __ALPINE_SERDES_H__ + +/* SerDes ETH mode */ +enum alpine_serdes_eth_mode { + ALPINE_SERDES_ETH_MODE_SGMII, + ALPINE_SERDES_ETH_MODE_KR, +}; + +/* + * Get SerDes group regs base, to be used in relevant Alpine drivers. + * Valid group is 0..3. + * Returns virtual base address of the group regs base. + */ +void *alpine_serdes_resource_get(uint32_t group); + +/* + * Set SerDes ETH mode for an entire group, unless already set + * Valid group is 0..3. + * Returns 0 upon success. + */ +int alpine_serdes_eth_mode_set(uint32_t group, + enum alpine_serdes_eth_mode mode); + +/* Lock the all serdes group for using common registers */ +void alpine_serdes_eth_group_lock(uint32_t group); + +/* Unlock the all serdes group for using common registers */ +void alpine_serdes_eth_group_unlock(uint32_t group); + +#endif /* __ALPINE_SERDES_H__ */ Modified: head/sys/boot/fdt/dts/arm/annapurna-alpine.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/annapurna-alpine.dts Thu Oct 20 11:23:59 2016 (r307668) +++ head/sys/boot/fdt/dts/arm/annapurna-alpine.dts Thu Oct 20 11:26:51 2016 (r307669) @@ -159,6 +159,12 @@ interrupt-parent = <&MPIC>; }; + /* SerDes */ + serdes { + compatible = "annapurna-labs,al-serdes"; + reg = <0x28c0000 0x1000>; + }; + serial0: serial@2883000 { compatible = "ns16550"; reg = <0x2883000 0x20>; Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Thu Oct 20 11:23:59 2016 (r307668) +++ head/sys/conf/files.arm Thu Oct 20 11:26:51 2016 (r307669) @@ -15,6 +15,9 @@ arm/annapurna/alpine/alpine_ccu.c optio arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt arm/annapurna/alpine/alpine_pci.c optional al_pci fdt arm/annapurna/alpine/alpine_pci_msix.c optional al_pci fdt +arm/annapurna/alpine/alpine_serdes.c optional al_serdes fdt \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" arm/arm/autoconf.c standard arm/arm/bcopy_page.S standard arm/arm/bcopyinout.S standard Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Oct 20 11:23:59 2016 (r307668) +++ head/sys/conf/files.arm64 Thu Oct 20 11:26:51 2016 (r307669) @@ -42,6 +42,9 @@ arm/annapurna/alpine/alpine_ccu.c optio arm/annapurna/alpine/alpine_nb_service.c optional al_nb_service fdt arm/annapurna/alpine/alpine_pci.c optional al_pci fdt arm/annapurna/alpine/alpine_pci_msix.c optional al_pci fdt +arm/annapurna/alpine/alpine_serdes.c optional al_serdes fdt \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" arm/arm/generic_timer.c standard arm/arm/gic.c standard arm/arm/gic_fdt.c optional fdt From owner-svn-src-all@freebsd.org Thu Oct 20 11:31:12 2016 Return-Path: Delivered-To: svn-src-all@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 C2B31C1ADAD; Thu, 20 Oct 2016 11:31:12 +0000 (UTC) (envelope-from wma@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 8EFF22CC; Thu, 20 Oct 2016 11:31:12 +0000 (UTC) (envelope-from wma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KBVB15070093; Thu, 20 Oct 2016 11:31:11 GMT (envelope-from wma@FreeBSD.org) Received: (from wma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KBVBDk070088; Thu, 20 Oct 2016 11:31:11 GMT (envelope-from wma@FreeBSD.org) Message-Id: <201610201131.u9KBVBDk070088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wma set sender to wma@FreeBSD.org using -f From: Wojciech Macek Date: Thu, 20 Oct 2016 11:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307670 - in head/sys: arm/conf arm64/conf conf dev/al_eth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 11:31:12 -0000 Author: wma Date: Thu Oct 20 11:31:11 2016 New Revision: 307670 URL: https://svnweb.freebsd.org/changeset/base/307670 Log: Driver for PCI Ethernet NIC on Alpine V1 and V2. Obtained from: Semihalf Submitted by: Michal Stanek Sponsored by: Annapurna Labs Reviewed by: wma Differential Revision: https://reviews.freebsd.org/D7814 Added: head/sys/dev/al_eth/ head/sys/dev/al_eth/al_eth.c (contents, props changed) head/sys/dev/al_eth/al_eth.h (contents, props changed) head/sys/dev/al_eth/al_init_eth_kr.c (contents, props changed) head/sys/dev/al_eth/al_init_eth_kr.h (contents, props changed) head/sys/dev/al_eth/al_init_eth_lm.c (contents, props changed) head/sys/dev/al_eth/al_init_eth_lm.h (contents, props changed) Modified: head/sys/arm/conf/ALPINE head/sys/arm64/conf/GENERIC head/sys/conf/files Modified: head/sys/arm/conf/ALPINE ============================================================================== --- head/sys/arm/conf/ALPINE Thu Oct 20 11:26:51 2016 (r307669) +++ head/sys/arm/conf/ALPINE Thu Oct 20 11:31:11 2016 (r307670) @@ -35,6 +35,9 @@ options INTRNG # Annapurna Alpine drivers device al_ccu # Alpine Cache Coherency Unit device al_nb_service # Alpine North Bridge Service +device al_iofic # I/O Fabric Interrupt Controller +device al_serdes # Serializer/Deserializer +device al_udma # Universal DMA # Pseudo devices device loop @@ -69,6 +72,7 @@ device al_pci # Annapurna Alpine PCI-E device ether device mii device bpf +device al_eth # Annapurna Alpine Ethernet NIC options DEVICE_POLLING # USB ethernet support, requires miibus Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Thu Oct 20 11:26:51 2016 (r307669) +++ head/sys/arm64/conf/GENERIC Thu Oct 20 11:31:11 2016 (r307670) @@ -94,6 +94,9 @@ options SOC_HISI_HI6220 # Annapurna Alpine drivers device al_ccu # Alpine Cache Coherency Unit device al_nb_service # Alpine North Bridge Service +device al_iofic # I/O Fabric Interrupt Controller +device al_serdes # Serializer/Deserializer +device al_udma # Universal DMA # VirtIO support device virtio @@ -119,6 +122,7 @@ device igb # Intel PRO/1000 PCIE Serve device ix # Intel 10Gb Ethernet Family device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device vnic # Cavium ThunderX NIC +device al_eth # Annapurna Alpine Ethernet NIC # Block devices device ahci Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Oct 20 11:26:51 2016 (r307669) +++ head/sys/conf/files Thu Oct 20 11:31:11 2016 (r307670) @@ -709,6 +709,45 @@ dev/aic7xxx/aic7xxx_93cx6.c optional ahc dev/aic7xxx/aic7xxx_osm.c optional ahc dev/aic7xxx/aic7xxx_pci.c optional ahc pci dev/aic7xxx/aic7xxx_reg_print.c optional ahc ahc_reg_pretty_print +dev/al_eth/al_eth.c optional al_eth \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +dev/al_eth/al_init_eth_lm.c optional al_eth \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +dev/al_eth/al_init_eth_kr.c optional al_eth \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_hal_iofic.c optional al_iofic \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_hal_serdes_25g.c optional al_serdes \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_hal_serdes_hssp.c optional al_serdes \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_hal_udma_config.c optional al_udma \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_hal_udma_debug.c optional al_udma \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_hal_udma_iofic.c optional al_udma \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_hal_udma_main.c optional al_udma \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/al_serdes.c optional al_serdes \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/eth/al_hal_eth_kr.c optional al_eth \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" +contrib/alpine-hal/eth/al_hal_eth_main.c optional al_eth \ + no-depend \ + compile-with "${CC} -c -o ${.TARGET} ${CFLAGS} -I$S/contrib/alpine-hal -I$S/contrib/alpine-hal/eth ${PROF} ${.IMPSRC}" dev/alc/if_alc.c optional alc pci dev/ale/if_ale.c optional ale pci dev/alpm/alpm.c optional alpm pci Added: head/sys/dev/al_eth/al_eth.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/al_eth/al_eth.c Thu Oct 20 11:31:11 2016 (r307670) @@ -0,0 +1,3584 @@ +/*- + * Copyright (c) 2015,2016 Annapurna Labs Ltd. and affiliates + * All rights reserved. + * + * Developed by Semihalf. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef INET +#include +#include +#include +#include +#endif + +#ifdef INET6 +#include +#endif + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "al_eth.h" +#include "al_init_eth_lm.h" +#include "arm/annapurna/alpine/alpine_serdes.h" + +#include "miibus_if.h" + +#define device_printf_dbg(fmt, ...) do { \ + if (AL_DBG_LEVEL >= AL_DBG_LEVEL_DBG) { AL_DBG_LOCK(); \ + device_printf(fmt, __VA_ARGS__); AL_DBG_UNLOCK();} \ + } while (0) + +MALLOC_DEFINE(M_IFAL, "if_al_malloc", "All allocated data for AL ETH driver"); + +/* move out to some pci header file */ +#define PCI_VENDOR_ID_ANNAPURNA_LABS 0x1c36 +#define PCI_DEVICE_ID_AL_ETH 0x0001 +#define PCI_DEVICE_ID_AL_ETH_ADVANCED 0x0002 +#define PCI_DEVICE_ID_AL_ETH_NIC 0x0003 +#define PCI_DEVICE_ID_AL_ETH_FPGA_NIC 0x0030 +#define PCI_DEVICE_ID_AL_CRYPTO 0x0011 +#define PCI_DEVICE_ID_AL_CRYPTO_VF 0x8011 +#define PCI_DEVICE_ID_AL_RAID_DMA 0x0021 +#define PCI_DEVICE_ID_AL_RAID_DMA_VF 0x8021 +#define PCI_DEVICE_ID_AL_USB 0x0041 + +#define MAC_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x" +#define MAC_ADDR(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] + +#define AL_ETH_MAC_TABLE_UNICAST_IDX_BASE 0 +#define AL_ETH_MAC_TABLE_UNICAST_MAX_COUNT 4 +#define AL_ETH_MAC_TABLE_ALL_MULTICAST_IDX (AL_ETH_MAC_TABLE_UNICAST_IDX_BASE + \ + AL_ETH_MAC_TABLE_UNICAST_MAX_COUNT) + +#define AL_ETH_MAC_TABLE_DROP_IDX (AL_ETH_FWD_MAC_NUM - 1) +#define AL_ETH_MAC_TABLE_BROADCAST_IDX (AL_ETH_MAC_TABLE_DROP_IDX - 1) + +#define AL_ETH_THASH_UDMA_SHIFT 0 +#define AL_ETH_THASH_UDMA_MASK (0xF << AL_ETH_THASH_UDMA_SHIFT) + +#define AL_ETH_THASH_Q_SHIFT 4 +#define AL_ETH_THASH_Q_MASK (0x3 << AL_ETH_THASH_Q_SHIFT) + +/* the following defines should be moved to hal */ +#define AL_ETH_FSM_ENTRY_IPV4_TCP 0 +#define AL_ETH_FSM_ENTRY_IPV4_UDP 1 +#define AL_ETH_FSM_ENTRY_IPV6_TCP 2 +#define AL_ETH_FSM_ENTRY_IPV6_UDP 3 +#define AL_ETH_FSM_ENTRY_IPV6_NO_UDP_TCP 4 +#define AL_ETH_FSM_ENTRY_IPV4_NO_UDP_TCP 5 + +/* FSM DATA format */ +#define AL_ETH_FSM_DATA_OUTER_2_TUPLE 0 +#define AL_ETH_FSM_DATA_OUTER_4_TUPLE 1 +#define AL_ETH_FSM_DATA_INNER_2_TUPLE 2 +#define AL_ETH_FSM_DATA_INNER_4_TUPLE 3 + +#define AL_ETH_FSM_DATA_HASH_SEL (1 << 2) + +#define AL_ETH_FSM_DATA_DEFAULT_Q 0 +#define AL_ETH_FSM_DATA_DEFAULT_UDMA 0 + +#define AL_BR_SIZE 512 +#define AL_TSO_SIZE 65500 +#define AL_DEFAULT_MTU 1500 + +#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) + +#define AL_IP_ALIGNMENT_OFFSET 2 + +#define SFP_I2C_ADDR 0x50 + +#define AL_MASK_GROUP_A_INT 0x7 +#define AL_MASK_GROUP_B_INT 0xF +#define AL_MASK_GROUP_C_INT 0xF +#define AL_MASK_GROUP_D_INT 0xFFFFFFFF + +#define AL_REG_OFFSET_FORWARD_INTR (0x1800000 + 0x1210) +#define AL_EN_FORWARD_INTR 0x1FFFF +#define AL_DIS_FORWARD_INTR 0 + +#define AL_M2S_MASK_INIT 0x480 +#define AL_S2M_MASK_INIT 0x1E0 +#define AL_M2S_S2M_MASK_NOT_INT (0x3f << 25) + +#define AL_10BASE_T_SPEED 10 +#define AL_100BASE_TX_SPEED 100 +#define AL_1000BASE_T_SPEED 1000 + +static devclass_t al_devclass; + +#define AL_RX_LOCK_INIT(_sc) mtx_init(&((_sc)->if_rx_lock), "ALRXL", "ALRXL", MTX_DEF) +#define AL_RX_LOCK(_sc) mtx_lock(&((_sc)->if_rx_lock)) +#define AL_RX_UNLOCK(_sc) mtx_unlock(&((_sc)->if_rx_lock)) + +/* helper functions */ +static int al_is_device_supported(device_t); + +static void al_eth_init_rings(struct al_eth_adapter *); +static void al_eth_flow_ctrl_disable(struct al_eth_adapter *); +int al_eth_fpga_read_pci_config(void *, int, uint32_t *); +int al_eth_fpga_write_pci_config(void *, int, uint32_t); +int al_eth_read_pci_config(void *, int, uint32_t *); +int al_eth_write_pci_config(void *, int, uint32_t); +void al_eth_irq_config(uint32_t *, uint32_t); +void al_eth_forward_int_config(uint32_t *, uint32_t); +static void al_eth_start_xmit(void *, int); +static void al_eth_rx_recv_work(void *, int); +static int al_eth_up(struct al_eth_adapter *); +static void al_eth_down(struct al_eth_adapter *); +static void al_eth_interrupts_unmask(struct al_eth_adapter *); +static void al_eth_interrupts_mask(struct al_eth_adapter *); +static int al_eth_check_mtu(struct al_eth_adapter *, int); +static uint64_t al_get_counter(struct ifnet *, ift_counter); +static void al_eth_req_rx_buff_size(struct al_eth_adapter *, int); +static int al_eth_board_params_init(struct al_eth_adapter *); +static int al_media_update(struct ifnet *); +static void al_media_status(struct ifnet *, struct ifmediareq *); +static int al_eth_function_reset(struct al_eth_adapter *); +static int al_eth_hw_init_adapter(struct al_eth_adapter *); +static void al_eth_serdes_init(struct al_eth_adapter *); +static void al_eth_lm_config(struct al_eth_adapter *); +static int al_eth_hw_init(struct al_eth_adapter *); + +static void al_tick_stats(void *); + +/* ifnet entry points */ +static void al_init(void *); +static int al_mq_start(struct ifnet *, struct mbuf *); +static void al_qflush(struct ifnet *); +static int al_ioctl(struct ifnet * ifp, u_long, caddr_t); + +/* bus entry points */ +static int al_probe(device_t); +static int al_attach(device_t); +static int al_detach(device_t); +static int al_shutdown(device_t); + +/* mii bus support routines */ +static int al_miibus_readreg(device_t, int, int); +static int al_miibus_writereg(device_t, int, int, int); +static void al_miibus_statchg(device_t); +static void al_miibus_linkchg(device_t); + +struct al_eth_adapter* g_adapters[16]; +uint32_t g_adapters_count; + +/* flag for napi-like mbuf processing, controlled from sysctl */ +static int napi = 0; + +static device_method_t al_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, al_probe), + DEVMETHOD(device_attach, al_attach), + DEVMETHOD(device_detach, al_detach), + DEVMETHOD(device_shutdown, al_shutdown), + + DEVMETHOD(miibus_readreg, al_miibus_readreg), + DEVMETHOD(miibus_writereg, al_miibus_writereg), + DEVMETHOD(miibus_statchg, al_miibus_statchg), + DEVMETHOD(miibus_linkchg, al_miibus_linkchg), + { 0, 0 } +}; + +static driver_t al_driver = { + "al", + al_methods, + sizeof(struct al_eth_adapter), +}; + +DRIVER_MODULE(al, pci, al_driver, al_devclass, 0, 0); +DRIVER_MODULE(miibus, al, miibus_driver, miibus_devclass, 0, 0); + +static int +al_probe(device_t dev) +{ + if ((al_is_device_supported(dev)) != 0) { + device_set_desc(dev, "al"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +} + +static int +al_attach(device_t dev) +{ + struct al_eth_lm_context *lm_context; + struct al_eth_adapter *adapter; + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + struct ifnet *ifp; + uint32_t dev_id; + uint32_t rev_id; + int bar_udma; + int bar_mac; + int bar_ec; + int err; + + err = 0; + ifp = NULL; + dev_id = rev_id = 0; + ctx = device_get_sysctl_ctx(dev); + tree = SYSCTL_PARENT(device_get_sysctl_tree(dev)); + child = SYSCTL_CHILDREN(tree); + + if (g_adapters_count == 0) { + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "napi", + CTLFLAG_RW, &napi, 0, "Use pseudo-napi mechanism"); + } + adapter = device_get_softc(dev); + adapter->dev = dev; + adapter->board_type = ALPINE_INTEGRATED; + snprintf(adapter->name, AL_ETH_NAME_MAX_LEN, "%s", + device_get_nameunit(dev)); + AL_RX_LOCK_INIT(adapter); + + g_adapters[g_adapters_count] = adapter; + + lm_context = &adapter->lm_context; + + bar_udma = PCIR_BAR(AL_ETH_UDMA_BAR); + adapter->udma_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &bar_udma, RF_ACTIVE); + if (adapter->udma_res == NULL) { + device_printf(adapter->dev, + "could not allocate memory resources for DMA.\n"); + err = ENOMEM; + goto err_res_dma; + } + adapter->udma_base = al_bus_dma_to_va(rman_get_bustag(adapter->udma_res), + rman_get_bushandle(adapter->udma_res)); + bar_mac = PCIR_BAR(AL_ETH_MAC_BAR); + adapter->mac_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &bar_mac, RF_ACTIVE); + if (adapter->mac_res == NULL) { + device_printf(adapter->dev, + "could not allocate memory resources for MAC.\n"); + err = ENOMEM; + goto err_res_mac; + } + adapter->mac_base = al_bus_dma_to_va(rman_get_bustag(adapter->mac_res), + rman_get_bushandle(adapter->mac_res)); + + bar_ec = PCIR_BAR(AL_ETH_EC_BAR); + adapter->ec_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &bar_ec, + RF_ACTIVE); + if (adapter->ec_res == NULL) { + device_printf(adapter->dev, + "could not allocate memory resources for EC.\n"); + err = ENOMEM; + goto err_res_ec; + } + adapter->ec_base = al_bus_dma_to_va(rman_get_bustag(adapter->ec_res), + rman_get_bushandle(adapter->ec_res)); + + adapter->netdev = ifp = if_alloc(IFT_ETHER); + + adapter->netdev->if_link_state = LINK_STATE_DOWN; + + ifp->if_softc = adapter; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + ifp->if_flags = ifp->if_drv_flags; + ifp->if_flags |= IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_ALLMULTI; + ifp->if_transmit = al_mq_start; + ifp->if_qflush = al_qflush; + ifp->if_ioctl = al_ioctl; + ifp->if_init = al_init; + ifp->if_get_counter = al_get_counter; + ifp->if_mtu = AL_DEFAULT_MTU; + + adapter->if_flags = ifp->if_flags; + + ifp->if_capabilities = ifp->if_capenable = 0; + + ifp->if_capabilities |= IFCAP_HWCSUM | + IFCAP_HWCSUM_IPV6 | IFCAP_TSO | + IFCAP_LRO | IFCAP_JUMBO_MTU; + + ifp->if_capenable = ifp->if_capabilities; + + adapter->id_number = g_adapters_count; + + if (adapter->board_type == ALPINE_INTEGRATED) { + dev_id = pci_get_device(adapter->dev); + rev_id = pci_get_revid(adapter->dev); + } else { + al_eth_fpga_read_pci_config(adapter->internal_pcie_base, + PCIR_DEVICE, &dev_id); + al_eth_fpga_read_pci_config(adapter->internal_pcie_base, + PCIR_REVID, &rev_id); + } + + adapter->dev_id = dev_id; + adapter->rev_id = rev_id; + + /* set default ring sizes */ + adapter->tx_ring_count = AL_ETH_DEFAULT_TX_SW_DESCS; + adapter->tx_descs_count = AL_ETH_DEFAULT_TX_HW_DESCS; + adapter->rx_ring_count = AL_ETH_DEFAULT_RX_DESCS; + adapter->rx_descs_count = AL_ETH_DEFAULT_RX_DESCS; + + adapter->num_tx_queues = AL_ETH_NUM_QUEUES; + adapter->num_rx_queues = AL_ETH_NUM_QUEUES; + + adapter->small_copy_len = AL_ETH_DEFAULT_SMALL_PACKET_LEN; + adapter->link_poll_interval = AL_ETH_DEFAULT_LINK_POLL_INTERVAL; + adapter->max_rx_buff_alloc_size = AL_ETH_DEFAULT_MAX_RX_BUFF_ALLOC_SIZE; + + al_eth_req_rx_buff_size(adapter, adapter->netdev->if_mtu); + + adapter->link_config.force_1000_base_x = AL_ETH_DEFAULT_FORCE_1000_BASEX; + + err = al_eth_board_params_init(adapter); + if (err != 0) + goto err; + + if (adapter->mac_mode == AL_ETH_MAC_MODE_10GbE_Serial) { + ifmedia_init(&adapter->media, IFM_IMASK, + al_media_update, al_media_status); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_LX, 0, NULL); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_10G_LR, 0, NULL); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO); + } + + al_eth_function_reset(adapter); + + err = al_eth_hw_init_adapter(adapter); + if (err != 0) + goto err; + + al_eth_init_rings(adapter); + g_adapters_count++; + + al_eth_lm_config(adapter); + mtx_init(&adapter->stats_mtx, "AlStatsMtx", NULL, MTX_DEF); + mtx_init(&adapter->wd_mtx, "AlWdMtx", NULL, MTX_DEF); + callout_init_mtx(&adapter->stats_callout, &adapter->stats_mtx, 0); + callout_init_mtx(&adapter->wd_callout, &adapter->wd_mtx, 0); + + ether_ifattach(ifp, adapter->mac_addr); + ifp->if_mtu = AL_DEFAULT_MTU; + + if (adapter->mac_mode == AL_ETH_MAC_MODE_RGMII) { + al_eth_hw_init(adapter); + + /* Attach PHY(s) */ + err = mii_attach(adapter->dev, &adapter->miibus, adapter->netdev, + al_media_update, al_media_status, BMSR_DEFCAPMASK, 0, + MII_OFFSET_ANY, 0); + if (err != 0) { + device_printf(adapter->dev, "attaching PHYs failed\n"); + return (err); + } + + adapter->mii = device_get_softc(adapter->miibus); + } + + return (err); + +err: + bus_release_resource(dev, SYS_RES_MEMORY, bar_ec, adapter->ec_res); +err_res_ec: + bus_release_resource(dev, SYS_RES_MEMORY, bar_mac, adapter->mac_res); +err_res_mac: + bus_release_resource(dev, SYS_RES_MEMORY, bar_udma, adapter->udma_res); +err_res_dma: + return (err); +} + +static int +al_detach(device_t dev) +{ + struct al_eth_adapter *adapter; + + adapter = device_get_softc(dev); + ether_ifdetach(adapter->netdev); + + mtx_destroy(&adapter->stats_mtx); + mtx_destroy(&adapter->wd_mtx); + + al_eth_down(adapter); + + bus_release_resource(dev, SYS_RES_IRQ, 0, adapter->irq_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, adapter->ec_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, adapter->mac_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, adapter->udma_res); + + return (0); +} + +int +al_eth_fpga_read_pci_config(void *handle, int where, uint32_t *val) +{ + + /* handle is the base address of the adapter */ + *val = al_reg_read32((void*)((u_long)handle + where)); + + return (0); +} + +int +al_eth_fpga_write_pci_config(void *handle, int where, uint32_t val) +{ + + /* handle is the base address of the adapter */ + al_reg_write32((void*)((u_long)handle + where), val); + return (0); +} + +int +al_eth_read_pci_config(void *handle, int where, uint32_t *val) +{ + + /* handle is a pci_dev */ + *val = pci_read_config((device_t)handle, where, sizeof(*val)); + return (0); +} + +int +al_eth_write_pci_config(void *handle, int where, uint32_t val) +{ + + /* handle is a pci_dev */ + pci_write_config((device_t)handle, where, val, sizeof(val)); + return (0); +} + +void +al_eth_irq_config(uint32_t *offset, uint32_t value) +{ + + al_reg_write32_relaxed(offset, value); +} + +void +al_eth_forward_int_config(uint32_t *offset, uint32_t value) +{ + + al_reg_write32(offset, value); +} + +static void +al_eth_serdes_init(struct al_eth_adapter *adapter) +{ + void __iomem *serdes_base; + + adapter->serdes_init = false; + + serdes_base = alpine_serdes_resource_get(adapter->serdes_grp); + if (serdes_base == NULL) { + device_printf(adapter->dev, "serdes_base get failed!\n"); + return; + } + + serdes_base = al_bus_dma_to_va(serdes_tag, serdes_base); + + al_serdes_handle_grp_init(serdes_base, adapter->serdes_grp, + &adapter->serdes_obj); + + adapter->serdes_init = true; +} + +static void +al_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + bus_addr_t *paddr; + + paddr = arg; + *paddr = segs->ds_addr; +} + +static int +al_dma_alloc_coherent(struct device *dev, bus_dma_tag_t *tag, bus_dmamap_t *map, + bus_addr_t *baddr, void **vaddr, uint32_t size) +{ + int ret; + uint32_t maxsize = ((size - 1)/PAGE_SIZE + 1) * PAGE_SIZE; + + ret = bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + maxsize, 1, maxsize, BUS_DMA_COHERENT, NULL, NULL, tag); + if (ret != 0) { + device_printf(dev, + "failed to create bus tag, ret = %d\n", ret); + return (ret); + } + + ret = bus_dmamem_alloc(*tag, vaddr, + BUS_DMA_COHERENT | BUS_DMA_ZERO, map); + if (ret != 0) { + device_printf(dev, + "failed to allocate dmamem, ret = %d\n", ret); + return (ret); + } + + ret = bus_dmamap_load(*tag, *map, *vaddr, + size, al_dma_map_addr, baddr, 0); + if (ret != 0) { + device_printf(dev, + "failed to allocate bus_dmamap_load, ret = %d\n", ret); + return (ret); + } + + return (0); +} + +static void +al_dma_free_coherent(bus_dma_tag_t tag, bus_dmamap_t map, void *vaddr) +{ + + bus_dmamap_unload(tag, map); + bus_dmamem_free(tag, vaddr, map); + bus_dma_tag_destroy(tag); +} + +static void +al_eth_mac_table_unicast_add(struct al_eth_adapter *adapter, + uint8_t idx, uint8_t *addr, uint8_t udma_mask) +{ + struct al_eth_fwd_mac_table_entry entry = { { 0 } }; + + memcpy(entry.addr, adapter->mac_addr, sizeof(adapter->mac_addr)); + + memset(entry.mask, 0xff, sizeof(entry.mask)); + entry.rx_valid = true; + entry.tx_valid = false; + entry.udma_mask = udma_mask; + entry.filter = false; + + device_printf_dbg(adapter->dev, + "%s: [%d]: addr "MAC_ADDR_STR" mask "MAC_ADDR_STR"\n", + __func__, idx, MAC_ADDR(entry.addr), MAC_ADDR(entry.mask)); + + al_eth_fwd_mac_table_set(&adapter->hal_adapter, idx, &entry); +} + +static void +al_eth_mac_table_all_multicast_add(struct al_eth_adapter *adapter, uint8_t idx, + uint8_t udma_mask) +{ + struct al_eth_fwd_mac_table_entry entry = { { 0 } }; + + memset(entry.addr, 0x00, sizeof(entry.addr)); + memset(entry.mask, 0x00, sizeof(entry.mask)); + entry.mask[0] |= 1; + entry.addr[0] |= 1; + + entry.rx_valid = true; + entry.tx_valid = false; + entry.udma_mask = udma_mask; + entry.filter = false; + + device_printf_dbg(adapter->dev, + "%s: [%d]: addr "MAC_ADDR_STR" mask "MAC_ADDR_STR"\n", + __func__, idx, MAC_ADDR(entry.addr), MAC_ADDR(entry.mask)); + + al_eth_fwd_mac_table_set(&adapter->hal_adapter, idx, &entry); +} + +static void +al_eth_mac_table_broadcast_add(struct al_eth_adapter *adapter, + uint8_t idx, uint8_t udma_mask) +{ + struct al_eth_fwd_mac_table_entry entry = { { 0 } }; + + memset(entry.addr, 0xff, sizeof(entry.addr)); + memset(entry.mask, 0xff, sizeof(entry.mask)); + + entry.rx_valid = true; + entry.tx_valid = false; + entry.udma_mask = udma_mask; + entry.filter = false; + + device_printf_dbg(adapter->dev, + "%s: [%d]: addr "MAC_ADDR_STR" mask "MAC_ADDR_STR"\n", + __func__, idx, MAC_ADDR(entry.addr), MAC_ADDR(entry.mask)); + + al_eth_fwd_mac_table_set(&adapter->hal_adapter, idx, &entry); +} + +static void +al_eth_mac_table_promiscuous_set(struct al_eth_adapter *adapter, + boolean_t promiscuous) +{ + struct al_eth_fwd_mac_table_entry entry = { { 0 } }; + + memset(entry.addr, 0x00, sizeof(entry.addr)); + memset(entry.mask, 0x00, sizeof(entry.mask)); + + entry.rx_valid = true; + entry.tx_valid = false; + entry.udma_mask = (promiscuous) ? 1 : 0; + entry.filter = (promiscuous) ? false : true; + + device_printf_dbg(adapter->dev, "%s: %s promiscuous mode\n", + __func__, (promiscuous) ? "enter" : "exit"); + + al_eth_fwd_mac_table_set(&adapter->hal_adapter, + AL_ETH_MAC_TABLE_DROP_IDX, &entry); +} + +static void +al_eth_set_thash_table_entry(struct al_eth_adapter *adapter, uint8_t idx, + uint8_t udma, uint32_t queue) +{ + + if (udma != 0) + panic("only UDMA0 is supporter"); + + if (queue >= AL_ETH_NUM_QUEUES) + panic("invalid queue number"); + + al_eth_thash_table_set(&adapter->hal_adapter, idx, udma, queue); +} + +/* init FSM, no tunneling supported yet, if packet is tcp/udp over ipv4/ipv6, use 4 tuple hash */ +static void +al_eth_fsm_table_init(struct al_eth_adapter *adapter) +{ + uint32_t val; + int i; + + for (i = 0; i < AL_ETH_RX_FSM_TABLE_SIZE; i++) { + uint8_t outer_type = AL_ETH_FSM_ENTRY_OUTER(i); + switch (outer_type) { + case AL_ETH_FSM_ENTRY_IPV4_TCP: + case AL_ETH_FSM_ENTRY_IPV4_UDP: + case AL_ETH_FSM_ENTRY_IPV6_TCP: + case AL_ETH_FSM_ENTRY_IPV6_UDP: + val = AL_ETH_FSM_DATA_OUTER_4_TUPLE | + AL_ETH_FSM_DATA_HASH_SEL; + break; + case AL_ETH_FSM_ENTRY_IPV6_NO_UDP_TCP: + case AL_ETH_FSM_ENTRY_IPV4_NO_UDP_TCP: + val = AL_ETH_FSM_DATA_OUTER_2_TUPLE | + AL_ETH_FSM_DATA_HASH_SEL; + break; + default: + val = AL_ETH_FSM_DATA_DEFAULT_Q | + AL_ETH_FSM_DATA_DEFAULT_UDMA; + } + al_eth_fsm_table_set(&adapter->hal_adapter, i, val); + } +} + +static void +al_eth_mac_table_entry_clear(struct al_eth_adapter *adapter, + uint8_t idx) +{ + struct al_eth_fwd_mac_table_entry entry = { { 0 } }; + + device_printf_dbg(adapter->dev, "%s: clear entry %d\n", __func__, idx); + + al_eth_fwd_mac_table_set(&adapter->hal_adapter, idx, &entry); +} + +static int +al_eth_hw_init_adapter(struct al_eth_adapter *adapter) +{ + struct al_eth_adapter_params *params = &adapter->eth_hal_params; + int rc; + + /* params->dev_id = adapter->dev_id; */ + params->rev_id = adapter->rev_id; + params->udma_id = 0; + params->enable_rx_parser = 1; /* enable rx epe parser*/ + params->udma_regs_base = adapter->udma_base; /* UDMA register base address */ + params->ec_regs_base = adapter->ec_base; /* Ethernet controller registers base address */ + params->mac_regs_base = adapter->mac_base; /* Ethernet MAC registers base address */ + params->name = adapter->name; + params->serdes_lane = adapter->serdes_lane; + + rc = al_eth_adapter_init(&adapter->hal_adapter, params); + if (rc != 0) + device_printf(adapter->dev, "%s failed at hal init!\n", + __func__); + + if ((adapter->board_type == ALPINE_NIC) || + (adapter->board_type == ALPINE_FPGA_NIC)) { + /* in pcie NIC mode, force eth UDMA to access PCIE0 using the vmid */ + struct al_udma_gen_tgtid_conf conf; + int i; + for (i = 0; i < DMA_MAX_Q; i++) { + conf.tx_q_conf[i].queue_en = AL_TRUE; + conf.tx_q_conf[i].desc_en = AL_FALSE; + conf.tx_q_conf[i].tgtid = 0x100; /* for access from PCIE0 */ + conf.rx_q_conf[i].queue_en = AL_TRUE; + conf.rx_q_conf[i].desc_en = AL_FALSE; + conf.rx_q_conf[i].tgtid = 0x100; /* for access from PCIE0 */ + } + al_udma_gen_tgtid_conf_set(adapter->udma_base, &conf); + } + + return (rc); +} + +static void +al_eth_lm_config(struct al_eth_adapter *adapter) +{ + struct al_eth_lm_init_params params = {0}; + + params.adapter = &adapter->hal_adapter; + params.serdes_obj = &adapter->serdes_obj; + params.lane = adapter->serdes_lane; + params.sfp_detection = adapter->sfp_detection_needed; + if (adapter->sfp_detection_needed == true) { + params.sfp_bus_id = adapter->i2c_adapter_id; + params.sfp_i2c_addr = SFP_I2C_ADDR; + } + + if (adapter->sfp_detection_needed == false) { + switch (adapter->mac_mode) { + case AL_ETH_MAC_MODE_10GbE_Serial: + if ((adapter->lt_en != 0) && (adapter->an_en != 0)) + params.default_mode = AL_ETH_LM_MODE_10G_DA; + else + params.default_mode = AL_ETH_LM_MODE_10G_OPTIC; + break; + case AL_ETH_MAC_MODE_SGMII: + params.default_mode = AL_ETH_LM_MODE_1G; + break; + default: + params.default_mode = AL_ETH_LM_MODE_10G_DA; + } + } else + params.default_mode = AL_ETH_LM_MODE_10G_DA; + + params.link_training = adapter->lt_en; + params.rx_equal = true; + params.static_values = !adapter->dont_override_serdes; + params.i2c_context = adapter; + params.kr_fec_enable = false; + + params.retimer_exist = adapter->retimer.exist; + params.retimer_bus_id = adapter->retimer.bus_id; + params.retimer_i2c_addr = adapter->retimer.i2c_addr; + params.retimer_channel = adapter->retimer.channel; + + al_eth_lm_init(&adapter->lm_context, ¶ms); +} + +static int +al_eth_board_params_init(struct al_eth_adapter *adapter) +{ + + if (adapter->board_type == ALPINE_NIC) { + adapter->mac_mode = AL_ETH_MAC_MODE_10GbE_Serial; + adapter->sfp_detection_needed = false; + adapter->phy_exist = false; + adapter->an_en = false; + adapter->lt_en = false; + adapter->ref_clk_freq = AL_ETH_REF_FREQ_375_MHZ; + adapter->mdio_freq = AL_ETH_DEFAULT_MDIO_FREQ_KHZ; + } else if (adapter->board_type == ALPINE_FPGA_NIC) { + adapter->mac_mode = AL_ETH_MAC_MODE_SGMII; + adapter->sfp_detection_needed = false; + adapter->phy_exist = false; + adapter->an_en = false; + adapter->lt_en = false; + adapter->ref_clk_freq = AL_ETH_REF_FREQ_375_MHZ; + adapter->mdio_freq = AL_ETH_DEFAULT_MDIO_FREQ_KHZ; + } else { + struct al_eth_board_params params; + int rc; + + adapter->auto_speed = false; + + rc = al_eth_board_params_get(adapter->mac_base, ¶ms); + if (rc != 0) { + device_printf(adapter->dev, + "board info not available\n"); + return (-1); + } + + adapter->phy_exist = params.phy_exist == TRUE; + adapter->phy_addr = params.phy_mdio_addr; + adapter->an_en = params.autoneg_enable; + adapter->lt_en = params.kr_lt_enable; + adapter->serdes_grp = params.serdes_grp; + adapter->serdes_lane = params.serdes_lane; + adapter->sfp_detection_needed = params.sfp_plus_module_exist; + adapter->i2c_adapter_id = params.i2c_adapter_id; + adapter->ref_clk_freq = params.ref_clk_freq; + adapter->dont_override_serdes = params.dont_override_serdes; + adapter->link_config.active_duplex = !params.half_duplex; + adapter->link_config.autoneg = !params.an_disable; + adapter->link_config.force_1000_base_x = params.force_1000_base_x; + adapter->retimer.exist = params.retimer_exist; + adapter->retimer.bus_id = params.retimer_bus_id; + adapter->retimer.i2c_addr = params.retimer_i2c_addr; + adapter->retimer.channel = params.retimer_channel; + + switch (params.speed) { + default: + device_printf(adapter->dev, + "%s: invalid speed (%d)\n", __func__, params.speed); + case AL_ETH_BOARD_1G_SPEED_1000M: + adapter->link_config.active_speed = 1000; + break; + case AL_ETH_BOARD_1G_SPEED_100M: + adapter->link_config.active_speed = 100; + break; + case AL_ETH_BOARD_1G_SPEED_10M: + adapter->link_config.active_speed = 10; + break; + } + + switch (params.mdio_freq) { + default: + device_printf(adapter->dev, + "%s: invalid mdio freq (%d)\n", __func__, + params.mdio_freq); + case AL_ETH_BOARD_MDIO_FREQ_2_5_MHZ: + adapter->mdio_freq = AL_ETH_DEFAULT_MDIO_FREQ_KHZ; + break; + case AL_ETH_BOARD_MDIO_FREQ_1_MHZ: + adapter->mdio_freq = AL_ETH_MDIO_FREQ_1000_KHZ; + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Oct 20 11:42:31 2016 Return-Path: Delivered-To: svn-src-all@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 7CF47C1A0F0; Thu, 20 Oct 2016 11:42:31 +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 3C19EBE5; Thu, 20 Oct 2016 11:42:31 +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 u9KBgUPt076445; Thu, 20 Oct 2016 11:42:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KBgTEr076438; Thu, 20 Oct 2016 11:42:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610201142.u9KBgTEr076438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 20 Oct 2016 11:42:29 +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: r307671 - in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/drm2/i915 dev/drm2/ttm kern vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 11:42:31 -0000 Author: kib Date: Thu Oct 20 11:42:29 2016 New Revision: 307671 URL: https://svnweb.freebsd.org/changeset/base/307671 Log: MFC r307218: Fix a race in vm_page_busy_sleep(9). Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/11/sys/dev/drm2/i915/i915_gem.c stable/11/sys/dev/drm2/ttm/ttm_bo_vm.c stable/11/sys/kern/vfs_bio.c stable/11/sys/vm/vm_object.c stable/11/sys/vm/vm_page.c stable/11/sys/vm/vm_page.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 20 11:31:11 2016 (r307670) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 20 11:42:29 2016 (r307671) @@ -421,7 +421,7 @@ page_busy(vnode_t *vp, int64_t start, in vm_page_reference(pp); vm_page_lock(pp); zfs_vmobject_wunlock(obj); - vm_page_busy_sleep(pp, "zfsmwb"); + vm_page_busy_sleep(pp, "zfsmwb", true); zfs_vmobject_wlock(obj); continue; } @@ -476,7 +476,7 @@ page_hold(vnode_t *vp, int64_t start) vm_page_reference(pp); vm_page_lock(pp); zfs_vmobject_wunlock(obj); - vm_page_busy_sleep(pp, "zfsmwb"); + vm_page_busy_sleep(pp, "zfsmwb", true); zfs_vmobject_wlock(obj); continue; } Modified: stable/11/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- stable/11/sys/dev/drm2/i915/i915_gem.c Thu Oct 20 11:31:11 2016 (r307670) +++ stable/11/sys/dev/drm2/i915/i915_gem.c Thu Oct 20 11:42:29 2016 (r307671) @@ -1533,7 +1533,7 @@ retry: DRM_UNLOCK(dev); vm_page_lock(page); VM_OBJECT_WUNLOCK(vm_obj); - vm_page_busy_sleep(page, "915pee"); + vm_page_busy_sleep(page, "915pee", false); goto retry; } goto have_page; @@ -1575,7 +1575,7 @@ retry: DRM_UNLOCK(dev); vm_page_lock(page); VM_OBJECT_WUNLOCK(vm_obj); - vm_page_busy_sleep(page, "915pbs"); + vm_page_busy_sleep(page, "915pbs", false); goto retry; } if (vm_page_insert(page, vm_obj, OFF_TO_IDX(offset))) { Modified: stable/11/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- stable/11/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Oct 20 11:31:11 2016 (r307670) +++ stable/11/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Oct 20 11:42:29 2016 (r307671) @@ -236,7 +236,7 @@ reserve: if (vm_page_busied(m)) { vm_page_lock(m); VM_OBJECT_WUNLOCK(vm_obj); - vm_page_busy_sleep(m, "ttmpbs"); + vm_page_busy_sleep(m, "ttmpbs", false); VM_OBJECT_WLOCK(vm_obj); ttm_mem_io_unlock(man); ttm_bo_unreserve(bo); Modified: stable/11/sys/kern/vfs_bio.c ============================================================================== --- stable/11/sys/kern/vfs_bio.c Thu Oct 20 11:31:11 2016 (r307670) +++ stable/11/sys/kern/vfs_bio.c Thu Oct 20 11:42:29 2016 (r307671) @@ -2637,7 +2637,7 @@ vfs_vmio_invalidate(struct buf *bp) while (vm_page_xbusied(m)) { vm_page_lock(m); VM_OBJECT_WUNLOCK(obj); - vm_page_busy_sleep(m, "mbncsh"); + vm_page_busy_sleep(m, "mbncsh", true); VM_OBJECT_WLOCK(obj); } if (pmap_page_wired_mappings(m) == 0) @@ -4202,7 +4202,7 @@ vfs_drain_busy_pages(struct buf *bp) while (vm_page_xbusied(m)) { vm_page_lock(m); VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); - vm_page_busy_sleep(m, "vbpage"); + vm_page_busy_sleep(m, "vbpage", true); VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); } } Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Thu Oct 20 11:31:11 2016 (r307670) +++ stable/11/sys/vm/vm_object.c Thu Oct 20 11:42:29 2016 (r307671) @@ -1186,7 +1186,7 @@ shadowlookup: if (object != tobject) VM_OBJECT_WUNLOCK(object); VM_OBJECT_WUNLOCK(tobject); - vm_page_busy_sleep(m, "madvpo"); + vm_page_busy_sleep(m, "madvpo", false); VM_OBJECT_WLOCK(object); goto relookup; } @@ -1365,7 +1365,7 @@ retry: VM_OBJECT_WUNLOCK(new_object); vm_page_lock(m); VM_OBJECT_WUNLOCK(orig_object); - vm_page_busy_sleep(m, "spltwt"); + vm_page_busy_sleep(m, "spltwt", false); VM_OBJECT_WLOCK(orig_object); VM_OBJECT_WLOCK(new_object); goto retry; @@ -1453,7 +1453,7 @@ vm_object_collapse_scan_wait(vm_object_t if (p == NULL) VM_WAIT; else - vm_page_busy_sleep(p, "vmocol"); + vm_page_busy_sleep(p, "vmocol", false); VM_OBJECT_WLOCK(object); VM_OBJECT_WLOCK(backing_object); return (TAILQ_FIRST(&backing_object->memq)); @@ -1912,7 +1912,7 @@ again: vm_page_lock(p); if (vm_page_xbusied(p)) { VM_OBJECT_WUNLOCK(object); - vm_page_busy_sleep(p, "vmopax"); + vm_page_busy_sleep(p, "vmopax", true); VM_OBJECT_WLOCK(object); goto again; } @@ -1927,7 +1927,7 @@ again: } if (vm_page_busied(p)) { VM_OBJECT_WUNLOCK(object); - vm_page_busy_sleep(p, "vmopar"); + vm_page_busy_sleep(p, "vmopar", false); VM_OBJECT_WLOCK(object); goto again; } Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Thu Oct 20 11:31:11 2016 (r307670) +++ stable/11/sys/vm/vm_page.c Thu Oct 20 11:42:29 2016 (r307671) @@ -743,21 +743,20 @@ vm_page_sunbusy(vm_page_t m) * This is used to implement the hard-path of busying mechanism. * * The given page must be locked. + * + * If nonshared is true, sleep only if the page is xbusy. */ void -vm_page_busy_sleep(vm_page_t m, const char *wmesg) +vm_page_busy_sleep(vm_page_t m, const char *wmesg, bool nonshared) { u_int x; - vm_page_lock_assert(m, MA_OWNED); + vm_page_assert_locked(m); x = m->busy_lock; - if (x == VPB_UNBUSIED) { - vm_page_unlock(m); - return; - } - if ((x & VPB_BIT_WAITERS) == 0 && - !atomic_cmpset_int(&m->busy_lock, x, x | VPB_BIT_WAITERS)) { + if (x == VPB_UNBUSIED || (nonshared && (x & VPB_BIT_SHARED) != 0) || + ((x & VPB_BIT_WAITERS) == 0 && + !atomic_cmpset_int(&m->busy_lock, x, x | VPB_BIT_WAITERS))) { vm_page_unlock(m); return; } @@ -1094,7 +1093,7 @@ vm_page_sleep_if_busy(vm_page_t m, const obj = m->object; vm_page_lock(m); VM_OBJECT_WUNLOCK(obj); - vm_page_busy_sleep(m, msg); + vm_page_busy_sleep(m, msg, false); VM_OBJECT_WLOCK(obj); return (TRUE); } @@ -3466,7 +3465,8 @@ retrylookup: vm_page_aflag_set(m, PGA_REFERENCED); vm_page_lock(m); VM_OBJECT_WUNLOCK(object); - vm_page_busy_sleep(m, "pgrbwt"); + vm_page_busy_sleep(m, "pgrbwt", (allocflags & + VM_ALLOC_IGN_SBUSY) != 0); VM_OBJECT_WLOCK(object); goto retrylookup; } else { Modified: stable/11/sys/vm/vm_page.h ============================================================================== --- stable/11/sys/vm/vm_page.h Thu Oct 20 11:31:11 2016 (r307670) +++ stable/11/sys/vm/vm_page.h Thu Oct 20 11:42:29 2016 (r307671) @@ -437,7 +437,7 @@ malloc2vm_flags(int malloc_flags) #endif void vm_page_busy_downgrade(vm_page_t m); -void vm_page_busy_sleep(vm_page_t m, const char *msg); +void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); void vm_page_flash(vm_page_t m); void vm_page_hold(vm_page_t mem); void vm_page_unhold(vm_page_t mem); From owner-svn-src-all@freebsd.org Thu Oct 20 11:50:41 2016 Return-Path: Delivered-To: svn-src-all@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 8901AC1A398; Thu, 20 Oct 2016 11:50:41 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BDDCE6C; Thu, 20 Oct 2016 11:50:41 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf0-x242.google.com with SMTP id l131so487917lfl.0; Thu, 20 Oct 2016 04:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lDQWTFm3Y5Tom+5BuBtr+hxNda8klMYSN6WiSpzz1JQ=; b=TCZ2IlqzvwomzL4rAWB1EWZtmbX+GNYEW52c5nQRoHUXcYwESgOKvN9l77CpjW1uId 8iAoHpnx2389uXt+bWgAchx2XoUF9B2Jngt804km8KLHxTOsXyCQ2beGHsX9hFWxspaf bT+s16YhvQNvFdoguGLfGcvhdN+/Mv/N/lh8gyIP/IQs3vHx8X1aw+mqBL1V6KOduPYN HcsEDPjQfbmme3vyamXDVSt0AvtPVbuoT1zJF2YD9nbxHspXqqrZFkz3GQAVD2nx6c3h Jr7GVffBmH/XjTosYZKKIzOKxyRKyJq26rdPz7mLlHPg4SIJA5y/TWPzcCzVxBC4K2BX mC0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lDQWTFm3Y5Tom+5BuBtr+hxNda8klMYSN6WiSpzz1JQ=; b=jmY4MSSpF4t9SUVQJBZO57I0hjrzEbYiB3HROjklTVqjsRYLba2nOXsuPC53j8TzcY m70X+JsRmS2NNnCJweNqEFh1mqXUW9OUfcZGZ6aIrTvlqvmF31KPM+8BVQczSWnw/xdf 55oRWTUB5SfbTaWwvzENT9NeI4/SAI549ig5Ukxkx2yK/9UCGZIQ8OYIGt7148zXCR83 D/oh27qTJBGFfeVQwOT+MYkQaQ1jZrlywIIIW4b+JVUFIe1R7/ojHQ8Yr9JjEjBfDFqJ 80JEZSB3kjCba2j71Sja56Q9uPw2mrXwayl+V7wHAj6aJwbURdN4WqTbeN0gDS06SXxp z0ug== X-Gm-Message-State: AA6/9RlwWx9zrHTe5I2KhBlJ5q8wfLq0/YOoQlaKKpBzd13tBjn68ru2RSKu/+9rgn+w3w== X-Received: by 10.28.64.213 with SMTP id n204mr193277wma.64.1476964238952; Thu, 20 Oct 2016 04:50:38 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id wh3sm78172765wjb.49.2016.10.20.04.50.37 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 20 Oct 2016 04:50:38 -0700 (PDT) Date: Thu, 20 Oct 2016 13:50:35 +0200 From: Mateusz Guzik To: Gleb Smirnoff Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307650 - head/sys/kern Message-ID: <20161020115035.GA26990@dft-labs.eu> References: <201610191829.u9JITqhm081246@repo.freebsd.org> <20161019220942.GM27748@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161019220942.GM27748@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 11:50:41 -0000 On Wed, Oct 19, 2016 at 03:09:42PM -0700, Gleb Smirnoff wrote: > On Wed, Oct 19, 2016 at 06:29:52PM +0000, Mateusz Guzik wrote: > M> Author: mjg > M> Date: Wed Oct 19 18:29:52 2016 > M> New Revision: 307650 > M> URL: https://svnweb.freebsd.org/changeset/base/307650 > M> > M> Log: > M> cache: split negative entry LRU into multiple lists > M> > M> This splits the ncneg_mtx lock while preserving the hit ratio at least > M> during buildworld. > M> > M> Create N dedicated lists for new negative entries. > M> > M> Entries with at least one hit get promoted to the hot list, where they > M> get requeued every M hits. > M> > M> Shrinking demotes one hot entry and performs a round-robin shrinking of > M> regular lists. > M> > M> Reviewed by: kib > > This instapanics: > > panic: Assertion ncp->nc_flag & NCF_NEGATIVE failed at /usr/src/head/sys/kern/vfs_cache.c:815 > It definitely works for me and I don't see how the condition can fail. Given the 'instapanic' note, I assume you can easily reproduce. Is this a stock head kernel? Can you reproduce with; diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index a112808..a8bd5eb 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -812,6 +812,11 @@ cache_negative_zap_one(void) goto out; } + if (!(ncp->nc_flag & NCF_NEGATIVE)) { + panic("%s: ncp %p flag %x dvp %p vp %p\n", __func__, ncp, + ncp->nc_flag, ncp->nc_dvp, ncp->nc_vp); + } + MPASS(ncp->nc_flag & NCF_NEGATIVE); dvlp = VP2VNODELOCK(ncp->nc_dvp); blp = NCP2BUCKETLOCK(ncp); -- Mateusz Guzik From owner-svn-src-all@freebsd.org Thu Oct 20 13:12:21 2016 Return-Path: Delivered-To: svn-src-all@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 71D7BC19115; Thu, 20 Oct 2016 13:12:21 +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 2F11AE4C; Thu, 20 Oct 2016 13:12:21 +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 u9KDCKTT010335; Thu, 20 Oct 2016 13:12:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KDCJXx010328; Thu, 20 Oct 2016 13:12:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610201312.u9KDCJXx010328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 20 Oct 2016 13:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307672 - in stable/10/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/drm2/i915 dev/drm2/ttm kern vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 13:12:21 -0000 Author: kib Date: Thu Oct 20 13:12:19 2016 New Revision: 307672 URL: https://svnweb.freebsd.org/changeset/base/307672 Log: MFC r307218: Fix a race in vm_page_busy_sleep(9). Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/10/sys/dev/drm2/i915/i915_gem.c stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c stable/10/sys/kern/vfs_bio.c stable/10/sys/vm/vm_object.c stable/10/sys/vm/vm_page.c stable/10/sys/vm/vm_page.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 20 11:42:29 2016 (r307671) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 20 13:12:19 2016 (r307672) @@ -421,7 +421,7 @@ page_busy(vnode_t *vp, int64_t start, in vm_page_reference(pp); vm_page_lock(pp); zfs_vmobject_wunlock(obj); - vm_page_busy_sleep(pp, "zfsmwb"); + vm_page_busy_sleep(pp, "zfsmwb", true); zfs_vmobject_wlock(obj); continue; } @@ -476,7 +476,7 @@ page_hold(vnode_t *vp, int64_t start) vm_page_reference(pp); vm_page_lock(pp); zfs_vmobject_wunlock(obj); - vm_page_busy_sleep(pp, "zfsmwb"); + vm_page_busy_sleep(pp, "zfsmwb", true); zfs_vmobject_wlock(obj); continue; } Modified: stable/10/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- stable/10/sys/dev/drm2/i915/i915_gem.c Thu Oct 20 11:42:29 2016 (r307671) +++ stable/10/sys/dev/drm2/i915/i915_gem.c Thu Oct 20 13:12:19 2016 (r307672) @@ -1976,7 +1976,7 @@ retry: DRM_UNLOCK(dev); vm_page_lock(m); VM_OBJECT_WUNLOCK(vm_obj); - vm_page_busy_sleep(m, "915pee"); + vm_page_busy_sleep(m, "915pee", false); goto retry; } goto have_page; @@ -2037,7 +2037,7 @@ retry: DRM_UNLOCK(dev); vm_page_lock(m); VM_OBJECT_WUNLOCK(vm_obj); - vm_page_busy_sleep(m, "915pbs"); + vm_page_busy_sleep(m, "915pbs", false); goto retry; } if (vm_page_insert(m, vm_obj, OFF_TO_IDX(offset))) { Modified: stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Oct 20 11:42:29 2016 (r307671) +++ stable/10/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Oct 20 13:12:19 2016 (r307672) @@ -239,7 +239,7 @@ reserve: if (vm_page_busied(m)) { vm_page_lock(m); VM_OBJECT_WUNLOCK(vm_obj); - vm_page_busy_sleep(m, "ttmpbs"); + vm_page_busy_sleep(m, "ttmpbs", false); VM_OBJECT_WLOCK(vm_obj); ttm_mem_io_unlock(man); ttm_bo_unreserve(bo); Modified: stable/10/sys/kern/vfs_bio.c ============================================================================== --- stable/10/sys/kern/vfs_bio.c Thu Oct 20 11:42:29 2016 (r307671) +++ stable/10/sys/kern/vfs_bio.c Thu Oct 20 13:12:19 2016 (r307672) @@ -1724,7 +1724,7 @@ brelse(struct buf *bp) while (vm_page_xbusied(m)) { vm_page_lock(m); VM_OBJECT_WUNLOCK(obj); - vm_page_busy_sleep(m, "mbncsh"); + vm_page_busy_sleep(m, "mbncsh", true); VM_OBJECT_WLOCK(obj); } if (pmap_page_wired_mappings(m) == 0) @@ -4069,7 +4069,7 @@ vfs_drain_busy_pages(struct buf *bp) while (vm_page_xbusied(m)) { vm_page_lock(m); VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); - vm_page_busy_sleep(m, "vbpage"); + vm_page_busy_sleep(m, "vbpage", true); VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); } } Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Thu Oct 20 11:42:29 2016 (r307671) +++ stable/10/sys/vm/vm_object.c Thu Oct 20 13:12:19 2016 (r307672) @@ -1182,7 +1182,7 @@ shadowlookup: if (object != tobject) VM_OBJECT_WUNLOCK(object); VM_OBJECT_WUNLOCK(tobject); - vm_page_busy_sleep(m, "madvpo"); + vm_page_busy_sleep(m, "madvpo", false); VM_OBJECT_WLOCK(object); goto relookup; } @@ -1361,7 +1361,7 @@ retry: VM_OBJECT_WUNLOCK(new_object); vm_page_lock(m); VM_OBJECT_WUNLOCK(orig_object); - vm_page_busy_sleep(m, "spltwt"); + vm_page_busy_sleep(m, "spltwt", false); VM_OBJECT_WLOCK(orig_object); VM_OBJECT_WLOCK(new_object); goto retry; @@ -1450,7 +1450,7 @@ vm_object_backing_scan_wait(vm_object_t if (p == NULL) VM_WAIT; else - vm_page_busy_sleep(p, "vmocol"); + vm_page_busy_sleep(p, "vmocol", false); VM_OBJECT_WLOCK(object); VM_OBJECT_WLOCK(backing_object); return (TAILQ_FIRST(&backing_object->memq)); @@ -1917,7 +1917,7 @@ again: vm_page_lock(p); if (vm_page_xbusied(p)) { VM_OBJECT_WUNLOCK(object); - vm_page_busy_sleep(p, "vmopax"); + vm_page_busy_sleep(p, "vmopax", true); VM_OBJECT_WLOCK(object); goto again; } @@ -1932,7 +1932,7 @@ again: } if (vm_page_busied(p)) { VM_OBJECT_WUNLOCK(object); - vm_page_busy_sleep(p, "vmopar"); + vm_page_busy_sleep(p, "vmopar", false); VM_OBJECT_WLOCK(object); goto again; } Modified: stable/10/sys/vm/vm_page.c ============================================================================== --- stable/10/sys/vm/vm_page.c Thu Oct 20 11:42:29 2016 (r307671) +++ stable/10/sys/vm/vm_page.c Thu Oct 20 13:12:19 2016 (r307672) @@ -601,21 +601,20 @@ vm_page_sunbusy(vm_page_t m) * This is used to implement the hard-path of busying mechanism. * * The given page must be locked. + * + * If nonshared is true, sleep only if the page is xbusy. */ void -vm_page_busy_sleep(vm_page_t m, const char *wmesg) +vm_page_busy_sleep(vm_page_t m, const char *wmesg, bool nonshared) { u_int x; - vm_page_lock_assert(m, MA_OWNED); + vm_page_assert_locked(m); x = m->busy_lock; - if (x == VPB_UNBUSIED) { - vm_page_unlock(m); - return; - } - if ((x & VPB_BIT_WAITERS) == 0 && - !atomic_cmpset_int(&m->busy_lock, x, x | VPB_BIT_WAITERS)) { + if (x == VPB_UNBUSIED || (nonshared && (x & VPB_BIT_SHARED) != 0) || + ((x & VPB_BIT_WAITERS) == 0 && + !atomic_cmpset_int(&m->busy_lock, x, x | VPB_BIT_WAITERS))) { vm_page_unlock(m); return; } @@ -928,7 +927,7 @@ vm_page_sleep_if_busy(vm_page_t m, const obj = m->object; vm_page_lock(m); VM_OBJECT_WUNLOCK(obj); - vm_page_busy_sleep(m, msg); + vm_page_busy_sleep(m, msg, false); VM_OBJECT_WLOCK(obj); return (TRUE); } @@ -2717,7 +2716,8 @@ retrylookup: vm_page_aflag_set(m, PGA_REFERENCED); vm_page_lock(m); VM_OBJECT_WUNLOCK(object); - vm_page_busy_sleep(m, "pgrbwt"); + vm_page_busy_sleep(m, "pgrbwt", (allocflags & + VM_ALLOC_IGN_SBUSY) != 0); VM_OBJECT_WLOCK(object); goto retrylookup; } else { Modified: stable/10/sys/vm/vm_page.h ============================================================================== --- stable/10/sys/vm/vm_page.h Thu Oct 20 11:42:29 2016 (r307671) +++ stable/10/sys/vm/vm_page.h Thu Oct 20 13:12:19 2016 (r307672) @@ -420,7 +420,7 @@ malloc2vm_flags(int malloc_flags) #endif void vm_page_busy_downgrade(vm_page_t m); -void vm_page_busy_sleep(vm_page_t m, const char *msg); +void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); void vm_page_flash(vm_page_t m); void vm_page_hold(vm_page_t mem); void vm_page_unhold(vm_page_t mem); From owner-svn-src-all@freebsd.org Thu Oct 20 13:48:30 2016 Return-Path: Delivered-To: svn-src-all@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 64073C19C91; Thu, 20 Oct 2016 13:48:30 +0000 (UTC) (envelope-from gallatin@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 3401C5F9; Thu, 20 Oct 2016 13:48:30 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KDmTKJ022297; Thu, 20 Oct 2016 13:48:29 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KDmTpE022296; Thu, 20 Oct 2016 13:48:29 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201610201348.u9KDmTpE022296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Thu, 20 Oct 2016 13:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307673 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 13:48:30 -0000 Author: gallatin Date: Thu Oct 20 13:48:29 2016 New Revision: 307673 URL: https://svnweb.freebsd.org/changeset/base/307673 Log: Clear mbuf hashtype on loopback when RSS is enabled. The hashtype on an outgoing mbuf reflects the correct hash on the transmit side of the connection. If this hash persists on loopback, the receiving RSS/PCBGROUP code will use it to look up the pcbgroup for the transmit side, which will often not match the pcbgroup for the receive side of the connection. This leads to TCP connections hanging, and dropping the SYN/ACK packet. This is essentially the same as having a hardware network card generate mbufs with an incorrect RSS hash. There are a number of places which can set the hash on transmit, so the simplest fix is to simply clear the hash at loopback time. Clearing the hash allows a new, correct hash to be calculated in software on the receive side. Reviewed by: jtl Discussed with: adrian Sponsored by: Netflix Modified: head/sys/net/if_loop.c Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Thu Oct 20 13:12:19 2016 (r307672) +++ head/sys/net/if_loop.c Thu Oct 20 13:48:29 2016 (r307673) @@ -36,6 +36,7 @@ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_rss.h" #include #include @@ -224,6 +225,10 @@ looutput(struct ifnet *ifp, struct mbuf if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); +#ifdef RSS + M_HASHTYPE_CLEAR(m); +#endif + /* BPF writes need to be handled specially. */ if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); From owner-svn-src-all@freebsd.org Thu Oct 20 14:48:59 2016 Return-Path: Delivered-To: svn-src-all@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 4271BC19843; Thu, 20 Oct 2016 14:48:59 +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 1F6DE228; Thu, 20 Oct 2016 14:48:59 +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 u9KEmwEr045167; Thu, 20 Oct 2016 14:48:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KEmvO8045162; Thu, 20 Oct 2016 14:48:57 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610201448.u9KEmvO8045162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 20 Oct 2016 14:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307674 - in head: gnu/usr.bin share/mk tools/build/mk tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 14:48:59 -0000 Author: emaste Date: Thu Oct 20 14:48:57 2016 New Revision: 307674 URL: https://svnweb.freebsd.org/changeset/base/307674 Log: Add knobs to make GNU diff and GNU grep optional This is added to facilitate experiments building FreeBSD without copyleft software. If WITHOUT_GNU_DIFF is set no /usr/bin/diff or /usr/bin/diff3 will be built. If WITHOUT_GNU_GREP is set then BSD grep will be installed as /usr/bin/bsdgrep or /usr/bin/grep, depending on the WITH_BSD_GREP knob. Reviewed by: brooks (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: Differential Revision: https://reviews.freebsd.org/D8288 Added: head/tools/build/options/WITHOUT_GNU_DIFF (contents, props changed) head/tools/build/options/WITHOUT_GNU_GREP (contents, props changed) Modified: head/gnu/usr.bin/Makefile head/share/mk/src.opts.mk head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/gnu/usr.bin/Makefile ============================================================================== --- head/gnu/usr.bin/Makefile Thu Oct 20 13:48:29 2016 (r307673) +++ head/gnu/usr.bin/Makefile Thu Oct 20 14:48:57 2016 (r307674) @@ -2,10 +2,6 @@ .include -SUBDIR= diff \ - diff3 \ - grep - SUBDIR_DEPEND_gdb= ${_binutils} .if ${MK_CXX} != "no" @@ -21,6 +17,8 @@ SUBDIR.${MK_GDB}+= gdb .endif SUBDIR.${MK_GCC}+= cc +SUBDIR.${MK_GNU_DIFF}+= diff diff3 +SUBDIR.${MK_GNU_GREP}+= grep SUBDIR.${MK_GPL_DTC}+= dtc SUBDIR.${MK_TESTS}+= tests Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Oct 20 13:48:29 2016 (r307673) +++ head/share/mk/src.opts.mk Thu Oct 20 14:48:57 2016 (r307674) @@ -98,6 +98,8 @@ __DEFAULT_YES_OPTIONS = \ GCOV \ GDB \ GNU \ + GNU_DIFF \ + GNU_GREP \ GNU_GREP_COMPAT \ GPIO \ GPL_DTC \ Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Thu Oct 20 13:48:29 2016 (r307673) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Thu Oct 20 14:48:57 2016 (r307674) @@ -2173,6 +2173,39 @@ OLD_FILES+=usr/share/man/man3/gpio_pin_t OLD_FILES+=usr/share/man/man8/gpioctl.8.gz .endif +.if ${MK_GNU_DIFF} == no +OLD_FILES+=usr/bin/diff +OLD_FILES+=usr/bin/diff3 +OLD_FILES+=usr/share/man/man1/diff.1.gz +OLD_FILES+=usr/share/man/man1/diff3.1.gz +OLD_FILES+=usr/share/man/man7/diff.7.gz +.endif + +.if ${MK_GNU_GREP} == no +OLD_FILES+=usr/bin/gnugrep +OLD_FILES+=usr/share/man/man1/gnugrep.1.gz +.if ${MK_BSD_GREP} == no +OLD_FILES+=usr/bin/bzgrep +OLD_FILES+=usr/bin/bzegrep +OLD_FILES+=usr/bin/bzfgrep +OLD_FILES+=usr/bin/egrep +OLD_FILES+=usr/bin/fgrep +OLD_FILES+=usr/bin/grep +OLD_FILES+=usr/bin/zegrep +OLD_FILES+=usr/bin/zfgrep +OLD_FILES+=usr/bin/zgrep +OLD_FILES+=usr/share/man/man1/bzegrep.1.gz +OLD_FILES+=usr/share/man/man1/bzfgrep.1.gz +OLD_FILES+=usr/share/man/man1/bzgrep.1.gz +OLD_FILES+=usr/share/man/man1/egrep.1.gz +OLD_FILES+=usr/share/man/man1/fgrep.1.gz +OLD_FILES+=usr/share/man/man1/grep.1.gz +OLD_FILES+=usr/share/man/man1/zegrep.1.gz +OLD_FILES+=usr/share/man/man1/zfgrep.1.gz +OLD_FILES+=usr/share/man/man1/zgrep.1.gz +.endif +.endif + # Also includes vgrind(1) .if ${MK_GROFF} == no OLD_FILES+=usr/bin/addftinfo Added: head/tools/build/options/WITHOUT_GNU_DIFF ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_GNU_DIFF Thu Oct 20 14:48:57 2016 (r307674) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr diff 1 +and +.Xr diff3 1 . Added: head/tools/build/options/WITHOUT_GNU_GREP ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_GNU_GREP Thu Oct 20 14:48:57 2016 (r307674) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to not build GNU +.Xr grep 1 . From owner-svn-src-all@freebsd.org Thu Oct 20 15:12:07 2016 Return-Path: Delivered-To: svn-src-all@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 7942BC1A1DE; Thu, 20 Oct 2016 15:12:07 +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 4B2A5938; Thu, 20 Oct 2016 15:12:07 +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 u9KFC6Zh053717; Thu, 20 Oct 2016 15:12:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KFC6YK053716; Thu, 20 Oct 2016 15:12:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610201512.u9KFC6YK053716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 20 Oct 2016 15:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307675 - head/gnu/usr.bin X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 15:12:07 -0000 Author: emaste Date: Thu Oct 20 15:12:06 2016 New Revision: 307675 URL: https://svnweb.freebsd.org/changeset/base/307675 Log: Remove trailing whitespace from r307674 Modified: head/gnu/usr.bin/Makefile Modified: head/gnu/usr.bin/Makefile ============================================================================== --- head/gnu/usr.bin/Makefile Thu Oct 20 14:48:57 2016 (r307674) +++ head/gnu/usr.bin/Makefile Thu Oct 20 15:12:06 2016 (r307675) @@ -17,8 +17,8 @@ SUBDIR.${MK_GDB}+= gdb .endif SUBDIR.${MK_GCC}+= cc -SUBDIR.${MK_GNU_DIFF}+= diff diff3 -SUBDIR.${MK_GNU_GREP}+= grep +SUBDIR.${MK_GNU_DIFF}+= diff diff3 +SUBDIR.${MK_GNU_GREP}+= grep SUBDIR.${MK_GPL_DTC}+= dtc SUBDIR.${MK_TESTS}+= tests From owner-svn-src-all@freebsd.org Thu Oct 20 15:14:22 2016 Return-Path: Delivered-To: svn-src-all@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 BD216C1A33F; Thu, 20 Oct 2016 15:14:22 +0000 (UTC) (envelope-from jonathan@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 8048DC16; Thu, 20 Oct 2016 15:14:22 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KFELs8056436; Thu, 20 Oct 2016 15:14:21 GMT (envelope-from jonathan@FreeBSD.org) Received: (from jonathan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KFELev056434; Thu, 20 Oct 2016 15:14:21 GMT (envelope-from jonathan@FreeBSD.org) Message-Id: <201610201514.u9KFELev056434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jonathan set sender to jonathan@FreeBSD.org using -f From: Jonathan Anderson Date: Thu, 20 Oct 2016 15:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307676 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 15:14:22 -0000 Author: jonathan Date: Thu Oct 20 15:14:21 2016 New Revision: 307676 URL: https://svnweb.freebsd.org/changeset/base/307676 Log: Add make rules to build LLVM IR from C/C++ sources. As a foundation for future work with LLVM's Intermediate Representation (IR), add new suffix rules that can be used to build .llo (text) or .bco (bitcode) files from C or C++ sources. This compilation step uses the same CFLAGS, etc., as are used for building .o files, with the exception of optimization flags. Many of the things we would like to do with IR (e.g., instrumentation) work better with unoptimized code, so our approach is to build .c->.bco without optimization and then apply the optimization in post-analysis, post-instrumentation linking. The overall result of these changes is: * one can "make foo.llo" or "make foo.bco" wherever "make foo.o" was supported * new make variables IR_CFLAGS and IR_CXXFLAGS are available to inspect the flags that are used by Clang to generate the IR These new rules are added unconditionally to our non-POSIX suffix rule set, since we cannot inspect COMPILER_TYPE in sys.mk. Future changes that depend on these rules (e.g., building IR versions of binaries from bsd.prog.mk) should use COMPILER_TYPE to determine when we can expect IR rules to succeed. Reviewed by: emaste, imp Approved by: rwatson (mentor) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D4339 Modified: head/share/mk/bsd.suffixes.mk head/share/mk/sys.mk Modified: head/share/mk/bsd.suffixes.mk ============================================================================== --- head/share/mk/bsd.suffixes.mk Thu Oct 20 15:12:06 2016 (r307675) +++ head/share/mk/bsd.suffixes.mk Thu Oct 20 15:14:21 2016 (r307676) @@ -20,12 +20,24 @@ ${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} +.c.bco: + ${CC} -emit-llvm ${IR_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + +.c.llo: + ${CC} -emit-llvm ${IR_CFLAGS} -S ${.IMPSRC} -o ${.TARGET} + .cc .cpp .cxx .C: ${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} .cc.o .cpp.o .cxx.o .C.o: ${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} +.cc.bco .cpp.bco .cxx.bco .C.bco: + ${CXX} -emit-llvm ${IR_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + +.cc.llo .cpp.llo .cxx.llo .C.llo: + ${CXX} -emit-llvm ${IR_CXXFLAGS} -S ${.IMPSRC} -o ${.TARGET} + .m.o: ${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Thu Oct 20 15:12:06 2016 (r307675) +++ head/share/mk/sys.mk Thu Oct 20 15:14:21 2016 (r307676) @@ -153,6 +153,7 @@ CFLAGS ?= -O2 -pipe CFLAGS += -fno-strict-aliasing .endif .endif +IR_CFLAGS ?= ${STATIC_CFLAGS:N-O*} ${CFLAGS:N-O*} PO_CFLAGS ?= ${CFLAGS} # cp(1) is used to copy source files to ${.OBJDIR}, make sure it can handle @@ -173,6 +174,7 @@ CTFFLAGS += -g CXX ?= c++ CXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign:N-Wold-style-definition} +IR_CXXFLAGS ?= ${STATIC_CXXFLAGS:N-O*} ${CXXFLAGS:N-O*} PO_CXXFLAGS ?= ${CXXFLAGS} DTRACE ?= dtrace From owner-svn-src-all@freebsd.org Thu Oct 20 17:10:27 2016 Return-Path: Delivered-To: svn-src-all@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 501A2C1AF64; Thu, 20 Oct 2016 17:10:27 +0000 (UTC) (envelope-from br@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 20721A9; Thu, 20 Oct 2016 17:10:27 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KHAQEJ000884; Thu, 20 Oct 2016 17:10:26 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KHAQqg000883; Thu, 20 Oct 2016 17:10:26 GMT (envelope-from br@FreeBSD.org) Message-Id: <201610201710.u9KHAQqg000883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 20 Oct 2016 17:10:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307677 - head/sys/modules/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 17:10:27 -0000 Author: br Date: Thu Oct 20 17:10:26 2016 New Revision: 307677 URL: https://svnweb.freebsd.org/changeset/base/307677 Log: Disable geom_eli module build on MIPS64 as it has alignment issues and causes kernel panic. ELI metadata is also not aligned properly for MIPS64 case. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Modified: head/sys/modules/geom/Makefile Modified: head/sys/modules/geom/Makefile ============================================================================== --- head/sys/modules/geom/Makefile Thu Oct 20 15:14:21 2016 (r307676) +++ head/sys/modules/geom/Makefile Thu Oct 20 17:10:26 2016 (r307677) @@ -6,7 +6,6 @@ SYSDIR?=${.CURDIR}/../.. SUBDIR= geom_bde \ geom_cache \ geom_concat \ - geom_eli \ geom_gate \ geom_journal \ geom_label \ @@ -30,4 +29,9 @@ SUBDIR= geom_bde \ SUBDIR+= geom_ccd .endif +# Alignment issues in g_eli_auth_run() on MIPS64 causes kernel panic +.if ${MACHINE_ARCH} != "mips64" && ${MACHINE_ARCH} != "mips64el" +SUBDIR+= geom_eli +.endif + .include From owner-svn-src-all@freebsd.org Thu Oct 20 17:16:10 2016 Return-Path: Delivered-To: svn-src-all@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 70BCEC1A186; Thu, 20 Oct 2016 17:16:10 +0000 (UTC) (envelope-from gjb@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 3F2C18EA; Thu, 20 Oct 2016 17:16:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KHG9vs004827; Thu, 20 Oct 2016 17:16:09 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KHG9Xi004826; Thu, 20 Oct 2016 17:16:09 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610201716.u9KHG9Xi004826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 20 Oct 2016 17:16: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: r307678 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 17:16:10 -0000 Author: gjb Date: Thu Oct 20 17:16:09 2016 New Revision: 307678 URL: https://svnweb.freebsd.org/changeset/base/307678 Log: Add an EN item regarding some recent systems that fail to boot under certain circumstances. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Thu Oct 20 17:10:26 2016 (r307677) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Thu Oct 20 17:16:09 2016 (r307678) @@ -198,6 +198,17 @@ boot + + + [2016-10-20] Several recent Dell + systems fail to find a bootable disk when the system boots + in Legacy/BIOS/CSM mode, the boot disk is partitioned with + GPT, and the Active flag in the + Protective MBR is not set. To work + around this issue, either configure the system to boot in + UEFI mode, or choose the "GPT + + Active" scheme. + From owner-svn-src-all@freebsd.org Thu Oct 20 17:28:53 2016 Return-Path: Delivered-To: svn-src-all@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 BF0ECC1A5D6; Thu, 20 Oct 2016 17:28:53 +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 8DEC719E; Thu, 20 Oct 2016 17:28:53 +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 u9KHSqgH009399; Thu, 20 Oct 2016 17:28:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KHSq2X009398; Thu, 20 Oct 2016 17:28:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610201728.u9KHSq2X009398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 20 Oct 2016 17:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307679 - head/gnu/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 17:28:53 -0000 Author: emaste Date: Thu Oct 20 17:28:52 2016 New Revision: 307679 URL: https://svnweb.freebsd.org/changeset/base/307679 Log: Build libgnuregex only if necessary for other components Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D8298 Modified: head/gnu/lib/Makefile Modified: head/gnu/lib/Makefile ============================================================================== --- head/gnu/lib/Makefile Thu Oct 20 17:16:09 2016 (r307678) +++ head/gnu/lib/Makefile Thu Oct 20 17:28:52 2016 (r307679) @@ -4,7 +4,6 @@ SUBDIR= csu SUBDIR+= libgcc -SUBDIR+= libregex SUBDIR.${MK_DIALOG}+= libdialog SUBDIR.${MK_GCC}+= libgcov libgomp @@ -15,6 +14,11 @@ SUBDIR.${MK_TESTS}+= tests SUBDIR+= libreadline .endif +.if ${MK_GNU_DIFF} != "no" || ${MK_GNU_GREP} != "no" || \ + ${GNU_GREP_COMPAT} != "no" || ${MK_GDB} != "no" +SUBDIR+= libregex +.endif + # libsupc++ uses libstdc++ headers, although 'make includes' should # have taken care of that already. .if ${MK_GNUCXX} != "no" From owner-svn-src-all@freebsd.org Thu Oct 20 18:18:29 2016 Return-Path: Delivered-To: svn-src-all@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 3C19AC1954D; Thu, 20 Oct 2016 18:18:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F7EDF61; Thu, 20 Oct 2016 18:18:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u9KIIR0L038343 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 20 Oct 2016 11:18:27 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u9KIIRcI038342; Thu, 20 Oct 2016 11:18:27 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 20 Oct 2016 11:18:27 -0700 From: Gleb Smirnoff To: Mateusz Guzik Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307650 - head/sys/kern Message-ID: <20161020181827.GU27748@FreeBSD.org> References: <201610191829.u9JITqhm081246@repo.freebsd.org> <20161019220942.GM27748@FreeBSD.org> <20161020115035.GA26990@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161020115035.GA26990@dft-labs.eu> User-Agent: Mutt/1.7.0 (2016-08-17) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 18:18:29 -0000 On Thu, Oct 20, 2016 at 01:50:35PM +0200, Mateusz Guzik wrote: M> On Wed, Oct 19, 2016 at 03:09:42PM -0700, Gleb Smirnoff wrote: M> > On Wed, Oct 19, 2016 at 06:29:52PM +0000, Mateusz Guzik wrote: M> > M> Author: mjg M> > M> Date: Wed Oct 19 18:29:52 2016 M> > M> New Revision: 307650 M> > M> URL: https://svnweb.freebsd.org/changeset/base/307650 M> > M> M> > M> Log: M> > M> cache: split negative entry LRU into multiple lists M> > M> M> > M> This splits the ncneg_mtx lock while preserving the hit ratio at least M> > M> during buildworld. M> > M> M> > M> Create N dedicated lists for new negative entries. M> > M> M> > M> Entries with at least one hit get promoted to the hot list, where they M> > M> get requeued every M hits. M> > M> M> > M> Shrinking demotes one hot entry and performs a round-robin shrinking of M> > M> regular lists. M> > M> M> > M> Reviewed by: kib M> > M> > This instapanics: M> > M> > panic: Assertion ncp->nc_flag & NCF_NEGATIVE failed at /usr/src/head/sys/kern/vfs_cache.c:815 M> > M> M> It definitely works for me and I don't see how the condition can fail. M> M> Given the 'instapanic' note, I assume you can easily reproduce. Is this M> a stock head kernel? M> M> Can you reproduce with; Trying to mount root from ufs:/dev/vtbd0p3 [rw]... panic: cache_negative_zap_one: ncp 0xffffffff81012500 flag 0 dvp 0 vp 0 cpuid = 11 KDB: enter: panic [ thread pid 21 tid 100097 ] Stopped at breakpoint+0x5: popq %rbp db> bt Tracing pid 21 tid 100097 td 0xfffff8000342ca00 breakpoint() at breakpoint+0x5/frame 0xfffffe00f7e8da90 kdb_enter() at kdb_enter+0x67/frame 0xfffffe00f7e8dac0 vpanic() at vpanic+0x26b/frame 0xfffffe00f7e8db90 kproc_shutdown() at kproc_shutdown/frame 0xfffffe00f7e8dbf0 cache_negative_zap_one() at cache_negative_zap_one+0x313/frame 0xfffffe00f7e8dcb0 cache_enter_time() at cache_enter_time+0xe5a/frame 0xfffffe00f7e8de10 ufs_lookup_ino() at ufs_lookup_ino+0xaf1/frame 0xfffffe00f7e8e030 ufs_lookup() at ufs_lookup+0x39/frame 0xfffffe00f7e8e050 VOP_CACHEDLOOKUP_APV() at VOP_CACHEDLOOKUP_APV+0x20a/frame 0xfffffe00f7e8e0d0 VOP_CACHEDLOOKUP() at VOP_CACHEDLOOKUP+0x4d/frame 0xfffffe00f7e8e120 vfs_cache_lookup() at vfs_cache_lookup+0x148/frame 0xfffffe00f7e8e190 VOP_LOOKUP_APV() at VOP_LOOKUP_APV+0x20a/frame 0xfffffe00f7e8e210 VOP_LOOKUP() at VOP_LOOKUP+0x4d/frame 0xfffffe00f7e8e260 lookup() at lookup+0xa02/frame 0xfffffe00f7e8e3a0 namei() at namei+0x9c6/frame 0xfffffe00f7e8e550 kern_statat() at kern_statat+0x16d/frame 0xfffffe00f7e8e7c0 sys_stat() at sys_stat+0x89/frame 0xfffffe00f7e8e8b0 syscallenter() at syscallenter+0x54f/frame 0xfffffe00f7e8e980 amd64_syscall() at amd64_syscall+0x2a/frame 0xfffffe00f7e8eab0 Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe00f7e8eab0 --- syscall (188, FreeBSD ELF64, sys_stat), rip = 0x800bd391a, rsp = 0x7fffffffe9a8, rbp = 0x7fffffffea90 --- db> -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Thu Oct 20 18:23:45 2016 Return-Path: Delivered-To: svn-src-all@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 BF3B8C1981D; Thu, 20 Oct 2016 18:23:45 +0000 (UTC) (envelope-from rstone@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 873606AC; Thu, 20 Oct 2016 18:23:45 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KINiqT031768; Thu, 20 Oct 2016 18:23:44 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KINiwr031764; Thu, 20 Oct 2016 18:23:44 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201610201823.u9KINiwr031764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 20 Oct 2016 18:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307680 - in head/tools/tools: . git X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 18:23:45 -0000 Author: rstone Date: Thu Oct 20 18:23:44 2016 New Revision: 307680 URL: https://svnweb.freebsd.org/changeset/base/307680 Log: Add some tools to simplify the use of git Add some scripts that wraps some FreeBSD Project infrastructure and simplifies using them with git. The scripts are: - arcgit, which creates a series of reviews in Differential - importgit, which applies a series of git commits to svn Differential Revision: https://reviews.freebsd.org/D2071 Added: head/tools/tools/git/ head/tools/tools/git/HOWTO (contents, props changed) head/tools/tools/git/arcgit (contents, props changed) head/tools/tools/git/importgit (contents, props changed) Modified: head/tools/tools/README Modified: head/tools/tools/README ============================================================================== --- head/tools/tools/README Thu Oct 20 17:28:52 2016 (r307679) +++ head/tools/tools/README Thu Oct 20 18:23:44 2016 (r307680) @@ -29,6 +29,7 @@ gdb_regofs A simple tool that prints out platforms only. genericize Turn a kernel config into something that can more easily be diffed against the appropriate GENERIC. +git Tools to simplify the use of git by committers. hcomp Compress header files by removing comments and whitespace. html-mv Rename HTML generated filenames to human readable filenames. ifinfo Uses the interface MIB to print out all the information Added: head/tools/tools/git/HOWTO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/git/HOWTO Thu Oct 20 18:23:44 2016 (r307680) @@ -0,0 +1,144 @@ +# $FreeBSD$ + +This directory contains tools intended to help committers use git when +interacting with standard FreeBSD project resources like Differential or svn. + +I. arcgit + +arcgit is a wrapper script around the arc command line tool that simplifies the +automatic creation of a series of Differential reviews from a series of git +commits. The intended workflow is: + +1. Create a series of commits in git. Each commit will be a separate review, so + try to make each commit as self-contained as possible. The series of commits + should demonstrate a logical progression towards your end goal. For example, + one commit might refactor existing code to expose a new API without changing + any current functionality. A subsequent commit could then introduce your new + code that uses the new API. + + It usually will not be helpful to present your code in the order in which it + was actually written and can actually be harmful. For example, if you + introduced a bug early in your development process that you fixed in a + subsequent commit, it is a waste of your reviewer's time to have them review + old code with known bugs. Instead, it would probably be best to squash the + bug fix into the commit that introduced it, so that the bug is never + presented to your reviewers in any review. + + The commit headline and commit message will be imported verbatim into + Differential, so try to give each commit a meaningful commit message that + gives your reviewers the necessary context to understand your change. + +2. Create your reviews bu running this command in your git repo: + $ arcgit -r C1~..C2 -R reviewer -T testplan + + C1 should be the first commit that you want reviewed, and C2 should be the + last commit that you want reviewed. You may add multiple reviewers by + specifying the -R option multiple times. You can CC (AKA subscribe) people + to a review with the -C option. Note that if you subscribe a mailing list + to a review, the mailing list will be emailed for every comment or change + made to each review. Please be judicious when subscibing mailing lists to + reviews. It may be better to instead send a single email to the appropriate + list announcing all of the reviews and giving a short summary of the change + as a whole, along with a link to the individual reviews. + +3. When you need to make a change and upload it to a review, use the following + process. First, check out the branch corresponding to the review (arcgit + automatically creates this branch for every review that it creates): + + $ git checkout review_D1234 + + Next, make your change and perform whatever testing is necessary. Commit it + to your repository with this command: + + $ git commit --fixup HEAD + + You can upload the change to the code review by running this command in your + repository while (ensure that you are still on the review_D1234 branch): + + $ arc diff --update D1234 review_D1234_base + + When you run arc, it will pull up your editor and give you a chance to + change the message that will be shown in Differential for this upload. It's + recommended that you change it from the default "fixup! ...." as that does + not give your reviewers an indication of what changes were made. It's not + recommended that you give the code review fixes meaningful commit messages + directly because we will be using git's autosquash feature in the next step, + which depends on the fixup! tag being present. + + Do not merge in other branches, or rebase your review branches at this point. + Any changes that are made will show up in your reviews, and that will create + extra noise that your reviewers will have to ignore. If a reviewer requests + a change that requires your commit to be based off of a later version of + head, I would suggest deferring the change from the review and creating a + new review with the change once you hit step 5. + +4. Once the reviews have been approved, you need to prepare your patch series + to be committed. This involves squashing the fixes made in code review + back into the original commit that they applied to. This gives you a clean + series of commits that are ready to be commited back to svn. + + First, merge each of your review branches back into your main development + branch. For example: + + $ git checkout myfeature_dev + $ for branch in review_D1234 review_D1235 review_D1236; do \ + git merge $branch || git mergetool -y || break; done + + Next, do an interactive rebase to squash your code review fixes back into the + main commit: + + $ git rebase -i -k review_D1234_base + + review_D1234 should be the name of the *first* review that was created for + you in step 2. For every commit, your editor will be pulled up and you will + be given one last chance to edit your commit message. Make sure that you fill + in the "Reviewed by:" tag indicating who accepted the review. This would + be a good point to add other tags like MFC after:, Sponsored by:, etc. + + The rebase will not introduce any actual changes to your code if done + properly. You can use this command to double-check that no changes were + inadvertently made here: + + $ git diff myfeature_dev@{1} + +5. Finally, you should get up to date with the latest changes from head: + + $ git pull --rebase origin master + + It is not recommended that you combine this step with the rebase done in the + previous step. The reason for this is that if you perform an interactive + rebase that changes the commit that you branch from, it becomes much more + difficult to use the reflog to confirm that the interactive rebase did not + introduce unwanted changes. + + At this point, you are ready to commit your changes to head. The importgit + script can be used to import your commits directly into git. + +II. importgit + +importgit is a script that can take a series of commits from git and commit them +to a svn repository. The script uses the git commit messages for the svn commit +message, which allows importgit to be fully automated. This does mean that once +you start importgit, it will start commit things to svn without giving any +further chance to sanity check what it's doing. + +importgit only supports importing commits that add or modify files. It does not +support importing commits that rename or delete files, to ensure that git's +rename detection heuristics do not introduce an error in the import process. +importgit also does not support importing merge commits. Only linear history +can be imported into svn. + +importgit must be run from a clean subversion checkout. You should ensure that +the working tree is up-to-date with "svn up" before running importgit. +importgit will run svn directly, so make sure that your ssh-agent is running +and has your ssh key loaded already. Run importgit as follows: + + $ importgit -r D1~..D2 -g /path/to/git/repo + +This will import every commit between D1 and D2, including both D1 and D2. The +invocation is very similar to the invocation given to arcgit but there is an +important point to note. When you rebased your commits as you followed steps 4 +and 5, the commit hashes of all of your commits changed, including C1 and C2. +You must go back and find the new commit hashes of your commits to pass to +importgit. Passing -r C1~..C2 would import your commits as they were *before* +your code review fixes were applied. Added: head/tools/tools/git/arcgit ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/git/arcgit Thu Oct 20 18:23:44 2016 (r307680) @@ -0,0 +1,214 @@ +#!/bin/sh +# +# Copyright (c) 2015 Ryan Stone. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# This script is used to submit a series of git commits to Differential. Each +# commit is submitted as a separate review. For each review, this script will +# create a branch called review_DXXXX (e.g. review_D2185 for Differential +# revision D2185). When you need to make a change to a review, checkout the +# review_D2185 branch, commit your change with "git commit --fixup HEAD". To\ +# upload the change to Differential, use the command: +# $ arc diff --update D2185 review_D2185_base +# +# When your reviews are complete, merge all of the review_DXXXX branches +# together, and then do a git rebase -ik to meld the code review fixes into the +# commit that they fixed. Now you have a clean series of patches to commit to +# svn. + +usage() +{ + echo "Usage: arcgit <-c commit | -r commit1~..commit2> [-R reviewer] " >&2 + echo " [-C subscriber] [-T testplan] [-n]" >&2 +} + +error() +{ + echo "$@" >&2 + usage + rm -f $phab_before $phab_after $arc_msg + exit 1 +} + +create_review() +{ + local commit phab_id arc_dir + unset phab_before phab_after arc_msg + commit=$1 + + phab_before=`mktemp -t arcoutput` + phab_after=`mktemp -t arcoutput` + echo "Create review for '`git show $commit -s --oneline`'" + + if [ -n "$dry_run" ] + then + return + fi + + git checkout $commit > /dev/null || error "Could not checkout $commit" + + arc_dir="$(git rev-parse --show-toplevel)/.git/arc" + arc_msg="$arc_dir/create-message" + mkdir -p $arc_dir + git show -s --format='%B' HEAD > $arc_msg + echo >> $arc_msg + echo "Test Plan:" >> $arc_msg + cat $test_plan >> $arc_msg + echo >> $arc_msg + echo "Reviewers:" >> $arc_msg + echo "$reviewers" >> $arc_msg + echo >> $arc_msg + echo "Subscribers:" >> $arc_msg + echo "$cc_list" >> $arc_msg + echo >> $arc_msg + + arc list > $phab_before + yes | env EDITOR=true arc diff --create --allow-untracked HEAD~ + arc list > $phab_after + + headline="$(git show $commit -s --format=%s)" + phab_id=`comm -13 "$phab_before" "$phab_after" | fgrep "$headline" \ + | egrep -o 'D[0-9]+:' | tr -d ':'` + + if [ -z "$phab_id" ] + then + error "Could not get review ID" + fi + + git branch review_${phab_id}_base HEAD~ + + git checkout -b review_$phab_id + cat - < /dev/null 2> /dev/null +then + error "Install devel/git first" +fi + +if ! type arc > /dev/null 2> /dev/null +then + error "Install devel/arcanist first" +fi + +git update-index -q --refresh +if ! git diff-index --quiet --cached HEAD +then + error "index is unclean" +fi + +if ! git diff-files --quiet +then + error "Working directory is unclean" +fi + +if git ls-files --other --error-unmatch . > /dev/null 2> /dev/null +then + error "Working directory contains untracked files" +fi + +# We have to do a git checkout in order to run arc, so save the original branch +# so that we can check it out again once we're done. +if ! orig_branch=$(git symbolic-ref --short -q HEAD) +then + orig_branch=$(git show -s --pretty='%H' HEAD) +fi + +git log --format=%H $range | tail -r | while read -r commit +do + create_review $commit < /dev/null +done + +# Note that due to the use of the pipeline above, the body of the while loop +# above runs in a subshell. If it exits with an error, execution resumes +# here rather than exiting the script, so we have to cache the right exit code +# and return it when we're done cleaning up. +code=$? + +git checkout $orig_branch + +exit $code + Added: head/tools/tools/git/importgit ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/git/importgit Thu Oct 20 18:23:44 2016 (r307680) @@ -0,0 +1,182 @@ +#!/bin/sh +# +# Copyright (c) 2015 Ryan Stone. 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$ + +usage() +{ + echo "Usage: importgit <-c commit | -r c1..c2> -g /path/to/git/repo [-n]" >&2 +} + +error() +{ + local print_usage + + if [ "$1" = "-u" ] + then + shift + print_usage=1 + else + print_usage= + fi + + echo "$@" >&2 + if [ -n "$print_usage" ] + then + usage + fi + exit 1 +} + +unset git range commit dry_run + +while getopts ":c:g:nr:" o +do + case "$o" in + c) + range="${OPTARG}~..${OPTARG}" + ;; + g) + git_repo=$OPTARG + ;; + n) + dry_run=1 + ;; + r) + range=$OPTARG + ;; + *) + error -u "Unrecognized argument '-$OPTARG'" + esac +done + +shift $((OPTIND - 1)) +OPTIND=1 + +if [ -n "$1" ] +then + error -u "Unrecognized argument $1" +fi + +if [ -z "$range" ] +then + error -u "-c or -r argument is mandatory" +fi + +if ! echo "$range" | egrep -qs '^[^.]+\.\.[^.]*$' +then + error -u "$range is not a range of commits. Did you mean '-c $range'?" +fi + +if [ -z "$git_repo" ] +then + error -u "-g argument is mandatory" +fi + +git="$git_repo/.git" + +if [ ! -d "$git" ] +then + error "$git_repo does not seem to be a git repo" +fi + +if ! type git > /dev/null 2> /dev/null +then + error "Install devel/git first" +fi + +if ! type svn > /dev/null 2> /dev/null +then + error "Install devel/subversion first" +fi + +if [ -n "$(svn status)" ] +then + error "Working tree is not clean" +fi + +if ! svn --non-interactive ls > /dev/null +then + error "Could not communicate with svn server. Is your ssh key loaded?" +fi + +git --git-dir=$git log --format=%H $range | tail -r | while read -r commit +do + echo "Applying `git --git-dir=$git show -s --oneline $commit`" + + if [ -n "$(git --git-dir=$git show --diff-filter=CDRTUXB $commit)" ] + then + error "Commit performed unsupported change (e.g. delete/rename)" + fi + + if [ "$(git --git-dir=$git show -s --format=%P $commit | wc -w)" -ne 1 ] + then + error "Cannot import merge commits" + fi + + git --git-dir=$git diff --diff-filter=A --name-only \ + ${commit}~..$commit | while read -r newfile + do + if [ -f "$newfile" ] + then + error "New file $newfile already exists in tree" + fi + done + + # The previous while loop ran in a subshell, so we have to check if it + # exited with an error and bail out if so. + ret=$? + if [ "$ret" -ne 0 ] + then + exit $ret + fi + + if [ -n "$dry_run" ] + then + continue + fi + + git --git-dir=$git show $commit | patch -p 1 -s || \ + error "Failed to apply patch" + + git --git-dir=$git diff --diff-filter=A --name-only \ + ${commit}~..$commit | while read -r newfile + do + svn add --parents --depth=infinity $newfile || \ + error "Failed to add new file" + done + + # The previous while loop ran in a subshell, so we have to check if it + # exited with an error and bail out if so. + ret=$? + if [ "$ret" -ne 0 ] + then + exit $ret + fi + + git --git-dir=$git show -s --format='%B' $commit | svn commit -F - || \ + error "Failed to commit" +done + From owner-svn-src-all@freebsd.org Thu Oct 20 18:28:06 2016 Return-Path: Delivered-To: svn-src-all@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 EEB54C19924; Thu, 20 Oct 2016 18:28:06 +0000 (UTC) (envelope-from rstone@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 A59CBA12; Thu, 20 Oct 2016 18:28:06 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KIS5XU032068; Thu, 20 Oct 2016 18:28:05 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KIS5Ak032067; Thu, 20 Oct 2016 18:28:05 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201610201828.u9KIS5Ak032067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 20 Oct 2016 18:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307681 - head/tools/tools/git X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 18:28:07 -0000 Author: rstone Date: Thu Oct 20 18:28:05 2016 New Revision: 307681 URL: https://svnweb.freebsd.org/changeset/base/307681 Log: Set the executable bit on arcgit and importgit Make it possible to run these scripts directly out of svn by setting the executable property on them. Modified: Directory Properties: head/tools/tools/git/arcgit (props changed) head/tools/tools/git/importgit (props changed) From owner-svn-src-all@freebsd.org Thu Oct 20 18:43:13 2016 Return-Path: Delivered-To: svn-src-all@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 E0770C19DE9; Thu, 20 Oct 2016 18:43:13 +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 AFC86131A; Thu, 20 Oct 2016 18:43:13 +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 u9KIhCbP039300; Thu, 20 Oct 2016 18:43:12 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KIhCft039299; Thu, 20 Oct 2016 18:43:12 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610201843.u9KIhCft039299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 20 Oct 2016 18:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307683 - head/gnu/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 18:43:14 -0000 Author: emaste Date: Thu Oct 20 18:43:12 2016 New Revision: 307683 URL: https://svnweb.freebsd.org/changeset/base/307683 Log: Correct typo in r307679: the variable is MK_GNU_GREP_COMPAT Modified: head/gnu/lib/Makefile Modified: head/gnu/lib/Makefile ============================================================================== --- head/gnu/lib/Makefile Thu Oct 20 18:38:37 2016 (r307682) +++ head/gnu/lib/Makefile Thu Oct 20 18:43:12 2016 (r307683) @@ -15,7 +15,7 @@ SUBDIR+= libreadline .endif .if ${MK_GNU_DIFF} != "no" || ${MK_GNU_GREP} != "no" || \ - ${GNU_GREP_COMPAT} != "no" || ${MK_GDB} != "no" + ${MK_GNU_GREP_COMPAT} != "no" || ${MK_GDB} != "no" SUBDIR+= libregex .endif From owner-svn-src-all@freebsd.org Thu Oct 20 19:42:27 2016 Return-Path: Delivered-To: svn-src-all@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 657ABC1A118; Thu, 20 Oct 2016 19:42:27 +0000 (UTC) (envelope-from ken@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 34A26D99; Thu, 20 Oct 2016 19:42:27 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KJgQPh062773; Thu, 20 Oct 2016 19:42:26 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KJgQOR062772; Thu, 20 Oct 2016 19:42:26 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201610201942.u9KJgQOR062772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 20 Oct 2016 19:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307684 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 19:42:27 -0000 Author: ken Date: Thu Oct 20 19:42:26 2016 New Revision: 307684 URL: https://svnweb.freebsd.org/changeset/base/307684 Log: For CCBs allocated on the stack, we need to clear the entire CCB, not just the header. Otherwise stack garbage can lead to random flags getting set. This showed up as 'camcontrol rescan all' failing with EINVAL because the address type wasn't CAM_DATA_VADDR. sbin/camcontrol/camcontrol.c: In rescan_or_reset_bus(), bzero the stack-allocated CCBs before use instead of clearing the body. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Thu Oct 20 18:43:12 2016 (r307683) +++ head/sbin/camcontrol/camcontrol.c Thu Oct 20 19:42:26 2016 (r307684) @@ -3139,6 +3139,8 @@ rescan_or_reset_bus(path_id_t bus, int r return(1); } + bzero(&ccb, sizeof(ccb)); + if (bus != CAM_BUS_WILDCARD) { ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS; ccb.ccb_h.path_id = bus; @@ -3181,7 +3183,7 @@ rescan_or_reset_bus(path_id_t bus, int r * no-op, sending a rescan to the xpt bus would result in a status of * CAM_REQ_INVALID. */ - CCB_CLEAR_ALL_EXCEPT_HDR(&matchccb.cdm); + bzero(&matchccb, sizeof(matchccb)); matchccb.ccb_h.func_code = XPT_DEV_MATCH; matchccb.ccb_h.path_id = CAM_BUS_WILDCARD; bufsize = sizeof(struct dev_match_result) * 20; From owner-svn-src-all@freebsd.org Thu Oct 20 19:55:51 2016 Return-Path: Delivered-To: svn-src-all@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 5FCA9C1A474; Thu, 20 Oct 2016 19:55:51 +0000 (UTC) (envelope-from mjg@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 31EA931B; Thu, 20 Oct 2016 19:55:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KJtonp067051; Thu, 20 Oct 2016 19:55:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KJtoGf067050; Thu, 20 Oct 2016 19:55:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201610201955.u9KJtoGf067050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 20 Oct 2016 19:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307685 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 19:55:51 -0000 Author: mjg Date: Thu Oct 20 19:55:50 2016 New Revision: 307685 URL: https://svnweb.freebsd.org/changeset/base/307685 Log: cache: fix up a corner case in r307650 If no negative entry is found on the last list, the ncp pointer will be left uninitialized and a non-null value will make the function assume an entry was found. Fix the problem by initializing to NULL on entry. Reported by: glebius Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Oct 20 19:42:26 2016 (r307684) +++ head/sys/kern/vfs_cache.c Thu Oct 20 19:55:50 2016 (r307685) @@ -763,6 +763,8 @@ cache_negative_shrink_select(int start, struct namecache *ncp; int i; + *ncpp = ncp = NULL; + for (i = start; i < numneglists; i++) { neglist = &neglists[i]; if (TAILQ_FIRST(&neglist->nl_list) == NULL) From owner-svn-src-all@freebsd.org Thu Oct 20 19:56:20 2016 Return-Path: Delivered-To: svn-src-all@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 82C10C1A4C7; Thu, 20 Oct 2016 19:56:20 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com [IPv6:2a00:1450:4010:c07::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B2706BE; Thu, 20 Oct 2016 19:56:20 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf0-x22c.google.com with SMTP id b75so99252392lfg.3; Thu, 20 Oct 2016 12:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rLfXp7+1AR2yXPyD7bpk5H/sp/IfJC/VKBy1K+VNmBM=; b=qMI2c/rTPBd6AQL6nIyZDFJjEIUrHyXpr35BohhuXYOczWEvmu/Ti8LAqVtti7CDh6 ovsvqwp1fcWxZ4LQfI1fA8HKp1TR0edafcs+chmVVIZVOiCdfsmvwKjaPVX8c/EXRBXn oYGUodrx2hFqLUFsxaRm1sfvvGv1BMcoLiq6QUPgmbmK4ueeGiqTVit34iIlyfRisLZO bD8WKuiTSeHo/sCqL8Ik+hTa86q1myvlOYS9CXKjPjCzfkSXgVQrzcjplnBvM0i9xa+M JfW5wH7uSlqIACm8wN6DLSCLNW86T/LBIl784iVMcjl/WZP448u0iHY6uQOoKW9Zg4fV XsBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rLfXp7+1AR2yXPyD7bpk5H/sp/IfJC/VKBy1K+VNmBM=; b=k1Kh/tv9ctC9kT/TRR0yc5L7BRfvojRhU6RwtHYuRwLbdBh87CZmvcovDFG+T0axg2 hSVrdYwKFPR7f/Q4wQD8JYo/r1dFofaG9GVj3SVc4X/HliD9JxuBTR1lZ4zTjhsSG7t+ bBZYzYLdUBR3iuG4kvIe0sRzll8rCLDu9jPdZhpsVUZMQgOq7BRD3sWZjUzd4oDmJzWI RnQBZYL/Mlsocl1yAggedgwHgzZkWShOhhnoWPaL6bNQHNZuKiQQzT/wAbDp6EIBUYax O+g50ZvdZoUBIoBiLW0t2iDJhPoCZ9mC3tfUb/gs8NiAJW2fK2Akb0cQDXJt5XwxL8LE 4LKw== X-Gm-Message-State: AA6/9RnljGRJeqAj+fWqjfjkwxL2RonrZydkn5ofommNrBsZD6vv6f6TjherZh1b+Pa9gw== X-Received: by 10.28.232.148 with SMTP id f20mr37322wmi.30.1476993377707; Thu, 20 Oct 2016 12:56:17 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by smtp.gmail.com with ESMTPSA id p3sm81173900wjr.31.2016.10.20.12.56.16 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 20 Oct 2016 12:56:17 -0700 (PDT) Date: Thu, 20 Oct 2016 21:56:15 +0200 From: Mateusz Guzik To: Gleb Smirnoff Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307650 - head/sys/kern Message-ID: <20161020195614.GA31016@dft-labs.eu> References: <201610191829.u9JITqhm081246@repo.freebsd.org> <20161019220942.GM27748@FreeBSD.org> <20161020115035.GA26990@dft-labs.eu> <20161020181827.GU27748@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161020181827.GU27748@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 19:56:20 -0000 On Thu, Oct 20, 2016 at 11:18:27AM -0700, Gleb Smirnoff wrote: > On Thu, Oct 20, 2016 at 01:50:35PM +0200, Mateusz Guzik wrote: > M> On Wed, Oct 19, 2016 at 03:09:42PM -0700, Gleb Smirnoff wrote: > M> > On Wed, Oct 19, 2016 at 06:29:52PM +0000, Mateusz Guzik wrote: > M> > M> Author: mjg > M> > M> Date: Wed Oct 19 18:29:52 2016 > M> > M> New Revision: 307650 > M> > M> URL: https://svnweb.freebsd.org/changeset/base/307650 > M> > M> > M> > M> Log: > M> > M> cache: split negative entry LRU into multiple lists > M> > M> > M> > M> This splits the ncneg_mtx lock while preserving the hit ratio at least > M> > M> during buildworld. > M> > M> > M> > M> Create N dedicated lists for new negative entries. > M> > M> > M> > M> Entries with at least one hit get promoted to the hot list, where they > M> > M> get requeued every M hits. > M> > M> > M> > M> Shrinking demotes one hot entry and performs a round-robin shrinking of > M> > M> regular lists. > M> > M> > M> > M> Reviewed by: kib > M> > > M> > This instapanics: > M> > > M> > panic: Assertion ncp->nc_flag & NCF_NEGATIVE failed at /usr/src/head/sys/kern/vfs_cache.c:815 > M> > > M> > M> It definitely works for me and I don't see how the condition can fail. > M> > M> Given the 'instapanic' note, I assume you can easily reproduce. Is this > M> a stock head kernel? > M> > M> Can you reproduce with; > > Trying to mount root from ufs:/dev/vtbd0p3 [rw]... > panic: cache_negative_zap_one: ncp 0xffffffff81012500 flag 0 dvp 0 vp 0 > Fixed in r307685. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Thu Oct 20 19:58:34 2016 Return-Path: Delivered-To: svn-src-all@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 712EAC1A607 for ; Thu, 20 Oct 2016 19:58:34 +0000 (UTC) (envelope-from 01000157e3ac7333-7f3a65f0-9ac8-40ba-a5e9-b88df9d4e042-000000@amazonses.com) Received: from a8-60.smtp-out.amazonses.com (a8-60.smtp-out.amazonses.com [54.240.8.60]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38661A0A for ; Thu, 20 Oct 2016 19:58:34 +0000 (UTC) (envelope-from 01000157e3ac7333-7f3a65f0-9ac8-40ba-a5e9-b88df9d4e042-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1476993512; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=6PE127d6tq3h716TBDFpuiKaoRhyaRTqC6r1lBH/B34=; b=ixJcCqJZ2CVNg4SOg1UYaU7BM8SE6p3go6XxpOpg7AIPaKIrgSgCfa9QqqcGi9Ak 5pNSXMpUL5O7DKU6+CX/WPL6nYYDnrrFZKotlLXOUUpDtRdTb0xfgCB+3SLJtrDoDYU oCw+t3BbPqxJ29RBX9OXFB0oXkAAUdlK/lu0lO8w= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1476993512; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=6PE127d6tq3h716TBDFpuiKaoRhyaRTqC6r1lBH/B34=; b=UzQTa025wpFaVOwAV0ndU55MaD32mVF0aaXISCpSMUMxvqc9IT+0CPWQNPCBUP6J GM6/akY6Zjs22J+yxSFGxedC9mNI0xCigMyeAhDZhftkHyVSNqyTE6hXDVXGsnNfdje 1gN7B8R7SRSrW8a6JjWqQ0AzHV7sPalgboaa94EA= Subject: Re: cvs commit: src/sys/sys _types.h resource.h To: Dag-Erling Smorgrav , src-committers@FreeBSD.org, "svn-src-all@freebsd.org" References: <200411081805.iA8I5hVK038813@repoman.freebsd.org> From: Colin Percival Message-ID: <01000157e3ac7333-7f3a65f0-9ac8-40ba-a5e9-b88df9d4e042-000000@email.amazonses.com> Date: Thu, 20 Oct 2016 19:58:32 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <200411081805.iA8I5hVK038813@repoman.freebsd.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2016.10.20-54.240.8.60 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 19:58:34 -0000 On 11/08/04 10:05, Dag-Erling Smorgrav wrote: > des 2004-11-08 18:05:43 UTC > > FreeBSD src repository > > Modified files: > sys/sys _types.h resource.h > Log: > Document why rlim_t needs to be a signed type. > Define RLIM_INFINITY as INT64_MAX instead of hand-rolling it. >From r137390: > -typedef __int64_t __rlim_t; /* resource limit (XXX not unsigned) */ > +typedef __int64_t __rlim_t; /* resource limit - intentionally */ > + /* signed, because of legacy code */ > + /* that uses -1 for RLIM_INFINITY */ Is it time to drop compatibility for code which was "legacy" 12 years ago in order to conform to the POSIX stipulation that rlim_t should be unsigned? -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@freebsd.org Thu Oct 20 20:12:35 2016 Return-Path: Delivered-To: svn-src-all@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 6D01EC1ADC9; Thu, 20 Oct 2016 20:12:35 +0000 (UTC) (envelope-from imp@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 3C8328AE; Thu, 20 Oct 2016 20:12:35 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KKCYfv074981; Thu, 20 Oct 2016 20:12:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KKCYJp074980; Thu, 20 Oct 2016 20:12:34 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201610202012.u9KKCYJp074980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 20 Oct 2016 20:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307686 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 20:12:35 -0000 Author: imp Date: Thu Oct 20 20:12:34 2016 New Revision: 307686 URL: https://svnweb.freebsd.org/changeset/base/307686 Log: Use MACHINE_ARCH rather than TARGET_ARCH which has no meaning outside of Makefile.inc1 Modified: head/sys/conf/Makefile.arm Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Thu Oct 20 19:55:50 2016 (r307685) +++ head/sys/conf/Makefile.arm Thu Oct 20 20:12:34 2016 (r307686) @@ -74,7 +74,7 @@ FILES_CPU_FUNC = \ $S/$M/$M/cpufunc_asm_pj4b.S $S/$M/$M/cpufunc_asm_armv6.S \ $S/$M/$M/cpufunc_asm_armv7.S -.if ${TARGET_ARCH} != "armv6" && defined(KERNPHYSADDR) +.if ${MACHINE_ARCH} != "armv6" && defined(KERNPHYSADDR) KERNEL_EXTRA=trampoline KERNEL_EXTRA_INSTALL=kernel.gz.tramp trampoline: ${KERNEL_KO}.tramp From owner-svn-src-all@freebsd.org Thu Oct 20 20:16:11 2016 Return-Path: Delivered-To: svn-src-all@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 A5FF0C1AE95; Thu, 20 Oct 2016 20:16:11 +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 76218A6E; Thu, 20 Oct 2016 20:16:11 +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 u9KKGAoi075158; Thu, 20 Oct 2016 20:16:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KKGAbE075157; Thu, 20 Oct 2016 20:16:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610202016.u9KKGAbE075157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 20 Oct 2016 20:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307687 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 20:16:11 -0000 Author: emaste Date: Thu Oct 20 20:16:10 2016 New Revision: 307687 URL: https://svnweb.freebsd.org/changeset/base/307687 Log: arch.7: correct typo in predefined macro example The example incorrectly used -Dm, which defines macro m with value 1. It is supposed to be -dM, which lists macros. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Oct 20 20:12:34 2016 (r307686) +++ head/share/man/man7/arch.7 Thu Oct 20 20:16:10 2016 (r307687) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2016 +.Dd October 20, 2016 .Dt ARCH 7 .Os .Sh NAME @@ -130,7 +130,7 @@ included here. .Pp The full set of predefined macros can be obtained with this command: .Bd -literal -offset indent -cc -x c -Dm -E /dev/null +cc -x c -dM -E /dev/null .Ed .Pp Common type size and endianness macros: From owner-svn-src-all@freebsd.org Thu Oct 20 20:29:56 2016 Return-Path: Delivered-To: svn-src-all@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 1FE9CC1B416; Thu, 20 Oct 2016 20:29:56 +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 E5D53370; Thu, 20 Oct 2016 20:29:55 +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 u9KKTtDT079125; Thu, 20 Oct 2016 20:29:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KKTtCm079124; Thu, 20 Oct 2016 20:29:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610202029.u9KKTtCm079124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 20 Oct 2016 20:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307688 - head/sys/compat/ia32 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 20:29:56 -0000 Author: emaste Date: Thu Oct 20 20:29:54 2016 New Revision: 307688 URL: https://svnweb.freebsd.org/changeset/base/307688 Log: Tidy up ia32_sysvec sv_flags setting Use the same approach as sys/arm/arm/elf_machdep.c to avoid an odd- looking , on a separate line. Modified: head/sys/compat/ia32/ia32_sysvec.c Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Thu Oct 20 20:16:10 2016 (r307687) +++ head/sys/compat/ia32/ia32_sysvec.c Thu Oct 20 20:29:54 2016 (r307688) @@ -120,13 +120,11 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_setregs = ia32_setregs, .sv_fixlimit = ia32_fixlimit, .sv_maxssiz = &ia32_maxssiz, - .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 | + .sv_flags = #ifdef __amd64__ - SV_SHP | SV_TIMEKEEP -#else - 0 + SV_SHP | SV_TIMEKEEP | #endif - , + SV_ABI_FREEBSD | SV_IA32 | SV_ILP32, .sv_set_syscall_retval = ia32_set_syscall_retval, .sv_fetch_syscall_args = ia32_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, From owner-svn-src-all@freebsd.org Thu Oct 20 21:12:51 2016 Return-Path: Delivered-To: svn-src-all@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 E590AC1A1B6; Thu, 20 Oct 2016 21:12:51 +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 B3F06997; Thu, 20 Oct 2016 21:12:51 +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 u9KLCovq098604; Thu, 20 Oct 2016 21:12:50 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KLCoYR098603; Thu, 20 Oct 2016 21:12:50 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610202112.u9KLCoYR098603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 20 Oct 2016 21:12:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307689 - head/gnu/lib/libgcc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 21:12:52 -0000 Author: bapt Date: Thu Oct 20 21:12:50 2016 New Revision: 307689 URL: https://svnweb.freebsd.org/changeset/base/307689 Log: Fix building of llvm's unwind if gcc has been also built when building gcc an unwind.h header is generate in the cc_tool directory which is included in the CFLAGS before the path where the llvm's unwind.h file lives Reviewed by: emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7357 Modified: head/gnu/lib/libgcc/Makefile Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Thu Oct 20 20:29:54 2016 (r307688) +++ head/gnu/lib/libgcc/Makefile Thu Oct 20 21:12:50 2016 (r307689) @@ -30,8 +30,7 @@ CFLAGS+= -DTARGET_ARM_EABI CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ -DHAVE_GTHR_DEFAULT \ -I${GCCLIB}/include \ - -I${GCCDIR}/config -I${GCCDIR} -I. \ - -I${CCDIR}/cc_tools + -I${GCCDIR}/config -I${GCCDIR} -I. LDFLAGS+= -nodefaultlibs LIBADD+= c @@ -102,6 +101,12 @@ CFLAGS+= -I${SRCTOP}/contrib/libc++/incl .else # MK_LLVM_LIBUNWIND +# +# Prevent the potential unwind.h from gcc (generated) +# to be in the include path before the one from llvm unwind +# +CFLAGS+= -I${CCDIR}/cc_tools + .if ${TARGET_CPUARCH} == "arm" LIB2ADDEH = unwind-arm.c libunwind-arm.S pr-support.c unwind-c.c .else From owner-svn-src-all@freebsd.org Thu Oct 20 21:30:00 2016 Return-Path: Delivered-To: svn-src-all@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 83D66C1A899; Thu, 20 Oct 2016 21:30:00 +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 51DE576C; Thu, 20 Oct 2016 21:30:00 +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 u9KLTx91002807; Thu, 20 Oct 2016 21:29:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KLTxcu002806; Thu, 20 Oct 2016 21:29:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610202129.u9KLTxcu002806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 20 Oct 2016 21:29:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307690 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 21:30:00 -0000 Author: emaste Date: Thu Oct 20 21:29:59 2016 New Revision: 307690 URL: https://svnweb.freebsd.org/changeset/base/307690 Log: Don't build libssp as a prereq lib if WITHOUT_SSP is set Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D8301 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Oct 20 21:12:50 2016 (r307689) +++ head/Makefile.inc1 Thu Oct 20 21:29:59 2016 (r307690) @@ -1983,7 +1983,10 @@ libraries: .MAKE .PHONY # # static libgcc.a prerequisite for shared libc # -_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt +_prereq_libs= gnu/lib/libgcc lib/libcompiler_rt +.if ${MK_SSP} != "no" +_prereq_libs+= gnu/lib/libssp/libssp_nonshared +.endif # These dependencies are not automatically generated: # From owner-svn-src-all@freebsd.org Thu Oct 20 22:00:59 2016 Return-Path: Delivered-To: svn-src-all@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 5B7B1C1B0A5; Thu, 20 Oct 2016 22:00:59 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 29BB4A26; Thu, 20 Oct 2016 22:00:59 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id A5C35272C; Fri, 21 Oct 2016 00:00:47 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 9A59028494; Fri, 21 Oct 2016 00:00:47 +0200 (CEST) Date: Fri, 21 Oct 2016 00:00:47 +0200 From: Jilles Tjoelker To: Warner Losh Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r307469 - head/etc Message-ID: <20161020220047.GA68806@stack.nl> References: <201610170407.u9H47D5n033011@repo.freebsd.org> <20161019202656.GA58917@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 22:00:59 -0000 On Wed, Oct 19, 2016 at 04:45:21PM -0600, Warner Losh wrote: > What missing quotes? It seemed to work find on the system I brought up... In ${root_rw_mount#[Yy][Ee][Ss]} with root_rw_mount=YES, the substring operation results in an empty string, which is removed because there are no quotes. This makes the test expression invalid. The result, with /firstboot existing, is two messages "[: =: unexpected operator" and an attempt to mount / read-only. > I didn't do the case statement because it would be three extra big > useless syntactical boogers in the code :) Fair enough. > I do like the idea of using checkyesno. It probably makes sense to change etc/rc.d/root to use checkyesno. This ensures behaviour with invalid values is exactly the same. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Thu Oct 20 23:02:31 2016 Return-Path: Delivered-To: svn-src-all@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 71C38C1BD56; Thu, 20 Oct 2016 23:02:31 +0000 (UTC) (envelope-from markj@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 41FDF97B; Thu, 20 Oct 2016 23:02:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KN2URT040505; Thu, 20 Oct 2016 23:02:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KN2UIF040504; Thu, 20 Oct 2016 23:02:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610202302.u9KN2UIF040504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 20 Oct 2016 23:02:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307691 - head/sys/geom/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 23:02:31 -0000 Author: markj Date: Thu Oct 20 23:02:30 2016 New Revision: 307691 URL: https://svnweb.freebsd.org/changeset/base/307691 Log: gmirror: Release pending regular requests when synchronization stops. Normally gmirror allows colliding requests to proceed whenever a synchronization request completes and advances to the next offset. However if an I/O request collides with one of the final g_mirror_syncreqs, nothing releases it once synchronization completes, resulting in an apparent I/O hang. The same problem can occur if synchronization is aborted by an I/O error. Therefore, be sure to requeue pending requests when mirror synchronization is stopped for any reason. While here, remove some dead code from g_mirror_regular_release(). MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Thu Oct 20 21:29:59 2016 (r307690) +++ head/sys/geom/mirror/g_mirror.c Thu Oct 20 23:02:30 2016 (r307691) @@ -1252,13 +1252,6 @@ g_mirror_regular_release(struct g_mirror G_MIRROR_LOGREQ(2, bp, "Releasing delayed request (%p).", bp); mtx_lock(&sc->sc_queue_mtx); bioq_insert_head(&sc->sc_queue, bp); -#if 0 - /* - * wakeup() is not needed, because this function is called from - * the worker thread. - */ - wakeup(&sc->sc_queue); -#endif mtx_unlock(&sc->sc_queue_mtx); } } @@ -2065,6 +2058,7 @@ g_mirror_sync_stop(struct g_mirror_disk G_MIRROR_DEBUG(0, "Device %s: rebuilding provider %s stopped.", sc->sc_name, g_mirror_get_diskname(disk)); } + g_mirror_regular_release(sc); free(disk->d_sync.ds_bios, M_MIRROR); disk->d_sync.ds_bios = NULL; cp = disk->d_sync.ds_consumer; From owner-svn-src-all@freebsd.org Thu Oct 20 23:08:41 2016 Return-Path: Delivered-To: svn-src-all@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 CC639C1BE12; Thu, 20 Oct 2016 23:08:41 +0000 (UTC) (envelope-from markj@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 82653B54; Thu, 20 Oct 2016 23:08:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KN8efr040747; Thu, 20 Oct 2016 23:08:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KN8esF040746; Thu, 20 Oct 2016 23:08:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610202308.u9KN8esF040746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 20 Oct 2016 23:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307692 - head/sys/geom/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 23:08:41 -0000 Author: markj Date: Thu Oct 20 23:08:40 2016 New Revision: 307692 URL: https://svnweb.freebsd.org/changeset/base/307692 Log: gmirror: Add a subroutine to free synchronization BIOs. This addresses a memory leak that occurs upon an I/O error during a mirror synchronization. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Thu Oct 20 23:02:30 2016 (r307691) +++ head/sys/geom/mirror/g_mirror.c Thu Oct 20 23:08:40 2016 (r307692) @@ -1276,6 +1276,22 @@ g_mirror_sync_release(struct g_mirror_so } /* + * Free a synchronization request and clear its slot in the array. + */ +static void +g_mirror_sync_request_free(struct g_mirror_disk *disk, struct bio *bp) +{ + int i; + + if (disk != NULL && disk->d_sync.ds_bios != NULL) { + i = (int)(uintptr_t)bp->bio_caller1; + disk->d_sync.ds_bios[i] = NULL; + } + free(bp->bio_data, M_MIRROR); + g_destroy_bio(bp); +} + +/* * Handle synchronization requests. * Every synchronization request is two-steps process: first, READ request is * send to active provider and then WRITE request (with read data) to the provider @@ -1287,6 +1303,7 @@ g_mirror_sync_request(struct bio *bp) { struct g_mirror_softc *sc; struct g_mirror_disk *disk; + struct g_mirror_disk_sync *sync; bp->bio_from->index--; sc = bp->bio_from->geom->softc; @@ -1296,8 +1313,7 @@ g_mirror_sync_request(struct bio *bp) g_topology_lock(); g_mirror_kill_consumer(sc, bp->bio_from); g_topology_unlock(); - free(bp->bio_data, M_MIRROR); - g_destroy_bio(bp); + g_mirror_sync_request_free(NULL, bp); sx_xlock(&sc->sc_lock); return; } @@ -1317,7 +1333,7 @@ g_mirror_sync_request(struct bio *bp) G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", bp->bio_error); - g_destroy_bio(bp); + g_mirror_sync_request_free(disk, bp); return; } G_MIRROR_LOGREQ(3, bp, @@ -1334,7 +1350,6 @@ g_mirror_sync_request(struct bio *bp) } case BIO_WRITE: { - struct g_mirror_disk_sync *sync; off_t offset; void *data; int i; @@ -1346,7 +1361,7 @@ g_mirror_sync_request(struct bio *bp) G_MIRROR_LOGREQ(0, bp, "Synchronization request failed (error=%d).", bp->bio_error); - g_destroy_bio(bp); + g_mirror_sync_request_free(disk, bp); sc->sc_bump_id |= G_MIRROR_BUMP_GENID; g_mirror_event_send(disk, G_MIRROR_DISK_STATE_DISCONNECTED, @@ -1360,12 +1375,7 @@ g_mirror_sync_request(struct bio *bp) (sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) { /* Don't send more synchronization requests. */ sync->ds_inflight--; - if (sync->ds_bios != NULL) { - i = (int)(uintptr_t)bp->bio_caller1; - sync->ds_bios[i] = NULL; - } - free(bp->bio_data, M_MIRROR); - g_destroy_bio(bp); + g_mirror_sync_request_free(disk, bp); if (sync->ds_inflight > 0) return; if (sync->ds_consumer == NULL || From owner-svn-src-all@freebsd.org Thu Oct 20 23:10:28 2016 Return-Path: Delivered-To: svn-src-all@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 B7752C1BE7E; Thu, 20 Oct 2016 23:10:28 +0000 (UTC) (envelope-from markj@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 87370CDC; Thu, 20 Oct 2016 23:10:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9KNAR0h040865; Thu, 20 Oct 2016 23:10:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KNAR1c040864; Thu, 20 Oct 2016 23:10:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610202310.u9KNAR1c040864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 20 Oct 2016 23:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307693 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 23:10:28 -0000 Author: markj Date: Thu Oct 20 23:10:27 2016 New Revision: 307693 URL: https://svnweb.freebsd.org/changeset/base/307693 Log: Simplify keg_drain() a bit by using LIST_FOREACH_SAFE. MFC after: 1 week Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Thu Oct 20 23:08:40 2016 (r307692) +++ head/sys/vm/uma_core.c Thu Oct 20 23:10:27 2016 (r307693) @@ -845,8 +845,7 @@ static void keg_drain(uma_keg_t keg) { struct slabhead freeslabs = { 0 }; - uma_slab_t slab; - uma_slab_t n; + uma_slab_t slab, tmp; /* * We don't want to take pages from statically allocated kegs at this @@ -862,15 +861,10 @@ keg_drain(uma_keg_t keg) if (keg->uk_free == 0) goto finished; - slab = LIST_FIRST(&keg->uk_free_slab); - while (slab) { - n = LIST_NEXT(slab, us_link); - - /* We have no where to free these to */ - if (slab->us_flags & UMA_SLAB_BOOT) { - slab = n; + LIST_FOREACH_SAFE(slab, &keg->uk_free_slab, us_link, tmp) { + /* We have nowhere to free these to. */ + if (slab->us_flags & UMA_SLAB_BOOT) continue; - } LIST_REMOVE(slab, us_link); keg->uk_pages -= keg->uk_ppera; @@ -880,8 +874,6 @@ keg_drain(uma_keg_t keg) UMA_HASH_REMOVE(&keg->uk_hash, slab, slab->us_data); SLIST_INSERT_HEAD(&freeslabs, slab, us_hlink); - - slab = n; } finished: KEG_UNLOCK(keg); From owner-svn-src-all@freebsd.org Thu Oct 20 23:39:18 2016 Return-Path: Delivered-To: svn-src-all@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 3B074C164C8; Thu, 20 Oct 2016 23:39:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BC0BD8B; Thu, 20 Oct 2016 23:39:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id BE55010AF88; Thu, 20 Oct 2016 19:39:16 -0400 (EDT) From: John Baldwin To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307688 - head/sys/compat/ia32 Date: Thu, 20 Oct 2016 15:10:43 -0700 Message-ID: <7756932.Sd4ZDxVN79@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201610202029.u9KKTtCm079124@repo.freebsd.org> References: <201610202029.u9KKTtCm079124@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 20 Oct 2016 19:39:16 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 23:39:18 -0000 On Thursday, October 20, 2016 08:29:55 PM Ed Maste wrote: > Author: emaste > Date: Thu Oct 20 20:29:54 2016 > New Revision: 307688 > URL: https://svnweb.freebsd.org/changeset/base/307688 > > Log: > Tidy up ia32_sysvec sv_flags setting > > Use the same approach as sys/arm/arm/elf_machdep.c to avoid an odd- > looking , on a separate line. This #ifdef is dubious as compat/ia32 is amd64-only at this point now that ia64 is gone. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Oct 20 23:53:17 2016 Return-Path: Delivered-To: svn-src-all@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 E53DAC16923; Thu, 20 Oct 2016 23:53:17 +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 9D129691; Thu, 20 Oct 2016 23:53:17 +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 u9KNrGY7059895; Thu, 20 Oct 2016 23:53:16 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9KNrGJ5059894; Thu, 20 Oct 2016 23:53:16 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201610202353.u9KNrGJ5059894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 20 Oct 2016 23:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307694 - head/sys/fs/nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 23:53:18 -0000 Author: rmacklem Date: Thu Oct 20 23:53:16 2016 New Revision: 307694 URL: https://svnweb.freebsd.org/changeset/base/307694 Log: A problem w.r.t. interoperation between the FreeBSD NFSv4.1 server with delegations enabled and the Linux NFSv4.1 client was reported in reviews.freebsd.org/D7891. I believe that the FreeBSD server behaviour conforms to the RFC and that the Linux client has a bug. Therefore, I do not think the proposed patch is appropriate. When nfsrv_writedelegifpos is non-zero, the FreeBSD server will issue a write delegation for a read open if possible. The Linux client then erroneously assumes that the credentials used for the read open can write the file. This patch reverses the default value for nfsrv_writedelegifpos to 0 so that the default behaviour is Linux compatible and adds a sysctl that can be used to set nfsrv_writedelegifpos. This change should only affect users that are mounting a FreeBSD server with delegations enabled (they are not enabled by default) with a Linux NFSv4.1 client mount. Reported by: fatih.acar@gandi.net Tested by: fatih.acar@gandi.net MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D7891 Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Thu Oct 20 23:10:27 2016 (r307693) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Thu Oct 20 23:53:16 2016 (r307694) @@ -70,6 +70,11 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, v4statel &nfsrv_v4statelimit, 0, "High water limit for NFSv4 opens+locks+delegations"); +static int nfsrv_writedelegifpos = 0; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, writedelegifpos, CTLFLAG_RW, + &nfsrv_writedelegifpos, 0, + "Issue a write delegation for read opens if possible"); + /* * Hash lists for nfs V4. */ @@ -80,7 +85,6 @@ struct nfssessionhash *nfssessionhash; static u_int32_t nfsrv_openpluslock = 0, nfsrv_delegatecnt = 0; static time_t nfsrvboottime; -static int nfsrv_writedelegifpos = 1; static int nfsrv_returnoldstateid = 0, nfsrv_clients = 0; static int nfsrv_clienthighwater = NFSRV_CLIENTHIGHWATER; static int nfsrv_nogsscallback = 0; From owner-svn-src-all@freebsd.org Fri Oct 21 02:07:05 2016 Return-Path: Delivered-To: svn-src-all@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 17C76C112ED; Fri, 21 Oct 2016 02:07:05 +0000 (UTC) (envelope-from jhibbits@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 DDA36C04; Fri, 21 Oct 2016 02:07:04 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L274L3009448; Fri, 21 Oct 2016 02:07:04 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L274Fl009447; Fri, 21 Oct 2016 02:07:04 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610210207.u9L274Fl009447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 21 Oct 2016 02:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307695 - head/sys/dev/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 02:07:05 -0000 Author: jhibbits Date: Fri Oct 21 02:07:03 2016 New Revision: 307695 URL: https://svnweb.freebsd.org/changeset/base/307695 Log: Remove an unnecessary debug printf. Modified: head/sys/dev/dpaa/bman.c Modified: head/sys/dev/dpaa/bman.c ============================================================================== --- head/sys/dev/dpaa/bman.c Thu Oct 20 23:53:16 2016 (r307694) +++ head/sys/dev/dpaa/bman.c Fri Oct 21 02:07:03 2016 (r307695) @@ -117,7 +117,6 @@ bman_attach(device_t dev) bp.errIrq = (uintptr_t)sc->sc_ires; bp.partBpidBase = 0; bp.partNumOfPools = BM_MAX_NUM_OF_POOLS; - printf("base address: %llx\n", (uint64_t)bp.baseAddress); sc->sc_bh = BM_Config(&bp); if (sc->sc_bh == NULL) From owner-svn-src-all@freebsd.org Fri Oct 21 02:16:13 2016 Return-Path: Delivered-To: svn-src-all@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 E5F3EC11691; Fri, 21 Oct 2016 02:16:13 +0000 (UTC) (envelope-from jhibbits@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 ADD301D2; Fri, 21 Oct 2016 02:16:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L2GCJ5013224; Fri, 21 Oct 2016 02:16:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L2GCGt013216; Fri, 21 Oct 2016 02:16:12 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610210216.u9L2GCGt013216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 21 Oct 2016 02:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307696 - in head/sys: dev/dpaa powerpc/conf/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 02:16:14 -0000 Author: jhibbits Date: Fri Oct 21 02:16:11 2016 New Revision: 307696 URL: https://svnweb.freebsd.org/changeset/base/307696 Log: Remove a hack requiring dtsec0 to always be enabled for mdio. Instead replace it with a different hack, that turns fman into a simplebus subclass, and maps its children within its address space. Since all PHY communication is done through dtsec0's mdio space, the FDT contains a reference to the dtsec0 mdio handle in all nodes that need it. Instead of using Freescale's implementation for MII access, use our own (copied loosely from the eTSEC driver, and could possibly be merged eventually). This lets us access the registers directly rather than needing a full dtsec interface just to access the registers. Future directions will include turning fman into more of a simplebus, and not mapping the region and playing games. This will require changes to the dtsec driver to make it a child of fman, and possibly other drivers as well. Added: head/sys/dev/dpaa/fman_mdio.c (contents, props changed) Modified: head/sys/dev/dpaa/fman.c head/sys/dev/dpaa/fman.h head/sys/dev/dpaa/fman_fdt.c head/sys/dev/dpaa/if_dtsec.c head/sys/dev/dpaa/if_dtsec.h head/sys/dev/dpaa/if_dtsec_fdt.c head/sys/powerpc/conf/dpaa/files.dpaa Modified: head/sys/dev/dpaa/fman.c ============================================================================== --- head/sys/dev/dpaa/fman.c Fri Oct 21 02:07:03 2016 (r307695) +++ head/sys/dev/dpaa/fman.c Fri Oct 21 02:16:11 2016 (r307696) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -88,6 +89,8 @@ static struct fman_softc *fm_sc = NULL; static t_Handle fman_init(struct fman_softc *sc, struct fman_config *cfg) { + struct ofw_bus_devinfo obd; + phandle_t node; t_FmParams fm_params; t_Handle muram_handle, fm_handle; t_Error error; @@ -158,6 +161,16 @@ fman_init(struct fman_softc *sc, struct device_printf(cfg->fman_device, "Hardware version: %d.%d.\n", revision_info.majorRev, revision_info.minorRev); + /* Initialize the simplebus part of things */ + simplebus_init(sc->sc_base.dev, 0); + + node = ofw_bus_get_node(sc->sc_base.dev); + for (node = OF_child(node); node > 0; node = OF_peer(node)) { + if (ofw_bus_gen_setup_devinfo(&obd, node) != 0) + continue; + simplebus_add_device(sc->sc_base.dev, node, 0, NULL, -1, NULL); + } + return (fm_handle); err2: @@ -173,7 +186,7 @@ fman_exception_callback(t_Handle app_han struct fman_softc *sc; sc = app_handle; - device_printf(sc->dev, "FMan exception occurred.\n"); + device_printf(sc->sc_base.dev, "FMan exception occurred.\n"); } static void @@ -183,7 +196,7 @@ fman_error_callback(t_Handle app_handle, struct fman_softc *sc; sc = app_handle; - device_printf(sc->dev, "FMan error occurred.\n"); + device_printf(sc->sc_base.dev, "FMan error occurred.\n"); } /** @} */ @@ -230,13 +243,25 @@ fman_get_bushandle(vm_offset_t *fm_base) } int +fman_get_dev(device_t *fm_dev) +{ + + if (fm_sc == NULL) + return (ENOMEM); + + *fm_dev = fm_sc->sc_base.dev; + + return (0); +} + +int fman_attach(device_t dev) { struct fman_softc *sc; struct fman_config cfg; sc = device_get_softc(dev); - sc->dev = dev; + sc->sc_base.dev = dev; fm_sc = sc; /* Check if MallocSmart allocator is ready */ @@ -249,7 +274,7 @@ fman_attach(device_t dev) sc->mem_rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (!sc->mem_res) { device_printf(dev, "could not allocate memory.\n"); return (ENXIO); Modified: head/sys/dev/dpaa/fman.h ============================================================================== --- head/sys/dev/dpaa/fman.h Fri Oct 21 02:07:03 2016 (r307695) +++ head/sys/dev/dpaa/fman.h Fri Oct 21 02:16:11 2016 (r307696) @@ -29,11 +29,13 @@ #ifndef FMAN_H_ #define FMAN_H_ +#include + /** * FMan driver instance data. */ struct fman_softc { - device_t dev; + struct simplebus_softc sc_base; struct resource *mem_res; struct resource *irq_res; struct resource *err_irq_res; @@ -63,5 +65,6 @@ uint32_t fman_get_clock(struct fman_soft int fman_get_handle(t_Handle *fmh); int fman_get_muram_handle(t_Handle *muramh); int fman_get_bushandle(vm_offset_t *fm_base); +int fman_get_dev(device_t *fmd); #endif /* FMAN_H_ */ Modified: head/sys/dev/dpaa/fman_fdt.c ============================================================================== --- head/sys/dev/dpaa/fman_fdt.c Fri Oct 21 02:07:03 2016 (r307695) +++ head/sys/dev/dpaa/fman_fdt.c Fri Oct 21 02:16:11 2016 (r307696) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -58,12 +59,8 @@ static device_method_t fman_methods[] = { 0, 0 } }; -static driver_t fman_driver = { - "fman", - fman_methods, - sizeof(struct fman_softc), -}; - +DEFINE_CLASS_1(fman, fman_driver, fman_methods, + sizeof(struct fman_softc), simplebus_driver); static devclass_t fman_devclass; EARLY_DRIVER_MODULE(fman, simplebus, fman_driver, fman_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); @@ -88,7 +85,7 @@ fman_get_clock(struct fman_softc *sc) phandle_t node; pcell_t fman_clock; - dev = sc->dev; + dev = sc->sc_base.dev; node = ofw_bus_get_node(dev); if ((OF_getprop(node, "clock-frequency", &fman_clock, Added: head/sys/dev/dpaa/fman_mdio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/dpaa/fman_mdio.c Fri Oct 21 02:16:11 2016 (r307696) @@ -0,0 +1,211 @@ +/*- + * Copyright (c) 2016 Justin Hibbits + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include "fman.h" +#include "miibus_if.h" + +#define MDIO_LOCK() mtx_lock(&sc->sc_lock) +#define MDIO_UNLOCK() mtx_unlock(&sc->sc_lock) +#define MDIO_WRITE4(sc,r,v) \ + bus_space_write_4(&bs_be_tag, sc->sc_handle, sc->sc_offset + r, v) +#define MDIO_READ4(sc, r) \ + bus_space_read_4(&bs_be_tag, sc->sc_handle, sc->sc_offset + r) + +#define MDIO_MIIMCFG 0x0 +#define MDIO_MIIMCOM 0x4 +#define MIIMCOM_SCAN_CYCLE 0x00000002 +#define MIIMCOM_READ_CYCLE 0x00000001 +#define MDIO_MIIMADD 0x8 +#define MDIO_MIIMCON 0xc +#define MDIO_MIIMSTAT 0x10 +#define MDIO_MIIMIND 0x14 +#define MIIMIND_BUSY 0x1 + +static int pqmdio_fdt_probe(device_t dev); +static int pqmdio_fdt_attach(device_t dev); +static int pqmdio_detach(device_t dev); +static int pqmdio_miibus_readreg(device_t dev, int phy, int reg); +static int pqmdio_miibus_writereg(device_t dev, int phy, int reg, int value); + +struct pqmdio_softc { + struct mtx sc_lock; + bus_space_handle_t sc_handle; + int sc_offset; +}; + +static device_method_t pqmdio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, pqmdio_fdt_probe), + DEVMETHOD(device_attach, pqmdio_fdt_attach), + DEVMETHOD(device_detach, pqmdio_detach), + + /* MII interface */ + DEVMETHOD(miibus_readreg, pqmdio_miibus_readreg), + DEVMETHOD(miibus_writereg, pqmdio_miibus_writereg), + + { 0, 0 } +}; + +static struct ofw_compat_data mdio_compat_data[] = { + {"fsl,fman-mdio", 0}, + {NULL, 0} +}; + +static driver_t pqmdio_driver = { + "pq_mdio", + pqmdio_methods, + sizeof(struct pqmdio_softc), +}; + +static int +pqmdio_fdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, mdio_compat_data)->ocd_str) + return (ENXIO); + + device_set_desc(dev, "Freescale QorIQ MDIO"); + + return (BUS_PROBE_DEFAULT); +} + +static int +pqmdio_fdt_attach(device_t dev) +{ + struct pqmdio_softc *sc; + rman_res_t start, count; + + sc = device_get_softc(dev); + + fman_get_bushandle(&sc->sc_handle); + bus_get_resource(dev, SYS_RES_MEMORY, 0, &start, &count); + sc->sc_offset = start; + + mtx_init(&sc->sc_lock, device_get_nameunit(dev), "QorIQ MDIO lock", + MTX_DEF); + + return (0); +} + +static int +pqmdio_detach(device_t dev) +{ + struct pqmdio_softc *sc; + + sc = device_get_softc(dev); + + mtx_destroy(&sc->sc_lock); + + return (0); +} + +int +pqmdio_miibus_readreg(device_t dev, int phy, int reg) +{ + struct pqmdio_softc *sc; + int rv; + + sc = device_get_softc(dev); + + MDIO_LOCK(); + + MDIO_WRITE4(sc, MDIO_MIIMADD, (phy << 8) | reg); + MDIO_WRITE4(sc, MDIO_MIIMCOM, MIIMCOM_READ_CYCLE); + + MDIO_READ4(sc, MDIO_MIIMCOM); + + while ((MDIO_READ4(sc, MDIO_MIIMIND)) & MIIMIND_BUSY) + ; + + rv = MDIO_READ4(sc, MDIO_MIIMSTAT); + + MDIO_WRITE4(sc, MDIO_MIIMCOM, 0); + MDIO_READ4(sc, MDIO_MIIMCOM); + MDIO_UNLOCK(); + + return (rv); +} + +int +pqmdio_miibus_writereg(device_t dev, int phy, int reg, int value) +{ + struct pqmdio_softc *sc; + + sc = device_get_softc(dev); + + MDIO_LOCK(); + /* Stop the MII management read cycle */ + MDIO_WRITE4(sc, MDIO_MIIMCOM, 0); + MDIO_READ4(sc, MDIO_MIIMCOM); + + MDIO_WRITE4(sc, MDIO_MIIMADD, (phy << 8) | reg); + + MDIO_WRITE4(sc, MDIO_MIIMCON, value); + MDIO_READ4(sc, MDIO_MIIMCON); + + /* Wait till MII management write is complete */ + while ((MDIO_READ4(sc, MDIO_MIIMIND)) & MIIMIND_BUSY) + ; + MDIO_UNLOCK(); + + return (0); +} + +static devclass_t pqmdio_devclass; +DRIVER_MODULE(pqmdio, fman, pqmdio_driver, pqmdio_devclass, 0, 0); +DRIVER_MODULE(miibus, pqmdio, miibus_driver, miibus_devclass, 0, 0); +MODULE_DEPEND(pqmdio, miibus, 1, 1, 1); + Modified: head/sys/dev/dpaa/if_dtsec.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec.c Fri Oct 21 02:07:03 2016 (r307695) +++ head/sys/dev/dpaa/if_dtsec.c Fri Oct 21 02:16:11 2016 (r307696) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -79,13 +80,6 @@ struct dtsec_fm_mac_ex_str { const int num; const char *str; }; - -/* XXX: Handle to FM_MAC instance of dTSEC0 */ -/* From QorIQ Data Path Acceleration Architecture Reference Manual, Rev 2, page - * 3-37, "The MII management hardware is shared by all dTSECs... only through - * the MIIM registers of dTSEC1 can external PHY's be accessed and configured." - */ -static t_Handle dtsec_mdio_mac_handle; /** @} */ @@ -205,8 +199,6 @@ dtsec_fm_mac_init(struct dtsec_softc *sc params.h_Fm = sc->sc_fmh; sc->sc_mach = FM_MAC_Config(¶ms); - if (sc->sc_hidden) - return (0); if (sc->sc_mach == NULL) { device_printf(sc->sc_dev, "couldn't configure FM_MAC module.\n" ); @@ -647,20 +639,6 @@ dtsec_attach(device_t dev) return (ENXIO); } - /* - * XXX: All phys are connected to MDIO interface of the first dTSEC - * device (dTSEC0). We have to save handle to the FM_MAC instance of - * dTSEC0, which is used later during phy's registers accesses. Another - * option would be adding new property to DTS pointing to correct dTSEC - * instance, of which FM_MAC handle has to be used for phy's registers - * accesses. We did not want to add new properties to DTS, thus this - * quite ugly hack. - */ - if (sc->sc_eth_id == 0) - dtsec_mdio_mac_handle = sc->sc_mach; - if (sc->sc_hidden) - return (0); - /* Init FMan TX port */ error = sc->sc_port_tx_init(sc, device_get_unit(sc->sc_dev)); if (error != 0) { @@ -797,47 +775,21 @@ int dtsec_miibus_readreg(device_t dev, int phy, int reg) { struct dtsec_softc *sc; - uint16_t data; - t_Error error; sc = device_get_softc(dev); - if (phy != sc->sc_phy_addr) - return (0xFFFF); - - DTSEC_MII_LOCK(sc); - error = FM_MAC_MII_ReadPhyReg(dtsec_mdio_mac_handle, phy, reg, &data); - DTSEC_MII_UNLOCK(sc); - if (error != E_OK) { - device_printf(dev, "Error while reading from PHY (NetCommSw " - "error: %d)\n", error); - return (0xFFFF); - } - - return ((int)data); + return (MIIBUS_READREG(sc->sc_mdio, phy, reg)); } int dtsec_miibus_writereg(device_t dev, int phy, int reg, int value) { + struct dtsec_softc *sc; - t_Error error; sc = device_get_softc(dev); - if (phy != sc->sc_phy_addr) - return (EINVAL); - - DTSEC_MII_LOCK(sc); - error = FM_MAC_MII_WritePhyReg(dtsec_mdio_mac_handle, phy, reg, value); - DTSEC_MII_UNLOCK(sc); - if (error != E_OK) { - device_printf(dev, "Error while writing to PHY (NetCommSw " - "error: %d).\n", error); - return (EIO); - } - - return (0); + return (MIIBUS_WRITEREG(sc->sc_mdio, phy, reg, value)); } void Modified: head/sys/dev/dpaa/if_dtsec.h ============================================================================== --- head/sys/dev/dpaa/if_dtsec.h Fri Oct 21 02:07:03 2016 (r307695) +++ head/sys/dev/dpaa/if_dtsec.h Fri Oct 21 02:16:11 2016 (r307696) @@ -75,6 +75,7 @@ struct dtsec_softc { uint32_t sc_port_tx_qman_chan; int sc_phy_addr; bool sc_hidden; + device_t sc_mdio; /* Params from fman_bus driver */ vm_offset_t sc_fm_base; Modified: head/sys/dev/dpaa/if_dtsec_fdt.c ============================================================================== --- head/sys/dev/dpaa/if_dtsec_fdt.c Fri Oct 21 02:07:03 2016 (r307695) +++ head/sys/dev/dpaa/if_dtsec_fdt.c Fri Oct 21 02:16:11 2016 (r307696) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include "if_dtsec.h" +#include "fman.h" static int dtsec_fdt_probe(device_t dev); @@ -106,6 +107,28 @@ dtsec_fdt_probe(device_t dev) } static int +find_mdio(phandle_t phy_node, device_t mac, device_t *mdio_dev) +{ + device_t bus; + + while (phy_node > 0) { + if (ofw_bus_node_is_compatible(phy_node, "fsl,fman-mdio")) + break; + phy_node = OF_parent(phy_node); + } + + if (phy_node <= 0) + return (ENOENT); + + if (fman_get_dev(&bus) < 0) + return (ENOENT); + + *mdio_dev = ofw_bus_find_child_device_by_phandle(bus, phy_node); + + return (0); +} + +static int dtsec_fdt_attach(device_t dev) { struct dtsec_softc *sc; @@ -127,13 +150,9 @@ dtsec_fdt_attach(device_t dev) if (OF_getprop(enet_node, "local-mac-address", (void *)sc->sc_mac_addr, 6) == -1) { - if (device_get_unit(dev) != 0) { - device_printf(dev, - "Could not load local-mac-addr property " - "from DTS\n"); - return (ENXIO); - } - sc->sc_hidden = true; + device_printf(dev, + "Could not load local-mac-addr property from DTS\n"); + return (ENXIO); } /* Get link speed */ @@ -160,6 +179,9 @@ dtsec_fdt_attach(device_t dev) sizeof(sc->sc_phy_addr)) <= 0) return (ENXIO); + if (find_mdio(phy_node, dev, &sc->sc_mdio) != 0) + return (ENXIO); + /* Get PHY connection type */ if (OF_getprop(enet_node, "phy-connection-type", (void *)phy_type, sizeof(phy_type)) <= 0) Modified: head/sys/powerpc/conf/dpaa/files.dpaa ============================================================================== --- head/sys/powerpc/conf/dpaa/files.dpaa Fri Oct 21 02:07:03 2016 (r307695) +++ head/sys/powerpc/conf/dpaa/files.dpaa Fri Oct 21 02:16:11 2016 (r307696) @@ -87,6 +87,8 @@ dev/dpaa/qman_fdt.c optional dpaa fdt no-depend compile-with "${DPAA_COMPILE_CMD}" dev/dpaa/fman.c optional dpaa fdt \ no-depend compile-with "${DPAA_COMPILE_CMD}" +dev/dpaa/fman_mdio.c optional dpaa fdt \ + no-depend compile-with "${DPAA_COMPILE_CMD}" dev/dpaa/fman_fdt.c optional dpaa fdt \ no-depend compile-with "${DPAA_COMPILE_CMD}" dev/dpaa/if_dtsec.c optional dpaa \ From owner-svn-src-all@freebsd.org Fri Oct 21 03:10:08 2016 Return-Path: Delivered-To: svn-src-all@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 7DB68C195A8; Fri, 21 Oct 2016 03:10:08 +0000 (UTC) (envelope-from araujo@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 4B1BA13BF; Fri, 21 Oct 2016 03:10:08 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L3A7SH033820; Fri, 21 Oct 2016 03:10:07 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L3A59r033802; Fri, 21 Oct 2016 03:10:05 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201610210310.u9L3A59r033802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 21 Oct 2016 03:10: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: r307697 - in stable/11: sbin/natd usr.bin/calendar usr.bin/gzip usr.bin/indent usr.bin/locale usr.bin/localedef usr.bin/netstat usr.bin/procstat usr.bin/rpcgen usr.bin/systat usr.sbin/c... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 03:10:08 -0000 Author: araujo Date: Fri Oct 21 03:10:05 2016 New Revision: 307697 URL: https://svnweb.freebsd.org/changeset/base/307697 Log: MFC r303541, r303542, r303543, r303545, r303546, r303547, r304225, r304226, r304605, r304676, r305212, r305863: r303541: Use nitems() from sys/param.h. Sponsored by: gandi.net (BSD Day Taiwan) MFC after: 2 weeks. r303542: Use nitems() from sys/param.h. MFC after: 2 weeks. Sponsored by: gandi.net (BSD Day Taiwan) r303543: Use nitems() from sys/param.h. MFC after: 2 weeks. Sponsored by: gandi.net (BSD Day Taiwan) r303545: Use nitems() from sys/param.h. MFC after: 2 weeks. Sponsored by: gandi.net (BSD Day Taiwan) r303546: Use nitems() from sys/param.h. MFC after: 2 weeks. Sponsored by: gandi.net (BSD Day Taiwan) r303547: Use nitems() from sys/param.h. MFC after: 2 weeks. Sponsored by: gandi.net (BSD Day Taiwan) r304225: Use nitems() from sys/param.h. MFC after: 2 weeks. r304226: Use nitems() from sys/param.h. MFC after: 2 weeks. r304605: Fix calloc(3) argument order. Reviewed by: trasz MFC after: 4 weeks. Differential Revision: https://reviews.freebsd.org/D7532 r304676: Fix calloc(3) argument order. MFC after: 4 weeks. r305212: - Invert calloc(3) argument order. MFC after: 4 weeks r305863: Invert calloc(3) argument order. Reviewed by: ed. MFC after: 4 weeks. Differential Revision: https://reviews.freebsd.org/D7902 Modified: stable/11/sbin/natd/natd.c stable/11/usr.bin/calendar/io.c stable/11/usr.bin/gzip/gzip.c stable/11/usr.bin/indent/indent.c stable/11/usr.bin/locale/locale.c stable/11/usr.bin/localedef/collate.c stable/11/usr.bin/netstat/pfkey.c stable/11/usr.bin/procstat/procstat_files.c stable/11/usr.bin/rpcgen/rpc_main.c stable/11/usr.bin/systat/main.c stable/11/usr.sbin/ctld/chap.c stable/11/usr.sbin/ctld/keys.c stable/11/usr.sbin/ctld/pdu.c stable/11/usr.sbin/fifolog/lib/fifolog_int.c stable/11/usr.sbin/fifolog/lib/fifolog_reader.c stable/11/usr.sbin/iscsid/chap.c stable/11/usr.sbin/iscsid/keys.c stable/11/usr.sbin/iscsid/pdu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/natd/natd.c ============================================================================== --- stable/11/sbin/natd/natd.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/sbin/natd/natd.c Fri Oct 21 03:10:05 2016 (r307697) @@ -2006,7 +2006,7 @@ NewInstance(const char *name) } } ninstance++; - ip = calloc(sizeof *ip, 1); + ip = calloc(1, sizeof(*ip)); ip->name = strdup(name); ip->la = LibAliasInit (ip->la); ip->assignAliasAddr = 0; Modified: stable/11/usr.bin/calendar/io.c ============================================================================== --- stable/11/usr.bin/calendar/io.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/calendar/io.c Fri Oct 21 03:10:05 2016 (r307697) @@ -118,7 +118,7 @@ cal_fopen(const char *file) return (NULL); } - for (i = 0; i < sizeof(calendarHomes)/sizeof(calendarHomes[0]) ; i++) { + for (i = 0; i < nitems(calendarHomes); i++) { if (chdir(calendarHomes[i]) != 0) continue; Modified: stable/11/usr.bin/gzip/gzip.c ============================================================================== --- stable/11/usr.bin/gzip/gzip.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/gzip/gzip.c Fri Oct 21 03:10:05 2016 (r307697) @@ -155,7 +155,7 @@ static suffixes_t suffixes[] = { #endif /* SMALL */ #undef SUFFIX }; -#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0]) +#define NUM_SUFFIXES (nitems(suffixes)) #define SUFFIX_MAXLEN 30 static const char gzip_version[] = "FreeBSD gzip 20150413"; Modified: stable/11/usr.bin/indent/indent.c ============================================================================== --- stable/11/usr.bin/indent/indent.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/indent/indent.c Fri Oct 21 03:10:05 2016 (r307697) @@ -1133,7 +1133,7 @@ check_type: while ((c = getc(input)) == '\n'); ungetc(c, input); } - if ((size_t)ifdef_level < sizeof(state_stack)/sizeof(state_stack[0])) { + if ((size_t)ifdef_level < nitems(state_stack)) { match_state[ifdef_level].tos = -1; state_stack[ifdef_level++] = ps; } Modified: stable/11/usr.bin/locale/locale.c ============================================================================== --- stable/11/usr.bin/locale/locale.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/locale/locale.c Fri Oct 21 03:10:05 2016 (r307697) @@ -220,10 +220,10 @@ struct _kwinfo { "(POSIX legacy)" } /* compat */ }; -#define NKWINFO (sizeof(kwinfo)/sizeof(kwinfo[0])) +#define NKWINFO (nitems(kwinfo)) const char *boguslocales[] = { "UTF-8" }; -#define NBOGUS (sizeof(boguslocales)/sizeof(boguslocales[0])) +#define NBOGUS (nitems(boguslocales)) int main(int argc, char *argv[]) Modified: stable/11/usr.bin/localedef/collate.c ============================================================================== --- stable/11/usr.bin/localedef/collate.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/localedef/collate.c Fri Oct 21 03:10:05 2016 (r307697) @@ -490,7 +490,7 @@ define_collsym(char *name) { collsym_t *sym; - if ((sym = calloc(sizeof (*sym), 1)) == NULL) { + if ((sym = calloc(1, sizeof(*sym))) == NULL) { fprintf(stderr,"out of memory"); return; } @@ -536,7 +536,7 @@ get_collundef(char *name) srch.name = name; if ((ud = RB_FIND(collundefs, &collundefs, &srch)) == NULL) { - if (((ud = calloc(sizeof (*ud), 1)) == NULL) || + if (((ud = calloc(1, sizeof(*ud))) == NULL) || ((ud->name = strdup(name)) == NULL)) { fprintf(stderr,"out of memory"); free(ud); @@ -561,7 +561,7 @@ get_collchar(wchar_t wc, int create) srch.wc = wc; cc = RB_FIND(collchars, &collchars, &srch); if ((cc == NULL) && create) { - if ((cc = calloc(sizeof (*cc), 1)) == NULL) { + if ((cc = calloc(1, sizeof(*cc))) == NULL) { fprintf(stderr, "out of memory"); return (NULL); } @@ -793,7 +793,7 @@ define_collelem(char *name, wchar_t *wcs return; } - if ((e = calloc(sizeof (*e), 1)) == NULL) { + if ((e = calloc(1, sizeof(*e))) == NULL) { fprintf(stderr, "out of memory"); return; } @@ -927,7 +927,7 @@ add_order_subst(void) s = RB_FIND(substs_ref, &substs_ref[curr_weight], &srch); if (s == NULL) { - if ((s = calloc(sizeof (*s), 1)) == NULL) { + if ((s = calloc(1, sizeof(*s))) == NULL) { fprintf(stderr,"out of memory"); return; } @@ -1035,7 +1035,7 @@ add_weight(int32_t ref, int pass) if (RB_FIND(weights, &weights[pass], &srch) != NULL) return; - if ((w = calloc(sizeof (*w), 1)) == NULL) { + if ((w = calloc(1, sizeof(*w))) == NULL) { fprintf(stderr, "out of memory"); return; } Modified: stable/11/usr.bin/netstat/pfkey.c ============================================================================== --- stable/11/usr.bin/netstat/pfkey.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/netstat/pfkey.c Fri Oct 21 03:10:05 2016 (r307697) @@ -101,8 +101,7 @@ static const char *pfkey_msgtype_names ( static const char * pfkey_msgtype_names(int x) { - const int max = - sizeof(pfkey_msgtypenames)/sizeof(pfkey_msgtypenames[0]); + const int max = nitems(pfkey_msgtypenames); static char buf[20]; if (x < max && pfkey_msgtypenames[x]) Modified: stable/11/usr.bin/procstat/procstat_files.c ============================================================================== --- stable/11/usr.bin/procstat/procstat_files.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/procstat/procstat_files.c Fri Oct 21 03:10:05 2016 (r307697) @@ -235,8 +235,7 @@ static struct cap_desc { { CAP_SOCK_CLIENT, "scl" }, { CAP_SOCK_SERVER, "ssr" }, }; -static const u_int cap_desc_count = sizeof(cap_desc) / - sizeof(cap_desc[0]); +static const u_int cap_desc_count = nitems(cap_desc); static u_int width_capability(cap_rights_t *rightsp) Modified: stable/11/usr.bin/rpcgen/rpc_main.c ============================================================================== --- stable/11/usr.bin/rpcgen/rpc_main.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/rpcgen/rpc_main.c Fri Oct 21 03:10:05 2016 (r307697) @@ -82,11 +82,11 @@ static char pathbuf[MAXPATHLEN + 1]; static const char *allv[] = { "rpcgen", "-s", "udp", "-s", "tcp", }; -static int allc = sizeof (allv)/sizeof (allv[0]); +static int allc = nitems(allv); static const char *allnv[] = { "rpcgen", "-s", "netpath", }; -static int allnc = sizeof (allnv)/sizeof (allnv[0]); +static int allnc = nitems(allnv); /* * machinations for handling expanding argument list Modified: stable/11/usr.bin/systat/main.c ============================================================================== --- stable/11/usr.bin/systat/main.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.bin/systat/main.c Fri Oct 21 03:10:05 2016 (r307697) @@ -261,7 +261,7 @@ display(void) int i, j; /* Get the load average over the last minute. */ - (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])); + (void) getloadavg(avenrun, nitems(avenrun)); (*curcmd->c_fetch)(); if (curcmd->c_flags & CF_LOADAV) { j = 5.0*avenrun[0] + 0.5; @@ -293,7 +293,7 @@ display(void) GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc[5]); GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc[6]); wmove(wload, 0, 0); wclrtoeol(wload); - for (i = 0 ; i < sizeof(arc) / sizeof(arc[0]) ; i++) { + for (i = 0 ; i < nitems(arc); i++) { if (arc[i] > 10llu * 1024 * 1024 * 1024 ) { wprintw(wload, "%7lluG", arc[i] >> 30); } @@ -318,7 +318,7 @@ void load(void) { - (void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0])); + (void) getloadavg(avenrun, nitems(avenrun)); mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f", avenrun[0], avenrun[1], avenrun[2]); clrtoeol(); Modified: stable/11/usr.sbin/ctld/chap.c ============================================================================== --- stable/11/usr.sbin/ctld/chap.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/ctld/chap.c Fri Oct 21 03:10:05 2016 (r307697) @@ -232,7 +232,7 @@ chap_new(void) { struct chap *chap; - chap = calloc(sizeof(*chap), 1); + chap = calloc(1, sizeof(*chap)); if (chap == NULL) log_err(1, "calloc"); @@ -333,7 +333,7 @@ rchap_new(const char *secret) { struct rchap *rchap; - rchap = calloc(sizeof(*rchap), 1); + rchap = calloc(1, sizeof(*rchap)); if (rchap == NULL) log_err(1, "calloc"); Modified: stable/11/usr.sbin/ctld/keys.c ============================================================================== --- stable/11/usr.sbin/ctld/keys.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/ctld/keys.c Fri Oct 21 03:10:05 2016 (r307697) @@ -43,7 +43,7 @@ keys_new(void) { struct keys *keys; - keys = calloc(sizeof(*keys), 1); + keys = calloc(1, sizeof(*keys)); if (keys == NULL) log_err(1, "calloc"); Modified: stable/11/usr.sbin/ctld/pdu.c ============================================================================== --- stable/11/usr.sbin/ctld/pdu.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/ctld/pdu.c Fri Oct 21 03:10:05 2016 (r307697) @@ -81,11 +81,11 @@ pdu_new(struct connection *conn) { struct pdu *pdu; - pdu = calloc(sizeof(*pdu), 1); + pdu = calloc(1, sizeof(*pdu)); if (pdu == NULL) log_err(1, "calloc"); - pdu->pdu_bhs = calloc(sizeof(*pdu->pdu_bhs), 1); + pdu->pdu_bhs = calloc(1, sizeof(*pdu->pdu_bhs)); if (pdu->pdu_bhs == NULL) log_err(1, "calloc"); Modified: stable/11/usr.sbin/fifolog/lib/fifolog_int.c ============================================================================== --- stable/11/usr.sbin/fifolog/lib/fifolog_int.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/fifolog/lib/fifolog_int.c Fri Oct 21 03:10:05 2016 (r307697) @@ -125,7 +125,7 @@ fifolog_int_open_i(struct fifolog_file * /* Initialize zlib handling */ - f->zs = calloc(sizeof *f->zs, 1); + f->zs = calloc(1, sizeof(*f->zs)); if (f->zs == NULL) return ("cannot malloc"); Modified: stable/11/usr.sbin/fifolog/lib/fifolog_reader.c ============================================================================== --- stable/11/usr.sbin/fifolog/lib/fifolog_reader.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/fifolog/lib/fifolog_reader.c Fri Oct 21 03:10:05 2016 (r307697) @@ -59,7 +59,7 @@ fifolog_reader_open(const char *fname) struct fifolog_reader *fr; int i; - fr = calloc(sizeof *fr, 1); + fr = calloc(1, sizeof(*fr)); if (fr == NULL) err(1, "Cannot malloc"); Modified: stable/11/usr.sbin/iscsid/chap.c ============================================================================== --- stable/11/usr.sbin/iscsid/chap.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/iscsid/chap.c Fri Oct 21 03:10:05 2016 (r307697) @@ -232,7 +232,7 @@ chap_new(void) { struct chap *chap; - chap = calloc(sizeof(*chap), 1); + chap = calloc(1, sizeof(*chap)); if (chap == NULL) log_err(1, "calloc"); @@ -333,7 +333,7 @@ rchap_new(const char *secret) { struct rchap *rchap; - rchap = calloc(sizeof(*rchap), 1); + rchap = calloc(1, sizeof(*rchap)); if (rchap == NULL) log_err(1, "calloc"); Modified: stable/11/usr.sbin/iscsid/keys.c ============================================================================== --- stable/11/usr.sbin/iscsid/keys.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/iscsid/keys.c Fri Oct 21 03:10:05 2016 (r307697) @@ -43,7 +43,7 @@ keys_new(void) { struct keys *keys; - keys = calloc(sizeof(*keys), 1); + keys = calloc(1, sizeof(*keys)); if (keys == NULL) log_err(1, "calloc"); Modified: stable/11/usr.sbin/iscsid/pdu.c ============================================================================== --- stable/11/usr.sbin/iscsid/pdu.c Fri Oct 21 02:16:11 2016 (r307696) +++ stable/11/usr.sbin/iscsid/pdu.c Fri Oct 21 03:10:05 2016 (r307697) @@ -81,11 +81,11 @@ pdu_new(struct connection *conn) { struct pdu *pdu; - pdu = calloc(sizeof(*pdu), 1); + pdu = calloc(1, sizeof(*pdu)); if (pdu == NULL) log_err(1, "calloc"); - pdu->pdu_bhs = calloc(sizeof(*pdu->pdu_bhs), 1); + pdu->pdu_bhs = calloc(1, sizeof(*pdu->pdu_bhs)); if (pdu->pdu_bhs == NULL) log_err(1, "calloc"); From owner-svn-src-all@freebsd.org Fri Oct 21 03:23:18 2016 Return-Path: Delivered-To: svn-src-all@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 A680BC198E0; Fri, 21 Oct 2016 03:23:18 +0000 (UTC) (envelope-from lwhsu@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 7635D1AF6; Fri, 21 Oct 2016 03:23:18 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L3NHxA041229; Fri, 21 Oct 2016 03:23:17 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L3NHO7041228; Fri, 21 Oct 2016 03:23:17 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201610210323.u9L3NHO7041228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 21 Oct 2016 03:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307698 - head/sys/modules/gpio/gpiospi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 03:23:18 -0000 Author: lwhsu (ports committer) Date: Fri Oct 21 03:23:17 2016 New Revision: 307698 URL: https://svnweb.freebsd.org/changeset/base/307698 Log: - Add required header for fixing `make` in sys/modules/gpio Reviewed by: imp, loos Differential Revision: https://reviews.freebsd.org/D7815 Modified: head/sys/modules/gpio/gpiospi/Makefile Modified: head/sys/modules/gpio/gpiospi/Makefile ============================================================================== --- head/sys/modules/gpio/gpiospi/Makefile Fri Oct 21 03:10:05 2016 (r307697) +++ head/sys/modules/gpio/gpiospi/Makefile Fri Oct 21 03:23:17 2016 (r307698) @@ -34,7 +34,7 @@ KMOD= gpiospi SRCS= gpiospi.c SRCS+= device_if.h bus_if.h gpio_if.h gpiobus_if.h spibus_if.h -SRCS+= ofw_bus_if.h opt_gpio.h +SRCS+= ofw_bus_if.h opt_gpio.h opt_platform.h CFLAGS+= -I. -I${.CURDIR}/../../../dev/gpio/ From owner-svn-src-all@freebsd.org Fri Oct 21 04:49:40 2016 Return-Path: Delivered-To: svn-src-all@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 66843C1AED6; Fri, 21 Oct 2016 04:49:40 +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 2CC7E21E; Fri, 21 Oct 2016 04:49:40 +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 u9L4ndbW071298; Fri, 21 Oct 2016 04:49:39 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L4ndCA071297; Fri, 21 Oct 2016 04:49:39 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210449.u9L4ndCA071297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 04:49:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307699 - head/gnu/lib/libgcc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 04:49:40 -0000 Author: ngie Date: Fri Oct 21 04:49:39 2016 New Revision: 307699 URL: https://svnweb.freebsd.org/changeset/base/307699 Log: Revert r307689 The proposed change ("Fix building of llvm's unwind if gcc has been also built") breaks the build with clang/llvm. Tested with... ( export SRCCONF=/dev/null WITH_CLANG= cd gnu/lib/libgcc; make obj; make depend; make all ) MFC after: 3 days X-MFC with: r307689 Pointyhat to: bapt Reported by: Jenkins, O. Hartmann Sponsored by: Dell EMC Isilon Modified: head/gnu/lib/libgcc/Makefile Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Fri Oct 21 03:23:17 2016 (r307698) +++ head/gnu/lib/libgcc/Makefile Fri Oct 21 04:49:39 2016 (r307699) @@ -30,7 +30,8 @@ CFLAGS+= -DTARGET_ARM_EABI CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ -DHAVE_GTHR_DEFAULT \ -I${GCCLIB}/include \ - -I${GCCDIR}/config -I${GCCDIR} -I. + -I${GCCDIR}/config -I${GCCDIR} -I. \ + -I${CCDIR}/cc_tools LDFLAGS+= -nodefaultlibs LIBADD+= c @@ -101,12 +102,6 @@ CFLAGS+= -I${SRCTOP}/contrib/libc++/incl .else # MK_LLVM_LIBUNWIND -# -# Prevent the potential unwind.h from gcc (generated) -# to be in the include path before the one from llvm unwind -# -CFLAGS+= -I${CCDIR}/cc_tools - .if ${TARGET_CPUARCH} == "arm" LIB2ADDEH = unwind-arm.c libunwind-arm.S pr-support.c unwind-c.c .else From owner-svn-src-all@freebsd.org Fri Oct 21 04:50:12 2016 Return-Path: Delivered-To: svn-src-all@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 C71E4C1AF49; Fri, 21 Oct 2016 04:50:12 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9382D3CC; Fri, 21 Oct 2016 04:50:12 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x242.google.com with SMTP id r16so7441461pfg.3; Thu, 20 Oct 2016 21:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=1+5OXldtC/A8H5y0gGYiToAk+UPcQ4TcAY/gbuoXhgg=; b=YGVyBSa+ZHJ1PEaICMubqTpXIaOYKy//hdWS8ng8D+BEdW6AqpmoKDSft3AqNA2n09 C8yRymuoCNC4LTsW1KdaKM76ObW3p9n12czzpLNEa+Wvt+w8UnZ6/xbJchcMN8W335Vc V7axUs0fYXDh39iyd3w6C1aCySpXzDi605rxp4k0dL3HXwW5uKrav2F+30GOOTM2uYRd QHFYEFxS9Jl/P12DFX7UP6kVtXCXxuzkr9nGQh9paDPdqbXiRVmoHEHWuhtP/N7z8F5c WGwSqYdBW7Ziv1K8ZxU5oD+ZqWaIs0iUuFMGxHkqAfp17ymtkc6Pbw45OxTAOTvyOM9W 4PeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=1+5OXldtC/A8H5y0gGYiToAk+UPcQ4TcAY/gbuoXhgg=; b=RCf0MHu/EbTghujXIEjVpgcEPHsCvxbGVgZ8hvitJ0L8m0fVOGFc8UGBK+5a03zs54 S94+4P0d2Ft1ELUa5gJ4fR5tGJ54mmqsUB8o8CO5/SodyDawm5FtpQXCWbQYUms0p6vH FQU2f5KQJWDp5ApxRdXqr//C6SwacCe8uscNg+q+0lVwOOcq51qXlWfLSb63/vWuskUB hmFIJak6CbQ0p3KQGQz6FrhUXK7uEI7RbFX1Ah39fu8SdlKxOtNHGg3+xwfcS/qiz3J+ lnEja8OVOtmykpk44e56I9uI6CkBLRovpLSt5ZsGFYuaa+bb+1otG8ZO2oMp/ZQ0Jw51 I4IQ== X-Gm-Message-State: AA6/9RnO+FSXFQ7ytTo2eCQmJugsF/A4qhVkanqxzNnoRS1bxGSu/MOpTvJZj2esS7GV1g== X-Received: by 10.99.119.68 with SMTP id s65mr6577065pgc.160.1477025411861; Thu, 20 Oct 2016 21:50:11 -0700 (PDT) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id a23sm938340pfc.59.2016.10.20.21.50.11 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Oct 2016 21:50:11 -0700 (PDT) Subject: Re: svn commit: r307689 - head/gnu/lib/libgcc Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_7807D56A-DA4A-42F4-A2B1-A4ACA871D4A4"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201610202112.u9KLCoYR098603@repo.freebsd.org> Date: Thu, 20 Oct 2016 21:50:13 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <045B2295-607B-483F-9A43-FC2663AC789A@gmail.com> References: <201610202112.u9KLCoYR098603@repo.freebsd.org> To: Baptiste Daroussin X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 04:50:12 -0000 --Apple-Mail=_7807D56A-DA4A-42F4-A2B1-A4ACA871D4A4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Oct 20, 2016, at 14:12, Baptiste Daroussin = wrote: >=20 > Author: bapt > Date: Thu Oct 20 21:12:50 2016 > New Revision: 307689 > URL: https://svnweb.freebsd.org/changeset/base/307689 >=20 > Log: > Fix building of llvm's unwind if gcc has been also built >=20 > when building gcc an unwind.h header is generate in the cc_tool = directory > which is included in the CFLAGS before the path where the llvm's = unwind.h file > lives >=20 > Reviewed by: emaste > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D7357 This broke the build with clang and was reverted via r307699. Thanks, -Ngie --Apple-Mail=_7807D56A-DA4A-42F4-A2B1-A4ACA871D4A4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYCZ6FAAoJEPWDqSZpMIYVWpQQAKrWjgY95+D7NNSD53CBN/Lp 0rAE2Sf5dS+ybejcPRD8etpyKqx7PvT7mPMfyH6Dctvu+r0m74XpLDwmmtJcEa+X iMQoAhHE8LL2n2nTKZn2VeualJUokOao6k6ZaD2cAga1DyF4OQJRc3WSRRDTYHeh r10TtsSu/1B32qEX0JJOBSgJJq5zEcE2nQNa7ykorUlbJTxFULCJnhnsiK//b+Mg vsvl1+0/o0zMKIMKM7029SgsKV+SsRD6Syw+W1/7Z2byE0uKmTBaA1p9bH8i4nWs OfTooGacKh8qQnqxQwhYEax3pwJ7np8z5ehjZVKl63AMeydr78fcT1lWGjp9uGZ/ O933HMk9YmFIYmVChT0cq9WavzQgMd8/Wo/YosYgbW5lLcnl+NBARp8/bhQLTxRP APE+r+Ha9xrsGIpRwGK70oK7E02HNiNHWU7lypcj5IV+u0XOIDvByYMNLjlCCIQN hKfubkAkawazdE34LDghpYOwi+Whv4cVLYuRtZwx5iAltjMH+C2HcOSBuUr5ORYs 4SBsDzcXSgemvDyG3goE4D32n61xYsPgwjYAeyDa9j/HdgBqo/XgkAc7VQv4ywpG iojQFfw21dIhUYWBOKEkuvS92bu/Cv+l94LaW4TdFT+0EWFV8npv8CO528TXmiG6 VD+MPOdbWmSg55OBiVm9 =v6Fr -----END PGP SIGNATURE----- --Apple-Mail=_7807D56A-DA4A-42F4-A2B1-A4ACA871D4A4-- From owner-svn-src-all@freebsd.org Fri Oct 21 04:54:45 2016 Return-Path: Delivered-To: svn-src-all@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 0C99EC1B14E; Fri, 21 Oct 2016 04:54: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 CCFD5B4E; Fri, 21 Oct 2016 04:54:44 +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 u9L4shKg074924; Fri, 21 Oct 2016 04:54:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L4sh0S074923; Fri, 21 Oct 2016 04:54:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210454.u9L4sh0S074923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 04:54:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307700 - head/lib/libc/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 04:54:45 -0000 Author: ngie Date: Fri Oct 21 04:54:43 2016 New Revision: 307700 URL: https://svnweb.freebsd.org/changeset/base/307700 Log: Only build lib/libc/tests/iconv if MK_ICONV != no MFC after: 1 week Reported by: damian@damianek.be Sponsored by: Dell EMC Isilon Modified: head/lib/libc/tests/Makefile Modified: head/lib/libc/tests/Makefile ============================================================================== --- head/lib/libc/tests/Makefile Fri Oct 21 04:49:39 2016 (r307699) +++ head/lib/libc/tests/Makefile Fri Oct 21 04:54:43 2016 (r307700) @@ -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-all@freebsd.org Fri Oct 21 05:21:21 2016 Return-Path: Delivered-To: svn-src-all@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 E117BC1B535; Fri, 21 Oct 2016 05:21: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 B088B759; Fri, 21 Oct 2016 05:21: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 u9L5LKCb082582; Fri, 21 Oct 2016 05:21:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L5LKKD082581; Fri, 21 Oct 2016 05:21:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210521.u9L5LKKD082581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 05:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307701 - head/contrib/netbsd-tests/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 05:21:22 -0000 Author: ngie Date: Fri Oct 21 05:21:20 2016 New Revision: 307701 URL: https://svnweb.freebsd.org/changeset/base/307701 Log: Expect tests/sys/fs/tmpfs/link_test:kqueue to fail It fails with: "dir/b did not receive NOTE_LINK" Also, add needed cleanup logic to cleanup the mountpoint after the fact MFC after: 2 weeks PR: 213662 Sponsored by: Dell EMC Isilon Modified: head/contrib/netbsd-tests/fs/tmpfs/t_link.sh Modified: head/contrib/netbsd-tests/fs/tmpfs/t_link.sh ============================================================================== --- head/contrib/netbsd-tests/fs/tmpfs/t_link.sh Fri Oct 21 04:54:43 2016 (r307700) +++ head/contrib/netbsd-tests/fs/tmpfs/t_link.sh Fri Oct 21 05:21:20 2016 (r307701) @@ -93,7 +93,18 @@ subdirs_body() { test_unmount } +# Begin FreeBSD +if true; then +atf_test_case kqueue cleanup +kqueue_cleanup() { + Mount_Point=$(pwd)/mntpt test_unmount || : +} +else +# End FreeBSD atf_test_case kqueue +# Begin FreeBSD +fi +# End FreeBSD kqueue_head() { atf_set "descr" "Verifies that creating a link raises the correct" \ "kqueue events" @@ -102,6 +113,10 @@ kqueue_head() { kqueue_body() { test_mount + # Begin FreeBSD + atf_expect_fail "fails with: dir/b did not receive NOTE_LINK - bug 213662" + # End FreeBSD + atf_check -s eq:0 -o empty -e empty mkdir dir atf_check -s eq:0 -o empty -e empty touch dir/a echo 'ln dir/a dir/b' | kqueue_monitor 2 dir dir/a From owner-svn-src-all@freebsd.org Fri Oct 21 05:24:10 2016 Return-Path: Delivered-To: svn-src-all@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 19A32C1B6B7; Fri, 21 Oct 2016 05:24: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 EAABDC25; Fri, 21 Oct 2016 05:24:09 +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 u9L5O9xp086264; Fri, 21 Oct 2016 05:24:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L5O8Ua086260; Fri, 21 Oct 2016 05:24:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210524.u9L5O8Ua086260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 05:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307702 - in head: etc/mtree tests/sys tests/sys/fs tests/sys/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 05:24:10 -0000 Author: ngie Date: Fri Oct 21 05:24:08 2016 New Revision: 307702 URL: https://svnweb.freebsd.org/changeset/base/307702 Log: Integrate contrib/netbsd-tests/fs/tmpfs into the FreeBSD test suite as tests/sys/fs These testcases exercise tmpfs support MFC after: 2 weeks Sponsored by: Dell EMC Isilon Added: head/tests/sys/fs/ head/tests/sys/fs/Makefile (contents, props changed) head/tests/sys/fs/tmpfs/ head/tests/sys/fs/tmpfs/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/tests/sys/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Fri Oct 21 05:21:20 2016 (r307701) +++ head/etc/mtree/BSD.tests.dist Fri Oct 21 05:24:08 2016 (r307702) @@ -396,6 +396,10 @@ .. file .. + fs + tmpfs + .. + .. geom class concat Modified: head/tests/sys/Makefile ============================================================================== --- head/tests/sys/Makefile Fri Oct 21 05:21:20 2016 (r307701) +++ head/tests/sys/Makefile Fri Oct 21 05:24:08 2016 (r307702) @@ -6,6 +6,7 @@ TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio TESTS_SUBDIRS+= fifo TESTS_SUBDIRS+= file +TESTS_SUBDIRS+= fs TESTS_SUBDIRS+= geom TESTS_SUBDIRS+= kern TESTS_SUBDIRS+= kqueue Added: head/tests/sys/fs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/fs/Makefile Fri Oct 21 05:24:08 2016 (r307702) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/fs + +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs + +#TESTS_SUBDIRS+= nullfs # XXX: needs rump +TESTS_SUBDIRS+= tmpfs + +${PACKAGE}FILES+= h_funcs.subr +${PACKAGE}FILESDIR= ${TESTSDIR} + +CLEANFILES+= h_funcs.subr +CLEANFILES+= h_funcs.subr.tmp + +h_funcs.subr: ${TESTSRC}/h_funcs.subr + cat ${.ALLSRC} | \ + sed -e '/atf_require_prog mount_$${name}/d' >>${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} + +.include Added: head/tests/sys/fs/tmpfs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/fs/tmpfs/Makefile Fri Oct 21 05:24:08 2016 (r307702) @@ -0,0 +1,56 @@ +# $FreeBSD$ + +PACKAGE= tests + +FILESYSTEM?= ${.CURDIR:T} + +TESTSDIR= ${TESTSBASE}/sys/fs/${FILESYSTEM} + +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs/${FILESYSTEM} + +# XXX: uses /dev/MAKEDEV to create pseudo /dev/{null,zero} character devices +#NETBSD_ATF_TESTS_SH+= devices_test +NETBSD_ATF_TESTS_SH+= create_test +NETBSD_ATF_TESTS_SH+= read_write_test +NETBSD_ATF_TESTS_SH+= dots_test +NETBSD_ATF_TESTS_SH+= exec_test +NETBSD_ATF_TESTS_SH+= link_test +NETBSD_ATF_TESTS_SH+= mkdir_test +NETBSD_ATF_TESTS_SH+= mknod_test +NETBSD_ATF_TESTS_SH+= mount_test +# XXX: need to replace `mknod ... p` with something more sensible +#NETBSD_ATF_TESTS_SH+= pipes_test +NETBSD_ATF_TESTS_SH+= trail_slash_test +NETBSD_ATF_TESTS_SH+= readdir_test +NETBSD_ATF_TESTS_SH+= remove_test +NETBSD_ATF_TESTS_SH+= rename_test +NETBSD_ATF_TESTS_SH+= rmdir_test +NETBSD_ATF_TESTS_SH+= setattr_test +NETBSD_ATF_TESTS_SH+= sizes_test +NETBSD_ATF_TESTS_SH+= sockets_test +NETBSD_ATF_TESTS_SH+= statvfs_test +NETBSD_ATF_TESTS_SH+= symlink_test +NETBSD_ATF_TESTS_SH+= times_test +NETBSD_ATF_TESTS_SH+= truncate_test +NETBSD_ATF_TESTS_SH+= vnd_test +NETBSD_ATF_TESTS_SH+= vnode_leak_test + +${PACKAGE}FILES+= h_funcs.subr +${PACKAGE}FILESDIR= ${TESTSDIR} + +PROGS+= h_tools +BINDIR.h_tools= ${TESTSDIR} + +ATF_TESTS_SH_SED_mount_test= \ + -e 's,-o -g,-o gid=,g' \ + -e 's,-o -m,-o mode=,g' \ + -e 's,-o -s,-o size=,g' \ + -e 's,-o -u,-o uid=,g' \ + -e 's,mount_${FILESYSTEM},mount -t ${FILESYSTEM},g' +ATF_TESTS_SH_SED_sizes_test= -e 's,-o -s,-o size=,g' +ATF_TESTS_SH_SED_statvfs_test= -e 's,-o -s,-o size=,g' +ATF_TESTS_SH_SED_vnode_leak_test= -e 's,-o -s,-o size=,g' + +.include + +.include From owner-svn-src-all@freebsd.org Fri Oct 21 06:05:17 2016 Return-Path: Delivered-To: svn-src-all@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 7AAC9C1BCB7; Fri, 21 Oct 2016 06:05:17 +0000 (UTC) (envelope-from sephe@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 4AC8EDC7; Fri, 21 Oct 2016 06:05:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L65GEI001663; Fri, 21 Oct 2016 06:05:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L65GE6001662; Fri, 21 Oct 2016 06:05:16 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610210605.u9L65GE6001662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 21 Oct 2016 06:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307703 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 06:05:17 -0000 Author: sephe Date: Fri Oct 21 06:05:16 2016 New Revision: 307703 URL: https://svnweb.freebsd.org/changeset/base/307703 Log: netmap: Unbreak i386 LINT building Sponsored by: Microsoft Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Fri Oct 21 05:24:08 2016 (r307702) +++ head/sys/dev/netmap/netmap_freebsd.c Fri Oct 21 06:05:16 2016 (r307703) @@ -1049,8 +1049,8 @@ nm_os_kthread_send_irq(struct nm_kthread if (ctx->user_td && ctx->irq_fd > 0) { err = kern_ioctl(ctx->user_td, ctx->irq_fd, ctx->irq_ioctl.com, (caddr_t)&ctx->irq_ioctl.data.msix); if (err) { - D("kern_ioctl error: %d ioctl parameters: fd %d com %lu data %p", - err, ctx->irq_fd, ctx->irq_ioctl.com, &ctx->irq_ioctl.data); + D("kern_ioctl error: %d ioctl parameters: fd %d com %ju data %p", + err, ctx->irq_fd, (uintmax_t)ctx->irq_ioctl.com, &ctx->irq_ioctl.data); } } } From owner-svn-src-all@freebsd.org Fri Oct 21 06:06:55 2016 Return-Path: Delivered-To: svn-src-all@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 D9453C1BD12; Fri, 21 Oct 2016 06:06:55 +0000 (UTC) (envelope-from jkim@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 8E312F27; Fri, 21 Oct 2016 06:06:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L66sqX001766; Fri, 21 Oct 2016 06:06:54 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L66sjo001764; Fri, 21 Oct 2016 06:06:54 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201610210606.u9L66sjo001764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 21 Oct 2016 06:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307704 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 06:06:55 -0000 Author: jkim Date: Fri Oct 21 06:06:54 2016 New Revision: 307704 URL: https://svnweb.freebsd.org/changeset/base/307704 Log: Fix compiler warnings for user land. Modified: head/sys/amd64/amd64/bpf_jit_machdep.c head/sys/i386/i386/bpf_jit_machdep.c Modified: head/sys/amd64/amd64/bpf_jit_machdep.c ============================================================================== --- head/sys/amd64/amd64/bpf_jit_machdep.c Fri Oct 21 06:05:16 2016 (r307703) +++ head/sys/amd64/amd64/bpf_jit_machdep.c Fri Oct 21 06:06:54 2016 (r307704) @@ -83,12 +83,13 @@ emit_code(bpf_bin_stream *stream, u_int break; case 2: - *((u_short *)(stream->ibuf + stream->cur_ip)) = (u_short)value; + *((u_short *)(void *)(stream->ibuf + stream->cur_ip)) = + (u_short)value; stream->cur_ip += 2; break; case 4: - *((u_int *)(stream->ibuf + stream->cur_ip)) = value; + *((u_int *)(void *)(stream->ibuf + stream->cur_ip)) = value; stream->cur_ip += 4; break; } @@ -650,5 +651,5 @@ bpf_jit_compile(struct bpf_insn *prog, u } #endif - return ((bpf_filter_func)stream.ibuf); + return ((bpf_filter_func)(void *)stream.ibuf); } Modified: head/sys/i386/i386/bpf_jit_machdep.c ============================================================================== --- head/sys/i386/i386/bpf_jit_machdep.c Fri Oct 21 06:05:16 2016 (r307703) +++ head/sys/i386/i386/bpf_jit_machdep.c Fri Oct 21 06:06:54 2016 (r307704) @@ -83,12 +83,13 @@ emit_code(bpf_bin_stream *stream, u_int break; case 2: - *((u_short *)(stream->ibuf + stream->cur_ip)) = (u_short)value; + *((u_short *)(void *)(stream->ibuf + stream->cur_ip)) = + (u_short)value; stream->cur_ip += 2; break; case 4: - *((u_int *)(stream->ibuf + stream->cur_ip)) = value; + *((u_int *)(void *)(stream->ibuf + stream->cur_ip)) = value; stream->cur_ip += 4; break; } @@ -679,5 +680,5 @@ bpf_jit_compile(struct bpf_insn *prog, u } #endif - return ((bpf_filter_func)stream.ibuf); + return ((bpf_filter_func)(void *)stream.ibuf); } From owner-svn-src-all@freebsd.org Fri Oct 21 06:09:31 2016 Return-Path: Delivered-To: svn-src-all@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 6CFDCC1BD78; Fri, 21 Oct 2016 06:09:31 +0000 (UTC) (envelope-from jkim@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 2FAB3FF; Fri, 21 Oct 2016 06:09:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L69UwD001899; Fri, 21 Oct 2016 06:09:30 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L69UV4001897; Fri, 21 Oct 2016 06:09:30 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201610210609.u9L69UV4001897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 21 Oct 2016 06:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307705 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 06:09:31 -0000 Author: jkim Date: Fri Oct 21 06:09:30 2016 New Revision: 307705 URL: https://svnweb.freebsd.org/changeset/base/307705 Log: Redude code for conditional jumps. Modified: head/sys/amd64/amd64/bpf_jit_machdep.c head/sys/i386/i386/bpf_jit_machdep.c Modified: head/sys/amd64/amd64/bpf_jit_machdep.c ============================================================================== --- head/sys/amd64/amd64/bpf_jit_machdep.c Fri Oct 21 06:06:54 2016 (r307704) +++ head/sys/amd64/amd64/bpf_jit_machdep.c Fri Oct 21 06:09:30 2016 (r307705) @@ -425,75 +425,58 @@ bpf_jit_compile(struct bpf_insn *prog, u break; case BPF_JMP|BPF_JGT|BPF_K: + case BPF_JMP|BPF_JGE|BPF_K: + case BPF_JMP|BPF_JEQ|BPF_K: + case BPF_JMP|BPF_JSET|BPF_K: + case BPF_JMP|BPF_JGT|BPF_X: + case BPF_JMP|BPF_JGE|BPF_X: + case BPF_JMP|BPF_JEQ|BPF_X: + case BPF_JMP|BPF_JSET|BPF_X: if (ins->jt == ins->jf) { JUMP(ins->jt); break; } - CMPid(ins->k, EAX); - JCC(JA, JBE); - break; + switch (ins->code) { + case BPF_JMP|BPF_JGT|BPF_K: + CMPid(ins->k, EAX); + JCC(JA, JBE); + break; - case BPF_JMP|BPF_JGE|BPF_K: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JGE|BPF_K: + CMPid(ins->k, EAX); + JCC(JAE, JB); break; - } - CMPid(ins->k, EAX); - JCC(JAE, JB); - break; - case BPF_JMP|BPF_JEQ|BPF_K: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JEQ|BPF_K: + CMPid(ins->k, EAX); + JCC(JE, JNE); break; - } - CMPid(ins->k, EAX); - JCC(JE, JNE); - break; - case BPF_JMP|BPF_JSET|BPF_K: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JSET|BPF_K: + TESTid(ins->k, EAX); + JCC(JNE, JE); break; - } - TESTid(ins->k, EAX); - JCC(JNE, JE); - break; - case BPF_JMP|BPF_JGT|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JGT|BPF_X: + CMPrd(EDX, EAX); + JCC(JA, JBE); break; - } - CMPrd(EDX, EAX); - JCC(JA, JBE); - break; - case BPF_JMP|BPF_JGE|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JGE|BPF_X: + CMPrd(EDX, EAX); + JCC(JAE, JB); break; - } - CMPrd(EDX, EAX); - JCC(JAE, JB); - break; - case BPF_JMP|BPF_JEQ|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JEQ|BPF_X: + CMPrd(EDX, EAX); + JCC(JE, JNE); break; - } - CMPrd(EDX, EAX); - JCC(JE, JNE); - break; - case BPF_JMP|BPF_JSET|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JSET|BPF_X: + TESTrd(EDX, EAX); + JCC(JNE, JE); break; } - TESTrd(EDX, EAX); - JCC(JNE, JE); break; case BPF_ALU|BPF_ADD|BPF_X: Modified: head/sys/i386/i386/bpf_jit_machdep.c ============================================================================== --- head/sys/i386/i386/bpf_jit_machdep.c Fri Oct 21 06:06:54 2016 (r307704) +++ head/sys/i386/i386/bpf_jit_machdep.c Fri Oct 21 06:09:30 2016 (r307705) @@ -446,75 +446,58 @@ bpf_jit_compile(struct bpf_insn *prog, u break; case BPF_JMP|BPF_JGT|BPF_K: + case BPF_JMP|BPF_JGE|BPF_K: + case BPF_JMP|BPF_JEQ|BPF_K: + case BPF_JMP|BPF_JSET|BPF_K: + case BPF_JMP|BPF_JGT|BPF_X: + case BPF_JMP|BPF_JGE|BPF_X: + case BPF_JMP|BPF_JEQ|BPF_X: + case BPF_JMP|BPF_JSET|BPF_X: if (ins->jt == ins->jf) { JUMP(ins->jt); break; } - CMPid(ins->k, EAX); - JCC(JA, JBE); - break; + switch (ins->code) { + case BPF_JMP|BPF_JGT|BPF_K: + CMPid(ins->k, EAX); + JCC(JA, JBE); + break; - case BPF_JMP|BPF_JGE|BPF_K: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JGE|BPF_K: + CMPid(ins->k, EAX); + JCC(JAE, JB); break; - } - CMPid(ins->k, EAX); - JCC(JAE, JB); - break; - case BPF_JMP|BPF_JEQ|BPF_K: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JEQ|BPF_K: + CMPid(ins->k, EAX); + JCC(JE, JNE); break; - } - CMPid(ins->k, EAX); - JCC(JE, JNE); - break; - case BPF_JMP|BPF_JSET|BPF_K: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JSET|BPF_K: + TESTid(ins->k, EAX); + JCC(JNE, JE); break; - } - TESTid(ins->k, EAX); - JCC(JNE, JE); - break; - case BPF_JMP|BPF_JGT|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JGT|BPF_X: + CMPrd(EDX, EAX); + JCC(JA, JBE); break; - } - CMPrd(EDX, EAX); - JCC(JA, JBE); - break; - case BPF_JMP|BPF_JGE|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JGE|BPF_X: + CMPrd(EDX, EAX); + JCC(JAE, JB); break; - } - CMPrd(EDX, EAX); - JCC(JAE, JB); - break; - case BPF_JMP|BPF_JEQ|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JEQ|BPF_X: + CMPrd(EDX, EAX); + JCC(JE, JNE); break; - } - CMPrd(EDX, EAX); - JCC(JE, JNE); - break; - case BPF_JMP|BPF_JSET|BPF_X: - if (ins->jt == ins->jf) { - JUMP(ins->jt); + case BPF_JMP|BPF_JSET|BPF_X: + TESTrd(EDX, EAX); + JCC(JNE, JE); break; } - TESTrd(EDX, EAX); - JCC(JNE, JE); break; case BPF_ALU|BPF_ADD|BPF_X: From owner-svn-src-all@freebsd.org Fri Oct 21 06:32:47 2016 Return-Path: Delivered-To: svn-src-all@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 0E1ADC1B553; Fri, 21 Oct 2016 06:32:47 +0000 (UTC) (envelope-from sephe@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 D40A214A; Fri, 21 Oct 2016 06:32:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L6WkDU012841; Fri, 21 Oct 2016 06:32:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L6WkIw012840; Fri, 21 Oct 2016 06:32:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610210632.u9L6WkIw012840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 21 Oct 2016 06:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307706 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 06:32:47 -0000 Author: sephe Date: Fri Oct 21 06:32:45 2016 New Revision: 307706 URL: https://svnweb.freebsd.org/changeset/base/307706 Log: netmap: Unbreak LINT-VIMAGE building Sponsored by: Microsoft Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Fri Oct 21 06:09:30 2016 (r307705) +++ head/sys/dev/netmap/netmap_freebsd.c Fri Oct 21 06:32:45 2016 (r307706) @@ -27,10 +27,10 @@ #include "opt_inet.h" #include "opt_inet6.h" -#include +#include #include #include -#include /* defines used in kernel.h */ +#include #include /* POLLIN, POLLOUT */ #include /* types used in module initialization */ #include /* DEV_MODULE_ORDERED */ @@ -1407,7 +1407,7 @@ freebsd_netmap_ioctl(struct cdev *dev __ int error; struct netmap_priv_d *priv; - CURVNET_SET(TD_TO_VNET(rd)); + CURVNET_SET(TD_TO_VNET(td)); error = devfs_get_cdevpriv((void **)&priv); if (error) { /* XXX ENOENT should be impossible, since the priv From owner-svn-src-all@freebsd.org Fri Oct 21 06:55:09 2016 Return-Path: Delivered-To: svn-src-all@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 4A5CEC1B8D0; Fri, 21 Oct 2016 06:55:09 +0000 (UTC) (envelope-from jkim@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 0BB18C47; Fri, 21 Oct 2016 06:55:08 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L6t8hE020645; Fri, 21 Oct 2016 06:55:08 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L6t71c020639; Fri, 21 Oct 2016 06:55:07 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201610210655.u9L6t71c020639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 21 Oct 2016 06:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307707 - in head: share/man/man4 sys/amd64/amd64 sys/i386/i386 sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 06:55:09 -0000 Author: jkim Date: Fri Oct 21 06:55:07 2016 New Revision: 307707 URL: https://svnweb.freebsd.org/changeset/base/307707 Log: Implement BPF_MOD and BPF_XOR instructions. These two ALU instructions first appeared on Linux. Then, libpcap adopted and made them available since 1.6.2. Now more platforms including NetBSD have them in kernel. So do we. --ì´ ì¤„ ì´í•˜ëŠ” ìžë™ìœ¼ë¡œ 제거ë©ë‹ˆë‹¤-- > Description of fields to fill in above: 76 columns --| > PR: If and which Problem Report is related. > Submitted by: If someone else sent in the change. > Reported by: If someone else reported the issue. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > MFH: Ports tree branch name. Request approval for merge. > Relnotes: Set to 'yes' for mention in release notes. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization. > Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). > Empty fields above will be automatically removed. M share/man/man4/bpf.4 M sys/amd64/amd64/bpf_jit_machdep.c M sys/amd64/amd64/bpf_jit_machdep.h M sys/i386/i386/bpf_jit_machdep.c M sys/i386/i386/bpf_jit_machdep.h M sys/net/bpf_filter.c Modified: head/share/man/man4/bpf.4 head/sys/amd64/amd64/bpf_jit_machdep.c head/sys/amd64/amd64/bpf_jit_machdep.h head/sys/i386/i386/bpf_jit_machdep.c head/sys/i386/i386/bpf_jit_machdep.h head/sys/net/bpf_filter.c Modified: head/share/man/man4/bpf.4 ============================================================================== --- head/share/man/man4/bpf.4 Fri Oct 21 06:32:45 2016 (r307706) +++ head/share/man/man4/bpf.4 Fri Oct 21 06:55:07 2016 (r307707) @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 15, 2010 +.Dd October 21, 2016 .Dt BPF 4 .Os .Sh NAME @@ -881,16 +881,20 @@ BPF_ALU+BPF_ADD+BPF_K A <- A + k BPF_ALU+BPF_SUB+BPF_K A <- A - k BPF_ALU+BPF_MUL+BPF_K A <- A * k BPF_ALU+BPF_DIV+BPF_K A <- A / k +BPF_ALU+BPF_MOD+BPF_K A <- A % k BPF_ALU+BPF_AND+BPF_K A <- A & k BPF_ALU+BPF_OR+BPF_K A <- A | k +BPF_ALU+BPF_XOR+BPF_K A <- A ^ k BPF_ALU+BPF_LSH+BPF_K A <- A << k BPF_ALU+BPF_RSH+BPF_K A <- A >> k BPF_ALU+BPF_ADD+BPF_X A <- A + X BPF_ALU+BPF_SUB+BPF_X A <- A - X BPF_ALU+BPF_MUL+BPF_X A <- A * X BPF_ALU+BPF_DIV+BPF_X A <- A / X +BPF_ALU+BPF_MOD+BPF_X A <- A % X BPF_ALU+BPF_AND+BPF_X A <- A & X BPF_ALU+BPF_OR+BPF_X A <- A | X +BPF_ALU+BPF_XOR+BPF_X A <- A ^ X BPF_ALU+BPF_LSH+BPF_X A <- A << X BPF_ALU+BPF_RSH+BPF_X A <- A >> X BPF_ALU+BPF_NEG A <- -A Modified: head/sys/amd64/amd64/bpf_jit_machdep.c ============================================================================== --- head/sys/amd64/amd64/bpf_jit_machdep.c Fri Oct 21 06:32:45 2016 (r307706) +++ head/sys/amd64/amd64/bpf_jit_machdep.c Fri Oct 21 06:55:07 2016 (r307707) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy) - * Copyright (C) 2005-2009 Jung-uk Kim + * Copyright (C) 2005-2016 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -494,6 +494,7 @@ bpf_jit_compile(struct bpf_insn *prog, u break; case BPF_ALU|BPF_DIV|BPF_X: + case BPF_ALU|BPF_MOD|BPF_X: TESTrd(EDX, EDX); if (fmem) { JNEb(4); @@ -507,6 +508,8 @@ bpf_jit_compile(struct bpf_insn *prog, u MOVrd(EDX, ECX); ZEROrd(EDX); DIVrd(ECX); + if (BPF_OP(ins->code) == BPF_MOD) + MOVrd(EDX, EAX); MOVrd(ECX, EDX); break; @@ -518,6 +521,10 @@ bpf_jit_compile(struct bpf_insn *prog, u ORrd(EDX, EAX); break; + case BPF_ALU|BPF_XOR|BPF_X: + XORrd(EDX, EAX); + break; + case BPF_ALU|BPF_LSH|BPF_X: MOVrd(EDX, ECX); SHL_CLrb(EAX); @@ -544,10 +551,13 @@ bpf_jit_compile(struct bpf_insn *prog, u break; case BPF_ALU|BPF_DIV|BPF_K: + case BPF_ALU|BPF_MOD|BPF_K: MOVrd(EDX, ECX); ZEROrd(EDX); MOVid(ins->k, ESI); DIVrd(ESI); + if (BPF_OP(ins->code) == BPF_MOD) + MOVrd(EDX, EAX); MOVrd(ECX, EDX); break; @@ -559,6 +569,10 @@ bpf_jit_compile(struct bpf_insn *prog, u ORid(ins->k, EAX); break; + case BPF_ALU|BPF_XOR|BPF_K: + XORid(ins->k, EAX); + break; + case BPF_ALU|BPF_LSH|BPF_K: SHLib((ins->k) & 0xff, EAX); break; Modified: head/sys/amd64/amd64/bpf_jit_machdep.h ============================================================================== --- head/sys/amd64/amd64/bpf_jit_machdep.h Fri Oct 21 06:32:45 2016 (r307706) +++ head/sys/amd64/amd64/bpf_jit_machdep.h Fri Oct 21 06:55:07 2016 (r307707) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy) - * Copyright (C) 2005-2009 Jung-uk Kim + * Copyright (C) 2005-2016 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -357,6 +357,24 @@ typedef void (*emit_func)(bpf_bin_stream emitm(&stream, i32, 4); \ } while (0) +/* xorl sr32,dr32 */ +#define XORrd(sr32, dr32) do { \ + emitm(&stream, 0x31, 1); \ + emitm(&stream, \ + (3 << 6) | ((sr32 & 0x7) << 3) | (dr32 & 0x7), 1); \ +} while (0) + +/* xorl i32,r32 */ +#define XORid(i32, r32) do { \ + if (r32 == EAX) { \ + emitm(&stream, 0x35, 1); \ + } else { \ + emitm(&stream, 0x81, 1); \ + emitm(&stream, (25 << 3) | r32, 1); \ + } \ + emitm(&stream, i32, 4); \ +} while (0) + /* shll i8,r32 */ #define SHLib(i8, r32) do { \ emitm(&stream, 0xc1, 1); \ Modified: head/sys/i386/i386/bpf_jit_machdep.c ============================================================================== --- head/sys/i386/i386/bpf_jit_machdep.c Fri Oct 21 06:32:45 2016 (r307706) +++ head/sys/i386/i386/bpf_jit_machdep.c Fri Oct 21 06:55:07 2016 (r307707) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy) - * Copyright (C) 2005-2009 Jung-uk Kim + * Copyright (C) 2005-2016 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -139,6 +139,7 @@ bpf_jit_optimize(struct bpf_insn *prog, flags |= BPF_JIT_FJMP; break; case BPF_ALU|BPF_DIV|BPF_K: + case BPF_ALU|BPF_MOD|BPF_K: flags |= BPF_JIT_FADK; break; } @@ -515,6 +516,7 @@ bpf_jit_compile(struct bpf_insn *prog, u break; case BPF_ALU|BPF_DIV|BPF_X: + case BPF_ALU|BPF_MOD|BPF_X: TESTrd(EDX, EDX); if (save_esp) { if (fpkt) { @@ -536,6 +538,8 @@ bpf_jit_compile(struct bpf_insn *prog, u MOVrd(EDX, ECX); ZEROrd(EDX); DIVrd(ECX); + if (BPF_OP(ins->code) == BPF_MOD) + MOVrd(EDX, EAX); MOVrd(ECX, EDX); break; @@ -547,6 +551,10 @@ bpf_jit_compile(struct bpf_insn *prog, u ORrd(EDX, EAX); break; + case BPF_ALU|BPF_XOR|BPF_X: + XORrd(EDX, EAX); + break; + case BPF_ALU|BPF_LSH|BPF_X: MOVrd(EDX, ECX); SHL_CLrb(EAX); @@ -573,10 +581,13 @@ bpf_jit_compile(struct bpf_insn *prog, u break; case BPF_ALU|BPF_DIV|BPF_K: + case BPF_ALU|BPF_MOD|BPF_K: MOVrd(EDX, ECX); ZEROrd(EDX); MOVid(ins->k, ESI); DIVrd(ESI); + if (BPF_OP(ins->code) == BPF_MOD) + MOVrd(EDX, EAX); MOVrd(ECX, EDX); break; @@ -588,6 +599,10 @@ bpf_jit_compile(struct bpf_insn *prog, u ORid(ins->k, EAX); break; + case BPF_ALU|BPF_XOR|BPF_K: + XORid(ins->k, EAX); + break; + case BPF_ALU|BPF_LSH|BPF_K: SHLib((ins->k) & 0xff, EAX); break; Modified: head/sys/i386/i386/bpf_jit_machdep.h ============================================================================== --- head/sys/i386/i386/bpf_jit_machdep.h Fri Oct 21 06:32:45 2016 (r307706) +++ head/sys/i386/i386/bpf_jit_machdep.h Fri Oct 21 06:55:07 2016 (r307707) @@ -1,6 +1,6 @@ /*- * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy) - * Copyright (C) 2005-2009 Jung-uk Kim + * Copyright (C) 2005-2016 Jung-uk Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -302,6 +302,24 @@ typedef void (*emit_func)(bpf_bin_stream emitm(&stream, i32, 4); \ } while (0) +/* xorl sr32,dr32 */ +#define XORrd(sr32, dr32) do { \ + emitm(&stream, 0x31, 1); \ + emitm(&stream, \ + (3 << 6) | ((sr32 & 0x7) << 3) | (dr32 & 0x7), 1); \ +} while (0) + +/* xorl i32,r32 */ +#define XORid(i32, r32) do { \ + if (r32 == EAX) { \ + emitm(&stream, 0x35, 1); \ + } else { \ + emitm(&stream, 0x81, 1); \ + emitm(&stream, (25 << 3) | r32, 1); \ + } \ + emitm(&stream, i32, 4); \ +} while (0) + /* shll i8,r32 */ #define SHLib(i8, r32) do { \ emitm(&stream, 0xc1, 1); \ Modified: head/sys/net/bpf_filter.c ============================================================================== --- head/sys/net/bpf_filter.c Fri Oct 21 06:32:45 2016 (r307706) +++ head/sys/net/bpf_filter.c Fri Oct 21 06:55:07 2016 (r307707) @@ -434,6 +434,12 @@ bpf_filter(const struct bpf_insn *pc, u_ A /= X; continue; + case BPF_ALU|BPF_MOD|BPF_X: + if (X == 0) + return (0); + A %= X; + continue; + case BPF_ALU|BPF_AND|BPF_X: A &= X; continue; @@ -442,6 +448,10 @@ bpf_filter(const struct bpf_insn *pc, u_ A |= X; continue; + case BPF_ALU|BPF_XOR|BPF_X: + A ^= X; + continue; + case BPF_ALU|BPF_LSH|BPF_X: A <<= X; continue; @@ -466,6 +476,10 @@ bpf_filter(const struct bpf_insn *pc, u_ A /= pc->k; continue; + case BPF_ALU|BPF_MOD|BPF_K: + A %= pc->k; + continue; + case BPF_ALU|BPF_AND|BPF_K: A &= pc->k; continue; @@ -474,6 +488,10 @@ bpf_filter(const struct bpf_insn *pc, u_ A |= pc->k; continue; + case BPF_ALU|BPF_XOR|BPF_K: + A ^= pc->k; + continue; + case BPF_ALU|BPF_LSH|BPF_K: A <<= pc->k; continue; @@ -508,8 +526,8 @@ static const u_short bpf_code_map[] = { 0x1013, /* 0x60-0x6f: 1100100000001000 */ 0x1010, /* 0x70-0x7f: 0000100000001000 */ 0x0093, /* 0x80-0x8f: 1100100100000000 */ - 0x0000, /* 0x90-0x9f: 0000000000000000 */ - 0x0000, /* 0xa0-0xaf: 0000000000000000 */ + 0x1010, /* 0x90-0x9f: 0000100000001000 */ + 0x1010, /* 0xa0-0xaf: 0000100000001000 */ 0x0002, /* 0xb0-0xbf: 0100000000000000 */ 0x0000, /* 0xc0-0xcf: 0000000000000000 */ 0x0000, /* 0xd0-0xdf: 0000000000000000 */ @@ -577,7 +595,8 @@ bpf_validate(const struct bpf_insn *f, i /* * Check for constant division by 0. */ - if (p->code == (BPF_ALU|BPF_DIV|BPF_K) && p->k == 0) + if ((p->code == (BPF_ALU|BPF_DIV|BPF_K) || + p->code == (BPF_ALU|BPF_MOD|BPF_K)) && p->k == 0) return (0); } return (BPF_CLASS(f[len - 1].code) == BPF_RET); From owner-svn-src-all@freebsd.org Fri Oct 21 06:56:34 2016 Return-Path: Delivered-To: svn-src-all@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 85A4FC1B92D; Fri, 21 Oct 2016 06:56:34 +0000 (UTC) (envelope-from jkim@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 51B99DC9; Fri, 21 Oct 2016 06:56:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L6uXna020763; Fri, 21 Oct 2016 06:56:33 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L6uUGl020734; Fri, 21 Oct 2016 06:56:30 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201610210656.u9L6uUGl020734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 21 Oct 2016 06:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307708 - in head/tools/regression/bpf/bpf_filter: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 06:56:34 -0000 Author: jkim Date: Fri Oct 21 06:56:30 2016 New Revision: 307708 URL: https://svnweb.freebsd.org/changeset/base/307708 Log: Clean up and add some test cases for ALU instructions. Added: head/tools/regression/bpf/bpf_filter/tests/test0085.h (contents, props changed) head/tools/regression/bpf/bpf_filter/tests/test0086.h (contents, props changed) head/tools/regression/bpf/bpf_filter/tests/test0087.h (contents, props changed) head/tools/regression/bpf/bpf_filter/tests/test0088.h (contents, props changed) head/tools/regression/bpf/bpf_filter/tests/test0089.h (contents, props changed) head/tools/regression/bpf/bpf_filter/tests/test0090.h (contents, props changed) head/tools/regression/bpf/bpf_filter/tests/test0091.h (contents, props changed) Modified: head/tools/regression/bpf/bpf_filter/Makefile head/tools/regression/bpf/bpf_filter/bpf_test.c head/tools/regression/bpf/bpf_filter/tests/test0001.h head/tools/regression/bpf/bpf_filter/tests/test0002.h head/tools/regression/bpf/bpf_filter/tests/test0003.h head/tools/regression/bpf/bpf_filter/tests/test0004.h head/tools/regression/bpf/bpf_filter/tests/test0005.h head/tools/regression/bpf/bpf_filter/tests/test0006.h head/tools/regression/bpf/bpf_filter/tests/test0007.h head/tools/regression/bpf/bpf_filter/tests/test0008.h head/tools/regression/bpf/bpf_filter/tests/test0009.h head/tools/regression/bpf/bpf_filter/tests/test0010.h head/tools/regression/bpf/bpf_filter/tests/test0011.h head/tools/regression/bpf/bpf_filter/tests/test0012.h head/tools/regression/bpf/bpf_filter/tests/test0013.h head/tools/regression/bpf/bpf_filter/tests/test0014.h head/tools/regression/bpf/bpf_filter/tests/test0015.h head/tools/regression/bpf/bpf_filter/tests/test0016.h head/tools/regression/bpf/bpf_filter/tests/test0017.h head/tools/regression/bpf/bpf_filter/tests/test0018.h head/tools/regression/bpf/bpf_filter/tests/test0019.h head/tools/regression/bpf/bpf_filter/tests/test0020.h head/tools/regression/bpf/bpf_filter/tests/test0021.h head/tools/regression/bpf/bpf_filter/tests/test0022.h head/tools/regression/bpf/bpf_filter/tests/test0023.h head/tools/regression/bpf/bpf_filter/tests/test0024.h head/tools/regression/bpf/bpf_filter/tests/test0025.h head/tools/regression/bpf/bpf_filter/tests/test0026.h head/tools/regression/bpf/bpf_filter/tests/test0027.h head/tools/regression/bpf/bpf_filter/tests/test0028.h head/tools/regression/bpf/bpf_filter/tests/test0029.h head/tools/regression/bpf/bpf_filter/tests/test0030.h head/tools/regression/bpf/bpf_filter/tests/test0031.h head/tools/regression/bpf/bpf_filter/tests/test0032.h head/tools/regression/bpf/bpf_filter/tests/test0033.h head/tools/regression/bpf/bpf_filter/tests/test0034.h head/tools/regression/bpf/bpf_filter/tests/test0035.h head/tools/regression/bpf/bpf_filter/tests/test0036.h head/tools/regression/bpf/bpf_filter/tests/test0037.h head/tools/regression/bpf/bpf_filter/tests/test0038.h head/tools/regression/bpf/bpf_filter/tests/test0039.h head/tools/regression/bpf/bpf_filter/tests/test0040.h head/tools/regression/bpf/bpf_filter/tests/test0041.h head/tools/regression/bpf/bpf_filter/tests/test0042.h head/tools/regression/bpf/bpf_filter/tests/test0043.h head/tools/regression/bpf/bpf_filter/tests/test0044.h head/tools/regression/bpf/bpf_filter/tests/test0045.h head/tools/regression/bpf/bpf_filter/tests/test0046.h head/tools/regression/bpf/bpf_filter/tests/test0047.h head/tools/regression/bpf/bpf_filter/tests/test0048.h head/tools/regression/bpf/bpf_filter/tests/test0049.h head/tools/regression/bpf/bpf_filter/tests/test0050.h head/tools/regression/bpf/bpf_filter/tests/test0051.h head/tools/regression/bpf/bpf_filter/tests/test0052.h head/tools/regression/bpf/bpf_filter/tests/test0053.h head/tools/regression/bpf/bpf_filter/tests/test0054.h head/tools/regression/bpf/bpf_filter/tests/test0055.h head/tools/regression/bpf/bpf_filter/tests/test0056.h head/tools/regression/bpf/bpf_filter/tests/test0057.h head/tools/regression/bpf/bpf_filter/tests/test0058.h head/tools/regression/bpf/bpf_filter/tests/test0059.h head/tools/regression/bpf/bpf_filter/tests/test0060.h head/tools/regression/bpf/bpf_filter/tests/test0061.h head/tools/regression/bpf/bpf_filter/tests/test0062.h head/tools/regression/bpf/bpf_filter/tests/test0063.h head/tools/regression/bpf/bpf_filter/tests/test0064.h head/tools/regression/bpf/bpf_filter/tests/test0065.h head/tools/regression/bpf/bpf_filter/tests/test0066.h head/tools/regression/bpf/bpf_filter/tests/test0067.h head/tools/regression/bpf/bpf_filter/tests/test0068.h head/tools/regression/bpf/bpf_filter/tests/test0069.h head/tools/regression/bpf/bpf_filter/tests/test0070.h head/tools/regression/bpf/bpf_filter/tests/test0071.h head/tools/regression/bpf/bpf_filter/tests/test0072.h head/tools/regression/bpf/bpf_filter/tests/test0073.h head/tools/regression/bpf/bpf_filter/tests/test0074.h head/tools/regression/bpf/bpf_filter/tests/test0075.h head/tools/regression/bpf/bpf_filter/tests/test0076.h head/tools/regression/bpf/bpf_filter/tests/test0077.h head/tools/regression/bpf/bpf_filter/tests/test0078.h head/tools/regression/bpf/bpf_filter/tests/test0079.h head/tools/regression/bpf/bpf_filter/tests/test0080.h head/tools/regression/bpf/bpf_filter/tests/test0081.h head/tools/regression/bpf/bpf_filter/tests/test0082.h head/tools/regression/bpf/bpf_filter/tests/test0083.h head/tools/regression/bpf/bpf_filter/tests/test0084.h Modified: head/tools/regression/bpf/bpf_filter/Makefile ============================================================================== --- head/tools/regression/bpf/bpf_filter/Makefile Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/Makefile Fri Oct 21 06:56:30 2016 (r307708) @@ -20,9 +20,11 @@ TEST_CASES?= test0001 test0002 test0003 test0069 test0070 test0071 test0072 \ test0073 test0074 test0075 test0076 \ test0077 test0078 test0079 test0080 \ - test0081 test0082 test0083 test0084 + test0081 test0082 test0083 test0084 \ + test0085 test0086 test0087 test0088 \ + test0089 test0090 test0091 -SYSDIR?= ${.CURDIR}/../../../../sys +SYSDIR?= ${SRCTOP}/sys SRCS= ${.CURDIR}/bpf_test.c Modified: head/tools/regression/bpf/bpf_filter/bpf_test.c ============================================================================== --- head/tools/regression/bpf/bpf_filter/bpf_test.c Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/bpf_test.c Fri Oct 21 06:56:30 2016 (r307708) @@ -105,8 +105,8 @@ static const u_short bpf_code_map[] = { 0x1013, /* 0x60-0x6f: 1100100000001000 */ 0x1010, /* 0x70-0x7f: 0000100000001000 */ 0x0093, /* 0x80-0x8f: 1100100100000000 */ - 0x0000, /* 0x90-0x9f: 0000000000000000 */ - 0x0000, /* 0xa0-0xaf: 0000000000000000 */ + 0x1010, /* 0x90-0x9f: 0000100000001000 */ + 0x1010, /* 0xa0-0xaf: 0000100000001000 */ 0x0002, /* 0xb0-0xbf: 0100000000000000 */ 0x0000, /* 0xc0-0xcf: 0000000000000000 */ 0x0000, /* 0xd0-0xdf: 0000000000000000 */ @@ -176,7 +176,8 @@ bpf_validate(const struct bpf_insn *f, i /* * Check for constant division by 0. */ - if (p->code == (BPF_ALU|BPF_DIV|BPF_K) && p->k == 0) + if ((p->code == (BPF_ALU|BPF_DIV|BPF_K) || + p->code == (BPF_ALU|BPF_MOD|BPF_K)) && p->k == 0) return (0); } return (BPF_CLASS(f[len - 1].code) == BPF_RET); Modified: head/tools/regression/bpf/bpf_filter/tests/test0001.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0001.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0001.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,27 +5,27 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(0x55, 0), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 1; +static int invalid = 1; /* Expected return value */ -u_int expect = 0; +static u_int expect = 0; /* Expected signal */ -int expect_signal = SIGABRT; +static int expect_signal = SIGABRT; Modified: head/tools/regression/bpf/bpf_filter/tests/test0002.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0002.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0002.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,26 +5,26 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_RET+BPF_K, 0xdeadc0de), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xdeadc0de; +static u_int expect = 0xdeadc0de; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0003.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0003.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0003.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,27 +5,27 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xdeadc0de; +static u_int expect = 0xdeadc0de; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0004.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0004.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0004.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,27 +5,27 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x01, 0x23, 0x45, 0x67, 0x89, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0x23456789; +static u_int expect = 0x23456789; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0005.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0005.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0005.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,27 +5,27 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 1), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x01, 0x23, 0x45, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0x2345; +static u_int expect = 0x2345; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0006.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0006.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0006.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,27 +5,27 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 1), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x01, 0x23, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0x23; +static u_int expect = 0x23; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0007.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0007.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0007.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,27 +5,27 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_W+BPF_LEN, 0), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = 0xdeadc0de; +static u_int wirelen = 0xdeadc0de; /* Packet length passed on buffer */ -u_int buflen = 0xdeadc0de; +static u_int buflen = 0xdeadc0de; /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xdeadc0de; +static u_int expect = 0xdeadc0de; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0008.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0008.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0008.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,28 +5,28 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LDX+BPF_W+BPF_LEN, 0), BPF_STMT(BPF_MISC+BPF_TXA, 0), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = 0xdeadc0de; +static u_int wirelen = 0xdeadc0de; /* Packet length passed on buffer */ -u_int buflen = 0xdeadc0de; +static u_int buflen = 0xdeadc0de; /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xdeadc0de; +static u_int expect = 0xdeadc0de; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0009.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0009.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0009.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,28 +5,28 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LDX+BPF_IMM, 1), BPF_STMT(BPF_LD+BPF_W+BPF_IND, 1), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0x456789ab; +static u_int expect = 0x456789ab; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0010.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0010.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0010.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,28 +5,28 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LDX+BPF_IMM, 1), BPF_STMT(BPF_LD+BPF_H+BPF_IND, 1), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x01, 0x23, 0x45, 0x67, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0x4567; +static u_int expect = 0x4567; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0011.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0011.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0011.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,28 +5,28 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LDX+BPF_IMM, 1), BPF_STMT(BPF_LD+BPF_B+BPF_IND, 1), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x01, 0x23, 0x45, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0x45; +static u_int expect = 0x45; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0012.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0012.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0012.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,28 +5,28 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LDX+BPF_MSH+BPF_B, 1), BPF_STMT(BPF_MISC+BPF_TXA, 0), BPF_STMT(BPF_RET+BPF_A, 0), }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x01, 0x23, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = (0x23 & 0xf) << 2; +static u_int expect = (0x23 & 0xf) << 2; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0013.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0013.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0013.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), BPF_STMT(BPF_ST, 7), BPF_STMT(BPF_LDX+BPF_MEM, 7), @@ -14,21 +14,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xdeadc0de; +static u_int expect = 0xdeadc0de; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0014.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0014.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0014.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LDX+BPF_IMM, 0xdeadc0de), BPF_STMT(BPF_STX, 7), BPF_STMT(BPF_LD+BPF_MEM, 7), @@ -13,21 +13,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xdeadc0de; +static u_int expect = 0xdeadc0de; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0015.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0015.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0015.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xc0decafe), BPF_STMT(BPF_JMP+BPF_JA, 1), BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), @@ -13,21 +13,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0016.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0016.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0016.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_JUMP(BPF_JMP+BPF_JGT+BPF_K, 0x01234568, 2, 0), BPF_JUMP(BPF_JMP+BPF_JGT+BPF_K, 0x01234566, 2, 1), @@ -17,21 +17,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0017.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0017.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0017.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0x01234568, 2, 0), BPF_JUMP(BPF_JMP+BPF_JGE+BPF_K, 0x01234567, 2, 1), @@ -17,21 +17,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0018.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0018.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0018.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x01234568, 2, 0), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x01234567, 2, 1), @@ -17,21 +17,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0019.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0019.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0019.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_JUMP(BPF_JMP+BPF_JSET+BPF_K, 0x80000000, 5, 0), BPF_JUMP(BPF_JMP+BPF_JSET+BPF_K, 0x40000000, 4, 0), @@ -22,21 +22,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0020.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0020.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0020.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_STMT(BPF_LDX+BPF_IMM, 0x01234568), BPF_JUMP(BPF_JMP+BPF_JGT+BPF_X, 0, 3, 0), @@ -20,21 +20,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0021.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0021.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0021.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_STMT(BPF_LDX+BPF_IMM, 0x01234568), BPF_JUMP(BPF_JMP+BPF_JGE+BPF_X, 0, 3, 0), @@ -20,21 +20,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0022.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0022.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0022.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_STMT(BPF_LDX+BPF_IMM, 0x01234568), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_X, 0, 3, 0), @@ -20,21 +20,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0023.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0023.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0023.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0x01234567), BPF_STMT(BPF_LDX+BPF_IMM, 0x80000000), BPF_JUMP(BPF_JMP+BPF_JSET+BPF_X, 0, 9, 0), @@ -30,21 +30,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xc0decafe; +static u_int expect = 0xc0decafe; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0024.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0024.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0024.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xbeadb8dd), BPF_STMT(BPF_LDX+BPF_IMM, 0x20000801), BPF_STMT(BPF_ALU+BPF_ADD+BPF_X, 0), @@ -13,21 +13,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xdeadc0de; +static u_int expect = 0xdeadc0de; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0025.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0025.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0025.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ -struct bpf_insn pc[] = { +static struct bpf_insn pc[] = { BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), BPF_STMT(BPF_LDX+BPF_IMM, 0x20000801), BPF_STMT(BPF_ALU+BPF_SUB+BPF_X, 0), @@ -13,21 +13,21 @@ struct bpf_insn pc[] = { }; /* Packet */ -u_char pkt[] = { +static u_char pkt[] = { 0x00, }; /* Packet length seen on wire */ -u_int wirelen = sizeof(pkt); +static u_int wirelen = sizeof(pkt); /* Packet length passed on buffer */ -u_int buflen = sizeof(pkt); +static u_int buflen = sizeof(pkt); /* Invalid instruction */ -int invalid = 0; +static int invalid = 0; /* Expected return value */ -u_int expect = 0xbeadb8dd; +static u_int expect = 0xbeadb8dd; /* Expected signal */ -int expect_signal = 0; +static int expect_signal = 0; Modified: head/tools/regression/bpf/bpf_filter/tests/test0026.h ============================================================================== --- head/tools/regression/bpf/bpf_filter/tests/test0026.h Fri Oct 21 06:55:07 2016 (r307707) +++ head/tools/regression/bpf/bpf_filter/tests/test0026.h Fri Oct 21 06:56:30 2016 (r307708) @@ -5,7 +5,7 @@ */ /* BPF program */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Oct 21 07:35:50 2016 Return-Path: Delivered-To: svn-src-all@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 B9EA5C1A68F; Fri, 21 Oct 2016 07:35:50 +0000 (UTC) (envelope-from sephe@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 89D0D1622; Fri, 21 Oct 2016 07:35:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L7Znmu036991; Fri, 21 Oct 2016 07:35:49 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L7Znff036990; Fri, 21 Oct 2016 07:35:49 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610210735.u9L7Znff036990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 21 Oct 2016 07:35:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307709 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 07:35:50 -0000 Author: sephe Date: Fri Oct 21 07:35:49 2016 New Revision: 307709 URL: https://svnweb.freebsd.org/changeset/base/307709 Log: LINT: Unhook netmap from LINT-NOIP and LINT-NOINET temporarily. After fixing ptnet NOINET support, netmap can be linked back to these two LINTs. Sponsored by: Microsoft Modified: head/sys/conf/makeLINT.mk Modified: head/sys/conf/makeLINT.mk ============================================================================== --- head/sys/conf/makeLINT.mk Fri Oct 21 06:56:30 2016 (r307708) +++ head/sys/conf/makeLINT.mk Fri Oct 21 07:35:49 2016 (r307709) @@ -21,6 +21,7 @@ LINT: ${NOTES} ../../conf/makeLINT.sed echo 'makeoptions MKMODULESENV+="WITHOUT_INET_SUPPORT="' >> ${.TARGET}-NOINET echo "nooptions INET" >> ${.TARGET}-NOINET echo "nodevice gre" >> ${.TARGET}-NOINET + echo "nodevice netmap" >> ${.TARGET}-NOINET echo "include ${.TARGET}" > ${.TARGET}-NOINET6 echo "ident ${.TARGET}-NOINET6" >> ${.TARGET}-NOINET6 echo 'makeoptions MKMODULESENV+="WITHOUT_INET6_SUPPORT="' >> ${.TARGET}-NOINET6 @@ -45,6 +46,7 @@ LINT: ${NOTES} ../../conf/makeLINT.sed echo "nodevice sk" >> ${.TARGET}-NOIP echo "nodevice txp" >> ${.TARGET}-NOIP echo "nodevice vxge" >> ${.TARGET}-NOIP + echo "nodevice netmap" >> ${.TARGET}-NOIP .endif .if ${TARGET} == "mips" echo "machine ${TARGET} ${TARGET_ARCH}" >> ${.TARGET} From owner-svn-src-all@freebsd.org Fri Oct 21 07:37:31 2016 Return-Path: Delivered-To: svn-src-all@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 3BE2BC1A720; Fri, 21 Oct 2016 07:37:31 +0000 (UTC) (envelope-from sephe@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 14C2917AD; Fri, 21 Oct 2016 07:37:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L7bUXE037103; Fri, 21 Oct 2016 07:37:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L7bUrX037100; Fri, 21 Oct 2016 07:37:30 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610210737.u9L7bUrX037100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 21 Oct 2016 07:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307710 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 07:37:31 -0000 Author: sephe Date: Fri Oct 21 07:37:29 2016 New Revision: 307710 URL: https://svnweb.freebsd.org/changeset/base/307710 Log: hyperv/hn: Always query RSS capabilities. - This avoid distributing NDIS version check. - Only NDIS 6.20 required (earlier NDIS uses different indirect table format). MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8291 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnreg.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 07:35:49 2016 (r307709) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 07:37:29 2016 (r307710) @@ -3408,10 +3408,9 @@ hn_synth_alloc_subchans(struct hn_softc int nchan, rxr_cnt, error; nchan = *nsubch + 1; - if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30 || nchan == 1) { + if (nchan == 1) { /* - * Either RSS is not supported, or multiple RX/TX rings - * are not requested. + * Multiple RX/TX rings are not requested. */ *nsubch = 0; return (0); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 21 07:35:49 2016 (r307709) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 21 07:37:29 2016 (r307710) @@ -744,15 +744,13 @@ hn_rndis_get_rsscaps(struct hn_softc *sc *rxr_cnt = 0; + if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_20) + return (EOPNOTSUPP); + memset(&in, 0, sizeof(in)); in.ndis_hdr.ndis_type = NDIS_OBJTYPE_RSS_CAPS; - if (sc->hn_ndis_ver < HN_NDIS_VERSION_6_30) { - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_1; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE_6_0; - } else { - in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; - in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; - } + in.ndis_hdr.ndis_rev = NDIS_RSS_CAPS_REV_2; + in.ndis_hdr.ndis_size = NDIS_RSS_CAPS_SIZE; caps_len = NDIS_RSS_CAPS_SIZE; error = hn_rndis_query2(sc, OID_GEN_RECEIVE_SCALE_CAPABILITIES, @@ -1027,10 +1025,12 @@ hn_rndis_conf_rss(struct hn_softc *sc, u int error; /* - * Only NDIS 6.30+ is supported. + * Only NDIS 6.20+ is supported: + * We only support 4bytes element in indirect table, which has been + * adopted since NDIS 6.20. */ - KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30, - ("NDIS 6.30+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); + KASSERT(sc->hn_ndis_ver >= HN_NDIS_VERSION_6_20, + ("NDIS 6.20+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); /* * NOTE: Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Fri Oct 21 07:35:49 2016 (r307709) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Fri Oct 21 07:37:29 2016 (r307710) @@ -36,6 +36,7 @@ * NDIS protocol version numbers */ #define HN_NDIS_VERSION_6_1 0x00060001 +#define HN_NDIS_VERSION_6_20 0x00060014 #define HN_NDIS_VERSION_6_30 0x0006001e #define HN_NDIS_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16) #define HN_NDIS_VERSION_MINOR(ver) ((ver) & 0xffff) From owner-svn-src-all@freebsd.org Fri Oct 21 07:46:36 2016 Return-Path: Delivered-To: svn-src-all@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 DF127C1A9B9; Fri, 21 Oct 2016 07:46:36 +0000 (UTC) (envelope-from sephe@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 A260A1C6C; Fri, 21 Oct 2016 07:46:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L7kZ75041177; Fri, 21 Oct 2016 07:46:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L7kZsm041174; Fri, 21 Oct 2016 07:46:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610210746.u9L7kZsm041174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 21 Oct 2016 07:46:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307711 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 07:46:37 -0000 Author: sephe Date: Fri Oct 21 07:46:35 2016 New Revision: 307711 URL: https://svnweb.freebsd.org/changeset/base/307711 Log: hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8293 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 21 07:37:29 2016 (r307710) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Oct 21 07:46:35 2016 (r307711) @@ -544,8 +544,9 @@ hn_nvs_init(struct hn_softc *sc) if (error) { if_printf(sc->hn_ifp, "reinit NVS version 0x%x " "failed: %d\n", sc->hn_nvs_ver, error); + return (error); } - return (error); + goto done; } /* @@ -567,11 +568,16 @@ hn_nvs_init(struct hn_softc *sc) HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver), HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver)); } - return (0); + goto done; } } if_printf(sc->hn_ifp, "no NVS available\n"); return (ENXIO); + +done: + if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) + sc->hn_caps |= HN_CAP_HASHVAL; + return (0); } int Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 21 07:37:29 2016 (r307710) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 21 07:46:35 2016 (r307711) @@ -269,6 +269,7 @@ struct hn_softc { #define HN_CAP_UDP6CS 0x0040 #define HN_CAP_TSO4 0x0080 #define HN_CAP_TSO6 0x0100 +#define HN_CAP_HASHVAL 0x0200 /* * Externs Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 07:37:29 2016 (r307710) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 07:46:35 2016 (r307711) @@ -2233,7 +2233,8 @@ hn_caps_sysctl(SYSCTL_HANDLER_ARGS) "\006UDP4CS" "\007UDP6CS" "\010TSO4" - "\011TSO6"); + "\011TSO6" + "\012HASHVAL"); return sysctl_handle_string(oidp, caps_str, sizeof(caps_str), req); } @@ -3008,12 +3009,15 @@ hn_fixup_tx_data(struct hn_softc *sc) if (sc->hn_caps & HN_CAP_UDP6CS) csum_assist |= CSUM_IP6_UDP; #endif - for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_csum_assist = csum_assist; - if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) { - /* Support HASHVAL pktinfo on TX path. */ + if (sc->hn_caps & HN_CAP_HASHVAL) { + /* + * Support HASHVAL pktinfo on TX path. + */ + if (bootverbose) + if_printf(sc->hn_ifp, "support HASHVAL pktinfo\n"); for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_tx_flags |= HN_TX_FLAG_HASHVAL; } From owner-svn-src-all@freebsd.org Fri Oct 21 08:02:07 2016 Return-Path: Delivered-To: svn-src-all@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 05E8AC1803D; Fri, 21 Oct 2016 08:02:07 +0000 (UTC) (envelope-from sephe@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 D6CAA35B; Fri, 21 Oct 2016 08:02:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L826KO048395; Fri, 21 Oct 2016 08:02:06 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L825L1048389; Fri, 21 Oct 2016 08:02:05 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610210802.u9L825L1048389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 21 Oct 2016 08:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307712 - in head/sys: dev/hyperv/netvsc net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:02:07 -0000 Author: sephe Date: Fri Oct 21 08:02:05 2016 New Revision: 307712 URL: https://svnweb.freebsd.org/changeset/base/307712 Log: hyperv/hn: Add network change support. Currently the network change is simulated by link status changes. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8295 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnvar.h head/sys/dev/hyperv/netvsc/ndis.h head/sys/net/rndis.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 21 07:46:35 2016 (r307711) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Oct 21 08:02:05 2016 (r307712) @@ -207,7 +207,6 @@ struct hn_softc { struct ifnet *hn_ifp; struct ifmedia hn_media; device_t hn_dev; - int hn_carrier; int hn_if_flags; struct sx hn_lock; struct vmbus_channel *hn_prichan; @@ -236,6 +235,9 @@ struct hn_softc { struct taskqueue *hn_mgmt_taskq; struct taskqueue *hn_mgmt_taskq0; struct task hn_link_task; + struct task hn_netchg_init; + struct timeout_task hn_netchg_status; + uint32_t hn_link_flags; /* HN_LINK_FLAG_ */ uint32_t hn_caps; /* HN_CAP_ */ uint32_t hn_flags; /* HN_FLAG_ */ @@ -271,6 +273,9 @@ struct hn_softc { #define HN_CAP_TSO6 0x0100 #define HN_CAP_HASHVAL 0x0200 +#define HN_LINK_FLAG_LINKUP 0x0001 +#define HN_LINK_FLAG_NETCHG 0x0002 + /* * Externs */ Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 07:46:35 2016 (r307711) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 08:02:05 2016 (r307712) @@ -335,6 +335,8 @@ static void hn_destroy_tx_data(struct hn static void hn_start_taskfunc(void *, int); static void hn_start_txeof_taskfunc(void *, int); static void hn_link_taskfunc(void *, int); +static void hn_netchg_init_taskfunc(void *, int); +static void hn_netchg_status_taskfunc(void *, int); static void hn_suspend_mgmt_taskfunc(void *, int); static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **); static int hn_create_rx_data(struct hn_softc *sc, int); @@ -360,6 +362,7 @@ static void hn_rx_drain(struct vmbus_cha static void hn_tx_resume(struct hn_softc *, int); static void hn_tx_ring_qflush(struct hn_tx_ring *); static int netvsc_detach(device_t dev); +static void hn_link_status(struct hn_softc *); static void hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt); @@ -482,7 +485,7 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (!sc->hn_carrier) { + if ((sc->hn_link_flags & HN_LINK_FLAG_LINKUP) == 0) { ifmr->ifm_active |= IFM_NONE; return; } @@ -563,6 +566,9 @@ netvsc_attach(device_t dev) taskqueue_start_threads(&sc->hn_mgmt_taskq0, 1, PI_NET, "%s mgmt", device_get_nameunit(dev)); TASK_INIT(&sc->hn_link_task, 0, hn_link_taskfunc, sc); + TASK_INIT(&sc->hn_netchg_init, 0, hn_netchg_init_taskfunc, sc); + TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, + hn_netchg_status_taskfunc, sc); /* * Allocate ifnet and setup its name earlier, so that if_printf @@ -808,10 +814,8 @@ netvsc_shutdown(device_t dev) } static void -hn_link_taskfunc(void *xsc, int pending __unused) +hn_link_status(struct hn_softc *sc) { - struct hn_softc *sc = xsc; - struct ifnet *ifp = sc->hn_ifp; uint32_t link_status; int error; @@ -822,11 +826,51 @@ hn_link_taskfunc(void *xsc, int pending } if (link_status == NDIS_MEDIA_STATE_CONNECTED) - sc->hn_carrier = 1; + sc->hn_link_flags |= HN_LINK_FLAG_LINKUP; else - sc->hn_carrier = 0; - if_link_state_change(ifp, - sc->hn_carrier ? LINK_STATE_UP : LINK_STATE_DOWN); + sc->hn_link_flags &= ~HN_LINK_FLAG_LINKUP; + if_link_state_change(sc->hn_ifp, + (sc->hn_link_flags & HN_LINK_FLAG_LINKUP) ? + LINK_STATE_UP : LINK_STATE_DOWN); +} + +static void +hn_link_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG) + return; + hn_link_status(sc); +} + +static void +hn_netchg_init_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + /* Prevent any link status checks from running. */ + sc->hn_link_flags |= HN_LINK_FLAG_NETCHG; + + /* + * Fake up a [link down --> link up] state change; 5 seconds + * delay is used, which closely simulates miibus reaction + * upon link down event. + */ + sc->hn_link_flags &= ~HN_LINK_FLAG_LINKUP; + if_link_state_change(sc->hn_ifp, LINK_STATE_DOWN); + taskqueue_enqueue_timeout(sc->hn_mgmt_taskq0, + &sc->hn_netchg_status, 5 * hz); +} + +static void +hn_netchg_status_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + /* Re-allow link status checks. */ + sc->hn_link_flags &= ~HN_LINK_FLAG_NETCHG; + hn_link_status(sc); } void @@ -837,6 +881,14 @@ hn_link_status_update(struct hn_softc *s taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_link_task); } +void +hn_network_change(struct hn_softc *sc) +{ + + if (sc->hn_mgmt_taskq != NULL) + taskqueue_enqueue(sc->hn_mgmt_taskq, &sc->hn_netchg_init); +} + static __inline int hn_txdesc_dmamap_load(struct hn_tx_ring *txr, struct hn_txdesc *txd, struct mbuf **m_head, bus_dma_segment_t *segs, int *nsegs) @@ -3719,6 +3771,8 @@ hn_suspend_mgmt(struct hn_softc *sc) /* * Make sure that all pending management tasks are completed. */ + taskqueue_drain(sc->hn_mgmt_taskq0, &sc->hn_netchg_init); + taskqueue_drain_timeout(sc->hn_mgmt_taskq0, &sc->hn_netchg_status); taskqueue_drain_all(sc->hn_mgmt_taskq0); } @@ -3796,10 +3850,11 @@ hn_resume_mgmt(struct hn_softc *sc) { /* - * Kick off link status check. + * Kick off network change detection, which will + * do link status check too. */ sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; - hn_link_status_update(sc); + hn_network_change(sc); } static void Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 21 07:46:35 2016 (r307711) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 21 08:02:05 2016 (r307712) @@ -158,6 +158,7 @@ static void hv_rf_receive_indicate_status(struct hn_softc *sc, const void *data, int dlen) { const struct rndis_status_msg *msg; + int ofs; if (dlen < sizeof(*msg)) { if_printf(sc->hn_ifp, "invalid RNDIS status\n"); @@ -176,8 +177,19 @@ hv_rf_receive_indicate_status(struct hn_ break; case RNDIS_STATUS_NETWORK_CHANGE: - /* TODO */ - if_printf(sc->hn_ifp, "network changed\n"); + ofs = RNDIS_STBUFOFFSET_ABS(msg->rm_stbufoffset); + if (dlen < ofs + msg->rm_stbuflen || + msg->rm_stbuflen < sizeof(uint32_t)) { + if_printf(sc->hn_ifp, "network changed\n"); + } else { + uint32_t change; + + memcpy(&change, ((const uint8_t *)msg) + ofs, + sizeof(change)); + if_printf(sc->hn_ifp, "network changed, change %u\n", + change); + } + hn_network_change(sc); break; default: Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 21 07:46:35 2016 (r307711) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 21 08:02:05 2016 (r307712) @@ -139,6 +139,7 @@ int hn_rxpkt(struct hn_rx_ring *rxr, co const struct hn_recvinfo *info); void hn_chan_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); void hn_link_status_update(struct hn_softc *sc); +void hn_network_change(struct hn_softc *sc); extern struct hn_send_ctx hn_send_ctx_none; Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Fri Oct 21 07:46:35 2016 (r307711) +++ head/sys/dev/hyperv/netvsc/ndis.h Fri Oct 21 08:02:05 2016 (r307712) @@ -32,6 +32,10 @@ #define NDIS_MEDIA_STATE_CONNECTED 0 #define NDIS_MEDIA_STATE_DISCONNECTED 1 +#define NDIS_NETCHANGE_TYPE_POSSIBLE 1 +#define NDIS_NETCHANGE_TYPE_DEFINITE 2 +#define NDIS_NETCHANGE_TYPE_FROMMEDIA 3 + #define NDIS_OFFLOAD_SET_NOCHG 0 #define NDIS_OFFLOAD_SET_ON 1 #define NDIS_OFFLOAD_SET_OFF 2 Modified: head/sys/net/rndis.h ============================================================================== --- head/sys/net/rndis.h Fri Oct 21 07:46:35 2016 (r307711) +++ head/sys/net/rndis.h Fri Oct 21 08:02:05 2016 (r307712) @@ -320,6 +320,10 @@ struct rndis_status_msg { /* rndis_diag_info */ }; +/* stbuf offset from the beginning of rndis_status_msg. */ +#define RNDIS_STBUFOFFSET_ABS(ofs) \ + ((ofs) + __offsetof(struct rndis_status_msg, rm_status)) + /* * Immediately after rndis_status_msg.rm_stbufoffset, if a control * message is malformatted, or a packet message contains inappropriate From owner-svn-src-all@freebsd.org Fri Oct 21 08:12:19 2016 Return-Path: Delivered-To: svn-src-all@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 BB0EFC18240; Fri, 21 Oct 2016 08:12:19 +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 8B6A4C9E; Fri, 21 Oct 2016 08:12:19 +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 u9L8CIcm052112; Fri, 21 Oct 2016 08:12:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8CIZN052111; Fri, 21 Oct 2016 08:12:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210812.u9L8CIZN052111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307713 - head/tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:12:19 -0000 Author: ngie Date: Fri Oct 21 08:12:18 2016 New Revision: 307713 URL: https://svnweb.freebsd.org/changeset/base/307713 Log: Remove /usr/libexec/bsdinstall/hardening if MK_BSDINSTALL == no MFC after: 3 days Sponsored by: Dell EMC Isilon Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Oct 21 08:02:05 2016 (r307712) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Oct 21 08:12:18 2016 (r307713) @@ -676,6 +676,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-all@freebsd.org Fri Oct 21 08:21:24 2016 Return-Path: Delivered-To: svn-src-all@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 AFEF4C18725; Fri, 21 Oct 2016 08:21:24 +0000 (UTC) (envelope-from sephe@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 65AE336B; Fri, 21 Oct 2016 08:21:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9L8LNTn053214; Fri, 21 Oct 2016 08:21:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8LNS8053211; Fri, 21 Oct 2016 08:21:23 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201610210821.u9L8LNS8053211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 21 Oct 2016 08:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307714 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:21:24 -0000 Author: sephe Date: Fri Oct 21 08:21:23 2016 New Revision: 307714 URL: https://svnweb.freebsd.org/changeset/base/307714 Log: hyperv/hn: Function renaming; consistent w/ hardware capabilities query. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8296 Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis_filter.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 08:12:18 2016 (r307713) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 21 08:21:23 2016 (r307714) @@ -3473,10 +3473,10 @@ hn_synth_alloc_subchans(struct hn_softc } /* - * Get RSS capabilities, e.g. # of RX rings, and # of indirect + * Query RSS capabilities, e.g. # of RX rings, and # of indirect * table entries. */ - error = hn_rndis_get_rsscaps(sc, &rxr_cnt); + error = hn_rndis_query_rsscaps(sc, &rxr_cnt); if (error) { /* No RSS; this is benign. */ *nsubch = 0; Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 21 08:12:18 2016 (r307713) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Fri Oct 21 08:21:23 2016 (r307714) @@ -748,7 +748,7 @@ done: } int -hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt) +hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt) { struct ndis_rss_caps in, caps; size_t caps_len; Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 21 08:12:18 2016 (r307713) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Fri Oct 21 08:21:23 2016 (r307714) @@ -122,7 +122,7 @@ void hn_rndis_detach(struct hn_softc *s int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); void *hn_rndis_pktinfo_append(struct rndis_packet_msg *, size_t pktsize, size_t pi_dlen, uint32_t pi_type); -int hn_rndis_get_rsscaps(struct hn_softc *sc, int *rxr_cnt); +int hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t *eaddr); int hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status); From owner-svn-src-all@freebsd.org Fri Oct 21 08:22:40 2016 Return-Path: Delivered-To: svn-src-all@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 7FC84C1879E; Fri, 21 Oct 2016 08:22:40 +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 4F59583C; Fri, 21 Oct 2016 08:22:40 +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 u9L8MdHD055942; Fri, 21 Oct 2016 08:22:39 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8MdCw055941; Fri, 21 Oct 2016 08:22:39 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210822.u9L8MdCw055941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:22: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: r307715 - stable/11/tests/sys/mac/bsdextended X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:22:40 -0000 Author: ngie Date: Fri Oct 21 08:22:39 2016 New Revision: 307715 URL: https://svnweb.freebsd.org/changeset/base/307715 Log: MFC r305916,r305918: r305916: Make sure $TMPDIR is created with 0755 permissions This is required to ensure that the temporary script can be executed, as the default mode is apparently too restrictive r305918: Only chmod $TMPDIR if it's not /tmp This is a safety belt to ensure that the /tmp sticky bit stuff doesn't get whacked by accident if someone runs the script outright Modified: stable/11/tests/sys/mac/bsdextended/matches_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/mac/bsdextended/matches_test.sh ============================================================================== --- stable/11/tests/sys/mac/bsdextended/matches_test.sh Fri Oct 21 08:21:23 2016 (r307714) +++ stable/11/tests/sys/mac/bsdextended/matches_test.sh Fri Oct 21 08:22:39 2016 (r307715) @@ -36,6 +36,12 @@ if ! sysctl -N security.mac.bsdextended echo "1..0 # SKIP mac_bsdextended(4) support isn't available" exit 0 fi +if [ "$TMPDIR" != "/tmp" ]; then + if ! chmod -Rf 0755 $TMPDIR; then + echo "1..0 # SKIP failed to chmod $TMPDIR" + exit 0 + fi +fi if ! playground=$(mktemp -d $TMPDIR/tmp.XXXXXXX); then echo "1..0 # SKIP failed to create temporary directory" exit 0 From owner-svn-src-all@freebsd.org Fri Oct 21 08:25:04 2016 Return-Path: Delivered-To: svn-src-all@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 64F04C1888B; Fri, 21 Oct 2016 08:25:04 +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 33BEFAB2; Fri, 21 Oct 2016 08:25:04 +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 u9L8P3pi056186; Fri, 21 Oct 2016 08:25:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8P3fY056185; Fri, 21 Oct 2016 08:25:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210825.u9L8P3fY056185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:25:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307716 - stable/10/tests/sys/mac/bsdextended X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:25:04 -0000 Author: ngie Date: Fri Oct 21 08:25:03 2016 New Revision: 307716 URL: https://svnweb.freebsd.org/changeset/base/307716 Log: MFstable/11 r307715: MFC r305916,r305918: r305916: Make sure $TMPDIR is created with 0755 permissions This is required to ensure that the temporary script can be executed, as the default mode is apparently too restrictive r305918: Only chmod $TMPDIR if it's not /tmp This is a safety belt to ensure that the /tmp sticky bit stuff doesn't get whacked by accident if someone runs the script outright Modified: stable/10/tests/sys/mac/bsdextended/matches_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/mac/bsdextended/matches_test.sh ============================================================================== --- stable/10/tests/sys/mac/bsdextended/matches_test.sh Fri Oct 21 08:22:39 2016 (r307715) +++ stable/10/tests/sys/mac/bsdextended/matches_test.sh Fri Oct 21 08:25:03 2016 (r307716) @@ -36,6 +36,12 @@ if ! sysctl -N security.mac.bsdextended echo "1..0 # SKIP mac_bsdextended(4) support isn't available" exit 0 fi +if [ "$TMPDIR" != "/tmp" ]; then + if ! chmod -Rf 0755 $TMPDIR; then + echo "1..0 # SKIP failed to chmod $TMPDIR" + exit 0 + fi +fi if ! playground=$(mktemp -d $TMPDIR/tmp.XXXXXXX); then echo "1..0 # SKIP failed to create temporary directory" exit 0 From owner-svn-src-all@freebsd.org Fri Oct 21 08:29:18 2016 Return-Path: Delivered-To: svn-src-all@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 80C36C18959; Fri, 21 Oct 2016 08:29: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 51CECD60; Fri, 21 Oct 2016 08:29: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 u9L8TH3v056476; Fri, 21 Oct 2016 08:29:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8THF2056474; Fri, 21 Oct 2016 08:29:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210829.u9L8THF2056474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:29:17 +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: r307717 - in stable/11/lib/libc/tests: iconv net/getaddrinfo X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:29:18 -0000 Author: ngie Date: Fri Oct 21 08:29:17 2016 New Revision: 307717 URL: https://svnweb.freebsd.org/changeset/base/307717 Log: MFC r305919: Don't define PACKAGE in lib/libc/tests/{iconv,net/getaddrinfo} needlessly This is already being done by bsd.test.mk The other subdirectory Makefiles were intentionally left alone Modified: stable/11/lib/libc/tests/iconv/Makefile stable/11/lib/libc/tests/net/getaddrinfo/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/iconv/Makefile ============================================================================== --- stable/11/lib/libc/tests/iconv/Makefile Fri Oct 21 08:25:03 2016 (r307716) +++ stable/11/lib/libc/tests/iconv/Makefile Fri Oct 21 08:29:17 2016 (r307717) @@ -1,7 +1,5 @@ # $FreeBSD$ -PACKAGE= tests - TESTSDIR= ${TESTSBASE}/lib/libc/iconv ATF_TESTS_C+= iconvctl_test Modified: stable/11/lib/libc/tests/net/getaddrinfo/Makefile ============================================================================== --- stable/11/lib/libc/tests/net/getaddrinfo/Makefile Fri Oct 21 08:25:03 2016 (r307716) +++ stable/11/lib/libc/tests/net/getaddrinfo/Makefile Fri Oct 21 08:29:17 2016 (r307717) @@ -1,7 +1,5 @@ # $FreeBSD$ -PACKAGE= tests - TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/net/${.CURDIR:T} .include From owner-svn-src-all@freebsd.org Fri Oct 21 08:31:16 2016 Return-Path: Delivered-To: svn-src-all@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 AAA91C18A29; Fri, 21 Oct 2016 08:31:16 +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 6009AF66; Fri, 21 Oct 2016 08:31:16 +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 u9L8VF5E056654; Fri, 21 Oct 2016 08:31:15 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8VFe8056652; Fri, 21 Oct 2016 08:31:15 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210831.u9L8VFe8056652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:31: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: r307718 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:31:16 -0000 Author: ngie Date: Fri Oct 21 08:31:15 2016 New Revision: 307718 URL: https://svnweb.freebsd.org/changeset/base/307718 Log: MFC r305920: Remove spurious newlines from atf_tc_fail calls This changes the results from broken (incorrect) to failed (correct) on i386 Modified: stable/11/lib/libc/tests/stdio/printbasic_test.c stable/11/lib/libc/tests/stdio/printfloat_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/stdio/printbasic_test.c ============================================================================== --- stable/11/lib/libc/tests/stdio/printbasic_test.c Fri Oct 21 08:29:17 2016 (r307717) +++ stable/11/lib/libc/tests/stdio/printbasic_test.c Fri Oct 21 08:31:15 2016 (r307718) @@ -80,7 +80,7 @@ _testfmt(const char *result, const char vsnprintf(s, sizeof(s), fmt, ap); if (strcmp(result, s) != 0) { atf_tc_fail( - "printf(\"%s\", %s) ==> [%s], expected [%s]\n", + "printf(\"%s\", %s) ==> [%s], expected [%s]", fmt, argstr, s, result); } @@ -91,7 +91,7 @@ _testfmt(const char *result, const char vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); if (wcscmp(wresult, ws) != 0) { atf_tc_fail( - "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]\n", + "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", wfmt, argstr, ws, wresult); } va_end(ap); Modified: stable/11/lib/libc/tests/stdio/printfloat_test.c ============================================================================== --- stable/11/lib/libc/tests/stdio/printfloat_test.c Fri Oct 21 08:29:17 2016 (r307717) +++ stable/11/lib/libc/tests/stdio/printfloat_test.c Fri Oct 21 08:31:15 2016 (r307718) @@ -72,7 +72,7 @@ _testfmt(const char *result, const char vsnprintf(s, sizeof(s), fmt, ap); if (strcmp(result, s) != 0) { atf_tc_fail( - "printf(\"%s\", %s) ==> [%s], expected [%s]\n", + "printf(\"%s\", %s) ==> [%s], expected [%s]", fmt, argstr, s, result); } @@ -83,7 +83,7 @@ _testfmt(const char *result, const char vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); if (wcscmp(wresult, ws) != 0) { atf_tc_fail( - "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]\n", + "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", wfmt, argstr, ws, wresult); } va_end(ap); From owner-svn-src-all@freebsd.org Fri Oct 21 08:32:28 2016 Return-Path: Delivered-To: svn-src-all@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 15635C18BD6; Fri, 21 Oct 2016 08:32:28 +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 BE7AF3D5; Fri, 21 Oct 2016 08:32:27 +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 u9L8WQsu060129; Fri, 21 Oct 2016 08:32:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8WQl9060128; Fri, 21 Oct 2016 08:32:26 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210832.u9L8WQl9060128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307719 - stable/10/lib/libc/tests/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:32:28 -0000 Author: ngie Date: Fri Oct 21 08:32:26 2016 New Revision: 307719 URL: https://svnweb.freebsd.org/changeset/base/307719 Log: MFstable/11 r307718: MFC r305920: Remove spurious newlines from atf_tc_fail calls This changes the results from broken (incorrect) to failed (correct) on i386 Modified: stable/10/lib/libc/tests/stdio/printbasic_test.c stable/10/lib/libc/tests/stdio/printfloat_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/stdio/printbasic_test.c ============================================================================== --- stable/10/lib/libc/tests/stdio/printbasic_test.c Fri Oct 21 08:31:15 2016 (r307718) +++ stable/10/lib/libc/tests/stdio/printbasic_test.c Fri Oct 21 08:32:26 2016 (r307719) @@ -80,7 +80,7 @@ _testfmt(const char *result, const char vsnprintf(s, sizeof(s), fmt, ap); if (strcmp(result, s) != 0) { atf_tc_fail( - "printf(\"%s\", %s) ==> [%s], expected [%s]\n", + "printf(\"%s\", %s) ==> [%s], expected [%s]", fmt, argstr, s, result); } @@ -91,7 +91,7 @@ _testfmt(const char *result, const char vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); if (wcscmp(wresult, ws) != 0) { atf_tc_fail( - "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]\n", + "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", wfmt, argstr, ws, wresult); } va_end(ap); Modified: stable/10/lib/libc/tests/stdio/printfloat_test.c ============================================================================== --- stable/10/lib/libc/tests/stdio/printfloat_test.c Fri Oct 21 08:31:15 2016 (r307718) +++ stable/10/lib/libc/tests/stdio/printfloat_test.c Fri Oct 21 08:32:26 2016 (r307719) @@ -72,7 +72,7 @@ _testfmt(const char *result, const char vsnprintf(s, sizeof(s), fmt, ap); if (strcmp(result, s) != 0) { atf_tc_fail( - "printf(\"%s\", %s) ==> [%s], expected [%s]\n", + "printf(\"%s\", %s) ==> [%s], expected [%s]", fmt, argstr, s, result); } @@ -83,7 +83,7 @@ _testfmt(const char *result, const char vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); if (wcscmp(wresult, ws) != 0) { atf_tc_fail( - "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]\n", + "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", wfmt, argstr, ws, wresult); } va_end(ap); From owner-svn-src-all@freebsd.org Fri Oct 21 08:33:53 2016 Return-Path: Delivered-To: svn-src-all@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 13D50C18C88; Fri, 21 Oct 2016 08:33:53 +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 D94E28BF; Fri, 21 Oct 2016 08:33:52 +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 u9L8XquT060341; Fri, 21 Oct 2016 08:33:52 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8Xp5i060340; Fri, 21 Oct 2016 08:33:51 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210833.u9L8Xp5i060340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:33:51 +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: r307720 - in stable/11/lib/libc/tests: net/getaddrinfo 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:33:53 -0000 Author: ngie Date: Fri Oct 21 08:33:51 2016 New Revision: 307720 URL: https://svnweb.freebsd.org/changeset/base/307720 Log: MFC r305961: Re-add PACKAGE=> tests to lib/libc/tests/net/getaddrinfo/Makefile and add it to lib/libc/tests/sys/Makefile [*] Even though make -VPACKAGE and make -n install seem to do the right thing, the effects are a bit different, depending on the build host. Obtained from: HardenedBSD (af602f0db) [*] Modified: stable/11/lib/libc/tests/net/getaddrinfo/Makefile stable/11/lib/libc/tests/sys/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/net/getaddrinfo/Makefile ============================================================================== --- stable/11/lib/libc/tests/net/getaddrinfo/Makefile Fri Oct 21 08:32:26 2016 (r307719) +++ stable/11/lib/libc/tests/net/getaddrinfo/Makefile Fri Oct 21 08:33:51 2016 (r307720) @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= tests + TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/net/${.CURDIR:T} .include Modified: stable/11/lib/libc/tests/sys/Makefile ============================================================================== --- stable/11/lib/libc/tests/sys/Makefile Fri Oct 21 08:32:26 2016 (r307719) +++ stable/11/lib/libc/tests/sys/Makefile Fri Oct 21 08:33:51 2016 (r307720) @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= tests + .include ATF_TESTS_C+= queue_test From owner-svn-src-all@freebsd.org Fri Oct 21 08:35:22 2016 Return-Path: Delivered-To: svn-src-all@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 3474CC18D43; Fri, 21 Oct 2016 08:35: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 05F6AB18; Fri, 21 Oct 2016 08:35: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 u9L8ZL7A060550; Fri, 21 Oct 2016 08:35:21 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8ZLFx060549; Fri, 21 Oct 2016 08:35:21 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210835.u9L8ZLFx060549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:35: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: r307721 - in stable/11/libexec/atf: atf-check atf-sh X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:35:22 -0000 Author: ngie Date: Fri Oct 21 08:35:20 2016 New Revision: 307721 URL: https://svnweb.freebsd.org/changeset/base/307721 Log: MFC r306029: Use SRCTOP instead of the longhand version for defining the path to contrib/atf Modified: stable/11/libexec/atf/atf-check/Makefile stable/11/libexec/atf/atf-sh/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/atf/atf-check/Makefile ============================================================================== --- stable/11/libexec/atf/atf-check/Makefile Fri Oct 21 08:33:51 2016 (r307720) +++ stable/11/libexec/atf/atf-check/Makefile Fri Oct 21 08:35:20 2016 (r307721) @@ -28,7 +28,7 @@ .include .include -ATF= ${.CURDIR:H:H:H}/contrib/atf +ATF= ${SRCTOP}/contrib/atf .PATH: ${ATF}/atf-sh PROG_CXX= atf-check Modified: stable/11/libexec/atf/atf-sh/Makefile ============================================================================== --- stable/11/libexec/atf/atf-sh/Makefile Fri Oct 21 08:33:51 2016 (r307720) +++ stable/11/libexec/atf/atf-sh/Makefile Fri Oct 21 08:35:20 2016 (r307721) @@ -28,7 +28,7 @@ .include .include -ATF= ${.CURDIR:H:H:H}/contrib/atf +ATF= ${SRCTOP}/contrib/atf .PATH: ${ATF}/atf-sh PROG_CXX= atf-sh From owner-svn-src-all@freebsd.org Fri Oct 21 08:36:32 2016 Return-Path: Delivered-To: svn-src-all@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 0B55DC18E5A; Fri, 21 Oct 2016 08:36:32 +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 CD7E9E3F; Fri, 21 Oct 2016 08:36:31 +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 u9L8aUox060824; Fri, 21 Oct 2016 08:36:30 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8aUC6060823; Fri, 21 Oct 2016 08:36:30 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210836.u9L8aUC6060823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307722 - in stable/10/libexec/atf: atf-check atf-sh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:36:32 -0000 Author: ngie Date: Fri Oct 21 08:36:30 2016 New Revision: 307722 URL: https://svnweb.freebsd.org/changeset/base/307722 Log: MFstable/11 r307721: MFC r306029: Use SRCTOP instead of the longhand version for defining the path to contrib/atf Modified: stable/10/libexec/atf/atf-check/Makefile stable/10/libexec/atf/atf-sh/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/atf/atf-check/Makefile ============================================================================== --- stable/10/libexec/atf/atf-check/Makefile Fri Oct 21 08:35:20 2016 (r307721) +++ stable/10/libexec/atf/atf-check/Makefile Fri Oct 21 08:36:30 2016 (r307722) @@ -27,7 +27,7 @@ .include -ATF= ${.CURDIR:H:H:H}/contrib/atf +ATF= ${SRCTOP}/contrib/atf .PATH: ${ATF}/atf-sh PROG_CXX= atf-check Modified: stable/10/libexec/atf/atf-sh/Makefile ============================================================================== --- stable/10/libexec/atf/atf-sh/Makefile Fri Oct 21 08:35:20 2016 (r307721) +++ stable/10/libexec/atf/atf-sh/Makefile Fri Oct 21 08:36:30 2016 (r307722) @@ -27,7 +27,7 @@ .include -ATF= ${.CURDIR:H:H:H}/contrib/atf +ATF= ${SRCTOP}/contrib/atf .PATH: ${ATF}/atf-sh PROG_CXX= atf-sh From owner-svn-src-all@freebsd.org Fri Oct 21 08:38:20 2016 Return-Path: Delivered-To: svn-src-all@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 44801C18F30; Fri, 21 Oct 2016 08:38:20 +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 14520DC; Fri, 21 Oct 2016 08:38:20 +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 u9L8cJpG060955; Fri, 21 Oct 2016 08:38:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8cJ4d060954; Fri, 21 Oct 2016 08:38:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210838.u9L8cJ4d060954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:38: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: r307723 - stable/11/tests/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:38:20 -0000 Author: ngie Date: Fri Oct 21 08:38:18 2016 New Revision: 307723 URL: https://svnweb.freebsd.org/changeset/base/307723 Log: MFC r305963,r305970: r305963: Reindent TESTSDIR definition for consistency/readability r305970: Remove change accidentally committed via r305963 for upcoming tests/sys/fs/... work Modified: stable/11/tests/sys/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/Makefile ============================================================================== --- stable/11/tests/sys/Makefile Fri Oct 21 08:36:30 2016 (r307722) +++ stable/11/tests/sys/Makefile Fri Oct 21 08:38:18 2016 (r307723) @@ -1,6 +1,6 @@ # $FreeBSD$ -TESTSDIR= ${TESTSBASE}/sys +TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio From owner-svn-src-all@freebsd.org Fri Oct 21 08:40:25 2016 Return-Path: Delivered-To: svn-src-all@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 46C28C1B05B; Fri, 21 Oct 2016 08:40: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 1861B6D1; Fri, 21 Oct 2016 08:40: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 u9L8eOMQ061290; Fri, 21 Oct 2016 08:40:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L8eOLH061289; Fri, 21 Oct 2016 08:40:24 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201610210840.u9L8eOLH061289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 21 Oct 2016 08:40: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: r307724 - stable/11/usr.bin/sed/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 08:40:25 -0000 Author: ngie Date: Fri Oct 21 08:40:24 2016 New Revision: 307724 URL: https://svnweb.freebsd.org/changeset/base/307724 Log: MFC r303367: Testcase 7.8 no longer needs to be marked TODO It passes out of the box today Modified: stable/11/usr.bin/sed/tests/multi_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sed/tests/multi_test.sh ============================================================================== --- stable/11/usr.bin/sed/tests/multi_test.sh Fri Oct 21 08:38:18 2016 (r307723) +++ stable/11/usr.bin/sed/tests/multi_test.sh Fri Oct 21 08:40:24 2016 (r307724) @@ -383,7 +383,6 @@ test_print() mark '7.8' echo line1 > lines3 echo "" >> lines3 - TODO=1 $SED -n -e '$p' lines3 /dev/null } From owner-svn-src-all@freebsd.org Fri Oct 21 09:15:35 2016 Return-Path: Delivered-To: svn-src-all@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 A5734C1BB63; Fri, 21 Oct 2016 09:15:35 +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 74423155E; Fri, 21 Oct 2016 09:15:35 +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 u9L9FYWf077382; Fri, 21 Oct 2016 09:15:34 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9L9FYtc077381; Fri, 21 Oct 2016 09:15:34 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610210915.u9L9FYtc077381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 21 Oct 2016 09:15:34 +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: r307725 - stable/11/sys/boot/userboot/userboot X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 09:15:35 -0000 Author: bapt Date: Fri Oct 21 09:15:34 2016 New Revision: 307725 URL: https://svnweb.freebsd.org/changeset/base/307725 Log: MFC: r307316 Fix build WITHOUT_FORTH Sponsored by: Gandi.net Modified: stable/11/sys/boot/userboot/userboot/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/userboot/userboot/Makefile ============================================================================== --- stable/11/sys/boot/userboot/userboot/Makefile Fri Oct 21 08:40:24 2016 (r307724) +++ stable/11/sys/boot/userboot/userboot/Makefile Fri Oct 21 09:15:34 2016 (r307725) @@ -49,9 +49,10 @@ BOOT_FORTH= yes CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 CFLAGS+= -DBF_DICTSIZE=15000 LIBFICL= ${.OBJDIR}/../ficl/libficl.a -LIBSTAND= ${.OBJDIR}/../libstand/libstand.a .endif +LIBSTAND= ${.OBJDIR}/../libstand/libstand.a + .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT LIBZFSBOOT= ${.OBJDIR}/../zfs/libzfsboot.a From owner-svn-src-all@freebsd.org Fri Oct 21 10:32:59 2016 Return-Path: Delivered-To: svn-src-all@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 00B48C1B2AE; Fri, 21 Oct 2016 10:32:59 +0000 (UTC) (envelope-from tuexen@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 CC30E19B; Fri, 21 Oct 2016 10:32:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LAWv2Q007883; Fri, 21 Oct 2016 10:32:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LAWv4k007879; Fri, 21 Oct 2016 10:32:57 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201610211032.u9LAWv4k007879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 21 Oct 2016 10:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307726 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 10:32:59 -0000 Author: tuexen Date: Fri Oct 21 10:32:57 2016 New Revision: 307726 URL: https://svnweb.freebsd.org/changeset/base/307726 Log: Make ICMPv6 hard error handling for TCP consistent with the ICMPv4 handling. Ensure that: * Protocol unreachable errors are handled by indicating ECONNREFUSED to the TCP user for both IPv4 and IPv6. These were ignored for IPv6. * Communication prohibited errors are handled by indicating ECONNREFUSED to the TCP user for both IPv4 and IPv6. These were ignored for IPv6. * Hop Limited exceeded errors are handled by indicating EHOSTUNREACH to the TCP user for both IPv4 and IPv6. For IPv6 the TCP connected was dropped but errno wasn't set. Reviewed by: gallatin, rrs MFC after: 1 month Sponsored by: Netflix Differential Revision: 7904 Modified: head/sys/netinet/ip_icmp.c head/sys/netinet/tcp_subr.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_input.c Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Fri Oct 21 09:15:34 2016 (r307725) +++ head/sys/netinet/ip_icmp.c Fri Oct 21 10:32:57 2016 (r307726) @@ -457,6 +457,8 @@ icmp_input(struct mbuf **mp, int *offp, * Treat subcodes 2,3 as immediate RST */ case ICMP_UNREACH_PROTOCOL: + code = PRC_UNREACH_PROTOCOL; + break; case ICMP_UNREACH_PORT: code = PRC_UNREACH_PORT; break; Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Fri Oct 21 09:15:34 2016 (r307725) +++ head/sys/netinet/tcp_subr.c Fri Oct 21 10:32:57 2016 (r307726) @@ -1968,7 +1968,8 @@ tcp_ctlinput(int cmd, struct sockaddr *s if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc_notify; else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || - cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && ip) + cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || + cmd == PRC_TIMXCEED_INTRANS) && ip) notify = tcp_drop_syn_sent; /* @@ -2100,8 +2101,8 @@ tcp6_ctlinput(int cmd, struct sockaddr * if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc_notify; else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || - cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && - ip6 != NULL) + cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || + cmd == PRC_TIMXCEED_INTRANS) && ip6 != NULL) notify = tcp_drop_syn_sent; /* Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Fri Oct 21 09:15:34 2016 (r307725) +++ head/sys/netinet6/icmp6.c Fri Oct 21 10:32:57 2016 (r307726) @@ -490,7 +490,7 @@ icmp6_input(struct mbuf **mp, int *offp, break; case ICMP6_DST_UNREACH_ADMIN: icmp6_ifstat_inc(ifp, ifs6_in_adminprohib); - code = PRC_UNREACH_PROTOCOL; /* is this a good code? */ + code = PRC_UNREACH_ADMIN_PROHIB; break; case ICMP6_DST_UNREACH_BEYONDSCOPE: /* I mean "source address was incorrect." */ Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Oct 21 09:15:34 2016 (r307725) +++ head/sys/netinet6/ip6_input.c Fri Oct 21 10:32:57 2016 (r307726) @@ -1772,6 +1772,6 @@ u_char inet6ctlerrmap[PRC_NCMDS] = { 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, EMSGSIZE, EHOSTUNREACH, 0, 0, - 0, 0, 0, 0, - ENOPROTOOPT + 0, 0, EHOSTUNREACH, 0, + ENOPROTOOPT, ECONNREFUSED }; From owner-svn-src-all@freebsd.org Fri Oct 21 11:29:26 2016 Return-Path: Delivered-To: svn-src-all@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 B811BC1B82D; Fri, 21 Oct 2016 11:29:26 +0000 (UTC) (envelope-from tuexen@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 80A122FD; Fri, 21 Oct 2016 11:29:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LBTPxH026993; Fri, 21 Oct 2016 11:29:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LBTPbb026992; Fri, 21 Oct 2016 11:29:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201610211129.u9LBTPbb026992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 21 Oct 2016 11:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307727 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 11:29:26 -0000 Author: tuexen Date: Fri Oct 21 11:29:25 2016 New Revision: 307727 URL: https://svnweb.freebsd.org/changeset/base/307727 Log: Document the TCP sysctl variables insecure_rst and insecure_syn. MFC after: 1 month Sponsored by: netflix Modified: head/share/man/man4/tcp.4 Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Fri Oct 21 10:32:57 2016 (r307726) +++ head/share/man/man4/tcp.4 Fri Oct 21 11:29:25 2016 (r307727) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 28, 2016 +.Dd October 21, 2016 .Dt TCP 4 .Os .Sh NAME @@ -586,6 +586,12 @@ downshift. List of available TCP function blocks (TCP stacks). .It Va functions_default The default TCP function block (TCP stack). +.It Va insecure_rst +Use criterias defined in RFC793 instead of RFC5961 for accepting RST segments. +Default is false. +.It Va insecure_syn +Use criterias defined in RFC793 instead of RFC5961 for accepting SYN segments. +Default is false. .El .Sh ERRORS A socket operation may fail with one of the following errors returned: From owner-svn-src-all@freebsd.org Fri Oct 21 13:51:49 2016 Return-Path: Delivered-To: svn-src-all@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 5008AC1BE2D; Fri, 21 Oct 2016 13:51:49 +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 19A7CB04; Fri, 21 Oct 2016 13:51:49 +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 u9LDpmBS098628; Fri, 21 Oct 2016 13:51:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LDpmAH098627; Fri, 21 Oct 2016 13:51:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610211351.u9LDpmAH098627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 21 Oct 2016 13:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307728 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 13:51:49 -0000 Author: emaste Date: Fri Oct 21 13:51:47 2016 New Revision: 307728 URL: https://svnweb.freebsd.org/changeset/base/307728 Log: netmap: fix kernel build on GCC-using architectures GCC produced a multiple declaration warning from the SYSCTL_DECL(_dev_netmap). Modified: head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Fri Oct 21 11:29:25 2016 (r307727) +++ head/sys/dev/netmap/netmap_mem2.c Fri Oct 21 13:51:47 2016 (r307728) @@ -502,7 +502,6 @@ static const struct netmap_mem_d nm_blue #define DECLARE_SYSCTLS(id, name) \ SYSBEGIN(mem2_ ## name); \ - SYSCTL_DECL(_dev_netmap); /* leave it here, easier for porting */ \ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_size, \ CTLFLAG_RW, &netmap_params[id].size, 0, "Requested size of netmap " STRINGIFY(name) "s"); \ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_curr_size, \ @@ -519,6 +518,7 @@ static const struct netmap_mem_d nm_blue "Default number of private netmap " STRINGIFY(name) "s"); \ SYSEND +SYSCTL_DECL(_dev_netmap); DECLARE_SYSCTLS(NETMAP_IF_POOL, if); DECLARE_SYSCTLS(NETMAP_RING_POOL, ring); DECLARE_SYSCTLS(NETMAP_BUF_POOL, buf); From owner-svn-src-all@freebsd.org Fri Oct 21 14:28:28 2016 Return-Path: Delivered-To: svn-src-all@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 6B596C1BA1D; Fri, 21 Oct 2016 14:28:28 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id 5D6DB192; Fri, 21 Oct 2016 14:28:28 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id D320F17AFC; Fri, 21 Oct 2016 07:28:21 -0700 (PDT) Date: Fri, 21 Oct 2016 07:28:21 -0700 From: hiren panchasara To: Michael Tuexen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307727 - head/share/man/man4 Message-ID: <20161021142821.GJ11808@strugglingcoder.info> References: <201610211129.u9LBTPbb026992@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Re2uCLPLNzqOLVJA" Content-Disposition: inline In-Reply-To: <201610211129.u9LBTPbb026992@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 14:28:28 -0000 --Re2uCLPLNzqOLVJA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 10/21/16 at 11:29P, Michael Tuexen wrote: > Author: tuexen > Date: Fri Oct 21 11:29:25 2016 > New Revision: 307727 > URL: https://svnweb.freebsd.org/changeset/base/307727 >=20 > Log: > Document the TCP sysctl variables insecure_rst and insecure_syn. > =20 > MFC after: 1 month > Sponsored by: netflix >=20 > Modified: > head/share/man/man4/tcp.4 >=20 > Modified: head/share/man/man4/tcp.4 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/man/man4/tcp.4 Fri Oct 21 10:32:57 2016 (r307726) > +++ head/share/man/man4/tcp.4 Fri Oct 21 11:29:25 2016 (r307727) > @@ -34,7 +34,7 @@ > .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 > .\" $FreeBSD$ > .\" > -.Dd June 28, 2016 > +.Dd October 21, 2016 > .Dt TCP 4 > .Os > .Sh NAME > @@ -586,6 +586,12 @@ downshift. > List of available TCP function blocks (TCP stacks). > .It Va functions_default > The default TCP function block (TCP stack). > +.It Va insecure_rst > +Use criterias defined in RFC793 instead of RFC5961 for accepting RST seg= ments. I am not a native speaker but should we s/criterias /criteria / ? > +Default is false. > +.It Va insecure_syn > +Use criterias defined in RFC793 instead of RFC5961 for accepting SYN seg= ments. Same. > +Default is false. > .El > .Sh ERRORS > A socket operation may fail with one of the following errors returned: >=20 Cheers, Hiren --Re2uCLPLNzqOLVJA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYCiYCXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/ljJEH+wS57SFQuWMlug3Lvl4sFIle BS4xEQYNl+t+ojAW3LsHq7DbbKXqAhZldfGBfRtAbmhucfqlaDA6lO3KpjY6uVGJ XrooTNdgz4uj9Y34RNLIDlHaqm1G2Rf7dWaWYxLngZyzSVE8itG8FxFIEflYjZz/ v6X0D22qpaS4IGPxsL3iDAeE85XP5SO+4IRLlS3GtSFdYYHlfjYslXujzNzEndFs 0xRk73+Ww5LxGfnI6ox5c3RI52Cn+6vom/CoPwq70lTSl5s/lJJW7T8oZdBIvtbB dbSSmYWx+mgXvf16gkzz5DKjpYq/Nx9Oul4sp+cZP2c8ZhofwOS8DMZMXsjptLY= =DrOf -----END PGP SIGNATURE----- --Re2uCLPLNzqOLVJA-- From owner-svn-src-all@freebsd.org Fri Oct 21 14:28:37 2016 Return-Path: Delivered-To: svn-src-all@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 86FFCC1BA53; Fri, 21 Oct 2016 14:28:37 +0000 (UTC) (envelope-from des@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 41E9F30F; Fri, 21 Oct 2016 14:28:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LESa5t011114; Fri, 21 Oct 2016 14:28:36 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LESZXI011102; Fri, 21 Oct 2016 14:28:35 GMT (envelope-from des@FreeBSD.org) Message-Id: <201610211428.u9LESZXI011102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 21 Oct 2016 14:28: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: r307729 - in stable/11: contrib/unbound contrib/unbound/cachedb contrib/unbound/compat contrib/unbound/contrib contrib/unbound/daemon contrib/unbound/dns64 contrib/unbound/dnstap contri... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 14:28:37 -0000 Author: des Date: Fri Oct 21 14:28:35 2016 New Revision: 307729 URL: https://svnweb.freebsd.org/changeset/base/307729 Log: MFH (r305381, r306457): upgrade to unbound 1.5.10 via 1.5.9 Added: stable/11/contrib/unbound/cachedb/ - copied from r305381, head/contrib/unbound/cachedb/ stable/11/contrib/unbound/compat/strsep.c - copied unchanged from r305381, head/contrib/unbound/compat/strsep.c stable/11/contrib/unbound/contrib/ - copied from r306457, head/contrib/unbound/contrib/ stable/11/contrib/unbound/util/ub_event.c - copied, changed from r305381, head/contrib/unbound/util/ub_event.c stable/11/contrib/unbound/util/ub_event.h - copied unchanged from r305381, head/contrib/unbound/util/ub_event.h stable/11/contrib/unbound/util/ub_event_pluggable.c - copied, changed from r305381, head/contrib/unbound/util/ub_event_pluggable.c Modified: stable/11/contrib/unbound/Makefile.in stable/11/contrib/unbound/acx_nlnetlabs.m4 stable/11/contrib/unbound/acx_python.m4 stable/11/contrib/unbound/compat/arc4random.c stable/11/contrib/unbound/compat/explicit_bzero.c stable/11/contrib/unbound/compat/getentropy_linux.c stable/11/contrib/unbound/config.h stable/11/contrib/unbound/config.h.in stable/11/contrib/unbound/configure stable/11/contrib/unbound/configure.ac stable/11/contrib/unbound/daemon/acl_list.c stable/11/contrib/unbound/daemon/acl_list.h stable/11/contrib/unbound/daemon/daemon.c stable/11/contrib/unbound/daemon/daemon.h stable/11/contrib/unbound/daemon/remote.c stable/11/contrib/unbound/daemon/remote.h stable/11/contrib/unbound/daemon/unbound.c stable/11/contrib/unbound/daemon/worker.c stable/11/contrib/unbound/dns64/dns64.c stable/11/contrib/unbound/dnstap/dnstap.c stable/11/contrib/unbound/doc/Changelog stable/11/contrib/unbound/doc/README stable/11/contrib/unbound/doc/example.conf stable/11/contrib/unbound/doc/example.conf.in stable/11/contrib/unbound/doc/libunbound.3 stable/11/contrib/unbound/doc/libunbound.3.in stable/11/contrib/unbound/doc/unbound-anchor.8 stable/11/contrib/unbound/doc/unbound-anchor.8.in stable/11/contrib/unbound/doc/unbound-checkconf.8 stable/11/contrib/unbound/doc/unbound-checkconf.8.in stable/11/contrib/unbound/doc/unbound-control.8 stable/11/contrib/unbound/doc/unbound-control.8.in stable/11/contrib/unbound/doc/unbound-host.1 stable/11/contrib/unbound/doc/unbound-host.1.in stable/11/contrib/unbound/doc/unbound.8 stable/11/contrib/unbound/doc/unbound.8.in stable/11/contrib/unbound/doc/unbound.conf.5 stable/11/contrib/unbound/doc/unbound.conf.5.in stable/11/contrib/unbound/doc/unbound.doxygen stable/11/contrib/unbound/iterator/iter_fwd.c stable/11/contrib/unbound/iterator/iter_hints.c stable/11/contrib/unbound/iterator/iter_utils.c stable/11/contrib/unbound/iterator/iter_utils.h stable/11/contrib/unbound/iterator/iterator.c stable/11/contrib/unbound/iterator/iterator.h stable/11/contrib/unbound/libunbound/context.h stable/11/contrib/unbound/libunbound/libunbound.c stable/11/contrib/unbound/libunbound/libworker.c stable/11/contrib/unbound/libunbound/libworker.h stable/11/contrib/unbound/libunbound/python/libunbound.i stable/11/contrib/unbound/libunbound/ubsyms.def stable/11/contrib/unbound/libunbound/unbound-event.h stable/11/contrib/unbound/libunbound/worker.h stable/11/contrib/unbound/services/cache/dns.c stable/11/contrib/unbound/services/listen_dnsport.c stable/11/contrib/unbound/services/listen_dnsport.h stable/11/contrib/unbound/services/localzone.c stable/11/contrib/unbound/services/localzone.h stable/11/contrib/unbound/services/mesh.c stable/11/contrib/unbound/services/modstack.c stable/11/contrib/unbound/services/outside_network.c stable/11/contrib/unbound/services/outside_network.h stable/11/contrib/unbound/sldns/keyraw.c stable/11/contrib/unbound/sldns/parseutil.c stable/11/contrib/unbound/sldns/rrdef.h stable/11/contrib/unbound/sldns/str2wire.c stable/11/contrib/unbound/sldns/wire2str.c stable/11/contrib/unbound/sldns/wire2str.h stable/11/contrib/unbound/smallapp/unbound-anchor.c stable/11/contrib/unbound/smallapp/unbound-checkconf.c stable/11/contrib/unbound/smallapp/unbound-control.c stable/11/contrib/unbound/smallapp/unbound-host.c stable/11/contrib/unbound/smallapp/worker_cb.c stable/11/contrib/unbound/util/alloc.c stable/11/contrib/unbound/util/config_file.c stable/11/contrib/unbound/util/config_file.h stable/11/contrib/unbound/util/configlexer.lex stable/11/contrib/unbound/util/configparser.y stable/11/contrib/unbound/util/data/dname.c stable/11/contrib/unbound/util/data/msgencode.c stable/11/contrib/unbound/util/data/msgparse.c stable/11/contrib/unbound/util/data/msgparse.h stable/11/contrib/unbound/util/data/msgreply.c stable/11/contrib/unbound/util/data/msgreply.h stable/11/contrib/unbound/util/fptr_wlist.c stable/11/contrib/unbound/util/fptr_wlist.h stable/11/contrib/unbound/util/iana_ports.inc stable/11/contrib/unbound/util/module.h stable/11/contrib/unbound/util/net_help.c stable/11/contrib/unbound/util/netevent.c stable/11/contrib/unbound/util/netevent.h stable/11/contrib/unbound/util/storage/dnstree.c stable/11/contrib/unbound/util/storage/dnstree.h stable/11/contrib/unbound/util/storage/lookup3.c stable/11/contrib/unbound/util/tube.c stable/11/contrib/unbound/util/tube.h stable/11/contrib/unbound/util/winsock_event.c stable/11/contrib/unbound/validator/autotrust.c stable/11/contrib/unbound/validator/val_anchor.c stable/11/contrib/unbound/validator/val_secalgo.c stable/11/contrib/unbound/validator/val_secalgo.h stable/11/contrib/unbound/validator/val_sigcrypt.c stable/11/contrib/unbound/validator/validator.c stable/11/lib/libunbound/Makefile stable/11/usr.sbin/unbound/checkconf/Makefile stable/11/usr.sbin/unbound/control/Makefile stable/11/usr.sbin/unbound/daemon/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/unbound/Makefile.in ============================================================================== --- stable/11/contrib/unbound/Makefile.in Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/Makefile.in Fri Oct 21 14:28:35 2016 (r307729) @@ -81,7 +81,7 @@ LINTFLAGS+=@NETBSD_LINTFLAGS@ # compat with OpenBSD LINTFLAGS+="-Dsigset_t=long" # FreeBSD -LINTFLAGS+="-D__uint16_t=uint16_t" "-DEVP_PKEY_ASN1_METHOD=int" "-D_RuneLocale=int" "-D__va_list=va_list" +LINTFLAGS+="-D__uint16_t=uint16_t" "-DEVP_PKEY_ASN1_METHOD=int" "-D_RuneLocale=int" "-D__va_list=va_list" "-D__uint32_t=uint32_t" INSTALL=$(SHELL) $(srcdir)/install-sh @@ -108,11 +108,12 @@ util/fptr_wlist.c util/locks.c util/log. util/netevent.c util/net_help.c util/random.c util/rbtree.c util/regional.c \ util/rtt.c util/storage/dnstree.c util/storage/lookup3.c \ util/storage/lruhash.c util/storage/slabhash.c util/timehist.c util/tube.c \ -util/winsock_event.c validator/autotrust.c validator/val_anchor.c \ -validator/validator.c validator/val_kcache.c validator/val_kentry.c \ -validator/val_neg.c validator/val_nsec3.c validator/val_nsec.c \ -validator/val_secalgo.c validator/val_sigcrypt.c \ -validator/val_utils.c dns64/dns64.c $(CHECKLOCK_SRC) $(DNSTAP_SRC) +util/ub_event.c util/ub_event_pluggable.c util/winsock_event.c \ +validator/autotrust.c validator/val_anchor.c validator/validator.c \ +validator/val_kcache.c validator/val_kentry.c validator/val_neg.c \ +validator/val_nsec3.c validator/val_nsec.c validator/val_secalgo.c \ +validator/val_sigcrypt.c validator/val_utils.c dns64/dns64.c cachedb/cachedb.c $(CHECKLOCK_SRC) \ +$(DNSTAP_SRC) COMMON_OBJ_WITHOUT_NETCALL=dns.lo infra.lo rrset.lo dname.lo msgencode.lo \ as112.lo msgparse.lo msgreply.lo packed_rrset.lo iterator.lo iter_delegpt.lo \ iter_donotq.lo iter_fwd.lo iter_hints.lo iter_priv.lo iter_resptype.lo \ @@ -122,10 +123,11 @@ fptr_wlist.lo locks.lo log.lo mini_event random.lo rbtree.lo regional.lo rtt.lo dnstree.lo lookup3.lo lruhash.lo \ slabhash.lo timehist.lo tube.lo winsock_event.lo autotrust.lo val_anchor.lo \ validator.lo val_kcache.lo val_kentry.lo val_neg.lo val_nsec3.lo val_nsec.lo \ -val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo \ +val_secalgo.lo val_sigcrypt.lo val_utils.lo dns64.lo cachedb.lo \ $(PYTHONMOD_OBJ) $(CHECKLOCK_OBJ) $(DNSTAP_OBJ) -COMMON_OBJ=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \ +COMMON_OBJ_WITHOUT_UB_EVENT=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \ outside_network.lo +COMMON_OBJ=$(COMMON_OBJ_WITHOUT_UB_EVENT) ub_event.lo # set to $COMMON_OBJ or to "" if --enableallsymbols COMMON_OBJ_ALL_SYMBOLS=@COMMON_OBJ_ALL_SYMBOLS@ COMPAT_SRC=compat/ctime_r.c compat/fake-rfc2553.c compat/gmtime_r.c \ @@ -134,7 +136,8 @@ compat/memcmp.c compat/memmove.c compat/ compat/strlcpy.c compat/strptime.c compat/getentropy_linux.c \ compat/getentropy_osx.c compat/getentropy_solaris.c compat/getentropy_win.c \ compat/explicit_bzero.c compat/arc4random.c compat/arc4random_uniform.c \ -compat/arc4_lock.c compat/sha512.c compat/reallocarray.c compat/isblank.c +compat/arc4_lock.c compat/sha512.c compat/reallocarray.c compat/isblank.c \ +compat/strsep.c COMPAT_OBJ=$(LIBOBJS:.o=.lo) COMPAT_OBJ_WITHOUT_CTIME=$(LIBOBJ_WITHOUT_CTIME:.o=.lo) COMPAT_OBJ_WITHOUT_CTIMEARC4=$(LIBOBJ_WITHOUT_CTIMEARC4:.o=.lo) @@ -177,7 +180,8 @@ daemon/worker.c daemon/acl_list.c daemon testcode/replay.c testcode/fake_event.c TESTBOUND_OBJ=testbound.lo replay.lo fake_event.lo TESTBOUND_OBJ_LINK=$(TESTBOUND_OBJ) testpkts.lo worker.lo acl_list.lo \ -daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) $(SLDNS_OBJ) $(COMPAT_OBJ) +daemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) ub_event.lo $(SLDNS_OBJ) \ +$(COMPAT_OBJ) LOCKVERIFY_SRC=testcode/lock_verify.c LOCKVERIFY_OBJ=lock_verify.lo LOCKVERIFY_OBJ_LINK=$(LOCKVERIFY_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \ @@ -209,8 +213,8 @@ DELAYER_OBJ_LINK=$(DELAYER_OBJ) worker_c $(SLDNS_OBJ) LIBUNBOUND_SRC=libunbound/context.c libunbound/libunbound.c \ libunbound/libworker.c -LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo -LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ) +LIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo ub_event_pluggable.lo +LIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ_WITHOUT_UB_EVENT) $(SLDNS_OBJ) $(COMPAT_OBJ) # win apps or "" if not on windows WINAPPS=@WINAPPS@ @@ -224,7 +228,7 @@ SVCUNINST_OBJ_LINK=$(SVCUNINST_OBJ) w_in $(COMPAT_OBJ_WITHOUT_CTIMEARC4) ANCHORUPD_SRC=winrc/anchor-update.c ANCHORUPD_OBJ=anchor-update.lo -ANCHORUPD_OBJ_LINK=$(ANCHORUPD_OBJ) rsrc_anchorupd.o $(COMPAT_OBJ_WITHOUT_CTIMEARC4) +ANCHORUPD_OBJ_LINK=$(ANCHORUPD_OBJ) rsrc_anchorupd.o $(COMPAT_OBJ_WITHOUT_CTIMEARC4) wire2str.lo str2wire.lo parseutil.lo sbuffer.lo rrdef.lo keyraw.lo parse.lo RSRC_OBJ=rsrc_svcinst.o rsrc_svcuninst.o rsrc_anchorupd.o rsrc_unbound.o \ rsrc_unbound_host.o rsrc_unbound_anchor.o rsrc_unbound_control.o \ rsrc_unbound_checkconf.o @@ -552,7 +556,7 @@ uninstall: $(PYTHONMOD_UNINSTALL) $(PYUN @echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand" iana_update: - curl -o port-numbers.tmp http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml --compressed + curl -o port-numbers.tmp https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml --compressed if file port-numbers.tmp | grep 'gzip' >/dev/null; then zcat port-numbers.tmp; else cat port-numbers.tmp; fi | awk '// {p=0;} /udp/ {p=1;} /[^u]/ {p=0;} /Decomissioned|Decommissioned|Removed|De-registered|unassigned|Unassigned|Reserved/ {u=1;} // { if(u==1) {u=0;} else { if(p==1) { match($$0,/[0-9]+/); print substr($$0, RSTART, RLENGTH) ","}}}' | sort -nu > util/iana_ports.inc rm -f port-numbers.tmp @@ -596,7 +600,6 @@ depend: rm -f $(DEPEND_TMP) $(DEPEND_TMP2) # Dependencies -as112.lo as112.o: $(srcdir)/util/as112.c $(srcdir)/util/as112.h dns.lo dns.o: $(srcdir)/services/cache/dns.c config.h $(srcdir)/iterator/iter_delegpt.h $(srcdir)/util/log.h \ $(srcdir)/validator/val_nsec.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/msgreply.h \ @@ -614,6 +617,7 @@ rrset.lo rrset.o: $(srcdir)/services/cac $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/slabhash.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/config_file.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/regional.h $(srcdir)/util/alloc.h +as112.lo as112.o: $(srcdir)/util/as112.c $(srcdir)/util/as112.h dname.lo dname.o: $(srcdir)/util/data/dname.c config.h $(srcdir)/util/data/dname.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/storage/lookup3.h $(srcdir)/sldns/sbuffer.h @@ -624,9 +628,9 @@ msgencode.lo msgencode.o: $(srcdir)/util $(srcdir)/sldns/sbuffer.h msgparse.lo msgparse.o: $(srcdir)/util/data/msgparse.c config.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/dname.h $(srcdir)/util/data/packed_rrset.h \ - $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/parseutil.h \ - $(srcdir)/sldns/wire2str.h + $(srcdir)/sldns/rrdef.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ + $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/regional.h $(srcdir)/sldns/sbuffer.h \ + $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h msgreply.lo msgreply.o: $(srcdir)/util/data/msgreply.c config.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/storage/lookup3.h $(srcdir)/util/alloc.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h \ @@ -700,11 +704,12 @@ listen_dnsport.lo listen_dnsport.o: $(sr $(srcdir)/util/rbtree.h $(srcdir)/util/log.h $(srcdir)/util/config_file.h \ $(srcdir)/util/net_help.h $(srcdir)/sldns/sbuffer.h localzone.lo localzone.o: $(srcdir)/services/localzone.c config.h $(srcdir)/services/localzone.h \ - $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h \ - $(srcdir)/sldns/sbuffer.h $(srcdir)/util/regional.h $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/storage/lruhash.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/util/as112.h + $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/storage/dnstree.h \ + $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/regional.h \ + $(srcdir)/util/config_file.h $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgencode.h $(srcdir)/util/net_help.h \ + $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/util/as112.h mesh.lo mesh.o: $(srcdir)/services/mesh.c config.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/netevent.h $(srcdir)/util/data/msgparse.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/log.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h \ @@ -718,7 +723,7 @@ modstack.lo modstack.o: $(srcdir)/servic $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h \ $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/dns64/dns64.h \ $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/validator/validator.h \ - $(srcdir)/validator/val_utils.h + $(srcdir)/validator/val_utils.h $(PYTHONMOD_HEADER) $(srcdir)/cachedb/cachedb.h outbound_list.lo outbound_list.o: $(srcdir)/services/outbound_list.c config.h \ $(srcdir)/services/outbound_list.h $(srcdir)/services/outside_network.h $(srcdir)/util/rbtree.h \ $(srcdir)/util/netevent.h @@ -755,14 +760,15 @@ fptr_wlist.lo fptr_wlist.o: $(srcdir)/ut $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h \ $(srcdir)/util/rbtree.h $(srcdir)/services/outside_network.h \ - $(srcdir)/services/localzone.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ + $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/cache/infra.h \ $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/dns64/dns64.h \ $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \ $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/validator/val_anchor.h \ $(srcdir)/validator/val_nsec3.h $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_kentry.h \ $(srcdir)/validator/val_neg.h $(srcdir)/validator/autotrust.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/libunbound/unbound.h \ - $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h + $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/config_file.h \ + $(PYTHONMOD_HEADER) $(srcdir)/cachedb/cachedb.h locks.lo locks.o: $(srcdir)/util/locks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h log.lo log.o: $(srcdir)/util/log.c config.h $(srcdir)/util/log.h $(srcdir)/util/locks.h $(srcdir)/sldns/sbuffer.h mini_event.lo mini_event.o: $(srcdir)/util/mini_event.c config.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h \ @@ -773,12 +779,12 @@ mini_event.lo mini_event.o: $(srcdir)/ut module.lo module.o: $(srcdir)/util/module.c config.h $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h -netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/util/log.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ - $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ +netevent.lo netevent.o: $(srcdir)/util/netevent.c config.h $(srcdir)/util/netevent.h $(srcdir)/util/ub_event.h \ + $(srcdir)/util/log.h $(srcdir)/util/net_help.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h \ + $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/sldns/sbuffer.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/dnstap/dnstap.h net_help.lo net_help.o: $(srcdir)/util/net_help.c config.h $(srcdir)/util/net_help.h $(srcdir)/util/log.h \ $(srcdir)/util/data/dname.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ @@ -808,7 +814,15 @@ tube.lo tube.o: $(srcdir)/util/tube.c co $(srcdir)/util/netevent.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/services/mesh.h \ - $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h + $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h $(srcdir)/util/ub_event.h +ub_event.lo ub_event.o: $(srcdir)/util/ub_event.c config.h $(srcdir)/util/ub_event.h $(srcdir)/util/log.h \ + $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h +ub_event_pluggable.lo ub_event_pluggable.o: $(srcdir)/util/ub_event_pluggable.c config.h $(srcdir)/util/ub_event.h \ + $(srcdir)/libunbound/unbound-event.h $(srcdir)/util/netevent.h $(srcdir)/util/log.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ + $(srcdir)/services/modstack.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h winsock_event.lo winsock_event.o: $(srcdir)/util/winsock_event.c config.h autotrust.lo autotrust.o: $(srcdir)/validator/autotrust.c config.h $(srcdir)/validator/autotrust.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ @@ -822,8 +836,8 @@ autotrust.lo autotrust.o: $(srcdir)/vali val_anchor.lo val_anchor.o: $(srcdir)/validator/val_anchor.c config.h $(srcdir)/validator/val_anchor.h \ $(srcdir)/util/rbtree.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/validator/val_sigcrypt.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/validator/autotrust.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/sldns/sbuffer.h \ - $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h $(srcdir)/util/as112.h + $(srcdir)/util/data/dname.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h $(srcdir)/util/as112.h \ + $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/str2wire.h validator.lo validator.o: $(srcdir)/validator/validator.c config.h $(srcdir)/validator/validator.h \ $(srcdir)/util/module.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \ @@ -880,7 +894,7 @@ val_utils.lo val_utils.o: $(srcdir)/vali $(srcdir)/validator/val_sigcrypt.h $(srcdir)/validator/val_anchor.h $(srcdir)/util/rbtree.h \ $(srcdir)/validator/val_nsec.h $(srcdir)/validator/val_neg.h $(srcdir)/services/cache/rrset.h \ $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/dns.h $(srcdir)/util/data/dname.h \ - $(srcdir)/util/net_help.h $(srcdir)/util/regional.h + $(srcdir)/util/net_help.h $(srcdir)/util/regional.h $(srcdir)/sldns/wire2str.h $(srcdir)/sldns/parseutil.h dns64.lo dns64.o: $(srcdir)/dns64/dns64.c config.h $(srcdir)/dns64/dns64.h $(srcdir)/util/module.h \ $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ @@ -888,6 +902,14 @@ dns64.lo dns64.o: $(srcdir)/dns64/dns64. $(srcdir)/util/storage/slabhash.h $(srcdir)/util/config_file.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/netevent.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/rbtree.h \ $(srcdir)/services/modstack.h $(srcdir)/util/net_help.h $(srcdir)/util/regional.h +cachedb.lo cachedb.o: $(srcdir)/cachedb/cachedb.c config.h $(srcdir)/cachedb/cachedb.h $(srcdir)/util/module.h \ + $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \ + $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ + $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h $(srcdir)/util/net_help.h $(srcdir)/util/config_file.h \ + $(srcdir)/util/data/msgencode.h $(srcdir)/services/cache/dns.h $(srcdir)/validator/val_neg.h \ + $(srcdir)/util/rbtree.h $(srcdir)/validator/val_secalgo.h $(srcdir)/iterator/iter_utils.h \ + $(srcdir)/iterator/iter_resptype.h $(srcdir)/sldns/parseutil.h $(srcdir)/sldns/wire2str.h \ + $(srcdir)/sldns/sbuffer.h checklocks.lo checklocks.o: $(srcdir)/testcode/checklocks.c config.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/testcode/checklocks.h unitanchor.lo unitanchor.o: $(srcdir)/testcode/unitanchor.c config.h $(srcdir)/util/log.h $(srcdir)/util/data/dname.h \ @@ -935,7 +957,8 @@ unitldns.lo unitldns.o: $(srcdir)/testco $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/wire2str.h acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/acl_list.h \ $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h + $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/services/localzone.h $(srcdir)/util/locks.h \ + $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h cachedump.lo cachedump.o: $(srcdir)/daemon/cachedump.c config.h $(srcdir)/daemon/cachedump.h \ $(srcdir)/daemon/remote.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ @@ -994,7 +1017,7 @@ unbound.lo unbound.o: $(srcdir)/daemon/u $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/util/ub_event.h worker.lo worker.o: $(srcdir)/daemon/worker.c config.h $(srcdir)/util/log.h $(srcdir)/util/net_help.h \ $(srcdir)/util/random.h $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \ @@ -1020,7 +1043,7 @@ testbound.lo testbound.o: $(srcdir)/test $(srcdir)/util/data/packed_rrset.h $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/util/rtt.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \ - $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/mini_event.h $(srcdir)/util/rbtree.h + $(srcdir)/services/mesh.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h testpkts.lo testpkts.o: $(srcdir)/testcode/testpkts.c config.h $(srcdir)/testcode/testpkts.h \ $(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h @@ -1042,7 +1065,8 @@ worker.lo worker.o: $(srcdir)/daemon/wor $(srcdir)/libunbound/libworker.h acl_list.lo acl_list.o: $(srcdir)/daemon/acl_list.c config.h $(srcdir)/daemon/acl_list.h \ $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rbtree.h $(srcdir)/util/regional.h $(srcdir)/util/log.h \ - $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h + $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/services/localzone.h $(srcdir)/util/locks.h \ + $(srcdir)/sldns/str2wire.h $(srcdir)/sldns/rrdef.h daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h \ $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h \ @@ -1101,7 +1125,7 @@ unbound-checkconf.lo unbound-checkconf.o $(srcdir)/iterator/iterator.h $(srcdir)/services/outbound_list.h $(srcdir)/iterator/iter_fwd.h \ $(srcdir)/util/rbtree.h $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h \ $(srcdir)/validator/validator.h $(srcdir)/validator/val_utils.h $(srcdir)/services/localzone.h \ - $(srcdir)/sldns/sbuffer.h + $(srcdir)/sldns/sbuffer.h $(PYTHONMOD_HEADER) worker_cb.lo worker_cb.o: $(srcdir)/smallapp/worker_cb.c config.h $(srcdir)/libunbound/context.h \ $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ $(srcdir)/libunbound/unbound.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ @@ -1113,17 +1137,18 @@ context.lo context.o: $(srcdir)/libunbou $(srcdir)/libunbound/unbound.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/config_file.h $(srcdir)/util/net_help.h $(srcdir)/services/localzone.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h \ - $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/util/storage/dnstree.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/sldns/sbuffer.h libunbound.lo libunbound.o: $(srcdir)/libunbound/libunbound.c $(srcdir)/libunbound/unbound.h \ $(srcdir)/libunbound/unbound-event.h config.h $(srcdir)/libunbound/context.h $(srcdir)/util/locks.h \ $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/util/config_file.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/regional.h \ - $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/services/localzone.h \ - $(srcdir)/services/cache/infra.h $(srcdir)/util/storage/dnstree.h $(srcdir)/util/rtt.h \ - $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/util/random.h $(srcdir)/util/net_help.h $(srcdir)/util/tube.h $(srcdir)/util/ub_event.h \ + $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/cache/infra.h \ + $(srcdir)/util/rtt.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ + $(srcdir)/sldns/sbuffer.h libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h $(srcdir)/libunbound/libworker.h \ $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \ $(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \ @@ -1131,11 +1156,12 @@ libworker.lo libworker.o: $(srcdir)/libu $(srcdir)/libunbound/unbound-event.h $(srcdir)/services/outside_network.h $(srcdir)/util/netevent.h \ $(srcdir)/services/mesh.h $(srcdir)/util/data/msgparse.h \ $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/module.h $(srcdir)/util/data/msgreply.h \ - $(srcdir)/services/localzone.h $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h \ - $(srcdir)/services/outbound_list.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/util/regional.h \ - $(srcdir)/util/random.h $(srcdir)/util/config_file.h $(srcdir)/util/storage/lookup3.h $(srcdir)/util/net_help.h \ - $(srcdir)/util/data/dname.h $(srcdir)/util/data/msgencode.h $(srcdir)/iterator/iter_fwd.h \ - $(srcdir)/iterator/iter_hints.h $(srcdir)/util/storage/dnstree.h $(srcdir)/sldns/str2wire.h + $(srcdir)/services/localzone.h $(srcdir)/util/storage/dnstree.h $(srcdir)/services/cache/rrset.h \ + $(srcdir)/util/storage/slabhash.h $(srcdir)/services/outbound_list.h $(srcdir)/util/fptr_wlist.h \ + $(srcdir)/util/tube.h $(srcdir)/util/regional.h $(srcdir)/util/random.h $(srcdir)/util/config_file.h \ + $(srcdir)/util/storage/lookup3.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \ + $(srcdir)/util/data/msgencode.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h \ + $(srcdir)/sldns/str2wire.h unbound-host.lo unbound-host.o: $(srcdir)/smallapp/unbound-host.c config.h $(srcdir)/libunbound/unbound.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/wire2str.h asynclook.lo asynclook.o: $(srcdir)/testcode/asynclook.c config.h $(srcdir)/libunbound/unbound.h \ @@ -1163,14 +1189,15 @@ pythonmod_utils.lo pythonmod_utils.o: $( $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/util/netevent.h $(srcdir)/util/net_help.h $(srcdir)/services/cache/dns.h \ $(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/util/regional.h \ - $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h + $(srcdir)/iterator/iter_delegpt.h $(srcdir)/sldns/sbuffer.h \ + win_svc.lo win_svc.o: $(srcdir)/winrc/win_svc.c config.h $(srcdir)/winrc/win_svc.h $(srcdir)/winrc/w_inst.h \ $(srcdir)/daemon/daemon.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/services/modstack.h \ $(srcdir)/daemon/worker.h $(srcdir)/libunbound/worker.h \ $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h \ $(srcdir)/util/netevent.h $(srcdir)/util/data/msgreply.h $(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h \ $(srcdir)/sldns/rrdef.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/util/module.h \ - $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h $(srcdir)/util/config_file.h $(srcdir)/util/winsock_event.h + $(srcdir)/dnstap/dnstap.h $(srcdir)/daemon/remote.h $(srcdir)/util/config_file.h $(srcdir)/util/ub_event.h w_inst.lo w_inst.o: $(srcdir)/winrc/w_inst.c config.h $(srcdir)/winrc/w_inst.h $(srcdir)/winrc/win_svc.h unbound-service-install.lo unbound-service-install.o: $(srcdir)/winrc/unbound-service-install.c config.h \ $(srcdir)/winrc/w_inst.h @@ -1213,3 +1240,4 @@ arc4_lock.lo arc4_lock.o: $(srcdir)/comp sha512.lo sha512.o: $(srcdir)/compat/sha512.c config.h reallocarray.lo reallocarray.o: $(srcdir)/compat/reallocarray.c config.h isblank.lo isblank.o: $(srcdir)/compat/isblank.c config.h +strsep.lo strsep.o: $(srcdir)/compat/strsep.c config.h Modified: stable/11/contrib/unbound/acx_nlnetlabs.m4 ============================================================================== --- stable/11/contrib/unbound/acx_nlnetlabs.m4 Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/acx_nlnetlabs.m4 Fri Oct 21 14:28:35 2016 (r307729) @@ -2,7 +2,9 @@ # Copyright 2009, Wouter Wijngaards, NLnet Labs. # BSD licensed. # -# Version 32 +# Version 34 +# 2016-03-21 Check -ldl -pthread for libcrypto for ldns and openssl 1.1.0. +# 2016-03-21 Use HMAC_Update instead of HMAC_CTX_Init (for openssl-1.1.0). # 2016-01-04 -D_DEFAULT_SOURCE defined with -D_BSD_SOURCE for Linux glibc 2.20 # 2015-12-11 FLTO check for new OSX, clang. # 2015-11-18 spelling check fix. @@ -671,16 +673,16 @@ AC_DEFUN([ACX_SSL_CHECKS], [ ACX_RUNTIME_PATH_ADD([$ssldir/lib]) fi - AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) + AC_MSG_CHECKING([for HMAC_Update in -lcrypto]) LIBS="$LIBS -lcrypto" LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" AC_TRY_LINK(, [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ], [ AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) ], [ AC_MSG_RESULT(no) # check if -lwsock32 or -lgdi32 are needed. @@ -690,11 +692,11 @@ AC_DEFUN([ACX_SSL_CHECKS], [ LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) @@ -704,15 +706,30 @@ AC_DEFUN([ACX_SSL_CHECKS], [ LIBSSL_LIBS="$LIBSSL_LIBS -ldl" AC_MSG_CHECKING([if -lcrypto needs -ldl]) AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); + int HMAC_Update(void); + (void)HMAC_Update(); ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) - AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl -pthread" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread" + AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread]) + AC_TRY_LINK([], [ + int HMAC_Update(void); + (void)HMAC_Update(); + ],[ + AC_DEFINE([HAVE_HMAC_UPDATE], 1, + [If you have HMAC_Update]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + ]) ]) ]) ]) Modified: stable/11/contrib/unbound/acx_python.m4 ============================================================================== --- stable/11/contrib/unbound/acx_python.m4 Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/acx_python.m4 Fri Oct 21 14:28:35 2016 (r307729) @@ -54,7 +54,7 @@ $ac_distutils_result]) AC_MSG_CHECKING([for Python library path]) if test -z "$PYTHON_LDFLAGS"; then PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ - print(get_config_var('BLDLIBRARY'));"` + print('-L'+get_config_var('LIBDIR')+' -L'+get_config_var('LIBDEST')+' '+get_config_var('BLDLIBRARY'));"` fi AC_MSG_RESULT([$PYTHON_LDFLAGS]) AC_SUBST([PYTHON_LDFLAGS]) Modified: stable/11/contrib/unbound/compat/arc4random.c ============================================================================== --- stable/11/contrib/unbound/compat/arc4random.c Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/compat/arc4random.c Fri Oct 21 14:28:35 2016 (r307729) @@ -48,6 +48,9 @@ #else /* !__GNUC__ */ #define inline #endif /* !__GNUC__ */ +#ifndef MAP_ANON +#define MAP_ANON MAP_ANONYMOUS +#endif #define KEYSZ 32 #define IVSZ 8 Modified: stable/11/contrib/unbound/compat/explicit_bzero.c ============================================================================== --- stable/11/contrib/unbound/compat/explicit_bzero.c Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/compat/explicit_bzero.c Fri Oct 21 14:28:35 2016 (r307729) @@ -6,7 +6,11 @@ #include "config.h" #include +#ifdef HAVE_ATTR_WEAK __attribute__((weak)) void +#else +void +#endif __explicit_bzero_hook(void *ATTR_UNUSED(buf), size_t ATTR_UNUSED(len)) { } Modified: stable/11/contrib/unbound/compat/getentropy_linux.c ============================================================================== --- stable/11/contrib/unbound/compat/getentropy_linux.c Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/compat/getentropy_linux.c Fri Oct 21 14:28:35 2016 (r307729) @@ -60,6 +60,9 @@ #include #endif #include +#ifndef MAP_ANON +#define MAP_ANON MAP_ANONYMOUS +#endif #define REPEAT 5 #define min(a, b) (((a) < (b)) ? (a) : (b)) @@ -94,7 +97,7 @@ int getentropy(void *buf, size_t len); extern int main(int, char *argv[]); #endif static int gotdata(char *buf, size_t len); -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len); #endif static int getentropy_urandom(void *buf, size_t len); @@ -113,7 +116,7 @@ getentropy(void *buf, size_t len) return -1; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) /* * Try descriptor-less getrandom() */ @@ -209,7 +212,7 @@ gotdata(char *buf, size_t len) return 0; } -#ifdef SYS_getrandom +#if defined(SYS_getrandom) && defined(__NR_getrandom) static int getentropy_getrandom(void *buf, size_t len) { Copied: stable/11/contrib/unbound/compat/strsep.c (from r305381, head/contrib/unbound/compat/strsep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/unbound/compat/strsep.c Fri Oct 21 14:28:35 2016 (r307729, copy of r305381, head/contrib/unbound/compat/strsep.c) @@ -0,0 +1,65 @@ +/** + * strsep implementation for compatibility. + * + * LICENSE + * Copyright (c) 2016, NLnet Labs + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of NLnetLabs nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL 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. + **/ + +#include "config.h" + +/** see if character is in the delimiter array */ +static int +in_delim(char c, const char* delim) +{ + const char* p; + if(!delim) + return 0; + for(p=delim; *p; p++) { + if(*p == c) + return 1; + } + return 0; +} + +char *strsep(char **stringp, const char *delim) +{ + char* s; + char* orig; + if(stringp == NULL || *stringp == NULL) + return NULL; + orig = *stringp; + s = *stringp; + while(*s && !in_delim(*s, delim)) + s++; + if(*s) { + *s = 0; + *stringp = s+1; + } else { + *stringp = NULL; + } + return orig; +} Modified: stable/11/contrib/unbound/config.h ============================================================================== --- stable/11/contrib/unbound/config.h Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/config.h Fri Oct 21 14:28:35 2016 (r307729) @@ -43,12 +43,18 @@ /* Whether the C compiler accepts the "unused" attribute */ #define HAVE_ATTR_UNUSED 1 +/* Whether the C compiler accepts the "weak" attribute */ +#define HAVE_ATTR_WEAK 1 + /* Define to 1 if you have the `chown' function. */ #define HAVE_CHOWN 1 /* Define to 1 if you have the `chroot' function. */ #define HAVE_CHROOT 1 +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + /* Define to 1 if you have the `ctime_r' function. */ #define HAVE_CTIME_R 1 @@ -108,9 +114,18 @@ /* Define to 1 if you have the `endprotoent' function. */ #define HAVE_ENDPROTOENT 1 +/* Define to 1 if you have the `endpwent' function. */ +#define HAVE_ENDPWENT 1 + /* Define to 1 if you have the `endservent' function. */ #define HAVE_ENDSERVENT 1 +/* Define to 1 if you have the `ERR_free_strings' function. */ +#define HAVE_ERR_FREE_STRINGS 1 + +/* Define to 1 if you have the `ERR_load_crypto_strings' function. */ +#define HAVE_ERR_LOAD_CRYPTO_STRINGS 1 + /* Define to 1 if you have the `event_base_free' function. */ /* #undef HAVE_EVENT_BASE_FREE */ @@ -126,6 +141,12 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_EVENT_H */ +/* Define to 1 if you have the `EVP_cleanup' function. */ +#define HAVE_EVP_CLEANUP 1 + +/* Define to 1 if you have the `EVP_MD_CTX_new' function. */ +/* #undef HAVE_EVP_MD_CTX_NEW */ + /* Define to 1 if you have the `EVP_sha1' function. */ #define HAVE_EVP_SHA1 1 @@ -189,8 +210,8 @@ /* Define to 1 if you have the header file. */ #define HAVE_GRP_H 1 -/* If you have HMAC_CTX_init */ -#define HAVE_HMAC_CTX_INIT 1 +/* If you have HMAC_Update */ +#define HAVE_HMAC_UPDATE 1 /* Define to 1 if you have the `inet_aton' function. */ #define HAVE_INET_ATON 1 @@ -249,24 +270,48 @@ /* Use libnettle for crypto */ /* #undef HAVE_NETTLE */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_DSA_COMPAT_H */ + /* Use libnss for crypto */ /* #undef HAVE_NSS */ +/* Define to 1 if you have the `OpenSSL_add_all_digests' function. */ +#define HAVE_OPENSSL_ADD_ALL_DIGESTS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_BN_H 1 + /* Define to 1 if you have the `OPENSSL_config' function. */ #define HAVE_OPENSSL_CONFIG 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_CONF_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_DH_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_DSA_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_ENGINE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_ERR_H 1 +/* Define to 1 if you have the `OPENSSL_init_crypto' function. */ +/* #undef HAVE_OPENSSL_INIT_CRYPTO */ + +/* Define to 1 if you have the `OPENSSL_init_ssl' function. */ +/* #undef HAVE_OPENSSL_INIT_SSL */ + /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_RAND_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_RSA_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_OPENSSL_SSL_H 1 @@ -291,6 +336,9 @@ /* Define to 1 if you have the `random' function. */ #define HAVE_RANDOM 1 +/* Define to 1 if you have the `RAND_cleanup' function. */ +#define HAVE_RAND_CLEANUP 1 + /* Define to 1 if you have the `reallocarray' function. */ #define HAVE_REALLOCARRAY 1 @@ -378,6 +426,9 @@ /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 +/* Define to 1 if you have the `strsep' function. */ +#define HAVE_STRSEP 1 + /* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */ /* #undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST */ @@ -515,7 +566,7 @@ #define PACKAGE_NAME "unbound" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "unbound 1.5.8" +#define PACKAGE_STRING "unbound 1.5.10" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "unbound" @@ -524,7 +575,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.5.8" +#define PACKAGE_VERSION "1.5.10" /* default pidfile location */ #define PIDFILE "/var/unbound/unbound.pid" @@ -543,7 +594,7 @@ #define ROOT_CERT_FILE "/var/unbound/icannbundle.pem" /* version number for resource files */ -#define RSRC_PACKAGE_VERSION 1,5,8,0 +#define RSRC_PACKAGE_VERSION 1,5,10,0 /* Directory to chdir to */ #define RUN_DIR "/var/unbound" @@ -581,9 +632,15 @@ /* define this to enable debug checks. */ /* #undef UNBOUND_DEBUG */ +/* Define to 1 to use cachedb support */ +/* #undef USE_CACHEDB */ + /* Define to 1 to enable dnstap support */ /* #undef USE_DNSTAP */ +/* Define this to enable DSA support. */ +#define USE_DSA 1 + /* Define this to enable ECDSA support. */ #define USE_ECDSA 1 @@ -596,6 +653,12 @@ /* Define if you want to use internal select based events */ #define USE_MINI_EVENT 1 +/* Define this to enable client TCP Fast Open. */ +/* #undef USE_MSG_FASTOPEN */ + +/* Define this to enable client TCP Fast Open. */ +/* #undef USE_OSX_MSG_FASTOPEN */ + /* Define this to enable SHA256 and SHA512 support. */ #define USE_SHA2 1 @@ -621,6 +684,9 @@ #endif +/* Define this to enable server TCP Fast Open. */ +/* #undef USE_TCP_FASTOPEN */ + /* Whether the windows socket API is used */ /* #undef USE_WINSOCK */ @@ -980,6 +1046,11 @@ int memcmp(const void *x, const void *y, char *ctime_r(const time_t *timep, char *buf); #endif +#ifndef HAVE_STRSEP +#define strsep unbound_strsep +char *strsep(char **stringp, const char *delim); +#endif + #ifndef HAVE_ISBLANK #define isblank unbound_isblank int isblank(int c); Modified: stable/11/contrib/unbound/config.h.in ============================================================================== --- stable/11/contrib/unbound/config.h.in Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/config.h.in Fri Oct 21 14:28:35 2016 (r307729) @@ -42,12 +42,18 @@ /* Whether the C compiler accepts the "unused" attribute */ #undef HAVE_ATTR_UNUSED +/* Whether the C compiler accepts the "weak" attribute */ +#undef HAVE_ATTR_WEAK + /* Define to 1 if you have the `chown' function. */ #undef HAVE_CHOWN /* Define to 1 if you have the `chroot' function. */ #undef HAVE_CHROOT +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA + /* Define to 1 if you have the `ctime_r' function. */ #undef HAVE_CTIME_R @@ -107,9 +113,18 @@ /* Define to 1 if you have the `endprotoent' function. */ #undef HAVE_ENDPROTOENT +/* Define to 1 if you have the `endpwent' function. */ +#undef HAVE_ENDPWENT + /* Define to 1 if you have the `endservent' function. */ #undef HAVE_ENDSERVENT +/* Define to 1 if you have the `ERR_free_strings' function. */ +#undef HAVE_ERR_FREE_STRINGS + +/* Define to 1 if you have the `ERR_load_crypto_strings' function. */ +#undef HAVE_ERR_LOAD_CRYPTO_STRINGS + /* Define to 1 if you have the `event_base_free' function. */ #undef HAVE_EVENT_BASE_FREE @@ -125,6 +140,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_EVENT_H +/* Define to 1 if you have the `EVP_cleanup' function. */ +#undef HAVE_EVP_CLEANUP + +/* Define to 1 if you have the `EVP_MD_CTX_new' function. */ +#undef HAVE_EVP_MD_CTX_NEW + /* Define to 1 if you have the `EVP_sha1' function. */ #undef HAVE_EVP_SHA1 @@ -188,8 +209,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H -/* If you have HMAC_CTX_init */ -#undef HAVE_HMAC_CTX_INIT +/* If you have HMAC_Update */ +#undef HAVE_HMAC_UPDATE /* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON @@ -248,24 +269,48 @@ /* Use libnettle for crypto */ #undef HAVE_NETTLE +/* Define to 1 if you have the header file. */ +#undef HAVE_NETTLE_DSA_COMPAT_H + /* Use libnss for crypto */ #undef HAVE_NSS +/* Define to 1 if you have the `OpenSSL_add_all_digests' function. */ +#undef HAVE_OPENSSL_ADD_ALL_DIGESTS + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_BN_H + /* Define to 1 if you have the `OPENSSL_config' function. */ #undef HAVE_OPENSSL_CONFIG /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_CONF_H +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_DH_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_DSA_H + /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_ENGINE_H /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_ERR_H +/* Define to 1 if you have the `OPENSSL_init_crypto' function. */ +#undef HAVE_OPENSSL_INIT_CRYPTO + +/* Define to 1 if you have the `OPENSSL_init_ssl' function. */ +#undef HAVE_OPENSSL_INIT_SSL + /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_RAND_H +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_SSL_H @@ -290,6 +335,9 @@ /* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM +/* Define to 1 if you have the `RAND_cleanup' function. */ +#undef HAVE_RAND_CLEANUP + /* Define to 1 if you have the `reallocarray' function. */ #undef HAVE_REALLOCARRAY @@ -377,6 +425,9 @@ /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + /* Define to 1 if `ipi_spec_dst' is a member of `struct in_pktinfo'. */ #undef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST @@ -580,9 +631,15 @@ /* define this to enable debug checks. */ #undef UNBOUND_DEBUG +/* Define to 1 to use cachedb support */ +#undef USE_CACHEDB + /* Define to 1 to enable dnstap support */ #undef USE_DNSTAP +/* Define this to enable DSA support. */ +#undef USE_DSA + /* Define this to enable ECDSA support. */ #undef USE_ECDSA @@ -595,6 +652,12 @@ /* Define if you want to use internal select based events */ #undef USE_MINI_EVENT +/* Define this to enable client TCP Fast Open. */ +#undef USE_MSG_FASTOPEN + +/* Define this to enable client TCP Fast Open. */ +#undef USE_OSX_MSG_FASTOPEN + /* Define this to enable SHA256 and SHA512 support. */ #undef USE_SHA2 @@ -620,6 +683,9 @@ #endif +/* Define this to enable server TCP Fast Open. */ +#undef USE_TCP_FASTOPEN + /* Whether the windows socket API is used */ #undef USE_WINSOCK @@ -979,6 +1045,11 @@ int memcmp(const void *x, const void *y, char *ctime_r(const time_t *timep, char *buf); #endif +#ifndef HAVE_STRSEP +#define strsep unbound_strsep +char *strsep(char **stringp, const char *delim); +#endif + #ifndef HAVE_ISBLANK #define isblank unbound_isblank int isblank(int c); Modified: stable/11/contrib/unbound/configure ============================================================================== --- stable/11/contrib/unbound/configure Fri Oct 21 13:51:47 2016 (r307728) +++ stable/11/contrib/unbound/configure Fri Oct 21 14:28:35 2016 (r307729) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for unbound 1.5.8. +# Generated by GNU Autoconf 2.69 for unbound 1.5.10. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unbound' PACKAGE_TARNAME='unbound' -PACKAGE_VERSION='1.5.8' -PACKAGE_STRING='unbound 1.5.8' +PACKAGE_VERSION='1.5.10' +PACKAGE_STRING='unbound 1.5.10' PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl' PACKAGE_URL='' @@ -832,7 +832,10 @@ with_ssl enable_sha2 enable_gost enable_ecdsa +enable_dsa enable_event_api *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Oct 21 14:36:58 2016 Return-Path: Delivered-To: svn-src-all@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 1BEA6C1BE32; Fri, 21 Oct 2016 14:36:58 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-yw0-x235.google.com (mail-yw0-x235.google.com [IPv6:2607:f8b0:4002:c05::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD669D4F; Fri, 21 Oct 2016 14:36:57 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-yw0-x235.google.com with SMTP id t193so97555078ywc.2; Fri, 21 Oct 2016 07:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=byo9P6kPHqN2E5cU6+NiCtdnV5XgV0OfDQxXQiH3hWQ=; b=ZokCpIsViVJSQm1cQRbwNuM9P3CISUv7V68NRXwLLvI1sBoisBzvAFYcM9n8yFlWJe LdpAgvPw++buE2KO2pdrIvXOkLgcmTsaiXgZpOv1nt72YVZs9UMFJRUF5cM6vQR520Fn GyeaADqlLUOTw/QQc/06X3Sm9tVrFNLZmGWPXfij6o7A3W/6IVnyg558hGhzjnidvRvw +/pxvqJr8WdKxqBWDu4r1nU6HBmQYd5TIZ4ejX6EfYorRZWI6SPHa4VDA728TtpeVeyq Cz633KLop8J9I8s/CIT/JzroT4lTQCysQk+IGy00O1pF9N2jjy6Qh/ZGU0P9BB83080u CiIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=byo9P6kPHqN2E5cU6+NiCtdnV5XgV0OfDQxXQiH3hWQ=; b=Hdt2SGRrEZ2MabGk30Y6YisVoAqSjtxpYeYI6In5v1lex3Tt8HziF+ZnL8wAeTHtfY sh4w364ZlHVqGNWDwF+fpodI+PQk4qN5eVllap4I0POG4vnSRVCI2LpKwCJA+Mendn3F BKLDW7u8tk6snpaMAy1I/QClmxCaO4hhNd0LBtTCr7UPXTVn5G2u8gpVaDo/rxsMjIvU 2Sb1wdjUR26MPu4zyLuD6KCcIuF3NAN+8sgaBgI4D5oQWK3lT4QVZgZT5vqKOGng+FaX jhVklUMzqD9pZjD4v2Jum3HX9XVpZbmcF8lJeSYcC5g7G9z4ln4STXKWhxQex0OgjNMN i2rA== X-Gm-Message-State: ABUngvfKCGqL6Fy7LtsxdJwFaSZTSaNcDh9R9i1IZC8o98OvAU6QC4QrVvokl6qc1z2KnAogEF/L+P/dCdHcrQ== X-Received: by 10.129.42.134 with SMTP id q128mr1422138ywq.38.1477060617067; Fri, 21 Oct 2016 07:36:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.133.131 with HTTP; Fri, 21 Oct 2016 07:36:55 -0700 (PDT) Received: by 10.129.133.131 with HTTP; Fri, 21 Oct 2016 07:36:55 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <20161021142821.GJ11808@strugglingcoder.info> References: <201610211129.u9LBTPbb026992@repo.freebsd.org> <20161021142821.GJ11808@strugglingcoder.info> From: Marcelo Araujo Date: Fri, 21 Oct 2016 22:36:55 +0800 Message-ID: Subject: Re: svn commit: r307727 - head/share/man/man4 To: hiren panchasara Cc: src-committers@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org, Michael Tuexen Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 14:36:58 -0000 Bump date too. On Oct 21, 2016 10:28 PM, "hiren panchasara" wrote: > On 10/21/16 at 11:29P, Michael Tuexen wrote: > > Author: tuexen > > Date: Fri Oct 21 11:29:25 2016 > > New Revision: 307727 > > URL: https://svnweb.freebsd.org/changeset/base/307727 > > > > Log: > > Document the TCP sysctl variables insecure_rst and insecure_syn. > > > > MFC after: 1 month > > Sponsored by: netflix > > > > Modified: > > head/share/man/man4/tcp.4 > > > > Modified: head/share/man/man4/tcp.4 > > ============================================================ > ================== > > --- head/share/man/man4/tcp.4 Fri Oct 21 10:32:57 2016 (r307726) > > +++ head/share/man/man4/tcp.4 Fri Oct 21 11:29:25 2016 (r307727) > > @@ -34,7 +34,7 @@ > > .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 > > .\" $FreeBSD$ > > .\" > > -.Dd June 28, 2016 > > +.Dd October 21, 2016 > > .Dt TCP 4 > > .Os > > .Sh NAME > > @@ -586,6 +586,12 @@ downshift. > > List of available TCP function blocks (TCP stacks). > > .It Va functions_default > > The default TCP function block (TCP stack). > > +.It Va insecure_rst > > +Use criterias defined in RFC793 instead of RFC5961 for accepting RST > segments. > > I am not a native speaker but should we s/criterias /criteria / ? > > +Default is false. > > +.It Va insecure_syn > > +Use criterias defined in RFC793 instead of RFC5961 for accepting SYN > segments. > > Same. > > +Default is false. > > .El > > .Sh ERRORS > > A socket operation may fail with one of the following errors returned: > > > > Cheers, > Hiren > From owner-svn-src-all@freebsd.org Fri Oct 21 15:09:12 2016 Return-Path: Delivered-To: svn-src-all@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 03C77C1ABBB; Fri, 21 Oct 2016 15:09:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB4B285F; Fri, 21 Oct 2016 15:09:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::d1be:e456:ed14:df1a] (unknown [IPv6:2001:7b8:3a7:0:d1be:e456:ed14:df1a]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 98EF4123F3; Fri, 21 Oct 2016 17:09:03 +0200 (CEST) Content-Type: multipart/signed; boundary="Apple-Mail=_623596D7-AA08-4F4A-8CCF-7D7DE11895F4"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r307676 - head/share/mk From: Dimitry Andric In-Reply-To: <201610201514.u9KFELev056434@repo.freebsd.org> Date: Fri, 21 Oct 2016 17:08:47 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <3489ADC0-3C2B-4220-BE93-F76014AB3A59@FreeBSD.org> References: <201610201514.u9KFELev056434@repo.freebsd.org> To: Jonathan Anderson X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 15:09:12 -0000 --Apple-Mail=_623596D7-AA08-4F4A-8CCF-7D7DE11895F4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 20 Oct 2016, at 17:14, Jonathan Anderson = wrote: >=20 > Author: jonathan > Date: Thu Oct 20 15:14:21 2016 > New Revision: 307676 > URL: https://svnweb.freebsd.org/changeset/base/307676 >=20 > Log: > Add make rules to build LLVM IR from C/C++ sources. >=20 > As a foundation for future work with LLVM's Intermediate = Representation (IR), > add new suffix rules that can be used to build .llo (text) or .bco = (bitcode) > files from C or C++ sources. Hi, Unfortunately I was not on the review list, but I object to using .llo and .bco, which implies that these are "object" files, and they are not. Can we please just use the upstream default extensions, .ll and .bc instead? -Dimitry --Apple-Mail=_623596D7-AA08-4F4A-8CCF-7D7DE11895F4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlgKL48ACgkQsF6jCi4glqM3tgCePex7DK3jLtXZEvyAMJX7kJgr fc0An1MpUYm+ydQwriNntfdI7WMqanTU =0UM9 -----END PGP SIGNATURE----- --Apple-Mail=_623596D7-AA08-4F4A-8CCF-7D7DE11895F4-- From owner-svn-src-all@freebsd.org Fri Oct 21 15:17:43 2016 Return-Path: Delivered-To: svn-src-all@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 DCD55C1AFC4; Fri, 21 Oct 2016 15:17:43 +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 AEDB1ED3; Fri, 21 Oct 2016 15:17:43 +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 u9LFHge7030524; Fri, 21 Oct 2016 15:17:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LFHgcM030523; Fri, 21 Oct 2016 15:17:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610211517.u9LFHgcM030523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 21 Oct 2016 15:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307730 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 15:17:44 -0000 Author: emaste Date: Fri Oct 21 15:17:42 2016 New Revision: 307730 URL: https://svnweb.freebsd.org/changeset/base/307730 Log: netmap: if_ptnet depends on inet Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Oct 21 14:28:35 2016 (r307729) +++ head/sys/conf/files Fri Oct 21 15:17:42 2016 (r307730) @@ -2226,7 +2226,7 @@ dev/nand/nfc_if.m optional nand dev/ncr/ncr.c optional ncr pci dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard -dev/netmap/if_ptnet.c optional netmap +dev/netmap/if_ptnet.c optional netmap inet dev/netmap/netmap.c optional netmap dev/netmap/netmap_freebsd.c optional netmap dev/netmap/netmap_generic.c optional netmap From owner-svn-src-all@freebsd.org Fri Oct 21 15:23:56 2016 Return-Path: Delivered-To: svn-src-all@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 16ACBC1B3ED; Fri, 21 Oct 2016 15:23:56 +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 DAE081902; Fri, 21 Oct 2016 15:23:55 +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 u9LFNtLj041191; Fri, 21 Oct 2016 15:23:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LFNsae041189; Fri, 21 Oct 2016 15:23:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610211523.u9LFNsae041189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 21 Oct 2016 15:23:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307731 - in head: sys/dev/pci usr.sbin/pciconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 15:23:56 -0000 Author: mav Date: Fri Oct 21 15:23:54 2016 New Revision: 307731 URL: https://svnweb.freebsd.org/changeset/base/307731 Log: Add names for some DASP devices. Submitted by: Dmitry Luhtionov MFC after: 1 week Modified: head/sys/dev/pci/pci.c head/usr.sbin/pciconf/pciconf.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Oct 21 15:17:42 2016 (r307730) +++ head/sys/dev/pci/pci.c Fri Oct 21 15:23:54 2016 (r307731) @@ -4608,6 +4608,9 @@ static const struct {PCIC_CRYPTO, PCIS_CRYPTO_ENTERTAIN, 1, "entertainment crypto"}, {PCIC_DASP, -1, 0, "dasp"}, {PCIC_DASP, PCIS_DASP_DPIO, 1, "DPIO module"}, + {PCIC_DASP, PCIS_DASP_PERFCNTRS, 1, "performance counters"}, + {PCIC_DASP, PCIS_DASP_COMM_SYNC, 1, "communication synchronizer"}, + {PCIC_DASP, PCIS_DASP_MGMT_CARD, 1, "signal processing management"}, {0, 0, 0, NULL} }; Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Fri Oct 21 15:17:42 2016 (r307730) +++ head/usr.sbin/pciconf/pciconf.c Fri Oct 21 15:23:54 2016 (r307731) @@ -697,6 +697,9 @@ static struct {PCIC_CRYPTO, PCIS_CRYPTO_NETCOMP, "entertainment crypto"}, {PCIC_DASP, -1, "dasp"}, {PCIC_DASP, PCIS_DASP_DPIO, "DPIO module"}, + {PCIC_DASP, PCIS_DASP_PERFCNTRS, "performance counters"}, + {PCIC_DASP, PCIS_DASP_COMM_SYNC, "communication synchronizer"}, + {PCIC_DASP, PCIS_DASP_MGMT_CARD, "signal processing management"}, {0, 0, NULL} }; From owner-svn-src-all@freebsd.org Fri Oct 21 15:26:33 2016 Return-Path: Delivered-To: svn-src-all@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 10915C1B58E; Fri, 21 Oct 2016 15:26:33 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id EEE951B44; Fri, 21 Oct 2016 15:26:32 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from ford.home.vangyzen.net (unknown [76.164.15.242]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 523E15649D; Fri, 21 Oct 2016 10:26:32 -0500 (CDT) Subject: Re: svn commit: r307727 - head/share/man/man4 To: hiren panchasara , Michael Tuexen References: <201610211129.u9LBTPbb026992@repo.freebsd.org> <20161021142821.GJ11808@strugglingcoder.info> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Eric van Gyzen Message-ID: Date: Fri, 21 Oct 2016 10:26:29 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161021142821.GJ11808@strugglingcoder.info> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 15:26:33 -0000 On 10/21/2016 09:28, hiren panchasara wrote: > On 10/21/16 at 11:29P, Michael Tuexen wrote: >> Author: tuexen >> Date: Fri Oct 21 11:29:25 2016 >> New Revision: 307727 >> URL: https://svnweb.freebsd.org/changeset/base/307727 >> >> Log: >> Document the TCP sysctl variables insecure_rst and insecure_syn. >> >> MFC after: 1 month >> Sponsored by: netflix >> >> Modified: >> head/share/man/man4/tcp.4 >> >> Modified: head/share/man/man4/tcp.4 >> ============================================================================== >> --- head/share/man/man4/tcp.4 Fri Oct 21 10:32:57 2016 (r307726) >> +++ head/share/man/man4/tcp.4 Fri Oct 21 11:29:25 2016 (r307727) >> @@ -34,7 +34,7 @@ >> .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 >> .\" $FreeBSD$ >> .\" >> -.Dd June 28, 2016 >> +.Dd October 21, 2016 >> .Dt TCP 4 >> .Os >> .Sh NAME >> @@ -586,6 +586,12 @@ downshift. >> List of available TCP function blocks (TCP stacks). >> .It Va functions_default >> The default TCP function block (TCP stack). >> +.It Va insecure_rst >> +Use criterias defined in RFC793 instead of RFC5961 for accepting RST segments. > > I am not a native speaker but should we s/criterias /criteria / ? I am a native speaker. Yes, these should be "criteria", which is the plural of "criterion". >> +Default is false. >> +.It Va insecure_syn >> +Use criterias defined in RFC793 instead of RFC5961 for accepting SYN segments. > > Same. >> +Default is false. >> .El >> .Sh ERRORS >> A socket operation may fail with one of the following errors returned: >> > > Cheers, > Hiren > From owner-svn-src-all@freebsd.org Fri Oct 21 16:11:30 2016 Return-Path: Delivered-To: svn-src-all@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 92449C1C25F; Fri, 21 Oct 2016 16:11:30 +0000 (UTC) (envelope-from gjb@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 49C5E91E; Fri, 21 Oct 2016 16:11:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LGBTEp057318; Fri, 21 Oct 2016 16:11:29 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LGBTRO057317; Fri, 21 Oct 2016 16:11:29 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610211611.u9LGBTRO057317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 21 Oct 2016 16:11:29 +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: r307732 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 16:11:30 -0000 Author: gjb Date: Fri Oct 21 16:11:29 2016 New Revision: 307732 URL: https://svnweb.freebsd.org/changeset/base/307732 Log: Document two errata items that may affect systems with ZFS boot pools on GPT. Submitted by: lidl Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 15:23:54 2016 (r307731) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:11:29 2016 (r307732) @@ -209,6 +209,44 @@ boot UEFI mode, or choose the "GPT + Active" scheme. + + + [2016-10-21] Support for sha512 and + skein checksumming has been added to the + ZFS filesystem. This was not mentioned + in the release notes. + + Systems being upgraded from earlier &os; releases with + ZFS will see a message in zpool + status output noting the pool is not at the + latest version, and some features may not be enabled. + Additional instructions on how to any ZFS + pools to the latest version and update the boot blocks for + all boot drives in the pool will also be provided in the + output. + + This information is also documented is also documented + in /usr/src/UPDATING, which is + included if the src component is selected + during installation. + + + + [2016-10-21] The size of the GPT + enabled ZFS boot blocks + (/boot/gptzfsboot) has increased past + 64K. Systems upgraded from older releases may experience + a problem where the size of the existing + "freebsd-boot" partition is too small to hold the + new gptzfsboot. + + Systems where the boot partition is immediately followed + by the swap partition, such as those installed via + &man.bsdinstall.8;, can resize the swap partition slightly + using the &man.gpart.8; resize command, + so space can be reclaimed to increase the size of the + freebsd-boot partition. + From owner-svn-src-all@freebsd.org Fri Oct 21 16:12:10 2016 Return-Path: Delivered-To: svn-src-all@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 5AA36C1C2B9; Fri, 21 Oct 2016 16:12:10 +0000 (UTC) (envelope-from gjb@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 295E9AFD; Fri, 21 Oct 2016 16:12:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LGC9ux059414; Fri, 21 Oct 2016 16:12:09 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LGC976059413; Fri, 21 Oct 2016 16:12:09 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610211612.u9LGC976059413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 21 Oct 2016 16:12: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: r307733 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 16:12:10 -0000 Author: gjb Date: Fri Oct 21 16:12:09 2016 New Revision: 307733 URL: https://svnweb.freebsd.org/changeset/base/307733 Log: Fix a spacing nit and a typo. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:11:29 2016 (r307732) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:12:09 2016 (r307733) @@ -97,8 +97,8 @@ An issue was discovered with Amazon® EC2™ images which would cause the virtual machine to hang during - boot when upgrading from previous FreeBSD versions. New - EC2™ installations are not affected, but exisiting + boot when upgrading from previous FreeBSD versions. New + EC2™ installations are not affected, but existing installations running earlier releases are advised to wait until the issue is resolved in an Errata Notice before upgrading. An Errata Notice to address this is planned From owner-svn-src-all@freebsd.org Fri Oct 21 16:12:25 2016 Return-Path: Delivered-To: svn-src-all@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 52935C1C302; Fri, 21 Oct 2016 16:12:25 +0000 (UTC) (envelope-from oshogbo@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 131EFD4A; Fri, 21 Oct 2016 16:12:25 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LGCOBd059471; Fri, 21 Oct 2016 16:12:24 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LGCOv4059470; Fri, 21 Oct 2016 16:12:24 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201610211612.u9LGCOv4059470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Fri, 21 Oct 2016 16:12:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307734 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 16:12:25 -0000 Author: oshogbo Date: Fri Oct 21 16:12:23 2016 New Revision: 307734 URL: https://svnweb.freebsd.org/changeset/base/307734 Log: capsicum: perform copyout without the fildesc lock held in sys_cap_ioctls_get Reviewed by: pjd Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Fri Oct 21 16:12:09 2016 (r307733) +++ head/sys/kern/sys_capability.c Fri Oct 21 16:12:23 2016 (r307734) @@ -89,6 +89,8 @@ SYSCTL_INT(_kern, OID_AUTO, trap_enotcap #ifdef CAPABILITY_MODE +#define IOCTLS_MAX_COUNT 256 /* XXX: Is 256 sane? */ + FEATURE(security_capability_mode, "Capsicum Capability Mode"); /* @@ -398,6 +400,11 @@ kern_cap_ioctls_limit(struct thread *td, AUDIT_ARG_FD(fd); + if (ncmds > IOCTLS_MAX_COUNT) { + error = EINVAL; + goto out_free; + } + fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); @@ -418,6 +425,7 @@ kern_cap_ioctls_limit(struct thread *td, error = 0; out: FILEDESC_XUNLOCK(fdp); +out_free: free(cmds, M_FILECAPS); return (error); } @@ -431,7 +439,7 @@ sys_cap_ioctls_limit(struct thread *td, ncmds = uap->ncmds; - if (ncmds > 256) /* XXX: Is 256 sane? */ + if (ncmds > IOCTLS_MAX_COUNT) return (EINVAL); if (ncmds == 0) { @@ -453,45 +461,59 @@ sys_cap_ioctls_get(struct thread *td, st { struct filedesc *fdp; struct filedescent *fdep; - u_long *cmds; - size_t maxcmds; + u_long *cmdsp, *dstcmds; + size_t maxcmds, ncmds; + int16_t count; int error, fd; fd = uap->fd; - cmds = uap->cmds; + dstcmds = uap->cmds; maxcmds = uap->maxcmds; AUDIT_ARG_FD(fd); fdp = td->td_proc->p_fd; - FILEDESC_SLOCK(fdp); - if (fget_locked(fdp, fd) == NULL) { + cmdsp = NULL; + if (dstcmds != NULL) { + cmdsp = malloc(sizeof(cmdsp[0]) * IOCTLS_MAX_COUNT, M_FILECAPS, + M_WAITOK | M_ZERO); + } + + FILEDESC_SLOCK(fdp); + fdep = fdeget_locked(fdp, fd); + if (fdep == NULL) { error = EBADF; + FILEDESC_SUNLOCK(fdp); goto out; } + count = fdep->fde_nioctls; + if (count != -1 && cmdsp != NULL) { + ncmds = MIN(count, maxcmds); + memcpy(cmdsp, fdep->fde_ioctls, sizeof(cmdsp[0]) * ncmds); + } + FILEDESC_SUNLOCK(fdp); /* * If all ioctls are allowed (fde_nioctls == -1 && fde_ioctls == NULL) * the only sane thing we can do is to not populate the given array and * return CAP_IOCTLS_ALL. */ - - fdep = &fdp->fd_ofiles[fd]; - if (cmds != NULL && fdep->fde_ioctls != NULL) { - error = copyout(fdep->fde_ioctls, cmds, - sizeof(cmds[0]) * MIN(fdep->fde_nioctls, maxcmds)); - if (error != 0) - goto out; - } - if (fdep->fde_nioctls == -1) + if (count != -1) { + if (cmdsp != NULL) { + error = copyout(cmdsp, dstcmds, + sizeof(cmdsp[0]) * ncmds); + if (error != 0) + goto out; + } + td->td_retval[0] = count; + } else { td->td_retval[0] = CAP_IOCTLS_ALL; - else - td->td_retval[0] = fdep->fde_nioctls; + } error = 0; out: - FILEDESC_SUNLOCK(fdp); + free(cmdsp, M_FILECAPS); return (error); } From owner-svn-src-all@freebsd.org Fri Oct 21 16:14:59 2016 Return-Path: Delivered-To: svn-src-all@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 97FA0C1C42C; Fri, 21 Oct 2016 16:14:59 +0000 (UTC) (envelope-from gjb@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 63B24FA6; Fri, 21 Oct 2016 16:14:59 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LGEw1o060311; Fri, 21 Oct 2016 16:14:58 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LGEwLb060310; Fri, 21 Oct 2016 16:14:58 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610211614.u9LGEwLb060310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 21 Oct 2016 16:14:58 +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: r307735 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 16:14:59 -0000 Author: gjb Date: Fri Oct 21 16:14:58 2016 New Revision: 307735 URL: https://svnweb.freebsd.org/changeset/base/307735 Log: Fix a copy/paste error. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:12:23 2016 (r307734) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:14:58 2016 (r307735) @@ -225,10 +225,10 @@ boot all boot drives in the pool will also be provided in the output. - This information is also documented is also documented - in /usr/src/UPDATING, which is - included if the src component is selected - during installation. + This information is also documented in + /usr/src/UPDATING, which is included if + the src component is selected during + installation. From owner-svn-src-all@freebsd.org Fri Oct 21 16:32:00 2016 Return-Path: Delivered-To: svn-src-all@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 1C3BEC1C81E; Fri, 21 Oct 2016 16:32:00 +0000 (UTC) (envelope-from oshogbo@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 E0784C1D; Fri, 21 Oct 2016 16:31:59 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LGVxwe066473; Fri, 21 Oct 2016 16:31:59 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LGVxLZ066472; Fri, 21 Oct 2016 16:31:59 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201610211631.u9LGVxLZ066472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Fri, 21 Oct 2016 16:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307737 - head/lib/libcapsicum X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 16:32:00 -0000 Author: oshogbo Date: Fri Oct 21 16:31:58 2016 New Revision: 307737 URL: https://svnweb.freebsd.org/changeset/base/307737 Log: Fix few sentence in the man page. Pointed out by: wblock Modified: head/lib/libcapsicum/capsicum_helpers.3 Modified: head/lib/libcapsicum/capsicum_helpers.3 ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.3 Fri Oct 21 16:29:40 2016 (r307736) +++ head/lib/libcapsicum/capsicum_helpers.3 Fri Oct 21 16:31:58 2016 (r307737) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd October 21, 2016 .Dt CAPSICUM_HELPERS 3 .Os .Sh NAME @@ -57,7 +57,8 @@ .Sh DESCRIPTION The .Nm capsicum helpers -are a set of a inline functions which simplify Capsicumizing programs. +are a set of a inline functions which simplify modifying programs to use +Capsicum. The goal is to reduce duplicated code patterns. The .Nm capsicum helpers @@ -70,7 +71,7 @@ restricts capabilities on .Fa fd to only those needed by POSIX stream objects (that is, FILEs). .Pp -The following flags can be provided: +These flags can be provided: .Pp .Bl -tag -width "CAPH_IGNORE_EBADF" -compact -offset indent .It Dv CAPH_IGNORE_EBADF From owner-svn-src-all@freebsd.org Fri Oct 21 16:43:15 2016 Return-Path: Delivered-To: svn-src-all@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 409DAC1C9ED; Fri, 21 Oct 2016 16:43:15 +0000 (UTC) (envelope-from gjb@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 0CD06279; Fri, 21 Oct 2016 16:43:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LGhEOd071733; Fri, 21 Oct 2016 16:43:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LGhEYR071732; Fri, 21 Oct 2016 16:43:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610211643.u9LGhEYR071732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 21 Oct 2016 16:43: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: r307739 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 16:43:15 -0000 Author: gjb Date: Fri Oct 21 16:43:13 2016 New Revision: 307739 URL: https://svnweb.freebsd.org/changeset/base/307739 Log: Document an issue with clang and source-based upgrades from 10.2 and earlier. Submitted by: imp Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:42:39 2016 (r307738) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:43:13 2016 (r307739) @@ -247,6 +247,19 @@ boot so space can be reclaimed to increase the size of the freebsd-boot partition. + + + [2016-10-21] Due to a bug in earlier versions of + &man.clang.1; that are difficult to work around in the + upgrade process, to upgrade the system from sources via + buildworld to -CURRENT or &release;, it is necessary to + upgrade machines running 9.x to at least revision r286035, + or machines running 10.x to revision r286033. Source-based + upgrades from 10.3-RELEASE are not affected. This differs + from the historical situation where one could generally + upgrade from anywhere on earlier stable branches, so caution + should be exercised. + From owner-svn-src-all@freebsd.org Fri Oct 21 16:47:03 2016 Return-Path: Delivered-To: svn-src-all@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 8C046C1CB72; Fri, 21 Oct 2016 16:47:03 +0000 (UTC) (envelope-from gjb@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 5BC1077A; Fri, 21 Oct 2016 16:47:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LGl2sB071997; Fri, 21 Oct 2016 16:47:02 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LGl2QS071996; Fri, 21 Oct 2016 16:47:02 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610211647.u9LGl2QS071996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 21 Oct 2016 16:47: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: r307740 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 16:47:03 -0000 Author: gjb Date: Fri Oct 21 16:47:02 2016 New Revision: 307740 URL: https://svnweb.freebsd.org/changeset/base/307740 Log: Fix wording. Submitted by: adamw Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:43:13 2016 (r307739) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 16:47:02 2016 (r307740) @@ -220,10 +220,10 @@ boot ZFS will see a message in zpool status output noting the pool is not at the latest version, and some features may not be enabled. - Additional instructions on how to any ZFS - pools to the latest version and update the boot blocks for - all boot drives in the pool will also be provided in the - output. + Additional instructions on how to update + ZFS pools to the latest version and + update the boot blocks for all boot drives in the pool will + also be provided in the output. This information is also documented in /usr/src/UPDATING, which is included if From owner-svn-src-all@freebsd.org Fri Oct 21 17:25:20 2016 Return-Path: Delivered-To: svn-src-all@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 A0279C1B8B6; Fri, 21 Oct 2016 17:25:20 +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 71F3BFF5; Fri, 21 Oct 2016 17:25:20 +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 u9LHPJcP087070; Fri, 21 Oct 2016 17:25:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LHPJSR087069; Fri, 21 Oct 2016 17:25:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610211725.u9LHPJSR087069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 21 Oct 2016 17:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307741 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 17:25:20 -0000 Author: emaste Date: Fri Oct 21 17:25:19 2016 New Revision: 307741 URL: https://svnweb.freebsd.org/changeset/base/307741 Log: Allow all subdirectories to be optional via SUBDIR.${MK_*} Reviewed by: br, imp Tested by: br Pointy hat to: emaste Differential Revision: https://reviews.freebsd.org/D8317 Modified: head/share/mk/bsd.subdir.mk Modified: head/share/mk/bsd.subdir.mk ============================================================================== --- head/share/mk/bsd.subdir.mk Fri Oct 21 16:47:02 2016 (r307740) +++ head/share/mk/bsd.subdir.mk Fri Oct 21 17:25:19 2016 (r307741) @@ -110,7 +110,7 @@ install: beforeinstall realinstall after # SUBDIR recursing may be disabled for MK_DIRDEPS_BUILD .if !target(_SUBDIR) -.if defined(SUBDIR) +.if defined(SUBDIR) || defined(SUBDIR.yes) SUBDIR:=${SUBDIR} ${SUBDIR.yes} SUBDIR:=${SUBDIR:u} .endif From owner-svn-src-all@freebsd.org Fri Oct 21 17:39:07 2016 Return-Path: Delivered-To: svn-src-all@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 06244C1BB3A; Fri, 21 Oct 2016 17:39:07 +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 A6E5D850; Fri, 21 Oct 2016 17:39:06 +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 u9LHd5oe091107; Fri, 21 Oct 2016 17:39:05 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LHd5J8091105; Fri, 21 Oct 2016 17:39:05 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201610211739.u9LHd5J8091105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 21 Oct 2016 17:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307742 - in stable/10: sbin/mount_msdosfs sys/fs/msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 17:39:07 -0000 Author: asomers Date: Fri Oct 21 17:39:05 2016 New Revision: 307742 URL: https://svnweb.freebsd.org/changeset/base/307742 Log: MFC r306276, but don't remove findwin95 Mount msdosfs with longnames support by default. The old behavior depended on the FAT version and on what files were in the root directory. "mount_msdosfs -o shortnames" is still supported. Modified: stable/10/sbin/mount_msdosfs/mount_msdosfs.8 stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_msdosfs/mount_msdosfs.8 ============================================================================== --- stable/10/sbin/mount_msdosfs/mount_msdosfs.8 Fri Oct 21 17:25:19 2016 (r307741) +++ stable/10/sbin/mount_msdosfs/mount_msdosfs.8 Fri Oct 21 17:39:05 2016 (r307742) @@ -142,15 +142,8 @@ If neither nor .Fl l are given, -.Nm -searches the root directory of the file system to -be mounted for any existing Win'95 long filenames. -If no such entries are found, but short DOS filenames are found, -.Fl s -is the default. -Otherwise .Fl l -is assumed. +is the default. .It Fl 9 Ignore the special Win'95 directory entries even if deleting or renaming a file. Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 21 17:25:19 2016 (r307741) +++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 21 17:39:05 2016 (r307742) @@ -175,24 +175,8 @@ update_mp(struct mount *mp, struct threa if (pmp->pm_flags & MSDOSFSMNT_NOWIN95) pmp->pm_flags |= MSDOSFSMNT_SHORTNAME; - else if (!(pmp->pm_flags & - (MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) { - struct vnode *rootvp; - - /* - * Try to divine whether to support Win'95 long filenames - */ - if (FAT32(pmp)) - pmp->pm_flags |= MSDOSFSMNT_LONGNAME; - else { - if ((error = - msdosfs_root(mp, LK_EXCLUSIVE, &rootvp)) != 0) - return error; - pmp->pm_flags |= findwin95(VTODE(rootvp)) ? - MSDOSFSMNT_LONGNAME : MSDOSFSMNT_SHORTNAME; - vput(rootvp); - } - } + else + pmp->pm_flags |= MSDOSFSMNT_LONGNAME; return 0; } From owner-svn-src-all@freebsd.org Fri Oct 21 17:43:27 2016 Return-Path: Delivered-To: svn-src-all@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 0FD66C1BCE8; Fri, 21 Oct 2016 17:43:27 +0000 (UTC) (envelope-from markj@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 CF86FC26; Fri, 21 Oct 2016 17:43:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LHhPGP094623; Fri, 21 Oct 2016 17:43:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LHhPfm094622; Fri, 21 Oct 2016 17:43:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610211743.u9LHhPfm094622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 21 Oct 2016 17:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307743 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 17:43:27 -0000 Author: markj Date: Fri Oct 21 17:43:25 2016 New Revision: 307743 URL: https://svnweb.freebsd.org/changeset/base/307743 Log: MFC r307236: Plug a vnode lock leak in vm_fault_hold(). Modified: stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Fri Oct 21 17:39:05 2016 (r307742) +++ stable/10/sys/vm/vm_fault.c Fri Oct 21 17:43:25 2016 (r307743) @@ -320,6 +320,8 @@ RetryFault:; growstack = FALSE; goto RetryFault; } + if (fs.vp != NULL) + vput(fs.vp); return (result); } From owner-svn-src-all@freebsd.org Fri Oct 21 17:44:48 2016 Return-Path: Delivered-To: svn-src-all@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 9B5B4C1BDAC; Fri, 21 Oct 2016 17:44:48 +0000 (UTC) (envelope-from markj@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 69AD4E68; Fri, 21 Oct 2016 17:44:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LHiltA094727; Fri, 21 Oct 2016 17:44:47 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LHilfL094726; Fri, 21 Oct 2016 17:44:47 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201610211744.u9LHilfL094726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 21 Oct 2016 17:44: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: r307744 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 17:44:48 -0000 Author: markj Date: Fri Oct 21 17:44:47 2016 New Revision: 307744 URL: https://svnweb.freebsd.org/changeset/base/307744 Log: MFC r307236: Plug a vnode lock leak in vm_fault_hold(). Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Fri Oct 21 17:43:25 2016 (r307743) +++ stable/11/sys/vm/vm_fault.c Fri Oct 21 17:44:47 2016 (r307744) @@ -321,6 +321,8 @@ RetryFault:; growstack = FALSE; goto RetryFault; } + if (fs.vp != NULL) + vput(fs.vp); return (result); } From owner-svn-src-all@freebsd.org Fri Oct 21 18:27:32 2016 Return-Path: Delivered-To: svn-src-all@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 09FB2C1C962; Fri, 21 Oct 2016 18:27:32 +0000 (UTC) (envelope-from hiren@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 B110AAD0; Fri, 21 Oct 2016 18:27:31 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LIRUde010304; Fri, 21 Oct 2016 18:27:30 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LIRUUi010303; Fri, 21 Oct 2016 18:27:30 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201610211827.u9LIRUUi010303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Fri, 21 Oct 2016 18:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307745 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 18:27:32 -0000 Author: hiren Date: Fri Oct 21 18:27:30 2016 New Revision: 307745 URL: https://svnweb.freebsd.org/changeset/base/307745 Log: Rework r306337. In sendit(), if mp->msg_control is present, then in sockargs() we are allocating mbuf to store mp->msg_control. Later in kern_sendit(), call to getsock_cap(), will check validity of file pointer passed, if this fails EBADF is returned but mbuf allocated in sockargs() is not freed. Made code changes to free the same. Since freeing control mbuf in sendit() after checking (control != NULL) may lead to double freeing of control mbuf in sendit(), we can free control mbuf in kern_sendit() if there are any errors in the routine. Submitted by: Lohith Bellad Reviewed by: glebius MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D8152 Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Fri Oct 21 17:44:47 2016 (r307744) +++ head/sys/kern/uipc_syscalls.c Fri Oct 21 18:27:30 2016 (r307745) @@ -762,8 +762,10 @@ kern_sendit(struct thread *td, int s, st cap_rights_set(&rights, CAP_CONNECT); } error = getsock_cap(td, s, &rights, &fp, NULL, NULL); - if (error != 0) + if (error != 0) { + m_freem(control); return (error); + } so = (struct socket *)fp->f_data; #ifdef KTRACE @@ -774,12 +776,16 @@ kern_sendit(struct thread *td, int s, st if (mp->msg_name != NULL) { error = mac_socket_check_connect(td->td_ucred, so, mp->msg_name); - if (error != 0) + if (error != 0) { + m_freem(control); goto bad; + } } error = mac_socket_check_send(td->td_ucred, so); - if (error != 0) + if (error != 0) { + m_freem(control); goto bad; + } #endif auio.uio_iov = mp->msg_iov; @@ -793,6 +799,7 @@ kern_sendit(struct thread *td, int s, st for (i = 0; i < mp->msg_iovlen; i++, iov++) { if ((auio.uio_resid += iov->iov_len) < 0) { error = EINVAL; + m_freem(control); goto bad; } } From owner-svn-src-all@freebsd.org Fri Oct 21 18:37:54 2016 Return-Path: Delivered-To: svn-src-all@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 CC1D9C1CBF2 for ; Fri, 21 Oct 2016 18:37:54 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 96A86FB9; Fri, 21 Oct 2016 18:37:54 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 5CB93103DA; Fri, 21 Oct 2016 18:37:47 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id 770B6439CF; Fri, 21 Oct 2016 20:37:47 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Colin Percival Cc: src-committers@FreeBSD.org, "svn-src-all\@freebsd.org" Subject: Re: cvs commit: src/sys/sys _types.h resource.h References: <200411081805.iA8I5hVK038813@repoman.freebsd.org> <01000157e3ac7982-b19e61c1-1619-44b1-88b5-3080d85e8d6d-000000@email.amazonses.com> Date: Fri, 21 Oct 2016 20:37:47 +0200 In-Reply-To: <01000157e3ac7982-b19e61c1-1619-44b1-88b5-3080d85e8d6d-000000@email.amazonses.com> (Colin Percival's message of "Thu, 20 Oct 2016 19:58:33 +0000") Message-ID: <86wph1o8ec.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 18:37:54 -0000 Colin Percival writes: > Dag-Erling Sm=C3=B8rgrav writes: > > -typedef __int64_t __rlim_t; /* resource limit (XXX not uns= igned) */ > > +typedef __int64_t __rlim_t; /* resource limit - intentiona= lly */ > > + /* signed, because of legacy c= ode */ > > + /* that uses -1 for RLIM_INFIN= ITY */ > Is it time to drop compatibility for code which was "legacy" 12 years ago > in order to conform to the POSIX stipulation that rlim_t should be unsign= ed? Well, all of that code is already broken because I defined RLIM_INFINITY to 2^63-1 instead of 2^64-1. But we might as well align ourselves with the legacy code (and with other OSes), as the consequences of changing RLIM_INFINITY are mostly cosmetic: an older ulimit on a newer kernel (or the other way around) will print a very large number instead of "unlimited", and if an older binary sets a limit to RLIM_INFINITY on a newer kernel (or the other way around) the kernel will spend a little extra time checking limits which will never be reached anyway. This will allow us to eliminate a certain amount of code (e.g. in procfs and the Linuxulator) that translates back and forth between our current RLIMIT_INFINITY and (int64_t)-1 / ~0UL. DES -- Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@freebsd.org Fri Oct 21 18:45:11 2016 Return-Path: Delivered-To: svn-src-all@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 22ACAC1CD40; Fri, 21 Oct 2016 18:45:11 +0000 (UTC) (envelope-from tuexen@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 E317C65A; Fri, 21 Oct 2016 18:45:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LIjABB017750; Fri, 21 Oct 2016 18:45:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LIjAPB017749; Fri, 21 Oct 2016 18:45:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201610211845.u9LIjAPB017749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 21 Oct 2016 18:45:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307746 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 18:45:11 -0000 Author: tuexen Date: Fri Oct 21 18:45:09 2016 New Revision: 307746 URL: https://svnweb.freebsd.org/changeset/base/307746 Log: Fix a grammar error. Reported by:i hiren, vangyzen MFC after: 1 month X-MFC: r307727 Sponsored by: Netflix Modified: head/share/man/man4/tcp.4 Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Fri Oct 21 18:27:30 2016 (r307745) +++ head/share/man/man4/tcp.4 Fri Oct 21 18:45:09 2016 (r307746) @@ -587,10 +587,10 @@ List of available TCP function blocks (T .It Va functions_default The default TCP function block (TCP stack). .It Va insecure_rst -Use criterias defined in RFC793 instead of RFC5961 for accepting RST segments. +Use criteria defined in RFC793 instead of RFC5961 for accepting RST segments. Default is false. .It Va insecure_syn -Use criterias defined in RFC793 instead of RFC5961 for accepting SYN segments. +Use criteria defined in RFC793 instead of RFC5961 for accepting SYN segments. Default is false. .El .Sh ERRORS From owner-svn-src-all@freebsd.org Fri Oct 21 18:45:55 2016 Return-Path: Delivered-To: svn-src-all@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 A9CE4C1CD92; Fri, 21 Oct 2016 18:45:55 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6FACC83F; Fri, 21 Oct 2016 18:45:54 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [192.168.1.109] (p508F0219.dip0.t-ipconnect.de [80.143.2.25]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 7FC9671E3F917; Fri, 21 Oct 2016 20:45:44 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Subject: Re: svn commit: r307727 - head/share/man/man4 From: Michael Tuexen In-Reply-To: Date: Fri, 21 Oct 2016 20:45:42 +0200 Cc: hiren panchasara , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <24E8C388-EA2D-425E-88DC-E288D2C28D35@freebsd.org> References: <201610211129.u9LBTPbb026992@repo.freebsd.org> <20161021142821.GJ11808@strugglingcoder.info> To: Eric van Gyzen X-Mailer: Apple Mail (2.3226) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 18:45:55 -0000 > On 21 Oct 2016, at 17:26, Eric van Gyzen wrote: >=20 > On 10/21/2016 09:28, hiren panchasara wrote: >> On 10/21/16 at 11:29P, Michael Tuexen wrote: >>> Author: tuexen >>> Date: Fri Oct 21 11:29:25 2016 >>> New Revision: 307727 >>> URL: https://svnweb.freebsd.org/changeset/base/307727 >>>=20 >>> Log: >>> Document the TCP sysctl variables insecure_rst and insecure_syn. >>>=20 >>> MFC after: 1 month >>> Sponsored by: netflix >>>=20 >>> Modified: >>> head/share/man/man4/tcp.4 >>>=20 >>> Modified: head/share/man/man4/tcp.4 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/share/man/man4/tcp.4 Fri Oct 21 10:32:57 2016 = (r307726) >>> +++ head/share/man/man4/tcp.4 Fri Oct 21 11:29:25 2016 = (r307727) >>> @@ -34,7 +34,7 @@ >>> .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 >>> .\" $FreeBSD$ >>> .\" >>> -.Dd June 28, 2016 >>> +.Dd October 21, 2016 >>> .Dt TCP 4 >>> .Os >>> .Sh NAME >>> @@ -586,6 +586,12 @@ downshift. >>> List of available TCP function blocks (TCP stacks). >>> .It Va functions_default >>> The default TCP function block (TCP stack). >>> +.It Va insecure_rst >>> +Use criterias defined in RFC793 instead of RFC5961 for accepting = RST segments. >>=20 >> I am not a native speaker but should we s/criterias /criteria / ? >=20 > I am a native speaker. Yes, these should be "criteria", which is the = plural of > "criterion". Thanks. Fixed in r307746. Best regards Michael >=20 >>> +Default is false. >>> +.It Va insecure_syn >>> +Use criterias defined in RFC793 instead of RFC5961 for accepting = SYN segments. >>=20 >> Same. >>> +Default is false. >>> .El >>> .Sh ERRORS >>> A socket operation may fail with one of the following errors = returned: >>>=20 >>=20 >> Cheers, >> Hiren >>=20 From owner-svn-src-all@freebsd.org Fri Oct 21 18:46:17 2016 Return-Path: Delivered-To: svn-src-all@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 636D3C1CDC5; Fri, 21 Oct 2016 18:46:17 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B4109A8; Fri, 21 Oct 2016 18:46:16 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [192.168.1.109] (p508F0219.dip0.t-ipconnect.de [80.143.2.25]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 20CA271E3F917; Fri, 21 Oct 2016 20:46:14 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Subject: Re: svn commit: r307727 - head/share/man/man4 From: Michael Tuexen In-Reply-To: Date: Fri, 21 Oct 2016 20:46:13 +0200 Cc: hiren panchasara , src-committers@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <21B3CF83-4C4C-4690-B3FA-B4A97C91BDFF@freebsd.org> References: <201610211129.u9LBTPbb026992@repo.freebsd.org> <20161021142821.GJ11808@strugglingcoder.info> To: araujo@freebsd.org X-Mailer: Apple Mail (2.3226) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 18:46:17 -0000 > On 21 Oct 2016, at 16:36, Marcelo Araujo = wrote: >=20 > Bump date too. It was bumped, wasn't it? Best regards Michael >=20 >=20 > On Oct 21, 2016 10:28 PM, "hiren panchasara" = wrote: > On 10/21/16 at 11:29P, Michael Tuexen wrote: > > Author: tuexen > > Date: Fri Oct 21 11:29:25 2016 > > New Revision: 307727 > > URL: https://svnweb.freebsd.org/changeset/base/307727 > > > > Log: > > Document the TCP sysctl variables insecure_rst and insecure_syn. > > > > MFC after: 1 month > > Sponsored by: netflix > > > > Modified: > > head/share/man/man4/tcp.4 > > > > Modified: head/share/man/man4/tcp.4 > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > > --- head/share/man/man4/tcp.4 Fri Oct 21 10:32:57 2016 = (r307726) > > +++ head/share/man/man4/tcp.4 Fri Oct 21 11:29:25 2016 = (r307727) > > @@ -34,7 +34,7 @@ > > .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 > > .\" $FreeBSD$ > > .\" > > -.Dd June 28, 2016 > > +.Dd October 21, 2016 > > .Dt TCP 4 > > .Os > > .Sh NAME > > @@ -586,6 +586,12 @@ downshift. > > List of available TCP function blocks (TCP stacks). > > .It Va functions_default > > The default TCP function block (TCP stack). > > +.It Va insecure_rst > > +Use criterias defined in RFC793 instead of RFC5961 for accepting = RST segments. >=20 > I am not a native speaker but should we s/criterias /criteria / ? > > +Default is false. > > +.It Va insecure_syn > > +Use criterias defined in RFC793 instead of RFC5961 for accepting = SYN segments. >=20 > Same. > > +Default is false. > > .El > > .Sh ERRORS > > A socket operation may fail with one of the following errors = returned: > > >=20 > Cheers, > Hiren From owner-svn-src-all@freebsd.org Fri Oct 21 18:54:58 2016 Return-Path: Delivered-To: svn-src-all@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 3BA39C1B0EA; Fri, 21 Oct 2016 18:54:58 +0000 (UTC) (envelope-from ken@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 F2AF912D; Fri, 21 Oct 2016 18:54:57 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LIsv82021597; Fri, 21 Oct 2016 18:54:57 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LIsv9w021596; Fri, 21 Oct 2016 18:54:57 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201610211854.u9LIsv9w021596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 21 Oct 2016 18:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307747 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 18:54:58 -0000 Author: ken Date: Fri Oct 21 18:54:56 2016 New Revision: 307747 URL: https://svnweb.freebsd.org/changeset/base/307747 Log: Fix a problem in camcontrol(8) that cropped up with r307684. In r307684, I changed rescan_or_reset_bus() to bzero stack-allocated CCBs before sending them to the kernel because there was stack garbage in there that wound up meaning that bogus CCB flags were set. While this fixed the 'camcontrol rescan all' case (XPT_DEV_MATCH CCBs were failing previously), it broke the 'camcontrol rescan 0' (or any other number) case when INVARIANTS are turned on. Rescanning a single bus reliably produced an assert in cam_periph_runccb(): panic: cam_periph_runccb: ccb=0xfffff80044ffe000, func_code=0x708, flags=0xffffdde0 The flags values don't make sense from the code. Changing the CCBs in rescan_or_reset_bus() from stack to heap allocated avoids the problem. It would be better to understand why userland stack allocated CCBs don't work properly, since there may be other code that breaks if stack allocated CCBs don't work. sbin/camcontrol/camcontrol.c: In rescan_or_reset_bus(), allocate the CCBs using malloc(3) instead of on the stack to avoid an assertion in cam_periph_runccb(). MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Oct 21 18:45:09 2016 (r307746) +++ head/sbin/camcontrol/camcontrol.c Fri Oct 21 18:54:56 2016 (r307747) @@ -3127,8 +3127,8 @@ dorescan_or_reset(int argc, char **argv, static int rescan_or_reset_bus(path_id_t bus, int rescan) { - union ccb ccb, matchccb; - int fd, retval; + union ccb *ccb = NULL, *matchccb = NULL; + int fd = -1, retval; int bufsize; retval = 0; @@ -3139,37 +3139,41 @@ rescan_or_reset_bus(path_id_t bus, int r return(1); } - bzero(&ccb, sizeof(ccb)); + ccb = malloc(sizeof(*ccb)); + if (ccb == NULL) { + warn("failed to allocate CCB"); + retval = 1; + goto bailout; + } + bzero(ccb, sizeof(*ccb)); if (bus != CAM_BUS_WILDCARD) { - ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS; - ccb.ccb_h.path_id = bus; - ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; - ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; - ccb.crcn.flags = CAM_FLAG_NONE; + ccb->ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS; + ccb->ccb_h.path_id = bus; + ccb->ccb_h.target_id = CAM_TARGET_WILDCARD; + ccb->ccb_h.target_lun = CAM_LUN_WILDCARD; + ccb->crcn.flags = CAM_FLAG_NONE; /* run this at a low priority */ - ccb.ccb_h.pinfo.priority = 5; + ccb->ccb_h.pinfo.priority = 5; - if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { + if (ioctl(fd, CAMIOCOMMAND, ccb) == -1) { warn("CAMIOCOMMAND ioctl failed"); - close(fd); - return(1); + retval = 1; + goto bailout; } - if ((ccb.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { fprintf(stdout, "%s of bus %d was successful\n", rescan ? "Re-scan" : "Reset", bus); } else { fprintf(stdout, "%s of bus %d returned error %#x\n", rescan ? "Re-scan" : "Reset", bus, - ccb.ccb_h.status & CAM_STATUS_MASK); + ccb->ccb_h.status & CAM_STATUS_MASK); retval = 1; } - close(fd); - return(retval); - + goto bailout; } @@ -3183,58 +3187,64 @@ rescan_or_reset_bus(path_id_t bus, int r * no-op, sending a rescan to the xpt bus would result in a status of * CAM_REQ_INVALID. */ - bzero(&matchccb, sizeof(matchccb)); - matchccb.ccb_h.func_code = XPT_DEV_MATCH; - matchccb.ccb_h.path_id = CAM_BUS_WILDCARD; + matchccb = malloc(sizeof(*matchccb)); + if (matchccb == NULL) { + warn("failed to allocate CCB"); + retval = 1; + goto bailout; + } + bzero(matchccb, sizeof(*matchccb)); + matchccb->ccb_h.func_code = XPT_DEV_MATCH; + matchccb->ccb_h.path_id = CAM_BUS_WILDCARD; bufsize = sizeof(struct dev_match_result) * 20; - matchccb.cdm.match_buf_len = bufsize; - matchccb.cdm.matches=(struct dev_match_result *)malloc(bufsize); - if (matchccb.cdm.matches == NULL) { + matchccb->cdm.match_buf_len = bufsize; + matchccb->cdm.matches=(struct dev_match_result *)malloc(bufsize); + if (matchccb->cdm.matches == NULL) { warnx("can't malloc memory for matches"); retval = 1; goto bailout; } - matchccb.cdm.num_matches = 0; + matchccb->cdm.num_matches = 0; - matchccb.cdm.num_patterns = 1; - matchccb.cdm.pattern_buf_len = sizeof(struct dev_match_pattern); + matchccb->cdm.num_patterns = 1; + matchccb->cdm.pattern_buf_len = sizeof(struct dev_match_pattern); - matchccb.cdm.patterns = (struct dev_match_pattern *)malloc( - matchccb.cdm.pattern_buf_len); - if (matchccb.cdm.patterns == NULL) { + matchccb->cdm.patterns = (struct dev_match_pattern *)malloc( + matchccb->cdm.pattern_buf_len); + if (matchccb->cdm.patterns == NULL) { warnx("can't malloc memory for patterns"); retval = 1; goto bailout; } - matchccb.cdm.patterns[0].type = DEV_MATCH_BUS; - matchccb.cdm.patterns[0].pattern.bus_pattern.flags = BUS_MATCH_ANY; + matchccb->cdm.patterns[0].type = DEV_MATCH_BUS; + matchccb->cdm.patterns[0].pattern.bus_pattern.flags = BUS_MATCH_ANY; do { unsigned int i; - if (ioctl(fd, CAMIOCOMMAND, &matchccb) == -1) { + if (ioctl(fd, CAMIOCOMMAND, matchccb) == -1) { warn("CAMIOCOMMAND ioctl failed"); retval = 1; goto bailout; } - if ((matchccb.ccb_h.status != CAM_REQ_CMP) - || ((matchccb.cdm.status != CAM_DEV_MATCH_LAST) - && (matchccb.cdm.status != CAM_DEV_MATCH_MORE))) { + if ((matchccb->ccb_h.status != CAM_REQ_CMP) + || ((matchccb->cdm.status != CAM_DEV_MATCH_LAST) + && (matchccb->cdm.status != CAM_DEV_MATCH_MORE))) { warnx("got CAM error %#x, CDM error %d\n", - matchccb.ccb_h.status, matchccb.cdm.status); + matchccb->ccb_h.status, matchccb->cdm.status); retval = 1; goto bailout; } - for (i = 0; i < matchccb.cdm.num_matches; i++) { + for (i = 0; i < matchccb->cdm.num_matches; i++) { struct bus_match_result *bus_result; /* This shouldn't happen. */ - if (matchccb.cdm.matches[i].type != DEV_MATCH_BUS) + if (matchccb->cdm.matches[i].type != DEV_MATCH_BUS) continue; - bus_result = &matchccb.cdm.matches[i].result.bus_result; + bus_result =&matchccb->cdm.matches[i].result.bus_result; /* * We don't want to rescan or reset the xpt bus. @@ -3243,23 +3253,23 @@ rescan_or_reset_bus(path_id_t bus, int r if (bus_result->path_id == CAM_XPT_PATH_ID) continue; - ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS : + ccb->ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS; - ccb.ccb_h.path_id = bus_result->path_id; - ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; - ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; - ccb.crcn.flags = CAM_FLAG_NONE; + ccb->ccb_h.path_id = bus_result->path_id; + ccb->ccb_h.target_id = CAM_TARGET_WILDCARD; + ccb->ccb_h.target_lun = CAM_LUN_WILDCARD; + ccb->crcn.flags = CAM_FLAG_NONE; /* run this at a low priority */ - ccb.ccb_h.pinfo.priority = 5; + ccb->ccb_h.pinfo.priority = 5; - if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { + if (ioctl(fd, CAMIOCOMMAND, ccb) == -1) { warn("CAMIOCOMMAND ioctl failed"); retval = 1; goto bailout; } - if ((ccb.ccb_h.status & CAM_STATUS_MASK) ==CAM_REQ_CMP){ + if ((ccb->ccb_h.status & CAM_STATUS_MASK)==CAM_REQ_CMP){ fprintf(stdout, "%s of bus %d was successful\n", rescan? "Re-scan" : "Reset", bus_result->path_id); @@ -3272,22 +3282,24 @@ rescan_or_reset_bus(path_id_t bus, int r fprintf(stderr, "%s of bus %d returned error " "%#x\n", rescan? "Re-scan" : "Reset", bus_result->path_id, - ccb.ccb_h.status & CAM_STATUS_MASK); + ccb->ccb_h.status & CAM_STATUS_MASK); retval = 1; } } - } while ((matchccb.ccb_h.status == CAM_REQ_CMP) - && (matchccb.cdm.status == CAM_DEV_MATCH_MORE)); + } while ((matchccb->ccb_h.status == CAM_REQ_CMP) + && (matchccb->cdm.status == CAM_DEV_MATCH_MORE)); bailout: if (fd != -1) close(fd); - if (matchccb.cdm.patterns != NULL) - free(matchccb.cdm.patterns); - if (matchccb.cdm.matches != NULL) - free(matchccb.cdm.matches); + if (matchccb != NULL) { + free(matchccb->cdm.patterns); + free(matchccb->cdm.matches); + free(matchccb); + } + free(ccb); return(retval); } From owner-svn-src-all@freebsd.org Fri Oct 21 18:57:59 2016 Return-Path: Delivered-To: svn-src-all@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 8010FC1B1E9; Fri, 21 Oct 2016 18:57:59 +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 37397651; Fri, 21 Oct 2016 18:57:59 +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 u9LIvwKC021759; Fri, 21 Oct 2016 18:57:58 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LIvwfO021757; Fri, 21 Oct 2016 18:57:58 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201610211857.u9LIvwfO021757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 21 Oct 2016 18:57:58 +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: r307748 - in stable/11: sbin/mount_msdosfs sys/fs/msdosfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 18:57:59 -0000 Author: asomers Date: Fri Oct 21 18:57:58 2016 New Revision: 307748 URL: https://svnweb.freebsd.org/changeset/base/307748 Log: MFC r306276, but don't remove findwin95 Mount msdosfs with longnames support by default. The old behavior depended on the FAT version and on what files were in the root directory. "mount_msdosfs -o shortnames" is still supported. Modified: stable/11/sbin/mount_msdosfs/mount_msdosfs.8 stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount_msdosfs/mount_msdosfs.8 ============================================================================== --- stable/11/sbin/mount_msdosfs/mount_msdosfs.8 Fri Oct 21 18:54:56 2016 (r307747) +++ stable/11/sbin/mount_msdosfs/mount_msdosfs.8 Fri Oct 21 18:57:58 2016 (r307748) @@ -142,15 +142,8 @@ If neither nor .Fl l are given, -.Nm -searches the root directory of the file system to -be mounted for any existing Win'95 long filenames. -If no such entries are found, but short DOS filenames are found, -.Fl s -is the default. -Otherwise .Fl l -is assumed. +is the default. .It Fl 9 Ignore the special Win'95 directory entries even if deleting or renaming a file. Modified: stable/11/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 21 18:54:56 2016 (r307747) +++ stable/11/sys/fs/msdosfs/msdosfs_vfsops.c Fri Oct 21 18:57:58 2016 (r307748) @@ -175,24 +175,8 @@ update_mp(struct mount *mp, struct threa if (pmp->pm_flags & MSDOSFSMNT_NOWIN95) pmp->pm_flags |= MSDOSFSMNT_SHORTNAME; - else if (!(pmp->pm_flags & - (MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) { - struct vnode *rootvp; - - /* - * Try to divine whether to support Win'95 long filenames - */ - if (FAT32(pmp)) - pmp->pm_flags |= MSDOSFSMNT_LONGNAME; - else { - if ((error = - msdosfs_root(mp, LK_EXCLUSIVE, &rootvp)) != 0) - return error; - pmp->pm_flags |= findwin95(VTODE(rootvp)) ? - MSDOSFSMNT_LONGNAME : MSDOSFSMNT_SHORTNAME; - vput(rootvp); - } - } + else + pmp->pm_flags |= MSDOSFSMNT_LONGNAME; return 0; } From owner-svn-src-all@freebsd.org Fri Oct 21 19:23:52 2016 Return-Path: Delivered-To: svn-src-all@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 90E4FC1BDDA; Fri, 21 Oct 2016 19:23:52 +0000 (UTC) (envelope-from gjb@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 5FC30A0D; Fri, 21 Oct 2016 19:23:52 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LJNpNx032937; Fri, 21 Oct 2016 19:23:51 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LJNpFV032936; Fri, 21 Oct 2016 19:23:51 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610211923.u9LJNpFV032936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 21 Oct 2016 19:23:51 +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: r307749 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 19:23:52 -0000 Author: gjb Date: Fri Oct 21 19:23:51 2016 New Revision: 307749 URL: https://svnweb.freebsd.org/changeset/base/307749 Log: Fix grammar. Submitted by: Kevin P. Neal Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 18:57:58 2016 (r307748) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Oct 21 19:23:51 2016 (r307749) @@ -250,7 +250,7 @@ boot [2016-10-21] Due to a bug in earlier versions of - &man.clang.1; that are difficult to work around in the + &man.clang.1; that is difficult to work around in the upgrade process, to upgrade the system from sources via buildworld to -CURRENT or &release;, it is necessary to upgrade machines running 9.x to at least revision r286035, From owner-svn-src-all@freebsd.org Fri Oct 21 20:17:21 2016 Return-Path: Delivered-To: svn-src-all@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 3277EC1CAEC; Fri, 21 Oct 2016 20:17:21 +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 DE828AF2; Fri, 21 Oct 2016 20:17:20 +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 u9LKHKSo051626; Fri, 21 Oct 2016 20:17:20 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LKHJow051623; Fri, 21 Oct 2016 20:17:19 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201610212017.u9LKHJow051623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 21 Oct 2016 20:17:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307752 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 20:17:21 -0000 Author: asomers Date: Fri Oct 21 20:17:19 2016 New Revision: 307752 URL: https://svnweb.freebsd.org/changeset/base/307752 Log: Close some file descriptor leaks in pw MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8245 Modified: head/usr.sbin/pw/grupd.c head/usr.sbin/pw/pw_nis.c head/usr.sbin/pw/pwupd.c Modified: head/usr.sbin/pw/grupd.c ============================================================================== --- head/usr.sbin/pw/grupd.c Fri Oct 21 19:44:09 2016 (r307751) +++ head/usr.sbin/pw/grupd.c Fri Oct 21 20:17:19 2016 (r307752) @@ -34,6 +34,7 @@ static const char rcsid[] = #include #include #include +#include #include "pwupd.h" @@ -73,8 +74,10 @@ gr_update(struct group * grp, char const } if (gr_copy(pfd, tfd, gr, old_gr) == -1) { gr_fini(); + close(tfd); err(1, "gr_copy()"); } + close(tfd); if (gr_mkdb() == -1) { gr_fini(); err(1, "gr_mkdb()"); Modified: head/usr.sbin/pw/pw_nis.c ============================================================================== --- head/usr.sbin/pw/pw_nis.c Fri Oct 21 19:44:09 2016 (r307751) +++ head/usr.sbin/pw/pw_nis.c Fri Oct 21 20:17:19 2016 (r307752) @@ -34,6 +34,7 @@ static const char rcsid[] = #include #include #include +#include #include "pw.h" @@ -63,8 +64,10 @@ pw_nisupdate(const char * path, struct p } if (pw_copy(pfd, tfd, pw, old_pw) == -1) { pw_fini(); + close(tfd); err(1, "pw_copy()"); } + close(tfd); if (chmod(pw_tempname(), 0644) == -1) err(1, "chmod()"); if (rename(pw_tempname(), path) == -1) Modified: head/usr.sbin/pw/pwupd.c ============================================================================== --- head/usr.sbin/pw/pwupd.c Fri Oct 21 19:44:09 2016 (r307751) +++ head/usr.sbin/pw/pwupd.c Fri Oct 21 20:17:19 2016 (r307752) @@ -111,8 +111,10 @@ pw_update(struct passwd * pwd, char cons } if (pw_copy(pfd, tfd, pw, old_pw) == -1) { pw_fini(); + close(tfd); err(1, "pw_copy()"); } + close(tfd); /* * in case of deletion of a user, the whole database * needs to be regenerated From owner-svn-src-all@freebsd.org Fri Oct 21 20:36:35 2016 Return-Path: Delivered-To: svn-src-all@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 24DC5C1C117; Fri, 21 Oct 2016 20:36:35 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-qt0-x234.google.com (mail-qt0-x234.google.com [IPv6:2607:f8b0:400d:c0d::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8DF09FB; Fri, 21 Oct 2016 20:36:34 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-qt0-x234.google.com with SMTP id m5so95772792qtb.3; Fri, 21 Oct 2016 13:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Jdd66SUYt7qgdg+FLVUXV1F4mrrOfnHbxDpIY4CzZq0=; b=UZ3sot7UsyTtElAIn3iASYMb3lIOdrotkmMckXislJX/i5C7DSA95DYPNhskyVodg5 eu46xiCcJ72dKigMfFKETV3tvDLJEAN6C9fhEcvPbD+mNBmbxxTD/02Kepor8Yv0Swgl 5UPPKL5xtvBMou4Zgmo26d2NAJot/1+SxVnbBvuJ9PUasjF00POJ8eZLaiX3JUEZ7uTm r4SBeUFa/KvW2rGbJnmORmbnbi6frzG2/OKLHcGw96LeARovI3cut4bDL0lp5vLOzKL1 YsLdoaXk16ZXDtH4gLjh1To0XxJ58xdXdyJMfPa2WyXr7o9C5HK+GQuZGB8gfBCq5Wiw wGzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Jdd66SUYt7qgdg+FLVUXV1F4mrrOfnHbxDpIY4CzZq0=; b=m0LScM8YWqZRJg+O0B+SgpWWJFBsrcbwSQjFORzhCrZ3q/HZO/XmRTPOmoQ/v+K0Gz xnvPlEcS9GIUWPfS22+lBogzx6uCOd1b5rchG5fGt+csMo/w6p/v1/8ANIATVqyGGcBR MZTG4OWAuHJr99hfwOUgzjE6I5B0F2VZ9NFrUPygTyFhYiE6BBrAHF/5AkZ9/kFEtpZl K+wXkk6fih/WcxNqh0YsAeQG9SR9QJdi/pyeidTzd6xeDuWvqWmTQ26N+3Ycqocw4E4Y RTtXC1dWcGaTJeWJ6YJDWYQf9FpKpf6qsNnAUfBX28sC9EGTubEtPNH13xGuk/8Sykhc kUBQ== X-Gm-Message-State: ABUngvcjWPySIm7Y4bYfpG/Tf2Eipvpm2Ryz6+B2HK50ctxfWrgMvFFu2geiVyELiYrYn+cw+Q0GmDESPOxUEw== X-Received: by 10.200.51.20 with SMTP id t20mr3354449qta.48.1477082193870; Fri, 21 Oct 2016 13:36:33 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.12.138.251 with HTTP; Fri, 21 Oct 2016 13:36:33 -0700 (PDT) In-Reply-To: <201610132306.u9DN6Aod023917@gw.catspoiler.org> References: <201610132306.u9DN6Aod023917@gw.catspoiler.org> From: Alan Somers Date: Fri, 21 Oct 2016 14:36:33 -0600 X-Google-Sender-Auth: kgwL3LL6ir1A0sjogb3Ffc-5Xic Message-ID: Subject: Re: svn commit: r285050 - in head: lib/libutil usr.sbin/pwd_mkdb To: Don Lewis Cc: Renato Botelho , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 20:36:35 -0000 On Thu, Oct 13, 2016 at 5:06 PM, Don Lewis wrote: > On 13 Oct, Alan Somers wrote: >> On Thu, Jul 2, 2015 at 11:31 AM, Renato Botelho wrote: >>> Author: garga (ports committer) >>> Date: Thu Jul 2 17:30:59 2015 >>> New Revision: 285050 >>> URL: https://svnweb.freebsd.org/changeset/base/285050 >>> >>> Log: >>> When passwd or group information is changed (by pw, vipw, chpass, ...) >>> temporary file is created and then a rename() call move it to official file. >>> This operation didn't have any check to make sure data was written to disk >>> and if a power cycle happens system could end up with a 0 length passwd >>> or group database. >>> >>> There is a pfSense bug with more infor about it: >>> >>> https://redmine.pfsense.org/issues/4523 >>> >>> The following changes were made to protect passwd and group operations: >>> >>> * lib/libutil/gr_util.c: >>> - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file >>> - After rename(), fsync() call on directory for faster result >>> >>> * lib/libutil/pw_util.c >>> - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file >>> >>> * usr.sbin/pwd_mkdb/pwd_mkdb.c >>> - Added O_SYNC flag on dbopen() calls >>> - After rename(), fsync() call on directory for faster result >>> >>> * lib/libutil/pw_util.3 >>> - pw_lock() returns a file descriptor to master password file on success >>> >>> Differential Revision: https://reviews.freebsd.org/D2978 >>> Approved by: bapt >>> Sponsored by: Netgate >>> >>> Modified: >>> head/lib/libutil/gr_util.c >>> head/lib/libutil/pw_util.3 >>> head/lib/libutil/pw_util.c >>> head/usr.sbin/pwd_mkdb/pwd_mkdb.c >> >> This change is making certain pw operations very slow on ZFS root >> systems. The problem is that when you open a file with O_SYNC, every >> single write(2) call turns into a zil_commit on ZFS, which is fairly >> expensive. Did you consider using fsync(2) on the temporary files >> instead of opening them with O_SYNC? I just tried that now, and I see >> a considerable speedup when running the tests in >> /usr/tests/usr.sbin/pw: >> >> Using O_SYNC, as CURRENT does: 4 minutes 5.2 seconds >> No synchronous operations at all: 49.5 seconds >> Using fsync(2): 56.0 seconds > > pwd_mkdb was fixed back in February with by switching to fsync() in > r295925. It looks like libutil was not fixed, though. https://reviews.freebsd.org/D8319 From owner-svn-src-all@freebsd.org Fri Oct 21 21:52:23 2016 Return-Path: Delivered-To: svn-src-all@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 61D3FC1B4F8; Fri, 21 Oct 2016 21:52:23 +0000 (UTC) (envelope-from dim@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 306E519E; Fri, 21 Oct 2016 21:52:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LLqM1N089306; Fri, 21 Oct 2016 21:52:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LLqMGf089305; Fri, 21 Oct 2016 21:52:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201610212152.u9LLqMGf089305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 21 Oct 2016 21:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307754 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 21:52:23 -0000 Author: dim Date: Fri Oct 21 21:52:22 2016 New Revision: 307754 URL: https://svnweb.freebsd.org/changeset/base/307754 Log: Fix building of many ports that use make from base, such as devel/apr1, after r307676, which added transformation rules for .llo and .bco files. These suffixes also have to be added the the global .SUFFIXES target, otherwise the various suffix-transformation rules would be interpreted as literal targets. E.g., .c.bco: ... commands ... would actually to build a file named ".c.bco". Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Fri Oct 21 20:31:52 2016 (r307753) +++ head/share/mk/sys.mk Fri Oct 21 21:52:22 2016 (r307754) @@ -121,7 +121,7 @@ META_MODE?= normal .if defined(%POSIX) .SUFFIXES: .o .c .y .l .a .sh .f .else -.SUFFIXES: .out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh +.SUFFIXES: .out .a .ln .o .bco .llo .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .asm .s .cl .p .h .sh .endif AR ?= ar From owner-svn-src-all@freebsd.org Fri Oct 21 21:55:51 2016 Return-Path: Delivered-To: svn-src-all@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 E1DB0C1B6BD; Fri, 21 Oct 2016 21:55:51 +0000 (UTC) (envelope-from jilles@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 945CD895; Fri, 21 Oct 2016 21:55:51 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9LLtoTq089477; Fri, 21 Oct 2016 21:55:50 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LLtoAW089474; Fri, 21 Oct 2016 21:55:50 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201610212155.u9LLtoAW089474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 21 Oct 2016 21:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307755 - in head: etc/rc.d sbin/swapon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 21:55:52 -0000 Author: jilles Date: Fri Oct 21 21:55:50 2016 New Revision: 307755 URL: https://svnweb.freebsd.org/changeset/base/307755 Log: swapoff: Remove only late devices with -aL. Currently, '/etc/rc.d/swaplate stop' removes all swap devices. This can be very slow and may not even be possible if there is a lot of swap space in use. However, removing swap devices is only needed for late swap devices that may depend on daemons that subsequent shutdown steps stop. Normal swap devices such as hard disk partitions will remain available throughout the shutdown process and need not be removed. In swapoff, interpret -aL to remove late swap devices only, and use this in etc/rc.d/swaplate. The meaning of -aL in swapon remains unchanged (add all swap devices, both normal and late). PR: 187081 Reviewed by: wblock (man page only), ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8126 Modified: head/etc/rc.d/swaplate head/sbin/swapon/swapon.8 head/sbin/swapon/swapon.c Modified: head/etc/rc.d/swaplate ============================================================================== --- head/etc/rc.d/swaplate Fri Oct 21 21:52:22 2016 (r307754) +++ head/etc/rc.d/swaplate Fri Oct 21 21:55:50 2016 (r307755) @@ -12,7 +12,7 @@ name="swaplate" desc="Setup late swap space" start_cmd='/sbin/swapon -aLq' -stop_cmd='/sbin/swapoff -aq' +stop_cmd='/sbin/swapoff -aLq' load_rc_config swap run_rc_command "$1" Modified: head/sbin/swapon/swapon.8 ============================================================================== --- head/sbin/swapon/swapon.8 Fri Oct 21 21:52:22 2016 (r307754) +++ head/sbin/swapon/swapon.8 Fri Oct 21 21:55:50 2016 (r307755) @@ -28,7 +28,7 @@ .\" @(#)swapon.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 2, 2016 +.Dd October 21, 2016 .Dt SWAPON 8 .Os .Sh NAME @@ -98,6 +98,12 @@ will be removed, unless their .Dq noauto option is also set. If the +.Fl L +option is specified, +only swap devices with the +.Dq late +option will be removed. +If the .Fl q option is used, informational messages will not be Modified: head/sbin/swapon/swapon.c ============================================================================== --- head/sbin/swapon/swapon.c Fri Oct 21 21:52:22 2016 (r307754) +++ head/sbin/swapon/swapon.c Fri Oct 21 21:55:50 2016 (r307755) @@ -176,6 +176,10 @@ main(int argc, char **argv) strstr(fsp->fs_mntops, "late") && late == 0) continue; + if (which_prog == SWAPOFF && + strstr(fsp->fs_mntops, "late") == NULL && + late != 0) + continue; swfile = swap_on_off(fsp->fs_spec, 1, fsp->fs_mntops); if (swfile == NULL) { From owner-svn-src-all@freebsd.org Fri Oct 21 22:02:49 2016 Return-Path: Delivered-To: svn-src-all@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 B3EBBC1B8A8 for ; Fri, 21 Oct 2016 22:02:49 +0000 (UTC) (envelope-from 01000157e944783d-5458f67c-26df-45fc-b823-c9ffdcfeeaab-000000@amazonses.com) Received: from a8-237.smtp-out.amazonses.com (a8-237.smtp-out.amazonses.com [54.240.8.237]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7943DCED for ; Fri, 21 Oct 2016 22:02:48 +0000 (UTC) (envelope-from 01000157e944783d-5458f67c-26df-45fc-b823-c9ffdcfeeaab-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1477087361; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=5/9p1hmMhe0/0W0k6n+PEg/Z4CfuCuzN2Ej5fCYDiWg=; b=IpIzPntEFYqNT7inm+Ozeb5tCO/XZPddRCai1hHLCddSuVURhqA3XS/UJM+W/tqV L1BtyoIJjxMEZHyVvueaODd50XSZ8zijF+Lp9v4z0Z3uOe91RQUvikbRbwdwJvkBo7T B6HQxrWu6+O0LSH2QfJ0HNYa5JswIJF+MLiCdTjQ= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1477087361; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=5/9p1hmMhe0/0W0k6n+PEg/Z4CfuCuzN2Ej5fCYDiWg=; b=GE1Q1MTfaJ9aa8d/L21W91KAYpnr8/dxbzhK1TehRInx6pTw6j0uJfvYPZx/ELDL XrvBKweiYQkx9yTGN2J0XxoluUT4imuf8OYVFXiEShAugTZO2Y4/B6DmcJqHKv9Rpt+ dm1CswL0UapmbUceSalFyudcx31rJlq7VoJVVwPA= Subject: Re: cvs commit: src/sys/sys _types.h resource.h To: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= References: <200411081805.iA8I5hVK038813@repoman.freebsd.org> <01000157e3ac7982-b19e61c1-1619-44b1-88b5-3080d85e8d6d-000000@email.amazonses.com> <86wph1o8ec.fsf@desk.des.no> Cc: src-committers@FreeBSD.org, "svn-src-all@freebsd.org" From: Colin Percival Message-ID: <01000157e944783d-5458f67c-26df-45fc-b823-c9ffdcfeeaab-000000@email.amazonses.com> Date: Fri, 21 Oct 2016 22:02:41 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <86wph1o8ec.fsf@desk.des.no> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SES-Outgoing: 2016.10.21-54.240.8.237 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 22:02:49 -0000 On 10/21/16 11:37, Dag-Erling Smørgrav wrote: > Colin Percival writes: >> Dag-Erling Smørgrav writes: >>> -typedef __int64_t __rlim_t; /* resource limit (XXX not unsigned) */ >>> +typedef __int64_t __rlim_t; /* resource limit - intentionally */ >>> + /* signed, because of legacy code */ >>> + /* that uses -1 for RLIM_INFINITY */ >> Is it time to drop compatibility for code which was "legacy" 12 years ago >> in order to conform to the POSIX stipulation that rlim_t should be unsigned? > > Well, all of that code is already broken because I defined RLIM_INFINITY > to 2^63-1 instead of 2^64-1. But we might as well align ourselves with > the legacy code (and with other OSes), as the consequences of changing > RLIM_INFINITY are mostly cosmetic [...] I wasn't talking about the value of RLIM_INFINITY, but rather about whether rlim_t should be signed or unsigned. Right now it is signed; but POSIX says it should be unsigned, and most other OSes follow POSIX's mandate here. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@freebsd.org Fri Oct 21 22:05:26 2016 Return-Path: Delivered-To: svn-src-all@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 25729C1B8F8; Fri, 21 Oct 2016 22:05:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03E5ED53; Fri, 21 Oct 2016 22:05:26 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 9CD6F10AF92; Fri, 21 Oct 2016 18:05:24 -0400 (EDT) From: John Baldwin To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307731 - in head: sys/dev/pci usr.sbin/pciconf Date: Fri, 21 Oct 2016 14:50:44 -0700 Message-ID: <3693422.knNeE0iEO3@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201610211523.u9LFNsae041189@repo.freebsd.org> References: <201610211523.u9LFNsae041189@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 21 Oct 2016 18:05:24 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 22:05:26 -0000 On Friday, October 21, 2016 03:23:54 PM Alexander Motin wrote: > Author: mav > Date: Fri Oct 21 15:23:54 2016 > New Revision: 307731 > URL: https://svnweb.freebsd.org/changeset/base/307731 > > Log: > Add names for some DASP devices. > > Submitted by: Dmitry Luhtionov > MFC after: 1 week We should perhaps move the class/subclass description table into a header file that can be included in both places rather than duplicated. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Oct 21 22:44:49 2016 Return-Path: Delivered-To: svn-src-all@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 675D5C1C0DA for ; Fri, 21 Oct 2016 22:44:49 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 30C23175; Fri, 21 Oct 2016 22:44:48 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 5FA1310778; Fri, 21 Oct 2016 22:44:47 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id 10693439DA; Sat, 22 Oct 2016 00:44:15 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Colin Percival Cc: src-committers@FreeBSD.org, "svn-src-all\@freebsd.org" Subject: Re: cvs commit: src/sys/sys _types.h resource.h References: <200411081805.iA8I5hVK038813@repoman.freebsd.org> <01000157e3ac7982-b19e61c1-1619-44b1-88b5-3080d85e8d6d-000000@email.amazonses.com> <86wph1o8ec.fsf@desk.des.no> <01000157e9447f3f-f307bb1a-7179-48f8-9e6a-fca3cf0de5f5-000000@email.amazonses.com> Date: Sat, 22 Oct 2016 00:44:15 +0200 In-Reply-To: <01000157e9447f3f-f307bb1a-7179-48f8-9e6a-fca3cf0de5f5-000000@email.amazonses.com> (Colin Percival's message of "Fri, 21 Oct 2016 22:02:42 +0000") Message-ID: <86shrpnwzk.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 22:44:49 -0000 Colin Percival writes: > I wasn't talking about the value of RLIM_INFINITY, but rather about wheth= er > rlim_t should be signed or unsigned. Right now it is signed; but POSIX s= ays > it should be unsigned, and most other OSes follow POSIX's mandate here. Yeah, I was a little bit confused about what my commit actually did (it's been 12 years!) but my point is that a) by all means, signedness doesn't really matter for compatibility, but b) if we're changing the type, we might as well change the value of RLIM_INFINITY to (rlim_t)-1 to match other OSes, and we can do it without significant breakage. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@freebsd.org Fri Oct 21 23:31:30 2016 Return-Path: Delivered-To: svn-src-all@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 55648C1CB02 for ; Fri, 21 Oct 2016 23:31:30 +0000 (UTC) (envelope-from 01000157e995ad01-46d7143d-ba55-4226-9d12-e56d201fa37d-000000@amazonses.com) Received: from a8-176.smtp-out.amazonses.com (a8-176.smtp-out.amazonses.com [54.240.8.176]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19E91BB6 for ; Fri, 21 Oct 2016 23:31:29 +0000 (UTC) (envelope-from 01000157e995ad01-46d7143d-ba55-4226-9d12-e56d201fa37d-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1477092683; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=aPoBZC9U7x7h8zqQVQ3BdwPhdwjit/L7/BxV4+5wj5Q=; b=eQUuBSo3a11k3R5UJmueXakQeuA5C1ELC2U5dQnGwcJz+OfsGqm2uauhVEHVCwUn 2HJbS8woY3wjnWDLwn81tRZd4w1fy/uzdwzWx7S+Lisc/tnwaFi2JM7bJJ9x0alKELG 5cxGbLBVvgIAlQ3fXkYB/ZQQAm87dg07WwpsIyhk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1477092683; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=aPoBZC9U7x7h8zqQVQ3BdwPhdwjit/L7/BxV4+5wj5Q=; b=IFcs0HRD5fpjdXkGbvLY5kqDJJVPgtPtq+z0NSpUea7MzitTJRy4IDiXFw8cPLJh bMNfsdIVoclE/Lk/Pr07mPEXhBmtuhCQvHGSxzFa+pWfmrTYaA39Er8W/g1+si+DhbH oNyvEztkSPXEoqXNhbCbV54gImDXrnHVD4BDAPVk= Subject: Re: cvs commit: src/sys/sys _types.h resource.h To: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= References: <200411081805.iA8I5hVK038813@repoman.freebsd.org> <01000157e3ac7982-b19e61c1-1619-44b1-88b5-3080d85e8d6d-000000@email.amazonses.com> <86wph1o8ec.fsf@desk.des.no> <01000157e9447f3f-f307bb1a-7179-48f8-9e6a-fca3cf0de5f5-000000@email.amazonses.com> <86shrpnwzk.fsf@desk.des.no> Cc: src-committers@FreeBSD.org, "svn-src-all@freebsd.org" From: Colin Percival Message-ID: <01000157e995ad01-46d7143d-ba55-4226-9d12-e56d201fa37d-000000@email.amazonses.com> Date: Fri, 21 Oct 2016 23:31:23 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <86shrpnwzk.fsf@desk.des.no> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SES-Outgoing: 2016.10.21-54.240.8.176 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 23:31:30 -0000 On 10/21/16 15:44, Dag-Erling Smørgrav wrote: > Colin Percival writes: >> I wasn't talking about the value of RLIM_INFINITY, but rather about whether >> rlim_t should be signed or unsigned. Right now it is signed; but POSIX says >> it should be unsigned, and most other OSes follow POSIX's mandate here. > > Yeah, I was a little bit confused about what my commit actually did It added a comment providing a reason for not conforming to POSIX, but did not change the underlying behaviour. > (it's been 12 years!) but my point is that a) by all means, signedness > doesn't really matter for compatibility, but b) if we're changing the > type, we might as well change the value of RLIM_INFINITY to (rlim_t)-1 > to match other OSes, and we can do it without significant breakage. Should we get a ports experimental run for this? -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@freebsd.org Fri Oct 21 23:50:03 2016 Return-Path: Delivered-To: svn-src-all@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 E8FC6C1CD65; Fri, 21 Oct 2016 23:50:03 +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 9DC4C19B; Fri, 21 Oct 2016 23:50:03 +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 u9LNo2dW031677; Fri, 21 Oct 2016 23:50:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9LNo2PT031675; Fri, 21 Oct 2016 23:50:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610212350.u9LNo2PT031675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 21 Oct 2016 23:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307756 - in head: include sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 23:50:04 -0000 Author: jhb Date: Fri Oct 21 23:50:02 2016 New Revision: 307756 URL: https://svnweb.freebsd.org/changeset/base/307756 Log: 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 Reviewed by: dim MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8194 Modified: head/include/stddef.h head/sys/sys/_types.h Modified: head/include/stddef.h ============================================================================== --- head/include/stddef.h Fri Oct 21 21:55:50 2016 (r307755) +++ head/include/stddef.h Fri Oct 21 23:50:02 2016 (r307756) @@ -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: head/sys/sys/_types.h ============================================================================== --- head/sys/sys/_types.h Fri Oct 21 21:55:50 2016 (r307755) +++ head/sys/sys/_types.h Fri Oct 21 23:50:02 2016 (r307756) @@ -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-all@freebsd.org Sat Oct 22 00:06:44 2016 Return-Path: Delivered-To: svn-src-all@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 D15BBC1C50F; Sat, 22 Oct 2016 00:06:44 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 907ADE3A; Sat, 22 Oct 2016 00:06:44 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 3318B5A9F27; Sat, 22 Oct 2016 00:00:56 +0000 (UTC) Date: Sat, 22 Oct 2016 00:00:56 +0000 From: Brooks Davis To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307756 - in head: include sys/sys Message-ID: <20161022000056.GC95989@spindle.one-eyed-alien.net> References: <201610212350.u9LNo2PT031675@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <201610212350.u9LNo2PT031675@repo.freebsd.org> User-Agent: Mutt/1.7.0 (2016-08-17) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 00:06:44 -0000 --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 21, 2016 at 11:50:02PM +0000, John Baldwin wrote: > Author: jhb > Date: Fri Oct 21 23:50:02 2016 > New Revision: 307756 > URL: https://svnweb.freebsd.org/changeset/base/307756 >=20 > Log: > Define max_align_t for C11. > =20 > 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 . > =20 > PR: 210890 > Reviewed by: dim > MFC after: 1 month > Differential Revision: https://reviews.freebsd.org/D8194 >=20 > Modified: > head/include/stddef.h > head/sys/sys/_types.h >=20 > Modified: head/include/stddef.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/include/stddef.h Fri Oct 21 21:55:50 2016 (r307755) > +++ head/include/stddef.h Fri Oct 21 23:50:02 2016 (r307756) > @@ -62,6 +62,14 @@ typedef ___wchar_t wchar_t; > #endif > #endif > =20 > +#if __STDC_VERSION__ >=3D 201112L || __cplusplus >=3D 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) > =20 > #endif /* _STDDEF_H_ */ >=20 > Modified: head/sys/sys/_types.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/_types.h Fri Oct 21 21:55:50 2016 (r307755) > +++ head/sys/sys/_types.h Fri Oct 21 23:50:02 2016 (r307756) > @@ -100,6 +100,11 @@ typedef __uint_least32_t __char32_t; > #define _CHAR32_T_DECLARED > #endif > =20 > +typedef struct { Should this be union per the commit message? Ideally I'd add a void * as well since that will support systems like CHERI where pointers are the largest type. -- Brooks > + 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 */ > =20 > typedef __uint32_t __fixpt_t; /* fixed point number */ >=20 --fdj2RfSjLxBAspz7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJYCqw3AAoJEKzQXbSebgfAFIYH/2VgcVD8iQ3ZJl1tvwQ1kkGr 6B1SfJbQGYWflM+I9kK640vKr7pLgVDtVuiNVFIbp4046b/i2Sj8c0T9Cx+epKw9 0YHI+7GeT67JHFX5YBQFuzTBkyIiYGFPGy8uh5bkN56iUJmS9Swx1ncgVz2zG3jA RnM2f3i+lr1PoD6aycPiWAuL/ppQy4XL9I8rSzi5DxQZKPQiO1J5sizEYhGi7zip tofEKf1eb5ofqNDVjnBNyyrYa3KYqjXIYFEdWe0qv9eM1d17ENL9wa1VpJegx5Eb 2x9HlLO0v9l/OEYSDLLQrNvyL84tus7obA1drki5qEEjkZvZuQwrU6+uNNi+CLc= =5rhX -----END PGP SIGNATURE----- --fdj2RfSjLxBAspz7-- From owner-svn-src-all@freebsd.org Sat Oct 22 00:25:21 2016 Return-Path: Delivered-To: svn-src-all@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 1CF0DC1C86E for ; Sat, 22 Oct 2016 00:25:21 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id CB589832; Sat, 22 Oct 2016 00:25:20 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 7B46910864; Sat, 22 Oct 2016 00:25:19 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id D6E4F439E7; Sat, 22 Oct 2016 02:25:16 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Colin Percival Cc: src-committers@FreeBSD.org, "svn-src-all\@freebsd.org" Subject: Re: cvs commit: src/sys/sys _types.h resource.h References: <200411081805.iA8I5hVK038813@repoman.freebsd.org> <01000157e3ac7982-b19e61c1-1619-44b1-88b5-3080d85e8d6d-000000@email.amazonses.com> <86wph1o8ec.fsf@desk.des.no> <01000157e9447f3f-f307bb1a-7179-48f8-9e6a-fca3cf0de5f5-000000@email.amazonses.com> <86shrpnwzk.fsf@desk.des.no> <01000157e995b411-6ad7331e-440f-4133-ab48-31b56c8384a7-000000@email.amazonses.com> Date: Sat, 22 Oct 2016 02:25:16 +0200 In-Reply-To: <01000157e995b411-6ad7331e-440f-4133-ab48-31b56c8384a7-000000@email.amazonses.com> (Colin Percival's message of "Fri, 21 Oct 2016 23:31:24 +0000") Message-ID: <86oa2dnsb7.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 00:25:21 -0000 Colin Percival writes: > Dag-Erling Sm=C3=B8rgrav writes: > > [...] we might as well change the value of RLIM_INFINITY to (rlim_t)-1 > > to match other OSes, and we can do it without significant breakage. > Should we get a ports experimental run for this? Sure. It might also be a good idea to ask portmgr@ to grep tarballs for rlim_t so we can inspect source code. I just realized that there is a potential for non-benign errors if a userland program compares a number to a limit that happens to be set to RLIM_INFINITY (an older binary will perform a signed comparison, which will return a different result if RLIM_INFINITY is negative when interpreted as a signed number). But userland programs shouldn't be comparing numbers to limits - that's the kernel's job, and the kernel will always be consistent with itself. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@freebsd.org Sat Oct 22 00:35:41 2016 Return-Path: Delivered-To: svn-src-all@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 BA572C1C98A; Sat, 22 Oct 2016 00:35:41 +0000 (UTC) (envelope-from des@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 8A375C1B; Sat, 22 Oct 2016 00:35:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9M0ZeAi050205; Sat, 22 Oct 2016 00:35:40 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M0ZeVC050200; Sat, 22 Oct 2016 00:35:40 GMT (envelope-from des@FreeBSD.org) Message-Id: <201610220035.u9M0ZeVC050200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Sat, 22 Oct 2016 00:35: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: r307757 - in stable/11: contrib/top usr.bin/top X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 00:35:41 -0000 Author: des Date: Sat Oct 22 00:35:40 2016 New Revision: 307757 URL: https://svnweb.freebsd.org/changeset/base/307757 Log: MFH (r305414): add a toggle to show approximate swap usage. Modified: stable/11/contrib/top/commands.c stable/11/contrib/top/machine.h stable/11/contrib/top/top.c stable/11/contrib/top/top.xs stable/11/usr.bin/top/machine.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/top/commands.c ============================================================================== --- stable/11/contrib/top/commands.c Fri Oct 21 23:50:02 2016 (r307756) +++ stable/11/contrib/top/commands.c Sat Oct 22 00:35:40 2016 (r307757) @@ -104,6 +104,7 @@ S - toggle the displaying of syste a - toggle the displaying of process titles\n\ t - toggle the display of this process\n\ u - display processes for only one user (+ selects all users)\n\ +w - toggle the display of swap use for each process\n\ z - toggle the displaying of the system idle process\n\ \n\ \n", stdout); Modified: stable/11/contrib/top/machine.h ============================================================================== --- stable/11/contrib/top/machine.h Fri Oct 21 23:50:02 2016 (r307756) +++ stable/11/contrib/top/machine.h Sat Oct 22 00:35:40 2016 (r307757) @@ -72,6 +72,7 @@ struct process_select int wcpu; /* show weighted cpu */ int jid; /* only this jid (unless jid == -1) */ int jail; /* show jail ID */ + int swap; /* show swap usage */ int kidle; /* show per-CPU idle threads */ char *command; /* only this command (unless == NULL) */ }; @@ -82,8 +83,8 @@ char *format_header(); char *format_next_process(); void toggle_pcpustats(void); void get_system_info(struct system_info *si); -int machine_init(struct statics *statics, char do_unames); -int proc_owner(int pid); +int machine_init(struct statics *statics, char do_unames); +int proc_owner(int pid); /* non-int routines typically used by the machine dependent module */ char *printable(); Modified: stable/11/contrib/top/top.c ============================================================================== --- stable/11/contrib/top/top.c Fri Oct 21 23:50:02 2016 (r307756) +++ stable/11/contrib/top/top.c Sat Oct 22 00:35:40 2016 (r307757) @@ -188,9 +188,9 @@ char *argv[]; fd_set readfds; #ifdef ORDER - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJo"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJwo"; #else - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJ"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJw"; #endif /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 @@ -219,8 +219,9 @@ char *argv[]; #define CMD_kidletog 22 #define CMD_pcputog 23 #define CMD_jail 24 +#define CMD_swaptog 25 #ifdef ORDER -#define CMD_order 25 +#define CMD_order 26 #endif /* set the buffer for stdout */ @@ -254,6 +255,7 @@ char *argv[]; ps.wcpu = 1; ps.jid = -1; ps.jail = No; + ps.swap = No; ps.kidle = Yes; ps.command = NULL; @@ -280,7 +282,7 @@ char *argv[]; optind = 1; } - while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:t")) != EOF) + while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:tw")) != EOF) { switch(i) { @@ -418,6 +420,10 @@ char *argv[]; pcpu_stats = !pcpu_stats; break; + case 'w': + ps.swap = 1; + break; + case 'z': ps.kidle = !ps.kidle; break; @@ -1141,6 +1147,15 @@ restart: reset_display(); putchar('\r'); break; + case CMD_swaptog: + ps.swap = !ps.swap; + new_message(MT_standout | MT_delayed, + " %sisplaying per-process swap usage.", + ps.swap ? "D" : "Not d"); + header_text = format_header(uname_field); + reset_display(); + putchar('\r'); + break; default: new_message(MT_standout, " BAD CASE IN SWITCH!"); putchar('\r'); Modified: stable/11/contrib/top/top.xs ============================================================================== --- stable/11/contrib/top/top.xs Fri Oct 21 23:50:02 2016 (r307756) +++ stable/11/contrib/top/top.xs Sat Oct 22 00:35:40 2016 (r307757) @@ -10,7 +10,7 @@ top \- display and update information ab .SH SYNOPSIS .B top [ -.B \-abCHIijnPqStuvz +.B \-abCHIijnPqStuvwz ] [ .BI \-d count ] [ @@ -148,6 +148,9 @@ Write version number information to stde No other processing takes place when this option is used. To see current revision information while top is running, use the help command \*(lq?\*(rq. .TP +.B \-w +Display approximate swap usage for each process. +.TP .B \-z Do not display the system idle process. .TP @@ -167,11 +170,12 @@ Set the delay between screen updates to seconds. The default delay between updates is \nD seconds. .TP .BI \-o field -Sort the process display area on the specified field. The field name is -the name of the column as seen in the output, but in lower case. Likely -values are \*(lqcpu\*(rq, \*(lqsize\*(rq, \*(lqres\*(rq, and \*(lqtime\*(rq, -but may vary on different operating systems. Note that -not all operating systems support this option. +Sort the process display area on the specified field. The field name +is the name of the column as seen in the output, but in lower case: +\*(lqcpu\*(lq, \*(rqsize\*(lq, \*(rqres\*(lq, \*(rqtime\*(lq, +\*(rqpri\*(lq, \*(rqthreads\*(lq, \*(lqtotal\*(lq, \*(rqread\*(lq, +\*(rqwrite\*(lq, \*(rqfault\*(lq, \*(rqvcsw\*(lq, \*(rqivcsw\*(lq, +\*(lqjid\*(lq, \*(rqswap\*(lq or \*(rqpid\*(lq. .TP .BI \-J jail Show only those processes owned by @@ -226,6 +230,7 @@ The options .BR \-S , .BR \-t , .BR \-u , +.BR \-w , and .B \-z are actually toggles. A second specification of any of these options @@ -346,6 +351,9 @@ Toggle the display of the .I top process. .TP +.B w +Toggle the display of swap usage. +.TP .B z Toggle the display of the system idle process. .SH "THE DISPLAY" @@ -379,8 +387,9 @@ is specified, a UID column will be subst PRI is the current priority of the process, NICE is the nice amount (in the range \-20 to 20), SIZE is the total size of the process (text, data, and stack), -RES is the current amount of resident memory (both SIZE and RES are -given in kilobytes), +RES is the current amount of resident memory, +SWAP is the approximate amount of swap, if enabled +(SIZE, RES and SWAP are given in kilobytes), STATE is the current state (one of \*(lqSTART\*(rq, \*(lqRUN\*(rq (shown as \*(lqCPUn\*(rq on SMP systems), \*(lqSLEEP\*(rq, \*(lqSTOP\*(rq, \*(lqZOMB\*(rq, \*(lqWAIT\*(rq, \*(lqLOCK\*(rq or the event on which the Modified: stable/11/usr.bin/top/machine.c ============================================================================== --- stable/11/usr.bin/top/machine.c Fri Oct 21 23:50:02 2016 (r307756) +++ stable/11/usr.bin/top/machine.c Sat Oct 22 00:35:40 2016 (r307757) @@ -69,7 +69,9 @@ static int namelength = 8; #endif /* TOP_JID_LEN based on max of 999999 */ #define TOP_JID_LEN 7 +#define TOP_SWAP_LEN 6 static int jidlength; +static int swaplength; static int cmdlengthdelta; /* Prototypes for top internals */ @@ -111,20 +113,20 @@ static char io_header[] = "%5d%*s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s" static char smp_header_thr[] = - " PID%*s %-*.*s THR PRI NICE SIZE RES STATE C TIME %7s COMMAND"; + " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; static char smp_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES STATE C TIME %7s COMMAND"; + " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE C TIME %7s COMMAND"; #define smp_Proc_format \ - "%5d%*s %-*.*s %s%3d %4s%7s %6s %-6.6s %2d%7s %6.2f%% %.*s" + "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s %2d%7s %6.2f%% %.*s" static char up_header_thr[] = - " PID%*s %-*.*s THR PRI NICE SIZE RES STATE TIME %7s COMMAND"; + " PID%*s %-*.*s THR PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; static char up_header[] = - " PID%*s %-*.*s " "PRI NICE SIZE RES STATE TIME %7s COMMAND"; + " PID%*s %-*.*s " "PRI NICE SIZE RES%*s STATE TIME %7s COMMAND"; #define up_Proc_format \ - "%5d%*s %-*.*s %s%3d %4s%7s %6s %-6.6s%.0d%7s %6.2f%% %.*s" + "%5d%*s %-*.*s %s%3d %4s%7s %6s%*.*s %-6.6s%.0d%7s %6.2f%% %.*s" /* process state names for the "STATE" column of the display */ @@ -227,6 +229,10 @@ static int pageshift; /* log base 2 of #define pagetok(size) ((size) << pageshift) +/* swap usage */ +#define ki_swap(kip) \ + ((kip)->ki_swrss > (kip)->ki_rssize ? (kip)->ki_swrss - (kip)->ki_rssize : 0) + /* useful externals */ long percentages(); @@ -237,7 +243,7 @@ long percentages(); char *ordernames[] = { "cpu", "size", "res", "time", "pri", "threads", "total", "read", "write", "fault", "vcsw", "ivcsw", - "jid", "pid", NULL + "jid", "swap", "pid", NULL }; #endif @@ -252,6 +258,7 @@ static long *pcpu_cp_old; static long *pcpu_cp_diff; static int *pcpu_cpu_states; +static int compare_swap(const void *a, const void *b); static int compare_jid(const void *a, const void *b); static int compare_pid(const void *a, const void *b); static int compare_tid(const void *a, const void *b); @@ -412,6 +419,11 @@ format_header(char *uname_field) else jidlength = 0; + if (ps.swap) + swaplength = TOP_SWAP_LEN + 1; /* +1 for extra left space */ + else + swaplength = 0; + switch (displaymode) { case DISP_CPU: /* @@ -426,6 +438,7 @@ format_header(char *uname_field) snprintf(Header, sizeof(Header), prehead, jidlength, ps.jail ? " JID" : "", namelength, namelength, uname_field, + swaplength, ps.swap ? " SWAP" : "", ps.wcpu ? "WCPU" : "CPU"); break; case DISP_IO: @@ -902,7 +915,8 @@ format_next_process(caddr_t handle, char int cpu, state; struct rusage ru, *rup; long p_tot, s_tot; - char *proc_fmt, thr_buf[6], jid_buf[TOP_JID_LEN + 1]; + char *proc_fmt, thr_buf[6]; + char jid_buf[TOP_JID_LEN + 1], swap_buf[TOP_SWAP_LEN + 1]; char *cmdbuf = NULL; char **args; const int cmdlen = 128; @@ -1061,6 +1075,13 @@ format_next_process(caddr_t handle, char snprintf(jid_buf, sizeof(jid_buf), "%*d", jidlength - 1, pp->ki_jid); + if (ps.swap == 0) + swap_buf[0] = '\0'; + else + snprintf(swap_buf, sizeof(swap_buf), "%*s", + swaplength - 1, + format_k2(pagetok(ki_swap(pp)))); /* XXX */ + if (displaymode == DISP_IO) { oldp = get_old_proc(pp); if (oldp != NULL) { @@ -1122,6 +1143,7 @@ format_next_process(caddr_t handle, char format_nice(pp), format_k2(PROCSIZE(pp)), format_k2(pagetok(pp->ki_rssize)), + swaplength, swaplength, swap_buf, status, cpu, format_time(cputime), @@ -1309,6 +1331,12 @@ static int sorted_state[] = { return (diff > 0 ? 1 : -1); \ } while (0) +#define ORDERKEY_SWAP(a, b) do { \ + int diff = (int)ki_swap(b) - (int)ki_swap(a); \ + if (diff != 0) \ + return (diff > 0 ? 1 : -1); \ +} while (0) + /* compare_cpu - the comparison function for sorting by cpu percentage */ int @@ -1357,6 +1385,7 @@ int (*compares[])() = { compare_vcsw, compare_ivcsw, compare_jid, + compare_swap, NULL }; @@ -1467,6 +1496,24 @@ compare_jid(const void *arg1, const void return (0); } + +/* compare_swap - the comparison function for sorting by swap */ +static int +compare_swap(const void *arg1, const void *arg2) +{ + struct kinfo_proc *p1 = *(struct kinfo_proc **)arg1; + struct kinfo_proc *p2 = *(struct kinfo_proc **)arg2; + + ORDERKEY_SWAP(p1, p2); + ORDERKEY_PCTCPU(p1, p2); + ORDERKEY_CPTICKS(p1, p2); + ORDERKEY_STATE(p1, p2); + ORDERKEY_PRIO(p1, p2); + ORDERKEY_RSSIZE(p1, p2); + ORDERKEY_MEM(p1, p2); + + return (0); +} #endif /* ORDER */ /* assorted comparison functions for sorting by i/o */ From owner-svn-src-all@freebsd.org Sat Oct 22 00:38:49 2016 Return-Path: Delivered-To: svn-src-all@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 01C8EC1C9F4; Sat, 22 Oct 2016 00:38:48 +0000 (UTC) (envelope-from des@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 BE5BAD83; Sat, 22 Oct 2016 00:38:48 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9M0cleT050352; Sat, 22 Oct 2016 00:38:47 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M0clLe050350; Sat, 22 Oct 2016 00:38:47 GMT (envelope-from des@FreeBSD.org) Message-Id: <201610220038.u9M0clLe050350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Sat, 22 Oct 2016 00:38: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: r307758 - stable/11/lib/libc/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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 00:38:49 -0000 Author: des Date: Sat Oct 22 00:38:47 2016 New Revision: 307758 URL: https://svnweb.freebsd.org/changeset/base/307758 Log: MFH (r306488, r306494, r306495, r306496): fix markup and cross-references Modified: stable/11/lib/libc/sys/getrlimit.2 stable/11/lib/libc/sys/sigaction.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/getrlimit.2 ============================================================================== --- stable/11/lib/libc/sys/getrlimit.2 Sat Oct 22 00:35:40 2016 (r307757) +++ stable/11/lib/libc/sys/getrlimit.2 Sat Oct 22 00:38:47 2016 (r307758) @@ -28,7 +28,7 @@ .\" @(#)getrlimit.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 19, 2015 +.Dd September 30, 2016 .Dt GETRLIMIT 2 .Os .Sh NAME @@ -137,7 +137,7 @@ For example, if the RSS hard limit is ex .Pp The .Vt rlimit -structure is used to specify the hard and soft limits on a resource, +structure is used to specify the hard and soft limits on a resource. .Bd -literal -offset indent struct rlimit { rlim_t rlim_cur; /* current (soft) limit */ @@ -183,9 +183,9 @@ soft limit will cause the write to fail to be generated; this normally terminates the process, but may be caught. When -the soft cpu time limit is exceeded, a signal +the soft cpu time limit is exceeded, a .Dv SIGXCPU -is sent to the +signal is sent to the offending process. .Pp When most operations would allocate more virtual memory than allowed by the @@ -198,7 +198,9 @@ A notable exception is stack extension, If stack extension would allocate more virtual memory than allowed by the soft limit of .Dv RLIMIT_AS , -the signal SIGSEGV will be delivered. +a +.Dv SIGSEGV +signal will be delivered. The caller is free to raise the soft address space limit up to the hard limit and retry the allocation. .Sh RETURN VALUES Modified: stable/11/lib/libc/sys/sigaction.2 ============================================================================== --- stable/11/lib/libc/sys/sigaction.2 Sat Oct 22 00:35:40 2016 (r307757) +++ stable/11/lib/libc/sys/sigaction.2 Sat Oct 22 00:38:47 2016 (r307758) @@ -28,7 +28,7 @@ .\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94 .\" $FreeBSD$ .\" -.Dd September 6, 2013 +.Dd September 30, 2016 .Dt SIGACTION 2 .Os .Sh NAME @@ -307,46 +307,38 @@ The following is a list of all signals with names as in the include file .In signal.h : .Bl -column SIGVTALARMXX "create core imagexxx" -.It Sy "NAME Default Action Description" -.It Dv SIGHUP No " terminate process" " terminal line hangup" -.It Dv SIGINT No " terminate process" " interrupt program" -.It Dv SIGQUIT No " create core image" " quit program" -.It Dv SIGILL No " create core image" " illegal instruction" -.It Dv SIGTRAP No " create core image" " trace trap" -.It Dv SIGABRT No " create core image" Ta Xr abort 3 -call (formerly -.Dv SIGIOT ) -.It Dv SIGEMT No " create core image" " emulate instruction executed" -.It Dv SIGFPE No " create core image" " floating-point exception" -.It Dv SIGKILL No " terminate process" " kill program" -.It Dv SIGBUS No " create core image" " bus error" -.It Dv SIGSEGV No " create core image" " segmentation violation" -.It Dv SIGSYS No " create core image" " non-existent system call invoked" -.It Dv SIGPIPE No " terminate process" " write on a pipe with no reader" -.It Dv SIGALRM No " terminate process" " real-time timer expired" -.It Dv SIGTERM No " terminate process" " software termination signal" -.It Dv SIGURG No " discard signal" " urgent condition present on socket" -.It Dv SIGSTOP No " stop process" " stop (cannot be caught or ignored)" -.It Dv SIGTSTP No " stop process" " stop signal generated from keyboard" -.It Dv SIGCONT No " discard signal" " continue after stop" -.It Dv SIGCHLD No " discard signal" " child status has changed" -.It Dv SIGTTIN No " stop process" " background read attempted from control terminal" -.It Dv SIGTTOU No " stop process" " background write attempted to control terminal" -.It Dv SIGIO No " discard signal" Tn " I/O" -is possible on a descriptor (see -.Xr fcntl 2 ) -.It Dv SIGXCPU No " terminate process" " cpu time limit exceeded (see" -.Xr setrlimit 2 ) -.It Dv SIGXFSZ No " terminate process" " file size limit exceeded (see" -.Xr setrlimit 2 ) -.It Dv SIGVTALRM No " terminate process" " virtual time alarm (see" -.Xr setitimer 2 ) -.It Dv SIGPROF No " terminate process" " profiling timer alarm (see" -.Xr setitimer 2 ) -.It Dv SIGWINCH No " discard signal" " Window size change" -.It Dv SIGINFO No " discard signal" " status request from keyboard" -.It Dv SIGUSR1 No " terminate process" " User defined signal 1" -.It Dv SIGUSR2 No " terminate process" " User defined signal 2" +.It Sy NAME Ta Sy Default Action Ta Sy Description +.It Dv SIGHUP Ta terminate process Ta terminal line hangup +.It Dv SIGINT Ta terminate process Ta interrupt program +.It Dv SIGQUIT Ta create core image Ta quit program +.It Dv SIGILL Ta create core image Ta illegal instruction +.It Dv SIGTRAP Ta create core image Ta trace trap +.It Dv SIGABRT Ta create core image Ta Xr abort 3 call (formerly Dv SIGIOT ) +.It Dv SIGEMT Ta create core image Ta emulate instruction executed +.It Dv SIGFPE Ta create core image Ta floating-point exception +.It Dv SIGKILL Ta terminate process Ta kill program +.It Dv SIGBUS Ta create core image Ta bus error +.It Dv SIGSEGV Ta create core image Ta segmentation violation +.It Dv SIGSYS Ta create core image Ta non-existent system call invoked +.It Dv SIGPIPE Ta terminate process Ta write on a pipe with no reader +.It Dv SIGALRM Ta terminate process Ta real-time timer expired +.It Dv SIGTERM Ta terminate process Ta software termination signal +.It Dv SIGURG Ta discard signal Ta urgent condition present on socket +.It Dv SIGSTOP Ta stop process Ta stop (cannot be caught or ignored) +.It Dv SIGTSTP Ta stop process Ta stop signal generated from keyboard +.It Dv SIGCONT Ta discard signal Ta continue after stop +.It Dv SIGCHLD Ta discard signal Ta child status has changed +.It Dv SIGTTIN Ta stop process Ta background read attempted from control terminal +.It Dv SIGTTOU Ta stop process Ta background write attempted to control terminal +.It Dv SIGIO Ta discard signal Ta I/O is possible on a descriptor (see Xr fcntl 2 ) +.It Dv SIGXCPU Ta terminate process Ta cpu time limit exceeded (see Xr setrlimit 2 ) +.It Dv SIGXFSZ Ta terminate process Ta file size limit exceeded (see Xr setrlimit 2 ) +.It Dv SIGVTALRM Ta terminate process Ta virtual time alarm (see Xr setitimer 2 ) +.It Dv SIGPROF Ta terminate process Ta profiling timer alarm (see Xr setitimer 2 ) +.It Dv SIGWINCH Ta discard signal Ta window size change +.It Dv SIGINFO Ta discard signal Ta status request from keyboard +.It Dv SIGUSR1 Ta terminate process Ta user defined signal 1 +.It Dv SIGUSR2 Ta terminate process Ta user defined signal 2 .El .Sh NOTE The @@ -739,6 +731,8 @@ or .Xr kill 1 , .Xr kill 2 , .Xr ptrace 2 , +.Xr setitimer 2 , +.Xr setrlimit 2 , .Xr sigaltstack 2 , .Xr sigpending 2 , .Xr sigprocmask 2 , From owner-svn-src-all@freebsd.org Sat Oct 22 00:48:59 2016 Return-Path: Delivered-To: svn-src-all@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 8A468C1CBEC; Sat, 22 Oct 2016 00:48:59 +0000 (UTC) (envelope-from np@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 515BA266; Sat, 22 Oct 2016 00:48:59 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9M0mwRi054324; Sat, 22 Oct 2016 00:48:58 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M0mwmI054323; Sat, 22 Oct 2016 00:48:58 GMT (envelope-from np@FreeBSD.org) Message-Id: <201610220048.u9M0mwmI054323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 22 Oct 2016 00:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307759 - head/sys/dev/cxgbe/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 00:48:59 -0000 Author: np Date: Sat Oct 22 00:48:58 2016 New Revision: 307759 URL: https://svnweb.freebsd.org/changeset/base/307759 Log: cxgbe(4): Dump any mailbox command that times out. Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Sat Oct 22 00:38:47 2016 (r307758) +++ head/sys/dev/cxgbe/common/t4_hw.c Sat Oct 22 00:48:58 2016 (r307759) @@ -432,6 +432,21 @@ int t4_wr_mbox_meat_timeout(struct adapt CH_ERR(adap, "command %#x in mailbox %d timed out\n", *(const u8 *)cmd, mbox); + /* If DUMP_MBOX is set the mbox has already been dumped */ + if ((adap->debug_flags & DF_DUMP_MBOX) == 0) { + p = cmd; + CH_ERR(adap, "mbox: %016llx %016llx %016llx %016llx " + "%016llx %016llx %016llx %016llx\n", + (unsigned long long)be64_to_cpu(p[0]), + (unsigned long long)be64_to_cpu(p[1]), + (unsigned long long)be64_to_cpu(p[2]), + (unsigned long long)be64_to_cpu(p[3]), + (unsigned long long)be64_to_cpu(p[4]), + (unsigned long long)be64_to_cpu(p[5]), + (unsigned long long)be64_to_cpu(p[6]), + (unsigned long long)be64_to_cpu(p[7])); + } + t4_report_fw_error(adap); t4_fatal_err(adap); return ret; From owner-svn-src-all@freebsd.org Sat Oct 22 01:38:23 2016 Return-Path: Delivered-To: svn-src-all@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 62CA6C1B54E; Sat, 22 Oct 2016 01:38:23 +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 25AA4846; Sat, 22 Oct 2016 01:38:23 +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 u9M1cMD6072854; Sat, 22 Oct 2016 01:38:22 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M1cLJ1072846; Sat, 22 Oct 2016 01:38:21 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610220138.u9M1cLJ1072846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 01:38: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: r307760 - in stable/11: etc/mtree include sys/conf sys/dev/evdev X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 01:38:23 -0000 Author: gonzo Date: Sat Oct 22 01:38:21 2016 New Revision: 307760 URL: https://svnweb.freebsd.org/changeset/base/307760 Log: MFC r305706, r305749, r306274 r305706: Add evdev protocol implementation evdev is a generic input event interface compatible with Linux evdev API at ioctl level. It allows using unmodified (apart from header name) input evdev drivers in Xorg, Wayland, Qt. This commit has only generic kernel API. evdev support for individual hardware drivers like ukbd, ums, atkbd, etc. will be committed later. Project was started by Jakub Klama as part of GSoC 2014. Jakub's evdev implementation was later used as a base, updated and finished by Vladimir Kondratiev. Submitted by: Vladimir Kondratiev Reviewed by: adrian, hans Differential Revision: https://reviews.freebsd.org/D6998 r305749: Remove semicolon from the end of the macro definition Reported by: hans r306274: Handle NULL argument in evdev_free Add check for evdev argument of evdev_free being NULL. This is valid value and should not cause crash. In this case evdev_free does nothing Submitted by: Vladimir Kondratiev Added: stable/11/sys/dev/evdev/ - copied from r305706, head/sys/dev/evdev/ Modified: stable/11/etc/mtree/BSD.include.dist stable/11/include/Makefile stable/11/sys/conf/NOTES stable/11/sys/conf/files stable/11/sys/conf/options stable/11/sys/dev/evdev/cdev.c stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/uinput.c Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.include.dist ============================================================================== --- stable/11/etc/mtree/BSD.include.dist Sat Oct 22 00:48:58 2016 (r307759) +++ stable/11/etc/mtree/BSD.include.dist Sat Oct 22 01:38:21 2016 (r307760) @@ -110,6 +110,8 @@ .. ciss .. + evdev + .. filemon .. firewire Modified: stable/11/include/Makefile ============================================================================== --- stable/11/include/Makefile Sat Oct 22 00:48:58 2016 (r307759) +++ stable/11/include/Makefile Sat Oct 22 01:38:21 2016 (r307760) @@ -154,7 +154,7 @@ copies: .PHONY .META done; \ fi .endfor -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} cd ${.CURDIR}/../sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${DESTDIR}${INCLUDEDIR}/$i @@ -177,6 +177,13 @@ copies: .PHONY .META ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ ${DESTDIR}${INCLUDEDIR}/dev/nand .endif + cd ${.CURDIR}/../sys/dev/evdev; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input.h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input-event-codes.h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev cd ${.CURDIR}/../sys/dev/pci; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ ${DESTDIR}${INCLUDEDIR}/dev/pci @@ -238,7 +245,7 @@ symlinks: .PHONY .META ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ done .endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci} cd ${.CURDIR}/../sys/$i; \ for h in *.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ @@ -266,6 +273,11 @@ symlinks: .PHONY .META ${DESTDIR}${INCLUDEDIR}/dev/nand; \ done .endif + cd ${.CURDIR}/../sys/dev/evdev; \ + for h in input.h input-event-codes.h uinput.h; do \ + ln -fs ../../../../sys/dev/evdev/$$h \ + ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ + done cd ${.CURDIR}/../sys/dev/pci; \ for h in pcireg.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \ Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Sat Oct 22 00:48:58 2016 (r307759) +++ stable/11/sys/conf/NOTES Sat Oct 22 01:38:21 2016 (r307760) @@ -3062,3 +3062,8 @@ options GZIO # BHND(4) drivers options BHND_LOGLEVEL # Logging threshold level + +# evdev interface +options EVDEV +options EVDEV_DEBUG +options UINPUT_DEBUG Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Sat Oct 22 00:48:58 2016 (r307759) +++ stable/11/sys/conf/files Sat Oct 22 01:38:21 2016 (r307760) @@ -1497,6 +1497,11 @@ dev/etherswitch/ip17x/ip17x_vlans.c opti dev/etherswitch/miiproxy.c optional miiproxy dev/etherswitch/rtl8366/rtl8366rb.c optional rtl8366rb dev/etherswitch/ukswitch/ukswitch.c optional ukswitch +dev/evdev/cdev.c optional evdev +dev/evdev/evdev.c optional evdev +dev/evdev/evdev_mt.c optional evdev +dev/evdev/evdev_utils.c optional evdev +dev/evdev/uinput.c optional evdev uinput dev/ex/if_ex.c optional ex dev/ex/if_ex_isa.c optional ex isa dev/ex/if_ex_pccard.c optional ex pccard Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Sat Oct 22 00:48:58 2016 (r307759) +++ stable/11/sys/conf/options Sat Oct 22 01:38:21 2016 (r307760) @@ -986,3 +986,8 @@ BHND_LOGLEVEL opt_global.h # GPIO and child devices GPIO_SPI_DEBUG opt_gpio.h + +# evdev protocol support +EVDEV opt_evdev.h +EVDEV_DEBUG opt_evdev.h +UINPUT_DEBUG opt_evdev.h Modified: stable/11/sys/dev/evdev/cdev.c ============================================================================== --- head/sys/dev/evdev/cdev.c Sun Sep 11 18:56:38 2016 (r305706) +++ stable/11/sys/dev/evdev/cdev.c Sat Oct 22 01:38:21 2016 (r307760) @@ -49,7 +49,7 @@ #include #ifdef EVDEV_DEBUG -#define debugf(client, fmt, args...) printf("evdev cdev: "fmt"\n", ##args); +#define debugf(client, fmt, args...) printf("evdev cdev: "fmt"\n", ##args) #else #define debugf(client, fmt, args...) #endif Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- head/sys/dev/evdev/evdev.c Sun Sep 11 18:56:38 2016 (r305706) +++ stable/11/sys/dev/evdev/evdev.c Sat Oct 22 01:38:21 2016 (r307760) @@ -92,7 +92,8 @@ void evdev_free(struct evdev_dev *evdev) { - if (evdev->ev_cdev != NULL && evdev->ev_cdev->si_drv1 != NULL) + if (evdev != NULL && evdev->ev_cdev != NULL && + evdev->ev_cdev->si_drv1 != NULL) evdev_unregister(evdev); free(evdev, M_EVDEV); Modified: stable/11/sys/dev/evdev/uinput.c ============================================================================== --- head/sys/dev/evdev/uinput.c Sun Sep 11 18:56:38 2016 (r305706) +++ stable/11/sys/dev/evdev/uinput.c Sat Oct 22 01:38:21 2016 (r307760) @@ -50,7 +50,7 @@ #include #ifdef UINPUT_DEBUG -#define debugf(state, fmt, args...) printf("uinput: " fmt "\n", ##args); +#define debugf(state, fmt, args...) printf("uinput: " fmt "\n", ##args) #else #define debugf(state, fmt, args...) #endif From owner-svn-src-all@freebsd.org Sat Oct 22 01:57:20 2016 Return-Path: Delivered-To: svn-src-all@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 2FDD4C1BC14; Sat, 22 Oct 2016 01:57:20 +0000 (UTC) (envelope-from jhibbits@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 C0E31125; Sat, 22 Oct 2016 01:57:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9M1vIR4080364; Sat, 22 Oct 2016 01:57:18 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M1vFXx080331; Sat, 22 Oct 2016 01:57:15 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610220157.u9M1vFXx080331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 22 Oct 2016 01:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307761 - in head: . contrib/binutils/bfd contrib/gcc/config/rs6000 gnu/lib/libgcc gnu/lib/libgomp gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/cc/cc_tools gnu/usr.bin/cc/include gnu... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 01:57:20 -0000 Author: jhibbits Date: Sat Oct 22 01:57:15 2016 New Revision: 307761 URL: https://svnweb.freebsd.org/changeset/base/307761 Log: Create a new MACHINE_ARCH for Freescale PowerPC e500v2 Summary: The Freescale e500v2 PowerPC core does not use a standard FPU. Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor unit, which doubles as a FPU. The PowerPC SPE ABI is incompatible with the stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this. Additionaly, the SPE opcodes overlap with Altivec, so these are mutually exclusive. Taking advantage of this fact, a new file, powerpc/booke/spe.c, was created with the same function set as in powerpc/powerpc/altivec.c, so it becomes effectively a drop-in replacement. setjmp/longjmp were modified to save the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by the SPE). Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not support double-precision floating point. Also, without a new MACHINE_ARCH it would be impossible to provide binary packages which utilize the SPE. Additionally, no work has been done to support ports, work is needed for this. This also means no newer gcc can yet be used. However, gcc's powerpc support has been refactored which would make adding a powerpcspe-freebsd target very easy. Test Plan: This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222 (P1022-based) board, compiled against the new ABI. Base system utilities (/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot multiuser. Reviewed By: bdrewery, imp Relnotes: yes Differential Revision: https://reviews.freebsd.org/D5683 Added: head/contrib/gcc/config/rs6000/freebsdspe.h (contents, props changed) head/lib/libc/powerpcspe/ head/lib/libc/powerpcspe/Makefile.inc (contents, props changed) head/lib/libc/powerpcspe/SYS.h (contents, props changed) head/lib/libc/powerpcspe/Symbol.map (contents, props changed) head/lib/libc/powerpcspe/_fpmath.h (contents, props changed) head/lib/libc/powerpcspe/arith.h (contents, props changed) head/lib/libc/powerpcspe/gd_qnan.h (contents, props changed) head/lib/libc/powerpcspe/gen/ head/lib/libc/powerpcspe/gen/Makefile.inc (contents, props changed) head/lib/libc/powerpcspe/gen/_ctx_start.S (contents, props changed) head/lib/libc/powerpcspe/gen/_set_tp.c (contents, props changed) head/lib/libc/powerpcspe/gen/_setjmp.S (contents, props changed) head/lib/libc/powerpcspe/gen/eabi.S (contents, props changed) head/lib/libc/powerpcspe/gen/fabs.S (contents, props changed) head/lib/libc/powerpcspe/gen/flt_rounds.c (contents, props changed) head/lib/libc/powerpcspe/gen/fpgetmask.c (contents, props changed) head/lib/libc/powerpcspe/gen/fpgetround.c (contents, props changed) head/lib/libc/powerpcspe/gen/fpgetsticky.c (contents, props changed) head/lib/libc/powerpcspe/gen/fpsetmask.c (contents, props changed) head/lib/libc/powerpcspe/gen/fpsetround.c (contents, props changed) head/lib/libc/powerpcspe/gen/infinity.c (contents, props changed) head/lib/libc/powerpcspe/gen/makecontext.c (contents, props changed) head/lib/libc/powerpcspe/gen/setjmp.S (contents, props changed) head/lib/libc/powerpcspe/gen/signalcontext.c (contents, props changed) head/lib/libc/powerpcspe/gen/sigsetjmp.S (contents, props changed) head/lib/libc/powerpcspe/gen/syncicache.c (contents, props changed) head/lib/libc/powerpcspe/softfloat/ head/lib/libc/powerpcspe/softfloat/milieu.h (contents, props changed) head/lib/libc/powerpcspe/softfloat/powerpc-gcc.h (contents, props changed) head/lib/libc/powerpcspe/softfloat/softfloat.h (contents, props changed) head/lib/libc/powerpcspe/sys/ head/lib/libc/powerpcspe/sys/Makefile.inc (contents, props changed) head/lib/libc/powerpcspe/sys/brk.S (contents, props changed) head/lib/libc/powerpcspe/sys/cerror.S (contents, props changed) head/lib/libc/powerpcspe/sys/exect.S (contents, props changed) head/lib/libc/powerpcspe/sys/ptrace.S (contents, props changed) head/lib/libc/powerpcspe/sys/sbrk.S (contents, props changed) head/lib/libc/powerpcspe/sys/setlogin.S (contents, props changed) head/sys/conf/ldscript.powerpcspe (contents, props changed) head/sys/powerpc/booke/spe.c (contents, props changed) head/sys/powerpc/conf/MPC85XXSPE (contents, props changed) Modified: head/Makefile head/Makefile.inc1 head/contrib/binutils/bfd/config.bfd head/gnu/lib/libgcc/Makefile head/gnu/lib/libgomp/Makefile head/gnu/usr.bin/binutils/Makefile.inc0 head/gnu/usr.bin/cc/Makefile.tgt head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs head/gnu/usr.bin/cc/include/Makefile head/gnu/usr.bin/gdb/Makefile.inc head/gnu/usr.bin/gdb/libgdb/Makefile head/lib/libarchive/Makefile head/lib/msun/powerpc/fenv.h head/share/mk/bsd.cpu.mk head/share/mk/bsd.endian.mk head/share/mk/local.meta.sys.mk head/share/mk/sys.mk head/sys/boot/powerpc/Makefile head/sys/conf/Makefile.powerpc head/sys/conf/files.powerpc head/sys/conf/kern.mk head/sys/conf/options.powerpc head/sys/modules/Makefile head/sys/powerpc/booke/booke_machdep.c head/sys/powerpc/include/param.h head/sys/powerpc/include/spr.h head/sys/powerpc/include/trap.h head/sys/powerpc/powerpc/trap.c head/usr.sbin/Makefile.powerpc Modified: head/Makefile ============================================================================== --- head/Makefile Sat Oct 22 01:38:21 2016 (r307760) +++ head/Makefile Sat Oct 22 01:57:15 2016 (r307761) @@ -239,7 +239,7 @@ _MAKE+= MK_META_MODE=no _TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} -_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/riscv64/riscv/} +_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64/riscv/} .endif .if defined(TARGET) && !defined(_TARGET) _TARGET=${TARGET} @@ -422,7 +422,7 @@ _UNIVERSE_TARGETS= ${TARGETS} TARGET_ARCHES_arm?= arm armeb armv6 TARGET_ARCHES_arm64?= aarch64 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 -TARGET_ARCHES_powerpc?= powerpc powerpc64 +TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe TARGET_ARCHES_pc98?= i386 .for target in ${TARGETS} TARGET_ARCHES_${target}?= ${target} Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Oct 22 01:38:21 2016 (r307760) +++ head/Makefile.inc1 Sat Oct 22 01:57:15 2016 (r307761) @@ -358,6 +358,7 @@ KNOWN_ARCHES?= aarch64/arm64 \ mipsn32/mips \ powerpc \ powerpc64/powerpc \ + powerpcspe/powerpc \ riscv64/riscv \ sparc64 Modified: head/contrib/binutils/bfd/config.bfd ============================================================================== --- head/contrib/binutils/bfd/config.bfd Sat Oct 22 01:38:21 2016 (r307760) +++ head/contrib/binutils/bfd/config.bfd Sat Oct 22 01:57:15 2016 (r307761) @@ -1103,7 +1103,7 @@ case "${targ}" in want64=true ;; #endif - powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ + powerpc-*-*bsd* | powerpcspe-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ powerpc-*-solaris2* | powerpc-*-linux-* | powerpc-*-rtems* | \ powerpc-*-chorus*) targ_defvec=bfd_elf32_powerpc_vec Added: head/contrib/gcc/config/rs6000/freebsdspe.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/gcc/config/rs6000/freebsdspe.h Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,77 @@ +/* Definitions of target machine for GNU compiler, + for PowerPC e500 machines running FreeBSD. + Based on linuxspe.h + Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Contributed by Aldy Hernandez (aldy@quesejoda.com). + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the + Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (PowerPC E500 FreeBSD)"); + +/* Override rs6000.h and sysv4.h definition. */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN) + +#undef TARGET_SPE_ABI +#undef TARGET_SPE +#undef TARGET_E500 +#undef TARGET_ISEL +#undef TARGET_FPRS +#undef TARGET_E500_SINGLE +#undef TARGET_E500_DOUBLE + +#define TARGET_SPE_ABI rs6000_spe_abi +#define TARGET_SPE rs6000_spe +#define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540) +#define TARGET_ISEL rs6000_isel +#define TARGET_FPRS (rs6000_float_gprs == 0) +#define TARGET_E500_SINGLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 1) +#define TARGET_E500_DOUBLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 2) + +#undef SUBSUBTARGET_OVERRIDE_OPTIONS +#define SUBSUBTARGET_OVERRIDE_OPTIONS \ + if (rs6000_select[1].string == NULL) \ + rs6000_cpu = PROCESSOR_PPC8540; \ + if (!rs6000_explicit_options.abi) \ + rs6000_spe_abi = 1; \ + if (!rs6000_explicit_options.float_gprs) \ + rs6000_float_gprs = 1; \ + /* See note below. */ \ + /*if (!rs6000_explicit_options.long_double)*/ \ + /* rs6000_long_double_type_size = 128;*/ \ + if (!rs6000_explicit_options.spe) \ + rs6000_spe = 1; \ + if (!rs6000_explicit_options.isel) \ + rs6000_isel = 1; \ + if (target_flags & MASK_64BIT) \ + error ("-m64 not supported in this configuration") + +/* The e500 ABI says that either long doubles are 128 bits, or if + implemented in any other size, the compiler/linker should error out. + We have no emulation libraries for 128 bit long doubles, and I hate + the dozens of failures on the regression suite. So I'm breaking ABI + specifications, until I properly fix the emulation. + + Enable these later. +#undef CPP_LONGDOUBLE_DEFAULT_SPEC +#define CPP_LONGDOUBLE_DEFAULT_SPEC "-D__LONG_DOUBLE_128__=1" +*/ + +#undef ASM_DEFAULT_SPEC +#define ASM_DEFAULT_SPEC "-mppc -mspe -me500" Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/lib/libgcc/Makefile Sat Oct 22 01:57:15 2016 (r307761) @@ -173,7 +173,7 @@ LIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c .endif .endif -.if ${TARGET_ARCH} == "powerpc" +.if ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpcspe" # from config/rs6000/t-ppccomm LIB2FUNCS_EXTRA = tramp.asm LIB2FUNCS_STATIC_EXTRA = eabi.asm Modified: head/gnu/lib/libgomp/Makefile ============================================================================== --- head/gnu/lib/libgomp/Makefile Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/lib/libgomp/Makefile Sat Oct 22 01:57:15 2016 (r307761) @@ -24,7 +24,7 @@ VERSION_MAP= ${SRCDIR}/libgomp.map # Target-specific OpenMP configuration .if ${MACHINE_CPUARCH} == arm || ${MACHINE_CPUARCH} == i386 || \ - ${MACHINE_ARCH} == powerpc || \ + ${MACHINE_ARCH} == powerpc || ${MACHINE_ARCH} == powerpcspe || \ (${MACHINE_CPUARCH} == mips && ${MACHINE_ARCH:Mmips64*} == "") OMP_LOCK_ALIGN = 4 OMP_LOCK_KIND= 4 Modified: head/gnu/usr.bin/binutils/Makefile.inc0 ============================================================================== --- head/gnu/usr.bin/binutils/Makefile.inc0 Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/usr.bin/binutils/Makefile.inc0 Sat Oct 22 01:57:15 2016 (r307761) @@ -7,7 +7,7 @@ VERSION= "2.17.50 [FreeBSD] 2007-07-03" .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif @@ -30,7 +30,7 @@ RELSRC= ${RELTOP}/../../../contrib/binut SRCDIR= ${.CURDIR}/${RELSRC} .if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "i386" || \ - ${TARGET_ARCH} == "powerpc" || \ + ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpcspe" || \ (${TARGET_CPUARCH} == "mips" && ${TARGET_ARCH:Mmips64*} == "") CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=32 .else Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/usr.bin/cc/Makefile.tgt Sat Oct 22 01:57:15 2016 (r307761) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64spe)/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs ============================================================================== --- head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/usr.bin/cc/cc_tools/Makefile.hdrs Sat Oct 22 01:57:15 2016 (r307761) @@ -46,6 +46,10 @@ TARGET_INC+= ${GCC_CPU}/bpabi.h TARGET_INC+= ${GCC_CPU}/biarch64.h TARGET_INC+= ${GCC_CPU}/default64.h .endif +.if ${TARGET_ARCH} == "powerpcspe" +TARGET_INC+= ${GCC_CPU}/freebsdspe.h +TARGET_INC+= ${GCC_CPU}/e500-double.h +.endif TARGET_INC+= ${GCC_CPU}/freebsd.h .if ${TARGET_CPUARCH} == "amd64" TARGET_INC+= ${GCC_CPU}/freebsd64.h Modified: head/gnu/usr.bin/cc/include/Makefile ============================================================================== --- head/gnu/usr.bin/cc/include/Makefile Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/usr.bin/cc/include/Makefile Sat Oct 22 01:57:15 2016 (r307761) @@ -14,7 +14,8 @@ INCS= ammintrin.h emmintrin.h mmintrin.h INCS+= wmmintrin.h __wmmintrin_aes.h __wmmintrin_pclmul.h .elif ${TARGET_ARCH} == "arm" INCS= mmintrin.h -.elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64" +.elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64" || \ + ${TARGET_ARCH} == "powerpcspe" INCS= ppc-asm.h altivec.h spe.h .endif Modified: head/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- head/gnu/usr.bin/gdb/Makefile.inc Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/usr.bin/gdb/Makefile.inc Sat Oct 22 01:57:15 2016 (r307761) @@ -23,7 +23,7 @@ OBJ_RL= ${OBJ_ROOT}/../lib/libreadline/r # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/libgdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/libgdb/Makefile Sat Oct 22 01:38:21 2016 (r307760) +++ head/gnu/usr.bin/gdb/libgdb/Makefile Sat Oct 22 01:57:15 2016 (r307761) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Sat Oct 22 01:38:21 2016 (r307760) +++ head/lib/libarchive/Makefile Sat Oct 22 01:57:15 2016 (r307761) @@ -30,7 +30,7 @@ SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_IC .endif .if ${MACHINE_ARCH:Marm*} != "" || ${MACHINE_ARCH:Mmips*} != "" || \ - ${MACHINE_ARCH:Msparc64*} != "" + ${MACHINE_ARCH:Msparc64*} != "" || ${MACHINE_ARCH:Mpowerpc*} != "" NO_WCAST_ALIGN= yes .if ${MACHINE_ARCH:M*64*} == "" CFLAGS+= -DPPMD_32BIT Added: head/lib/libc/powerpcspe/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/Makefile.inc Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +SRCS+= trivial-vdso_tc.c + +# Long double is 64-bits +MDSRCS+=machdep_ldisd.c +SYM_MAPS+=${LIBC_SRCTOP}/powerpcspe/Symbol.map Added: head/lib/libc/powerpcspe/SYS.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/SYS.h Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2002 Benno Rice. All rights reserved. + * Copyright (c) 2002 David E. O'Brien. 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. + * 3. Neither the name of the author nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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 REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $NetBSD: SYS.h,v 1.8 2002/01/14 00:55:56 thorpej Exp $ + * $FreeBSD$ + */ + +#include +#include + +#define _SYSCALL(name) \ + .text; \ + .align 2; \ + li 0,(SYS_##name); \ + sc + +#define SYSCALL(name) \ + .text; \ + .align 2; \ +2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ +ENTRY(__sys_##name); \ + WEAK_REFERENCE(__sys_##name, name); \ + WEAK_REFERENCE(__sys_##name, _##name); \ + _SYSCALL(name); \ + bso 2b + +#define PSEUDO(name) \ + .text; \ + .align 2; \ +ENTRY(__sys_##name); \ + WEAK_REFERENCE(__sys_##name, _##name); \ + _SYSCALL(name); \ + bnslr; \ + b PIC_PLT(CNAME(HIDENAME(cerror))) + +#define RSYSCALL(name) \ + .text; \ + .align 2; \ +2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ +ENTRY(__sys_##name); \ + WEAK_REFERENCE(__sys_##name, name); \ + WEAK_REFERENCE(__sys_##name, _##name); \ + _SYSCALL(name); \ + bnslr; \ + b PIC_PLT(CNAME(HIDENAME(cerror))) Added: head/lib/libc/powerpcspe/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/Symbol.map Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,59 @@ +/* + * $FreeBSD$ + */ + +/* + * This only needs to contain symbols that are not listed in + * symbol maps from other parts of libc (i.e., not found in + * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...). + */ +FBSD_1.0 { + /* PSEUDO syscalls */ + _exit; + + _mcount; + _setjmp; + _longjmp; + fabs; + __flt_rounds; + fpgetmask; + fpgetround; + fpgetsticky; + fpsetmask; + fpsetround; + __infinity; + __nan; + makecontext; + setjmp; + longjmp; + sigsetjmp; + siglongjmp; + htonl; + htons; + ntohl; + ntohs; + brk; + exect; + sbrk; + vfork; +}; + +FBSD_1.3 { + __eabi; +}; + +FBSDprivate_1.0 { + /* PSEUDO syscalls */ + __sys_getlogin; + _getlogin; + __sys_exit; + + _set_tp; + _fpgetsticky; + __makecontext; + __longjmp; + signalcontext; + __signalcontext; + __syncicache; + _end; +}; Added: head/lib/libc/powerpcspe/_fpmath.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/_fpmath.h Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2003 David Schultz + * 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$ + */ + +union IEEEl2bits { + long double e; + struct { + unsigned int sign :1; + unsigned int exp :11; + unsigned int manh :20; + unsigned int manl :32; + } bits; +}; + +#define mask_nbit_l(u) ((void)0) +#define LDBL_IMPLICIT_NBIT +#define LDBL_NBIT 0 + +#define LDBL_MANH_SIZE 20 +#define LDBL_MANL_SIZE 32 + +#define LDBL_TO_ARRAY32(u, a) do { \ + (a)[0] = (uint32_t)(u).bits.manl; \ + (a)[1] = (uint32_t)(u).bits.manh; \ +} while(0) Added: head/lib/libc/powerpcspe/arith.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/arith.h Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,16 @@ +/* + * MD header for contrib/gdtoa + * + * $FreeBSD$ + */ + +/* + * NOTE: The definitions in this file must be correct or strtod(3) and + * floating point formats in printf(3) will break! The file can be + * generated by running contrib/gdtoa/arithchk.c on the target + * architecture. See contrib/gdtoa/gdtoaimp.h for details. + */ + +#define IEEE_MC68k +#define Arith_Kind_ASL 2 +#define Double_Align Added: head/lib/libc/powerpcspe/gd_qnan.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gd_qnan.h Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,21 @@ +/* + * MD header for contrib/gdtoa + * + * This file can be generated by compiling and running contrib/gdtoa/qnan.c + * on the target architecture after arith.h has been generated. + * + * $FreeBSD$ + */ + +#define f_QNAN 0x7fc00000 +#define d_QNAN0 0x7ff80000 +#define d_QNAN1 0x0 +#define ld_QNAN0 0x7ff80000 +#define ld_QNAN1 0x0 +#define ld_QNAN2 0x0 +#define ld_QNAN3 0x0 +#define ldus_QNAN0 0x7ff8 +#define ldus_QNAN1 0x0 +#define ldus_QNAN2 0x0 +#define ldus_QNAN3 0x0 +#define ldus_QNAN4 0x0 Added: head/lib/libc/powerpcspe/gen/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/Makefile.inc Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +SRCS += _ctx_start.S eabi.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c \ + infinity.c ldexp.c makecontext.c _setjmp.S \ + setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ + _set_tp.c \ + trivial-getcontextx.c + + + Added: head/lib/libc/powerpcspe/gen/_ctx_start.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/_ctx_start.S Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2004 Suleiman Souhlal + * 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$"); + + .globl CNAME(_ctx_done) + .globl CNAME(abort) + + ENTRY(_ctx_start) + mtlr %r14 + blrl /* branch to start function */ + mr %r3,%r15 /* pass pointer to ucontext as argument */ + bl PIC_PLT(CNAME(_ctx_done)) /* branch to ctxt completion func */ + /* + * we should never return from the + * above branch. + */ + bl PIC_PLT(CNAME(abort)) /* abort */ + END(_cts_start) + + .section .note.GNU-stack,"",%progbits Added: head/lib/libc/powerpcspe/gen/_set_tp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/_set_tp.c Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2004 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#include "libc_private.h" + +void +_set_tp(void *tpval) +{ + + __asm __volatile("mr 2,%0" :: "r"((char*)tpval + 0x7008)); +} Added: head/lib/libc/powerpcspe/gen/_setjmp.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/_setjmp.S Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,117 @@ +/*- + * Copyright (c) 2016 Justin Hibbits + * 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. + */ +/* $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * C library -- _setjmp, _longjmp + * + * _longjmp(a,v) + * will generate a "return(v?v:1)" from the last call to + * _setjmp(a) + * by restoring registers from the stack. + * The previous signal state is NOT restored. + * + * jmpbuf layout: + * +------------+ + * | unused | + * +------------+ + * | unused | + * | | + * | (4 words) | + * | | + * +------------+ + * | saved regs | + * | ... | + */ + +ENTRY(_setjmp) + mflr %r11 + mfcr %r12 + evstdd %r1,24+0*8(%r3) + evstdd %r2,24+1*8(%r3) + evstdd %r11,24+2*8(%r3) + evstdd %r12,24+3*8(%r3) + evstdd %r13,24+4*8(%r3) + evstdd %r14,24+5*8(%r3) + evstdd %r15,24+6*8(%r3) + evstdd %r16,24+7*8(%r3) + evstdd %r17,24+8*8(%r3) + evstdd %r18,24+9*8(%r3) + evstdd %r19,24+10*8(%r3) + evstdd %r20,24+11*8(%r3) + evstdd %r21,24+12*8(%r3) + evstdd %r22,24+13*8(%r3) + evstdd %r23,24+14*8(%r3) + evstdd %r24,24+15*8(%r3) + evstdd %r25,24+16*8(%r3) + evstdd %r26,24+17*8(%r3) + evstdd %r27,24+18*8(%r3) + evstdd %r28,24+19*8(%r3) + evstdd %r29,24+20*8(%r3) + evstdd %r30,24+21*8(%r3) + evstdd %r31,24+22*8(%r3) + + li %r3,0 + blr +END(_setjmp) + +ENTRY(_longjmp) + evldd %r1,24+0*8(%r3) + evldd %r2,24+1*8(%r3) + evldd %r11,24+2*8(%r3) + evldd %r12,24+3*8(%r3) + evldd %r13,24+4*8(%r3) + evldd %r14,24+5*8(%r3) + evldd %r15,24+6*8(%r3) + evldd %r16,24+7*8(%r3) + evldd %r17,24+8*8(%r3) + evldd %r18,24+9*8(%r3) + evldd %r19,24+10*8(%r3) + evldd %r20,24+11*8(%r3) + evldd %r21,24+12*8(%r3) + evldd %r22,24+13*8(%r3) + evldd %r23,24+14*8(%r3) + evldd %r24,24+15*8(%r3) + evldd %r25,24+16*8(%r3) + evldd %r26,24+17*8(%r3) + evldd %r27,24+18*8(%r3) + evldd %r28,24+19*8(%r3) + evldd %r29,24+20*8(%r3) + evldd %r30,24+21*8(%r3) + evldd %r31,24+22*8(%r3) + + mtlr %r11 + mtcr %r12 + or. %r3,%r4,%r4 + bnelr + li %r3,1 + blr +END(_longjmp) + + .section .note.GNU-stack,"",%progbits Added: head/lib/libc/powerpcspe/gen/eabi.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/eabi.S Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2011 Marcel Moolenaar + * 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$"); + +ENTRY(__eabi) + blr +END(__eabi) + + .section .note.GNU-stack,"",%progbits Added: head/lib/libc/powerpcspe/gen/fabs.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/fabs.S Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Justin Hibbits + * 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$"); + +/* + * double fabs(double) + */ +ENTRY(fabs) + efdabs %f1,%f1 + blr +END(fabs) + + .section .note.GNU-stack,"",%progbits Added: head/lib/libc/powerpcspe/gen/flt_rounds.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/flt_rounds.c Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,57 @@ +/* $NetBSD: flt_rounds.c,v 1.4.10.3 2002/03/22 20:41:53 nathanw Exp $ */ + +/* + * Copyright (c) 2016 Justin Hibbits + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Mark Brinicombe + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#ifndef _SOFT_FLOAT +static const int map[] = { + 1, /* round to nearest */ + 0, /* round to zero */ + 2, /* round to positive infinity */ + 3 /* round to negative infinity */ +}; + +int +__flt_rounds() +{ + uint32_t fpscr; + + __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); + return map[(fpscr & 0x03)]; +} +#endif Added: head/lib/libc/powerpcspe/gen/fpgetmask.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/fpgetmask.c Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,49 @@ +/* $NetBSD: fpgetmask.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $ */ + +/* + * Copyright (c) 2016 Justin Hibbits + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dan Winship. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#ifndef _SOFT_FLOAT +fp_except_t +fpgetmask() +{ + uint32_t fpscr; + + __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); + return ((fp_except_t)((fpscr >> 3) & 0x1f)); +} +#endif Added: head/lib/libc/powerpcspe/gen/fpgetround.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/fpgetround.c Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,49 @@ +/* $NetBSD: fpgetround.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $ */ + +/* + * Copyright (c) 2016 Justin Hibbits + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dan Winship. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#ifndef _SOFT_FLOAT +fp_rnd_t +fpgetround() +{ + uint32_t fpscr; + + __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); + return ((fp_rnd_t)(fpscr & 0x3)); +} +#endif Added: head/lib/libc/powerpcspe/gen/fpgetsticky.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/fpgetsticky.c Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,55 @@ +/* $NetBSD: fpgetsticky.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */ + +/* + * Copyright (c) 2016 Justin Hibbits + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dan Winship. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include "namespace.h" + +#include +#include +#include + +#ifndef _SOFT_FLOAT +#ifdef __weak_alias +__weak_alias(fpgetsticky,_fpgetsticky) +#endif + +fp_except_t +fpgetsticky() +{ + uint32_t fpscr; + + __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); + return ((fp_except_t)((fpscr >> 25) & 0x1f)); +} +#endif Added: head/lib/libc/powerpcspe/gen/fpsetmask.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpcspe/gen/fpsetmask.c Sat Oct 22 01:57:15 2016 (r307761) @@ -0,0 +1,53 @@ +/* $NetBSD: fpsetmask.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */ + +/* + * Copyright (c) 2016 Justin Hibbits *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 22 01:58:23 2016 Return-Path: Delivered-To: svn-src-all@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 2ABC8C1BCA8; Sat, 22 Oct 2016 01:58:23 +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 E02492DE; Sat, 22 Oct 2016 01:58:22 +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 u9M1wMvM080442; Sat, 22 Oct 2016 01:58:22 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M1wLUI080438; Sat, 22 Oct 2016 01:58:21 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610220158.u9M1wLUI080438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 01:58: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: r307762 - in stable/11/sys/arm: conf ti X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 01:58:23 -0000 Author: gonzo Date: Sat Oct 22 01:58:21 2016 New Revision: 307762 URL: https://svnweb.freebsd.org/changeset/base/307762 Log: MFC r305708, r305719 r305708: Add evdev support to TI ADC/touchscreen driver Add generic evdev support to touchscreen part of ti_adc: two absolute coordinates + button touch to indicate pen position. Pressure value reporting is not implemented yet. Tested on: Beaglebone Black + 4DCAPE-43T + tslib r305719: Cleanup evdev support for TI ADC/TS - evdev_set_methods call is not required if actual methods are no-ops - evdev_set_serial is also optional if there is no meaningful input device identifier - evdev_set_id on the other hand is mandatory, so set virtual bus with dummy vendor/product/version Suggested by: Vladimir Kondratiev Modified: stable/11/sys/arm/conf/BEAGLEBONE stable/11/sys/arm/ti/ti_adc.c stable/11/sys/arm/ti/ti_adcreg.h stable/11/sys/arm/ti/ti_adcvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/11/sys/arm/conf/BEAGLEBONE Sat Oct 22 01:57:15 2016 (r307761) +++ stable/11/sys/arm/conf/BEAGLEBONE Sat Oct 22 01:58:21 2016 (r307762) @@ -133,3 +133,6 @@ device hdmi device ums device ukbd device kbdmux + +# Uncomment to enable evdev support for ti_adc +# options EVDEV Modified: stable/11/sys/arm/ti/ti_adc.c ============================================================================== --- stable/11/sys/arm/ti/ti_adc.c Sat Oct 22 01:57:15 2016 (r307761) +++ stable/11/sys/arm/ti/ti_adc.c Sat Oct 22 01:58:21 2016 (r307762) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_evdev.h" + #include #include #include @@ -52,6 +54,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef EVDEV +#include +#include +#endif + #include #include #include @@ -80,6 +87,20 @@ static struct ti_adc_input ti_adc_inputs static int ti_adc_samples[5] = { 0, 2, 4, 8, 16 }; +static int ti_adc_detach(device_t dev); + +#ifdef EVDEV +static void +ti_adc_ev_report(struct ti_adc_softc *sc) +{ + + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_X, sc->sc_x); + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_Y, sc->sc_y); + evdev_push_event(sc->sc_evdev, EV_KEY, BTN_TOUCH, sc->sc_pen_down); + evdev_sync(sc->sc_evdev); +} +#endif /* EVDEV */ + static void ti_adc_enable(struct ti_adc_softc *sc) { @@ -450,7 +471,14 @@ ti_adc_tsc_read_data(struct ti_adc_softc #ifdef DEBUG_TSC device_printf(sc->sc_dev, "touchscreen x: %d, y: %d\n", x, y); #endif - /* TODO: That's where actual event reporting should take place */ + +#ifdef EVDEV + if ((sc->sc_x != x) || (sc->sc_y != y)) { + sc->sc_x = x; + sc->sc_y = y; + ti_adc_ev_report(sc); + } +#endif } static void @@ -488,11 +516,17 @@ ti_adc_intr(void *arg) status |= ADC_IRQ_HW_PEN_ASYNC; ADC_WRITE4(sc, ADC_IRQENABLE_CLR, ADC_IRQ_HW_PEN_ASYNC); +#ifdef EVDEV + ti_adc_ev_report(sc); +#endif } if (rawstatus & ADC_IRQ_PEN_UP) { sc->sc_pen_down = 0; status |= ADC_IRQ_PEN_UP; +#ifdef EVDEV + ti_adc_ev_report(sc); +#endif } if (status & ADC_IRQ_FIFO0_THRES) @@ -840,6 +874,38 @@ ti_adc_attach(device_t dev) ti_adc_setup(sc); TI_ADC_UNLOCK(sc); +#ifdef EVDEV + if (sc->sc_tsc_wires > 0) { + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, device_get_desc(dev)); + evdev_set_phys(sc->sc_evdev, device_get_nameunit(dev)); + evdev_set_id(sc->sc_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_prop(sc->sc_evdev, INPUT_PROP_DIRECT); + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_ABS); + evdev_support_event(sc->sc_evdev, EV_KEY); + + evdev_support_abs(sc->sc_evdev, ABS_X, 0, 0, + ADC_MAX_VALUE, 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_Y, 0, 0, + ADC_MAX_VALUE, 0, 0, 0); + + evdev_support_key(sc->sc_evdev, BTN_TOUCH); + + err = evdev_register(sc->sc_evdev); + if (err) { + device_printf(dev, + "failed to register evdev: error=%d\n", err); + ti_adc_detach(dev); + return (err); + } + + sc->sc_pen_down = 0; + sc->sc_x = -1; + sc->sc_y = -1; + } +#endif /* EVDEV */ + return (0); } @@ -854,6 +920,11 @@ ti_adc_detach(device_t dev) TI_ADC_LOCK(sc); ti_adc_reset(sc); ti_adc_setup(sc); + +#ifdef EVDEV + evdev_free(sc->sc_evdev); +#endif + TI_ADC_UNLOCK(sc); TI_ADC_LOCK_DESTROY(sc); Modified: stable/11/sys/arm/ti/ti_adcreg.h ============================================================================== --- stable/11/sys/arm/ti/ti_adcreg.h Sat Oct 22 01:57:15 2016 (r307761) +++ stable/11/sys/arm/ti/ti_adcreg.h Sat Oct 22 01:58:21 2016 (r307762) @@ -122,5 +122,6 @@ #define ADC_FIFO_STEP_ID_MSK 0x000f0000 #define ADC_FIFO_STEP_ID_SHIFT 16 #define ADC_FIFO_DATA_MSK 0x00000fff +#define ADC_MAX_VALUE 0xfff #endif /* _TI_ADCREG_H_ */ Modified: stable/11/sys/arm/ti/ti_adcvar.h ============================================================================== --- stable/11/sys/arm/ti/ti_adcvar.h Sat Oct 22 01:57:15 2016 (r307761) +++ stable/11/sys/arm/ti/ti_adcvar.h Sat Oct 22 01:58:21 2016 (r307762) @@ -55,6 +55,11 @@ struct ti_adc_softc { int sc_yn_bit, sc_yn_inp; uint32_t sc_tsc_enabled; int sc_pen_down; +#ifdef EVDEV + int sc_x; + int sc_y; + struct evdev_dev *sc_evdev; +#endif }; struct ti_adc_input { From owner-svn-src-all@freebsd.org Sat Oct 22 02:11:54 2016 Return-Path: Delivered-To: svn-src-all@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 C52F9C1BEB4; Sat, 22 Oct 2016 02:11:54 +0000 (UTC) (envelope-from jhibbits@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 84B7FB09; Sat, 22 Oct 2016 02:11:54 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9M2Br4S086292; Sat, 22 Oct 2016 02:11:53 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M2BrVe086290; Sat, 22 Oct 2016 02:11:53 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610220211.u9M2BrVe086290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 22 Oct 2016 02:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307763 - head/sys/dev/dpaa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 02:11:54 -0000 Author: jhibbits Date: Sat Oct 22 02:11:53 2016 New Revision: 307763 URL: https://svnweb.freebsd.org/changeset/base/307763 Log: Initialize the ofw_bus_devinfo on the portals to prevent a crash. If the device tree doesn't contain a cpu-handle field in any bman-portal or qman-portal, it will exit without setting up the devinfo, leaving it uninitialized. This will lead to attempts to free random memory, and ultimately panic. Modified: head/sys/dev/dpaa/bman_fdt.c head/sys/dev/dpaa/qman_fdt.c Modified: head/sys/dev/dpaa/bman_fdt.c ============================================================================== --- head/sys/dev/dpaa/bman_fdt.c Sat Oct 22 01:58:21 2016 (r307762) +++ head/sys/dev/dpaa/bman_fdt.c Sat Oct 22 02:11:53 2016 (r307763) @@ -143,7 +143,7 @@ bman_portals_fdt_attach(device_t dev) ihandle_t cpu; int cpu_num, cpus, intr_rid; struct dpaa_portals_devinfo di; - struct ofw_bus_devinfo ofw_di; + struct ofw_bus_devinfo ofw_di = {}; cpus = 0; sc = device_get_softc(dev); Modified: head/sys/dev/dpaa/qman_fdt.c ============================================================================== --- head/sys/dev/dpaa/qman_fdt.c Sat Oct 22 01:58:21 2016 (r307762) +++ head/sys/dev/dpaa/qman_fdt.c Sat Oct 22 02:11:53 2016 (r307763) @@ -143,7 +143,7 @@ qman_portals_fdt_attach(device_t dev) ihandle_t cpu; int cpu_num, cpus, intr_rid; struct dpaa_portals_devinfo di; - struct ofw_bus_devinfo ofw_di; + struct ofw_bus_devinfo ofw_di = {}; cpus = 0; sc = device_get_softc(dev); From owner-svn-src-all@freebsd.org Sat Oct 22 02:15:41 2016 Return-Path: Delivered-To: svn-src-all@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 67060C1B03C; Sat, 22 Oct 2016 02:15: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 1E0C7D1C; Sat, 22 Oct 2016 02:15: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 u9M2FecS087727; Sat, 22 Oct 2016 02:15:40 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M2FeOo087725; Sat, 22 Oct 2016 02:15:40 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610220215.u9M2FeOo087725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 02:15: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: r307764 - in stable/11/sys: dev/usb/input modules/usb/ukbd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 02:15:41 -0000 Author: gonzo Date: Sat Oct 22 02:15:39 2016 New Revision: 307764 URL: https://svnweb.freebsd.org/changeset/base/307764 Log: MFC r306132, r306275: r306132: Add evdev support to ukbd driver event generation is disabled by default in favour of kbdmux. This behavoiur is controlled by kern.evdev.rcpt_mask sysctl, bit 3 should be set to give priority to hw over mux Submitted by: Vladimir Kondratiev Reviewed by: hans Differential Revision: https://reviews.freebsd.org/D7957 r306275: Do not perform extra check for NULL, evdev_free can handle NULL value Submitted by: Vladimir Kondratiev Modified: stable/11/sys/dev/usb/input/ukbd.c stable/11/sys/modules/usb/ukbd/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/11/sys/dev/usb/input/ukbd.c Sat Oct 22 02:11:53 2016 (r307763) +++ stable/11/sys/dev/usb/input/ukbd.c Sat Oct 22 02:15:39 2016 (r307764) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_kbd.h" #include "opt_ukbd.h" +#include "opt_evdev.h" #include #include @@ -73,6 +74,11 @@ __FBSDID("$FreeBSD$"); #include +#ifdef EVDEV +#include +#include +#endif + #include #include #include @@ -162,6 +168,9 @@ struct ukbd_softc { struct usb_device *sc_udev; struct usb_interface *sc_iface; struct usb_xfer *sc_xfer[UKBD_N_TRANSFER]; +#ifdef EVDEV + struct evdev_dev *sc_evdev; +#endif uint32_t sc_ntime[UKBD_NKEYCODE]; uint32_t sc_otime[UKBD_NKEYCODE]; @@ -377,6 +386,12 @@ static device_attach_t ukbd_attach; static device_detach_t ukbd_detach; static device_resume_t ukbd_resume; +#ifdef EVDEV +static struct evdev_methods ukbd_evdev_methods = { + .ev_event = evdev_ev_kbd_event, +}; +#endif + static uint8_t ukbd_any_key_pressed(struct ukbd_softc *sc) { @@ -405,6 +420,14 @@ ukbd_put_key(struct ukbd_softc *sc, uint DPRINTF("0x%02x (%d) %s\n", key, key, (key & KEY_RELEASE) ? "released" : "pressed"); +#ifdef EVDEV + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) { + evdev_push_event(sc->sc_evdev, EV_KEY, + evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); + evdev_sync(sc->sc_evdev); + } +#endif + if (sc->sc_inputs < UKBD_IN_BUF_SIZE) { sc->sc_input[sc->sc_inputtail] = key; ++(sc->sc_inputs); @@ -918,6 +941,11 @@ ukbd_set_leds_callback(struct usb_xfer * if (!any) break; +#ifdef EVDEV + if (sc->sc_evdev != NULL) + evdev_push_leds(sc->sc_evdev, sc->sc_leds); +#endif + /* range check output report length */ len = sc->sc_led_size; if (len > (UKBD_BUFFER_SIZE - 1)) @@ -1193,6 +1221,10 @@ ukbd_attach(device_t dev) usb_error_t err; uint16_t n; uint16_t hid_len; +#ifdef EVDEV + struct evdev_dev *evdev; + int i; +#endif #ifdef USB_DEBUG int rate; #endif @@ -1307,6 +1339,37 @@ ukbd_attach(device_t dev) goto detach; } #endif + +#ifdef EVDEV + evdev = evdev_alloc(); + evdev_set_name(evdev, device_get_desc(dev)); + evdev_set_phys(evdev, device_get_nameunit(dev)); + evdev_set_id(evdev, BUS_USB, uaa->info.idVendor, + uaa->info.idProduct, 0); + evdev_set_serial(evdev, usb_get_serial(uaa->device)); + evdev_set_methods(evdev, kbd, &ukbd_evdev_methods); + evdev_support_event(evdev, EV_SYN); + evdev_support_event(evdev, EV_KEY); + if (sc->sc_flags & (UKBD_FLAG_NUMLOCK | UKBD_FLAG_CAPSLOCK | + UKBD_FLAG_SCROLLLOCK)) + evdev_support_event(evdev, EV_LED); + evdev_support_event(evdev, EV_REP); + + for (i = 0x00; i <= 0xFF; i++) + evdev_support_key(evdev, evdev_hid2key(i)); + if (sc->sc_flags & UKBD_FLAG_NUMLOCK) + evdev_support_led(evdev, LED_NUML); + if (sc->sc_flags & UKBD_FLAG_CAPSLOCK) + evdev_support_led(evdev, LED_CAPSL); + if (sc->sc_flags & UKBD_FLAG_SCROLLLOCK) + evdev_support_led(evdev, LED_SCROLLL); + + if (evdev_register(evdev)) + evdev_free(evdev); + else + sc->sc_evdev = evdev; +#endif + sc->sc_flags |= UKBD_FLAG_ATTACHED; if (bootverbose) { @@ -1377,6 +1440,11 @@ ukbd_detach(device_t dev) } } #endif + +#ifdef EVDEV + evdev_free(sc->sc_evdev); +#endif + if (KBD_IS_CONFIGURED(&sc->sc_kbd)) { error = kbd_unregister(&sc->sc_kbd); if (error) { @@ -1908,6 +1976,10 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_lon else kbd->kb_delay1 = ((int *)arg)[0]; kbd->kb_delay2 = ((int *)arg)[1]; +#ifdef EVDEV + if (sc->sc_evdev != NULL) + evdev_push_repeats(sc->sc_evdev, kbd); +#endif return (0); #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ @@ -2056,6 +2128,9 @@ ukbd_set_leds(struct ukbd_softc *sc, uin static int ukbd_set_typematic(keyboard_t *kbd, int code) { +#ifdef EVDEV + struct ukbd_softc *sc = kbd->kb_data; +#endif static const int delays[] = {250, 500, 750, 1000}; static const int rates[] = {34, 38, 42, 46, 50, 55, 59, 63, 68, 76, 84, 92, 100, 110, 118, 126, @@ -2067,6 +2142,10 @@ ukbd_set_typematic(keyboard_t *kbd, int } kbd->kb_delay1 = delays[(code >> 5) & 3]; kbd->kb_delay2 = rates[code & 0x1f]; +#ifdef EVDEV + if (sc->sc_evdev != NULL) + evdev_push_repeats(sc->sc_evdev, kbd); +#endif return (0); } Modified: stable/11/sys/modules/usb/ukbd/Makefile ============================================================================== --- stable/11/sys/modules/usb/ukbd/Makefile Sat Oct 22 02:11:53 2016 (r307763) +++ stable/11/sys/modules/usb/ukbd/Makefile Sat Oct 22 02:15:39 2016 (r307764) @@ -30,7 +30,7 @@ S= ${.CURDIR}/../../.. .PATH: $S/dev/usb/input KMOD= ukbd -SRCS= opt_bus.h opt_compat.h opt_kbd.h opt_ukbd.h opt_usb.h \ +SRCS= opt_bus.h opt_compat.h opt_evdev.h opt_kbd.h opt_ukbd.h opt_usb.h \ device_if.h bus_if.h usb_if.h usbdevs.h \ ukbd.c From owner-svn-src-all@freebsd.org Sat Oct 22 02:26:34 2016 Return-Path: Delivered-To: svn-src-all@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 AADFFC1B463; Sat, 22 Oct 2016 02:26:34 +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 6DE3820F; Sat, 22 Oct 2016 02:26:34 +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 u9M2QXIq091875; Sat, 22 Oct 2016 02:26:33 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M2QXCX091872; Sat, 22 Oct 2016 02:26:33 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610220226.u9M2QXCX091872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 02:26: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: r307765 - in stable/11/sys: dev/usb/input modules/usb/ums X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 02:26:34 -0000 Author: gonzo Date: Sat Oct 22 02:26:33 2016 New Revision: 307765 URL: https://svnweb.freebsd.org/changeset/base/307765 Log: MFC r306134: Add evdev support to ums(4) event generation is disabled by default in favour of sysmouse. This behavoiur is controlled by kern.evdev.rcpt_mask sysctl, bit 2 should be set to give priority to hw over sysmouse Submitted by: Vladimir Kondratiev Reviewed by: hans Differential Revision: https://reviews.freebsd.org/D7863 Modified: stable/11/sys/dev/usb/input/ums.c stable/11/sys/modules/usb/ums/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/ums.c ============================================================================== --- stable/11/sys/dev/usb/input/ums.c Sat Oct 22 02:15:39 2016 (r307764) +++ stable/11/sys/dev/usb/input/ums.c Sat Oct 22 02:26:33 2016 (r307765) @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf */ +#include "opt_evdev.h" + #include #include #include @@ -68,6 +70,11 @@ __FBSDID("$FreeBSD$"); #include +#ifdef EVDEV +#include +#include +#endif + #include #include #include @@ -135,10 +142,18 @@ struct ums_softc { int sc_pollrate; int sc_fflags; +#ifdef EVDEV + int sc_evflags; +#define UMS_EVDEV_OPENED 1 +#endif uint8_t sc_buttons; uint8_t sc_iid; uint8_t sc_temp[64]; + +#ifdef EVDEV + struct evdev_dev *sc_evdev; +#endif }; static void ums_put_queue_timeout(void *__sc); @@ -149,25 +164,39 @@ static device_probe_t ums_probe; static device_attach_t ums_attach; static device_detach_t ums_detach; -static usb_fifo_cmd_t ums_start_read; -static usb_fifo_cmd_t ums_stop_read; -static usb_fifo_open_t ums_open; -static usb_fifo_close_t ums_close; -static usb_fifo_ioctl_t ums_ioctl; +static usb_fifo_cmd_t ums_fifo_start_read; +static usb_fifo_cmd_t ums_fifo_stop_read; +static usb_fifo_open_t ums_fifo_open; +static usb_fifo_close_t ums_fifo_close; +static usb_fifo_ioctl_t ums_fifo_ioctl; + +#ifdef EVDEV +static evdev_open_t ums_ev_open; +static evdev_close_t ums_ev_close; +#endif +static void ums_start_rx(struct ums_softc *); +static void ums_stop_rx(struct ums_softc *); static void ums_put_queue(struct ums_softc *, int32_t, int32_t, int32_t, int32_t, int32_t); static int ums_sysctl_handler_parseinfo(SYSCTL_HANDLER_ARGS); static struct usb_fifo_methods ums_fifo_methods = { - .f_open = &ums_open, - .f_close = &ums_close, - .f_ioctl = &ums_ioctl, - .f_start_read = &ums_start_read, - .f_stop_read = &ums_stop_read, + .f_open = &ums_fifo_open, + .f_close = &ums_fifo_close, + .f_ioctl = &ums_fifo_ioctl, + .f_start_read = &ums_fifo_start_read, + .f_stop_read = &ums_fifo_stop_read, .basename[0] = "ums", }; +#ifdef EVDEV +static struct evdev_methods ums_evdev_methods = { + .ev_open = &ums_ev_open, + .ev_close = &ums_ev_close, +}; +#endif + static void ums_put_queue_timeout(void *__sc) { @@ -327,11 +356,17 @@ ums_intr_callback(struct usb_xfer *xfer, case USB_ST_SETUP: tr_setup: /* check if we can put more data into the FIFO */ - if (usb_fifo_put_bytes_max( - sc->sc_fifo.fp[USB_FIFO_RX]) != 0) { - usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); - usbd_transfer_submit(xfer); + if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) == 0) { +#ifdef EVDEV + if (sc->sc_evflags == 0) + break; +#else + break; +#endif } + + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); break; default: /* Error */ @@ -655,6 +690,41 @@ ums_attach(device_t dev) if (err) goto detach; +#ifdef EVDEV + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, device_get_desc(dev)); + evdev_set_phys(sc->sc_evdev, device_get_nameunit(dev)); + evdev_set_id(sc->sc_evdev, BUS_USB, uaa->info.idVendor, + uaa->info.idProduct, 0); + evdev_set_serial(sc->sc_evdev, usb_get_serial(uaa->device)); + evdev_set_methods(sc->sc_evdev, sc, &ums_evdev_methods); + evdev_support_prop(sc->sc_evdev, INPUT_PROP_POINTER); + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_REL); + evdev_support_event(sc->sc_evdev, EV_KEY); + + info = &sc->sc_info[0]; + + if (info->sc_flags & UMS_FLAG_X_AXIS) + evdev_support_rel(sc->sc_evdev, REL_X); + + if (info->sc_flags & UMS_FLAG_Y_AXIS) + evdev_support_rel(sc->sc_evdev, REL_Y); + + if (info->sc_flags & UMS_FLAG_Z_AXIS) + evdev_support_rel(sc->sc_evdev, REL_WHEEL); + + if (info->sc_flags & UMS_FLAG_T_AXIS) + evdev_support_rel(sc->sc_evdev, REL_HWHEEL); + + for (i = 0; i < info->sc_buttons; i++) + evdev_support_key(sc->sc_evdev, BTN_MOUSE + i); + + err = evdev_register(sc->sc_evdev); + if (err) + goto detach; +#endif + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "parseinfo", CTLTYPE_STRING|CTLFLAG_RD, @@ -680,6 +750,10 @@ ums_detach(device_t self) usb_fifo_detach(&sc->sc_fifo); +#ifdef EVDEV + evdev_free(sc->sc_evdev); +#endif + usbd_transfer_unsetup(sc->sc_xfer, UMS_N_TRANSFER); usb_callout_drain(&sc->sc_callout); @@ -690,9 +764,44 @@ ums_detach(device_t self) } static void -ums_start_read(struct usb_fifo *fifo) +ums_reset(struct ums_softc *sc) +{ + + /* reset all USB mouse parameters */ + + if (sc->sc_buttons > MOUSE_MSC_MAXBUTTON) + sc->sc_hw.buttons = MOUSE_MSC_MAXBUTTON; + else + sc->sc_hw.buttons = sc->sc_buttons; + + sc->sc_hw.iftype = MOUSE_IF_USB; + sc->sc_hw.type = MOUSE_MOUSE; + sc->sc_hw.model = MOUSE_MODEL_GENERIC; + sc->sc_hw.hwid = 0; + + sc->sc_mode.protocol = MOUSE_PROTO_MSC; + sc->sc_mode.rate = -1; + sc->sc_mode.resolution = MOUSE_RES_UNKNOWN; + sc->sc_mode.accelfactor = 0; + sc->sc_mode.level = 0; + sc->sc_mode.packetsize = MOUSE_MSC_PACKETSIZE; + sc->sc_mode.syncmask[0] = MOUSE_MSC_SYNCMASK; + sc->sc_mode.syncmask[1] = MOUSE_MSC_SYNC; + + /* reset status */ + + sc->sc_status.flags = 0; + sc->sc_status.button = 0; + sc->sc_status.obutton = 0; + sc->sc_status.dx = 0; + sc->sc_status.dy = 0; + sc->sc_status.dz = 0; + /* sc->sc_status.dt = 0; */ +} + +static void +ums_start_rx(struct ums_softc *sc) { - struct ums_softc *sc = usb_fifo_softc(fifo); int rate; /* Check if we should override the default polling interval */ @@ -715,14 +824,28 @@ ums_start_read(struct usb_fifo *fifo) } static void -ums_stop_read(struct usb_fifo *fifo) +ums_stop_rx(struct ums_softc *sc) { - struct ums_softc *sc = usb_fifo_softc(fifo); - usbd_transfer_stop(sc->sc_xfer[UMS_INTR_DT]); usb_callout_stop(&sc->sc_callout); } +static void +ums_fifo_start_read(struct usb_fifo *fifo) +{ + struct ums_softc *sc = usb_fifo_softc(fifo); + + ums_start_rx(sc); +} + +static void +ums_fifo_stop_read(struct usb_fifo *fifo) +{ + struct ums_softc *sc = usb_fifo_softc(fifo); + + ums_stop_rx(sc); +} + #if ((MOUSE_SYS_PACKETSIZE != 8) || \ (MOUSE_MSC_PACKETSIZE != 5)) @@ -769,6 +892,21 @@ ums_put_queue(struct ums_softc *sc, int3 usb_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf, sc->sc_mode.packetsize, 1); +#ifdef EVDEV + if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { + /* Push evdev event */ + evdev_push_event(sc->sc_evdev, EV_REL, REL_X, dx); + evdev_push_event(sc->sc_evdev, EV_REL, REL_Y, -dy); + evdev_push_event(sc->sc_evdev, EV_REL, REL_WHEEL, -dz); + evdev_push_event(sc->sc_evdev, EV_REL, REL_HWHEEL, dt); + evdev_push_mouse_btn(sc->sc_evdev, + (buttons & ~MOUSE_STDBUTTONS) | + (buttons & (1 << 2) ? MOUSE_BUTTON1DOWN : 0) | + (buttons & (1 << 1) ? MOUSE_BUTTON2DOWN : 0) | + (buttons & (1 << 0) ? MOUSE_BUTTON3DOWN : 0)); + evdev_sync(sc->sc_evdev); + } +#endif } else { DPRINTF("Buffer full, discarded packet\n"); } @@ -781,8 +919,44 @@ ums_reset_buf(struct ums_softc *sc) usb_fifo_reset(sc->sc_fifo.fp[USB_FIFO_RX]); } +#ifdef EVDEV +static int +ums_ev_open(struct evdev_dev *evdev, void *ev_softc) +{ + struct ums_softc *sc = (struct ums_softc *)ev_softc; + + mtx_lock(&sc->sc_mtx); + + sc->sc_evflags = UMS_EVDEV_OPENED; + + if (sc->sc_fflags == 0) { + ums_reset(sc); + ums_start_rx(sc); + } + + mtx_unlock(&sc->sc_mtx); + + return (0); +} + +static void +ums_ev_close(struct evdev_dev *evdev, void *ev_softc) +{ + struct ums_softc *sc = (struct ums_softc *)ev_softc; + + mtx_lock(&sc->sc_mtx); + + sc->sc_evflags = 0; + + if (sc->sc_fflags == 0) + ums_stop_rx(sc); + + mtx_unlock(&sc->sc_mtx); +} +#endif + static int -ums_open(struct usb_fifo *fifo, int fflags) +ums_fifo_open(struct usb_fifo *fifo, int fflags) { struct ums_softc *sc = usb_fifo_softc(fifo); @@ -793,39 +967,13 @@ ums_open(struct usb_fifo *fifo, int ffla return (EBUSY); /* check for first open */ - if (sc->sc_fflags == 0) { - - /* reset all USB mouse parameters */ - - if (sc->sc_buttons > MOUSE_MSC_MAXBUTTON) - sc->sc_hw.buttons = MOUSE_MSC_MAXBUTTON; - else - sc->sc_hw.buttons = sc->sc_buttons; - - sc->sc_hw.iftype = MOUSE_IF_USB; - sc->sc_hw.type = MOUSE_MOUSE; - sc->sc_hw.model = MOUSE_MODEL_GENERIC; - sc->sc_hw.hwid = 0; - - sc->sc_mode.protocol = MOUSE_PROTO_MSC; - sc->sc_mode.rate = -1; - sc->sc_mode.resolution = MOUSE_RES_UNKNOWN; - sc->sc_mode.accelfactor = 0; - sc->sc_mode.level = 0; - sc->sc_mode.packetsize = MOUSE_MSC_PACKETSIZE; - sc->sc_mode.syncmask[0] = MOUSE_MSC_SYNCMASK; - sc->sc_mode.syncmask[1] = MOUSE_MSC_SYNC; - - /* reset status */ - - sc->sc_status.flags = 0; - sc->sc_status.button = 0; - sc->sc_status.obutton = 0; - sc->sc_status.dx = 0; - sc->sc_status.dy = 0; - sc->sc_status.dz = 0; - /* sc->sc_status.dt = 0; */ - } +#ifdef EVDEV + if (sc->sc_fflags == 0 && sc->sc_evflags == 0) + ums_reset(sc); +#else + if (sc->sc_fflags == 0) + ums_reset(sc); +#endif if (fflags & FREAD) { /* allocate RX buffer */ @@ -840,7 +988,7 @@ ums_open(struct usb_fifo *fifo, int ffla } static void -ums_close(struct usb_fifo *fifo, int fflags) +ums_fifo_close(struct usb_fifo *fifo, int fflags) { struct ums_softc *sc = usb_fifo_softc(fifo); @@ -853,7 +1001,7 @@ ums_close(struct usb_fifo *fifo, int ffl } static int -ums_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) +ums_fifo_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) { struct ums_softc *sc = usb_fifo_softc(fifo); mousemode_t mode; Modified: stable/11/sys/modules/usb/ums/Makefile ============================================================================== --- stable/11/sys/modules/usb/ums/Makefile Sat Oct 22 02:15:39 2016 (r307764) +++ stable/11/sys/modules/usb/ums/Makefile Sat Oct 22 02:26:33 2016 (r307765) @@ -30,7 +30,7 @@ S= ${.CURDIR}/../../.. .PATH: $S/dev/usb/input KMOD= ums -SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h vnode_if.h usbdevs.h \ - ums.c +SRCS= opt_bus.h opt_evdev.h opt_usb.h device_if.h bus_if.h usb_if.h \ + vnode_if.h usbdevs.h ums.c .include From owner-svn-src-all@freebsd.org Sat Oct 22 02:31:50 2016 Return-Path: Delivered-To: svn-src-all@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 DE920C1B726; Sat, 22 Oct 2016 02:31:50 +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 ADAF1842; Sat, 22 Oct 2016 02:31:50 +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 u9M2VnVd093497; Sat, 22 Oct 2016 02:31:49 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M2Vn03093496; Sat, 22 Oct 2016 02:31:49 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610220231.u9M2Vn03093496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 02:31: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: r307766 - stable/11/sys/dev/evdev X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 02:31:51 -0000 Author: gonzo Date: Sat Oct 22 02:31:49 2016 New Revision: 307766 URL: https://svnweb.freebsd.org/changeset/base/307766 Log: MFC r306578: Fix gcc compilation error input_absinfo.code is unsigned so condition is always false Modified: stable/11/sys/dev/evdev/uinput.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/uinput.c ============================================================================== --- stable/11/sys/dev/evdev/uinput.c Sat Oct 22 02:26:33 2016 (r307765) +++ stable/11/sys/dev/evdev/uinput.c Sat Oct 22 02:31:49 2016 (r307766) @@ -527,7 +527,7 @@ uinput_ioctl_sub(struct uinput_cdev_stat return (EINVAL); uabs = (struct uinput_abs_setup *)data; - if (uabs->code > ABS_MAX || uabs->code < 0) + if (uabs->code > ABS_MAX) return (EINVAL); evdev_support_abs(state->ucs_evdev, uabs->code, From owner-svn-src-all@freebsd.org Sat Oct 22 02:38:00 2016 Return-Path: Delivered-To: svn-src-all@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 8F973C1B8D7; Sat, 22 Oct 2016 02:38:00 +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 69DA6B8B; Sat, 22 Oct 2016 02:38:00 +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 u9M2bxZm095795; Sat, 22 Oct 2016 02:37:59 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M2bxfL095791; Sat, 22 Oct 2016 02:37:59 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610220237.u9M2bxfL095791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 02:37: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: r307767 - in stable/11/sys: arm/broadcom/bcm2835 boot/fdt/dts/arm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 02:38:00 -0000 Author: gonzo Date: Sat Oct 22 02:37:59 2016 New Revision: 307767 URL: https://svnweb.freebsd.org/changeset/base/307767 Log: MFC r306430 Add touchscreen support for the official 7" RPi touch display Technically touchscreen chip is FT5406 but all hardware communication is performed by VideCore and only final results are presented to ARM part through memory region shared between VC and ARM. evdev is used as userland interface. FT5406 supports up to 10 touchpoints, but for now driver emulates single touch device because I do not have GUI bits to test this functionality. Driver is not enabled in default config for RPI and RPI2 Tested with: evdev-dump, tslib Added: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c - copied unchanged from r306430, head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Modified: stable/11/sys/arm/broadcom/bcm2835/files.bcm283x stable/11/sys/boot/fdt/dts/arm/rpi.dts stable/11/sys/boot/fdt/dts/arm/rpi2.dts Directory Properties: stable/11/ (props changed) Copied: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c (from r306430, head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Sat Oct 22 02:37:59 2016 (r307767, copy of r306430, head/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c) @@ -0,0 +1,337 @@ +/*- + * 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "mbox_if.h" + +#ifdef DEBUG +#define DPRINTF(fmt, ...) do { \ + printf("%s:%u: ", __func__, __LINE__); \ + printf(fmt, ##__VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(fmt, ...) +#endif + +#define FT5406_LOCK(_sc) \ + mtx_lock(&(_sc)->sc_mtx) +#define FT5406_UNLOCK(_sc) \ + mtx_unlock(&(_sc)->sc_mtx) +#define FT5406_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \ + "ft5406", MTX_DEF) +#define FT5406_LOCK_DESTROY(_sc) \ + mtx_destroy(&_sc->sc_mtx); +#define FT5406_LOCK_ASSERT(_sc) \ + mtx_assert(&(_sc)->sc_mtx, MA_OWNED) + +#define FT5406_DEVICE_MODE 0 +#define FT5406_GESTURE_ID 1 +#define FT5406_NUM_POINTS 2 +#define FT5406_POINT_XH(n) (0 + 3 + (n)*6) +#define FT5406_POINT_XL(n) (1 + 3 + (n)*6) +#define FT5406_POINT_YH(n) (2 + 3 + (n)*6) +#define FT5406_POINT_YL(n) (3 + 3 + (n)*6) +#define FT5406_WINDOW_SIZE 64 + +#define GET_NUM_POINTS(buf) (buf[FT5406_NUM_POINTS]) +#define GET_X(buf, n) (((buf[FT5406_POINT_XH(n)] & 0xf) << 8) | \ + (buf[FT5406_POINT_XL(n)])) +#define GET_Y(buf, n) (((buf[FT5406_POINT_YH(n)] & 0xf) << 8) | \ + (buf[FT5406_POINT_YL(n)])) +#define GET_TOUCH_ID(buf, n) ((buf[FT5406_POINT_YH(n)] >> 4) & 0xf) + +#define NO_POINTS 99 +#define SCREEN_WIDTH 800 +#define SCREEN_HEIGHT 480 + +struct ft5406ts_softc { + device_t sc_dev; + struct mtx sc_mtx; + struct proc *sc_worker; + + /* mbox buffer (mapped to KVA) */ + uint8_t *touch_buf; + + /* initial hook for waiting mbox intr */ + struct intr_config_hook sc_init_hook; + + struct evdev_dev *sc_evdev; + int sc_detaching; +}; + +static void +ft5406ts_worker(void *data) +{ + struct ft5406ts_softc *sc = (struct ft5406ts_softc *)data; + int points; + int id, new_x, new_y, i, new_pen_down, updated; + int x, y, pen_down; + uint8_t window[FT5406_WINDOW_SIZE]; + int tick; + + /* 60Hz */ + tick = hz*17/1000; + if (tick == 0) + tick = 1; + + x = y = -1; + pen_down = 0; + + FT5406_LOCK(sc); + while(1) { + msleep(sc, &sc->sc_mtx, PCATCH | PZERO, "ft5406ts", tick); + + if (sc->sc_detaching) + break; + + memcpy(window, sc->touch_buf, sizeof(window)); + sc->touch_buf[FT5406_NUM_POINTS] = NO_POINTS; + + points = GET_NUM_POINTS(window); + /* + * No update from VC - do nothing + */ + if (points == NO_POINTS) + continue; + + /* No points and pen is already up */ + if ((points == 0) && !pen_down) + continue; + + new_pen_down = 0; + for (i = 0; i < points; i++) { + id = GET_TOUCH_ID(window, 0); + /* For now consider only touch 0 */ + if (id != 0) + continue; + new_pen_down = 1; + new_x = GET_X(window, 0); + new_y = GET_Y(window, 0); + } + + updated = 0; + + if (new_x != x) { + x = new_x; + updated = 1; + } + + if (new_y != y) { + y = new_y; + updated = 1; + } + + if (new_pen_down != pen_down) { + pen_down = new_pen_down; + updated = 1; + } + + if (updated) { + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_X, x); + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_Y, y); + evdev_push_event(sc->sc_evdev, EV_KEY, BTN_TOUCH, pen_down); + evdev_sync(sc->sc_evdev); + } + } + FT5406_UNLOCK(sc); + + kproc_exit(0); +} + +static void +ft5406ts_init(void *arg) +{ + struct ft5406ts_softc *sc = arg; + struct bcm2835_mbox_tag_touchbuf msg; + uint32_t touchbuf; + int err; + + /* release this hook (continue boot) */ + config_intrhook_disestablish(&sc->sc_init_hook); + + memset(&msg, 0, sizeof(msg)); + msg.hdr.buf_size = sizeof(msg); + msg.hdr.code = BCM2835_MBOX_CODE_REQ; + msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_TOUCHBUF; + msg.tag_hdr.val_buf_size = sizeof(msg.body); + msg.tag_hdr.val_len = sizeof(msg.body); + msg.end_tag = 0; + + /* call mailbox property */ + err = bcm2835_mbox_property(&msg, sizeof(msg)); + if (err) { + device_printf(sc->sc_dev, "failed to get touchbuf address\n"); + return; + } + + if (msg.body.resp.address == 0) { + device_printf(sc->sc_dev, "touchscreen not detected\n"); + return; + } + + touchbuf = VCBUS_TO_PHYS(msg.body.resp.address); + sc->touch_buf = (uint8_t*)pmap_mapdev(touchbuf, FT5406_WINDOW_SIZE); + + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, device_get_desc(sc->sc_dev)); + evdev_set_phys(sc->sc_evdev, device_get_nameunit(sc->sc_dev)); + evdev_set_id(sc->sc_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_prop(sc->sc_evdev, INPUT_PROP_DIRECT); + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_ABS); + evdev_support_event(sc->sc_evdev, EV_KEY); + + evdev_support_abs(sc->sc_evdev, ABS_X, 0, 0, + SCREEN_WIDTH, 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_Y, 0, 0, + SCREEN_HEIGHT, 0, 0, 0); + + evdev_support_key(sc->sc_evdev, BTN_TOUCH); + + err = evdev_register(sc->sc_evdev); + if (err) { + evdev_free(sc->sc_evdev); + return; + } + + sc->touch_buf[FT5406_NUM_POINTS] = NO_POINTS; + if (kproc_create(ft5406ts_worker, (void*)sc, &sc->sc_worker, 0, 0, + "ft5406ts_worker") != 0) { + printf("failed to create ft5406ts_worker\n"); + } +} + +static int +ft5406ts_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "rpi,rpi-ft5406")) + return (ENXIO); + + device_set_desc(dev, "FT5406 touchscreen (VC memory interface)"); + + return (BUS_PROBE_DEFAULT); +} + +static int +ft5406ts_attach(device_t dev) +{ + struct ft5406ts_softc *sc; + + /* set self dev */ + sc = device_get_softc(dev); + sc->sc_dev = dev; + + /* register callback for using mbox when interrupts are enabled */ + sc->sc_init_hook.ich_func = ft5406ts_init; + sc->sc_init_hook.ich_arg = sc; + + if (config_intrhook_establish(&sc->sc_init_hook) != 0) { + device_printf(dev, "config_intrhook_establish failed\n"); + return (ENOMEM); + } + + FT5406_LOCK_INIT(sc); + + return (0); +} + +static int +ft5406ts_detach(device_t dev) +{ + struct ft5406ts_softc *sc; + + sc = device_get_softc(dev); + + FT5406_LOCK(sc); + if (sc->sc_worker) + sc->sc_detaching = 1; + + if (sc->sc_evdev) + evdev_free(sc->sc_evdev); + FT5406_UNLOCK(sc); + + FT5406_LOCK_DESTROY(sc); + + return (0); +} + +static device_method_t ft5406ts_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ft5406ts_probe), + DEVMETHOD(device_attach, ft5406ts_attach), + DEVMETHOD(device_detach, ft5406ts_detach), + + DEVMETHOD_END +}; + +static devclass_t ft5406ts_devclass; +static driver_t ft5406ts_driver = { + "ft5406ts", + ft5406ts_methods, + sizeof(struct ft5406ts_softc), +}; + +DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0); Modified: stable/11/sys/arm/broadcom/bcm2835/files.bcm283x ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/files.bcm283x Sat Oct 22 02:31:49 2016 (r307766) +++ stable/11/sys/arm/broadcom/bcm2835/files.bcm283x Sat Oct 22 02:37:59 2016 (r307767) @@ -6,6 +6,7 @@ arm/broadcom/bcm2835/bcm2835_cpufreq.c arm/broadcom/bcm2835/bcm2835_dma.c standard arm/broadcom/bcm2835/bcm2835_fb.c optional sc arm/broadcom/bcm2835/bcm2835_fbd.c optional vt +arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio arm/broadcom/bcm2835/bcm2835_intr.c standard arm/broadcom/bcm2835/bcm2835_machdep.c standard Modified: stable/11/sys/boot/fdt/dts/arm/rpi.dts ============================================================================== --- stable/11/sys/boot/fdt/dts/arm/rpi.dts Sat Oct 22 02:31:49 2016 (r307766) +++ stable/11/sys/boot/fdt/dts/arm/rpi.dts Sat Oct 22 02:37:59 2016 (r307767) @@ -322,6 +322,11 @@ broadcom,depth = <0>; /* Set by VideoCore */ }; + rpi_ft5406 { + compatible = "rpi,rpi-ft5406"; + status = "okay"; + }; + leds { compatible = "gpio-leds"; Modified: stable/11/sys/boot/fdt/dts/arm/rpi2.dts ============================================================================== --- stable/11/sys/boot/fdt/dts/arm/rpi2.dts Sat Oct 22 02:31:49 2016 (r307766) +++ stable/11/sys/boot/fdt/dts/arm/rpi2.dts Sat Oct 22 02:37:59 2016 (r307767) @@ -337,6 +337,11 @@ broadcom,depth = <0>; /* Set by VideoCore */ }; + rpi_ft5406 { + compatible = "rpi,rpi-ft5406"; + status = "okay"; + }; + leds { compatible = "gpio-leds"; From owner-svn-src-all@freebsd.org Sat Oct 22 08:00:48 2016 Return-Path: Delivered-To: svn-src-all@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 6B496C1CE2B; Sat, 22 Oct 2016 08:00:48 +0000 (UTC) (envelope-from avg@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 4533AF2E; Sat, 22 Oct 2016 08:00:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9M80lJB017293; Sat, 22 Oct 2016 08:00:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9M80knZ017287; Sat, 22 Oct 2016 08:00:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201610220800.u9M80knZ017287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 22 Oct 2016 08:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307768 - in head: share/man/man4 sys/conf sys/dev/jedec_ts sys/modules/i2c sys/modules/i2c/jedec_ts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 08:00:48 -0000 Author: avg Date: Sat Oct 22 08:00:46 2016 New Revision: 307768 URL: https://svnweb.freebsd.org/changeset/base/307768 Log: jedec_ts: a driver for thermal sensors on memory modules The driver currently supports chips that are fully compliant with the JEDEC SPD / EEPROM / TS standard (JEDEC Standard 21-C, TSE2002 Specification, frequenlty referred to as JEDEC JC 42.4). Additionally some chips from STMicroelectronics are supported as well. They are compliant except for their Device ID pattern. Given the continued lack of any common sensor infrastructure, the driver uses an ad-hoc sysctl to report the temperature. Reviewed by: wblock (documentation) MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D8174 Added: head/share/man/man4/jedec_ts.4 (contents, props changed) head/sys/dev/jedec_ts/ head/sys/dev/jedec_ts/jedec_ts.c (contents, props changed) head/sys/modules/i2c/jedec_ts/ head/sys/modules/i2c/jedec_ts/Makefile (contents, props changed) Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/modules/i2c/Makefile Added: head/share/man/man4/jedec_ts.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/jedec_ts.4 Sat Oct 22 08:00:46 2016 (r307768) @@ -0,0 +1,130 @@ +.\" +.\" Copyright (c) 2016 Andriy Gapon +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 13, 2016 +.Dt JEDEC_TS 4 +.Os +.Sh NAME +.Nm jedec_ts +.Nd driver for temperature sensors on memory modules +.Sh SYNOPSIS +.Bd -ragged -offset indent +.Cd "device jedec_ts" +.Cd "device smbus" +.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 +jedec_ts_load="YES" +.Ed +.Pp +In +.Pa /boot/device.hints : +.Bd -literal -offset indent +.Cd hint.jedec_ts.0.at="smbus0" +.Cd hint.jedec_ts.0.addr="0x30" +.Cd hint.jedec_ts.1.at="smbus0" +.Cd hint.jedec_ts.1.addr="0x32" +.Cd hint.jedec_ts.2.at="smbus0" +.Cd hint.jedec_ts.2.addr="0x34" +.Cd hint.jedec_ts.3.at="smbus0" +.Cd hint.jedec_ts.3.addr="0x36" +.Cd hint.jedec_ts.4.at="smbus0" +.Cd hint.jedec_ts.4.addr="0x38" +.Cd hint.jedec_ts.5.at="smbus0" +.Cd hint.jedec_ts.5.addr="0x3A" +.Cd hint.jedec_ts.6.at="smbus0" +.Cd hint.jedec_ts.6.addr="0x3C" +.Cd hint.jedec_ts.7.at="smbus0" +.Cd hint.jedec_ts.7.addr="0x3E" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides access to sensor data over the +.Xr smbus 4 . +The driver supports temperature sensors on memory modules that conform +to JEDEC Standard 21-C, TSE2002 Specification. +.Pp +The access to +.Nm +data is made via the +.Xr sysctl 8 +interface: +.Bl -tag -width "dev.jedec_ts.%d.temp" +.It Va dev.jedec_ts.%d.temp +read-only value of the current temperature read by the sensor. +.El +.Pp +On a system using +.Xr device.hints 5 , +these values are configurable for +.Nm : +.Bl -tag -width "hint.jedec_ts.%d.addr" +.It Va hint.jedec_ts.%d.at +target +.Xr smbus 4 . +.It Va hint.jedec_ts.%d.addr +.Nm +SMBus address on the +.Xr smbus 4 . +.El +.Pp +.Nm +temperature sensors can be wired to eight different addresses, +allowing up to eight sensors on the same +.Xr smbus 4 . +.Pp +If the sensors are on an I2C bus behind an +.Xr iicbus 4 +controller, then the +.Xr iicsmb 4 +bridge driver can be used to attach the +.Xr smbus 4 . +.Sh EXAMPLES +.Ss Sensor read out for two memory modules: +.Bd -literal +dev.jedec_ts.0.temp: 40.2500C +dev.jedec_ts.1.temp: 40.7500C +.Ed +.Sh SEE ALSO +.Xr iicbus 4 , +.Xr iicsmb 4 , +.Xr smbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Oct 22 02:37:59 2016 (r307767) +++ head/sys/conf/NOTES Sat Oct 22 08:00:46 2016 (r307768) @@ -2527,7 +2527,12 @@ device ismt device smb +# SMBus peripheral devices # +# jedec_ts Temperature Sensor compliant with JEDEC Standard 21-C +# +device jedec_ts + # I2C Bus # # Philips i2c bus support is provided by the `iicbus' device. Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Oct 22 02:37:59 2016 (r307767) +++ head/sys/conf/files Sat Oct 22 08:00:46 2016 (r307768) @@ -2062,6 +2062,7 @@ dev/ixgbe/ixgbe_dcb_82598.c optional ix compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_dcb_82599.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/jedec_ts/jedec_ts.c optional jedec_ts smbus dev/jme/if_jme.c optional jme pci dev/joy/joy.c optional joy dev/joy/joy_isa.c optional joy isa Added: head/sys/dev/jedec_ts/jedec_ts.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/jedec_ts/jedec_ts.c Sat Oct 22 08:00:46 2016 (r307768) @@ -0,0 +1,179 @@ +/*- + * Copyright (c) 2016 Andriy Gapon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "smbus_if.h" + + +/* + * SMBus specification defines little-endian byte order, + * but it seems that the JEDEC devices expect it to + * be big-endian. + */ +static int +ts_readw_be(device_t dev, uint8_t reg, uint16_t *val) +{ + device_t bus = device_get_parent(dev); + uint8_t addr = smbus_get_addr(dev); + int err; + + err = smbus_readw(bus, addr, reg, val); + if (err != 0) + return (err); + *val = be16toh(*val); + return (0); +} + +static int +ts_temp_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev = arg1; + int err; + int temp; + uint16_t val; + + err = ts_readw_be(dev, 5, &val); + if (err != 0) + return (EIO); + + /* + * Convert the reading to temperature in 0.0001 Kelvins. + * Three most significant bits are flags, the next + * most significant bit is a sign bit. + * Each step is 0.0625 degrees. + */ + temp = val & 0xfff; + if ((val & 0x1000) != 0) + temp = -temp; + temp = temp * 625 + 2731500; + err = sysctl_handle_int(oidp, &temp, 0, req); + return (err); +} + +static int +ts_probe(device_t dev) +{ + device_set_desc(dev, "DIMM memory sensor"); + return (BUS_PROBE_DEFAULT); +} + +static int +ts_attach(device_t dev) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *tree; + int err; + uint16_t vendorid; + uint16_t devid; + uint8_t addr; + + addr = smbus_get_addr(dev); + if ((addr & 0x30) != 0x30) { + /* Up to 8 slave devices starting at 0x30. */ + return (ENXIO); + } + + err = ts_readw_be(dev, 6, &vendorid); + if (err != 0) { + device_printf(dev, "failed to read Manufacturer ID\n"); + return (ENXIO); + } + err = ts_readw_be(dev, 6, &devid); + if (err != 0) { + device_printf(dev, "failed to read Device ID\n"); + return (ENXIO); + } + if ((devid & 0xff00) == 0x2200) { + /* + * Defined by JEDEC Standard No. 21-C, Release 26, + * Page 4.1.6 – 24 + */ + } else if (vendorid == 0x104a) { + /* + * STMicroelectronics datasheets say that + * device ID and revision can vary. + * E.g. STT424E02, Doc ID 13448 Rev 8, + * section 4.6, page 26. + */ + } else { + if (bootverbose) { + device_printf(dev, "Unknown Manufacturer and Device IDs" + ", 0x%x and 0x%x\n", vendorid, devid); + } + return (ENXIO); + } + + ctx = device_get_sysctl_ctx(dev); + tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "temp", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0, + ts_temp_sysctl, "IK4", "Current temperature"); + + return (0); +} + +static int +ts_detach(device_t dev) +{ + return (0); +} + + +static device_method_t jedec_ts_methods[] = { + /* Methods from the device interface */ + DEVMETHOD(device_probe, ts_probe), + DEVMETHOD(device_attach, ts_attach), + DEVMETHOD(device_detach, ts_detach), + + /* Terminate method list */ + { 0, 0 } +}; + +static driver_t jedec_ts_driver = { + "jedec_ts", + jedec_ts_methods, + 0 /* no softc */ +}; + +static devclass_t jedec_ts_devclass; + +DRIVER_MODULE(jedec_ts, smbus, jedec_ts_driver, jedec_ts_devclass, 0, 0); +MODULE_DEPEND(jedec_ts, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); +MODULE_VERSION(jedec_ts, 1); Modified: head/sys/modules/i2c/Makefile ============================================================================== --- head/sys/modules/i2c/Makefile Sat Oct 22 02:37:59 2016 (r307767) +++ head/sys/modules/i2c/Makefile Sat Oct 22 08:00:46 2016 (r307768) @@ -1,6 +1,6 @@ # $FreeBSD$ SUBDIR = -SUBDIR += controllers if_ic smbus iicbus iicbb iicsmb iic cyapa smb isl +SUBDIR += controllers if_ic smbus iicbus iicbb iicsmb iic cyapa smb isl jedec_ts .include Added: head/sys/modules/i2c/jedec_ts/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/i2c/jedec_ts/Makefile Sat Oct 22 08:00:46 2016 (r307768) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../dev/jedec_ts +KMOD = jedec_ts +SRCS = jedec_ts.c bus_if.h device_if.h smbus_if.h + +.include From owner-svn-src-all@freebsd.org Sat Oct 22 11:26:23 2016 Return-Path: Delivered-To: svn-src-all@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 EC8D1C1C6A5; Sat, 22 Oct 2016 11:26:23 +0000 (UTC) (envelope-from jilles@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 BB25AFD7; Sat, 22 Oct 2016 11:26:23 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MBQMD3097694; Sat, 22 Oct 2016 11:26:22 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MBQMO9097692; Sat, 22 Oct 2016 11:26:22 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201610221126.u9MBQMO9097692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 22 Oct 2016 11:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307769 - head/usr.sbin/daemon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 11:26:24 -0000 Author: jilles Date: Sat Oct 22 11:26:22 2016 New Revision: 307769 URL: https://svnweb.freebsd.org/changeset/base/307769 Log: daemon: Allow logging daemon stdout/stderr to file or syslog. There are various new options, documented in the man page, to send the daemon's standard output and/or standard error to a file or to syslog. Submitted by: ank at iki.fi Reviewed by: wblock (man page only) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D7993 Modified: head/usr.sbin/daemon/daemon.8 head/usr.sbin/daemon/daemon.c Modified: head/usr.sbin/daemon/daemon.8 ============================================================================== --- head/usr.sbin/daemon/daemon.8 Sat Oct 22 08:00:46 2016 (r307768) +++ head/usr.sbin/daemon/daemon.8 Sat Oct 22 11:26:22 2016 (r307769) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2016 +.Dd October 22, 2016 .Dt DAEMON 8 .Os .Sh NAME @@ -34,11 +34,16 @@ .Nd run detached from the controlling terminal .Sh SYNOPSIS .Nm -.Op Fl cfr +.Op Fl cfrS .Op Fl p Ar child_pidfile .Op Fl P Ar supervisor_pidfile .Op Fl t Ar title .Op Fl u Ar user +.Op Fl m Ar output_mask +.Op Fl o Ar output_file +.Op Fl s Ar syslog_priority +.Op Fl T Ar syslog_tag +.Op Fl s Ar syslog_facility .Ar command arguments ... .Sh DESCRIPTION The @@ -46,6 +51,8 @@ The utility detaches itself from the controlling terminal and executes the program specified by its arguments. Privileges may be lowered to the specified user. +The output of the daemonized process may be redirected to syslog and to a +log file. .Pp The options are as follows: .Bl -tag -width indent @@ -55,6 +62,19 @@ Change the current working directory to .It Fl f Redirect standard input, standard output and standard error to .Pa /dev/null . +.It Fl S +Enable syslog output. +This is implicitly applied if other syslog parameters are provided. +The default values are daemon, notice, and daemon for facility, priority, and +tag, respectively. +.It Fl o Ar output_file +Append output from the daemonized process to +.Pa output_file . +If the file does not exist, it is created with permissions 0600. +.It Fl m Ar output_mask +Redirect output from the child process stdout (1), stderr (2), or both (3). +This value specifies what is sent to syslog and the log file. +The default is 3. .It Fl p Ar child_pidfile Write the ID of the created process into the .Ar child_pidfile @@ -96,18 +116,37 @@ option is used or not. .It Fl r Supervise and restart the program if it has been terminated. .It Fl t Ar title -Process title for the daemon to make it easily identifiable. +Set the title for the daemon process. +The default is the daemonized invocation. .It Fl u Ar user Login name of the user to execute the program under. Requires adequate superuser privileges. +.It Fl s Ar syslog_priority +These priorities are accepted: emerg, alert, crit, err, warning, +notice, info, and debug. +The default is info. +.It Fl l Ar syslog_facility +These facilities are accepted: auth, authpriv, console, cron, daemon, +ftp, kern, lpr, mail, news, ntp, security, syslog, user, uucp, and +local0, ..., local7. +The default is daemon. +.It Fl T Ar syslog_tag +Set the tag which is appended to all syslog messages. +The default is daemon. .El .Pp -If the +If any of the options .Fl p , -.Fl P +.Fl P , +.Fl r , +.Fl o , +.Fl s , +.Fl T , +.Fl m , +.Fl S , or -.Fl r -option is specified the program is executed in a spawned child process. +.Fl l +are specified, the program is executed in a spawned child process. The .Nm waits until it terminates to keep the pid file(s) locked and removes them @@ -119,6 +158,13 @@ spawned process. Normally it will cause the child to exit, remove the pidfile(s) and then terminate. .Pp +If neither file or syslog output are selected, all output is redirected to the +.Nm +process and written to stdout. +The +.Fl f +option may be used to suppress the stdout output completely. +.Pp The .Fl P option is useful combined with the @@ -145,13 +191,21 @@ library routine, 2 if or .Ar supervisor_pidfile is requested, but cannot be opened, 3 if process is already running (pidfile -exists and is locked), -otherwise 0. +exists and is locked), 4 if +.Ar syslog_priority +is not accepted, 5 if +.Ar syslog_facility +is not accepted, 6 if +.Ar output_mask +is not within the accepted range, 7 if +.Ar output_file +cannot be opened for appending, and otherwise 0. .Sh DIAGNOSTICS -If the command cannot be executed, an error message is displayed on -standard error unless the +If the command cannot be executed, an error message is printed to +standard error. +The exact behavior depends on the logging parameters and the .Fl f -flag is specified. +flag. .Sh SEE ALSO .Xr setregid 2 , .Xr setreuid 2 , Modified: head/usr.sbin/daemon/daemon.c ============================================================================== --- head/usr.sbin/daemon/daemon.c Sat Oct 22 08:00:46 2016 (r307768) +++ head/usr.sbin/daemon/daemon.c Sat Oct 22 11:26:22 2016 (r307769) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -44,25 +45,59 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#define SYSLOG_NAMES +#include +#include +#include + +#define LBUF_SIZE 4096 + +struct log_params { + int dosyslog; + int logpri; + int noclose; + int outfd; +}; -static void dummy_sighandler(int); static void restrict_process(const char *); -static int wait_child(pid_t pid, sigset_t *mask); +static void handle_term(int); +static void handle_chld(int); +static int listen_child(int, struct log_params *); +static int get_log_mapping(const char *, const CODE *); +static void open_pid_files(const char *, const char *, struct pidfh **, + struct pidfh **); +static void do_output(const unsigned char *, size_t, struct log_params *); +static void daemon_sleep(time_t, long); static void usage(void); +static volatile sig_atomic_t terminate = 0, child_gone = 0, pid = 0; + int main(int argc, char *argv[]) { - struct pidfh *ppfh, *pfh; - sigset_t mask, oldmask; - int ch, nochdir, noclose, restart, serrno; - const char *pidfile, *ppidfile, *title, *user; - pid_t otherpid, pid; - + const char *pidfile, *ppidfile, *title, *user, *outfn, *logtag; + int ch, nochdir, noclose, restart, dosyslog, child_eof; + sigset_t mask_susp, mask_orig, mask_read, mask_term; + struct log_params logpar; + int pfd[2] = { -1, -1 }, outfd = -1; + int stdmask, logpri, logfac; + struct pidfh *ppfh, *pfh; + char *p; + + memset(&logpar, 0, sizeof(logpar)); + stdmask = STDOUT_FILENO | STDERR_FILENO; + ppidfile = pidfile = user = NULL; nochdir = noclose = 1; + logpri = LOG_NOTICE; + logfac = LOG_DAEMON; + logtag = "daemon"; restart = 0; - ppidfile = pidfile = title = user = NULL; - while ((ch = getopt(argc, argv, "cfp:P:rt:u:")) != -1) { + dosyslog = 0; + outfn = NULL; + title = NULL; + while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:T:")) != -1) { switch (ch) { case 'c': nochdir = 0; @@ -70,6 +105,20 @@ main(int argc, char *argv[]) case 'f': noclose = 0; break; + case 'l': + logfac = get_log_mapping(optarg, facilitynames); + if (logfac == -1) + errx(5, "unrecognized syslog facility"); + dosyslog = 1; + break; + case 'm': + stdmask = strtol(optarg, &p, 10); + if (p == optarg || stdmask < 0 || stdmask > 3) + errx(6, "unrecognized listening mask"); + break; + case 'o': + outfn = optarg; + break; case 'p': pidfile = optarg; break; @@ -79,9 +128,22 @@ main(int argc, char *argv[]) case 'r': restart = 1; break; + case 's': + logpri = get_log_mapping(optarg, prioritynames); + if (logpri == -1) + errx(4, "unrecognized syslog priority"); + dosyslog = 1; + break; + case 'S': + dosyslog = 1; + break; case 't': title = optarg; break; + case 'T': + logtag = optarg; + dosyslog = 1; + break; case 'u': user = optarg; break; @@ -95,43 +157,30 @@ main(int argc, char *argv[]) if (argc == 0) usage(); + if (!title) + title = argv[0]; + + if (outfn) { + outfd = open(outfn, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0600); + if (outfd == -1) + err(7, "open"); + } + + if (dosyslog) + openlog(logtag, LOG_PID | LOG_NDELAY, logfac); + ppfh = pfh = NULL; /* * Try to open the pidfile before calling daemon(3), * to be able to report the error intelligently */ - if (pidfile != NULL) { - pfh = pidfile_open(pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { - errx(3, "process already running, pid: %d", - otherpid); - } - err(2, "pidfile ``%s''", pidfile); - } - } - /* Do the same for actual daemon process. */ - if (ppidfile != NULL) { - ppfh = pidfile_open(ppidfile, 0600, &otherpid); - if (ppfh == NULL) { - serrno = errno; - pidfile_remove(pfh); - errno = serrno; - if (errno == EEXIST) { - errx(3, "process already running, pid: %d", - otherpid); - } - err(2, "ppidfile ``%s''", ppidfile); - } - } - + open_pid_files(pidfile, ppidfile, &pfh, &ppfh); if (daemon(nochdir, noclose) == -1) { warn("daemon"); goto exit; } /* Write out parent pidfile if needed. */ pidfile_write(ppfh); - /* * If the pidfile or restart option is specified the daemon * executes the command in a forked process and wait on child @@ -139,34 +188,50 @@ main(int argc, char *argv[]) * we don't want the monitoring daemon to be terminated * leaving the running process and the stale pidfile, so we * catch SIGTERM and forward it to the children expecting to - * get SIGCHLD eventually. + * get SIGCHLD eventually. We also must fork() to obtain a + * readable pipe with the child for writing to a log file + * and syslog. */ pid = -1; - if (pidfile != NULL || ppidfile != NULL || restart) { + if (pidfile || ppidfile || restart || outfd != -1 || dosyslog) { + struct sigaction act_term, act_chld; + + /* Avoid PID racing with SIGCHLD and SIGTERM. */ + memset(&act_term, 0, sizeof(act_term)); + act_term.sa_handler = handle_term; + sigemptyset(&act_term.sa_mask); + sigaddset(&act_term.sa_mask, SIGCHLD); + + memset(&act_chld, 0, sizeof(act_chld)); + act_chld.sa_handler = handle_chld; + sigemptyset(&act_chld.sa_mask); + sigaddset(&act_chld.sa_mask, SIGTERM); + + /* Block these when avoiding racing before sigsuspend(). */ + sigemptyset(&mask_susp); + sigaddset(&mask_susp, SIGTERM); + sigaddset(&mask_susp, SIGCHLD); + /* Block SIGTERM when we lack a valid child PID. */ + sigemptyset(&mask_term); + sigaddset(&mask_term, SIGTERM); /* - * Restore default action for SIGTERM in case the - * parent process decided to ignore it. + * When reading, we wish to avoid SIGCHLD. SIGTERM + * has to be caught, otherwise we'll be stuck until + * the read() returns - if it returns. */ - if (signal(SIGTERM, SIG_DFL) == SIG_ERR) { - warn("signal"); + sigemptyset(&mask_read); + sigaddset(&mask_read, SIGCHLD); + /* Block SIGTERM to avoid racing until we have forked. */ + if (sigprocmask(SIG_BLOCK, &mask_term, &mask_orig)) { + warn("sigprocmask"); goto exit; } - /* - * Because SIGCHLD is ignored by default, setup dummy handler - * for it, so we can mask it. - */ - if (signal(SIGCHLD, dummy_sighandler) == SIG_ERR) { - warn("signal"); + if (sigaction(SIGTERM, &act_term, NULL) == -1) { + warn("sigaction"); goto exit; } - /* - * Block interesting signals. - */ - sigemptyset(&mask); - sigaddset(&mask, SIGTERM); - sigaddset(&mask, SIGCHLD); - if (sigprocmask(SIG_SETMASK, &mask, &oldmask) == -1) { - warn("sigprocmask"); + if (sigaction(SIGCHLD, &act_chld, NULL) == -1) { + warn("sigaction"); goto exit; } /* @@ -175,56 +240,190 @@ main(int argc, char *argv[]) * not have superuser privileges. */ (void)madvise(NULL, 0, MADV_PROTECT); + logpar.outfd = outfd; + logpar.dosyslog = dosyslog; + logpar.logpri = logpri; + logpar.noclose = noclose; restart: + if (pipe(pfd)) + err(1, "pipe"); /* - * Spawn a child to exec the command, so in the parent - * we could wait for it to exit and remove pidfile. + * Spawn a child to exec the command. */ + child_gone = 0; pid = fork(); if (pid == -1) { warn("fork"); goto exit; + } else if (pid > 0) { + /* + * Unblock SIGTERM after we know we have a valid + * child PID to signal. + */ + if (sigprocmask(SIG_UNBLOCK, &mask_term, NULL)) { + warn("sigprocmask"); + goto exit; + } + close(pfd[1]); + pfd[1] = -1; } } if (pid <= 0) { - if (pid == 0) { - /* Restore old sigmask in the child. */ - if (sigprocmask(SIG_SETMASK, &oldmask, NULL) == -1) - err(1, "sigprocmask"); - } /* Now that we are the child, write out the pid. */ pidfile_write(pfh); if (user != NULL) restrict_process(user); - + /* + * When forking, the child gets the original sigmask, + * and dup'd pipes. + */ + if (pid == 0) { + close(pfd[0]); + if (sigprocmask(SIG_SETMASK, &mask_orig, NULL)) + err(1, "sigprogmask"); + if (stdmask & STDERR_FILENO) { + if (dup2(pfd[1], STDERR_FILENO) == -1) + err(1, "dup2"); + } + if (stdmask & STDOUT_FILENO) { + if (dup2(pfd[1], STDOUT_FILENO) == -1) + err(1, "dup2"); + } + if (pfd[1] != STDERR_FILENO && + pfd[1] != STDOUT_FILENO) + close(pfd[1]); + } execvp(argv[0], argv); - /* * execvp() failed -- report the error. The child is * now running, so the exit status doesn't matter. */ err(1, "%s", argv[0]); } - - if (title != NULL) - setproctitle("%s[%d]", title, pid); - else - setproctitle("%s[%d]", argv[0], pid); - if (wait_child(pid, &mask) == 0 && restart) { - sleep(1); + setproctitle("%s[%d]", title, (int)pid); + /* + * As we have closed the write end of pipe for parent process, + * we might detect the child's exit by reading EOF. The child + * might have closed its stdout and stderr, so we must wait for + * the SIGCHLD to ensure that the process is actually gone. + */ + child_eof = 0; + for (;;) { + /* + * We block SIGCHLD when listening, but SIGTERM we accept + * so the read() won't block if we wish to depart. + * + * Upon receiving SIGTERM, we have several options after + * sending the SIGTERM to our child: + * - read until EOF + * - read until EOF but only for a while + * - bail immediately + * + * We go for the third, as otherwise we have no guarantee + * that we won't block indefinitely if the child refuses + * to depart. To handle the second option, a different + * approach would be needed (procctl()?) + */ + if (child_gone && child_eof) { + break; + } else if (terminate) { + goto exit; + } else if (!child_eof) { + if (sigprocmask(SIG_BLOCK, &mask_read, NULL)) { + warn("sigprocmask"); + goto exit; + } + child_eof = !listen_child(pfd[0], &logpar); + if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) { + warn("sigprocmask"); + goto exit; + } + } else { + if (sigprocmask(SIG_BLOCK, &mask_susp, NULL)) { + warn("sigprocmask"); + goto exit; + } + while (!terminate && !child_gone) + sigsuspend(&mask_orig); + if (sigprocmask(SIG_UNBLOCK, &mask_susp, NULL)) { + warn("sigprocmask"); + goto exit; + } + } + } + if (sigprocmask(SIG_BLOCK, &mask_term, NULL)) { + warn("sigprocmask"); + goto exit; + } + if (restart && !terminate) { + daemon_sleep(1, 0); + close(pfd[0]); + pfd[0] = -1; goto restart; } exit: + close(outfd); + close(pfd[0]); + close(pfd[1]); + if (dosyslog) + closelog(); pidfile_remove(pfh); pidfile_remove(ppfh); exit(1); /* If daemon(3) succeeded exit status does not matter. */ } static void -dummy_sighandler(int sig __unused) +daemon_sleep(time_t secs, long nsecs) { - /* Nothing to do. */ + struct timespec ts = { secs, nsecs }; + while (nanosleep(&ts, &ts) == -1) { + if (errno != EINTR) + err(1, "nanosleep"); + } +} + +static void +open_pid_files(const char *pidfile, const char *ppidfile, + struct pidfh **pfh, struct pidfh **ppfh) +{ + pid_t fpid; + int serrno; + + if (pidfile) { + *pfh = pidfile_open(pidfile, 0600, &fpid); + if (*pfh == NULL) { + if (errno == EEXIST) { + errx(3, "process already running, pid: %d", + fpid); + } + err(2, "pidfile ``%s''", pidfile); + } + } + /* Do the same for the actual daemon process. */ + if (ppidfile) { + *ppfh = pidfile_open(ppidfile, 0600, &fpid); + if (*ppfh == NULL) { + serrno = errno; + pidfile_remove(*pfh); + errno = serrno; + if (errno == EEXIST) { + errx(3, "process already running, pid: %d", + fpid); + } + err(2, "ppidfile ``%s''", ppidfile); + } + } +} + +static int +get_log_mapping(const char *str, const CODE *c) +{ + const CODE *cp; + for (cp = c; cp->c_name; cp++) + if (strcmp(cp->c_name, str) == 0) + return cp->c_val; + return -1; } static void @@ -240,34 +439,112 @@ restrict_process(const char *user) errx(1, "failed to set user environment"); } +/* + * We try to collect whole lines terminated by '\n'. Otherwise we collect a + * full buffer, and then output it. + * + * Return value of 0 is assumed to mean EOF or error, and 1 indicates to + * continue reading. + */ static int -wait_child(pid_t pid, sigset_t *mask) +listen_child(int fd, struct log_params *logpar) +{ + static unsigned char buf[LBUF_SIZE]; + static size_t bytes_read = 0; + int rv; + + assert(logpar); + assert(bytes_read < LBUF_SIZE - 1); + + rv = read(fd, buf + bytes_read, LBUF_SIZE - bytes_read - 1); + if (rv > 0) { + unsigned char *cp; + + bytes_read += rv; + assert(bytes_read <= LBUF_SIZE - 1); + /* Always NUL-terminate just in case. */ + buf[LBUF_SIZE - 1] = '\0'; + /* + * Chomp line by line until we run out of buffer. + * This does not take NUL characters into account. + */ + while ((cp = memchr(buf, '\n', bytes_read)) != NULL) { + size_t bytes_line = cp - buf + 1; + assert(bytes_line <= bytes_read); + do_output(buf, bytes_line, logpar); + bytes_read -= bytes_line; + memmove(buf, cp + 1, bytes_read); + } + /* Wait until the buffer is full. */ + if (bytes_read < LBUF_SIZE - 1) + return 1; + do_output(buf, bytes_read, logpar); + bytes_read = 0; + return 1; + } else if (rv == -1) { + /* EINTR should trigger another read. */ + if (errno == EINTR) { + return 1; + } else { + warn("read"); + return 0; + } + } + /* Upon EOF, we have to flush what's left of the buffer. */ + if (bytes_read > 0) { + do_output(buf, bytes_read, logpar); + bytes_read = 0; + } + return 0; +} + +/* + * The default behavior is to stay silent if the user wants to redirect + * output to a file and/or syslog. If neither are provided, then we bounce + * everything back to parent's stdout. + */ +static void +do_output(const unsigned char *buf, size_t len, struct log_params *logpar) { - int terminate, signo; + assert(len <= LBUF_SIZE); + assert(logpar); + + if (len < 1) + return; + if (logpar->dosyslog) + syslog(logpar->logpri, "%.*s", (int)len, buf); + if (logpar->outfd != -1) { + if (write(logpar->outfd, buf, len) == -1) + warn("write"); + } + if (logpar->noclose && !logpar->dosyslog && logpar->outfd == -1) + printf("%.*s", (int)len, buf); +} - terminate = 0; +/* + * We use the global PID acquired directly from fork. If there is no valid + * child pid, the handler should be blocked and/or child_gone == 1. + */ +static void +handle_term(int signo) +{ + if (pid > 0 && !child_gone) + kill(pid, signo); + terminate = 1; +} + +static void +handle_chld(int signo) +{ + (void)signo; for (;;) { - if (sigwait(mask, &signo) == -1) { - warn("sigwaitinfo"); - return (-1); - } - switch (signo) { - case SIGCHLD: - if (waitpid(pid, NULL, WNOHANG) == -1) { - warn("waitpid"); - return (-1); - } - return (terminate); - case SIGTERM: - terminate = 1; - if (kill(pid, signo) == -1) { - warn("kill"); - return (-1); - } - continue; - default: - warnx("sigwaitinfo: invalid signal: %d", signo); - return (-1); + int rv = waitpid(-1, NULL, WNOHANG); + if (pid == rv) { + child_gone = 1; + break; + } else if (rv == -1 && errno != EINTR) { + warn("waitpid"); + return; } } } @@ -275,8 +552,11 @@ wait_child(pid_t pid, sigset_t *mask) static void usage(void) { - (void)fprintf(stderr, "%s\n\t%s\n", - "usage: daemon [-cfr] [-p child_pidfile] [-P supervisor_pidfile]", - "[-t title] [-u user] command arguments ..."); + (void)fprintf(stderr, + "usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]\n" + " [-u user] [-o output_file] [-t title]\n" + " [-l syslog_facility] [-s syslog_priority]\n" + " [-T syslog_tag] [-m output_mask]\n" + "command arguments ...\n"); exit(1); } From owner-svn-src-all@freebsd.org Sat Oct 22 12:06:19 2016 Return-Path: Delivered-To: svn-src-all@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 D7BEAC19DD2; Sat, 22 Oct 2016 12:06:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x232.google.com (mail-it0-x232.google.com [IPv6:2607:f8b0:4001:c0b::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F71FACA; Sat, 22 Oct 2016 12:06:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x232.google.com with SMTP id 66so47067617itl.1; Sat, 22 Oct 2016 05:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=+yl5WzMZsHMR3OVi0erSbz/XQFeltZ05rvA2UYUpL5A=; b=LAFuYxHuaHbI9qgsME3a282WxMP/fW2/OQ93n1qdomkOLwiNZ/c74dli4au3JqrAx7 RFgTCU+imwLkDVdv0nokqH/7JtMYrdH6w2a0lzndtm9GtKfkvDjHAeVFXcUc+YAMyiOr qE86uUacNtRdAQ1r2zNVzMKHlDHaNjGUVEc4m4la+CNiixJ2I5pl8Gj/UFsvierB9ves Q9TwYwXftllRWW4ayXavrUiFCe1RBkE/jn11PLgdH/Uj94z/A0ztK9jWqC9qnjARudYn SakM1R6EJf8i09K7W9JU85D8v/2XcA1jiCG2Vs1FTfWI9aOQLBmVCo0Yv7Z8pIYL6AqA uYNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=+yl5WzMZsHMR3OVi0erSbz/XQFeltZ05rvA2UYUpL5A=; b=d6yQdc/TnxVy2jUYvyG3toLOLRAm2eMXo9UeHkfyKvuZW8p/rD+IgVETAyxdqa98Sz mvOjIv7gD2WseExBobLNyIcWHEOmY1a4AUGbpdSJ/4JqnqPhzE43Hdk6eCaDy0hmod3o +j1J5ZBBHX6T0ZXSOH48E52sC+eADddK5AT26i5dBJFTx+8zQyl3c4g54Pidcf0hpbCe mpHduBYlv0gH9gDNPEVRvjGJCs8h3DFV9+gK93qu0qYKHqx8+0kf2vaTgXhaEMiazI4V nLxVGsQMvzFLOFzkGKelE7LX7ZM6IG3YxE2jn1UACH8unC6uDSmZsIfdyUwl581TFcnt XMug== X-Gm-Message-State: ABUngve1UVpS9y1Qk4rGs8uixjFIEJWqEWDP6LHxjOJ6Dtq+9k7vUa/+0elQ5ANPu7inef58vy6/bmfkm+j3pg== X-Received: by 10.107.179.11 with SMTP id c11mr5499718iof.169.1477137978789; Sat, 22 Oct 2016 05:06:18 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.180.211 with HTTP; Sat, 22 Oct 2016 05:05:58 -0700 (PDT) In-Reply-To: <201610101909.u9AJ9ZH0022085@repo.freebsd.org> References: <201610101909.u9AJ9ZH0022085@repo.freebsd.org> From: Ed Maste Date: Sat, 22 Oct 2016 12:05:58 +0000 X-Google-Sender-Auth: lWtui4w9kzNQ87tFfGcgTcSWZxo Message-ID: Subject: Re: svn commit: r307003 - head/contrib/mdocml To: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 12:06:19 -0000 On 10 October 2016 at 19:09, Ed Maste wrote: > Author: emaste > Date: Mon Oct 10 19:09:35 2016 > New Revision: 307003 > URL: https://svnweb.freebsd.org/changeset/base/307003 > > Log: > makewhatis: make output reproducible Several of us discussed this issue at the FreeBSD Developer Summit prior to FOSDEM 2016, and des@ later added to the wiki a description of the approach taken by this commit; I'm sorry that wasn't mentioned in the commit message. From owner-svn-src-all@freebsd.org Sat Oct 22 12:20:28 2016 Return-Path: Delivered-To: svn-src-all@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 4DB19C1B1D7; Sat, 22 Oct 2016 12:20:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D86EFAC; Sat, 22 Oct 2016 12:20:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9MCKHeu081496 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 22 Oct 2016 15:20:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9MCKHeu081496 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u9MCKHmg081494; Sat, 22 Oct 2016 15:20:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 22 Oct 2016 15:20:17 +0300 From: Konstantin Belousov To: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307761 - in head: . contrib/binutils/bfd contrib/gcc/config/rs6000 gnu/lib/libgcc gnu/lib/libgomp gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/cc/cc_tools gnu/usr.bin/cc/include gnu... Message-ID: <20161022122017.GY54029@kib.kiev.ua> References: <201610220157.u9M1vFXx080331@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201610220157.u9M1vFXx080331@repo.freebsd.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 12:20:28 -0000 On Sat, Oct 22, 2016 at 01:57:15AM +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Sat Oct 22 01:57:15 2016 > New Revision: 307761 > URL: https://svnweb.freebsd.org/changeset/base/307761 > > Log: > Create a new MACHINE_ARCH for Freescale PowerPC e500v2 > Added: > head/lib/libc/powerpcspe/sys/ptrace.S (contents, props changed) This is not needed, libc provides MI implementation in libc/sys/ptrace.c. From owner-svn-src-all@freebsd.org Sat Oct 22 12:43:10 2016 Return-Path: Delivered-To: svn-src-all@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 94922C1BA1C; Sat, 22 Oct 2016 12:43:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 111DC70; Sat, 22 Oct 2016 12:43:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u9MCh4hq087261 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 22 Oct 2016 15:43:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u9MCh4hq087261 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u9MCh1ar087260; Sat, 22 Oct 2016 15:43:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 22 Oct 2016 15:43:01 +0300 From: Konstantin Belousov To: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307761 - in head: . contrib/binutils/bfd contrib/gcc/config/rs6000 gnu/lib/libgcc gnu/lib/libgomp gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/cc/cc_tools gnu/usr.bin/cc/include gnu... Message-ID: <20161022124301.GZ54029@kib.kiev.ua> References: <201610220157.u9M1vFXx080331@repo.freebsd.org> <20161022122017.GY54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161022122017.GY54029@kib.kiev.ua> User-Agent: Mutt/1.7.1 (2016-10-04) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 12:43:10 -0000 On Sat, Oct 22, 2016 at 03:20:17PM +0300, Konstantin Belousov wrote: > On Sat, Oct 22, 2016 at 01:57:15AM +0000, Justin Hibbits wrote: > > Author: jhibbits > > Date: Sat Oct 22 01:57:15 2016 > > New Revision: 307761 > > URL: https://svnweb.freebsd.org/changeset/base/307761 > > > > Log: > > Create a new MACHINE_ARCH for Freescale PowerPC e500v2 > > > Added: > > head/lib/libc/powerpcspe/sys/ptrace.S (contents, props changed) > > This is not needed, libc provides MI implementation in libc/sys/ptrace.c. Why the decision to copy whole lib/libc/powerpc to lib/libc/powerpcspe was used to create the architecture ? I did a primitive-science overview, and got total ~2300 lines in lib/libc/powerpcspe, while $ diff -Nrua lib/libc/powerpc lib/libc/powerpcspe | diffstat -p0 | tail -1 16 files changed, 240 insertions(+), 174 deletions(-) It seems to be possible to only create several new files, like *setjmp.S and fp*.c, and reuse existing stock files from libc/powerpc for anything else. I am the one who does most of the sweeping changes over libc, and I am somewhat saddened by addition of almost identical copy of the existing architecture files which need to be maintained together with the original. From owner-svn-src-all@freebsd.org Sat Oct 22 13:09:31 2016 Return-Path: Delivered-To: svn-src-all@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 5A15FC1C08D; Sat, 22 Oct 2016 13:09:31 +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 295AAD53; Sat, 22 Oct 2016 13:09:31 +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 u9MD9Uqg035992; Sat, 22 Oct 2016 13:09:30 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MD9U3a035991; Sat, 22 Oct 2016 13:09:30 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221309.u9MD9U3a035991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 13:09:30 +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: r307770 - stable/11 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 13:09:31 -0000 Author: bapt Date: Sat Oct 22 13:09:30 2016 New Revision: 307770 URL: https://svnweb.freebsd.org/changeset/base/307770 Log: MFC: 306864,307648 Groff is needed only if MK_GROFF and MK_SHAREDOCS are both true. Modified: stable/11/Makefile.inc1 Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Sat Oct 22 11:26:22 2016 (r307769) +++ stable/11/Makefile.inc1 Sat Oct 22 13:09:30 2016 (r307770) @@ -1570,7 +1570,7 @@ _strfile= usr.bin/fortune/strfile _gperf= gnu/usr.bin/gperf .endif -.if ${MK_GROFF} != "no" +.if ${MK_SHAREDOCS} != "no" && ${MK_GROFF} != "no" _groff= gnu/usr.bin/groff \ usr.bin/soelim .endif From owner-svn-src-all@freebsd.org Sat Oct 22 13:11:10 2016 Return-Path: Delivered-To: svn-src-all@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 81AB8C1C22E; Sat, 22 Oct 2016 13:11:10 +0000 (UTC) (envelope-from jhibbits@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 50187F2B; Sat, 22 Oct 2016 13:11:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MDB9Nf036134; Sat, 22 Oct 2016 13:11:09 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MDB9XP036133; Sat, 22 Oct 2016 13:11:09 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610221311.u9MDB9XP036133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 22 Oct 2016 13:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307771 - head/lib/libc/powerpcspe/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 13:11:10 -0000 Author: jhibbits Date: Sat Oct 22 13:11:09 2016 New Revision: 307771 URL: https://svnweb.freebsd.org/changeset/base/307771 Log: ptrace.S is not needed, libc/sys/ptrace.c exists already. This was leftovers from the initial branch work. Reported by: kib Deleted: head/lib/libc/powerpcspe/sys/ptrace.S Modified: head/lib/libc/powerpcspe/sys/Makefile.inc Modified: head/lib/libc/powerpcspe/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpcspe/sys/Makefile.inc Sat Oct 22 13:09:30 2016 (r307770) +++ head/lib/libc/powerpcspe/sys/Makefile.inc Sat Oct 22 13:11:09 2016 (r307771) @@ -1,6 +1,6 @@ # $FreeBSD$ -MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S +MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S # Don't generate default code for these syscalls: NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o From owner-svn-src-all@freebsd.org Sat Oct 22 13:14:04 2016 Return-Path: Delivered-To: svn-src-all@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 18887C1C2E2; Sat, 22 Oct 2016 13:14:04 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-it0-x244.google.com (mail-it0-x244.google.com [IPv6:2607:f8b0:4001:c0b::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2A132E0; Sat, 22 Oct 2016 13:14:03 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-it0-x244.google.com with SMTP id 139so3177532itm.2; Sat, 22 Oct 2016 06:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=cc:message-id:from:to:in-reply-to:content-transfer-encoding :mime-version:subject:date:references; bh=h1yeqxP+3bQr7qw2UiHya4ntEcHRWJaha2jrSqcO6nU=; b=X/Da+2QhR+1ZCy1viP8qtV/cA92wrTx/FdjdmwSzFs7z+ROZZynjJ2Np88s+MHpw8L vDqQa3fO4r/c886f2jDcvGv9JGr6jkKT98TJ/mayvAqwyKrXK8QJ/U474KytjKloJRlX twa2HIfYH2Q55y+slQ3P7EWQa7bv5HGQeRuVSnv/M6vKXUO7ubX9/ZlNFVY065cdvXBp EQQGLh3z8ufuIPTt9/N4nVZIYzOXsLn1Od/bdzDMXuWxBpdQq2Q7F10aC4CKdnA8I1jq sWhzPOB33Pcd3fqd4OuBrHOXOoZYKm+6FTHu8hKAdWOGi+dGGOjh6MsqaFzB2mQadMpV +5MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:cc:message-id:from:to:in-reply-to :content-transfer-encoding:mime-version:subject:date:references; bh=h1yeqxP+3bQr7qw2UiHya4ntEcHRWJaha2jrSqcO6nU=; b=SxZdRoNtIEKyXZVYokvNA36sWS2p9gTjMblWu3jXALKPUPDuF0voWcVCnYt2IWFeLC kPRzbd9vjqvPCQ3IKNBg6qW7nEb5jEzSsyVcGjjzxiPutwi3+0HQvOOrEaYltoGDOHKg L70NHvhoqJfIX/9xp2LxYoUZbiVuKbN5cz7ltEd3y+SFW7aVeNdbgDOFl3aOXp6QPKbS Bvw5uCevEHtM4guXdmL8VXruaqOfRLO7P0x2AQ4bxVvPfDoSI48x9T5SLVZpyc9I7NJv UgRpouCF96nvhVICqCGONWG8Tpmo6bRxbA6DM3ETHsYP8yS6fKddCeIt+G5lQnykNM3m ozAA== X-Gm-Message-State: ABUngvfLFQpYweX1giN6MFJX3YB4xE+hjILBJBJbSpQ2ka3fwh4pSp6LsYe09uVQ6r7wQw== X-Received: by 10.107.202.69 with SMTP id a66mr6474229iog.170.1477142043055; Sat, 22 Oct 2016 06:14:03 -0700 (PDT) Received: from Triad.knownspace (50-80-150-234.client.mchsi.com. [50.80.150.234]) by smtp.gmail.com with ESMTPSA id a100sm3802948ioj.13.2016.10.22.06.14.01 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 22 Oct 2016 06:14:02 -0700 (PDT) Cc: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: From: Justin Hibbits To: Konstantin Belousov In-Reply-To: <20161022124301.GZ54029@kib.kiev.ua> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: svn commit: r307761 - in head: . contrib/binutils/bfd contrib/gcc/config/rs6000 gnu/lib/libgcc gnu/lib/libgomp gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/cc/cc_tools gnu/usr.bin/cc/include gnu... Date: Sat, 22 Oct 2016 08:14:00 -0500 References: <201610220157.u9M1vFXx080331@repo.freebsd.org> <20161022122017.GY54029@kib.kiev.ua> <20161022124301.GZ54029@kib.kiev.ua> X-Mailer: Apple Mail (2.936) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 13:14:04 -0000 On Oct 22, 2016, at 7:43 AM, Konstantin Belousov wrote: > On Sat, Oct 22, 2016 at 03:20:17PM +0300, Konstantin Belousov wrote: >> On Sat, Oct 22, 2016 at 01:57:15AM +0000, Justin Hibbits wrote: >>> Author: jhibbits >>> Date: Sat Oct 22 01:57:15 2016 >>> New Revision: 307761 >>> URL: https://svnweb.freebsd.org/changeset/base/307761 >>> >>> Log: >>> Create a new MACHINE_ARCH for Freescale PowerPC e500v2 >> >>> Added: >>> head/lib/libc/powerpcspe/sys/ptrace.S (contents, props changed) >> >> This is not needed, libc provides MI implementation in libc/sys/ >> ptrace.c. > > Why the decision to copy whole lib/libc/powerpc to lib/libc/powerpcspe > was used to create the architecture ? I did a primitive-science > overview, and got total ~2300 lines in lib/libc/powerpcspe, while > $ diff -Nrua lib/libc/powerpc lib/libc/powerpcspe | diffstat -p0 | > tail -1 > 16 files changed, 240 insertions(+), 174 deletions(-) > > It seems to be possible to only create several new files, like > *setjmp.S and fp*.c, and reuse existing stock files from libc/powerpc > for anything else. > > I am the one who does most of the sweeping changes over libc, and > I am somewhat saddened by addition of almost identical copy of the > existing architecture files which need to be maintained together with > the original. To be honest, I didn't think it was the right way either, but wasn't completely certain (and admittedly didn't try) that I could have two files with the same names, one in powerpc one in powerpcspe, and have it ignore the powerpc one if it exists in powerpcspe. libc's Makefile includes ${MACHINE_ARCH}/Makefile.inc, unless it doesn't exist in which case it includes ${MACHINE_CPUARCH}/ Makefile.inc, I'll see if I can consolidate them, but do you have a recommendation of the best way to do it? I also didn't really like the code duplication, but couldn't think of an easy/good way to do so. Now that we've chatted on IRC a bit about this, I'll take your suggestion and create some Makefile.common files to share between powerpc and powerpcspe. It may take a couple days depending on my available time. - Justin From owner-svn-src-all@freebsd.org Sat Oct 22 13:15:21 2016 Return-Path: Delivered-To: svn-src-all@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 31D1DC1C35F; Sat, 22 Oct 2016 13:15:21 +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 E225B691; Sat, 22 Oct 2016 13:15:20 +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 u9MDFKHU039786; Sat, 22 Oct 2016 13:15:20 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MDFJ2p039783; Sat, 22 Oct 2016 13:15:19 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221315.u9MDFJ2p039783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 13:15: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: r307772 - stable/11/usr.bin/sdiff X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 13:15:21 -0000 Author: bapt Date: Sat Oct 22 13:15:19 2016 New Revision: 307772 URL: https://svnweb.freebsd.org/changeset/base/307772 Log: MFC: 307368,307369,307372,307381 Remove the common.h include which is actually not used in sdiff.c Turn editit into a static function Move cleanup() into the edit.c file which is the only users of that function Remove common.{c,h} Fix typos in sdiff(1) message and improve display Deleted: stable/11/usr.bin/sdiff/common.c stable/11/usr.bin/sdiff/common.h Modified: stable/11/usr.bin/sdiff/Makefile stable/11/usr.bin/sdiff/edit.c stable/11/usr.bin/sdiff/sdiff.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sdiff/Makefile ============================================================================== --- stable/11/usr.bin/sdiff/Makefile Sat Oct 22 13:11:09 2016 (r307771) +++ stable/11/usr.bin/sdiff/Makefile Sat Oct 22 13:15:19 2016 (r307772) @@ -3,7 +3,7 @@ .include PROG= sdiff -SRCS= common.c edit.c sdiff.c +SRCS= edit.c sdiff.c WARNS= 3 MAN1= sdiff.1 Modified: stable/11/usr.bin/sdiff/edit.c ============================================================================== --- stable/11/usr.bin/sdiff/edit.c Sat Oct 22 13:11:09 2016 (r307771) +++ stable/11/usr.bin/sdiff/edit.c Sat Oct 22 13:15:19 2016 (r307772) @@ -21,10 +21,16 @@ __FBSDID("$FreeBSD$"); #include #include -#include "common.h" #include "extern.h" -int editit(const char *); +static void +cleanup(const char *filename) +{ + + if (unlink(filename)) + err(2, "could not delete: %s", filename); + exit(2); +} /* * Execute an editor on the specified pathname, which is interpreted @@ -32,7 +38,7 @@ int editit(const char *); * * Returns -1 on error, or the exit value on success. */ -int +static int editit(const char *pathname) { sig_t sighup, sigint, sigquit, sigchld; Modified: stable/11/usr.bin/sdiff/sdiff.c ============================================================================== --- stable/11/usr.bin/sdiff/sdiff.c Sat Oct 22 13:11:09 2016 (r307771) +++ stable/11/usr.bin/sdiff/sdiff.c Sat Oct 22 13:15:19 2016 (r307772) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "common.h" #include "extern.h" #define DIFF_PATH "/usr/bin/diff" @@ -144,24 +143,25 @@ static struct option longopts[] = { }; static const char *help_msg[] = { - "\nusage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", - "\t-l, --left-column, Only print the left column for identical lines.", - "\t-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.", - "\t-s, --suppress-common-lines, Skip identical lines.", - "\t-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.", - "\tOptions passed to diff(1) are:", - "\t\t-a, --text, Treat file1 and file2 as text files.", - "\t\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.", - "\t\t-d, --minimal, Minimize diff size.", - "\t\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.", - "\t\t-i, --ignore-case, Do a case-insensitive comparison.", - "\t\t-t, --expand-tabs Expand tabs to spaces.", - "\t\t-W, --ignore-all-spaces, Ignore all spaces.", - "\t\t--speed-large-files, Assume large file with scattered changes.", - "\t\t--strip-trailing-cr, Strip trailing carriage return.", - "\t\t--ignore-file-name-case, Ignore case of file names.", - "\t\t--no-ignore-file-name-case, Do not ignore file name case", - "\t\t--tabsize NUM, Change size of tabs (default 8.)", + "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n", + "-l, --left-column: only print the left column for identical lines.", + "-o OUTFILE, --output=OUTFILE: interactively merge file1 and file2 into outfile.", + "-s, --suppress-common-lines: skip identical lines.", + "-w WIDTH, --width=WIDTH: print a maximum of WIDTH characters on each line.", + "", + "Options passed to diff(1) are:", + "\t-a, --text: treat file1 and file2 as text files.", + "\t-b, --ignore-trailing-cr: ignore trailing blank spaces.", + "\t-d, --minimal: minimize diff size.", + "\t-I RE, --ignore-matching-lines=RE: ignore changes whose line matches RE.", + "\t-i, --ignore-case: do a case-insensitive comparison.", + "\t-t, --expand-tabs: sxpand tabs to spaces.", + "\t-W, --ignore-all-spaces: ignore all spaces.", + "\t--speed-large-files: assume large file with scattered changes.", + "\t--strip-trailing-cr: strip trailing carriage return.", + "\t--ignore-file-name-case: ignore case of file names.", + "\t--no-ignore-file-name-case: do not ignore file name case", + "\t--tabsize NUM: change size of tabs (default 8.)", NULL, }; From owner-svn-src-all@freebsd.org Sat Oct 22 13:20:04 2016 Return-Path: Delivered-To: svn-src-all@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 04BADC1C417; Sat, 22 Oct 2016 13:20: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 AE704883; Sat, 22 Oct 2016 13:20:03 +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 u9MDK29X039998; Sat, 22 Oct 2016 13:20:02 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MDK2iL039997; Sat, 22 Oct 2016 13:20:02 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221320.u9MDK2iL039997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 13:20: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: r307773 - stable/11/usr.bin/tee X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 13:20:04 -0000 Author: bapt Date: Sat Oct 22 13:20:02 2016 New Revision: 307773 URL: https://svnweb.freebsd.org/changeset/base/307773 Log: MFC: 305937 Capsicum-ize tee(1) Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D7940 Modified: stable/11/usr.bin/tee/tee.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/tee/tee.c ============================================================================== --- stable/11/usr.bin/tee/tee.c Sat Oct 22 13:15:19 2016 (r307772) +++ stable/11/usr.bin/tee/tee.c Sat Oct 22 13:20:02 2016 (r307773) @@ -41,14 +41,18 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include +#include #include +#include + #include +#include #include #include #include #include #include +#include #include typedef struct _list { @@ -69,6 +73,8 @@ main(int argc, char *argv[]) char *bp; int append, ch, exitval; char *buf; + cap_rights_t rights; + unsigned long cmd; #define BSIZE (8 * 1024) append = 0; @@ -90,6 +96,16 @@ main(int argc, char *argv[]) if ((buf = malloc(BSIZE)) == NULL) err(1, "malloc"); + cap_rights_init(&rights, CAP_READ, CAP_FSTAT); + if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit rights for stdin"); + cap_rights_init(&rights, CAP_WRITE, CAP_FSTAT, CAP_IOCTL); + if (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit rights for stderr"); + cmd = TIOCGETA; + if (cap_ioctls_limit(STDERR_FILENO, &cmd, 1) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit ioctls for stderr"); + add(STDOUT_FILENO, "stdout"); for (exitval = 0; *argv; ++argv) @@ -100,6 +116,8 @@ main(int argc, char *argv[]) } else add(fd, *argv); + if (cap_enter() < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to enter capability mode"); while ((rval = read(STDIN_FILENO, buf, BSIZE)) > 0) for (p = head; p; p = p->next) { n = rval; @@ -129,6 +147,21 @@ static void add(int fd, const char *name) { LIST *p; + cap_rights_t rights; + unsigned long cmd; + + if (fd == STDOUT_FILENO) + cap_rights_init(&rights, CAP_WRITE, CAP_FSTAT, CAP_IOCTL); + else + cap_rights_init(&rights, CAP_WRITE, CAP_FSTAT); + if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit rights"); + + if (fd == STDOUT_FILENO) { + cmd = TIOCGETA; + if (cap_ioctls_limit(fd, &cmd, 1) < 0 && errno != ENOSYS) + err(EXIT_FAILURE, "unable to limit ioctls for stdout"); + } if ((p = malloc(sizeof(LIST))) == NULL) err(1, "malloc"); From owner-svn-src-all@freebsd.org Sat Oct 22 14:00:13 2016 Return-Path: Delivered-To: svn-src-all@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 C6FF0C1CF23; Sat, 22 Oct 2016 14:00:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C871CAD; Sat, 22 Oct 2016 14:00:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::f9cd:eb1b:c961:7062] (unknown [IPv6:2001:7b8:3a7:0:f9cd:eb1b:c961:7062]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 330CF13609; Sat, 22 Oct 2016 16:00:10 +0200 (CEST) Content-Type: multipart/signed; boundary="Apple-Mail=_22889CC7-FD96-4BA8-83DC-1798341EBBA8"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r307756 - in head: include sys/sys From: Dimitry Andric In-Reply-To: <20161022000056.GC95989@spindle.one-eyed-alien.net> Date: Sat, 22 Oct 2016 16:00:01 +0200 Cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <0C5786D6-EB91-4762-9FAB-4C447EAB0AF8@FreeBSD.org> References: <201610212350.u9LNo2PT031675@repo.freebsd.org> <20161022000056.GC95989@spindle.one-eyed-alien.net> To: Brooks Davis X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 14:00:13 -0000 --Apple-Mail=_22889CC7-FD96-4BA8-83DC-1798341EBBA8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 22 Oct 2016, at 02:00, Brooks Davis wrote: >=20 > On Fri, Oct 21, 2016 at 11:50:02PM +0000, John Baldwin wrote: >> Author: jhb >> Date: Fri Oct 21 23:50:02 2016 >> New Revision: 307756 >> URL: https://svnweb.freebsd.org/changeset/base/307756 >>=20 >> Log: >> Define max_align_t for C11. >>=20 >> 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 . ... Modified: head/sys/sys/_types.h >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/sys/_types.h Fri Oct 21 21:55:50 2016 = (r307755) >> +++ head/sys/sys/_types.h Fri Oct 21 23:50:02 2016 = (r307756) >> @@ -100,6 +100,11 @@ typedef __uint_least32_t __char32_t; >> #define _CHAR32_T_DECLARED >> #endif >>=20 >> +typedef struct { >=20 > Should this be union per the commit message? You would be inclined to think so, but the strange way this is defined is only to be compatible with gcc's definition, which was introduced here in 2011: = https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/ginclude/stddef.h?r1=3D181048&r2= =3D181047&pathrev=3D181048 > Ideally I'd add a void * as well since that will support systems like > CHERI where pointers are the largest type. Is void * larger than a struct with long long and long double? I'd think this would be at least 128 bits on almost all architectures? In any case, if you want to change this definition, it is probably best to first check it with upstream gcc, otherwise you'll end up with an incompatibility. -Dimitry --Apple-Mail=_22889CC7-FD96-4BA8-83DC-1798341EBBA8 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlgLcOkACgkQsF6jCi4glqMwaQCfSjtamAUoC7N1raA1m4KXJQ/h MgcAn22khZQ9Ou3ozpMGSm6LJoqOAWcE =nXwd -----END PGP SIGNATURE----- --Apple-Mail=_22889CC7-FD96-4BA8-83DC-1798341EBBA8-- From owner-svn-src-all@freebsd.org Sat Oct 22 14:16:22 2016 Return-Path: Delivered-To: svn-src-all@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 C1EC0C1C329; Sat, 22 Oct 2016 14:16:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E7953A7; Sat, 22 Oct 2016 14:16:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::f9cd:eb1b:c961:7062] (unknown [IPv6:2001:7b8:3a7:0:f9cd:eb1b:c961:7062]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E58E91360B; Sat, 22 Oct 2016 16:16:19 +0200 (CEST) Content-Type: multipart/signed; boundary="Apple-Mail=_28DABD1C-67B4-437C-BECC-29ABA83694D3"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r307756 - in head: include sys/sys From: Dimitry Andric In-Reply-To: <0C5786D6-EB91-4762-9FAB-4C447EAB0AF8@FreeBSD.org> Date: Sat, 22 Oct 2016 16:16:10 +0200 Cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <6A32024C-BEAC-43FE-8581-CBCCCB1D1F34@FreeBSD.org> References: <201610212350.u9LNo2PT031675@repo.freebsd.org> <20161022000056.GC95989@spindle.one-eyed-alien.net> <0C5786D6-EB91-4762-9FAB-4C447EAB0AF8@FreeBSD.org> To: Brooks Davis X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 14:16:22 -0000 --Apple-Mail=_28DABD1C-67B4-437C-BECC-29ABA83694D3 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 22 Oct 2016, at 16:00, Dimitry Andric wrote: > > On 22 Oct 2016, at 02:00, Brooks Davis wrote: ... >> Ideally I'd add a void * as well since that will support systems like >> CHERI where pointers are the largest type. > > Is void * larger than a struct with long long and long double? I'd > think this would be at least 128 bits on almost all architectures? > > In any case, if you want to change this definition, it is probably best > to first check it with upstream gcc, otherwise you'll end up with an > incompatibility. For some more historic context, see this LLVM commit: http://llvm.org/viewvc/llvm-project?view=revision&revision=201729 ------------------------------------------------------------------------ r201729 | chandlerc | 2014-02-19 23:35:01 +0100 (Wed, 19 Feb 2014) | 20 lines Teach Clang to provide ::max_align_t in C11 and C++11 modes. This definition is not chosen idly. There is an unfortunate reality with max_align_t -- the specific nature of its definition leaks into the ABI almost immediately. Because it is part of C11 and C++11 it becomes essential for it to match with other systems on that ABI. There is an effort to discourage any further use of this construct as a consequence -- using max_align_t introduces an immediate ABI problem. We can never update it to have larger alignment even as the microarchitecture changes to necessitate higher alignment. =/ The particular definition here exactly matches the ABI of GCC's chosen ::max_align_t definition, for better or worse. This was written with the help of Richard Smith who was decoding the exact ABI implications of the selected definition in GCC. Notably, in-register arguments are impacted by the particular definition chosen. =/ No one is under the illusion that this is a "good" or "useful" definition of max_align_t, and we are working with the standards committee to specify a more useful interface to address this need. ------------------------------------------------------------------------ E.g., it is likely better to avoid using max_align_t altogether. -Dimitry --Apple-Mail=_28DABD1C-67B4-437C-BECC-29ABA83694D3 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlgLdLMACgkQsF6jCi4glqNbJwCdGNzIy5gP+W9jYFwmfdkYAfcF 2YEAn1hoQhtsgK4ak27sffE/LmOzG21h =RPfZ -----END PGP SIGNATURE----- --Apple-Mail=_28DABD1C-67B4-437C-BECC-29ABA83694D3-- From owner-svn-src-all@freebsd.org Sat Oct 22 14:37:15 2016 Return-Path: Delivered-To: svn-src-all@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 115B6C1C988; Sat, 22 Oct 2016 14:37:15 +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 D4DD710AE; Sat, 22 Oct 2016 14:37:14 +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 u9MEbDpl070112; Sat, 22 Oct 2016 14:37:13 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MEbDLR070111; Sat, 22 Oct 2016 14:37:13 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201610221437.u9MEbDLR070111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 22 Oct 2016 14:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307774 - head/lib/libusb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 14:37:15 -0000 Author: trasz Date: Sat Oct 22 14:37:13 2016 New Revision: 307774 URL: https://svnweb.freebsd.org/changeset/base/307774 Log: Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not "product vendor". This is consistent with how it's generally done. The ordering is visible eg in usbconfig(8) output. Note to self: MFC this to 9 and 8. Reviewed by: hselasky@ MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8258 Modified: head/lib/libusb/libusb20_ugen20.c Modified: head/lib/libusb/libusb20_ugen20.c ============================================================================== --- head/lib/libusb/libusb20_ugen20.c Sat Oct 22 13:20:02 2016 (r307773) +++ head/lib/libusb/libusb20_ugen20.c Sat Oct 22 14:37:13 2016 (r307774) @@ -214,8 +214,8 @@ ugen20_enumerate(struct libusb20_device snprintf(pdev->usb_desc, sizeof(pdev->usb_desc), USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number, - pdev->device_address, devinfo.udi_product, - devinfo.udi_vendor, pdev->bus_number); + pdev->device_address, devinfo.udi_vendor, + devinfo.udi_product, pdev->bus_number); error = 0; done: From owner-svn-src-all@freebsd.org Sat Oct 22 15:26:35 2016 Return-Path: Delivered-To: svn-src-all@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 011A9C1D792; Sat, 22 Oct 2016 15:26:35 +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 C26D3A72; Sat, 22 Oct 2016 15:26:34 +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 u9MFQXNt089053; Sat, 22 Oct 2016 15:26:33 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MFQWMo089042; Sat, 22 Oct 2016 15:26:32 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610221526.u9MFQWMo089042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 15:26: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: r307775 - in stable/11/sys: arm/broadcom/bcm2835 arm/conf arm/ti conf dev/evdev dev/usb/input modules modules/evdev modules/uinput X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 15:26:35 -0000 Author: gonzo Date: Sat Oct 22 15:26:32 2016 New Revision: 307775 URL: https://svnweb.freebsd.org/changeset/base/307775 Log: MFC r306530, r306531, r306532, r306579: r306530: Declare a module for evdev and add dependency to ukbd(4) and ums(4) Prepare for making evdev a module. "Pure" evdev device drivers (like touchscreen) and evdev itself can be built as a modules regardless of "options EVDEV" in kernel config. So if people does not require evdev functionality in hybrid drivers like ums and ukbd they can, for instance, kldload evdev and utouchscreen to run FreeBSD in kiosk mode. r306531: Add dependency to evdev module (if required) r306532: Add dependency to evdev module r306579: Modularize evdev - Convert "options EVDEV" to "device evdev" and "device uinput", add modules for both new devices. They are isolated subsystems and do not require any compile-time changes to general kernel subsytems - For hybrid drivers that have evdev as an optional way to deliver input events add option EVDEV_SUPPORT. Update all existing hybrid drivers to use it instead of EVDEV - Remove no-op DECLARE_MODULE in evdev, it's not required, MODULE_VERSION is enough - Add evdev module dependency to uinput Submitted by: Vladimir Kondratiev Added: stable/11/sys/modules/evdev/ - copied from r306579, head/sys/modules/evdev/ stable/11/sys/modules/uinput/ - copied from r306579, head/sys/modules/uinput/ Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c stable/11/sys/arm/conf/BEAGLEBONE stable/11/sys/arm/ti/ti_adc.c stable/11/sys/arm/ti/ti_adcvar.h stable/11/sys/conf/NOTES stable/11/sys/conf/options stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/uinput.c stable/11/sys/dev/usb/input/ukbd.c stable/11/sys/dev/usb/input/ums.c stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Sat Oct 22 15:26:32 2016 (r307775) @@ -335,3 +335,4 @@ static driver_t ft5406ts_driver = { }; DRIVER_MODULE(ft5406ts, ofwbus, ft5406ts_driver, ft5406ts_devclass, 0, 0); +MODULE_DEPEND(ft5406ts, evdev, 1, 1, 1); Modified: stable/11/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/11/sys/arm/conf/BEAGLEBONE Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/arm/conf/BEAGLEBONE Sat Oct 22 15:26:32 2016 (r307775) @@ -135,4 +135,4 @@ device ukbd device kbdmux # Uncomment to enable evdev support for ti_adc -# options EVDEV +# options EVDEV_SUPPORT Modified: stable/11/sys/arm/ti/ti_adc.c ============================================================================== --- stable/11/sys/arm/ti/ti_adc.c Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/arm/ti/ti_adc.c Sat Oct 22 15:26:32 2016 (r307775) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef EVDEV +#ifdef EVDEV_SUPPORT #include #include #endif @@ -89,7 +89,7 @@ static int ti_adc_samples[5] = { 0, 2, 4 static int ti_adc_detach(device_t dev); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT static void ti_adc_ev_report(struct ti_adc_softc *sc) { @@ -472,7 +472,7 @@ ti_adc_tsc_read_data(struct ti_adc_softc device_printf(sc->sc_dev, "touchscreen x: %d, y: %d\n", x, y); #endif -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if ((sc->sc_x != x) || (sc->sc_y != y)) { sc->sc_x = x; sc->sc_y = y; @@ -516,7 +516,7 @@ ti_adc_intr(void *arg) status |= ADC_IRQ_HW_PEN_ASYNC; ADC_WRITE4(sc, ADC_IRQENABLE_CLR, ADC_IRQ_HW_PEN_ASYNC); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT ti_adc_ev_report(sc); #endif } @@ -524,7 +524,7 @@ ti_adc_intr(void *arg) if (rawstatus & ADC_IRQ_PEN_UP) { sc->sc_pen_down = 0; status |= ADC_IRQ_PEN_UP; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT ti_adc_ev_report(sc); #endif } @@ -874,7 +874,7 @@ ti_adc_attach(device_t dev) ti_adc_setup(sc); TI_ADC_UNLOCK(sc); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_tsc_wires > 0) { sc->sc_evdev = evdev_alloc(); evdev_set_name(sc->sc_evdev, device_get_desc(dev)); @@ -921,7 +921,7 @@ ti_adc_detach(device_t dev) ti_adc_reset(sc); ti_adc_setup(sc); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT evdev_free(sc->sc_evdev); #endif @@ -958,3 +958,6 @@ static devclass_t ti_adc_devclass; DRIVER_MODULE(ti_adc, simplebus, ti_adc_driver, ti_adc_devclass, 0, 0); MODULE_VERSION(ti_adc, 1); MODULE_DEPEND(ti_adc, simplebus, 1, 1, 1); +#ifdef EVDEV_SUPPORT +MODULE_DEPEND(ti_adc, evdev, 1, 1, 1); +#endif Modified: stable/11/sys/arm/ti/ti_adcvar.h ============================================================================== --- stable/11/sys/arm/ti/ti_adcvar.h Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/arm/ti/ti_adcvar.h Sat Oct 22 15:26:32 2016 (r307775) @@ -55,7 +55,7 @@ struct ti_adc_softc { int sc_yn_bit, sc_yn_inp; uint32_t sc_tsc_enabled; int sc_pen_down; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT int sc_x; int sc_y; struct evdev_dev *sc_evdev; Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/conf/NOTES Sat Oct 22 15:26:32 2016 (r307775) @@ -3064,6 +3064,8 @@ options GZIO options BHND_LOGLEVEL # Logging threshold level # evdev interface -options EVDEV -options EVDEV_DEBUG -options UINPUT_DEBUG +device evdev # input event device support +options EVDEV_SUPPORT # evdev support in legacy drivers +options EVDEV_DEBUG # enable event debug msgs +device uinput # install /dev/uinput cdev +options UINPUT_DEBUG # enable uinput debug msgs Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/conf/options Sat Oct 22 15:26:32 2016 (r307775) @@ -988,6 +988,6 @@ BHND_LOGLEVEL opt_global.h GPIO_SPI_DEBUG opt_gpio.h # evdev protocol support -EVDEV opt_evdev.h +EVDEV_SUPPORT opt_evdev.h EVDEV_DEBUG opt_evdev.h UINPUT_DEBUG opt_evdev.h Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- stable/11/sys/dev/evdev/evdev.c Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/dev/evdev/evdev.c Sat Oct 22 15:26:32 2016 (r307775) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -916,3 +917,5 @@ evdev_stop_repeat(struct evdev_dev *evde evdev->ev_rep_key = KEY_RESERVED; } } + +MODULE_VERSION(evdev, 1); Modified: stable/11/sys/dev/evdev/uinput.c ============================================================================== --- stable/11/sys/dev/evdev/uinput.c Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/dev/evdev/uinput.c Sat Oct 22 15:26:32 2016 (r307775) @@ -708,3 +708,5 @@ uinput_modevent(module_t mod __unused, i } DEV_MODULE(uinput, uinput_modevent, NULL); +MODULE_VERSION(uinput, 1); +MODULE_DEPEND(uinput, evdev, 1, 1, 1); Modified: stable/11/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/11/sys/dev/usb/input/ukbd.c Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/dev/usb/input/ukbd.c Sat Oct 22 15:26:32 2016 (r307775) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #include -#ifdef EVDEV +#ifdef EVDEV_SUPPORT #include #include #endif @@ -168,7 +168,7 @@ struct ukbd_softc { struct usb_device *sc_udev; struct usb_interface *sc_iface; struct usb_xfer *sc_xfer[UKBD_N_TRANSFER]; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT struct evdev_dev *sc_evdev; #endif @@ -386,7 +386,7 @@ static device_attach_t ukbd_attach; static device_detach_t ukbd_detach; static device_resume_t ukbd_resume; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT static struct evdev_methods ukbd_evdev_methods = { .ev_event = evdev_ev_kbd_event, }; @@ -420,7 +420,7 @@ ukbd_put_key(struct ukbd_softc *sc, uint DPRINTF("0x%02x (%d) %s\n", key, key, (key & KEY_RELEASE) ? "released" : "pressed"); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) { evdev_push_event(sc->sc_evdev, EV_KEY, evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); @@ -941,7 +941,7 @@ ukbd_set_leds_callback(struct usb_xfer * if (!any) break; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_evdev != NULL) evdev_push_leds(sc->sc_evdev, sc->sc_leds); #endif @@ -1221,7 +1221,7 @@ ukbd_attach(device_t dev) usb_error_t err; uint16_t n; uint16_t hid_len; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT struct evdev_dev *evdev; int i; #endif @@ -1340,7 +1340,7 @@ ukbd_attach(device_t dev) } #endif -#ifdef EVDEV +#ifdef EVDEV_SUPPORT evdev = evdev_alloc(); evdev_set_name(evdev, device_get_desc(dev)); evdev_set_phys(evdev, device_get_nameunit(dev)); @@ -1441,7 +1441,7 @@ ukbd_detach(device_t dev) } #endif -#ifdef EVDEV +#ifdef EVDEV_SUPPORT evdev_free(sc->sc_evdev); #endif @@ -1976,7 +1976,7 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_lon else kbd->kb_delay1 = ((int *)arg)[0]; kbd->kb_delay2 = ((int *)arg)[1]; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_evdev != NULL) evdev_push_repeats(sc->sc_evdev, kbd); #endif @@ -2128,7 +2128,7 @@ ukbd_set_leds(struct ukbd_softc *sc, uin static int ukbd_set_typematic(keyboard_t *kbd, int code) { -#ifdef EVDEV +#ifdef EVDEV_SUPPORT struct ukbd_softc *sc = kbd->kb_data; #endif static const int delays[] = {250, 500, 750, 1000}; @@ -2142,7 +2142,7 @@ ukbd_set_typematic(keyboard_t *kbd, int } kbd->kb_delay1 = delays[(code >> 5) & 3]; kbd->kb_delay2 = rates[code & 0x1f]; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_evdev != NULL) evdev_push_repeats(sc->sc_evdev, kbd); #endif @@ -2297,5 +2297,8 @@ static driver_t ukbd_driver = { DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); MODULE_DEPEND(ukbd, usb, 1, 1, 1); +#ifdef EVDEV_SUPPORT +MODULE_DEPEND(ukbd, evdev, 1, 1, 1); +#endif MODULE_VERSION(ukbd, 1); USB_PNP_HOST_INFO(ukbd_devs); Modified: stable/11/sys/dev/usb/input/ums.c ============================================================================== --- stable/11/sys/dev/usb/input/ums.c Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/dev/usb/input/ums.c Sat Oct 22 15:26:32 2016 (r307775) @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); #include -#ifdef EVDEV +#ifdef EVDEV_SUPPORT #include #include #endif @@ -142,7 +142,7 @@ struct ums_softc { int sc_pollrate; int sc_fflags; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT int sc_evflags; #define UMS_EVDEV_OPENED 1 #endif @@ -151,7 +151,7 @@ struct ums_softc { uint8_t sc_iid; uint8_t sc_temp[64]; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT struct evdev_dev *sc_evdev; #endif }; @@ -170,7 +170,7 @@ static usb_fifo_open_t ums_fifo_open; static usb_fifo_close_t ums_fifo_close; static usb_fifo_ioctl_t ums_fifo_ioctl; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT static evdev_open_t ums_ev_open; static evdev_close_t ums_ev_close; #endif @@ -190,7 +190,7 @@ static struct usb_fifo_methods ums_fifo_ .basename[0] = "ums", }; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT static struct evdev_methods ums_evdev_methods = { .ev_open = &ums_ev_open, .ev_close = &ums_ev_close, @@ -357,7 +357,7 @@ ums_intr_callback(struct usb_xfer *xfer, tr_setup: /* check if we can put more data into the FIFO */ if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) == 0) { -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_evflags == 0) break; #else @@ -690,7 +690,7 @@ ums_attach(device_t dev) if (err) goto detach; -#ifdef EVDEV +#ifdef EVDEV_SUPPORT sc->sc_evdev = evdev_alloc(); evdev_set_name(sc->sc_evdev, device_get_desc(dev)); evdev_set_phys(sc->sc_evdev, device_get_nameunit(dev)); @@ -750,7 +750,7 @@ ums_detach(device_t self) usb_fifo_detach(&sc->sc_fifo); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT evdev_free(sc->sc_evdev); #endif @@ -892,7 +892,7 @@ ums_put_queue(struct ums_softc *sc, int3 usb_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf, sc->sc_mode.packetsize, 1); -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { /* Push evdev event */ evdev_push_event(sc->sc_evdev, EV_REL, REL_X, dx); @@ -919,7 +919,7 @@ ums_reset_buf(struct ums_softc *sc) usb_fifo_reset(sc->sc_fifo.fp[USB_FIFO_RX]); } -#ifdef EVDEV +#ifdef EVDEV_SUPPORT static int ums_ev_open(struct evdev_dev *evdev, void *ev_softc) { @@ -967,7 +967,7 @@ ums_fifo_open(struct usb_fifo *fifo, int return (EBUSY); /* check for first open */ -#ifdef EVDEV +#ifdef EVDEV_SUPPORT if (sc->sc_fflags == 0 && sc->sc_evflags == 0) ums_reset(sc); #else @@ -1199,5 +1199,8 @@ static driver_t ums_driver = { DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); MODULE_DEPEND(ums, usb, 1, 1, 1); +#ifdef EVDEV_SUPPORT +MODULE_DEPEND(ums, evdev, 1, 1, 1); +#endif MODULE_VERSION(ums, 1); USB_PNP_HOST_INFO(ums_devs); Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Sat Oct 22 14:37:13 2016 (r307774) +++ stable/11/sys/modules/Makefile Sat Oct 22 15:26:32 2016 (r307775) @@ -111,6 +111,7 @@ SUBDIR= \ ${_epic} \ esp \ ${_et} \ + evdev \ ${_ex} \ ${_exca} \ ext2fs \ @@ -373,6 +374,7 @@ SUBDIR= \ udf \ udf_iconv \ ufs \ + uinput \ unionfs \ urtwn \ ${_urtwnfw} \ From owner-svn-src-all@freebsd.org Sat Oct 22 16:24:13 2016 Return-Path: Delivered-To: svn-src-all@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 D050FC1CC93; Sat, 22 Oct 2016 16:24:13 +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 7B7B4D51; Sat, 22 Oct 2016 16:24:13 +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 u9MGOCUg011573; Sat, 22 Oct 2016 16:24:12 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MGOCnY011570; Sat, 22 Oct 2016 16:24:12 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610221624.u9MGOCnY011570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 16:24: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: r307776 - in stable/11/sys: arm/broadcom/bcm2835 arm/conf modules/rpi_ft5406 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 16:24:13 -0000 Author: gonzo Date: Sat Oct 22 16:24:12 2016 New Revision: 307776 URL: https://svnweb.freebsd.org/changeset/base/307776 Log: MFC r306618, r306619 r306618: Fix attach/detach methods - Initialize lock before starting worker process - Do not hold lock when destroying evdev. By that time ther should be no other active code pathes that can access softc r306619: Add rpi_ft5406 module and add it to extra modules in Raspberry Pi configs Added: stable/11/sys/modules/rpi_ft5406/ - copied from r306619, head/sys/modules/rpi_ft5406/ Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c stable/11/sys/arm/conf/RPI-B stable/11/sys/arm/conf/RPI2 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Sat Oct 22 15:26:32 2016 (r307775) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Sat Oct 22 16:24:12 2016 (r307776) @@ -288,13 +288,13 @@ ft5406ts_attach(device_t dev) sc->sc_init_hook.ich_func = ft5406ts_init; sc->sc_init_hook.ich_arg = sc; + FT5406_LOCK_INIT(sc); + if (config_intrhook_establish(&sc->sc_init_hook) != 0) { device_printf(dev, "config_intrhook_establish failed\n"); return (ENOMEM); } - FT5406_LOCK_INIT(sc); - return (0); } @@ -308,10 +308,11 @@ ft5406ts_detach(device_t dev) FT5406_LOCK(sc); if (sc->sc_worker) sc->sc_detaching = 1; + wakeup(sc); + FT5406_UNLOCK(sc); if (sc->sc_evdev) evdev_free(sc->sc_evdev); - FT5406_UNLOCK(sc); FT5406_LOCK_DESTROY(sc); Modified: stable/11/sys/arm/conf/RPI-B ============================================================================== --- stable/11/sys/arm/conf/RPI-B Sat Oct 22 15:26:32 2016 (r307775) +++ stable/11/sys/arm/conf/RPI-B Sat Oct 22 16:24:12 2016 (r307776) @@ -94,4 +94,4 @@ options FDT # Configure using FDT/DTB # handed to kernel via U-Boot and ubldr. #options FDT_DTB_STATIC #makeoptions FDT_DTS_FILE=rpi.dts -makeoptions MODULES_EXTRA=dtb/rpi +makeoptions MODULES_EXTRA="dtb/rpi rpi_ft5406" Modified: stable/11/sys/arm/conf/RPI2 ============================================================================== --- stable/11/sys/arm/conf/RPI2 Sat Oct 22 15:26:32 2016 (r307775) +++ stable/11/sys/arm/conf/RPI2 Sat Oct 22 16:24:12 2016 (r307776) @@ -98,4 +98,4 @@ options FDT # Configure using FDT/DTB # handed to kernel via U-Boot and ubldr. #options FDT_DTB_STATIC #makeoptions FDT_DTS_FILE=rpi2.dts -makeoptions MODULES_EXTRA=dtb/rpi +makeoptions MODULES_EXTRA="dtb/rpi rpi_ft5406" From owner-svn-src-all@freebsd.org Sat Oct 22 16:38:41 2016 Return-Path: Delivered-To: svn-src-all@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 75C96C1CFCC; Sat, 22 Oct 2016 16: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 3638E3AF; Sat, 22 Oct 2016 16: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 u9MGce7J015398; Sat, 22 Oct 2016 16:38:40 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MGcdXp015392; Sat, 22 Oct 2016 16:38:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610221638.u9MGcdXp015392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 16:38: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: r307777 - in stable/11/sys/dev: evdev usb/input X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 16:38:41 -0000 Author: gonzo Date: Sat Oct 22 16:38:39 2016 New Revision: 307777 URL: https://svnweb.freebsd.org/changeset/base/307777 Log: MFC r306647, r306855, r306857 r306647: const-ify struct evdev_methods Submitted by: Vladimir Kondratiev Suggested by: hselasky r306855: Allow using of driver's mutex instead internal one for evdev locking. Add new API call: evdev_register_mtx which takes lock argument that should be used instead of internal one for evdev locking. Useful for cases if evdev_push_event() is always called with driver's lock taken and reduces amount of lock aquisitions. This allows to avoid LOR between ev_open/ev_close invocations and evdev_push_event() Such LOR can happen when ev_open/ev_close methods acquire driver lock and evdev_push_event() is called with this lock taken. Submitted by: Vladimir Kondratiev r306857: Implement EVDEV_FLAG_MT_AUTOREL flag (autorelease touchpoints) Automaticaly release (send ABS_MT_TRACKING_ID = -1) MT-slots that has not been listed in current MT protocol type B report. Slot is counted as listed if corresponding ABS_MT_SLOT event has been sent regardless of other MT events. Events are sent on SYN_REPORT event. Submitted by: Vladimir Kondratiev Modified: stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/evdev.h stable/11/sys/dev/evdev/evdev_mt.c stable/11/sys/dev/evdev/evdev_private.h stable/11/sys/dev/usb/input/ukbd.c stable/11/sys/dev/usb/input/ums.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- stable/11/sys/dev/evdev/evdev.c Sat Oct 22 16:24:12 2016 (r307776) +++ stable/11/sys/dev/evdev/evdev.c Sat Oct 22 16:38:39 2016 (r307777) @@ -187,8 +187,8 @@ evdev_estimate_report_size(struct evdev_ return (size); } -int -evdev_register(struct evdev_dev *evdev) +static int +evdev_register_common(struct evdev_dev *evdev) { int ret; @@ -196,7 +196,6 @@ evdev_register(struct evdev_dev *evdev) evdev->ev_shortname, evdev->ev_name, evdev->ev_serial); /* Initialize internal structures */ - mtx_init(&evdev->ev_mtx, "evmtx", NULL, MTX_DEF); LIST_INIT(&evdev->ev_clients); if (evdev_event_supported(evdev, EV_REP) && @@ -228,6 +227,19 @@ evdev_register(struct evdev_dev *evdev) /* Create char device node */ ret = evdev_cdev_create(evdev); bail_out: + return (ret); +} + +int +evdev_register(struct evdev_dev *evdev) +{ + int ret; + + evdev->ev_lock_type = EV_LOCK_INTERNAL; + evdev->ev_lock = &evdev->ev_mtx; + mtx_init(&evdev->ev_mtx, "evmtx", NULL, MTX_DEF); + + ret = evdev_register_common(evdev); if (ret != 0) mtx_destroy(&evdev->ev_mtx); @@ -235,6 +247,15 @@ bail_out: } int +evdev_register_mtx(struct evdev_dev *evdev, struct mtx *mtx) +{ + + evdev->ev_lock_type = EV_LOCK_MTX; + evdev->ev_lock = mtx; + return (evdev_register_common(evdev)); +} + +int evdev_unregister(struct evdev_dev *evdev) { struct evdev_client *client; @@ -257,7 +278,7 @@ evdev_unregister(struct evdev_dev *evdev /* destroy_dev can sleep so release lock */ ret = evdev_cdev_destroy(evdev); evdev->ev_cdev = NULL; - if (ret == 0) + if (ret == 0 && evdev->ev_lock_type == EV_LOCK_INTERNAL) mtx_destroy(&evdev->ev_mtx); evdev_free_absinfo(evdev->ev_absinfo); @@ -302,7 +323,7 @@ evdev_set_serial(struct evdev_dev *evdev inline void evdev_set_methods(struct evdev_dev *evdev, void *softc, - struct evdev_methods *methods) + const struct evdev_methods *methods) { evdev->ev_methods = methods; @@ -665,6 +686,8 @@ evdev_sparse_event(struct evdev_dev *evd case EV_SYN: if (code == SYN_REPORT) { + /* Count empty reports as well as non empty */ + evdev->ev_report_count++; /* Skip empty reports */ if (!evdev->ev_report_opened) return (EV_SKIP_EVENT); @@ -701,10 +724,7 @@ evdev_propagate_event(struct evdev_dev * EVDEV_CLIENT_UNLOCKQ(client); } - /* Update counters */ evdev->ev_event_count++; - if (type == EV_SYN && code == SYN_REPORT) - evdev->ev_report_count++; } void @@ -735,16 +755,24 @@ evdev_push_event(struct evdev_dev *evdev int32_t value) { + if (evdev->ev_lock_type != EV_LOCK_INTERNAL) + EVDEV_LOCK_ASSERT(evdev); + if (evdev_check_event(evdev, type, code, value) != 0) return (EINVAL); - EVDEV_LOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_LOCK(evdev); evdev_modify_event(evdev, type, code, &value); + if (type == EV_SYN && code == SYN_REPORT && + bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL)) + evdev_send_mt_autorel(evdev); if (type == EV_SYN && code == SYN_REPORT && evdev->ev_report_opened && bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) evdev_send_mt_compat(evdev); evdev_send_event(evdev, type, code, value); - EVDEV_UNLOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_UNLOCK(evdev); return (0); } Modified: stable/11/sys/dev/evdev/evdev.h ============================================================================== --- stable/11/sys/dev/evdev/evdev.h Sat Oct 22 16:24:12 2016 (r307776) +++ stable/11/sys/dev/evdev/evdev.h Sat Oct 22 16:38:39 2016 (r307777) @@ -70,6 +70,8 @@ extern int evdev_rcpt_mask; #define EVDEV_FLAG_SOFTREPEAT 0x00 /* use evdev to repeat keys */ #define EVDEV_FLAG_MT_STCOMPAT 0x01 /* autogenerate ST-compatible events * for MT protocol type B reports */ +#define EVDEV_FLAG_MT_AUTOREL 0x02 /* Autorelease MT-slots not listed in + * current MT protocol type B report */ #define EVDEV_FLAG_MAX 0x1F #define EVDEV_FLAG_CNT (EVDEV_FLAG_MAX + 1) @@ -89,8 +91,10 @@ void evdev_set_name(struct evdev_dev *, void evdev_set_id(struct evdev_dev *, uint16_t, uint16_t, uint16_t, uint16_t); void evdev_set_phys(struct evdev_dev *, const char *); void evdev_set_serial(struct evdev_dev *, const char *); -void evdev_set_methods(struct evdev_dev *, void *, struct evdev_methods *); +void evdev_set_methods(struct evdev_dev *, void *, + const struct evdev_methods *); int evdev_register(struct evdev_dev *); +int evdev_register_mtx(struct evdev_dev *, struct mtx *); int evdev_unregister(struct evdev_dev *); int evdev_push_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); int evdev_sync(struct evdev_dev *); Modified: stable/11/sys/dev/evdev/evdev_mt.c ============================================================================== --- stable/11/sys/dev/evdev/evdev_mt.c Sat Oct 22 16:24:12 2016 (r307776) +++ stable/11/sys/dev/evdev/evdev_mt.c Sat Oct 22 16:38:39 2016 (r307777) @@ -112,6 +112,7 @@ void evdev_set_last_mt_slot(struct evdev_dev *evdev, int32_t slot) { + evdev->ev_mt->ev_mt_slots[slot].ev_report = evdev->ev_report_count; evdev->ev_mt->ev_mt_last_reported_slot = slot; } @@ -128,10 +129,6 @@ evdev_set_mt_value(struct evdev_dev *evd int32_t value) { - if (code == ABS_MT_TRACKING_ID && value == -1) - evdev->ev_mt->ev_mt_slots[slot].ev_report = - evdev->ev_report_count; - evdev->ev_mt->ev_mt_slots[slot].ev_mt_states[ABS_MT_INDEX(code)] = value; } @@ -227,9 +224,13 @@ void evdev_push_nfingers(struct evdev_dev *evdev, int32_t nfingers) { - EVDEV_LOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_LOCK(evdev); + else + EVDEV_LOCK_ASSERT(evdev); evdev_send_nfingers(evdev, nfingers); - EVDEV_UNLOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_UNLOCK(evdev); } void @@ -263,7 +264,29 @@ void evdev_push_mt_compat(struct evdev_dev *evdev) { - EVDEV_LOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_LOCK(evdev); + else + EVDEV_LOCK_ASSERT(evdev); evdev_send_mt_compat(evdev); - EVDEV_UNLOCK(evdev); + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + EVDEV_UNLOCK(evdev); +} + +void +evdev_send_mt_autorel(struct evdev_dev *evdev) +{ + int32_t slot; + + EVDEV_LOCK_ASSERT(evdev); + + for (slot = 0; slot <= MAXIMAL_MT_SLOT(evdev); slot++) { + if (evdev->ev_mt->ev_mt_slots[slot].ev_report != + evdev->ev_report_count && + evdev_get_mt_value(evdev, slot, ABS_MT_TRACKING_ID) != -1){ + evdev_send_event(evdev, EV_ABS, ABS_MT_SLOT, slot); + evdev_send_event(evdev, EV_ABS, ABS_MT_TRACKING_ID, + -1); + } + } } Modified: stable/11/sys/dev/evdev/evdev_private.h ============================================================================== --- stable/11/sys/dev/evdev/evdev_private.h Sat Oct 22 16:24:12 2016 (r307776) +++ stable/11/sys/dev/evdev/evdev_private.h Sat Oct 22 16:38:39 2016 (r307777) @@ -71,6 +71,12 @@ enum evdev_clock_id EV_CLOCK_BOOTTIME /* monotonic, suspend-awared */ }; +enum evdev_lock_type +{ + EV_LOCK_INTERNAL = 0, /* Internal evdev mutex */ + EV_LOCK_MTX, /* Driver`s mutex */ +}; + struct evdev_dev { char ev_name[NAMELEN]; @@ -78,6 +84,8 @@ struct evdev_dev char ev_serial[NAMELEN]; struct cdev * ev_cdev; int ev_unit; + enum evdev_lock_type ev_lock_type; + struct mtx * ev_lock; struct mtx ev_mtx; struct input_id ev_id; struct evdev_client * ev_grabber; @@ -116,16 +124,16 @@ struct evdev_dev uint64_t ev_report_count; /* Parent driver callbacks: */ - struct evdev_methods * ev_methods; + const struct evdev_methods * ev_methods; void * ev_softc; LIST_ENTRY(evdev_dev) ev_link; LIST_HEAD(, evdev_client) ev_clients; }; -#define EVDEV_LOCK(evdev) mtx_lock(&(evdev)->ev_mtx) -#define EVDEV_UNLOCK(evdev) mtx_unlock(&(evdev)->ev_mtx) -#define EVDEV_LOCK_ASSERT(evdev) mtx_assert(&(evdev)->ev_mtx, MA_OWNED) +#define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock) +#define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock) +#define EVDEV_LOCK_ASSERT(evdev) mtx_assert((evdev)->ev_lock, MA_OWNED) struct evdev_client { @@ -184,6 +192,7 @@ void evdev_set_last_mt_slot(struct evdev int32_t evdev_get_mt_value(struct evdev_dev *, int32_t, int16_t); void evdev_set_mt_value(struct evdev_dev *, int32_t, int16_t, int32_t); void evdev_send_mt_compat(struct evdev_dev *); +void evdev_send_mt_autorel(struct evdev_dev *); /* Utility functions: */ void evdev_client_dumpqueue(struct evdev_client *); Modified: stable/11/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/11/sys/dev/usb/input/ukbd.c Sat Oct 22 16:24:12 2016 (r307776) +++ stable/11/sys/dev/usb/input/ukbd.c Sat Oct 22 16:38:39 2016 (r307777) @@ -387,7 +387,7 @@ static device_detach_t ukbd_detach; static device_resume_t ukbd_resume; #ifdef EVDEV_SUPPORT -static struct evdev_methods ukbd_evdev_methods = { +static const struct evdev_methods ukbd_evdev_methods = { .ev_event = evdev_ev_kbd_event, }; #endif Modified: stable/11/sys/dev/usb/input/ums.c ============================================================================== --- stable/11/sys/dev/usb/input/ums.c Sat Oct 22 16:24:12 2016 (r307776) +++ stable/11/sys/dev/usb/input/ums.c Sat Oct 22 16:38:39 2016 (r307777) @@ -191,7 +191,7 @@ static struct usb_fifo_methods ums_fifo_ }; #ifdef EVDEV_SUPPORT -static struct evdev_methods ums_evdev_methods = { +static const struct evdev_methods ums_evdev_methods = { .ev_open = &ums_ev_open, .ev_close = &ums_ev_close, }; From owner-svn-src-all@freebsd.org Sat Oct 22 16:42:50 2016 Return-Path: Delivered-To: svn-src-all@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 A0190C1D1F5; Sat, 22 Oct 2016 16:42:50 +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 60557AB8; Sat, 22 Oct 2016 16:42:50 +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 u9MGgnDB019086; Sat, 22 Oct 2016 16:42:49 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MGgnQF019085; Sat, 22 Oct 2016 16:42:49 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610221642.u9MGgnQF019085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 16: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: r307778 - stable/11/sys/arm/broadcom/bcm2835 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 16:42:50 -0000 Author: gonzo Date: Sat Oct 22 16:42:49 2016 New Revision: 307778 URL: https://svnweb.freebsd.org/changeset/base/307778 Log: MFC r306860: Add multitouch support for RPi's FT5406 - Add multitouch support (protocol B) - Report physical size of the screen - Switch from using busy loop to callbacks - Enable callbacks only when there is active listener on /dev/input/eventX Submitted by: Vladimir Kondratiev Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Sat Oct 22 16:38:39 2016 (r307777) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c Sat Oct 22 16:42:49 2016 (r307778) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -102,14 +101,20 @@ __FBSDID("$FreeBSD$"); (buf[FT5406_POINT_YL(n)])) #define GET_TOUCH_ID(buf, n) ((buf[FT5406_POINT_YH(n)] >> 4) & 0xf) -#define NO_POINTS 99 -#define SCREEN_WIDTH 800 -#define SCREEN_HEIGHT 480 +#define NO_POINTS 99 +#define SCREEN_WIDTH 800 +#define SCREEN_HEIGHT 480 +#define SCREEN_WIDTH_MM 155 +#define SCREEN_HEIGHT_MM 86 +#define SCREEN_RES_X (SCREEN_WIDTH / SCREEN_WIDTH_MM) +#define SCREEN_RES_Y (SCREEN_HEIGHT / SCREEN_HEIGHT_MM) +#define MAX_TOUCH_ID (10 - 1) struct ft5406ts_softc { device_t sc_dev; struct mtx sc_mtx; - struct proc *sc_worker; + int sc_tick; + struct callout sc_callout; /* mbox buffer (mapped to KVA) */ uint8_t *touch_buf; @@ -118,86 +123,76 @@ struct ft5406ts_softc { struct intr_config_hook sc_init_hook; struct evdev_dev *sc_evdev; - int sc_detaching; + + uint8_t sc_window[FT5406_WINDOW_SIZE]; +}; + +static evdev_open_t ft5406ts_ev_open; +static evdev_close_t ft5406ts_ev_close; + +static const struct evdev_methods ft5406ts_evdev_methods = { + .ev_open = &ft5406ts_ev_open, + .ev_close = &ft5406ts_ev_close, }; static void -ft5406ts_worker(void *data) +ft5406ts_callout(void *data) { struct ft5406ts_softc *sc = (struct ft5406ts_softc *)data; int points; - int id, new_x, new_y, i, new_pen_down, updated; - int x, y, pen_down; - uint8_t window[FT5406_WINDOW_SIZE]; - int tick; + int id, i, x, y; - /* 60Hz */ - tick = hz*17/1000; - if (tick == 0) - tick = 1; - - x = y = -1; - pen_down = 0; - - FT5406_LOCK(sc); - while(1) { - msleep(sc, &sc->sc_mtx, PCATCH | PZERO, "ft5406ts", tick); - - if (sc->sc_detaching) - break; - - memcpy(window, sc->touch_buf, sizeof(window)); - sc->touch_buf[FT5406_NUM_POINTS] = NO_POINTS; - - points = GET_NUM_POINTS(window); - /* - * No update from VC - do nothing - */ - if (points == NO_POINTS) - continue; + FT5406_LOCK_ASSERT(sc); - /* No points and pen is already up */ - if ((points == 0) && !pen_down) - continue; + memcpy(sc->sc_window, sc->touch_buf, FT5406_WINDOW_SIZE); + sc->touch_buf[FT5406_NUM_POINTS] = NO_POINTS; - new_pen_down = 0; - for (i = 0; i < points; i++) { - id = GET_TOUCH_ID(window, 0); - /* For now consider only touch 0 */ - if (id != 0) - continue; - new_pen_down = 1; - new_x = GET_X(window, 0); - new_y = GET_Y(window, 0); + points = GET_NUM_POINTS(sc->sc_window); + /* + * No update from VC - do nothing. + */ + if (points == NO_POINTS) + goto out; + + for (i = 0; i < points; i++) { + id = GET_TOUCH_ID(sc->sc_window, i); + x = GET_X(sc->sc_window, i); + y = GET_Y(sc->sc_window, i); + + if (id > MAX_TOUCH_ID) { + device_printf(sc->sc_dev, "bad touch id: %d", id); + continue; } + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_MT_SLOT, id); + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_MT_TRACKING_ID, id); + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_MT_POSITION_X, x); + evdev_push_event(sc->sc_evdev, EV_ABS, ABS_MT_POSITION_Y, y); + } + evdev_sync(sc->sc_evdev); +out: + callout_reset(&sc->sc_callout, sc->sc_tick, ft5406ts_callout, sc); +} - updated = 0; +static void +ft5406ts_ev_close(struct evdev_dev *evdev, void *data) +{ + struct ft5406ts_softc *sc = (struct ft5406ts_softc *)data; - if (new_x != x) { - x = new_x; - updated = 1; - } + FT5406_LOCK_ASSERT(sc); - if (new_y != y) { - y = new_y; - updated = 1; - } + callout_stop(&sc->sc_callout); +} - if (new_pen_down != pen_down) { - pen_down = new_pen_down; - updated = 1; - } +static int +ft5406ts_ev_open(struct evdev_dev *evdev, void *data) +{ + struct ft5406ts_softc *sc = (struct ft5406ts_softc *)data; - if (updated) { - evdev_push_event(sc->sc_evdev, EV_ABS, ABS_X, x); - evdev_push_event(sc->sc_evdev, EV_ABS, ABS_Y, y); - evdev_push_event(sc->sc_evdev, EV_KEY, BTN_TOUCH, pen_down); - evdev_sync(sc->sc_evdev); - } - } - FT5406_UNLOCK(sc); + FT5406_LOCK_ASSERT(sc); - kproc_exit(0); + callout_reset(&sc->sc_callout, sc->sc_tick, ft5406ts_callout, sc); + + return (0); } static void @@ -234,33 +229,40 @@ ft5406ts_init(void *arg) touchbuf = VCBUS_TO_PHYS(msg.body.resp.address); sc->touch_buf = (uint8_t*)pmap_mapdev(touchbuf, FT5406_WINDOW_SIZE); + /* 60Hz */ + sc->sc_tick = hz * 17 / 1000; + if (sc->sc_tick == 0) + sc->sc_tick = 1; + sc->sc_evdev = evdev_alloc(); evdev_set_name(sc->sc_evdev, device_get_desc(sc->sc_dev)); evdev_set_phys(sc->sc_evdev, device_get_nameunit(sc->sc_dev)); - evdev_set_id(sc->sc_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_set_id(sc->sc_evdev, BUS_HOST, 0, 0, 0); + evdev_set_methods(sc->sc_evdev, sc, &ft5406ts_evdev_methods); + evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_STCOMPAT); + evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_AUTOREL); evdev_support_prop(sc->sc_evdev, INPUT_PROP_DIRECT); evdev_support_event(sc->sc_evdev, EV_SYN); evdev_support_event(sc->sc_evdev, EV_ABS); - evdev_support_event(sc->sc_evdev, EV_KEY); - evdev_support_abs(sc->sc_evdev, ABS_X, 0, 0, - SCREEN_WIDTH, 0, 0, 0); - evdev_support_abs(sc->sc_evdev, ABS_Y, 0, 0, - SCREEN_HEIGHT, 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_MT_SLOT, 0, 0, + MAX_TOUCH_ID, 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_MT_TRACKING_ID, 0, -1, + MAX_TOUCH_ID, 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_MT_POSITION_X, 0, 0, + SCREEN_WIDTH, 0, 0, SCREEN_RES_X); + evdev_support_abs(sc->sc_evdev, ABS_MT_POSITION_Y, 0, 0, + SCREEN_HEIGHT, 0, 0, SCREEN_RES_Y); - evdev_support_key(sc->sc_evdev, BTN_TOUCH); - - err = evdev_register(sc->sc_evdev); + err = evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx); if (err) { evdev_free(sc->sc_evdev); + sc->sc_evdev = NULL; /* Avoid double free */ return; } sc->touch_buf[FT5406_NUM_POINTS] = NO_POINTS; - if (kproc_create(ft5406ts_worker, (void*)sc, &sc->sc_worker, 0, 0, - "ft5406ts_worker") != 0) { - printf("failed to create ft5406ts_worker\n"); - } + callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0); } static int @@ -292,6 +294,7 @@ ft5406ts_attach(device_t dev) if (config_intrhook_establish(&sc->sc_init_hook) != 0) { device_printf(dev, "config_intrhook_establish failed\n"); + FT5406_LOCK_DESTROY(sc); return (ENOMEM); } @@ -305,14 +308,7 @@ ft5406ts_detach(device_t dev) sc = device_get_softc(dev); - FT5406_LOCK(sc); - if (sc->sc_worker) - sc->sc_detaching = 1; - wakeup(sc); - FT5406_UNLOCK(sc); - - if (sc->sc_evdev) - evdev_free(sc->sc_evdev); + evdev_free(sc->sc_evdev); FT5406_LOCK_DESTROY(sc); From owner-svn-src-all@freebsd.org Sat Oct 22 17:21:23 2016 Return-Path: Delivered-To: svn-src-all@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 3AF9BC1DB84; Sat, 22 Oct 2016 17:21:23 +0000 (UTC) (envelope-from tuexen@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 06247EC1; Sat, 22 Oct 2016 17:21:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MHLMcU033959; Sat, 22 Oct 2016 17:21:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MHLMMa033957; Sat, 22 Oct 2016 17:21:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201610221721.u9MHLMMa033957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 22 Oct 2016 17:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307779 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 17:21:23 -0000 Author: tuexen Date: Sat Oct 22 17:21:21 2016 New Revision: 307779 URL: https://svnweb.freebsd.org/changeset/base/307779 Log: No functional changes, mostly getting the whitespace changes resulting from an updated formatting tool chain. MFC after: 1 month Modified: head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Sat Oct 22 16:42:49 2016 (r307778) +++ head/sys/netinet/sctp_bsd_addr.c Sat Oct 22 17:21:21 2016 (r307779) @@ -140,7 +140,6 @@ sctp_gather_internal_ifa_flags(struct sc ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; } } - #endif /* INET6 */ @@ -201,10 +200,8 @@ sctp_init_ifns_for_vrf(int vrfid) struct ifaddr *ifa; struct sctp_ifa *sctp_ifa; uint32_t ifa_flags; - #ifdef INET6 struct in6_ifaddr *ifa6; - #endif IFNET_RLOCK(); Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Oct 22 16:42:49 2016 (r307778) +++ head/sys/netinet/sctp_output.c Sat Oct 22 17:21:21 2016 (r307779) @@ -1943,7 +1943,6 @@ sctp_add_addr_to_mbuf(struct mbuf *m, st struct sctp_paramhdr *parmh; struct mbuf *mret; uint16_t plen; - #endif switch (ifa->address.sa.sa_family) { @@ -2139,10 +2138,8 @@ skip_count: cnt++; total_count++; if (cnt >= 2) { - /* - * two from each - * address - */ + /* two from each + * address */ break; } if (total_count > SCTP_ADDRESS_LIMIT) { @@ -2784,7 +2781,6 @@ sctp_select_nth_preferred_addr_from_ifn_ { struct sctp_ifa *ifa, *sifa; int num_eligible_addr = 0; - #ifdef INET6 struct sockaddr_in6 sin6, lsa6; @@ -2829,10 +2825,8 @@ sctp_select_nth_preferred_addr_from_ifn_ if (fam == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&sifa->address.sin6.sin6_addr) && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* - * link-local <-> link-local must belong to the same - * scope. - */ + /* link-local <-> link-local must belong to the same + * scope. */ memcpy(&lsa6, &sifa->address.sin6, sizeof(struct sockaddr_in6)); (void)sa6_recoverscope(&lsa6); if (sin6.sin6_scope_id != lsa6.sin6_scope_id) { @@ -2966,10 +2960,8 @@ sctp_choose_boundall(struct sctp_inpcb * struct sctp_ifa *sctp_ifa, *sifa; uint32_t ifn_index; struct sctp_vrf *vrf; - #ifdef INET int retried = 0; - #endif /*- @@ -3315,14 +3307,11 @@ sctp_source_address_selection(struct sct struct sctp_ifa *answer; uint8_t dest_is_priv, dest_is_loop; sa_family_t fam; - #ifdef INET struct sockaddr_in *to = (struct sockaddr_in *)&ro->ro_dst; - #endif #ifdef INET6 struct sockaddr_in6 *to6 = (struct sockaddr_in6 *)&ro->ro_dst; - #endif /** @@ -3570,14 +3559,11 @@ sctp_process_cmsgs_for_init(struct sctp_ struct cmsghdr cmh; int tlen, at; struct sctp_initmsg initmsg; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif tlen = SCTP_BUF_LEN(control); @@ -3618,10 +3604,8 @@ sctp_process_cmsgs_for_init(struct sctp_ if (stcb->asoc.streamoutcnt < stcb->asoc.pre_open_streams) { struct sctp_stream_out *tmp_str; unsigned int i; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif /* Default is NOT correct */ @@ -3744,14 +3728,11 @@ sctp_findassociation_cmsgs(struct sctp_i int tlen, at; struct sctp_tcb *stcb; struct sockaddr *addr; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif tlen = SCTP_BUF_LEN(control); @@ -3970,7 +3951,6 @@ sctp_handle_no_route(struct sctp_tcb *st } } } - #endif static int @@ -4016,22 +3996,17 @@ sctp_lowlevel_chunk_output(struct sctp_i struct sctphdr *sctphdr; int packet_length; int ret; - #if defined(INET) || defined(INET6) uint32_t vrf_id; - #endif #if defined(INET) || defined(INET6) struct mbuf *o_pak; sctp_route_t *ro = NULL; struct udphdr *udp = NULL; - #endif uint8_t tos_value; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so = NULL; - #endif if ((net) && (net->dest_state & SCTP_ADDR_OUT_OF_SCOPE)) { @@ -4289,10 +4264,8 @@ sctp_lowlevel_chunk_output(struct sctp_i /* free tempy routes */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ + /* PMTU check versus smallest asoc MTU goes + * here */ if ((ro->ro_rt != NULL) && (net->ro._s_addr)) { uint32_t mtu; @@ -4567,10 +4540,8 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT3, (struct sockaddr *)sin6); if (net) { sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; - /* - * preserve the port and scope for link - * local send - */ + /* preserve the port and scope for link + * local send */ prev_scope = sin6->sin6_scope_id; prev_port = sin6->sin6_port; } @@ -4636,10 +4607,8 @@ sctp_lowlevel_chunk_output(struct sctp_i /* Now if we had a temp route free it */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ + /* PMTU check versus smallest asoc MTU goes + * here */ if (ro->ro_rt == NULL) { /* Route was freed */ if (net->ro._s_addr && @@ -4969,11 +4938,11 @@ sctp_arethere_unrecognized_parameters(st * being equal to the beginning of the params i.e. (iphlen + * sizeof(struct sctp_init_msg) parse through the parameters to the * end of the mbuf verifying that all parameters are known. - * + * * For unknown parameters build and return a mbuf with * UNRECOGNIZED_PARAMETER errors. If the flags indicate to stop * processing this chunk stop, and set *abort_processing to 1. - * + * * By having param_offset be pre-set to where parameters begin it is * hoped that this routine may be reused in the future by new * features. @@ -5260,7 +5229,6 @@ invalid_size: *abort_processing = 1; if ((op_err == NULL) && phdr) { int l_len; - #ifdef INET6 l_len = SCTP_MIN_OVERHEAD; #else @@ -5318,14 +5286,11 @@ sctp_are_there_new_addresses(struct sctp uint8_t fnd; struct sctp_nets *net; int check_src; - #ifdef INET struct sockaddr_in sin4, *sa4; - #endif #ifdef INET6 struct sockaddr_in6 sin6, *sa6; - #endif #ifdef INET @@ -5509,18 +5474,15 @@ sctp_send_initiate_ack(struct sctp_inpcb struct sctp_paramhdr *ph; union sctp_sockstore *over_addr; struct sctp_scoping scp; - #ifdef INET struct sockaddr_in *dst4 = (struct sockaddr_in *)dst; struct sockaddr_in *src4 = (struct sockaddr_in *)src; struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *dst6 = (struct sockaddr_in6 *)dst; struct sockaddr_in6 *src6 = (struct sockaddr_in6 *)src; struct sockaddr_in6 *sin6; - #endif struct sockaddr *to; struct sctp_state_cookie stc; @@ -5544,10 +5506,10 @@ sctp_send_initiate_ack(struct sctp_inpcb /* * new addresses, out of here in non-cookie-wait * states - * - * Send an ABORT, without the new address error cause. - * This looks no different than if no listener was - * present. + * + * Send an ABORT, without the new address error + * cause. This looks no different than if no + * listener was present. */ op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); @@ -5560,9 +5522,9 @@ sctp_send_initiate_ack(struct sctp_inpcb /* * change of remote encapsulation port, out of here * in non-cookie-wait states - * - * Send an ABORT, without an specific error cause. This - * looks no different than if no listener was + * + * Send an ABORT, without an specific error cause. + * This looks no different than if no listener was * present. */ op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -5716,10 +5678,8 @@ do_a_abort: * show up in our scoped count. */ cnt_inits_to = 1; - /* - * pull out the scope_id from - * incoming pkt - */ + /* pull out the scope_id from + * incoming pkt */ } else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr) || IN6_IS_ADDR_SITELOCAL(&dst6->sin6_addr)) { /* @@ -5744,7 +5704,6 @@ do_a_abort: #ifdef INET6 struct sctp_nets *lnet; - #endif stc.loopback_scope = asoc->scope.loopback_scope; @@ -6206,9 +6165,9 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* if chunk was present */ - } /* if of sufficient priority */ - } /* if chunk has enabled */ + } /* if chunk was present */ + } /* if of sufficient priority */ + } /* if chunk has enabled */ } /* tailqforeach */ TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { @@ -6229,11 +6188,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* end if chk->data */ - } /* end if right class */ - } /* end if chk pr-sctp */ + } /* end if chk->data */ + } /* end if right class */ + } /* end if chk pr-sctp */ } /* tailqforeachsafe (chk) */ - } /* if enabled in asoc */ + } /* if enabled in asoc */ } int @@ -6476,10 +6435,8 @@ error_out: /* get the prepend space */ SCTP_BUF_RESV_UF(outchain, (SCTP_FIRST_MBUF_RESV + 4)); } else { - /* - * We really should not get a NULL - * in endofchain - */ + /* We really should not get a NULL + * in endofchain */ /* find end */ m = outchain; while (m) { @@ -6491,10 +6448,8 @@ error_out: } /* sanity */ if (*endofchain == NULL) { - /* - * huh, TSNH XXX maybe we - * should panic - */ + /* huh, TSNH XXX maybe we + * should panic */ sctp_m_freem(outchain); goto new_mbuf; } @@ -6693,17 +6648,13 @@ sctp_sendall_iterator(struct sctp_inpcb if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { goto abort_anyway; } - /* - * there is nothing queued to send, so I'm - * done... - */ + /* there is nothing queued to send, so I'm + * done... */ if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { - /* - * only send SHUTDOWN the first time - * through - */ + /* only send SHUTDOWN the first time + * through */ if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } @@ -7334,10 +7285,8 @@ re_look: SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; if (sp->msg_is_complete) { - /* - * the sender finished the - * msg - */ + /* the sender finished the + * msg */ goto re_look; } } @@ -7955,9 +7904,9 @@ nothing_to_send: * (when CMT is off) then it calls * sctp_fill_outqueue for the net. This gets data on * the send queue for that network. - * - * In sctp_fill_outqueue TSN's are assigned and data is - * copied out of the stream buffers. Note mostly + * + * In sctp_fill_outqueue TSN's are assigned and data + * is copied out of the stream buffers. Note mostly * copy by reference (we hope). */ net->window_probe = 0; @@ -8226,10 +8175,8 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* - * error, we could not - * output - */ + /* error, we could not + * output */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8302,16 +8249,12 @@ again_one_more_time: * to where the sack is going.. */ if (chk->whoTo == net) { - /* - * Don't transmit it to where its - * going (current net) - */ + /* Don't transmit it to where its + * going (current net) */ continue; } else if (sack_goes_to == net) { - /* - * But do transmit it to this - * address - */ + /* But do transmit it to this + * address */ goto skip_net_check; } } @@ -8504,10 +8447,8 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* - * error, we could not - * output - */ + /* error, we could not + * output */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8704,17 +8645,13 @@ again_one_more_time: override_ok = 0; SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } else if (override_ok) { - /* - * use this data's - * keyid - */ + /* use this data's + * keyid */ auth_keyid = chk->auth_keyid; override_ok = 0; } else if (auth_keyid != chk->auth_keyid) { - /* - * different keyid, - * so done bundling - */ + /* different keyid, + * so done bundling */ break; } } @@ -8793,8 +8730,7 @@ again_one_more_time: break; } } /* for (chunk gather loop for this net) */ - } /* if asoc.state OPEN */ -no_data_fill: +} /* if asoc.state OPEN */ no_data_fill: /* Is there something to send for this destination? */ if (outchain) { /* We may need to start a control timer or two */ @@ -9734,10 +9670,8 @@ one_chunk_around: auth_keyid = fwd->auth_keyid; override_ok = 0; } else if (fwd->auth_keyid != auth_keyid) { - /* - * different keyid, - * so done bundling - */ + /* different keyid, + * so done bundling */ break; } } @@ -10113,11 +10047,9 @@ do_it_again: if (asoc->max_burst > 0) { if (SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst)) { if ((net->flight_size + (asoc->max_burst * net->mtu)) < net->cwnd) { - /* - * JRS - Use the congestion + /* JRS - Use the congestion * control given in the - * congestion control module - */ + * congestion control module */ asoc->cc_functions.sctp_cwnd_update_after_output(stcb, net, asoc->max_burst); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLE) { sctp_log_maxburst(stcb, net, 0, asoc->max_burst, SCTP_MAX_BURST_APPLIED); @@ -10127,10 +10059,8 @@ do_it_again: net->fast_retran_ip = 0; } else { if (net->flight_size == 0) { - /* - * Should be decaying the - * cwnd here - */ + /* Should be decaying the + * cwnd here */ ; } } @@ -11017,23 +10947,18 @@ sctp_send_resp_msg(struct sockaddr *src, struct mbuf *mout; struct sctphdr *shout; struct sctp_chunkhdr *ch; - #if defined(INET) || defined(INET6) struct udphdr *udp; int ret; - #endif int len, cause_len, padding_len; - #ifdef INET struct sockaddr_in *src_sin, *dst_sin; struct ip *ip; - #endif #ifdef INET6 struct sockaddr_in6 *src_sin6, *dst_sin6; struct ip6_hdr *ip6; - #endif /* Compute the length of the cause and add final padding. */ @@ -11622,10 +11547,8 @@ sctp_send_cwr(struct sctp_tcb *stcb, str asoc = &stcb->asoc; TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) { - /* - * found a previous CWR queued to same destination - * update it if needed - */ + /* found a previous CWR queued to same destination + * update it if needed */ uint32_t ctsn; cwr = mtod(chk->data, struct sctp_cwr_chunk *); @@ -12169,10 +12092,8 @@ sctp_send_str_reset_req(struct sctp_tcb struct sctp_stream_out *oldstream; struct sctp_stream_queue_pending *sp, *nsp; int i; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif oldstream = stcb->asoc.strmout; @@ -12204,10 +12125,8 @@ sctp_send_str_reset_req(struct sctp_tcb stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ - /* - * This should be a SS_COPY operation FIX ME STREAM - * SCHEDULER EXPERT - */ + /* This should be a SS_COPY operation FIX ME STREAM + * SCHEDULER EXPERT */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { @@ -12451,10 +12370,8 @@ sctp_sosend(struct socket *so, int error, use_sndinfo = 0; struct sctp_sndrcvinfo sndrcvninfo; struct sockaddr *addr_to_use; - #if defined(INET) && defined(INET6) struct sockaddr_in sin; - #endif if (control) { @@ -12739,10 +12656,8 @@ sctp_lower_sosend(struct socket *so, } if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* - * Set the connected flag so we can queue - * data - */ + /* Set the connected flag so we can queue + * data */ soisconnecting(so); } hold_tcblock = 1; @@ -12752,10 +12667,8 @@ sctp_lower_sosend(struct socket *so, } else { SCTP_PRINTF("Huh-3? create lock should have been on??\n"); } - /* - * Turn on queue only flag to prevent data from - * being sent - */ + /* Turn on queue only flag to prevent data from + * being sent */ queue_only = 1; asoc = &stcb->asoc; SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); @@ -13248,10 +13161,8 @@ skip_preblock: } /* PR-SCTP? */ if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { - /* - * This is ugly but we must assure locking - * order - */ + /* This is ugly but we must assure locking + * order */ if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); hold_tcblock = 1; @@ -13528,10 +13439,8 @@ dataless_eof: msg); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_LOCKED); - /* - * now relock the stcb so everything - * is sane - */ + /* now relock the stcb so everything + * is sane */ hold_tcblock = 0; stcb = NULL; goto out; @@ -13605,10 +13514,8 @@ skip_out_eof: if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) { /* we can attempt to send too. */ if (hold_tcblock == 0) { - /* - * If there is activity recv'ing sacks no need to - * send - */ + /* If there is activity recv'ing sacks no need to + * send */ if (SCTP_TCB_TRYLOCK(stcb)) { sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED); hold_tcblock = 1; @@ -13776,10 +13683,9 @@ sctp_v6src_match_nexthop(struct sockaddr SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)&gw6); SCTPDBG(SCTP_DEBUG_OUTPUT2, "installed router is "); SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, ro->ro_rt->rt_gateway); - if (sctp_cmpaddr((struct sockaddr *)&gw6, - ro->ro_rt->rt_gateway)) { - SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is installed\n"); + if (sctp_cmpaddr((struct sockaddr *)&gw6, ro->ro_rt->rt_gateway)) { ND6_RUNLOCK(); + SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is installed\n"); return (1); } } @@ -13787,7 +13693,6 @@ sctp_v6src_match_nexthop(struct sockaddr SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is not installed\n"); return (0); } - #endif int From owner-svn-src-all@freebsd.org Sat Oct 22 18:02:22 2016 Return-Path: Delivered-To: svn-src-all@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 1FA75C1D5A1; Sat, 22 Oct 2016 18:02:22 +0000 (UTC) (envelope-from cem@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 E3B3A225; Sat, 22 Oct 2016 18:02:21 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MI2Lnl048890; Sat, 22 Oct 2016 18:02:21 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MI2LXw048889; Sat, 22 Oct 2016 18:02:21 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610221802.u9MI2LXw048889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Sat, 22 Oct 2016 18:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307780 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 18:02:22 -0000 Author: cem Date: Sat Oct 22 18:02:20 2016 New Revision: 307780 URL: https://svnweb.freebsd.org/changeset/base/307780 Log: ddb(4): Add sleepchains to "show allchains" Reported by: markj Reviewed by: markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8320 Modified: head/sys/kern/subr_turnstile.c Modified: head/sys/kern/subr_turnstile.c ============================================================================== --- head/sys/kern/subr_turnstile.c Sat Oct 22 17:21:21 2016 (r307779) +++ head/sys/kern/subr_turnstile.c Sat Oct 22 18:02:20 2016 (r307780) @@ -157,6 +157,9 @@ static void init_turnstile0(void *dummy) #ifdef TURNSTILE_PROFILING static void init_turnstile_profiling(void *arg); #endif +#ifdef DDB +static void print_sleepchain(struct thread *td, const char *prefix); +#endif static void propagate_priority(struct thread *td); static int turnstile_adjust_thread(struct turnstile *ts, struct thread *td); @@ -1169,6 +1172,10 @@ DB_SHOW_ALL_COMMAND(chains, db_show_allc db_printf("chain %d:\n", i++); print_lockchain(td, " "); } + if (TD_IS_INHIBITED(td) && TD_ON_SLEEPQ(td)) { + db_printf("chain %d:\n", i++); + print_sleepchain(td, " "); + } if (db_pager_quit) return; } From owner-svn-src-all@freebsd.org Sat Oct 22 19:19:00 2016 Return-Path: Delivered-To: svn-src-all@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 EC2FAC1D655; Sat, 22 Oct 2016 19:19:00 +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 C40F02C7; Sat, 22 Oct 2016 19:19:00 +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 u9MJIxTo076015; Sat, 22 Oct 2016 19:18:59 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MJIx9Q076011; Sat, 22 Oct 2016 19:18:59 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221918.u9MJIx9Q076011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 19:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r307781 - vendor/tzdata/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 19:19:01 -0000 Author: bapt Date: Sat Oct 22 19:18:59 2016 New Revision: 307781 URL: https://svnweb.freebsd.org/changeset/base/307781 Log: Import tzdata 2016h Modified: vendor/tzdata/dist/asia vendor/tzdata/dist/australasia vendor/tzdata/dist/europe vendor/tzdata/dist/northamerica Modified: vendor/tzdata/dist/asia ============================================================================== --- vendor/tzdata/dist/asia Sat Oct 22 18:02:20 2016 (r307780) +++ vendor/tzdata/dist/asia Sat Oct 22 19:18:59 2016 (r307781) @@ -2544,11 +2544,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Paul Eggert (2015-03-03): # http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014 # says that the fall 2014 transition was Oct 23 at 24:00. -# For future dates, guess the last Friday in March at 24:00 through -# the first Friday on or after October 21 at 00:00. This is consistent with -# the predictions in today's editions of the following URLs: -# http://www.timeanddate.com/time/change/gaza-strip/gaza -# http://www.timeanddate.com/time/change/west-bank/hebron # From Hannah Kreitem (2016-03-09): # http://www.palestinecabinet.gov.ps/WebSite/ar/ViewDetails?ID=31728 @@ -2558,7 +2553,21 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # # From Paul Eggert (2016-03-12): # Predict spring transitions on March's last Saturday at 01:00 from now on. -# Leave fall predictions alone for now. + +# From Sharef Mustafa (2016-10-19): +# [T]he Palestinian cabinet decision (Mar 8th 2016) published on +# http://www.palestinecabinet.gov.ps/WebSite/Upload/Decree/GOV_17/16032016134830.pdf +# states that summer time will end on Oct 29th at 01:00. +# +# From Tim Parenti (2016-10-19): +# Predict fall transitions on October's last Saturday at 01:00 from now on. +# This is consistent with the 2016 transition as well as our spring +# predictions. +# +# From Paul Eggert (2016-10-19): +# It's also consistent with predictions in the following URLs today: +# http://www.timeanddate.com/time/change/gaza-strip/gaza +# http://www.timeanddate.com/time/change/west-bank/hebron # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S @@ -2587,9 +2596,10 @@ Rule Palestine 2011 only - Sep 30 0:00 0 Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S Rule Palestine 2012 only - Sep 21 1:00 0 - Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - -Rule Palestine 2014 max - Oct Fri>=21 0:00 0 - +Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 - Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S +Rule Palestine 2016 max - Oct lastSat 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct @@ -2739,45 +2749,31 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 J # People who live in regions under Tamil control can use [TZ='Asia/Kolkata'], # as that zone has agreed with the Tamil areas since our cutoff date of 1970. -# From K Sethu (2006-04-25): -# I think the abbreviation LKT originated from the world of computers at -# the time of or subsequent to the time zone changes by SL Government -# twice in 1996 and probably SL Government or its standardization -# agencies never declared an abbreviation as a national standard. -# -# I recollect before the recent change the government announcements -# mentioning it as simply changing Sri Lanka Standard Time or Sri Lanka -# Time and no mention was made about the abbreviation. -# -# If we look at Sri Lanka Department of Government's "Official News -# Website of Sri Lanka" ... http://www.news.lk/ we can see that they -# use SLT as abbreviation in time stamp at the beginning of each news -# item.... -# -# Within Sri Lanka I think LKT is well known among computer users and -# administrators. In my opinion SLT may not be a good choice because the -# nation's largest telcom / internet operator Sri Lanka Telcom is well -# known by that abbreviation - simply as SLT (there IP domains are -# slt.lk and sltnet.lk). -# -# But if indeed our government has adopted SLT as standard abbreviation -# (that we have not known so far) then it is better that it be used for -# all computers. - -# From Paul Eggert (2006-04-25): -# One possibility is that we wait for a bit for the dust to settle down -# and then see what people actually say in practice. +# From Sadika Sumanapala (2016-10-19): +# According to http://www.sltime.org (maintained by Measurement Units, +# Standards & Services Department, Sri Lanka) abbreviation for Sri Lanka +# standard time is SLST. +# +# From Paul Eggert (2016-10-18): +# "SLST" seems to be reasonably recent and rarely-used outside time +# zone nerd sources. I searched Google News and found three uses of +# it in the International Business Times of India in February and +# March of this year when discussing cricket match times, but nothing +# since then (though there has been a lot of cricket) and nothing in +# other English-language news sources. Our old abbreviation "LKT" is +# even worse. For now, let's use a numeric abbreviation; we can +# switch to "SLST" if it catches on. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Colombo 5:19:24 - LMT 1880 5:19:32 - MMT 1906 # Moratuwa Mean Time - 5:30 - IST 1942 Jan 5 - 5:30 0:30 IHST 1942 Sep - 5:30 1:00 IST 1945 Oct 16 2:00 - 5:30 - IST 1996 May 25 0:00 - 6:30 - LKT 1996 Oct 26 0:30 - 6:00 - LKT 2006 Apr 15 0:30 - 5:30 - IST + 5:30 - +0530 1942 Jan 5 + 5:30 0:30 +0530/+06 1942 Sep + 5:30 1:00 +0530/+0630 1945 Oct 16 2:00 + 5:30 - +0530 1996 May 25 0:00 + 6:30 - +0630 1996 Oct 26 0:30 + 6:00 - +06 2006 Apr 15 0:30 + 5:30 - +0530 # Syria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Modified: vendor/tzdata/dist/australasia ============================================================================== --- vendor/tzdata/dist/australasia Sat Oct 22 18:02:20 2016 (r307780) +++ vendor/tzdata/dist/australasia Sat Oct 22 19:18:59 2016 (r307781) @@ -350,7 +350,13 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # commencing at 2.00 am on Sunday 1st November, 2015 and ending at # 3.00 am on Sunday 17th January, 2016. -# From Paul Eggert (2015-09-01): +# From Raymond Kumar (2016-10-04): +# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-6th-NOVEMBER,-2016.aspx +# "Fiji's daylight savings will begin on Sunday, 6 November 2016, when +# clocks go forward an hour at 2am to 3am.... Daylight Saving will +# end at 3.00am on Sunday 15th January 2017." + +# From Paul Eggert (2016-10-03): # For now, guess DST from 02:00 the first Sunday in November to # 03:00 the third Sunday in January. Although ad hoc, it matches # transitions since late 2014 and seems more likely to match future Modified: vendor/tzdata/dist/europe ============================================================================== --- vendor/tzdata/dist/europe Sat Oct 22 18:02:20 2016 (r307780) +++ vendor/tzdata/dist/europe Sat Oct 22 19:18:59 2016 (r307781) @@ -1908,7 +1908,7 @@ Zone Europe/Monaco 0:29:32 - LMT 1891 Ma # Amsterdam mean time. # The data entries before 1945 are taken from -# http://www.phys.uu.nl/~vgent/wettijd/wettijd.htm +# http://www.staff.science.uu.nl/~gent0113/idl/idl.htm # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time @@ -3427,22 +3427,24 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Ju # Turkey -# From Amar Devegowda (2007-01-03): -# The time zone rules for Istanbul, Turkey have not been changed for years now. -# ... The latest rules are available at: -# http://www.timeanddate.com/worldclock/timezone.html?n=107 -# From Steffen Thorsen (2007-01-03): -# I have been able to find press records back to 1996 which all say that -# DST started 01:00 local time and end at 02:00 local time. I am not sure -# what happened before that. One example for each year from 1996 to 2001: -# http://newspot.byegm.gov.tr/arsiv/1996/21/N4.htm -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING97/03/97X03X25.TXT -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING98/03/98X03X02.HTM -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING99/10/99X10X26.HTM#%2016 -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2000/03/00X03X06.HTM#%2021 -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2001/03/23x03x01.HTM#%2027 -# From Paul Eggert (2007-01-03): -# Prefer the above source to Shanks & Pottenger for time stamps after 1990. +# From Kıvanç Yazan (2016-09-25): +# 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with +# no exceptions. +# 2) 1994's lastSun was overridden with Mar 20 ... +# Here are official papers: +# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986 +# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987 +# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988 +# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989 +# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992 +# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995 +# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994 +# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997 +# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000 +# http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 +# http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 +# From Paul Eggert (2016-09-25): +# Prefer the above sources to Shanks & Pottenger for time stamps after 1985. # From Steffen Thorsen (2007-03-09): # Starting 2007 though, it seems that they are adopting EU's 1:00 UTC @@ -3551,10 +3553,10 @@ Rule Turkey 1983 only - Jul 31 0:00 1:00 Rule Turkey 1983 only - Oct 2 0:00 0 - Rule Turkey 1985 only - Apr 20 0:00 1:00 S Rule Turkey 1985 only - Sep 28 0:00 0 - -Rule Turkey 1986 1990 - Mar lastSun 2:00s 1:00 S -Rule Turkey 1986 1990 - Sep lastSun 2:00s 0 - -Rule Turkey 1991 2006 - Mar lastSun 1:00s 1:00 S -Rule Turkey 1991 1995 - Sep lastSun 1:00s 0 - +Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S +Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 - +Rule Turkey 1994 only - Mar 20 1:00s 1:00 S +Rule Turkey 1995 2006 - Mar lastSun 1:00s 1:00 S Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Istanbul 1:55:52 - LMT 1880 Modified: vendor/tzdata/dist/northamerica ============================================================================== --- vendor/tzdata/dist/northamerica Sat Oct 22 18:02:20 2016 (r307780) +++ vendor/tzdata/dist/northamerica Sat Oct 22 19:18:59 2016 (r307781) @@ -24,8 +24,32 @@ # was the result of his proposals at the Convention of Railroad Trunk Lines # in New York City (1869-10). His 1870 proposal was based on Washington, DC, # but in 1872-05 he moved the proposed origin to Greenwich. -# His proposal was adopted by the railroads on 1883-11-18 at 12:00, -# and the most of the country soon followed suit. + +# From Paul Eggert (2016-09-21): +# Dowd's proposal left many details unresolved, such as where to draw +# lines between time zones. The key individual who made time zones +# work in the US was William Frederick Allen - railway engineer, +# managing editor of the Travelers' Guide, and secretary of the +# General Time Convention, a railway standardization group. Allen +# spent months in dialogs with scientific and railway leaders, +# developed a workable plan to institute time zones, and presented it +# to the General Time Convention on 1883-04-11, saying that his plan +# meant "local time would be practically abolished" - a plus for +# railway scheduling. By the next convention on 1883-10-11 nearly all +# railroads had agreed and it took effect on 1883-11-18 at 12:00. +# That Sunday was called the "day of two noons", as the eastern parts +# of the new zones observed noon twice. Allen witnessed the +# transition in New York City, writing: +# +# I heard the bells of St. Paul's strike on the old time. Four +# minutes later, obedient to the electrical signal from the Naval +# Observatory ... the time-ball made its rapid descent, the chimes +# of old Trinity rang twelve measured strokes, and local time was +# abandoned, probably forever. +# +# Most of the US soon followed suit. See: +# Bartky IR. The adoption of standard time. Technol Cult 1989 Jan;30(1):25-56. +# http://dx.doi.org/10.2307/3105430 # From Paul Eggert (2005-04-16): # That 1883 transition occurred at 12:00 new time, not at 12:00 old time. From owner-svn-src-all@freebsd.org Sat Oct 22 19:19:32 2016 Return-Path: Delivered-To: svn-src-all@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 E32F1C1D6DD; Sat, 22 Oct 2016 19:19:32 +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 9903E681; Sat, 22 Oct 2016 19:19:32 +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 u9MJJV3P076087; Sat, 22 Oct 2016 19:19:31 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MJJVQT076085; Sat, 22 Oct 2016 19:19:31 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221919.u9MJJVQT076085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 19:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r307782 - vendor/tzdata/tzdata2016h X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 19:19:33 -0000 Author: bapt Date: Sat Oct 22 19:19:31 2016 New Revision: 307782 URL: https://svnweb.freebsd.org/changeset/base/307782 Log: tag import of tzdata 2016h Added: vendor/tzdata/tzdata2016h/ - copied from r306848, vendor/tzdata/dist/ Replaced: vendor/tzdata/tzdata2016h/asia - copied unchanged from r307781, vendor/tzdata/dist/asia vendor/tzdata/tzdata2016h/australasia - copied unchanged from r307781, vendor/tzdata/dist/australasia vendor/tzdata/tzdata2016h/europe - copied unchanged from r307781, vendor/tzdata/dist/europe vendor/tzdata/tzdata2016h/northamerica - copied unchanged from r307781, vendor/tzdata/dist/northamerica Copied: vendor/tzdata/tzdata2016h/asia (from r307781, vendor/tzdata/dist/asia) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/tzdata/tzdata2016h/asia Sat Oct 22 19:19:31 2016 (r307782, copy of r307781, vendor/tzdata/dist/asia) @@ -0,0 +1,3054 @@ +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# This file is by no means authoritative; if you think you know better, +# go ahead and edit the file (and please send any changes to +# tz@iana.org for general use in the future). For more, please see +# the file CONTRIBUTING in the tz distribution. + +# From Paul Eggert (2015-08-08): +# +# Unless otherwise specified, the source for data through 1990 is: +# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), +# San Diego: ACS Publications, Inc. (2003). +# Unfortunately this book contains many errors and cites no sources. +# +# Gwillim Law writes that a good source +# for recent time zone data is the International Air Transport +# Association's Standard Schedules Information Manual (IATA SSIM), +# published semiannually. Law sent in several helpful summaries +# of the IATA's data after 1990. Except where otherwise noted, +# IATA SSIM is the source for entries after 1990. +# +# Another source occasionally used is Edward W. Whitman, World Time Differences, +# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which +# I found in the UCLA library. +# +# For data circa 1899, a common source is: +# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. +# http://www.jstor.org/stable/1774359 +# +# For Russian data circa 1919, a source is: +# Byalokoz EL. New Counting of Time in Russia since July 1, 1919. +# (See the 'europe' file for a fuller citation.) +# +# A reliable and entertaining source about time zones is +# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). +# +# I invented the abbreviations marked '*' in the following table; +# the rest are from earlier versions of this file, or from other sources. +# Corrections are welcome! +# std dst +# LMT Local Mean Time +# 2:00 EET EEST Eastern European Time +# 2:00 IST IDT Israel +# 3:00 AST ADT Arabia* +# 3:30 IRST IRDT Iran* +# 4:00 GST Gulf* +# 5:30 IST India +# 7:00 ICT Indochina, most times and locations* +# 7:00 WIB west Indonesia (Waktu Indonesia Barat) +# 8:00 WITA central Indonesia (Waktu Indonesia Tengah) +# 8:00 CST China +# 8:00 IDT Indochina, 1943-45, 1947-55, 1960-75 (some locations)* +# 8:00 JWST Western Standard Time (Japan, 1896/1937)* +# 8:30 KST KDT Korea when at +0830* +# 9:00 JCST Central Standard Time (Japan, 1896/1937) +# 9:00 WIT east Indonesia (Waktu Indonesia Timur) +# 9:00 JST JDT Japan +# 9:00 KST KDT Korea when at +09 +# 9:30 ACST Australian Central Standard Time +# +# See the 'europe' file for Russia and Turkey in Asia. + +# From Guy Harris: +# Incorporates data for Singapore from Robert Elz' asia 1.1, as well as +# additional information from Tom Yap, Sun Microsystems Intercontinental +# Technical Support (including a page from the Official Airline Guide - +# Worldwide Edition). The names for time zones are guesses. + +############################################################################### + +# These rules are stolen from the 'europe' file. +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule EUAsia 1981 max - Mar lastSun 1:00u 1:00 S +Rule EUAsia 1979 1995 - Sep lastSun 1:00u 0 - +Rule EUAsia 1996 max - Oct lastSun 1:00u 0 - +Rule E-EurAsia 1981 max - Mar lastSun 0:00 1:00 S +Rule E-EurAsia 1979 1995 - Sep lastSun 0:00 0 - +Rule E-EurAsia 1996 max - Oct lastSun 0:00 0 - +Rule RussiaAsia 1981 1984 - Apr 1 0:00 1:00 S +Rule RussiaAsia 1981 1983 - Oct 1 0:00 0 - +Rule RussiaAsia 1984 1995 - Sep lastSun 2:00s 0 - +Rule RussiaAsia 1985 2011 - Mar lastSun 2:00s 1:00 S +Rule RussiaAsia 1996 2011 - Oct lastSun 2:00s 0 - + +# Afghanistan +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Kabul 4:36:48 - LMT 1890 + 4:00 - AFT 1945 + 4:30 - AFT + +# Armenia +# From Paul Eggert (2006-03-22): +# Shanks & Pottenger have Yerevan switching to 3:00 (with Russian DST) +# in spring 1991, then to 4:00 with no DST in fall 1995, then +# readopting Russian DST in 1997. Go with Shanks & Pottenger, even +# when they disagree with others. Edgar Der-Danieliantz +# reported (1996-05-04) that Yerevan probably wouldn't use DST +# in 1996, though it did use DST in 1995. IATA SSIM (1991/1998) reports that +# Armenia switched from 3:00 to 4:00 in 1998 and observed DST after 1991, +# but started switching at 3:00s in 1998. + +# From Arthur David Olson (2011-06-15): +# While Russia abandoned DST in 2011, Armenia may choose to +# follow Russia's "old" rules. + +# From Alexander Krivenyshev (2012-02-10): +# According to News Armenia, on Feb 9, 2012, +# http://newsarmenia.ru/society/20120209/42609695.html +# +# The Armenia National Assembly adopted final reading of Amendments to the +# Law "On procedure of calculation time on the territory of the Republic of +# Armenia" according to which Armenia [is] abolishing Daylight Saving Time. +# or +# (brief) +# http://www.worldtimezone.com/dst_news/dst_news_armenia03.html +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 + 3:00 - +03 1957 Mar + 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s + 3:00 RussiaAsia +03/+04 1995 Sep 24 2:00s + 4:00 - +04 1997 + 4:00 RussiaAsia +04/+05 + +# Azerbaijan + +# From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23): +# According to the resolution of Cabinet of Ministers, 1997 +# From Paul Eggert (2015-09-17): It was Resolution No. 21 (1997-03-17). +# http://code.az/files/daylight_res.pdf + +# From Steffen Thorsen (2016-03-17): +# ... the Azerbaijani Cabinet of Ministers has cancelled switching to +# daylight saving time.... +# http://www.azernews.az/azerbaijan/94137.html +# http://vestnikkavkaza.net/news/Azerbaijani-Cabinet-of-Ministers-cancels-daylight-saving-time.html +# http://en.apa.az/xeber_azerbaijan_abolishes_daylight_savings_ti_240862.html + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 S +Rule Azer 1997 2015 - Oct lastSun 5:00 0 - +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Baku 3:19:24 - LMT 1924 May 2 + 3:00 - +03 1957 Mar + 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s + 3:00 RussiaAsia +03/+04 1992 Sep lastSun 2:00s + 4:00 - +04 1996 + 4:00 EUAsia +04/+05 1997 + 4:00 Azer +04/+05 + +# Bahrain +# See Asia/Qatar. + +# Bangladesh +# From Alexander Krivenyshev (2009-05-13): +# According to newspaper Asian Tribune (May 6, 2009) Bangladesh may introduce +# Daylight Saving Time from June 16 to Sept 30 +# +# Bangladesh to introduce daylight saving time likely from June 16 +# http://www.asiantribune.com/?q=node/17288 +# http://www.worldtimezone.com/dst_news/dst_news_bangladesh02.html +# +# "... Bangladesh government has decided to switch daylight saving time from +# June +# 16 till September 30 in a bid to ensure maximum use of daylight to cope with +# crippling power crisis. " +# +# The switch will remain in effect from June 16 to Sept 30 (2009) but if +# implemented the next year, it will come in force from April 1, 2010 + +# From Steffen Thorsen (2009-06-02): +# They have finally decided now, but changed the start date to midnight between +# the 19th and 20th, and they have not set the end date yet. +# +# Some sources: +# http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601 +# http://bdnews24.com/details.php?id=85889&cid=2 +# +# Our wrap-up: +# http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html + +# From A. N. M. Kamrus Saadat (2009-06-15): +# Finally we've got the official mail regarding DST start time where DST start +# time is mentioned as Jun 19 2009, 23:00 from BTRC (Bangladesh +# Telecommunication Regulatory Commission). +# +# No DST end date has been announced yet. + +# From Alexander Krivenyshev (2009-09-25): +# Bangladesh won't go back to Standard Time from October 1, 2009, +# instead it will continue DST measure till the cabinet makes a fresh decision. +# +# Following report by same newspaper-"The Daily Star Friday": +# "DST change awaits cabinet decision-Clock won't go back by 1-hr from Oct 1" +# http://www.thedailystar.net/newDesign/news-details.php?nid=107021 +# http://www.worldtimezone.com/dst_news/dst_news_bangladesh04.html + +# From Steffen Thorsen (2009-10-13): +# IANS (Indo-Asian News Service) now reports: +# Bangladesh has decided that the clock advanced by an hour to make +# maximum use of daylight hours as an energy saving measure would +# "continue for an indefinite period." +# +# One of many places where it is published: +# http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html + +# From Alexander Krivenyshev (2009-12-24): +# According to Bangladesh newspaper "The Daily Star," +# Bangladesh will change its clock back to Standard Time on Dec 31, 2009. +# +# Clock goes back 1-hr on Dec 31 night. +# http://www.thedailystar.net/newDesign/news-details.php?nid=119228 +# http://www.worldtimezone.com/dst_news/dst_news_bangladesh05.html +# +# "...The government yesterday decided to put the clock back by one hour +# on December 31 midnight and the new time will continue until March 31, +# 2010 midnight. The decision came at a cabinet meeting at the Prime +# Minister's Office last night..." + +# From Alexander Krivenyshev (2010-03-22): +# According to Bangladesh newspaper "The Daily Star," +# Cabinet cancels Daylight Saving Time +# http://www.thedailystar.net/newDesign/latest_news.php?nid=22817 +# http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Dhaka 2009 only - Jun 19 23:00 1:00 S +Rule Dhaka 2009 only - Dec 31 24:00 0 - + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Dhaka 6:01:40 - LMT 1890 + 5:53:20 - HMT 1941 Oct # Howrah Mean Time? + 6:30 - BURT 1942 May 15 # Burma Time + 5:30 - IST 1942 Sep + 6:30 - BURT 1951 Sep 30 + 6:00 - DACT 1971 Mar 26 # Dacca Time + 6:00 - BDT 2009 + 6:00 Dhaka BD%sT + +# Bhutan +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Thimphu 5:58:36 - LMT 1947 Aug 15 # or Thimbu + 5:30 - IST 1987 Oct + 6:00 - BTT # Bhutan Time + +# British Indian Ocean Territory +# Whitman and the 1995 CIA time zone map say 5:00, but the +# 1997 and later maps say 6:00. Assume the switch occurred in 1996. +# We have no information as to when standard time was introduced; +# assume it occurred in 1907, the same year as Mauritius (which +# then contained the Chagos Archipelago). +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Indian/Chagos 4:49:40 - LMT 1907 + 5:00 - IOT 1996 # BIOT Time + 6:00 - IOT + +# Brunei +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Bandar Seri Begawan + 7:30 - BNT 1933 + 8:00 - BNT + +# Burma / Myanmar + +# Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon. + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Yangon 6:24:40 - LMT 1880 # or Rangoon + 6:24:40 - RMT 1920 # Rangoon Mean Time? + 6:30 - BURT 1942 May # Burma Time + 9:00 - JST 1945 May 3 + 6:30 - MMT # Myanmar Time + +# Cambodia +# See Asia/Bangkok. + + +# China + +# From Guy Harris: +# People's Republic of China. Yes, they really have only one time zone. + +# From Bob Devine (1988-01-28): +# No they don't. See TIME mag, 1986-02-17 p.52. Even though +# China is across 4 physical time zones, before Feb 1, 1986 only the +# Peking (Beijing) time zone was recognized. Since that date, China +# has two of 'em - Peking's and Ãœrümqi (named after the capital of +# the Xinjiang Uyghur Autonomous Region). I don't know about DST for it. +# +# . . .I just deleted the DST table and this editor makes it too +# painful to suck in another copy. So, here is what I have for +# DST start/end dates for Peking's time zone (info from AP): +# +# 1986 May 4 - Sept 14 +# 1987 mid-April - ?? + +# From U. S. Naval Observatory (1989-01-19): +# CHINA 8 H AHEAD OF UTC ALL OF CHINA, INCL TAIWAN +# CHINA 9 H AHEAD OF UTC APR 17 - SEP 10 + +# From Paul Eggert (2008-02-11): +# Jim Mann, "A clumsy embrace for another western custom: China on daylight +# time - sort of", Los Angeles Times, 1986-05-05 ... [says] that China began +# observing daylight saving time in 1986. + +# From Paul Eggert (2014-06-30): +# Shanks & Pottenger have China switching to a single time zone in 1980, but +# this doesn't seem to be correct. They also write that China observed summer +# DST from 1986 through 1991, which seems to match the above commentary, so +# go with them for DST rules as follows: +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Shang 1940 only - Jun 3 0:00 1:00 D +Rule Shang 1940 1941 - Oct 1 0:00 0 S +Rule Shang 1941 only - Mar 16 0:00 1:00 D +Rule PRC 1986 only - May 4 0:00 1:00 D +Rule PRC 1986 1991 - Sep Sun>=11 0:00 0 S +Rule PRC 1987 1991 - Apr Sun>=10 0:00 1:00 D + +# From Anthony Fok (2001-12-20): +# BTW, I did some research on-line and found some info regarding these five +# historic timezones from some Taiwan websites. And yes, there are official +# Chinese names for these locales (before 1949). +# +# From Jesper Nørgaard Welen (2006-07-14): +# I have investigated the timezones around 1970 on the +# http://www.astro.com/atlas site [with provinces and county +# boundaries summarized below].... A few other exceptions were two +# counties on the Sichuan side of the Xizang-Sichuan border, +# counties Dege and Baiyu which lies on the Sichuan side and are +# therefore supposed to be GMT+7, Xizang region being GMT+6, but Dege +# county is GMT+8 according to astro.com while Baiyu county is GMT+6 +# (could be true), for the moment I am assuming that those two +# counties are mistakes in the astro.com data. + +# From Paul Eggert (2014-06-30): +# Alois Treindl kindly sent me translations of the following two sources: +# +# (1) +# Guo Qingsheng (National Time-Service Center, CAS, Xi'an 710600, China) +# Beijing Time at the Beginning of the PRC +# China Historical Materials of Science and Technology +# (Zhongguo ke ji shi liao, 中国科技å²æ–™), Vol. 24, No. 1 (2003) +# It gives evidence that at the beginning of the PRC, Beijing time was +# officially apparent solar time! However, Guo also says that the +# evidence is dubious, as the relevant institute of astronomy had not +# been taken over by the PRC yet. It's plausible that apparent solar +# time was announced but never implemented, and that people continued +# to use UT+8. As the Shanghai radio station (and I presume the +# observatory) was still under control of French missionaries, it +# could well have ignored any such mandate. +# +# (2) +# Guo Qing-sheng (Shaanxi Astronomical Observatory, CAS, Xi'an 710600, China) +# A Study on the Standard Time Changes for the Past 100 Years in China +# [undated and unknown publication location] +# It says several things: +# * The Qing dynasty used local apparent solar time throughout China. +# * The Republic of China instituted Beijing mean solar time effective +# the official calendar book of 1914. +# * The French Concession in Shanghai set up signal stations in +# French docks in the 1890s, controlled by Xujiahui (Zikawei) +# Observatory and set to local mean time. +# * "From the end of the 19th century" it changed to UT+8. +# * Chinese Customs (by then reduced to a tool of foreign powers) +# eventually standardized on this time for all ports, and it +# became used by railways as well. +# * In 1918 the Central Observatory proposed dividing China into +# five time zones (see below for details). This caught on +# at first only in coastal areas observing UT+8. +# * During WWII all of China was in theory was at UT+7. In practice +# this was ignored in the west, and I presume was ignored in +# Japanese-occupied territory. +# * Japanese-occupied Manchuria was at UT+9, i.e., Japan time. +# * The five-zone plan was resurrected after WWII and officially put into +# place (with some modifications) in March 1948. It's not clear +# how well it was observed in areas under Nationalist control. +# * The People's Liberation Army used UT+8 during the civil war. +# +# An AP article "Shanghai Internat'l Area Little Changed" in the +# Lewiston (ME) Daily Sun (1939-05-29), p 17, said "Even the time is +# different - the occupied districts going by Tokyo time, an hour +# ahead of that prevailing in the rest of Shanghai." Guess that the +# Xujiahui Observatory was under French control and stuck with UT +08. +# +# In earlier versions of this file, China had many separate Zone entries, but +# this was based on what were apparently incorrect data in Shanks & Pottenger. +# This has now been simplified to the two entries Asia/Shanghai and +# Asia/Urumqi, with the others being links for backward compatibility. +# Proposed in 1918 and theoretically in effect until 1949 (although in practice +# mainly observed in coastal areas), the five zones were: +# +# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT +08:30 +# Asia/Harbin (currently a link to Asia/Shanghai) +# Heilongjiang (except Mohe county), Jilin +# +# Zhongyuan Time ("Central plain Time") UT +08 +# Asia/Shanghai +# most of China +# This currently represents most other zones as well, +# as apparently these regions have been the same since 1970. +# Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest. +# Guo says Shanghai switched to UT +08 "from the end of the 19th century". +# +# Long-shu Time (probably due to Long and Shu being two names of the area) UT +07 +# Asia/Chongqing (currently a link to Asia/Shanghai) +# Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan; +# most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong +# counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing, +# Yangchun, Yangjiang, Yu'nan, and Yunfu. +# +# Xin-zang Time ("Xinjiang-Tibet Time") UT +06 +# Asia/Urumqi +# This currently represents Kunlun Time as well, +# as apparently the two regions have been the same since 1970. +# The Gansu counties Aksay, Anxi, Dunhuang, Subei; west Qinghai; +# the Guangdong counties Xuwen, Haikang, Suixi, Lianjiang, +# Zhanjiang, Wuchuan, Huazhou, Gaozhou, Maoming, Dianbai, and Xinyi; +# east Tibet, including Lhasa, Chamdo, Shigaise, Jimsar, Shawan and Hutubi; +# east Xinjiang, including Ãœrümqi, Turpan, Karamay, Korla, Minfeng, Jinghe, +# Wusu, Qiemo, Xinyan, Wulanwusu, Jinghe, Yumin, Tacheng, Tuoli, Emin, +# Shihezi, Changji, Yanqi, Heshuo, Tuokexun, Tulufan, Shanshan, Hami, +# Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan. +# +# Kunlun Time UT +05:30 +# Asia/Kashgar (currently a link to Asia/Urumqi) +# West Tibet, including Pulan, Aheqi, Shufu, Shule; +# West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke, +# Zhaosu, Tekesi, Gongliu, Chabuchaer, Huocheng, Bole, Pishan, Suiding, +# and Yarkand. + +# From Luther Ma (2009-10-17): +# Almost all (>99.9%) ethnic Chinese (properly ethnic Han) living in +# Xinjiang use Chinese Standard Time. Some are aware of Xinjiang time, +# but have no need of it. All planes, trains, and schools function on +# what is called "Beijing time." When Han make an appointment in Chinese +# they implicitly use Beijing time. +# +# On the other hand, ethnic Uyghurs, who make up about half the +# population of Xinjiang, typically use "Xinjiang time" which is two +# hours behind Beijing time, or UT +06. The government of the Xinjiang +# Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as +# local governments such as the Ãœrümqi city government use both times in +# publications, referring to what is popularly called Xinjiang time as +# "Ãœrümqi time." When Uyghurs make an appointment in the Uyghur language +# they almost invariably use Xinjiang time. +# +# (Their ethnic Han compatriots would typically have no clue of its +# widespread use, however, because so extremely few of them are fluent in +# Uyghur, comparable to the number of Anglo-Americans fluent in Navajo.) +# +# (...As with the rest of China there was a brief interval ending in 1990 +# or 1991 when summer time was in use. The confusion was severe, with +# the province not having dual times but four times in use at the same +# time. Some areas remained on standard Xinjiang time or Beijing time and +# others moving their clocks ahead.) + +# From Luther Ma (2009-11-19): +# With the risk of being redundant to previous answers these are the most common +# English "transliterations" (w/o using non-English symbols): +# +# 1. Wulumuqi... +# 2. Kashi... +# 3. Urumqi... +# 4. Kashgar... +# ... +# 5. It seems that Uyghurs in Ãœrümqi has been using Xinjiang since at least the +# 1960's. I know of one Han, now over 50, who grew up in the surrounding +# countryside and used Xinjiang time as a child. +# +# 6. Likewise for Kashgar and the rest of south Xinjiang I don't know of any +# start date for Xinjiang time. +# +# Without having access to local historical records, nor the ability to legally +# publish them, I would go with October 1, 1949, when Xinjiang became the Uyghur +# Autonomous Region under the PRC. (Before that Uyghurs, of course, would also +# not be using Beijing time, but some local time.) + +# From David Cochrane (2014-03-26): +# Just a confirmation that Ãœrümqi time was implemented in Ãœrümqi on 1 Feb 1986: +# http://content.time.com/time/magazine/article/0,9171,960684,00.html + +# From Luther Ma (2014-04-22): +# I have interviewed numerous people of various nationalities and from +# different localities in Xinjiang and can confirm the information in Guo's +# report regarding Xinjiang, as well as the Time article reference by David +# Cochrane. Whether officially recognized or not (and both are officially +# recognized), two separate times have been in use in Xinjiang since at least +# the Cultural Revolution: Xinjiang Time (XJT), aka Ãœrümqi Time or local time; +# and Beijing Time. There is no confusion in Xinjiang as to which name refers +# to which time. Both are widely used in the province, although in some +# population groups might be use one to the exclusion of the other. The only +# problem is that computers and smart phones list Ãœrümqi (or Kashgar) as +# having the same time as Beijing. + +# From Paul Eggert (2014-06-30): +# In the early days of the PRC, Tibet was given its own time zone (UT +06) +# but this was withdrawn in 1959 and never reinstated; see Tubten Khétsun, +# Memories of life in Lhasa under Chinese Rule, Columbia U Press, ISBN +# 978-0231142861 (2008), translator's introduction by Matthew Akester, p x. +# As this is before our 1970 cutoff, Tibet doesn't need a separate zone. +# +# Xinjiang Time is well-documented as being officially recognized. E.g., see +# "The Working-Calendar for The Xinjiang Uygur Autonomous Region Government" +# (2014-04-22). +# Unfortunately, we have no good records of time in Xinjiang before 1986. +# During the 20th century parts of Xinjiang were ruled by the Qing dynasty, +# the Republic of China, various warlords, the First and Second East Turkestan +# Republics, the Soviet Union, the Kuomintang, and the People's Republic of +# China, and tracking down all these organizations' timekeeping rules would be +# quite a trick. Approximate this lost history by a transition from LMT to +# UT +06 at the start of 1928, the year of accession of the warlord Jin Shuren, +# which happens to be the date given by Shanks & Pottenger (no doubt as a +# guess) as the transition from LMT. Ignore the usage of +08 before +# 1986-02-01 under the theory that the transition date to +08 is unknown and +# that the sort of users who prefer Asia/Urumqi now typically ignored the +# +08 mandate back then. + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Beijing time, used throughout China; represented by Shanghai. +Zone Asia/Shanghai 8:05:43 - LMT 1901 + 8:00 Shang C%sT 1949 + 8:00 PRC C%sT +# Xinjiang time, used by many in western China; represented by Ãœrümqi / Ãœrümchi +# / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) +Zone Asia/Urumqi 5:50:20 - LMT 1928 + 6:00 - XJT + + +# Hong Kong (Xianggang) + +# Milne gives 7:36:41.7; round this. + +# From Lee Yiu Chung (2009-10-24): +# I found there are some mistakes for the...DST rule for Hong +# Kong. [According] to the DST record from Hong Kong Observatory (actually, +# it is not [an] observatory, but the official meteorological agency of HK, +# and also serves as the official timing agency), there are some missing +# and incorrect rules. Although the exact switch over time is missing, I +# think 3:30 is correct. The official DST record for Hong Kong can be +# obtained from +# http://www.hko.gov.hk/gts/time/Summertime.htm + +# From Arthur David Olson (2009-10-28): +# Here are the dates given at +# http://www.hko.gov.hk/gts/time/Summertime.htm +# as of 2009-10-28: +# Year Period +# 1941 1 Apr to 30 Sep +# 1942 Whole year +# 1943 Whole year +# 1944 Whole year +# 1945 Whole year +# 1946 20 Apr to 1 Dec +# 1947 13 Apr to 30 Dec +# 1948 2 May to 31 Oct +# 1949 3 Apr to 30 Oct +# 1950 2 Apr to 29 Oct +# 1951 1 Apr to 28 Oct +# 1952 6 Apr to 25 Oct +# 1953 5 Apr to 1 Nov +# 1954 21 Mar to 31 Oct +# 1955 20 Mar to 6 Nov +# 1956 18 Mar to 4 Nov +# 1957 24 Mar to 3 Nov +# 1958 23 Mar to 2 Nov +# 1959 22 Mar to 1 Nov +# 1960 20 Mar to 6 Nov +# 1961 19 Mar to 5 Nov +# 1962 18 Mar to 4 Nov +# 1963 24 Mar to 3 Nov +# 1964 22 Mar to 1 Nov +# 1965 18 Apr to 17 Oct +# 1966 17 Apr to 16 Oct +# 1967 16 Apr to 22 Oct +# 1968 21 Apr to 20 Oct +# 1969 20 Apr to 19 Oct +# 1970 19 Apr to 18 Oct +# 1971 18 Apr to 17 Oct +# 1972 16 Apr to 22 Oct +# 1973 22 Apr to 21 Oct +# 1973/74 30 Dec 73 to 20 Oct 74 +# 1975 20 Apr to 19 Oct +# 1976 18 Apr to 17 Oct +# 1977 Nil +# 1978 Nil +# 1979 13 May to 21 Oct +# 1980 to Now Nil +# The page does not give start or end times of day. +# The page does not give a start date for 1942. +# The page does not givw an end date for 1945. +# The Japanese occupation of Hong Kong began on 1941-12-25. +# The Japanese surrender of Hong Kong was signed 1945-09-15. +# For lack of anything better, use start of those days as the transition times. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule HK 1941 only - Apr 1 3:30 1:00 S +Rule HK 1941 only - Sep 30 3:30 0 - +Rule HK 1946 only - Apr 20 3:30 1:00 S +Rule HK 1946 only - Dec 1 3:30 0 - +Rule HK 1947 only - Apr 13 3:30 1:00 S +Rule HK 1947 only - Dec 30 3:30 0 - +Rule HK 1948 only - May 2 3:30 1:00 S +Rule HK 1948 1951 - Oct lastSun 3:30 0 - +Rule HK 1952 only - Oct 25 3:30 0 - +Rule HK 1949 1953 - Apr Sun>=1 3:30 1:00 S +Rule HK 1953 only - Nov 1 3:30 0 - +Rule HK 1954 1964 - Mar Sun>=18 3:30 1:00 S +Rule HK 1954 only - Oct 31 3:30 0 - +Rule HK 1955 1964 - Nov Sun>=1 3:30 0 - +Rule HK 1965 1976 - Apr Sun>=16 3:30 1:00 S +Rule HK 1965 1976 - Oct Sun>=16 3:30 0 - +Rule HK 1973 only - Dec 30 3:30 1:00 S +Rule HK 1979 only - May Sun>=8 3:30 1:00 S +Rule HK 1979 only - Oct Sun>=16 3:30 0 - +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 + 8:00 HK HK%sT 1941 Dec 25 + 9:00 - JST 1945 Sep 15 + 8:00 HK HK%sT + +############################################################################### + +# Taiwan + +# From smallufo (2010-04-03): +# According to Taiwan's CWB [Central Weather Bureau], +# http://www.cwb.gov.tw/V6/astronomy/cdata/summert.htm +# Taipei has DST in 1979 between July 1st and Sep 30. + +# From Yu-Cheng Chuang (2013-07-12): +# On Dec 28, 1895, the Meiji Emperor announced Ordinance No. 167 of +# Meiji Year 28 "The clause about standard time", mentioned that +# Taiwan and Penghu Islands, as well as Yaeyama and Miyako Islands +# (both in Okinawa) adopt the Western Standard Time which is based on +# 120E. The adoption began from Jan 1, 1896. The original text can be +# found on Wikisource: +# http://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時) +# ... This could be the first adoption of time zone in Taiwan, because +# during the Qing Dynasty, it seems that there was no time zone +# declared officially. +# +# Later, in the beginning of World War II, on Sep 25, 1937, the Showa +# Emperor announced Ordinance No. 529 of Showa Year 12 "The clause of +# revision in the ordinance No. 167 of Meiji year 28 about standard +# time", in which abolished the adoption of Western Standard Time in +# western islands (listed above), which means the whole Japan +# territory, including later occupations, adopt Japan Central Time +# (UTC+9). The adoption began on Oct 1, 1937. The original text can +# be found on Wikisource: +# http://ja.wikisource.org/wiki/明治二å八年勅令第百六å七號標準時ニ關スル件中改正ノ件 +# +# That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937. + +# From Yu-Cheng Chuang (2014-07-02): +# I've found more evidence about when the time zone was switched from UTC+9 +# back to UTC+8 after WW2. I believe it was on Sep 21, 1945. In a document +# during Japanese era [1] in which the officer told the staff to change time +# zone back to Western Standard Time (UTC+8) on Sep 21. And in another +# history page of National Cheng Kung University [2], on Sep 21 there is a +# note "from today, switch back to Western Standard Time". From these two +# materials, I believe that the time zone change happened on Sep 21. And +# today I have found another monthly journal called "The Astronomical Herald" +# from The Astronomical Society of Japan [3] in which it mentioned the fact +# that: +# +# 1. Standard Time of the Country (Japan) was adopted on Jan 1, 1888, using +# the time at 135E (GMT+9) +# +# 2. Standard Time of the Country was renamed to Central Standard Time, on Jan +# 1, 1898, and on the same day, the new territories Taiwan and Penghu islands, +# as well as Yaeyama and Miyako islands, adopted a new time zone called +# Western Standard Time, which is in GMT+8. +# +# 3. Western Standard Time was deprecated on Sep 30, 1937. From then all the +# territories of Japan adopted the same time zone, which is Central Standard +# Time. +# +# [1] Academica Historica, Taiwan: +# http://163.29.208.22:8080/govsaleShowImage/connect_img.php?s=00101738900090036&e=00101738900090037 +# [2] Nat'l Cheng Kung University 70th Anniversary Special Site: +# http://www.ncku.edu.tw/~ncku70/menu/001/01_01.htm +# [3] Yukio Niimi, The Standard Time in Japan (1997), p.475: +# http://www.asj.or.jp/geppou/archive_open/1997/pdf/19971001c.pdf + +# Yu-Cheng Chuang (2014-07-03): +# I finally have found the real official gazette about changing back to +# Western Standard Time on Sep 21 in Taiwan. It's Taiwan Governor-General +# Bulletin No. 386 in Showa 20 years (1945), published on Sep 19, 1945. [1] ... +# [It] abolishes Bulletin No. 207 in Showa 12 years (1937), which is a local +# bulletin in Taiwan for that Ordinance No. 529. It also mentioned that 1am on +# Sep 21, 1945 will be 12am on Sep 21. I think this bulletin is much more +# official than the one I mentioned in my first mail, because it's from the +# top-level government in Taiwan. If you're going to quote any resource, this +# would be a good one. +# [1] Taiwan Governor-General Gazette, No. 1018, Sep 19, 1945: +# http://db2.th.gov.tw/db2/view/viewImg.php?imgcode=0072031018a&num=19&bgn=019&end=019&otherImg=&type=gener + +# From Yu-Cheng Chuang (2014-07-02): +# In 1946, DST in Taiwan was from May 15 and ended on Sep 30. The info from +# Central Weather Bureau website was not correct. +# +# Original Bulletin: +# http://subtpg.tpg.gov.tw/og/image2.asp?f=03502F0AKM1AF +# http://subtpg.tpg.gov.tw/og/image2.asp?f=0350300AKM1B0 (cont.) +# +# In 1947, DST in Taiwan was expanded to Oct 31. There is a backup of that +# telegram announcement from Taiwan Province Government: +# +# http://subtpg.tpg.gov.tw/og/image2.asp?f=0360310AKZ431 +# +# Here is a brief translation: +# +# The Summer Time this year is adopted from midnight Apr 15 until Sep 20 +# midnight. To save (energy?) consumption, we're expanding Summer Time +# adoption till Oct 31 midnight. +# +# The Central Weather Bureau website didn't mention that, however it can +# be found from historical government announcement database. + +# From Paul Eggert (2014-07-03): +# As per Yu-Cheng Chuang, say that Taiwan was at UT +09 from 1937-10-01 +# until 1945-09-21 at 01:00, overriding Shanks & Pottenger. +# Likewise, use Yu-Cheng Chuang's data for DST in Taiwan. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Taiwan 1946 only - May 15 0:00 1:00 D +Rule Taiwan 1946 only - Oct 1 0:00 0 S +Rule Taiwan 1947 only - Apr 15 0:00 1:00 D +Rule Taiwan 1947 only - Nov 1 0:00 0 S +Rule Taiwan 1948 1951 - May 1 0:00 1:00 D +Rule Taiwan 1948 1951 - Oct 1 0:00 0 S +Rule Taiwan 1952 only - Mar 1 0:00 1:00 D +Rule Taiwan 1952 1954 - Nov 1 0:00 0 S +Rule Taiwan 1953 1959 - Apr 1 0:00 1:00 D +Rule Taiwan 1955 1961 - Oct 1 0:00 0 S +Rule Taiwan 1960 1961 - Jun 1 0:00 1:00 D +Rule Taiwan 1974 1975 - Apr 1 0:00 1:00 D +Rule Taiwan 1974 1975 - Oct 1 0:00 0 S +Rule Taiwan 1979 only - Jul 1 0:00 1:00 D +Rule Taiwan 1979 only - Oct 1 0:00 0 S + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Taipei or Taibei or T'ai-pei +Zone Asia/Taipei 8:06:00 - LMT 1896 Jan 1 + 8:00 - JWST 1937 Oct 1 + 9:00 - JST 1945 Sep 21 1:00 + 8:00 Taiwan C%sT + +# Macau (Macao, Aomen) +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Macau 1961 1962 - Mar Sun>=16 3:30 1:00 S +Rule Macau 1961 1964 - Nov Sun>=1 3:30 0 - +Rule Macau 1963 only - Mar Sun>=16 0:00 1:00 S +Rule Macau 1964 only - Mar Sun>=16 3:30 1:00 S +Rule Macau 1965 only - Mar Sun>=16 0:00 1:00 S +Rule Macau 1965 only - Oct 31 0:00 0 - +Rule Macau 1966 1971 - Apr Sun>=16 3:30 1:00 S +Rule Macau 1966 1971 - Oct Sun>=16 3:30 0 - +Rule Macau 1972 1974 - Apr Sun>=15 0:00 1:00 S +Rule Macau 1972 1973 - Oct Sun>=15 0:00 0 - +Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 - +Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 S +Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 S +Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 - +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 + 8:00 Macau MO%sT 1999 Dec 20 # return to China + 8:00 PRC C%sT + + +############################################################################### + +# Cyprus +# +# Milne says the Eastern Telegraph Company used 2:14:00. Stick with LMT. +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Cyprus 1975 only - Apr 13 0:00 1:00 S +Rule Cyprus 1975 only - Oct 12 0:00 0 - +Rule Cyprus 1976 only - May 15 0:00 1:00 S +Rule Cyprus 1976 only - Oct 11 0:00 0 - +Rule Cyprus 1977 1980 - Apr Sun>=1 0:00 1:00 S +Rule Cyprus 1977 only - Sep 25 0:00 0 - +Rule Cyprus 1978 only - Oct 2 0:00 0 - +Rule Cyprus 1979 1997 - Sep lastSun 0:00 0 - +Rule Cyprus 1981 1998 - Mar lastSun 0:00 1:00 S +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Nicosia 2:13:28 - LMT 1921 Nov 14 + 2:00 Cyprus EE%sT 1998 Sep + 2:00 EUAsia EE%sT +# IATA SSIM (1998-09) has Cyprus using EU rules for the first time. + +# Classically, Cyprus belongs to Asia; e.g. see Herodotus, Histories, I.72. +# However, for various reasons many users expect to find it under Europe. +Link Asia/Nicosia Europe/Nicosia + +# Georgia +# From Paul Eggert (1994-11-19): +# Today's _Economist_ (p 60) reports that Georgia moved its clocks forward +# an hour recently, due to a law proposed by Zurab Murvanidze, +# an MP who went on a hunger strike for 11 days to force discussion about it! +# We have no details, but we'll guess they didn't move the clocks back in fall. +# +# From Mathew Englander, quoting AP (1996-10-23 13:05-04): +# Instead of putting back clocks at the end of October, Georgia +# will stay on daylight savings time this winter to save energy, +# President Eduard Shevardnadze decreed Wednesday. +# +# From the BBC via Joseph S. Myers (2004-06-27): +# +# Georgia moved closer to Western Europe on Sunday... The former Soviet +# republic has changed its time zone back to that of Moscow. As a result it +# is now just four hours ahead of Greenwich Mean Time, rather than five hours +# ahead. The switch was decreed by the pro-Western president of Georgia, +# Mikheil Saakashvili, who said the change was partly prompted by the process +# of integration into Europe. + +# From Teimuraz Abashidze (2005-11-07): +# Government of Georgia ... decided to NOT CHANGE daylight savings time on +# [Oct.] 30, as it was done before during last more than 10 years. +# Currently, we are in fact GMT +4:00, as before 30 October it was GMT +# +3:00.... The problem is, there is NO FORMAL LAW or governmental document +# about it. As far as I can find, I was told, that there is no document, +# because we just DIDN'T ISSUE document about switching to winter time.... +# I don't know what can be done, especially knowing that some years ago our +# DST rules where changed THREE TIMES during one month. + +# Milne 1899 says Tbilisi (Tiflis) time was 2:59:05.7. +# Byalokoz 1919 says Georgia was 2:59:11. +# Go with Byalokoz. + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Tbilisi 2:59:11 - LMT 1880 + 2:59:11 - TBMT 1924 May 2 # Tbilisi Mean Time + 3:00 - +03 1957 Mar + 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s + 3:00 RussiaAsia +03/+04 1992 + 3:00 E-EurAsia +03/+04 1994 Sep lastSun + 4:00 E-EurAsia +04/+05 1996 Oct lastSun + 4:00 1:00 +05 1997 Mar lastSun + 4:00 E-EurAsia +04/+05 2004 Jun 27 + 3:00 RussiaAsia +03/+04 2005 Mar lastSun 2:00 + 4:00 - +04 + +# East Timor + +# See Indonesia for the 1945 transition. + +# From João Carrascalão, brother of the former governor of East Timor, in +# East Timor may be late for its millennium +# (1999-12-26/31): +# Portugal tried to change the time forward in 1974 because the sun +# rises too early but the suggestion raised a lot of problems with the +# Timorese and I still don't think it would work today because it +# conflicts with their way of life. + +# From Paul Eggert (2000-12-04): +# We don't have any record of the above attempt. +# Most likely our records are incomplete, but we have no better data. + +# From Manoel de Almeida e Silva, Deputy Spokesman for the UN Secretary-General +# http://www.hri.org/news/world/undh/2000/00-08-16.undh.html +# (2000-08-16): +# The Cabinet of the East Timor Transition Administration decided +# today to advance East Timor's time by one hour. The time change, +# which will be permanent, with no seasonal adjustment, will happen at +# midnight on Saturday, September 16. + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Dili 8:22:20 - LMT 1912 Jan 1 + 8:00 - TLT 1942 Feb 21 23:00 # E Timor Time + 9:00 - JST 1945 Sep 23 + 9:00 - TLT 1976 May 3 + 8:00 - WITA 2000 Sep 17 0:00 + 9:00 - TLT + +# India + +# From Ian P. Beacock, in "A brief history of (modern) time", The Atlantic +# http://www.theatlantic.com/technology/archive/2015/12/the-creation-of-modern-time/421419/ +# (2015-12-22): +# In January 1906, several thousand cotton-mill workers rioted on the +# outskirts of Bombay.... They were protesting the proposed abolition of +# local time in favor of Indian Standard Time.... Journalists called this +# dispute the "Battle of the Clocks." It lasted nearly half a century. + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata + 5:53:20 - HMT 1941 Oct # Howrah Mean Time? + 6:30 - BURT 1942 May 15 # Burma Time + 5:30 - IST 1942 Sep + 5:30 1:00 IST 1945 Oct 15 + 5:30 - IST +# The following are like Asia/Kolkata: +# Andaman Is +# Lakshadweep (Laccadive, Minicoy and Amindivi Is) +# Nicobar Is + +# Indonesia +# +# From Paul Eggert (2014-09-06): +# The 1876 Report of the Secretary of the [US] Navy, p 306 says that Batavia +# civil time was 7:07:12.5; round to even for Jakarta. +# +# From Gwillim Law (2001-05-28), overriding Shanks & Pottenger: +# http://www.sumatera-inc.com/go_to_invest/about_indonesia.asp#standtime +# says that Indonesia's time zones changed on 1988-01-01. Looking at some +# time zone maps, I think that must refer to Western Borneo (Kalimantan Barat +# and Kalimantan Tengah) switching from UTC+8 to UTC+7. +# +# From Paul Eggert (2007-03-10): +# Here is another correction to Shanks & Pottenger. +# JohnTWB writes that Japanese forces did not surrender control in +# Indonesia until 1945-09-01 00:00 at the earliest (in Jakarta) and +# other formal surrender ceremonies were September 9, 11, and 13, plus +# September 12 for the regional surrender to Mountbatten in Singapore. +# These would be the earliest possible times for a change. +# Régimes horaires pour le monde entier, by Henri Le Corre, (Éditions +# Traditionnelles, 1987, Paris) says that Java and Madura switched +# from UT +09 to +07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura +# (Hollandia). For now, assume all Indonesian locations other than Jayapura +# switched on 1945-09-23. +# +# From Paul Eggert (2013-08-11): +# Normally the tz database uses English-language abbreviations, but in +# Indonesia it's typical to use Indonesian-language abbreviations even +# when writing in English. For example, see the English-language +# summary published by the Time and Frequency Laboratory of the +# Research Center for Calibration, Instrumentation and Metrology, +# Indonesia, (2006-09-29). +# The time zone abbreviations and UT offsets are: +# +# WIB - +07 - Waktu Indonesia Barat (Indonesia western time) +# WITA - +08 - Waktu Indonesia Tengah (Indonesia central time) +# WIT - +09 - Waktu Indonesia Timur (Indonesia eastern time) +# +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +# Java, Sumatra +Zone Asia/Jakarta 7:07:12 - LMT 1867 Aug 10 +# Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13, +# but this must be a typo. + 7:07:12 - BMT 1923 Dec 31 23:47:12 # Batavia + 7:20 - JAVT 1932 Nov # Java Time + 7:30 - WIB 1942 Mar 23 + 9:00 - JST 1945 Sep 23 + 7:30 - WIB 1948 May + 8:00 - WIB 1950 May + 7:30 - WIB 1964 + 7:00 - WIB +# west and central Borneo +Zone Asia/Pontianak 7:17:20 - LMT 1908 May + 7:17:20 - PMT 1932 Nov # Pontianak MT + 7:30 - WIB 1942 Jan 29 + 9:00 - JST 1945 Sep 23 + 7:30 - WIB 1948 May + 8:00 - WIB 1950 May + 7:30 - WIB 1964 + 8:00 - WITA 1988 Jan 1 + 7:00 - WIB +# Sulawesi, Lesser Sundas, east and south Borneo +Zone Asia/Makassar 7:57:36 - LMT 1920 + 7:57:36 - MMT 1932 Nov # Macassar MT + 8:00 - WITA 1942 Feb 9 + 9:00 - JST 1945 Sep 23 + 8:00 - WITA +# Maluku Islands, West Papua, Papua +Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov + 9:00 - WIT 1944 Sep 1 + 9:30 - ACST 1964 + 9:00 - WIT + +# Iran + +# From Roozbeh Pournader (2003-03-15): +# This is an English translation of what I just found (originally in Persian). +# The Gregorian dates in brackets are mine: +# +# Official Newspaper No. 13548-1370/6/25 [1991-09-16] +# No. 16760/T233 H 1370/6/10 [1991-09-01] +# +# The Rule About Change of the Official Time of the Country +# +# The Board of Ministers, in the meeting dated 1370/5/23 [1991-08-14], +# based on the suggestion number 2221/D dated 1370/4/22 [1991-07-13] +# of the Country's Organization for Official and Employment Affairs, +# and referring to the law for equating the working hours of workers +# and officers in the whole country dated 1359/4/23 [1980-07-14], and +# for synchronizing the official times of the country, agreed that: +# +# The official time of the country will should move forward one hour +# at the 24[:00] hours of the first day of Farvardin and should return +# to its previous state at the 24[:00] hours of the 30th day of +# Shahrivar. +# +# First Deputy to the President - Hassan Habibi +# +# From personal experience, that agrees with what has been followed *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 22 19:24:47 2016 Return-Path: Delivered-To: svn-src-all@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 8F9AFC1D971; Sat, 22 Oct 2016 19:24:47 +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 6A75CCD4; Sat, 22 Oct 2016 19:24:47 +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 u9MJOk0W079642; Sat, 22 Oct 2016 19:24:46 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MJOkIR079638; Sat, 22 Oct 2016 19:24:46 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221924.u9MJOkIR079638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 19:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307783 - head/contrib/tzdata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 19:24:47 -0000 Author: bapt Date: Sat Oct 22 19:24:46 2016 New Revision: 307783 URL: https://svnweb.freebsd.org/changeset/base/307783 Log: Import tzdata 2016h MFC after: 2 days Modified: head/contrib/tzdata/asia head/contrib/tzdata/australasia head/contrib/tzdata/europe head/contrib/tzdata/northamerica Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Sat Oct 22 19:19:31 2016 (r307782) +++ head/contrib/tzdata/asia Sat Oct 22 19:24:46 2016 (r307783) @@ -2544,11 +2544,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Paul Eggert (2015-03-03): # http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014 # says that the fall 2014 transition was Oct 23 at 24:00. -# For future dates, guess the last Friday in March at 24:00 through -# the first Friday on or after October 21 at 00:00. This is consistent with -# the predictions in today's editions of the following URLs: -# http://www.timeanddate.com/time/change/gaza-strip/gaza -# http://www.timeanddate.com/time/change/west-bank/hebron # From Hannah Kreitem (2016-03-09): # http://www.palestinecabinet.gov.ps/WebSite/ar/ViewDetails?ID=31728 @@ -2558,7 +2553,21 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # # From Paul Eggert (2016-03-12): # Predict spring transitions on March's last Saturday at 01:00 from now on. -# Leave fall predictions alone for now. + +# From Sharef Mustafa (2016-10-19): +# [T]he Palestinian cabinet decision (Mar 8th 2016) published on +# http://www.palestinecabinet.gov.ps/WebSite/Upload/Decree/GOV_17/16032016134830.pdf +# states that summer time will end on Oct 29th at 01:00. +# +# From Tim Parenti (2016-10-19): +# Predict fall transitions on October's last Saturday at 01:00 from now on. +# This is consistent with the 2016 transition as well as our spring +# predictions. +# +# From Paul Eggert (2016-10-19): +# It's also consistent with predictions in the following URLs today: +# http://www.timeanddate.com/time/change/gaza-strip/gaza +# http://www.timeanddate.com/time/change/west-bank/hebron # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S @@ -2587,9 +2596,10 @@ Rule Palestine 2011 only - Sep 30 0:00 0 Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S Rule Palestine 2012 only - Sep 21 1:00 0 - Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - -Rule Palestine 2014 max - Oct Fri>=21 0:00 0 - +Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 - Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S +Rule Palestine 2016 max - Oct lastSat 1:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct @@ -2739,45 +2749,31 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 J # People who live in regions under Tamil control can use [TZ='Asia/Kolkata'], # as that zone has agreed with the Tamil areas since our cutoff date of 1970. -# From K Sethu (2006-04-25): -# I think the abbreviation LKT originated from the world of computers at -# the time of or subsequent to the time zone changes by SL Government -# twice in 1996 and probably SL Government or its standardization -# agencies never declared an abbreviation as a national standard. -# -# I recollect before the recent change the government announcements -# mentioning it as simply changing Sri Lanka Standard Time or Sri Lanka -# Time and no mention was made about the abbreviation. -# -# If we look at Sri Lanka Department of Government's "Official News -# Website of Sri Lanka" ... http://www.news.lk/ we can see that they -# use SLT as abbreviation in time stamp at the beginning of each news -# item.... -# -# Within Sri Lanka I think LKT is well known among computer users and -# administrators. In my opinion SLT may not be a good choice because the -# nation's largest telcom / internet operator Sri Lanka Telcom is well -# known by that abbreviation - simply as SLT (there IP domains are -# slt.lk and sltnet.lk). -# -# But if indeed our government has adopted SLT as standard abbreviation -# (that we have not known so far) then it is better that it be used for -# all computers. - -# From Paul Eggert (2006-04-25): -# One possibility is that we wait for a bit for the dust to settle down -# and then see what people actually say in practice. +# From Sadika Sumanapala (2016-10-19): +# According to http://www.sltime.org (maintained by Measurement Units, +# Standards & Services Department, Sri Lanka) abbreviation for Sri Lanka +# standard time is SLST. +# +# From Paul Eggert (2016-10-18): +# "SLST" seems to be reasonably recent and rarely-used outside time +# zone nerd sources. I searched Google News and found three uses of +# it in the International Business Times of India in February and +# March of this year when discussing cricket match times, but nothing +# since then (though there has been a lot of cricket) and nothing in +# other English-language news sources. Our old abbreviation "LKT" is +# even worse. For now, let's use a numeric abbreviation; we can +# switch to "SLST" if it catches on. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Colombo 5:19:24 - LMT 1880 5:19:32 - MMT 1906 # Moratuwa Mean Time - 5:30 - IST 1942 Jan 5 - 5:30 0:30 IHST 1942 Sep - 5:30 1:00 IST 1945 Oct 16 2:00 - 5:30 - IST 1996 May 25 0:00 - 6:30 - LKT 1996 Oct 26 0:30 - 6:00 - LKT 2006 Apr 15 0:30 - 5:30 - IST + 5:30 - +0530 1942 Jan 5 + 5:30 0:30 +0530/+06 1942 Sep + 5:30 1:00 +0530/+0630 1945 Oct 16 2:00 + 5:30 - +0530 1996 May 25 0:00 + 6:30 - +0630 1996 Oct 26 0:30 + 6:00 - +06 2006 Apr 15 0:30 + 5:30 - +0530 # Syria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Modified: head/contrib/tzdata/australasia ============================================================================== --- head/contrib/tzdata/australasia Sat Oct 22 19:19:31 2016 (r307782) +++ head/contrib/tzdata/australasia Sat Oct 22 19:24:46 2016 (r307783) @@ -350,7 +350,13 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # commencing at 2.00 am on Sunday 1st November, 2015 and ending at # 3.00 am on Sunday 17th January, 2016. -# From Paul Eggert (2015-09-01): +# From Raymond Kumar (2016-10-04): +# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-6th-NOVEMBER,-2016.aspx +# "Fiji's daylight savings will begin on Sunday, 6 November 2016, when +# clocks go forward an hour at 2am to 3am.... Daylight Saving will +# end at 3.00am on Sunday 15th January 2017." + +# From Paul Eggert (2016-10-03): # For now, guess DST from 02:00 the first Sunday in November to # 03:00 the third Sunday in January. Although ad hoc, it matches # transitions since late 2014 and seems more likely to match future Modified: head/contrib/tzdata/europe ============================================================================== --- head/contrib/tzdata/europe Sat Oct 22 19:19:31 2016 (r307782) +++ head/contrib/tzdata/europe Sat Oct 22 19:24:46 2016 (r307783) @@ -1908,7 +1908,7 @@ Zone Europe/Monaco 0:29:32 - LMT 1891 Ma # Amsterdam mean time. # The data entries before 1945 are taken from -# http://www.phys.uu.nl/~vgent/wettijd/wettijd.htm +# http://www.staff.science.uu.nl/~gent0113/idl/idl.htm # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time @@ -3427,22 +3427,24 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Ju # Turkey -# From Amar Devegowda (2007-01-03): -# The time zone rules for Istanbul, Turkey have not been changed for years now. -# ... The latest rules are available at: -# http://www.timeanddate.com/worldclock/timezone.html?n=107 -# From Steffen Thorsen (2007-01-03): -# I have been able to find press records back to 1996 which all say that -# DST started 01:00 local time and end at 02:00 local time. I am not sure -# what happened before that. One example for each year from 1996 to 2001: -# http://newspot.byegm.gov.tr/arsiv/1996/21/N4.htm -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING97/03/97X03X25.TXT -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING98/03/98X03X02.HTM -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING99/10/99X10X26.HTM#%2016 -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2000/03/00X03X06.HTM#%2021 -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2001/03/23x03x01.HTM#%2027 -# From Paul Eggert (2007-01-03): -# Prefer the above source to Shanks & Pottenger for time stamps after 1990. +# From Kıvanç Yazan (2016-09-25): +# 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with +# no exceptions. +# 2) 1994's lastSun was overridden with Mar 20 ... +# Here are official papers: +# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986 +# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987 +# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988 +# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989 +# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992 +# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995 +# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994 +# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997 +# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000 +# http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 +# http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 +# From Paul Eggert (2016-09-25): +# Prefer the above sources to Shanks & Pottenger for time stamps after 1985. # From Steffen Thorsen (2007-03-09): # Starting 2007 though, it seems that they are adopting EU's 1:00 UTC @@ -3551,10 +3553,10 @@ Rule Turkey 1983 only - Jul 31 0:00 1:00 Rule Turkey 1983 only - Oct 2 0:00 0 - Rule Turkey 1985 only - Apr 20 0:00 1:00 S Rule Turkey 1985 only - Sep 28 0:00 0 - -Rule Turkey 1986 1990 - Mar lastSun 2:00s 1:00 S -Rule Turkey 1986 1990 - Sep lastSun 2:00s 0 - -Rule Turkey 1991 2006 - Mar lastSun 1:00s 1:00 S -Rule Turkey 1991 1995 - Sep lastSun 1:00s 0 - +Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S +Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 - +Rule Turkey 1994 only - Mar 20 1:00s 1:00 S +Rule Turkey 1995 2006 - Mar lastSun 1:00s 1:00 S Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Istanbul 1:55:52 - LMT 1880 Modified: head/contrib/tzdata/northamerica ============================================================================== --- head/contrib/tzdata/northamerica Sat Oct 22 19:19:31 2016 (r307782) +++ head/contrib/tzdata/northamerica Sat Oct 22 19:24:46 2016 (r307783) @@ -24,8 +24,32 @@ # was the result of his proposals at the Convention of Railroad Trunk Lines # in New York City (1869-10). His 1870 proposal was based on Washington, DC, # but in 1872-05 he moved the proposed origin to Greenwich. -# His proposal was adopted by the railroads on 1883-11-18 at 12:00, -# and the most of the country soon followed suit. + +# From Paul Eggert (2016-09-21): +# Dowd's proposal left many details unresolved, such as where to draw +# lines between time zones. The key individual who made time zones +# work in the US was William Frederick Allen - railway engineer, +# managing editor of the Travelers' Guide, and secretary of the +# General Time Convention, a railway standardization group. Allen +# spent months in dialogs with scientific and railway leaders, +# developed a workable plan to institute time zones, and presented it +# to the General Time Convention on 1883-04-11, saying that his plan +# meant "local time would be practically abolished" - a plus for +# railway scheduling. By the next convention on 1883-10-11 nearly all +# railroads had agreed and it took effect on 1883-11-18 at 12:00. +# That Sunday was called the "day of two noons", as the eastern parts +# of the new zones observed noon twice. Allen witnessed the +# transition in New York City, writing: +# +# I heard the bells of St. Paul's strike on the old time. Four +# minutes later, obedient to the electrical signal from the Naval +# Observatory ... the time-ball made its rapid descent, the chimes +# of old Trinity rang twelve measured strokes, and local time was +# abandoned, probably forever. +# +# Most of the US soon followed suit. See: +# Bartky IR. The adoption of standard time. Technol Cult 1989 Jan;30(1):25-56. +# http://dx.doi.org/10.2307/3105430 # From Paul Eggert (2005-04-16): # That 1883 transition occurred at 12:00 new time, not at 12:00 old time. From owner-svn-src-all@freebsd.org Sat Oct 22 19:27:50 2016 Return-Path: Delivered-To: svn-src-all@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 C4A7FC1D9FF; Sat, 22 Oct 2016 19:27:50 +0000 (UTC) (envelope-from jhibbits@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 94AEAE61; Sat, 22 Oct 2016 19:27:50 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MJRnRX079795; Sat, 22 Oct 2016 19:27:49 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MJRnZu079794; Sat, 22 Oct 2016 19:27:49 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610221927.u9MJRnZu079794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 22 Oct 2016 19:27:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307784 - head/gnu/usr.bin/cc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 19:27:50 -0000 Author: jhibbits Date: Sat Oct 22 19:27:49 2016 New Revision: 307784 URL: https://svnweb.freebsd.org/changeset/base/307784 Log: Fix a typo from a manual merge. Modified: head/gnu/usr.bin/cc/Makefile.tgt Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Sat Oct 22 19:24:46 2016 (r307783) +++ head/gnu/usr.bin/cc/Makefile.tgt Sat Oct 22 19:27:49 2016 (r307784) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64spe)/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif From owner-svn-src-all@freebsd.org Sat Oct 22 19:36:14 2016 Return-Path: Delivered-To: svn-src-all@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 313B5C1DBC8; Sat, 22 Oct 2016 19:36:14 +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 003E92D7; Sat, 22 Oct 2016 19:36:13 +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 u9MJaD5V083558; Sat, 22 Oct 2016 19:36:13 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MJaDrf083557; Sat, 22 Oct 2016 19:36:13 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221936.u9MJaDrf083557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 19:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307785 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 19:36:14 -0000 Author: bapt Date: Sat Oct 22 19:36:12 2016 New Revision: 307785 URL: https://svnweb.freebsd.org/changeset/base/307785 Log: Import pci_vendors 2016.10.20 Modified: head/share/misc/pci_vendors Modified: head/share/misc/pci_vendors ============================================================================== --- head/share/misc/pci_vendors Sat Oct 22 19:27:49 2016 (r307784) +++ head/share/misc/pci_vendors Sat Oct 22 19:36:12 2016 (r307785) @@ -3,8 +3,8 @@ # # List of PCI ID's # -# Version: 2016.10.03 -# Date: 2016-10-03 03:15:01 +# Version: 2016.10.20 +# Date: 2016-10-20 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -245,8 +245,13 @@ 0013 53c875a 1000 1000 LSI53C875A PCI to Ultra SCSI Controller 0014 MegaRAID Tri-Mode SAS3516 + 1028 1fd4 PERC H745P MX 1d49 0602 ThinkSystem RAID 930-16i 4GB Flash PCIe 12Gb Adapter 0016 MegaRAID Tri-Mode SAS3508 + 1028 1fc9 PERC H840 Adapter + 1028 1fcb PERC H740P Adapter + 1028 1fcd PERC H740P Mini + 1028 1fcf PERC H740P Mini 1d49 0601 ThinkSystem RAID 930-8i 2GB Flash PCIe 12Gb Adapter 1d49 0603 ThinkSystem RAID 930-24i 4GB Flash PCIe 12Gb Adapter 1d49 0604 ThinkSystem RAID 930-8e 4GB Flash PCIe 12Gb Adapter @@ -376,6 +381,7 @@ 1028 1f4d PERC FD33xS 1028 1f4f PERC H730P Slim 1028 1f54 PERC FD33xD + 1028 1fd1 PERC H730P MX 17aa 1052 ThinkServer RAID 720i 17aa 1053 ThinkServer RAID 720ix 1d49 0600 ThinkSystem RAID 730-8i 1GB Cache PCIe 12Gb Adapter @@ -535,8 +541,11 @@ 0097 SAS3008 PCI-Express Fusion-MPT SAS-3 1000 3090 SAS9311-8i 1000 30e0 SAS9300-8i - 1028 1f45 12GB/s HBA internal + 1028 1f45 HBA330 Adapter 1028 1f46 12Gbps HBA + 1028 1f53 HBA330 Mini + 1028 1fd2 HBA330 MX + 1028 1fd3 HBA330 MMZ 00ab SAS3516 Fusion-MPT Tri-Mode RAID On Chip (ROC) 00ac SAS3416 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) 1d49 0201 ThinkSystem 9400-16i PCIe 12Gb HBA @@ -1588,7 +1597,7 @@ 1462 2938 Radeon R9 360 OEM 1462 3271 Radeon R9 360 OEM 1682 7360 Radeon R7 360 - 6660 Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330] + 6660 Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430] 1028 05ea Radeon HD 8670M 1028 06bf Radeon R5 M335 103c 1970 Radeon HD 8670M @@ -1596,6 +1605,7 @@ 103c 8136 Radeon R5 M330 17aa 3804 Radeon R5 M330 17aa 3809 Radeon R5 M330 + 17aa 381a Radeon R5 M430 17aa 390c Radeon R5 M330 6663 Sun PRO [Radeon HD 8570A/8570M] 1025 0846 Radeon HD 8570A @@ -2866,11 +2876,12 @@ 174b e180 Radeon HD 7350 17af 3015 Radeon HD 7350 68fe Cedar LE - 6900 Topaz XT [Radeon R7 M260/M265 / M340/M360] + 6900 Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445] 1025 1056 Radeon R7 M360 / R8 M365DX 1028 0640 Radeon R7 M260/M265 1028 0643 Radeon R7 M260/M265 1028 067f Radeon R7 M260 + 1028 0767 Radeon R7 M445 1028 130a Radeon R7 M260 103c 2263 Radeon R7 M260 103c 2269 Radeon R7 M260 @@ -2881,6 +2892,7 @@ 103c 80b5 Radeon R7 M360 103c 80b9 Radeon R7 M360 103c 811c Radeon R7 M340 + 103c 8226 Radeon R7 M440 10cf 1906 Radeon R7 M260 1170 9979 Radeon R7 M360 1179 f903 Radeon R7 M260 @@ -2892,6 +2904,7 @@ 17aa 5021 Radeon R7 M260 6901 Topaz PRO [Radeon R5 M255] 103c 1318 Radeon R6 M255DX + 6907 Meso XT [Radeon R5 M315] 6921 Amethyst XT [Radeon R9 M295X] 6929 Tonga XT GL [FirePro S7150] 692b Tonga PRO GL [FirePro W7100] @@ -3349,7 +3362,7 @@ 99a4 Trinity [Radeon HD 7400G] aa00 R600 HDMI Audio [Radeon HD 2900 GT/PRO/XT] aa01 RV635 HDMI Audio [Radeon HD 3650/3730/3750] - aa08 RV630 HDMI Audio [Radeon HD 2600 Series] + aa08 RV630 HDMI Audio [Radeon HD 2600 PRO/XT / HD 3610] aa10 RV610 HDMI Audio [Radeon HD 2350 PRO / 2400 PRO/XT / HD 3410] 174b aa10 Radeon HD 2400 PRO 18bc aa10 Radeon HD 2400 PRO @@ -3369,10 +3382,10 @@ aa68 Cedar HDMI Audio [Radeon HD 5400/6300/7300 Series] 1028 aa68 XPS 8300 aa80 Cayman/Antilles HDMI Audio [Radeon HD 6930/6950/6970/6990] - aa88 Barts HDMI Audio [Radeon HD 6800 Series] + aa88 Barts HDMI Audio [Radeon HD 6790/6850/6870 / 7720 OEM] aa90 Turks HDMI Audio [Radeon HD 6500/6600 / 6700M Series] 1028 04a3 Precision M4600 - aa98 Caicos HDMI Audio [Radeon HD 6400 Series] + aa98 Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] 174b aa98 Radeon HD 6450 1GB DDR3 aaa0 Tahiti HDMI Audio [Radeon HD 7870 XT / 7950/7970] aab0 Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] @@ -7347,6 +7360,7 @@ 8533 PEX 8533 32-lane, 6-port PCI Express Switch 8547 PEX 8547 48-lane, 3-port PCI Express Switch 8548 PEX 8548 48-lane, 9-port PCI Express Switch + 8603 PEX 8603 3-lane, 3-Port PCI Express Gen 2 (5.0 GT/s) Switch 8604 PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch 8605 PEX 8605 PCI Express 4-port Gen2 Switch 8606 PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch @@ -17921,7 +17935,7 @@ 1015 MT27710 Family [ConnectX-4 Lx] 1016 MT27710 Family [ConnectX-4 Lx Virtual Function] 1017 MT27800 Family [ConnectX-5] - 1018 MT28800 Family [ConnectX-5 Virtual Function] + 1018 MT27800 Family [ConnectX-5 Virtual Function] 1019 MT28800 Family [ConnectX-5 Ex] 101a MT28800 Family [ConnectX-5 Ex Virtual Function] 101b MT28831 @@ -17932,6 +17946,7 @@ 1020 MT28860 1021 MT28861 1974 MT28800 Family [ConnectX-5 PCIe Bridge] + 1975 MT416842 Family [BlueField SoC PCIe Bridge] 5274 MT21108 InfiniBridge 5a44 MT23108 InfiniHost 5a45 MT23108 [Infinihost HCA Flash Recovery] @@ -17966,6 +17981,9 @@ 7121 NPS-600 configuration and management interface 7122 NPS-600 network interface PF 7123 NPS-600 network interface VF + a2d0 MT416842 + a2d1 MT416842 + a2d3 MT416842 BlueField multicore SoC family VF # SwitchX-2, 40GbE switch c738 MT51136 c739 MT51136 GW @@ -18638,7 +18656,12 @@ 7018 AP408: 32-Channel Digital I/O Module 701a AP220-16 12-Bit, 16-Channel Analog Output Module 701b AP231-16 16-Bit, 16-Channel Analog Output Module + 7021 APA7-201 Reconfigurable Artix-7 FPGA module 48 TTL channels + 7022 APA7-202 Reconfigurable Artix-7 FPGA module 24 RS485 channels + 7023 APA7-203 Reconfigurable Artix-7 FPGA module 24 TTL & 12 RS485 channels + 7024 APA7-204 Reconfigurable Artix-7 FPGA module 24 LVDS channels 7042 AP482 Counter Timer Module with TTL Level Input/Output + 7043 AP483 Counter Timer Module with TTL Level and RS422 Input/Output 7044 AP484 Counter Timer Module with RS422 Input/Output 16da Advantech Co., Ltd. 0011 INES GPIB-PCI @@ -18881,6 +18904,7 @@ 0401 Datacenter Technologies QDF2400 PCI Express Root Port 17cc NetChip Technology, Inc 2280 USB 2.0 +17cd Cadence Design Systems, Inc. 17cf Z-Com, Inc. 17d3 Areca Technology Corp. 1110 ARC-1110 4-Port PCI-X to SATA RAID Controller @@ -20290,7 +20314,8 @@ 1432 8102 EN-8102P 10GbE Ethernet Adapter 1fc9 3015 Ethernet Adapter 4026 TN9610 10GbE SFP+ Ethernet Adapter - 4027 TN9710 10GBase-T/NBASE-T Ethernet Adapter + 4027 TN9710P 10GBase-T/NBASE-T Ethernet Adapter + 4527 TN9710Q 5GBase-T/NBASE-T Ethernet Adapter 1fcc StreamLabs f416 MS416 fb01 MH4LM @@ -22295,6 +22320,7 @@ 17aa 4007 82599ES 10-Gigabit SFI/SFP+ Network Connection 17aa 402b 82599ES 10Gb 2-port Server Adapter X520-DA2 17aa 402f FPGA Card XC7VX690T-3FFG1157E + 18d4 0c09 82599ES 10Gb 2-port SFP+ OCP Mezz Card MOP81-I-10GS2 1bd4 001b 10G SFP+ DP ER102Fi4 Rack Adapter 1bd4 002f 10G SFP+ DP EP102Fi4A Adapter 1bd4 0032 10G SFP+ DP EP102Fi4 Adapter @@ -22570,8 +22596,15 @@ 1520 I350 Ethernet Controller Virtual Function 1521 I350 Gigabit Network Connection 1028 0602 Gigabit 2P I350-t LOM + 1028 0693 Gigabit 2P I350-t LOM + 1028 06e2 Gigabit 2P I350-t LOM + 1028 0757 Gigabit I350-t LOM + 1028 075a Gigabit I350-t LOM 1028 1f60 Gigabit 4P I350-t rNDC 1028 1f62 Gigabit 4P X540/I350 rNDC + 1028 1fa8 Ethernet 10G 4P X550/I350 rNDC + 1028 1fa9 Ethernet 10G 4P X550 rNDC + 1028 1faa Gigabit 4P X550/I350 rNDC 1028 ff9a Gigabit 4P X710/I350 rNDC 103c 17d1 Ethernet 1Gb 4-port 366FLR Adapter 103c 2003 Ethernet 1Gb 2-port 367i Adapter @@ -22590,6 +22623,7 @@ 15d9 0652 Dual Port i350 GbE MicroLP [AOC-CGP-i2] 17aa 1074 ThinkServer I350-T4 AnyFabric 17aa 4005 I350 Gigabit Network Connection + 18d4 0c07 I350 1Gb 2-port RJ45 OCP Mezz Card MOP41-I-1GT2 1bd4 001d 1G base-T QP EP014Ti1 Adapter 1bd4 0035 1G base-T QP EP014Ti1 Adapter 8086 0001 Ethernet Server Adapter I350-T4 @@ -22698,6 +22732,7 @@ 1028 1fa9 Ethernet 10G 4P X550 rNDC 1590 00d1 Ethernet 10Gb 2-port 562T Adapter 1590 00d2 Ethernet 10Gb 2-port 562FLR-T Adapter + 18d4 0c08 X550 10Gb 2-port RJ45 OCP Mezz Card MOP81-I-10GT2 8086 0001 Ethernet Converged Network Adapter X550-T2 8086 001a Ethernet Converged Network Adapter X550-T2 8086 0022 Ethernet Converged Network Adapter X550-T2 @@ -22782,11 +22817,11 @@ 108e 0000 Ethernet Controller X710 for 10GBASE-T 108e 4857 Ethernet Controller X710 for 10GBASE-T 1587 Ethernet Controller XL710 for 20GbE backplane - 103c 0000 HP Flex-20 20Gb 2-port 660FLB Adapter - 103c 22fe HP Flex-20 20Gb 2-port 660FLB Adapter + 103c 0000 HPE Ethernet 10/20Gb 2-port 660FLB Adapter + 103c 22fe HPE Ethernet 10/20Gb 2-port 660FLB Adapter 1588 Ethernet Controller XL710 for 20GbE backplane - 103c 0000 HP Flex-20 20Gb 2-port 660M Adapter - 103c 22ff HP Flex-20 20Gb 2-port 660M Adapter + 103c 0000 HPE Ethernet 10/20Gb 2-port 660M Adapter + 103c 22ff HPE Ethernet 10/20Gb 2-port 660M Adapter 1589 Ethernet Controller X710/X557-AT 10GBASE-T 108e 0000 Quad Port 10GBase-T Adapter 108e 7b1c Quad Port 10GBase-T Adapter @@ -23169,7 +23204,7 @@ 1e09 7 Series Chipset Family 2-port SATA Controller [IDE mode] 144d c652 NP300E5C series laptop 1e0e 7 Series/C210 Series Chipset Family SATA Controller [RAID mode] - 1e10 7 Series/C210 Series Chipset Family PCI Express Root Port 1 + 1e10 7 Series/C216 Chipset Family PCI Express Root Port 1 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -23181,7 +23216,7 @@ 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A 1e14 7 Series/C210 Series Chipset Family PCI Express Root Port 3 - 1e16 7 Series/C210 Series Chipset Family PCI Express Root Port 4 + 1e16 7 Series/C216 Chipset Family PCI Express Root Port 4 1043 108d VivoBook X202EV 1043 1477 N56VZ 144d c652 NP300E5C series laptop @@ -23194,7 +23229,7 @@ 1e1c 7 Series/C210 Series Chipset Family PCI Express Root Port 7 1e1e 7 Series/C210 Series Chipset Family PCI Express Root Port 8 1849 1e1e Motherboard - 1e20 7 Series/C210 Series Chipset Family High Definition Audio Controller + 1e20 7 Series/C216 Chipset Family High Definition Audio Controller 1028 054b Dell XPS One 2710 1043 108d VivoBook X202EV 1043 1477 N56VZ @@ -23203,7 +23238,7 @@ 1043 8445 ASUS P8Z77-V LX Motherboard 144d c652 NP300E5C series laptop 1849 1898 Z77 Extreme4 motherboard - 1e22 7 Series/C210 Series Chipset Family SMBus Controller + 1e22 7 Series/C216 Chipset Family SMBus Controller 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -23213,14 +23248,14 @@ 1e24 7 Series/C210 Series Chipset Family Thermal Management Controller 1043 1517 Zenbook Prime UX31A 1e25 7 Series/C210 Series Chipset Family DMI to PCI Bridge - 1e26 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 + 1e26 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A 1043 84ca P8 series motherboard 144d c652 NP300E5C series laptop 1849 1e26 Motherboard - 1e2d 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 + 1e2d 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -23235,7 +23270,7 @@ 1043 84ca P8 series motherboard 1849 1e31 Motherboard 1e33 7 Series/C210 Series Chipset Family LAN Controller - 1e3a 7 Series/C210 Series Chipset Family MEI Controller #1 + 1e3a 7 Series/C216 Chipset Family MEI Controller #1 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -26234,10 +26269,21 @@ 37cd X722 Virtual Function 37ce Ethernet Connection X722 for 10GbE backplane 1590 0215 Ethernet 10Gb 2-port 568i Adapter + 17aa 4023 Intel Ethernet Connection X722 for 10GbE backplane 37cf Ethernet Connection X722 for 10GbE QSFP+ 37d0 Ethernet Connection X722 for 10GbE SFP+ 37d1 Ethernet Connection X722 for 1GbE + 17aa 4020 Intel Ethernet Connection X722 for 1GbE + 17aa 4021 Intel Ethernet Connection X722 for 1GbE + 17aa 4022 Intel Ethernet Connection X722 for 1GbE + 8086 4020 Ethernet Connection X722 for 1GbE + 8086 4021 Ethernet Connection X722 for 1GbE + 8086 4022 Ethernet Connection X722 for 1GbE 37d2 Ethernet Connection X722 for 10GBASE-T + 17aa 4020 Intel Ethernet Connection X722 for 10GBASE + 17aa 4021 Intel Ethernet Connection X722 for 10GBASE + 8086 4020 Ethernet Connection X722 for 10GBASE + 8086 4021 Ethernet Connection X722 for 10GBASE 37d3 Ethernet Connection X722 for 10GbE SFP+ 37d4 Ethernet Connection X722 for 10GbE QSFP+ 37d9 X722 Hyper-V Virtual Function From owner-svn-src-all@freebsd.org Sat Oct 22 19:51:33 2016 Return-Path: Delivered-To: svn-src-all@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 E4DE4C1DF8D; Sat, 22 Oct 2016 19:51:33 +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 B40D2C7C; Sat, 22 Oct 2016 19:51:33 +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 u9MJpWSc088254; Sat, 22 Oct 2016 19:51:32 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MJpWbC088252; Sat, 22 Oct 2016 19:51:32 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610221951.u9MJpWbC088252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 19:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307786 - in head: etc/rc.d tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 19:51:34 -0000 Author: bapt Date: Sat Oct 22 19:51:32 2016 New Revision: 307786 URL: https://svnweb.freebsd.org/changeset/base/307786 Log: Do not install NIS program rc script if WITHOUT_NIS is set PR: 213375 Submitted by: sergey@akhmatov.ru MFC after: 3 days Modified: head/etc/rc.d/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Sat Oct 22 19:36:12 2016 (r307785) +++ head/etc/rc.d/Makefile Sat Oct 22 19:51:32 2016 (r307786) @@ -118,14 +118,17 @@ FILES= DAEMON \ ugidfw \ ${_utx} \ var \ - watchdogd \ - ypbind \ + watchdogd + +.if ${MK_NIS} != "no" +FILES+= ypbind \ ypldap \ yppasswdd \ ypserv \ ypset \ ypupdated \ ypxfrd +.endif .if ${MK_ACCT} != "no" FILESGROUPS+= ACCT Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Oct 22 19:36:12 2016 (r307785) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sat Oct 22 19:51:32 2016 (r307786) @@ -6113,6 +6113,13 @@ OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-N .endif .if ${MK_NIS} == no +OLD_FILES+=etc/rc.d/ypbind +OLD_FILES+=etc/rc.d/ypldap +OLD_FILES+=etc/rc.d/yppasswdd +OLD_FILES+=etc/rc.d/ypserv +OLD_FILES+=etc/rc.d/ypset +OLD_FILES+=etc/rc.d/ypupdated +OLD_FILES+=etc/rc.d/ypxfrd OLD_FILES+=usr/bin/ypcat OLD_FILES+=usr/bin/ypchfn OLD_FILES+=usr/bin/ypchpass From owner-svn-src-all@freebsd.org Sat Oct 22 20:00:41 2016 Return-Path: Delivered-To: svn-src-all@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 52984C1C486; Sat, 22 Oct 2016 20:00:41 +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 1D5AC2BB; Sat, 22 Oct 2016 20:00:41 +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 u9MK0eMB091262; Sat, 22 Oct 2016 20:00:40 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MK0epb091261; Sat, 22 Oct 2016 20:00:40 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222000.u9MK0epb091261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307787 - head/sys/boot/efi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:00:41 -0000 Author: bapt Date: Sat Oct 22 20:00:39 2016 New Revision: 307787 URL: https://svnweb.freebsd.org/changeset/base/307787 Log: Fix typo in the COMPILER_VERSION check PR: 213120 Submitted by: Yuta Satoh MFC after: 3 days Modified: head/sys/boot/efi/Makefile Modified: head/sys/boot/efi/Makefile ============================================================================== --- head/sys/boot/efi/Makefile Sat Oct 22 19:51:32 2016 (r307786) +++ head/sys/boot/efi/Makefile Sat Oct 22 20:00:39 2016 (r307787) @@ -4,7 +4,7 @@ # In-tree GCC does not support __attribute__((ms_abi)), but gcc newer # than 4.5 supports it. -.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 404500 +.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" .if ${MK_FDT} != "no" @@ -18,6 +18,6 @@ SUBDIR+= fdt SUBDIR+= libefi loader boot1 .endif -.endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 404500 +.endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 .include From owner-svn-src-all@freebsd.org Sat Oct 22 20:39:19 2016 Return-Path: Delivered-To: svn-src-all@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 D3280C1D4C5; Sat, 22 Oct 2016 20:39:19 +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 90E4EE45; Sat, 22 Oct 2016 20:39:19 +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 u9MKdIV6006766; Sat, 22 Oct 2016 20:39:18 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKdI1n006763; Sat, 22 Oct 2016 20:39:18 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222039.u9MKdI1n006763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:39: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: r307788 - in stable/11: tools/build/mk usr.sbin usr.sbin/etcupdate X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:39:19 -0000 Author: bapt Date: Sat Oct 22 20:39:18 2016 New Revision: 307788 URL: https://svnweb.freebsd.org/changeset/base/307788 Log: MFC r303784, r303785, r305620: r303784: etcupdate: directly use diff3(1) instead of merge(1) During the last attempt to rmeove GNU rcs, 2 blockers were spotted: We need an ident(1) and etcupdate(8) uses merge(1). Now nothing should prevent to remove rcs from base Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D7401 r303785: always install etcupdate Now that etcupdate does not depend on rcs anymore there is no need to conditionnally install it r305620: (by vangyzen ) etcupdate: preserve the metadata of the destination file When using diff3 to perform a three-way merge, etcupdate lost the destination file's metadata. The metadata from the temporary file were used instead. This was unpleasant for rc.d scripts, which require execute permission. Use "cat >" to overwrite the destination file's contents while preserving its metadata. Reviewed by: bapt Sponsored by: Dell Technologies Differential Revision: https://reviews.freebsd.org/D7817 Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc stable/11/usr.sbin/Makefile stable/11/usr.sbin/etcupdate/etcupdate.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Oct 22 20:00:39 2016 (r307787) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Oct 22 20:39:18 2016 (r307788) @@ -6800,7 +6800,6 @@ OLD_FILES+=usr/bin/rcsdiff OLD_FILES+=usr/bin/rcsfreeze OLD_FILES+=usr/bin/rcsmerge OLD_FILES+=usr/bin/rlog -OLD_FILES+=usr/sbin/etcupdate OLD_FILES+=usr/share/man/man1/ci.1.gz OLD_FILES+=usr/share/man/man1/co.1.gz OLD_FILES+=usr/share/man/man1/merge.1.gz @@ -6812,16 +6811,6 @@ OLD_FILES+=usr/share/man/man1/rcsintro.1 OLD_FILES+=usr/share/man/man1/rcsmerge.1.gz OLD_FILES+=usr/share/man/man1/rlog.1.gz OLD_FILES+=usr/share/man/man5/rcsfile.5.gz -OLD_FILES+=usr/share/man/man8/etcupdate.8.gz -OLD_FILES+=usr/tests/usr.sbin/etcupdate/Kyuafile -OLD_FILES+=usr/tests/usr.sbin/etcupdate/always_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/conflicts_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/fbsdid_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/ignore_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/preworld_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/tests_test -OLD_FILES+=usr/tests/usr.sbin/etcupdate/tzsetup_test -OLD_DIRS+=usr/tests/usr.sbin/etcupdate .endif #.if ${MK_RESCUE} == no Modified: stable/11/usr.sbin/Makefile ============================================================================== --- stable/11/usr.sbin/Makefile Sat Oct 22 20:00:39 2016 (r307787) +++ stable/11/usr.sbin/Makefile Sat Oct 22 20:39:18 2016 (r307788) @@ -25,6 +25,7 @@ SUBDIR= adduser \ digictl \ diskinfo \ dumpcis \ + etcupdate \ extattr \ extattrctl \ fifolog \ @@ -188,7 +189,6 @@ SUBDIR.${MK_QUOTAS}+= edquota SUBDIR.${MK_QUOTAS}+= quotaon SUBDIR.${MK_QUOTAS}+= repquota SUBDIR.${MK_RCMDS}+= rwhod -SUBDIR.${MK_RCS}+= etcupdate SUBDIR.${MK_SENDMAIL}+= editmap SUBDIR.${MK_SENDMAIL}+= mailstats SUBDIR.${MK_SENDMAIL}+= makemap Modified: stable/11/usr.sbin/etcupdate/etcupdate.sh ============================================================================== --- stable/11/usr.sbin/etcupdate/etcupdate.sh Sat Oct 22 20:00:39 2016 (r307787) +++ stable/11/usr.sbin/etcupdate/etcupdate.sh Sat Oct 22 20:39:18 2016 (r307788) @@ -814,15 +814,19 @@ merge_file() local res # Try the merge to see if there is a conflict. - merge -q -p ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 >/dev/null 2>&3 + diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > /dev/null 2>&3 res=$? case $res in 0) # No conflicts, so just redo the merge to the # real file. - log "merge ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1" + log "diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1" if [ -z "$dryrun" ]; then - merge ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 + temp=$(mktemp -t etcupdate) + diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > ${temp} + # Use "cat >" to preserve metadata. + cat ${temp} > ${DESTDIR}$1 + rm -f ${temp} fi post_install_file $1 echo " M $1" @@ -832,10 +836,10 @@ merge_file() # the conflicts directory. if [ -z "$dryrun" ]; then install_dirs $NEWTREE $CONFLICTS $1 - log "cp -Rp ${DESTDIR}$1 ${CONFLICTS}$1" - cp -Rp ${DESTDIR}$1 ${CONFLICTS}$1 >&3 2>&1 - merge -A -q -L "yours" -L "original" -L "new" \ - ${CONFLICTS}$1 ${OLDTREE}$1 ${NEWTREE}$1 + log "diff3 -m -A ${DESTDIR}$1 ${CONFLICTS}$1" + diff3 -m -A -L "yours" -L "original" -L "new" \ + ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > \ + ${CONFLICTS}$1 fi echo " C $1" ;; From owner-svn-src-all@freebsd.org Sat Oct 22 20:46:58 2016 Return-Path: Delivered-To: svn-src-all@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 A84F5C1D7AC; Sat, 22 Oct 2016 20:46:58 +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 7FCCD65F; Sat, 22 Oct 2016 20:46:58 +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 u9MKkvC2010478; Sat, 22 Oct 2016 20:46:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKkvmW010477; Sat, 22 Oct 2016 20:46:57 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222046.u9MKkvmW010477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:46:57 +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: r307789 - stable/11/usr.bin/sdiff X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:46:58 -0000 Author: bapt Date: Sat Oct 22 20:46:57 2016 New Revision: 307789 URL: https://svnweb.freebsd.org/changeset/base/307789 Log: MFC r303783, r305927: r303783: sdiff: remove non finish/function code 2 extra options not available neither on other BSD nor in GNU sdiff: --diff-pid and --pipe-fd were present in the SoC code, none were usable Just remove it r305927: Remove reference of z(s)diff which was dropped before importing Modified: stable/11/usr.bin/sdiff/sdiff.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sdiff/sdiff.c ============================================================================== --- stable/11/usr.bin/sdiff/sdiff.c Sat Oct 22 20:39:18 2016 (r307788) +++ stable/11/usr.bin/sdiff/sdiff.c Sat Oct 22 20:46:57 2016 (r307789) @@ -104,9 +104,6 @@ enum { HLINES_OPT, LFILES_OPT, DIFFPROG_OPT, - PIPE_FD, - /* pid from the diff parent (if applicable) */ - DIFF_PID, NOOP_OPT, }; @@ -120,8 +117,6 @@ static struct option longopts[] = { { "output", required_argument, NULL, 'o' }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, - { "pipe-fd", required_argument, NULL, PIPE_FD }, - { "diff-pid", required_argument, NULL, DIFF_PID }, /* Options processed by diff. */ { "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT }, { "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT }, @@ -237,7 +232,7 @@ main(int argc, char **argv) FILE *diffpipe=NULL, *file1, *file2; size_t diffargc = 0, wflag = WIDTH; int ch, fd[2] = {-1}, status; - pid_t pid=0; pid_t ppid =-1; + pid_t pid=0; const char *outfile = NULL; struct option *popt; char **diffargv, *diffprog = DIFF_PATH, *filename1, *filename2, @@ -320,11 +315,6 @@ main(int argc, char **argv) if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; - case DIFF_PID: - ppid = strtonum(optarg, 0, INT_MAX, &errstr); - if (errstr) - errx(2, "diff pid value is %s: %s", errstr, optarg); - break; case HELP_OPT: for (i = 0; help_msg[i] != NULL; i++) printf("%s\n", help_msg[i]); @@ -393,35 +383,34 @@ main(int argc, char **argv) errx(2, "width is too large: %zu", width); line_width = width * 2 + 3; - if (ppid == -1 ) { - if (pipe(fd)) - err(2, "pipe"); - - switch (pid = fork()) { - case 0: - /* child */ - /* We don't read from the pipe. */ - close(fd[0]); - if (dup2(fd[1], STDOUT_FILENO) == -1) - err(2, "child could not duplicate descriptor"); - /* Free unused descriptor. */ - close(fd[1]); - execvp(diffprog, diffargv); - err(2, "could not execute diff: %s", diffprog); - break; - case -1: - err(2, "could not fork"); - break; - } + if (pipe(fd)) + err(2, "pipe"); - /* parent */ - /* We don't write to the pipe. */ + switch (pid = fork()) { + case 0: + /* child */ + /* We don't read from the pipe. */ + close(fd[0]); + if (dup2(fd[1], STDOUT_FILENO) == -1) + err(2, "child could not duplicate descriptor"); + /* Free unused descriptor. */ close(fd[1]); - - /* Open pipe to diff command. */ - if ((diffpipe = fdopen(fd[0], "r")) == NULL) - err(2, "could not open diff pipe"); + execvp(diffprog, diffargv); + err(2, "could not execute diff: %s", diffprog); + break; + case -1: + err(2, "could not fork"); + break; } + + /* parent */ + /* We don't write to the pipe. */ + close(fd[1]); + + /* Open pipe to diff command. */ + if ((diffpipe = fdopen(fd[0], "r")) == NULL) + err(2, "could not open diff pipe"); + if ((file1 = fopen(filename1, "r")) == NULL) err(2, "could not open %s", filename1); if ((file2 = fopen(filename2, "r")) == NULL) @@ -489,8 +478,8 @@ main(int argc, char **argv) } /* - * When sdiff/zsdiff detects a binary file as input, executes them with - * diff/zdiff to maintain the same behavior as GNU sdiff with binary input. + * When sdiff detects a binary file as input, executes them with + * diff to maintain the same behavior as GNU sdiff with binary input. */ static void binexec(char *diffprog, char *f1, char *f2) From owner-svn-src-all@freebsd.org Sat Oct 22 20:49:09 2016 Return-Path: Delivered-To: svn-src-all@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 AFE6EC1D915; Sat, 22 Oct 2016 20:49:09 +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 7BD9A916; Sat, 22 Oct 2016 20:49:09 +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 u9MKn8MP010624; Sat, 22 Oct 2016 20:49:08 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKn7ow010611; Sat, 22 Oct 2016 20:49:07 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222049.u9MKn7ow010611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:49:07 +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: r307790 - in stable/11/contrib/libucl: . haskell include m4 python python/src python/tests src tests/schema X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:49:09 -0000 Author: bapt Date: Sat Oct 22 20:49:07 2016 New Revision: 307790 URL: https://svnweb.freebsd.org/changeset/base/307790 Log: MFC r306544: Import libucl 20160812 Added: stable/11/contrib/libucl/haskell/ - copied from r306544, head/contrib/libucl/haskell/ stable/11/contrib/libucl/m4/gcov.m4 - copied unchanged from r306544, head/contrib/libucl/m4/gcov.m4 stable/11/contrib/libucl/python/tests/ - copied from r306544, head/contrib/libucl/python/tests/ Deleted: stable/11/contrib/libucl/python/test.sh stable/11/contrib/libucl/python/test_uclmodule.py Modified: stable/11/contrib/libucl/CMakeLists.txt stable/11/contrib/libucl/Makefile.unix stable/11/contrib/libucl/Makefile.w32 stable/11/contrib/libucl/README.md stable/11/contrib/libucl/include/ucl++.h stable/11/contrib/libucl/include/ucl.h stable/11/contrib/libucl/python/setup.py stable/11/contrib/libucl/python/src/uclmodule.c stable/11/contrib/libucl/src/ucl_parser.c stable/11/contrib/libucl/src/ucl_schema.c stable/11/contrib/libucl/src/ucl_util.c stable/11/contrib/libucl/tests/schema/patternProperties.json stable/11/contrib/libucl/tests/schema/refRemote.json Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libucl/CMakeLists.txt ============================================================================== --- stable/11/contrib/libucl/CMakeLists.txt Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/CMakeLists.txt Sat Oct 22 20:49:07 2016 (r307790) @@ -205,8 +205,7 @@ SET(UCLSRC src/ucl_util.c src/ucl_hash.c src/ucl_schema.c src/ucl_msgpack.c - src/ucl_sexp.c - src/xxhash.c) + src/ucl_sexp.c) SET (LIB_TYPE STATIC) Modified: stable/11/contrib/libucl/Makefile.unix ============================================================================== --- stable/11/contrib/libucl/Makefile.unix Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/Makefile.unix Sat Oct 22 20:49:07 2016 (r307790) @@ -1,7 +1,7 @@ CC ?= gcc DESTDIR ?= /usr/local LD ?= gcc -C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src +C_COMMON_FLAGS ?= -fPIC -Wall -W -Wno-unused-parameter -Wno-pointer-sign -I./include -I./uthash -I./src -I./klib MAJOR_VERSION = 0 MINOR_VERSION = 2 PATCH_VERSION = 9 @@ -25,13 +25,12 @@ HDEPS = $(SRCDIR)/ucl_hash.h \ $(SRCDIR)/ucl_chartable.h \ $(SRCDIR)/ucl_internal.h \ $(INCLUDEDIR)/ucl.h \ - $(SRCDIR)/xxhash.h + $(SRCDIR)/mum.h OBJECTS = $(OBJDIR)/ucl_hash.o \ $(OBJDIR)/ucl_util.o \ $(OBJDIR)/ucl_parser.o \ $(OBJDIR)/ucl_emitter.o \ - $(OBJDIR)/ucl_schema.o \ - $(OBJDIR)/xxhash.o + $(OBJDIR)/ucl_schema.o all: $(OBJDIR) $(OBJDIR)/$(SONAME) @@ -55,8 +54,6 @@ $(OBJDIR)/ucl_hash.o: $(SRCDIR)/ucl_hash $(CC) -o $(OBJDIR)/ucl_hash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_hash.c $(OBJDIR)/ucl_schema.o: $(SRCDIR)/ucl_schema.c $(HDEPS) $(CC) -o $(OBJDIR)/ucl_schema.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/ucl_schema.c -$(OBJDIR)/xxhash.o: $(SRCDIR)/xxhash.c $(HDEPS) - $(CC) -o $(OBJDIR)/xxhash.o $(CPPFLAGS) $(COPT_FLAGS) $(CFLAGS) $(C_COMMON_FLAGS) $(SSL_CFLAGS) $(FETCH_FLAGS) -c $(SRCDIR)/xxhash.c clean: $(RM) $(OBJDIR)/*.o $(OBJDIR)/$(SONAME_FULL) $(OBJDIR)/$(SONAME) $(OBJDIR)/chargen $(OBJDIR)/test_basic $(OBJDIR)/test_speed $(OBJDIR)/objdump $(OBJDIR)/test_generate $(OBJDIR)/test_schema || true Modified: stable/11/contrib/libucl/Makefile.w32 ============================================================================== --- stable/11/contrib/libucl/Makefile.w32 Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/Makefile.w32 Sat Oct 22 20:49:07 2016 (r307790) @@ -28,14 +28,13 @@ HDEPS = $(SRCDIR)/ucl_hash.h \ $(SRCDIR)/ucl_chartable.h \ $(SRCDIR)/ucl_internal.h \ $(INCLUDEDIR)/ucl.h \ - $(SRCDIR)/xxhash.h + $(SRCDIR)/mum.h OBJECTS = $(OBJDIR)/ucl_hash.o \ $(OBJDIR)/ucl_util.o \ $(OBJDIR)/ucl_parser.o \ $(OBJDIR)/ucl_emitter.o \ $(OBJDIR)/ucl_emitter_utils.o \ - $(OBJDIR)/ucl_schema.o \ - $(OBJDIR)/xxhash.o + $(OBJDIR)/ucl_schema.o all: $(OBJDIR) $(OBJDIR)/$(SONAME) Modified: stable/11/contrib/libucl/README.md ============================================================================== --- stable/11/contrib/libucl/README.md Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/README.md Sat Oct 22 20:49:07 2016 (r307790) @@ -12,7 +12,7 @@ - [Named keys hierarchy](#named-keys-hierarchy) - [Convenient numbers and booleans](#convenient-numbers-and-booleans) - [General improvements](#general-improvements) - - [Commments](#commments) + - [Comments](#comments) - [Macros support](#macros-support) - [Variables support](#variables-support) - [Multiline strings](#multiline-strings) @@ -21,7 +21,7 @@ - [Performance](#performance) - [Conclusion](#conclusion) -## Introduction +## Introduction This document describes the main features and principles of the configuration language called `UCL` - universal configuration language. @@ -47,7 +47,7 @@ section { string = "something"; subsection { host = { - host = "hostname"; + host = "hostname"; port = 900; } host = { @@ -163,9 +163,9 @@ section { } } ``` - + Plain definitions may be more complex and contain more than a single level of nested objects: - + ```nginx section "blah" "foo" { key = value; @@ -174,7 +174,7 @@ section "blah" "foo" { is presented as: -```nginx +```nginx section { blah { foo { @@ -196,17 +196,17 @@ section { ## General improvements -### Commments +### Comments UCL supports different style of comments: -* single line: `#` +* single line: `#` * multiline: `/* ... */` Multiline comments may be nested: ```c # Sample single line comment -/* +/* some comment /* nested comment */ end of comment @@ -263,7 +263,7 @@ all files that matches the specified pat for your operating system). This option is meaningless for URL includes. * `url` (default: **true**) - allow URL includes. * `path` (default: empty) - A UCL_ARRAY of directories to search for the include file. -Search ends after the first patch, unless `glob` is true, then all matches are included. +Search ends after the first match, unless `glob` is true, then all matches are included. * `prefix` (default false) - Put included contents inside an object, instead of loading them into the root. If no `key` is provided, one is automatically generated based on each files basename() * `key` (default: ) - Key to load contents of include into. If @@ -273,7 +273,7 @@ object or an array. * `priority` (default: 0) - specify priority for the include (see below). * `duplicate` (default: 'append') - specify policy of duplicates resolving: - `append` - default strategy, if we have new object of higher priority then it replaces old one, if we have new object with less priority it is ignored completely, and if we have two duplicate objects with the same priority then we have a multi-value key (implicit array) - - `merge` - if we have object or array, then new keys are merged inside, if we have a plain object then an implicit array is formed (regardeless of priorities) + - `merge` - if we have object or array, then new keys are merged inside, if we have a plain object then an implicit array is formed (regardless of priorities) - `error` - create error on duplicate keys and stop parsing - `rewrite` - always rewrite an old value with new one (ignoring priorities) @@ -320,7 +320,7 @@ Here are some rules for this syntax: * Multiline terminator must start just after `<<` symbols and it must consist of capital letters only (e.g. `< +#include +#include +#include #include #include @@ -100,6 +103,68 @@ private: return func; }; + static bool ucl_variable_getter(const unsigned char *data, size_t len, + unsigned char ** /*replace*/, size_t * /*replace_len*/, bool *need_free, void* ud) + { + *need_free = false; + + auto vars = reinterpret_cast *>(ud); + if (vars && data && len != 0) { + vars->emplace (data, data + len); + } + return false; + } + + static bool ucl_variable_replacer (const unsigned char *data, size_t len, + unsigned char **replace, size_t *replace_len, bool *need_free, void* ud) + { + *need_free = false; + + auto replacer = reinterpret_cast(ud); + if (!replacer) { + return false; + } + + std::string var_name (data, data + len); + if (!replacer->is_variable (var_name)) { + return false; + } + + std::string var_value = replacer->replace (var_name); + if (var_value.empty ()) { + return false; + } + + *replace = (unsigned char *)UCL_ALLOC (var_value.size ()); + memcpy (*replace, var_value.data (), var_value.size ()); + + *replace_len = var_value.size (); + *need_free = true; + + return true; + } + + template + static Ucl parse_with_strategy_function (C config_func, P parse_func, std::string &err) + { + auto parser = ucl_parser_new (UCL_PARSER_DEFAULT); + + config_func (parser); + + if (!parse_func (parser)) { + err.assign (ucl_parser_get_error (parser)); + ucl_parser_free (parser); + + return nullptr; + } + + auto obj = ucl_parser_get_object (parser); + ucl_parser_free (parser); + + // Obj will handle ownership + return Ucl (obj); + } + std::unique_ptr obj; public: @@ -117,9 +182,9 @@ public: const_iterator(const Ucl &obj) { it = std::shared_ptr(ucl_object_iterate_new (obj.obj.get()), - ucl_iter_deleter()); + ucl_iter_deleter()); cur.reset (new Ucl(ucl_object_iterate_safe (it.get(), true))); - if (!*cur) { + if (cur->type() == UCL_NULL) { it.reset (); cur.reset (); } @@ -153,7 +218,7 @@ public: cur.reset (new Ucl(ucl_object_iterate_safe (it.get(), true))); } - if (!*cur) { + if (cur && cur->type() == UCL_NULL) { it.reset (); cur.reset (); } @@ -171,6 +236,17 @@ public: } }; + struct variable_replacer { + virtual ~variable_replacer() {} + + virtual bool is_variable (const std::string &str) const + { + return !str.empty (); + } + + virtual std::string replace (const std::string &var) const = 0; + }; + // We grab ownership if get non-const ucl_object_t Ucl(ucl_object_t *other) { obj.reset (other); @@ -211,20 +287,20 @@ public: obj.reset (ucl_object_fromstring_common (value.data (), value.size (), UCL_STRING_RAW)); } - Ucl(const char * value) { + Ucl(const char *value) { obj.reset (ucl_object_fromstring_common (value, 0, UCL_STRING_RAW)); } // Implicit constructor: anything with a to_json() function. template - Ucl(const T & t) : Ucl(t.to_ucl()) {} + Ucl(const T &t) : Ucl(t.to_ucl()) {} // Implicit constructor: map-like objects (std::map, std::unordered_map, etc) template ::value && std::is_constructible::value, int>::type = 0> - Ucl(const M & m) { + Ucl(const M &m) { obj.reset (ucl_object_typed_new (UCL_OBJECT)); auto cobj = obj.get (); @@ -238,7 +314,7 @@ public: template ::value, int>::type = 0> - Ucl(const V & v) { + Ucl(const V &v) { obj.reset (ucl_object_typed_new (UCL_ARRAY)); auto cobj = obj.get (); @@ -356,46 +432,138 @@ public: return out; } - static Ucl parse (const std::string & in, std::string & err) + static Ucl parse (const std::string &in, std::string &err) { - auto parser = ucl_parser_new (UCL_PARSER_DEFAULT); + return parse (in, std::map(), err); + } - if (!ucl_parser_add_chunk (parser, (const unsigned char *)in.data (), - in.size ())) { - err.assign (ucl_parser_get_error (parser)); - ucl_parser_free (parser); + static Ucl parse (const std::string &in, const std::map &vars, std::string &err) + { + auto config_func = [&vars] (ucl_parser *parser) { + for (const auto & item : vars) { + ucl_parser_register_variable (parser, item.first.c_str (), item.second.c_str ()); + } + }; + + auto parse_func = [&in] (ucl_parser *parser) { + return ucl_parser_add_chunk (parser, (unsigned char *)in.data (), in.size ()); + }; + + return parse_with_strategy_function (config_func, parse_func, err); + } + static Ucl parse (const std::string &in, const variable_replacer &replacer, std::string &err) + { + auto config_func = [&replacer] (ucl_parser *parser) { + ucl_parser_set_variables_handler (parser, ucl_variable_replacer, + &const_cast(replacer)); + }; + + auto parse_func = [&in] (ucl_parser *parser) { + return ucl_parser_add_chunk (parser, (unsigned char *) in.data (), in.size ()); + }; + + return parse_with_strategy_function (config_func, parse_func, err); + } + + static Ucl parse (const char *in, std::string &err) + { + return parse (in, std::map(), err); + } + + static Ucl parse (const char *in, const std::map &vars, std::string &err) + { + if (!in) { + err = "null input"; return nullptr; } + return parse (std::string (in), vars, err); + } - auto obj = ucl_parser_get_object (parser); + static Ucl parse (const char *in, const variable_replacer &replacer, std::string &err) + { + if (!in) { + err = "null input"; + return nullptr; + } + return parse (std::string(in), replacer, err); + } + + static Ucl parse_from_file (const std::string &filename, std::string &err) + { + return parse_from_file (filename, std::map(), err); + } + + static Ucl parse_from_file (const std::string &filename, const std::map &vars, std::string &err) + { + auto config_func = [&vars] (ucl_parser *parser) { + for (const auto & item : vars) { + ucl_parser_register_variable (parser, item.first.c_str (), item.second.c_str ()); + } + }; + + auto parse_func = [&filename] (ucl_parser *parser) { + return ucl_parser_add_file (parser, filename.c_str ()); + }; + + return parse_with_strategy_function (config_func, parse_func, err); + } + + static Ucl parse_from_file (const std::string &filename, const variable_replacer &replacer, std::string &err) + { + auto config_func = [&replacer] (ucl_parser *parser) { + ucl_parser_set_variables_handler (parser, ucl_variable_replacer, + &const_cast(replacer)); + }; + + auto parse_func = [&filename] (ucl_parser *parser) { + return ucl_parser_add_file (parser, filename.c_str ()); + }; + + return parse_with_strategy_function (config_func, parse_func, err); + } + + static std::vector find_variable (const std::string &in) + { + auto parser = ucl_parser_new (UCL_PARSER_DEFAULT); + + std::set vars; + ucl_parser_set_variables_handler (parser, ucl_variable_getter, &vars); + ucl_parser_add_chunk (parser, (const unsigned char *)in.data (), in.size ()); ucl_parser_free (parser); - // Obj will handle ownership - return Ucl (obj); + std::vector result; + std::move (vars.begin (), vars.end (), std::back_inserter (result)); + return result; } - static Ucl parse (const char * in, std::string & err) + static std::vector find_variable (const char *in) { - if (in) { - return parse (std::string(in), err); - } else { - err = "null input"; - return nullptr; + if (!in) { + return std::vector(); } + return find_variable (std::string (in)); } - static Ucl parse (std::istream &ifs, std::string &err) + static std::vector find_variable_from_file (const std::string &filename) { - return Ucl::parse (std::string(std::istreambuf_iterator(ifs), - std::istreambuf_iterator()), err); + auto parser = ucl_parser_new (UCL_PARSER_DEFAULT); + + std::set vars; + ucl_parser_set_variables_handler (parser, ucl_variable_getter, &vars); + ucl_parser_add_file (parser, filename.c_str ()); + ucl_parser_free (parser); + + std::vector result; + std::move (vars.begin (), vars.end (), std::back_inserter (result)); + return std::move (result); } - Ucl& operator= (Ucl rhs) - { - obj.swap (rhs.obj); - return *this; - } + Ucl& operator= (Ucl rhs) + { + obj.swap (rhs.obj); + return *this; + } bool operator== (const Ucl &rhs) const { Modified: stable/11/contrib/libucl/include/ucl.h ============================================================================== --- stable/11/contrib/libucl/include/ucl.h Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/include/ucl.h Sat Oct 22 20:49:07 2016 (r307790) @@ -1016,7 +1016,6 @@ UCL_EXTERN bool ucl_parser_add_string_pr * Load and add data from a file * @param parser parser structure * @param filename the name of file - * @param err if *err is NULL it is set to parser error * @return true if chunk has been added and false in case of error */ UCL_EXTERN bool ucl_parser_add_file (struct ucl_parser *parser, @@ -1026,7 +1025,6 @@ UCL_EXTERN bool ucl_parser_add_file (str * Load and add data from a file * @param parser parser structure * @param filename the name of file - * @param err if *err is NULL it is set to parser error * @param priority the desired priority of a chunk (only 4 least significant bits * are considered for this parameter) * @return true if chunk has been added and false in case of error @@ -1035,6 +1033,20 @@ UCL_EXTERN bool ucl_parser_add_file_prio const char *filename, unsigned priority); /** + * Load and add data from a file + * @param parser parser structure + * @param filename the name of file + * @param priority the desired priority of a chunk (only 4 least significant bits + * are considered for this parameter) + * @param strat Merge strategy to use while parsing this file + * @param parse_type Parser type to use while parsing this file + * @return true if chunk has been added and false in case of error + */ +UCL_EXTERN bool ucl_parser_add_file_full (struct ucl_parser *parser, const char *filename, + unsigned priority, enum ucl_duplicate_strategy strat, + enum ucl_parse_type parse_type); + +/** * Load and add data from a file descriptor * @param parser parser structure * @param filename the name of file Copied: stable/11/contrib/libucl/m4/gcov.m4 (from r306544, head/contrib/libucl/m4/gcov.m4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libucl/m4/gcov.m4 Sat Oct 22 20:49:07 2016 (r307790, copy of r306544, head/contrib/libucl/m4/gcov.m4) @@ -0,0 +1,89 @@ +# SYNOPSIS +# +# Add code coverage support with gcov/lcov. +# +# AX_CODE_COVERAGE() +# +# DESCRIPTION +# +# Provides a --enable-coverage option which checks for available +# gcov/lcov binaries and provides ENABLE_CODE_COVERAGE conditional. +# +# LAST MODIFICATION +# +# $Id: coverage.m4 40881 2013-08-20 17:54:39Z damon $ +# +# COPYLEFT +# +# Copyright (c) 2012 Roy H. Stogner +# Copyright (c) 2010 Karl W. Schulz +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. + +AC_DEFUN([AX_CODE_COVERAGE], +[ + +AC_ARG_ENABLE(coverage, AC_HELP_STRING([--enable-coverage],[configure code coverage analysis tools])) + +HAVE_GCOV_TOOLS=0 + +GCOV_FLAGS="" + +if test "x$enable_coverage" = "xyes"; then + + # ---------------------------- + # Check for gcov/lcov binaries + # ---------------------------- + + AC_ARG_VAR([GCOV], [Coverage testing command]) + if test "x$GCOV" = "x"; then + AC_PATH_PROG(GCOV, gcov, no) + else + AC_PATH_PROG(GCOV, $GCOV, no) + fi + + AC_PATH_PROG(LCOV, lcov, no) + AC_PATH_PROG(GENHTML, genhtml) + + # ---------------------------------- + # include coverage compiler options + # ---------------------------------- + AC_MSG_CHECKING([for clang]) + + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], [[ + #ifndef __clang__ + not clang + #endif + ]])], + [CLANG=yes], [CLANG=no]) + + AC_MSG_RESULT([$CLANG]) + HAVE_GCOV_TOOLS=1 + COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" + COVERAGE_LDFLAGS="--coverage -fprofile-arcs -ftest-coverage" + COVERAGE_OPTFLAGS="-O0" + + # Test for C... + CFLAGS="${GCOV_FLAGS} ${CFLAGS}" + CXXFLAGS="${GCOV_FLAGS} ${CXXFLAGS}" + if test "x$GCC" = "xyes" -a "x$CLANG" = "xno"; then + COVERAGE_LIBS="-lgcov" + else + COVERAGE_LIBS="" + fi +fi + +AC_SUBST([GCOV]) +AC_SUBST([LCOV]) +AC_SUBST([GENHTML]) +AC_SUBST([GENHTML_OPTIONS]) +AC_SUBST([COVERAGE_CFLAGS]) +AC_SUBST([COVERAGE_OPTFLAGS]) +AC_SUBST([COVERAGE_LDFLAGS]) +AC_SUBST([COVERAGE_LIBS]) +AM_CONDITIONAL(CODE_COVERAGE_ENABLED,test x$HAVE_GCOV_TOOLS = x1) + +]) Modified: stable/11/contrib/libucl/python/setup.py ============================================================================== --- stable/11/contrib/libucl/python/setup.py Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/python/setup.py Sat Oct 22 20:49:07 2016 (r307790) @@ -1,37 +1,43 @@ -import distutils.ccompiler -import distutils.sysconfig -from distutils.core import setup, Extension +try: + from setuptools import setup, Extension +except ImportError: + from distutils.core import setup, Extension + import os +import sys +tests_require = [] -compiler = distutils.ccompiler.new_compiler() -search_paths=[os.path.expanduser('~/{}'), '/opt/local/{}', '/usr/local/{}', '/usr/{}'] -lib_paths = [ a.format("lib") for a in search_paths] -inc_paths = [ a.format("include") for a in search_paths] +if sys.version < '2.7': + tests_require.append('unittest2') -uclmodule = Extension('ucl', - include_dirs = inc_paths, - library_dirs = lib_paths, - libraries = ['ucl'], - sources = ['src/uclmodule.c'], - runtime_library_dirs = lib_paths, - language='c') +uclmodule = Extension( + 'ucl', + libraries = ['ucl'], + sources = ['src/uclmodule.c'], + language = 'c' +) -setup(name='ucl', - version='1.0', - description='ucl parser and emmitter', +setup( + name = 'ucl', + version = '0.8', + description = 'ucl parser and emmitter', ext_modules = [uclmodule], - author="Eitan Adler", - author_email="lists@eitanadler.com", - url="https://github.com/vstakhov/libucl/", - license="MIT", - classifiers=["Development Status :: 3 - Alpha", + test_suite = 'tests', + tests_require = tests_require, + author = "Eitan Adler, Denis Volpato Martins", + author_email = "lists@eitanadler.com", + url = "https://github.com/vstakhov/libucl/", + license = "MIT", + classifiers = [ + "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: DFSG approved", "License :: OSI Approved :: MIT License", "Programming Language :: C", + "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries", - ] - ) + ] +) Modified: stable/11/contrib/libucl/python/src/uclmodule.c ============================================================================== --- stable/11/contrib/libucl/python/src/uclmodule.c Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/python/src/uclmodule.c Sat Oct 22 20:49:07 2016 (r307790) @@ -2,6 +2,8 @@ #include #include +static PyObject *SchemaError; + static PyObject * _basic_ucl_type (ucl_object_t const *obj) { @@ -13,9 +15,11 @@ _basic_ucl_type (ucl_object_t const *obj case UCL_STRING: return Py_BuildValue ("s", ucl_object_tostring (obj)); case UCL_BOOLEAN: - return ucl_object_toboolean (obj) ? Py_True : Py_False; + return PyBool_FromLong (ucl_object_toboolean (obj)); case UCL_TIME: return Py_BuildValue ("d", ucl_object_todouble (obj)); + case UCL_NULL: + Py_RETURN_NONE; } return NULL; } @@ -124,26 +128,60 @@ _iterate_python (PyObject *obj) { if (obj == Py_None) { return ucl_object_new(); - } else if (PyBool_Check (obj)) { + } + else if (PyBool_Check (obj)) { return ucl_object_frombool (obj == Py_True); - } else if (PyInt_Check (obj)) { + } +#if PY_MAJOR_VERSION < 3 + else if (PyInt_Check (obj)) { return ucl_object_fromint (PyInt_AsLong (obj)); - } else if (PyFloat_Check (obj)) { + } +#endif + else if (PyLong_Check (obj)) { + return ucl_object_fromint (PyLong_AsLong (obj)); + } + else if (PyFloat_Check (obj)) { return ucl_object_fromdouble (PyFloat_AsDouble (obj)); - } else if (PyString_Check (obj)) { + } + else if (PyUnicode_Check (obj)) { + ucl_object_t *ucl_str; + PyObject *str = PyUnicode_AsASCIIString(obj); + ucl_str = ucl_object_fromstring (PyBytes_AsString (str)); + Py_DECREF(str); + return ucl_str; + } +#if PY_MAJOR_VERSION < 3 + else if (PyString_Check (obj)) { return ucl_object_fromstring (PyString_AsString (obj)); - // } else if (PyDateTime_Check (obj)) { } +#endif else if (PyDict_Check(obj)) { PyObject *key, *value; Py_ssize_t pos = 0; ucl_object_t *top, *elm; + char *keystr = NULL; top = ucl_object_typed_new (UCL_OBJECT); while (PyDict_Next(obj, &pos, &key, &value)) { elm = _iterate_python(value); - ucl_object_insert_key (top, elm, PyString_AsString(key), 0, true); + + if (PyUnicode_Check(key)) { + PyObject *keyascii = PyUnicode_AsASCIIString(key); + keystr = PyBytes_AsString(keyascii); + Py_DECREF(keyascii); + } +#if PY_MAJOR_VERSION < 3 + else if (PyString_Check(key)) { + keystr = PyString_AsString(key); + } +#endif + else { + PyErr_SetString(PyExc_TypeError, "Unknown key type"); + return NULL; + } + + ucl_object_insert_key (top, elm, keystr, 0, true); } return top; @@ -195,11 +233,6 @@ ucl_dump (PyObject *self, PyObject *args Py_RETURN_NONE; } - if (!PyDict_Check(obj)) { - PyErr_SetString(PyExc_TypeError, "Argument must be dict"); - return NULL; - } - root = _iterate_python(obj); if (root) { PyObject *ret; @@ -207,7 +240,11 @@ ucl_dump (PyObject *self, PyObject *args buf = (char *) ucl_object_emit (root, emitter); ucl_object_unref (root); +#if PY_MAJOR_VERSION < 3 ret = PyString_FromString (buf); +#else + ret = PyUnicode_FromString (buf); +#endif free(buf); return ret; @@ -219,17 +256,35 @@ ucl_dump (PyObject *self, PyObject *args static PyObject * ucl_validate (PyObject *self, PyObject *args) { - char *uclstr, *schema; + PyObject *dataobj, *schemaobj; + ucl_object_t *data, *schema; + bool r; + struct ucl_schema_error err; - if (PyArg_ParseTuple(args, "zz", &uclstr, &schema)) { - if (!uclstr || !schema) { - Py_RETURN_NONE; - } + if (!PyArg_ParseTuple (args, "OO", &schemaobj, &dataobj)) { + PyErr_SetString (PyExc_TypeError, "Unhandled object type"); + return NULL; + } - PyErr_SetString(PyExc_NotImplementedError, "schema validation is not yet supported"); + schema = _iterate_python(schemaobj); + if (!schema) + return NULL; + + data = _iterate_python(dataobj); + if (!data) + return NULL; + + // validation + r = ucl_object_validate (schema, data, &err); + ucl_object_unref (schema); + ucl_object_unref (data); + + if (!r) { + PyErr_SetString (SchemaError, err.msg); + return NULL; } - return NULL; + Py_RETURN_TRUE; } static PyMethodDef uclMethods[] = { @@ -247,6 +302,10 @@ init_macros(PyObject *mod) PyModule_AddIntMacro(mod, UCL_EMIT_CONFIG); PyModule_AddIntMacro(mod, UCL_EMIT_YAML); PyModule_AddIntMacro(mod, UCL_EMIT_MSGPACK); + + SchemaError = PyErr_NewException("ucl.SchemaError", NULL, NULL); + Py_INCREF(SchemaError); + PyModule_AddObject(mod, "SchemaError", SchemaError); } #if PY_MAJOR_VERSION >= 3 Modified: stable/11/contrib/libucl/src/ucl_parser.c ============================================================================== --- stable/11/contrib/libucl/src/ucl_parser.c Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/src/ucl_parser.c Sat Oct 22 20:49:07 2016 (r307790) @@ -342,6 +342,7 @@ ucl_check_variable_safe (struct ucl_pars /* Call generic handler */ if (parser->var_handler (ptr, remain, &dst, &dstlen, &need_free, parser->var_data)) { + *out_len += dstlen; *found = true; if (need_free) { free (dst); @@ -458,11 +459,18 @@ ucl_expand_single_variable (struct ucl_p } if (!found) { if (strict && parser->var_handler != NULL) { - if (parser->var_handler (ptr, remain, &dst, &dstlen, &need_free, + size_t var_len = 0; + while (var_len < remain && p[var_len] != '}') + var_len ++; + + if (parser->var_handler (p, var_len, &dst, &dstlen, &need_free, parser->var_data)) { memcpy (d, dst, dstlen); - ret += dstlen; - d += remain; + ret += var_len; + d += dstlen; + if (need_free) { + free (dst); + } found = true; } } Modified: stable/11/contrib/libucl/src/ucl_schema.c ============================================================================== --- stable/11/contrib/libucl/src/ucl_schema.c Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/src/ucl_schema.c Sat Oct 22 20:49:07 2016 (r307790) @@ -69,7 +69,7 @@ ucl_schema_create_error (struct ucl_sche * Check whether we have a pattern specified */ static const ucl_object_t * -ucl_schema_test_pattern (const ucl_object_t *obj, const char *pattern) +ucl_schema_test_pattern (const ucl_object_t *obj, const char *pattern, bool recursive) { const ucl_object_t *res = NULL; #ifdef HAVE_REGEX_H @@ -78,11 +78,16 @@ ucl_schema_test_pattern (const ucl_objec ucl_object_iter_t iter = NULL; if (regcomp (®, pattern, REG_EXTENDED | REG_NOSUB) == 0) { - while ((elt = ucl_object_iterate (obj, &iter, true)) != NULL) { - if (regexec (®, ucl_object_key (elt), 0, NULL, 0) == 0) { - res = elt; - break; + if (recursive) { + while ((elt = ucl_object_iterate (obj, &iter, true)) != NULL) { + if (regexec (®, ucl_object_key (elt), 0, NULL, 0) == 0) { + res = elt; + break; + } } + } else { + if (regexec (®, ucl_object_key (obj), 0, NULL, 0) == 0) + res = obj; } regfree (®); } @@ -205,12 +210,17 @@ ucl_schema_validate_object (const ucl_ob } } else if (strcmp (ucl_object_key (elt), "patternProperties") == 0) { + const ucl_object_t *vobj; + ucl_object_iter_t viter; piter = NULL; while (ret && (prop = ucl_object_iterate (elt, &piter, true)) != NULL) { - found = ucl_schema_test_pattern (obj, ucl_object_key (prop)); - if (found) { - ret = ucl_schema_validate (prop, found, true, err, root, - ext_ref); + viter = NULL; + while (ret && (vobj = ucl_object_iterate (obj, &viter, true)) != NULL) { + found = ucl_schema_test_pattern (vobj, ucl_object_key (prop), false); + if (found) { + ret = ucl_schema_validate (prop, found, true, err, root, + ext_ref); + } } } } @@ -234,7 +244,7 @@ ucl_schema_validate_object (const ucl_ob piter = NULL; pat = ucl_object_lookup (schema, "patternProperties"); while ((pelt = ucl_object_iterate (pat, &piter, true)) != NULL) { - found = ucl_schema_test_pattern (obj, ucl_object_key (pelt)); + found = ucl_schema_test_pattern (obj, ucl_object_key (pelt), true); if (found != NULL) { break; } Modified: stable/11/contrib/libucl/src/ucl_util.c ============================================================================== --- stable/11/contrib/libucl/src/ucl_util.c Sat Oct 22 20:46:57 2016 (r307789) +++ stable/11/contrib/libucl/src/ucl_util.c Sat Oct 22 20:49:07 2016 (r307790) @@ -1795,8 +1795,9 @@ ucl_parser_set_filevars (struct ucl_pars } bool -ucl_parser_add_file_priority (struct ucl_parser *parser, const char *filename, - unsigned priority) +ucl_parser_add_file_full (struct ucl_parser *parser, const char *filename, + unsigned priority, enum ucl_duplicate_strategy strat, + enum ucl_parse_type parse_type) { unsigned char *buf; size_t len; @@ -1819,7 +1820,8 @@ ucl_parser_add_file_priority (struct ucl } parser->cur_file = strdup (realbuf); ucl_parser_set_filevars (parser, realbuf, false); - ret = ucl_parser_add_chunk_priority (parser, buf, len, priority); + ret = ucl_parser_add_chunk_full (parser, buf, len, priority, strat, + parse_type); if (len > 0) { ucl_munmap (buf, len); @@ -1829,14 +1831,27 @@ ucl_parser_add_file_priority (struct ucl } bool +ucl_parser_add_file_priority (struct ucl_parser *parser, const char *filename, + unsigned priority) +{ + if (parser == NULL) { + return false; + } + + return ucl_parser_add_file_full(parser, filename, priority, + UCL_DUPLICATE_APPEND, UCL_PARSE_UCL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 22 20:49:45 2016 Return-Path: Delivered-To: svn-src-all@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 F07CDC1D9AC; Sat, 22 Oct 2016 20:49:45 +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 BA64CA96; Sat, 22 Oct 2016 20:49:45 +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 u9MKniqX010686; Sat, 22 Oct 2016 20:49:44 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKnirM010685; Sat, 22 Oct 2016 20:49:44 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222049.u9MKnirM010685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:49: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: r307791 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:49:46 -0000 Author: bapt Date: Sat Oct 22 20:49:44 2016 New Revision: 307791 URL: https://svnweb.freebsd.org/changeset/base/307791 Log: MFC r306554: Use accept4 with O_NONBLOCK rather than accept + fcntl 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 Sat Oct 22 20:49:07 2016 (r307790) +++ stable/11/usr.sbin/bhyve/dbgport.c Sat Oct 22 20:49:44 2016 (r307791) @@ -73,10 +73,8 @@ again: printf("Waiting for connection from gdb\r\n"); printonce = 1; } - conn_fd = accept(listen_fd, NULL, NULL); - if (conn_fd >= 0) - fcntl(conn_fd, F_SETFL, O_NONBLOCK); - else if (errno != EINTR) + conn_fd = accept4(listen_fd, NULL, NULL, O_NONBLOCK); + if (conn_fd < 0 && errno != EINTR) perror("accept"); } From owner-svn-src-all@freebsd.org Sat Oct 22 20:50:50 2016 Return-Path: Delivered-To: svn-src-all@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 C0EF9C1DA42; Sat, 22 Oct 2016 20:50:50 +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 90D6FC51; Sat, 22 Oct 2016 20:50:50 +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 u9MKontS011565; Sat, 22 Oct 2016 20:50:49 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKonf8011564; Sat, 22 Oct 2016 20:50:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222050.u9MKonf8011564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:50: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: r307792 - stable/11/lib/libdevdctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:50:50 -0000 Author: bapt Date: Sat Oct 22 20:50:49 2016 New Revision: 307792 URL: https://svnweb.freebsd.org/changeset/base/307792 Log: MFC r307364: directly create the socket with SOCK_NONBLOCK instead of calling fcntl(2) Modified: stable/11/lib/libdevdctl/consumer.cc Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libdevdctl/consumer.cc ============================================================================== --- stable/11/lib/libdevdctl/consumer.cc Sat Oct 22 20:49:44 2016 (r307791) +++ stable/11/lib/libdevdctl/consumer.cc Sat Oct 22 20:50:49 2016 (r307792) @@ -108,11 +108,9 @@ Consumer::ConnectToDevd() strlcpy(devdAddr.sun_path, s_devdSockPath, sizeof(devdAddr.sun_path)); sLen = SUN_LEN(&devdAddr); - m_devdSockFD = socket(AF_UNIX, SOCK_SEQPACKET, 0); + m_devdSockFD = socket(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK, 0); if (m_devdSockFD == -1) err(1, "Unable to create socket"); - if (fcntl(m_devdSockFD, F_SETFL, O_NONBLOCK) < 0) - err(1, "fcntl"); result = connect(m_devdSockFD, reinterpret_cast(&devdAddr), sLen); From owner-svn-src-all@freebsd.org Sat Oct 22 20:52:59 2016 Return-Path: Delivered-To: svn-src-all@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 D248EC1DB82; Sat, 22 Oct 2016 20:52:59 +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 9DC56F97; Sat, 22 Oct 2016 20:52:59 +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 u9MKqw8G014286; Sat, 22 Oct 2016 20:52:58 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKqwEU014285; Sat, 22 Oct 2016 20:52:58 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222052.u9MKqwEU014285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:52:58 +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: r307793 - stable/11/usr.bin/calendar X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:52:59 -0000 Author: bapt Date: Sat Oct 22 20:52:58 2016 New Revision: 307793 URL: https://svnweb.freebsd.org/changeset/base/307793 Log: MFC r303265: Remove reference cpp(1) which is not used anymore Modified: stable/11/usr.bin/calendar/calendar.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/calendar/calendar.1 ============================================================================== --- stable/11/usr.bin/calendar/calendar.1 Sat Oct 22 20:50:49 2016 (r307792) +++ stable/11/usr.bin/calendar/calendar.1 Sat Oct 22 20:52:58 2016 (r307793) @@ -28,7 +28,7 @@ .\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\" $FreeBSD$ .\" -.Dd April 6, 2013 +.Dd July 24, 2016 .Dt CALENDAR 1 .Os .Sh NAME @@ -295,7 +295,6 @@ This is no longer true, the date is only at the beginning of a line. .Sh SEE ALSO .Xr at 1 , -.Xr cpp 1 , .Xr mail 1 , .Xr cron 8 .Sh HISTORY From owner-svn-src-all@freebsd.org Sat Oct 22 20:54:55 2016 Return-Path: Delivered-To: svn-src-all@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 86EF8C1DC67; Sat, 22 Oct 2016 20:54:55 +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 3AF87177; Sat, 22 Oct 2016 20:54:55 +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 u9MKsswr014390; Sat, 22 Oct 2016 20:54:54 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKssRl014388; Sat, 22 Oct 2016 20:54:54 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222054.u9MKssRl014388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:54:54 +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: r307794 - stable/11/usr.bin/mkcsmapper X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:54:55 -0000 Author: bapt Date: Sat Oct 22 20:54:54 2016 New Revision: 307794 URL: https://svnweb.freebsd.org/changeset/base/307794 Log: MFC r302471, r302473: r302471: Add RCS Id. Sort options in SYNOPSIS. Fix macro usage. Fix Dd. Submitted by: wiz@NetBSD.org Obtained from: NetBSD r302473: Sync usage between program and man page. Increase column width. [1] Simplifay the usage() function Replace errx/strerror with errc Submitted by: wiz@NetBSD.org [1] Obtained from: NetBSD Modified: stable/11/usr.bin/mkcsmapper/mkcsmapper.1 stable/11/usr.bin/mkcsmapper/yacc.y Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mkcsmapper/mkcsmapper.1 ============================================================================== --- stable/11/usr.bin/mkcsmapper/mkcsmapper.1 Sat Oct 22 20:52:58 2016 (r307793) +++ stable/11/usr.bin/mkcsmapper/mkcsmapper.1 Sat Oct 22 20:54:54 2016 (r307794) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 6, 2009 +.Dd July 9, 2016 .Dt MKCSMAPPER 1 .Os .Sh NAME @@ -43,10 +43,10 @@ .Xr iconv 3 .Sh SYNOPSIS .Nm -.Op Fl mpd -.Fl o -.Ar outfile -.Ar infile +.Op Fl d +.Op Fl m | Fl p +.Op Fl o Ar outfile +.Op Ar infile .Sh DESCRIPTION The .Nm @@ -60,7 +60,7 @@ A pivot file, which the possible source pairs or the set of mappings to use for a compound encoding. .Pp The following options are available: -.Bl -tag -width 0123 +.Bl -tag -width XoXoutfileXX .It Fl d Turns on debug mode. .It Fl m @@ -82,7 +82,8 @@ Generate pivot data from .Sh HISTORY .Nm first appeared in -.Nx 2.0 , and made its appearance in +.Nx 2.0 , +and made its appearance in .Fx 9.0 . .Sh AUTHORS This manual page was written by Modified: stable/11/usr.bin/mkcsmapper/yacc.y ============================================================================== --- stable/11/usr.bin/mkcsmapper/yacc.y Sat Oct 22 20:52:58 2016 (r307793) +++ stable/11/usr.bin/mkcsmapper/yacc.y Sat Oct 22 20:54:54 2016 (r307794) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: yacc.y,v 1.7 2006/09/09 14:35:17 tnozaki Exp $ */ +/* $NetBSD: yacc.y,v 1.11 2016/06/28 09:22:16 wiz Exp $ */ %{ /*- @@ -664,18 +664,15 @@ do_mkpv(FILE *in) if (ret && output) unlink(output); /* dump failure */ if (ret) - errx(EXIT_FAILURE, "%s\n", strerror(ret)); + errc(EXIT_FAILURE, ret, ""); } static void usage(void) { - warnx("usage: \n" - "\t%s [-d] [-o outfile] [infile]\n" - "\t%s -m [-d] [-o outfile] [infile]\n" - "\t%s -p [-d] [-o outfile] [infile]\n", - getprogname(), getprogname(), getprogname()); - exit(1); + fprintf(stderr, "Usage: %s [-d] [-m|-p] [-o outfile] [infile]\n", + getprogname()); + exit(EXIT_FAILURE); } int From owner-svn-src-all@freebsd.org Sat Oct 22 20:56:51 2016 Return-Path: Delivered-To: svn-src-all@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 AEF91C1DCEE; Sat, 22 Oct 2016 20:56:51 +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 493E3309; Sat, 22 Oct 2016 20:56:51 +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 u9MKuook014546; Sat, 22 Oct 2016 20:56:50 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKun2o014539; Sat, 22 Oct 2016 20:56:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222056.u9MKun2o014539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:56: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: r307795 - stable/11/contrib/mdocml X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:56:51 -0000 Author: bapt Date: Sat Oct 22 20:56:49 2016 New Revision: 307795 URL: https://svnweb.freebsd.org/changeset/base/307795 Log: MFC r303223: Update mandoc to 1.13.4 release Added: stable/11/contrib/mdocml/man.cgi.3 - copied unchanged from r303223, head/contrib/mdocml/man.cgi.3 Modified: stable/11/contrib/mdocml/INSTALL stable/11/contrib/mdocml/LICENSE stable/11/contrib/mdocml/Makefile stable/11/contrib/mdocml/NEWS stable/11/contrib/mdocml/TODO stable/11/contrib/mdocml/cgi.c stable/11/contrib/mdocml/cgi.h.example stable/11/contrib/mdocml/configure stable/11/contrib/mdocml/configure.local.example stable/11/contrib/mdocml/demandoc.c stable/11/contrib/mdocml/libmandoc.h stable/11/contrib/mdocml/main.c stable/11/contrib/mdocml/main.h stable/11/contrib/mdocml/man.1 stable/11/contrib/mdocml/man.cgi.8 stable/11/contrib/mdocml/mandoc.3 stable/11/contrib/mdocml/mandoc.css stable/11/contrib/mdocml/mandoc.db.5 stable/11/contrib/mdocml/mandoc_headers.3 stable/11/contrib/mdocml/mandoc_malloc.3 stable/11/contrib/mdocml/mandocdb.c stable/11/contrib/mdocml/manpage.c stable/11/contrib/mdocml/manpath.c stable/11/contrib/mdocml/mansearch.c stable/11/contrib/mdocml/mchars_alloc.3 stable/11/contrib/mdocml/read.c stable/11/contrib/mdocml/tag.c stable/11/contrib/mdocml/term.c stable/11/contrib/mdocml/term_ascii.c stable/11/contrib/mdocml/test-rewb-bsd.c stable/11/contrib/mdocml/test-rewb-sysv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/mdocml/INSTALL ============================================================================== --- stable/11/contrib/mdocml/INSTALL Sat Oct 22 20:54:54 2016 (r307794) +++ stable/11/contrib/mdocml/INSTALL Sat Oct 22 20:56:49 2016 (r307795) @@ -1,4 +1,4 @@ -$Id: INSTALL,v 1.13 2015/11/07 14:01:16 schwarze Exp $ +$Id: INSTALL,v 1.15 2016/07/14 11:09:06 schwarze Exp $ About mdocml, the portable mandoc distribution ---------------------------------------------- @@ -16,7 +16,7 @@ tech@ mailing list, too. Enjoy using the mandoc toolset! -Ingo Schwarze, Karlsruhe, March 2015 +Ingo Schwarze, Karlsruhe, July 2016 Installation @@ -52,7 +52,7 @@ and go back to step 2. 4. Run "make -n install" and check whether everything will be installed to the intended places. Otherwise, put some *DIR or *NM* -variables into "configure.local" and go back to step 2. +variables into "configure.local" and go back to step 2. 5. Run "sudo make install". If you intend to build a binary package using some kind of fake root mechanism, you may need a @@ -63,7 +63,7 @@ in the "Makefile" to understand how DEST manpath(1), make sure it is configured correctly, in particular, it returns all directory trees where manual pages are installed. Otherwise, if your system uses man.conf(5), make sure it contains -a "_whatdb" line for each directory tree, and the order of these +a "manpath" line for each directory tree, and the order of these lines meets your wishes. 7. If you compiled with database support, run the command "sudo Modified: stable/11/contrib/mdocml/LICENSE ============================================================================== --- stable/11/contrib/mdocml/LICENSE Sat Oct 22 20:54:54 2016 (r307794) +++ stable/11/contrib/mdocml/LICENSE Sat Oct 22 20:56:49 2016 (r307795) @@ -1,11 +1,11 @@ -$Id: LICENSE,v 1.11 2015/11/07 17:58:55 schwarze Exp $ +$Id: LICENSE,v 1.12 2016/07/07 23:46:36 schwarze Exp $ With the exceptions noted below, all code and documentation contained in the mdocml toolkit is protected by the Copyright of the following developers: Copyright (c) 2008-2012, 2014 Kristaps Dzonsons -Copyright (c) 2010-2015 Ingo Schwarze +Copyright (c) 2010-2016 Ingo Schwarze Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger Copyright (c) 2013 Franco Fichtner Copyright (c) 2014 Baptiste Daroussin Modified: stable/11/contrib/mdocml/Makefile ============================================================================== --- stable/11/contrib/mdocml/Makefile Sat Oct 22 20:54:54 2016 (r307794) +++ stable/11/contrib/mdocml/Makefile Sat Oct 22 20:56:49 2016 (r307795) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.480 2015/11/07 21:53:14 schwarze Exp $ +# $Id: Makefile,v 1.488 2016/07/12 05:18:38 kristaps Exp $ # # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons -# Copyright (c) 2011, 2013, 2014, 2015 Ingo Schwarze +# Copyright (c) 2011, 2013-2016 Ingo Schwarze # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -VERSION = 1.13.3 +VERSION = 1.13.4 # === LIST OF FILES ==================================================== @@ -31,6 +31,9 @@ TESTSRCS = test-dirent-namlen.c \ test-pledge.c \ test-progname.c \ test-reallocarray.c \ + test-rewb-bsd.c \ + test-rewb-sysv.c \ + test-sandbox_init.c \ test-sqlite3.c \ test-sqlite3_errstr.c \ test-strcasestr.c \ @@ -138,6 +141,7 @@ DISTFILES = INSTALL \ makewhatis.8 \ man.1 \ man.7 \ + man.cgi.3 \ man.cgi.8 \ man.conf.5 \ man.h \ @@ -164,6 +168,7 @@ DISTFILES = INSTALL \ predefs.in \ roff.7 \ roff.h \ + roff_int.h \ soelim.1 \ st.in \ tag.h \ @@ -293,6 +298,7 @@ WWW_MANS = apropos.1.html \ roff.7.html \ tbl.7.html \ makewhatis.8.html \ + man.cgi.3.html \ man.cgi.8.html \ man.h.html \ manconf.h.html \ @@ -392,34 +398,30 @@ db-install: base-build cgi-install: cgi-build mkdir -p $(DESTDIR)$(CGIBINDIR) mkdir -p $(DESTDIR)$(HTDOCDIR) - mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1 - mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8 $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR) $(INSTALL_DATA) mandoc.css $(DESTDIR)$(HTDOCDIR) - $(INSTALL_MAN) apropos.1 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1/ - $(INSTALL_MAN) man.cgi.8 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8/ Makefile.local config.h: configure ${TESTSRCS} @echo "$@ is out of date; please run ./configure" @exit 1 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) - $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + ar rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) mandoc: $(MAIN_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(MAIN_OBJS) libmandoc.a $(DBLIB) + $(CC) -o $@ $(LDFLAGS) $(MAIN_OBJS) libmandoc.a $(LDADD) manpage: $(MANPAGE_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB) + $(CC) -o $@ $(LDFLAGS) $(MANPAGE_OBJS) libmandoc.a $(LDADD) man.cgi: $(CGI_OBJS) libmandoc.a - $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB) + $(CC) $(STATIC) -o $@ $(LDFLAGS) $(CGI_OBJS) libmandoc.a $(LDADD) demandoc: $(DEMANDOC_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a $(DBLIB) + $(CC) -o $@ $(LDFLAGS) $(DEMANDOC_OBJS) libmandoc.a $(LDADD) soelim: $(SOELIM_OBJS) - $(CC) $(LDFLAGS) -o $@ $(SOELIM_OBJS) + $(CC) -o $@ $(LDFLAGS) $(SOELIM_OBJS) # --- maintainer targets --- @@ -439,6 +441,8 @@ depend: config.h Makefile.depend > Makefile.tmp mv Makefile.tmp Makefile.depend +dist: mdocml.sha256 + mdocml.sha256: mdocml.tar.gz sha256 mdocml.tar.gz > $@ Modified: stable/11/contrib/mdocml/NEWS ============================================================================== --- stable/11/contrib/mdocml/NEWS Sat Oct 22 20:54:54 2016 (r307794) +++ stable/11/contrib/mdocml/NEWS Sat Oct 22 20:56:49 2016 (r307795) @@ -1,7 +1,140 @@ -$Id: NEWS,v 1.10 2015/11/05 16:58:20 schwarze Exp $ +$Id: NEWS,v 1.12 2016/07/14 11:09:06 schwarze Exp $ This file lists the most important changes in the mdocml.bsd.lv distribution. +Changes in version 1.13.4, released on July 14, 2016 + + --- MAJOR NEW FEATURES --- + * man.conf(5): Design and implement a simpler configuration file format. + * man(1): Leverage less(1) -T and :t in a way resembling ctags(1) + to jump to the definitions of various terms inside manual pages. + * soelim(1): New implementation by Baptiste Daroussin. + * privilege limitation: Use OpenBSD pledge(2) or OS X sandbox_init(3) + when available. + * man.cgi(8): Support short URIs like http://man.openbsd.org/mdoc . + * mandoc.css: Use one unified stylesheet rather than three different ones. + --- MAJOR FUNCTIONALLY RELEVANT BUGFIXES --- + * mdoc(7): Fix multiple aspects of SYNOPSIS .Nm formatting. + * man(1): Fix process group handling, avoiding unclean shutdowns. + --- PORTABILITY IMPROVEMENTS --- + * Correctly use the ohash(3) compatibility implementation + even when building without SQLite support. + * Add compat glue for building on Solaris 9 and 10. + * Let ./configure select a supported RE syntax for word boundaries. + * Support LDFLAGS, to be used for example for hardening options. + * Avoid mixing putchar(3) and putwchar(3) on the same file descriptor, + it resulted in output corruption on some platforms. + * Avoid reusing va_lists, use va_copy(3) for better portability. + * Do not hardcode the path to the more(1) program. + --- MINOR NEW FEATURES --- + * roff(7): Implement \n(.$ (number of macro arguments). + * roff(7): Fully implement \z (do not advance cursor). + * roff(7): Implement the `r' conditional (register exists). + * roff(7): Implement \\$* (interpolate all arguments). + * roff(7): Parse and ignore \, and \/ (italic corrections). + * When there is no -m, no -M, no MANPATH and no /etc/man.conf, + fall back to /usr/share/man:/usr/X11R6/man:/usr/local/man. + * man(1): Give manuals in purely numerical sections priority over + manuals of the same name in sections with an alphabetical suffix. + * man.cgi(8): Support "header.html" and "footer.html". + * man.cgi(8): Set the "autofocus" attribute on the query text box. + * man.cgi(8): Simplify the search form, drop two useless buttons. + * man.cgi(8): Delete the pseudo-manpath "mandoc", assume that + apropos(1) and man.cgi(8) are installed in the default manpath. + --- RELIABILITY BUGFIXES --- + * mdoc(7): Avoid a use after free and an assertion failure when nodes + are deleted during validation. + * mdoc(7): Avoid a NULL pointer access when .Bd has no arguments. + * mdoc(7): Avoid a NULL pointer access triggered by mismatching end macros. + * mdoc(7): Avoid an assertion when .Fo has no argument. + * mdoc(7): Avoid an assertion when .Ta occurs in .Bl -column. + * mdoc(7): Avoid an assertion when a body gets broken and has a tail. + * roff(7): Avoid an assertion caused by blanks inside \o. + * roff(7): Make .so links to gziped manuals work without mandoc.db(5). + * tbl(7): Avoid a use after free when the last line of a layout is empty. + * eqn(7): Avoid an infinite loop caused by recursive "define". + * makewhatis(8): Avoid a segfault caused by unusual directory structures. + * Fix handling of leading, trailing, and double colons in MANPATH and -m. + --- MINOR BUGFIXES --- + * mdoc(7): Put arguments to end macros of broken partial explicit blocks + inside the breaking block. + * mdoc(7): Let .Dv force normal font. + * mdoc(7): Make trailing whitespace significant in .Bl -tag widths. + * mdoc(7): Fix macro interpretation around tabs in .Bl -column. + * man(7): Use the default width for .RS without arguments. + * man(7): On a new RS nesting level, the saved width starts from + the default width, not from the saved width of the previous level. + * man(7): Allow .PD in next-line scope. + * man(7): Improve handling of empty .HP. + * man(7): Improve formatting of .br and .sp inside .HP. + * man(7): Do not mistreat empty arguments to font alternating + macros as vertical spacing requests. + * man(7): Allow fill mode changes in tagged paragraph next-line scope. + * man(7): Fix minor bugs in block rewinding and simplify the related code. + * man(7): Add missing line breaks before subsection headers. + * man(7): Give section and subsection headers hanging indentation. + * man(7): Make trailing whitespace significant in .TP widths. + * roff(7): Don't allow breaking the output line after hyphens + that immediately follow escape sequences. + * roff(7): Ignore blank characters at the beginning of conditional blocks. + * roff(7): Escape breakable hyphens only after handling input line traps. + * roff(7): Reject \[uD800] to \[uDFFF] (surrogates) in the parser. + * tbl(7): Allow more than one data field after T} on the same input line. + * terminal output: Apply bold and italic to non-ASCII Unicode codepoints. + * terminal output: Improve rounding rules for horizontal scaling widths. + * HTML output: Render ASCII_NBRSP as " ", not "-". + * man(1): Do not match the first part of a name if it continues with a dot. + * man(1): Keep working even if the current directory is unusable. + * man(1): Better error message when $PAGER is invalid. + * makewhatis(8): Improve handling of .Va and .Vt macros. + * apropos(1): Print "nothing appropriate" to stderr when appropriate. + * apropos(1): Abort with a useful error message when elementary + database operations like preparing queries or binding variables fail. + --- STRUCTURAL CHANGES, no functional change --- + * mdoc(7) and man(7): Unified data structures struct roff_node etc. + * mdoc(7) and man(7): Unified node handling library in roff.c. + * mdoc(7) and man(7): Seperate validation phase from parsing. + * roff(7): Major character table cleanup. + * Link with libz rather than forking gunzip(1). + --- THANKS TO --- + * Baptiste Daroussin (FreeBSD) for the new soelim(1) + and for release testing. + * Anthony Bentley (OpenBSD) for unifying mandoc.css, two nice + patches for man.cgi(8), some documentation patches, some bug + reports, and various useful discussions. + * Todd Miller (OpenBSD) for lots of help with process group and + signal handling, a few patches, some bug reports and some useful + discussions. + * Jonathan Gray (OpenBSD) for yet more testing with afl(1) + again resulting in more than half a dozen important bug reports. + * Svyatoslav Mishyn (Crux Linux) for some patches, several bug + reports, and extensive release testing. + * Christian Neukirchen (void Linux) for a number of compatibility + patches and suggestions and several bug reports. + * Christos Zoulas (NetBSD) for a bug fix patch and some useful + suggestions for cleanup. + * Florian Obser (OpenBSD) for a bugfix patch and some bug reports. + * Sevan Janiyan for help with Solaris compatibility and release + testing on many platforms. + * Jan Holzhueter and OpenCSW in general for help with Solaris + compatibility, and for providing me with a Solaris 9/10/11 testing + environment. + * Michael McConville (OpenBSD) for some simple cleanup patches. + * Thomas Klausner (NetBSD) for some bug reports and release testing. + * Christian Weisgerber, Dmitrij Czarkoff, Igor Sobrado, + Ken Westerback, Marc Espie, Mike Belopuhov, Rafael Neves, + Ted Unangst, Tim van der Molen, Theo Buehler, Theo de Raadt + (OpenBSD), Kurt Jaeger, Dag Erling Smoergrav (FreeBSD), + Joerg Sonnenberger (NetBSD), Carsten Kunze (Heirloom troff), + Daniel Levai, Fabian Raetz, Jan Stary, Jean-Yves Migeon, + Lorenzo Beretta, Markus Waldeck, Maxim Belooussov, Michael Reed, + Peter Bray, and Serguey Parkhomovsky for bug reports and feature + suggestions. + * Alexander Hall, Andrew Fresh, Antoine Jacoutot, Doug Hogan, + Jason McIntyre, Jasper Lievisse Adriaanse, Kent Spillner, + Nicholas Marriott, Peter Hessler, Sebastien Marie, Stefan Sperling, + and Theo de Raadt (OpenBSD) for helpful discussions and feedback. + Changes in version 1.13.3, released on March 13, 2015 --- MAJOR NEW FEATURES --- Modified: stable/11/contrib/mdocml/TODO ============================================================================== --- stable/11/contrib/mdocml/TODO Sat Oct 22 20:54:54 2016 (r307794) +++ stable/11/contrib/mdocml/TODO Sat Oct 22 20:56:49 2016 (r307795) @@ -1,6 +1,6 @@ ************************************************************************ * Official mandoc TODO. -* $Id: TODO,v 1.216 2016/01/08 01:37:32 schwarze Exp $ +* $Id: TODO,v 1.218 2016/06/05 21:06:04 schwarze Exp $ ************************************************************************ Many issues are annotated for difficulty as follows: @@ -416,6 +416,11 @@ are mere guesses, and some may be wrong. see also matthew@ Fri, 18 Jul 2014 19:25:12 -0700 loc * exist * algo ** size * imp *** +- In -man -Thtml, .nf does not preserve indentation. + It should either convert blanks to   + or use
 rather than 
(like .Bd -literal does). + Reported by afresh1@ 12 Apr 2016 14:35:45 -0700 + - .Bf at the beginning of a paragraph inserts a bogus 1ex horizontal space, see for example random(3). Introduced in http://mdocml.bsd.lv/cgi-bin/cvsweb/mdoc_html.c.diff?r1=1.91&r2=1.92 @@ -583,8 +588,6 @@ are mere guesses, and some may be wrong. to tech@mdocml, naddy@ Wed, 28 Sep 2011 11:21:46 +0200 wait! kristaps@ Sun, 02 Oct 2011 17:12:52 +0200 -- for system errors, use errno/strerror/warn/err - ************************************************************************ * documentation issues ************************************************************************ @@ -628,9 +631,6 @@ Several areas can be cleaned up to make * structural issues ************************************************************************ -- Use libz directly instead of forking gunzip(1). - Suggested by bapt at FreeBSD among others. - - We use the input line number at several places to distinguish same-line from different-line input. That plainly doesn't work with user-defined macros, leading to random breakage. Modified: stable/11/contrib/mdocml/cgi.c ============================================================================== --- stable/11/contrib/mdocml/cgi.c Sat Oct 22 20:54:54 2016 (r307794) +++ stable/11/contrib/mdocml/cgi.c Sat Oct 22 20:56:49 2016 (r307795) @@ -1,7 +1,7 @@ -/* $Id: cgi.c,v 1.116 2016/01/04 12:36:26 schwarze Exp $ */ +/* $Id: cgi.c,v 1.135 2016/07/11 22:48:37 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons - * Copyright (c) 2014, 2015 Ingo Schwarze + * Copyright (c) 2014, 2015, 2016 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -55,15 +56,20 @@ struct req { struct query q; char **p; /* array of available manpaths */ size_t psz; /* number of available manpaths */ + int isquery; /* QUERY_STRING used, not PATH_INFO */ +}; + +enum focus { + FOCUS_NONE = 0, + FOCUS_QUERY }; -static void catman(const struct req *, const char *); -static void format(const struct req *, const char *); static void html_print(const char *); static void html_putchar(char); static int http_decode(char *); -static void http_parse(struct req *, const char *); -static void pathgen(struct req *); +static void parse_manpath_conf(struct req *); +static void parse_path_info(struct req *req, const char *path); +static void parse_query_string(struct req *, const char *); static void pg_error_badrequest(const char *); static void pg_error_internal(void); static void pg_index(const struct req *); @@ -74,16 +80,18 @@ static void pg_searchres(const struct static void pg_show(struct req *, const char *); static void resp_begin_html(int, const char *); static void resp_begin_http(int, const char *); +static void resp_catman(const struct req *, const char *); static void resp_copy(const char *); static void resp_end_html(void); -static void resp_searchform(const struct req *); +static void resp_format(const struct req *, const char *); +static void resp_searchform(const struct req *, enum focus); static void resp_show(const struct req *, const char *); static void set_query_attr(char **, char **); static int validate_filename(const char *); static int validate_manpath(const struct req *, const char *); static int validate_urifrag(const char *); -static const char *scriptname; /* CGI script name */ +static const char *scriptname = SCRIPT_NAME; static const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9}; static const char *const sec_numbers[] = { @@ -106,16 +114,16 @@ static const int sec_MAX = sizeof(sec_na static const char *const arch_names[] = { "amd64", "alpha", "armish", "armv7", - "aviion", "hppa", "hppa64", "i386", - "ia64", "landisk", "loongson", "luna88k", - "macppc", "mips64", "octeon", "sgi", - "socppc", "solbourne", "sparc", "sparc64", - "vax", "zaurus", + "hppa", "hppa64", "i386", "landisk", + "loongson", "luna88k", "macppc", "mips64", + "octeon", "sgi", "socppc", "sparc", + "sparc64", "zaurus", "amiga", "arc", "arm32", "atari", - "beagle", "cats", "hp300", "mac68k", - "mvme68k", "mvme88k", "mvmeppc", "palm", - "pc532", "pegasos", "pmax", "powerpc", - "sun3", "wgrisc", "x68k" + "aviion", "beagle", "cats", "hp300", + "ia64", "mac68k", "mvme68k", "mvme88k", + "mvmeppc", "palm", "pc532", "pegasos", + "pmax", "powerpc", "solbourne", "sun3", + "vax", "wgrisc", "x68k" }; static const int arch_MAX = sizeof(arch_names) / sizeof(char *); @@ -182,11 +190,12 @@ set_query_attr(char **attr, char **val) * and store the values into the query structure. */ static void -http_parse(struct req *req, const char *qs) +parse_query_string(struct req *req, const char *qs) { char *key, *val; size_t keysz, valsz; + req->isquery = 1; req->q.manpath = NULL; req->q.arch = NULL; req->q.sec = NULL; @@ -338,14 +347,14 @@ resp_begin_html(int code, const char *ms resp_begin_http(code, msg); printf("\n" - "\n" - "\n" - "\n" - "\n" - "%s\n" - "\n" - "\n" + "\n" + "\n" + "\n" + "\n" + "%s\n" + "\n" + "\n" "\n", CSS_DIR, CUSTOMIZE_TITLE); @@ -358,103 +367,87 @@ resp_end_html(void) resp_copy(MAN_DIR "/footer.html"); - puts("\n" - ""); + puts("\n" + ""); } static void -resp_searchform(const struct req *req) +resp_searchform(const struct req *req, enum focus focus) { int i; puts(""); - printf("
\n" - "
\n" - "
\n" - "Manual Page Search Parameters\n", + printf("
\n" + "\n" + "
\n" + "Manual Page Search Parameters\n", scriptname); /* Write query input box. */ - printf( "
\n" - "q.query) + printf("q.query != NULL) html_print(req->q.query); - puts("\" SIZE=\"40\">"); - - /* Write submission and reset buttons. */ - - printf( "\n" - "\n"); - - /* Write show radio button */ - - printf( "\n" - "q.equal) - printf("CHECKED=\"checked\" "); - printf( "NAME=\"apropos\" ID=\"show\" VALUE=\"0\">\n" - "\n"); + printf( "\" size=\"40\""); + if (focus == FOCUS_QUERY) + printf(" autofocus"); + puts(">"); + + /* Write submission buttons. */ + + printf( "\n" + "\n
\n"); /* Write section selector. */ - puts( "
\n" - ""); for (i = 0; i < sec_MAX; i++) { - printf("\n", sec_names[i]); + printf(" selected=\"selected\""); + printf(">%s\n", sec_names[i]); } - puts(""); + puts(""); /* Write architecture selector. */ - printf( ""); + puts(""); /* Write manpath selector. */ if (req->psz > 1) { - puts(""); for (i = 0; i < (int)req->psz; i++) { - printf(""); + puts(""); } - puts(""); + puts(""); } - /* Write search radio button */ - - printf( "\n" - "q.equal) - printf("CHECKED=\"checked\" "); - printf( "NAME=\"apropos\" ID=\"search\" VALUE=\"1\">\n" - "\n"); - - puts("
\n" - "
\n" - "\n" - "
"); + puts("
\n" + "\n" + "
"); puts(""); } @@ -477,9 +470,6 @@ validate_manpath(const struct req *req, { size_t i; - if ( ! strcmp(manpath, "mandoc")) - return 1; - for (i = 0; i < req->psz; i++) if ( ! strcmp(manpath, req->p[i])) return 1; @@ -503,15 +493,16 @@ pg_index(const struct req *req) { resp_begin_html(200, NULL); - resp_searchform(req); - printf("

\n" + resp_searchform(req, FOCUS_QUERY); + printf("

\n" "This web interface is documented in the\n" - "man.cgi\n" + "man.cgi(8)\n" "manual, and the\n" - "apropos\n" + "apropos(1)\n" "manual explains the query syntax.\n" - "

\n", - scriptname, scriptname); + "

\n", + scriptname, *scriptname == '\0' ? "" : "/", + scriptname, *scriptname == '\0' ? "" : "/"); resp_end_html(); } @@ -519,10 +510,10 @@ static void pg_noresult(const struct req *req, const char *msg) { resp_begin_html(200, NULL); - resp_searchform(req); - puts("

"); + resp_searchform(req, FOCUS_QUERY); + puts("

"); puts(msg); - puts("

"); + puts("

"); resp_end_html(); } @@ -531,12 +522,12 @@ pg_error_badrequest(const char *msg) { resp_begin_html(400, "Bad Request"); - puts("

Bad Request

\n" - "

\n"); + puts("

Bad Request

\n" + "

\n"); puts(msg); printf("Try again from the\n" - "main page.\n" - "

", scriptname); + "main page.\n" + "

", scriptname); resp_end_html(); } @@ -544,7 +535,7 @@ static void pg_error_internal(void) { resp_begin_html(500, "Internal Server Error"); - puts("

Internal Server Error

"); + puts("

Internal Server Error

"); resp_end_html(); } @@ -552,28 +543,30 @@ static void pg_searchres(const struct req *req, struct manpage *r, size_t sz) { char *arch, *archend; - size_t i, iuse, isec; + const char *sec; + size_t i, iuse; int archprio, archpriouse; int prio, priouse; - char sec; for (i = 0; i < sz; i++) { if (validate_filename(r[i].file)) continue; - fprintf(stderr, "invalid filename %s in %s database\n", + warnx("invalid filename %s in %s database", r[i].file, req->q.manpath); pg_error_internal(); return; } - if (1 == sz) { + if (req->isquery && sz == 1) { /* * If we have just one result, then jump there now * without any delay. */ printf("Status: 303 See Other\r\n"); - printf("Location: http://%s%s/%s/%s", - HTTP_HOST, scriptname, req->q.manpath, r[0].file); + printf("Location: http://%s/%s%s%s/%s", + HTTP_HOST, scriptname, + *scriptname == '\0' ? "" : "/", + req->q.manpath, r[0].file); printf("\r\n" "Content-Type: text/html; charset=utf-8\r\n" "\r\n"); @@ -581,50 +574,57 @@ pg_searchres(const struct req *req, stru } resp_begin_html(200, NULL); - resp_searchform(req); - puts("
"); - puts(""); + resp_searchform(req, + req->q.equal || sz == 1 ? FOCUS_NONE : FOCUS_QUERY); - for (i = 0; i < sz; i++) { - printf("\n" - "\n" - "\n" - ""); - } + if (sz > 1) { + puts("
"); + puts("
\n" - "q.manpath, r[i].file); - printf("\">"); - html_print(r[i].names); - printf("\n" - ""); - html_print(r[i].output); - puts("
"); - puts("
\n" - "
"); + for (i = 0; i < sz; i++) { + printf("\n" + "\n" + "q.manpath, r[i].file); + printf("\">"); + html_print(r[i].names); + printf("\n" + "\n" + ""); + html_print(r[i].output); + puts("\n" + ""); + } + + puts("\n" + "
"); + } /* * In man(1) mode, show one of the pages * even if more than one is found. */ - if (req->q.equal) { - puts("
"); + if (req->q.equal || sz == 1) { + puts("
"); iuse = 0; - priouse = 10; + priouse = 20; archpriouse = 3; for (i = 0; i < sz; i++) { - isec = strcspn(r[i].file, "123456789"); - sec = r[i].file[isec]; - if ('\0' == sec) + sec = r[i].file; + sec += strcspn(sec, "123456789"); + if (sec[0] == '\0') continue; - prio = sec_prios[sec - '1']; - if (NULL == req->q.arch) { + prio = sec_prios[sec[0] - '1']; + if (sec[1] != '/') + prio += 10; + if (req->q.arch == NULL) { archprio = - (NULL == (arch = strchr( - r[i].file + isec, '/'))) ? 3 : - (NULL == (archend = strchr( - arch + 1, '/'))) ? 0 : + ((arch = strchr(sec + 1, '/')) + == NULL) ? 3 : + ((archend = strchr(arch + 1, '/')) + == NULL) ? 0 : strncmp(arch, "amd64/", archend - arch) ? 2 : 1; if (archprio < archpriouse) { @@ -648,7 +648,7 @@ pg_searchres(const struct req *req, stru } static void -catman(const struct req *req, const char *file) +resp_catman(const struct req *req, const char *file) { FILE *f; char *p; @@ -658,12 +658,12 @@ catman(const struct req *req, const char int italic, bold; if ((f = fopen(file, "r")) == NULL) { - puts("

You specified an invalid manual file.

"); + puts("

You specified an invalid manual file.

"); return; } - puts("
\n" - "
");
+	puts("
\n" + "
");
 
 	p = NULL;
 	sz = 0;
@@ -689,9 +689,9 @@ catman(const struct req *req, const char
 
 			if ('\b' != p[i + 1]) {
 				if (italic)
-					printf("");
+					printf("");
 				if (bold)
-					printf("");
+					printf("");
 				italic = bold = 0;
 				html_putchar(p[i]);
 				continue;
@@ -702,9 +702,9 @@ catman(const struct req *req, const char
 
 			if ('_' == p[i]) {
 				if (bold)
-					printf("");
+					printf("");
 				if ( ! italic)
-					printf("");
+					printf("");
 				bold = 0;
 				italic = 1;
 				i += 2;
@@ -726,9 +726,9 @@ catman(const struct req *req, const char
 					('*' == p[i] && '|' == p[i + 2]) ||
 					('|' == p[i] && '*' == p[i + 2]))  {
 				if (italic)
-					printf("");
+					printf("");
 				if (bold)
-					printf("");
+					printf("");
 				italic = bold = 0;
 				putchar('*');
 				i += 2;
@@ -740,9 +740,9 @@ catman(const struct req *req, const char
 					('+' == p[i] && '|' == p[i + 1]) ||
 					('|' == p[i] && '+' == p[i + 1]))  {
 				if (italic)
-					printf("");
+					printf("");
 				if (bold)
-					printf("");
+					printf("");
 				italic = bold = 0;
 				putchar('+');
 				i += 2;
@@ -752,9 +752,9 @@ catman(const struct req *req, const char
 			/* Bold mode. */
 
 			if (italic)
-				printf("");
+				printf("");
 			if ( ! bold)
-				printf("");
+				printf("");
 			bold = 1;
 			italic = 0;
 			i += 2;
@@ -767,9 +767,9 @@ catman(const struct req *req, const char
 		 */
 
 		if (italic)
-			printf("");
+			printf("");
 		if (bold)
-			printf("");
+			printf("");
 
 		if (i == len - 1 && p[i] != '\n')
 			html_putchar(p[i]);
@@ -778,14 +778,14 @@ catman(const struct req *req, const char
 	}
 	free(p);
 
-	puts("
\n" - "
"); + puts("
\n" + "
"); fclose(f); } static void -format(const struct req *req, const char *file) +resp_format(const struct req *req, const char *file) { struct manoutput conf; struct mparse *mp; @@ -795,7 +795,7 @@ format(const struct req *req, const char int usepath; if (-1 == (fd = open(file, O_RDONLY, 0))) { - puts("

You specified an invalid manual file.

"); + puts("

You specified an invalid manual file.

"); return; } @@ -807,17 +807,12 @@ format(const struct req *req, const char memset(&conf, 0, sizeof(conf)); conf.fragment = 1; usepath = strcmp(req->q.manpath, req->p[0]); - mandoc_asprintf(&conf.man, "%s?query=%%N&sec=%%S%s%s%s%s", - scriptname, - req->q.arch ? "&arch=" : "", - req->q.arch ? req->q.arch : "", - usepath ? "&manpath=" : "", - usepath ? req->q.manpath : ""); + mandoc_asprintf(&conf.man, "/%s%s%%N.%%S", + usepath ? req->q.manpath : "", usepath ? "/" : ""); mparse_result(mp, &man, NULL); if (man == NULL) { - fprintf(stderr, "fatal mandoc error: %s/%s\n", - req->q.manpath, file); + warnx("fatal mandoc error: %s/%s", req->q.manpath, file); pg_error_internal(); mparse_free(mp); mchars_free(); @@ -848,9 +843,9 @@ resp_show(const struct req *req, const c file += 2; if ('c' == *file) - catman(req, file); + resp_catman(req, file); else - format(req, file); + resp_format(req, file); } static void @@ -881,18 +876,12 @@ pg_show(struct req *req, const char *ful */ if (chdir(manpath) == -1) { - fprintf(stderr, "chdir %s: %s\n", - manpath, strerror(errno)); + warn("chdir %s", manpath); pg_error_internal(); free(manpath); return; } - - if (strcmp(manpath, "mandoc")) { - free(req->q.manpath); - req->q.manpath = manpath; - } else - free(manpath); + free(manpath); if ( ! validate_filename(file)) { pg_error_badrequest( @@ -901,7 +890,7 @@ pg_show(struct req *req, const char *ful } resp_begin_html(200, NULL); - resp_searchform(req); + resp_searchform(req, FOCUS_NONE); resp_show(req, file); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Oct 22 20:57:53 2016 Return-Path: Delivered-To: svn-src-all@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 123CAC1DD6D; Sat, 22 Oct 2016 20:57:53 +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 D2DBD6B8; Sat, 22 Oct 2016 20:57:52 +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 u9MKvpse014621; Sat, 22 Oct 2016 20:57:51 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKvpAm014620; Sat, 22 Oct 2016 20:57:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222057.u9MKvpAm014620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:57:51 +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: r307796 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:57:53 -0000 Author: bapt Date: Sat Oct 22 20:57:51 2016 New Revision: 307796 URL: https://svnweb.freebsd.org/changeset/base/307796 Log: MFC r305707: Directly set the O_NONBLOCK flags via open(2) 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 Sat Oct 22 20:56:49 2016 (r307795) +++ stable/11/usr.sbin/syslogd/syslogd.c Sat Oct 22 20:57:51 2016 (r307796) @@ -621,10 +621,7 @@ main(int argc, char *argv[]) dprintf("sending on inet and/or inet6 socket\n"); } - if ((fklog = open(_PATH_KLOG, O_RDONLY, 0)) >= 0) - if (fcntl(fklog, F_SETFL, O_NONBLOCK) < 0) - fklog = -1; - if (fklog < 0) + if ((fklog = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0)) < 0) dprintf("can't open %s (%d)\n", _PATH_KLOG, errno); /* tuck my process id away */ From owner-svn-src-all@freebsd.org Sat Oct 22 21:28:15 2016 Return-Path: Delivered-To: svn-src-all@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 C9539C1D47F for ; Sat, 22 Oct 2016 21:28:15 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x22e.google.com (mail-yb0-x22e.google.com [IPv6:2607:f8b0:4002:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 92BBF7C0 for ; Sat, 22 Oct 2016 21:28:15 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x22e.google.com with SMTP id g68so54759369ybi.0 for ; Sat, 22 Oct 2016 14:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qG04PVtvioxAkWpHFmcx6Ye6hDPn8EJucIUw+S9yrRU=; b=NiA13JQD8iw50MSgwgQU6+nDJnNgJq/DTJ5RZ2gFVD3P2Pu7PwaqrCVeQfiRaeuOhO y0pxHDIs0KMA32I34769tUYDE1WYxQaoXQB1Fpd/A4lTib4ahRCffgFtA/ZUs1R4ThIH 5uDq8daHtvNaH5uIBWFgnVay/wfeZ2M1T2+b+4B8PWtMCSO3rLi/KlZ1B4dkWMNsxj1v 6LtSgX59RpIgLRezXbWPA6PXwwf2v35MSWjnKAJ2frtwhMZm2xHtvTSqbbQod/I6taoq E4yaOyUIbQFeO67m5PHPOSh+bH+z8JAUssXNwliRE+a8KIHhbcTnXMu8p76nIXABXvtp B6nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qG04PVtvioxAkWpHFmcx6Ye6hDPn8EJucIUw+S9yrRU=; b=HU2H+x6Y/qYxQwHUp/kKylfTm4APJia80CJsMVlQ+qa6mj9qmctJ6Eg0MKXAal7yNN FuAmfK3a5HSMn2CqYBtknmEm8sClm/d5VjpBNBTG2ctnDzpd2RjBdQRpMXHL9ep0UQKS tslRWxNhQUGX9xup3u3oaf/FfGvv+OizHeOpdxB+PGHtC9X97fSk4CxjkciHDPY3eu4T 1ereJAUUWin62zrB0SL1OnA90YqehCNmwYihSSNqVjKJ94jQKPco6WEoeX5hv/CKxuG/ mkAAQWXH8/7pk1zn0P9Ky28ReZUgVUCwmumTySyEd22BpPdSQJgaaPzdtq0P1uyNRRbr bvxA== X-Gm-Message-State: ABUngvfH5CtwkdxuxPmjSFa5tm/oC/lMalcDF9pcKJ7HP0Tg1MNluf1T3qNIZrWPLUvz7+HV0OfR/VEb3LcyBw== X-Received: by 10.37.84.7 with SMTP id i7mr8449906ybb.92.1477171694079; Sat, 22 Oct 2016 14:28:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.246.129 with HTTP; Sat, 22 Oct 2016 14:27:43 -0700 (PDT) In-Reply-To: <201610222049.u9MKnirM010685@repo.freebsd.org> References: <201610222049.u9MKnirM010685@repo.freebsd.org> From: Ed Schouten Date: Sat, 22 Oct 2016 23:27:43 +0200 Message-ID: Subject: Re: svn commit: r307791 - stable/11/usr.sbin/bhyve To: Baptiste Daroussin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 21:28:15 -0000 Hi Baptiste, 2016-10-22 22:49 GMT+02:00 Baptiste Daroussin : > Use accept4 with O_NONBLOCK rather than accept + fcntl Keep in mind that changes like these do reduce the portability of the code. accept4(), SOCK_NONBLOCK, etc. are not part of POSIX. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-all@freebsd.org Sat Oct 22 21:30:21 2016 Return-Path: Delivered-To: svn-src-all@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 31978C1D515; Sat, 22 Oct 2016 21:30:21 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6E7E952; Sat, 22 Oct 2016 21:30:20 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id f193so47183400wmg.0; Sat, 22 Oct 2016 14:30:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=E6UcQDge/OZBQ/vRRH/PBp8djgmEdv2B6fT3M0rWfAk=; b=FeWO1aEsFdBTMWzfOc1HAK6Gy7JkcjlswN/oNfkHave3JzGPVZ2NEJx0VCB18rXwd9 uvjMpVQCjtyvqm+ZtGmQM6LFGXCV6g7u0Rw/dMZ57hp+3uNdl+7HnTWxWG1m4gfgA2T/ KumtYXy+5vJ4wQ6y3j2LvWFiLSZCfT/4AaSO4m+fJZvv+3Ocv9V9Se2jSVN/K4W9hl5m LNwa1gHQJz4P8yOdEZ2n9BNzWIzP4lw/i7kimx1qrM1sNsTz7njcwgz3AFxxHmym8S7n gm+ph5k1jPap43w7uxENeBjAcm6s+o46dIgNAWR2MQJayEwiA4lCX83hK2Pzk6SWP6oc ZE5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=E6UcQDge/OZBQ/vRRH/PBp8djgmEdv2B6fT3M0rWfAk=; b=LPQHOdyC3zZ3vmd22r7yIEHQml2t9YH20ecV2rN315nM0DWkCMG4QMdbo3sY/4yVFy 3HmTZqaOPuixFEvXCmgwT9ryenidWmAePhhW/d3rHFBhabKfI4n6xnFvR4S/1IZ2uHiP TnswVBkfbCgTL6pJZfOsbwUf5VtOI7V6QhgV7YBFd2RJ+IR50LNeghqsVecXbiLmjEzu GrN5OVIZC7Nl7PjY/UIVEeERde7AP5nVHt4YnKDXWQ0b6xAtBgxLbRFw6kI7zECiXwgE E6Plc5pJQANQ02NjMbImsYgPIJGITWghc0JaSocjvEFTyQBFcK5+2lpniq3MH1vneUrF HtMw== X-Gm-Message-State: ABUngvdBkplJXnCXNSAqnC7Nqz06EZaFtFR8hyYhGetv4dpBk4+tJvoJDRgELeFISgjLOA== X-Received: by 10.28.109.24 with SMTP id i24mr8064138wmc.111.1477171818762; Sat, 22 Oct 2016 14:30:18 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id f194sm3319526wmg.12.2016.10.22.14.30.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Oct 2016 14:30:18 -0700 (PDT) Sender: Baptiste Daroussin Date: Sat, 22 Oct 2016 23:30:17 +0200 From: Baptiste Daroussin To: Ed Schouten Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r307791 - stable/11/usr.sbin/bhyve Message-ID: <20161022213017.d6h2wji75r2huqqv@ivaldir.etoilebsd.net> References: <201610222049.u9MKnirM010685@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jhyhs2fzwdblxaob" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161014 (1.7.1) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 21:30:21 -0000 --jhyhs2fzwdblxaob Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 22, 2016 at 11:27:43PM +0200, Ed Schouten wrote: > Hi Baptiste, >=20 > 2016-10-22 22:49 GMT+02:00 Baptiste Daroussin : > > Use accept4 with O_NONBLOCK rather than accept + fcntl >=20 > Keep in mind that changes like these do reduce the portability of the > code. accept4(), SOCK_NONBLOCK, etc. are not part of POSIX. >=20 I entirely forgot that! Thanks for the heads up, I'll be carefull Best regards, Bapt --jhyhs2fzwdblxaob Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJYC9pmAAoJEGOJi9zxtz5aSEQQAIK5qOyEg0MQVi6MpyWVsQlO d0a38Cnfn04w2dMW2vXrtrSsWLw4vqtueVrAqN1sNEBIe/TTkoHyJHiIpA5CHlog Dr02RSfWnwAvsmIAMQWWInCmtpCdVKO4a4udE02vw3RaYFNecoFj0wDgqmIkKhAY 6yD9rMn1tA5/+3F1bh1mq7sBGiVmoCgI9MzyPdNSdEQrISfEcWI8r34cP5WmIzAx r2QGlym1oSsryEctGH1wcq8ACMd9HvrlJMmXa5CZpQma5Gno531X2CknjerO3JCI IXFkEpBTelYzF+gYRW+k0SjFgPd/CbU/dFmmQImQuqgyTH5jjovr8A3rHtcJ1TOp O8ZDl+r7pw/IrIhADyyJfYGFBoW6uRzv9cTJqeQ0uRnV6FcJYXfxUWVilyJW4k+g ACEP/bnRP04i06W2+WK/P0ZMVXAKsfNPWxY4c81NE4JYRsWm6UMs9urDqwA0sxGV 2Hff5LCcxAP6In8MvB9c7+k1W/B5/UuYR+hbu/jojZVrmmD1jYkUaE8l5exMTbeF pJaduv4mFnVQzYh4IjOd5xbXLeCr/eJ7UKcByfo0RPFgNyyUOv8aNB3cWdgI01tO +kch1O0l0nhcdmobbqyAkjf8ymcJrm0eWiOH/urjcI046o1rk4DplYNenBW1Nzjk pexHt+wgZIre6jzo8Mtp =4GlP -----END PGP SIGNATURE----- --jhyhs2fzwdblxaob-- From owner-svn-src-all@freebsd.org Sat Oct 22 21:41:02 2016 Return-Path: Delivered-To: svn-src-all@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 73193C1D92E; Sat, 22 Oct 2016 21:41:02 +0000 (UTC) (envelope-from mm@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 37DC5F30; Sat, 22 Oct 2016 21:41:02 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MLf1Fc032546; Sat, 22 Oct 2016 21:41:01 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MLf0Ih032536; Sat, 22 Oct 2016 21:41:00 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201610222141.u9MLf0Ih032536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 22 Oct 2016 21:41: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: r307797 - in stable/11/contrib/libarchive: cpio/test libarchive libarchive/test tar/test X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 21:41:02 -0000 Author: mm Date: Sat Oct 22 21:41:00 2016 New Revision: 307797 URL: https://svnweb.freebsd.org/changeset/base/307797 Log: MFC r307215: Sync libarchive with vendor. Style and tests fixes. Important vendor bugfixes (relevant to FreeBSD): #801: FreeBSD Coverity report: resource leak in libarchive/tar/test/main.c Modified: stable/11/contrib/libarchive/cpio/test/main.c stable/11/contrib/libarchive/cpio/test/test.h stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c stable/11/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c stable/11/contrib/libarchive/libarchive/test/main.c stable/11/contrib/libarchive/libarchive/test/test.h stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c stable/11/contrib/libarchive/tar/test/main.c stable/11/contrib/libarchive/tar/test/test.h stable/11/contrib/libarchive/tar/test/test_missing_file.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libarchive/cpio/test/main.c ============================================================================== --- stable/11/contrib/libarchive/cpio/test/main.c Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/cpio/test/main.c Sat Oct 22 21:41:00 2016 (r307797) @@ -130,6 +130,13 @@ __FBSDID("$FreeBSD$"); # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1294,6 +1301,11 @@ assertion_file_time(const char *file, in switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1425,7 +1437,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1661,6 +1673,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1675,6 +1688,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: stable/11/contrib/libarchive/cpio/test/test.h ============================================================================== --- stable/11/contrib/libarchive/cpio/test/test.h Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/cpio/test/test.h Sat Oct 22 21:41:00 2016 (r307797) @@ -182,6 +182,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -327,6 +329,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; Modified: stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sat Oct 22 21:41:00 2016 (r307797) @@ -627,7 +627,6 @@ translate_acl(struct archive_read_disk * archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Unknown ACL brand"); return (ARCHIVE_WARN); - break; } #endif Modified: stable/11/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Sat Oct 22 21:41:00 2016 (r307797) @@ -232,6 +232,7 @@ static const char * lookup_uname_helper(struct name_cache *cache, id_t id) { struct passwd *result; + (void)cache; /* UNUSED */ result = getpwuid((uid_t)id); @@ -298,6 +299,7 @@ static const char * lookup_gname_helper(struct name_cache *cache, id_t id) { struct group *result; + (void)cache; /* UNUSED */ result = getgrgid((gid_t)id); Modified: stable/11/contrib/libarchive/libarchive/test/main.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/main.c Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/libarchive/test/main.c Sat Oct 22 21:41:00 2016 (r307797) @@ -128,6 +128,13 @@ __FBSDID("$FreeBSD$"); # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1364,6 +1371,31 @@ assertion_file_birthtime_recent(const ch return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1403,7 +1435,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1440,31 +1472,6 @@ assertion_file_size(const char *file, in return (0); } -/* Verify mode of 'pathname'. */ -int -assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) -{ - int mode; - int r; - - assertion_count(file, line); -#if defined(_WIN32) && !defined(__CYGWIN__) - failure_start(file, line, "assertFileMode not yet implemented for Windows"); -#else - { - struct stat st; - r = lstat(pathname, &st); - mode = (int)(st.st_mode & 0777); - } - if (r == 0 && mode == expected_mode) - return (1); - failure_start(file, line, "File %s has mode %o, expected %o", - pathname, mode, expected_mode); -#endif - failure_finish(NULL); - return (0); -} - /* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */ int assertion_is_dir(const char *file, int line, const char *pathname, int mode) @@ -1664,6 +1671,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1678,6 +1686,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: stable/11/contrib/libarchive/libarchive/test/test.h ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test.h Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/libarchive/test/test.h Sat Oct 22 21:41:00 2016 (r307797) @@ -243,12 +243,12 @@ int assertion_file_birthtime_recent(cons int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); int assertion_file_not_exists(const char *, int, const char *); int assertion_file_size(const char *, int, const char *, long); -int assertion_file_mode(const char *, int, const char *, int); int assertion_is_dir(const char *, int, const char *, int); int assertion_is_hardlink(const char *, int, const char *, const char *); int assertion_is_not_hardlink(const char *, int, const char *, const char *); @@ -329,6 +329,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; Modified: stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/libarchive/test/test_read_set_format.c Sat Oct 22 21:41:00 2016 (r307797) @@ -200,6 +200,8 @@ DEFINE_TEST(test_read_append_filter_wron { struct archive_entry *ae; struct archive *a; + int fd; + fpos_t pos; /* * If we have "bunzip2 -q", try using that. @@ -208,6 +210,13 @@ DEFINE_TEST(test_read_append_filter_wron skipping("Can't run bunzip2 program on this platform"); return; } + + /* bunzip2 will write to stderr, redirect it to a file */ + fflush(stderr); + fgetpos(stderr, &pos); + fd = dup(fileno(stderr)); + freopen("stderr1", "w", stderr); + assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); assertEqualIntA(a, ARCHIVE_OK, @@ -217,4 +226,13 @@ DEFINE_TEST(test_read_append_filter_wron assertA(archive_read_next_header(a, &ae) < (ARCHIVE_WARN)); assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* restore stderr */ + fflush(stderr); + dup2(fd, fileno(stderr)); + close(fd); + clearerr(stderr); + fsetpos(stderr, &pos); + + assertTextFileContents("bunzip2: (stdin) is not a bzip2 file.\n", "stderr1"); } Modified: stable/11/contrib/libarchive/tar/test/main.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/main.c Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/tar/test/main.c Sat Oct 22 21:41:00 2016 (r307797) @@ -1164,6 +1164,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1301,6 +1330,11 @@ assertion_file_time(const char *file, in switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1432,7 +1466,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1668,6 +1702,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1682,6 +1717,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: stable/11/contrib/libarchive/tar/test/test.h ============================================================================== --- stable/11/contrib/libarchive/tar/test/test.h Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/tar/test/test.h Sat Oct 22 21:41:00 2016 (r307797) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: stable/11/contrib/libarchive/tar/test/test_missing_file.c ============================================================================== --- stable/11/contrib/libarchive/tar/test/test_missing_file.c Sat Oct 22 20:57:51 2016 (r307796) +++ stable/11/contrib/libarchive/tar/test/test_missing_file.c Sat Oct 22 21:41:00 2016 (r307797) @@ -27,11 +27,15 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_missing_file) { + const char * invalid_stderr[] = { "INTERNAL ERROR", NULL }; assertMakeFile("file1", 0644, "file1"); assertMakeFile("file2", 0644, "file2"); assert(0 == systemf("%s -cf archive.tar file1 file2 2>stderr1", testprog)); assertEmptyFile("stderr1"); assert(0 != systemf("%s -cf archive.tar file1 file2 file3 2>stderr2", testprog)); + assertFileContainsNoInvalidStrings("stderr2", invalid_stderr); assert(0 != systemf("%s -cf archive.tar 2>stderr3", testprog)); - assert(0 != systemf("%s -cf archive.tar file3 2>stderr4", testprog)); + assertFileContainsNoInvalidStrings("stderr3", invalid_stderr); + assert(0 != systemf("%s -cf archive.tar file3 file4 2>stderr4", testprog)); + assertFileContainsNoInvalidStrings("stderr4", invalid_stderr); } From owner-svn-src-all@freebsd.org Sat Oct 22 21:41:30 2016 Return-Path: Delivered-To: svn-src-all@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 38F45C1D99B; Sat, 22 Oct 2016 21:41:30 +0000 (UTC) (envelope-from mm@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 027CB10E3; Sat, 22 Oct 2016 21:41:29 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MLfTOq033401; Sat, 22 Oct 2016 21:41:29 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MLfSQm033391; Sat, 22 Oct 2016 21:41:28 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201610222141.u9MLfSQm033391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 22 Oct 2016 21:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307798 - in stable/10/contrib/libarchive: cpio/test libarchive libarchive/test tar/test X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 21:41:30 -0000 Author: mm Date: Sat Oct 22 21:41:28 2016 New Revision: 307798 URL: https://svnweb.freebsd.org/changeset/base/307798 Log: MFC r307215: Sync libarchive with vendor. Style and tests fixes. Important vendor bugfixes (relevant to FreeBSD): #801: FreeBSD Coverity report: resource leak in libarchive/tar/test/main.c Modified: stable/10/contrib/libarchive/cpio/test/main.c stable/10/contrib/libarchive/cpio/test/test.h stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c stable/10/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c stable/10/contrib/libarchive/libarchive/test/main.c stable/10/contrib/libarchive/libarchive/test/test.h stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c stable/10/contrib/libarchive/tar/test/main.c stable/10/contrib/libarchive/tar/test/test.h stable/10/contrib/libarchive/tar/test/test_missing_file.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/cpio/test/main.c ============================================================================== --- stable/10/contrib/libarchive/cpio/test/main.c Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/cpio/test/main.c Sat Oct 22 21:41:28 2016 (r307798) @@ -130,6 +130,13 @@ __FBSDID("$FreeBSD$"); # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1294,6 +1301,11 @@ assertion_file_time(const char *file, in switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1425,7 +1437,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1661,6 +1673,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1675,6 +1688,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: stable/10/contrib/libarchive/cpio/test/test.h ============================================================================== --- stable/10/contrib/libarchive/cpio/test/test.h Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/cpio/test/test.h Sat Oct 22 21:41:28 2016 (r307798) @@ -182,6 +182,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -327,6 +329,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sat Oct 22 21:41:28 2016 (r307798) @@ -627,7 +627,6 @@ translate_acl(struct archive_read_disk * archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Unknown ACL brand"); return (ARCHIVE_WARN); - break; } #endif Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Sat Oct 22 21:41:28 2016 (r307798) @@ -232,6 +232,7 @@ static const char * lookup_uname_helper(struct name_cache *cache, id_t id) { struct passwd *result; + (void)cache; /* UNUSED */ result = getpwuid((uid_t)id); @@ -298,6 +299,7 @@ static const char * lookup_gname_helper(struct name_cache *cache, id_t id) { struct group *result; + (void)cache; /* UNUSED */ result = getgrgid((gid_t)id); Modified: stable/10/contrib/libarchive/libarchive/test/main.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/main.c Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/libarchive/test/main.c Sat Oct 22 21:41:28 2016 (r307798) @@ -128,6 +128,13 @@ __FBSDID("$FreeBSD$"); # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1364,6 +1371,31 @@ assertion_file_birthtime_recent(const ch return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1403,7 +1435,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1440,31 +1472,6 @@ assertion_file_size(const char *file, in return (0); } -/* Verify mode of 'pathname'. */ -int -assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) -{ - int mode; - int r; - - assertion_count(file, line); -#if defined(_WIN32) && !defined(__CYGWIN__) - failure_start(file, line, "assertFileMode not yet implemented for Windows"); -#else - { - struct stat st; - r = lstat(pathname, &st); - mode = (int)(st.st_mode & 0777); - } - if (r == 0 && mode == expected_mode) - return (1); - failure_start(file, line, "File %s has mode %o, expected %o", - pathname, mode, expected_mode); -#endif - failure_finish(NULL); - return (0); -} - /* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */ int assertion_is_dir(const char *file, int line, const char *pathname, int mode) @@ -1664,6 +1671,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1678,6 +1686,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: stable/10/contrib/libarchive/libarchive/test/test.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test.h Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/libarchive/test/test.h Sat Oct 22 21:41:28 2016 (r307798) @@ -243,12 +243,12 @@ int assertion_file_birthtime_recent(cons int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); int assertion_file_not_exists(const char *, int, const char *); int assertion_file_size(const char *, int, const char *, long); -int assertion_file_mode(const char *, int, const char *, int); int assertion_is_dir(const char *, int, const char *, int); int assertion_is_hardlink(const char *, int, const char *, const char *); int assertion_is_not_hardlink(const char *, int, const char *, const char *); @@ -329,6 +329,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; Modified: stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c Sat Oct 22 21:41:28 2016 (r307798) @@ -200,6 +200,8 @@ DEFINE_TEST(test_read_append_filter_wron { struct archive_entry *ae; struct archive *a; + int fd; + fpos_t pos; /* * If we have "bunzip2 -q", try using that. @@ -208,6 +210,13 @@ DEFINE_TEST(test_read_append_filter_wron skipping("Can't run bunzip2 program on this platform"); return; } + + /* bunzip2 will write to stderr, redirect it to a file */ + fflush(stderr); + fgetpos(stderr, &pos); + fd = dup(fileno(stderr)); + freopen("stderr1", "w", stderr); + assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); assertEqualIntA(a, ARCHIVE_OK, @@ -217,4 +226,13 @@ DEFINE_TEST(test_read_append_filter_wron assertA(archive_read_next_header(a, &ae) < (ARCHIVE_WARN)); assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* restore stderr */ + fflush(stderr); + dup2(fd, fileno(stderr)); + close(fd); + clearerr(stderr); + fsetpos(stderr, &pos); + + assertTextFileContents("bunzip2: (stdin) is not a bzip2 file.\n", "stderr1"); } Modified: stable/10/contrib/libarchive/tar/test/main.c ============================================================================== --- stable/10/contrib/libarchive/tar/test/main.c Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/tar/test/main.c Sat Oct 22 21:41:28 2016 (r307798) @@ -1164,6 +1164,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1301,6 +1330,11 @@ assertion_file_time(const char *file, in switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1432,7 +1466,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1668,6 +1702,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1682,6 +1717,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: stable/10/contrib/libarchive/tar/test/test.h ============================================================================== --- stable/10/contrib/libarchive/tar/test/test.h Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/tar/test/test.h Sat Oct 22 21:41:28 2016 (r307798) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: stable/10/contrib/libarchive/tar/test/test_missing_file.c ============================================================================== --- stable/10/contrib/libarchive/tar/test/test_missing_file.c Sat Oct 22 21:41:00 2016 (r307797) +++ stable/10/contrib/libarchive/tar/test/test_missing_file.c Sat Oct 22 21:41:28 2016 (r307798) @@ -27,11 +27,15 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_missing_file) { + const char * invalid_stderr[] = { "INTERNAL ERROR", NULL }; assertMakeFile("file1", 0644, "file1"); assertMakeFile("file2", 0644, "file2"); assert(0 == systemf("%s -cf archive.tar file1 file2 2>stderr1", testprog)); assertEmptyFile("stderr1"); assert(0 != systemf("%s -cf archive.tar file1 file2 file3 2>stderr2", testprog)); + assertFileContainsNoInvalidStrings("stderr2", invalid_stderr); assert(0 != systemf("%s -cf archive.tar 2>stderr3", testprog)); - assert(0 != systemf("%s -cf archive.tar file3 2>stderr4", testprog)); + assertFileContainsNoInvalidStrings("stderr3", invalid_stderr); + assert(0 != systemf("%s -cf archive.tar file3 file4 2>stderr4", testprog)); + assertFileContainsNoInvalidStrings("stderr4", invalid_stderr); } From owner-svn-src-all@freebsd.org Sat Oct 22 21:51:59 2016 Return-Path: Delivered-To: svn-src-all@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 B319CC1DE3C; Sat, 22 Oct 2016 21:51:59 +0000 (UTC) (envelope-from jhibbits@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 8C3FF197E; Sat, 22 Oct 2016 21:51:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MLpwkG036535; Sat, 22 Oct 2016 21:51:58 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MLpwuv036530; Sat, 22 Oct 2016 21:51:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201610222151.u9MLpwuv036530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 22 Oct 2016 21:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307799 - in head/lib/libc: powerpc/gen powerpcspe powerpcspe/gen powerpcspe/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 21:51:59 -0000 Author: jhibbits Date: Sat Oct 22 21:51:58 2016 New Revision: 307799 URL: https://svnweb.freebsd.org/changeset/base/307799 Log: Reduce code duplication between powerpc and powerpcspe They're nearly identical except for a few files. Reported by: kib Added: head/lib/libc/powerpc/gen/Makefile.common (contents, props changed) Deleted: head/lib/libc/powerpcspe/SYS.h head/lib/libc/powerpcspe/_fpmath.h head/lib/libc/powerpcspe/arith.h head/lib/libc/powerpcspe/gd_qnan.h head/lib/libc/powerpcspe/gen/_ctx_start.S head/lib/libc/powerpcspe/gen/_set_tp.c head/lib/libc/powerpcspe/gen/eabi.S head/lib/libc/powerpcspe/gen/infinity.c head/lib/libc/powerpcspe/gen/makecontext.c head/lib/libc/powerpcspe/gen/signalcontext.c head/lib/libc/powerpcspe/gen/syncicache.c head/lib/libc/powerpcspe/sys/brk.S head/lib/libc/powerpcspe/sys/cerror.S head/lib/libc/powerpcspe/sys/exect.S head/lib/libc/powerpcspe/sys/sbrk.S head/lib/libc/powerpcspe/sys/setlogin.S Modified: head/lib/libc/powerpc/gen/Makefile.inc head/lib/libc/powerpcspe/Makefile.inc head/lib/libc/powerpcspe/gen/Makefile.inc head/lib/libc/powerpcspe/sys/Makefile.inc Added: head/lib/libc/powerpc/gen/Makefile.common ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/powerpc/gen/Makefile.common Sat Oct 22 21:51:58 2016 (r307799) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.PATH: ${LIBC_SRCTOP}/powerpc/gen + +SRCS += _ctx_start.S eabi.S infinity.c ldexp.c makecontext.c \ + signalcontext.c syncicache.c _set_tp.c trivial-getcontextx.c Modified: head/lib/libc/powerpc/gen/Makefile.inc ============================================================================== --- head/lib/libc/powerpc/gen/Makefile.inc Sat Oct 22 21:41:28 2016 (r307798) +++ head/lib/libc/powerpc/gen/Makefile.inc Sat Oct 22 21:51:58 2016 (r307799) @@ -1,11 +1,7 @@ # $FreeBSD$ -SRCS += _ctx_start.S eabi.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ - fpgetsticky.c fpsetmask.c fpsetround.c \ - infinity.c ldexp.c makecontext.c _setjmp.S \ - setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ - _set_tp.c \ - trivial-getcontextx.c - - +.include "${LIBC_SRC}/powerpc/gen/Makefile.common" +SRCS += fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c \ + _setjmp.S setjmp.S sigsetjmp.S Modified: head/lib/libc/powerpcspe/Makefile.inc ============================================================================== --- head/lib/libc/powerpcspe/Makefile.inc Sat Oct 22 21:41:28 2016 (r307798) +++ head/lib/libc/powerpcspe/Makefile.inc Sat Oct 22 21:51:58 2016 (r307799) @@ -1,5 +1,6 @@ # $FreeBSD$ +CFLAGS+= -I${LIBC_SRCTOP}/powerpc SRCS+= trivial-vdso_tc.c # Long double is 64-bits Modified: head/lib/libc/powerpcspe/gen/Makefile.inc ============================================================================== --- head/lib/libc/powerpcspe/gen/Makefile.inc Sat Oct 22 21:41:28 2016 (r307798) +++ head/lib/libc/powerpcspe/gen/Makefile.inc Sat Oct 22 21:51:58 2016 (r307799) @@ -1,11 +1,7 @@ # $FreeBSD$ -SRCS += _ctx_start.S eabi.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ - fpgetsticky.c fpsetmask.c fpsetround.c \ - infinity.c ldexp.c makecontext.c _setjmp.S \ - setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ - _set_tp.c \ - trivial-getcontextx.c - - +.include "${LIBC_SRCTOP}/powerpc/gen/Makefile.common" +SRCS += fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c \ + _setjmp.S setjmp.S sigsetjmp.S Modified: head/lib/libc/powerpcspe/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpcspe/sys/Makefile.inc Sat Oct 22 21:41:28 2016 (r307798) +++ head/lib/libc/powerpcspe/sys/Makefile.inc Sat Oct 22 21:51:58 2016 (r307799) @@ -1,8 +1,4 @@ # $FreeBSD$ -MDASM+= brk.S cerror.S exect.S sbrk.S setlogin.S - -# Don't generate default code for these syscalls: -NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o - -PSEUDO= _getlogin.o _exit.o +.PATH: ${LIBC_SRCTOP}/powerpc/sys +.sinclude "${LIBC_SRCTOP}/powerpc/sys/Makefile.inc" From owner-svn-src-all@freebsd.org Sat Oct 22 22:27:52 2016 Return-Path: Delivered-To: svn-src-all@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 D341FC1D693; Sat, 22 Oct 2016 22:27:52 +0000 (UTC) (envelope-from cy@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 89768D26; Sat, 22 Oct 2016 22:27:52 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MMRpoU048417; Sat, 22 Oct 2016 22:27:51 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MMRp8Y048414; Sat, 22 Oct 2016 22:27:51 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201610222227.u9MMRp8Y048414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 22 Oct 2016 22:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307800 - in head/usr.sbin/amd: . amd libamu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 22:27:52 -0000 Author: cy Date: Sat Oct 22 22:27:51 2016 New Revision: 307800 URL: https://svnweb.freebsd.org/changeset/base/307800 Log: Sources from the "current" build tree and generated sources in the object tree should be used instead of sources and headers from the already installed source tree on the build host. This was noticed while addressing issues in the upcoming amd update. MFC after: 2 weeks Modified: head/usr.sbin/amd/Makefile.inc head/usr.sbin/amd/amd/Makefile head/usr.sbin/amd/libamu/Makefile Modified: head/usr.sbin/amd/Makefile.inc ============================================================================== --- head/usr.sbin/amd/Makefile.inc Sat Oct 22 21:51:58 2016 (r307799) +++ head/usr.sbin/amd/Makefile.inc Sat Oct 22 22:27:51 2016 (r307800) @@ -32,8 +32,8 @@ CFLAGS+= -DYES_HESIOD CFLAGS+= -DHOST_CPU=\"${MACHINE_CPUARCH}\" -DHOST_ARCH=\"${MACHINE_ARCH}\" RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -MOUNT_X= ${DESTDIR}/usr/include/rpcsvc/mount.x -NFS_PROT_X= ${DESTDIR}/usr/include/rpcsvc/nfs_prot.x +MOUNT_X= ${SRCTOP}/include/rpcsvc/mount.x +NFS_PROT_X= ${SRCTOP}/include/rpcsvc/nfs_prot.x WARNS?= 1 Modified: head/usr.sbin/amd/amd/Makefile ============================================================================== --- head/usr.sbin/amd/amd/Makefile Sat Oct 22 21:51:58 2016 (r307799) +++ head/usr.sbin/amd/amd/Makefile Sat Oct 22 22:27:51 2016 (r307800) @@ -25,7 +25,7 @@ SRCS+= ops_unionfs.c opts.c readdir.c re SRCS+= srvr_amfs_auto.c srvr_nfs.c CFLAGS+= -I${SRCTOP}/contrib/amd/amd \ - -I${DESTDIR}/usr/include/rpcsvc + -I${.OBJDIR}/../../../include/rpcsvc LIBADD= amu wrap Modified: head/usr.sbin/amd/libamu/Makefile ============================================================================== --- head/usr.sbin/amd/libamu/Makefile Sat Oct 22 21:51:58 2016 (r307799) +++ head/usr.sbin/amd/libamu/Makefile Sat Oct 22 22:27:51 2016 (r307800) @@ -23,7 +23,7 @@ SRCS+= nfs_prot_x.c xdr_func_%undef.c CLEANFILES+= nfs_prot_x.c xdr_func_%undef.c CFLAGS+= -I${SRCTOP}/contrib/amd/libamu \ - -I${DESTDIR}/usr/include/rpcsvc + -I${.OBJDIR}/../../../include/rpcsvc nfs_prot_x.c: ${NFS_PROT_X} ${RPCCOM} -c -C -DWANT_NFS3 ${NFS_PROT_X} -o ${.TARGET} From owner-svn-src-all@freebsd.org Sat Oct 22 22:29:04 2016 Return-Path: Delivered-To: svn-src-all@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 71DF7C1D70D; Sat, 22 Oct 2016 22:29:04 +0000 (UTC) (envelope-from cy@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 41760EA0; Sat, 22 Oct 2016 22:29:04 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MMT3Zj048503; Sat, 22 Oct 2016 22:29:03 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MMT3YY048502; Sat, 22 Oct 2016 22:29:03 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201610222229.u9MMT3YY048502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 22 Oct 2016 22:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307801 - head/usr.sbin/amd/amd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 22:29:04 -0000 Author: cy Date: Sat Oct 22 22:29:03 2016 New Revision: 307801 URL: https://svnweb.freebsd.org/changeset/base/307801 Log: Align whitespace. MFC after: 2 weeks X-MFC with: r307800 Modified: head/usr.sbin/amd/amd/Makefile Modified: head/usr.sbin/amd/amd/Makefile ============================================================================== --- head/usr.sbin/amd/amd/Makefile Sat Oct 22 22:27:51 2016 (r307800) +++ head/usr.sbin/amd/amd/Makefile Sat Oct 22 22:29:03 2016 (r307801) @@ -31,7 +31,7 @@ LIBADD= amu wrap CLEANFILES+= conf_parse.c conf_parse.h conf_tok.c -conf_tok.o: conf_parse.h +conf_tok.o: conf_parse.h # These are generated at compile time SRCS+= mount_xdr.c From owner-svn-src-all@freebsd.org Sat Oct 22 22:35:41 2016 Return-Path: Delivered-To: svn-src-all@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 5374BC1D9FC; Sat, 22 Oct 2016 22:35:41 +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 2E4B86EF; Sat, 22 Oct 2016 22:35:41 +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 u9MMZeK3052267; Sat, 22 Oct 2016 22:35:40 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MMZdR2052263; Sat, 22 Oct 2016 22:35:39 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222235.u9MMZdR2052263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 22:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307802 - in head: tools/build/mk usr.sbin usr.sbin/tzsetup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 22:35:41 -0000 Author: bapt Date: Sat Oct 22 22:35:39 2016 New Revision: 307802 URL: https://svnweb.freebsd.org/changeset/base/307802 Log: Fix build of tzsetup when WITHOUT_DIALOG is set Hide dialog specific code behind HAVE_DIALOG. It allows to build a stripped down version (missing the dialog UI) but perfectly function tzsetup when world is built WITHOUT_DIALOG Reorganise a bit the code to limit the number of blocks under HAVE_DIALOG Reviewed by: emaste Sponsored by: https://reviews.freebsd.org/D8325 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/Makefile head/usr.sbin/tzsetup/Makefile head/usr.sbin/tzsetup/tzsetup.c Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Oct 22 22:29:03 2016 (r307801) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sat Oct 22 22:35:39 2016 (r307802) @@ -1348,12 +1348,10 @@ OLD_FILES+=usr/lib/libdpv.so OLD_FILES+=usr/lib/libdpv.so.1 OLD_FILES+=usr/lib/libdpv_p.a OLD_FILES+=usr/sbin/bsdconfig -OLD_FILES+=usr/sbin/tzsetup OLD_FILES+=usr/share/man/man1/dialog.1.gz OLD_FILES+=usr/share/man/man1/dpv.1.gz OLD_FILES+=usr/share/man/man3/dialog.3.gz OLD_FILES+=usr/share/man/man3/dpv.3.gz -OLD_FILES+=usr/share/man/man8/tzsetup.8.gz OLD_FILES+=usr/share/man/man8/bsdconfig.8.gz .endif Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Sat Oct 22 22:29:03 2016 (r307801) +++ head/usr.sbin/Makefile Sat Oct 22 22:35:39 2016 (r307802) @@ -88,6 +88,7 @@ SUBDIR= adduser \ tcpdump \ traceroute \ trpt \ + tzsetup \ uefisign \ ugidfw \ vigr \ @@ -121,7 +122,6 @@ SUBDIR.${MK_BOOTPARAMD}+= bootparamd SUBDIR.${MK_BSDINSTALL}+= bsdinstall SUBDIR.${MK_BSNMP}+= bsnmpd SUBDIR.${MK_CTM}+= ctm -SUBDIR.${MK_DIALOG}+= tzsetup SUBDIR.${MK_DIALOG}+= bsdconfig SUBDIR.${MK_EFI}+= efivar SUBDIR.${MK_FLOPPY}+= fdcontrol Modified: head/usr.sbin/tzsetup/Makefile ============================================================================== --- head/usr.sbin/tzsetup/Makefile Sat Oct 22 22:29:03 2016 (r307801) +++ head/usr.sbin/tzsetup/Makefile Sat Oct 22 22:35:39 2016 (r307802) @@ -1,12 +1,16 @@ # $FreeBSD$ +.include + PROG= tzsetup MAN= tzsetup.8 -CFLAGS+= -I${.CURDIR}/../../contrib/dialog -I. +CFLAGS+= -I. +.if ${MK_DIALOG} != no WARNS?= 3 - +CFLAGS+= -I${.CURDIR}/../../contrib/dialog -DHAVE_DIALOG LIBADD= dialog ncursesw +.endif .include Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Sat Oct 22 22:29:03 2016 (r307801) +++ head/usr.sbin/tzsetup/tzsetup.c Sat Oct 22 22:35:39 2016 (r307802) @@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef HAVE_DIALOG #include +#endif #define _PATH_ZONETAB "/usr/share/zoneinfo/zone.tab" #define _PATH_ISO3166 "/usr/share/misc/iso3166" @@ -72,6 +74,19 @@ __FBSDID("$FreeBSD$"); #define DITEM_LEAVE_MENU (1 << 16) #define DITEM_RECREATE (1 << 18) +static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], + path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], + path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; + +static int reallydoit = 1; +static int reinstall = 0; +static char *chrootenv = NULL; + +static void usage(void); +static int install_zoneinfo(const char *zoneinfo); +static int install_zoneinfo_file(const char *zoneinfo_file); + +#ifdef HAVE_DIALOG /* for use in describing more exotic behaviors */ typedef struct dialogMenuItem { char *prompt; @@ -187,20 +202,10 @@ again: return result; } -static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], - path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], - path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; - -static int reallydoit = 1; -static int reinstall = 0; static int usedialog = 1; -static char *chrootenv = NULL; -static void usage(void); static int confirm_zone(const char *filename); static int continent_country_menu(dialogMenuItem *); -static int install_zoneinfo(const char *zoneinfo); -static int install_zoneinfo_file(const char *zoneinfo_file); static int set_zone_multi(dialogMenuItem *); static int set_zone_whole_country(dialogMenuItem *); static int set_zone_menu(dialogMenuItem *); @@ -644,6 +649,53 @@ set_zone_utc(void) } static int +confirm_zone(const char *filename) +{ + char title[64], prompt[64]; + time_t t = time(0); + struct tm *tm; + int rv; + + setenv("TZ", filename == NULL ? "" : filename, 1); + tzset(); + tm = localtime(&t); + + snprintf(title, sizeof(title), "Confirmation"); + snprintf(prompt, sizeof(prompt), + "Does the abbreviation `%s' look reasonable?", tm->tm_zone); + rv = !dialog_yesno(title, prompt, 5, 72); + return (rv); +} + +static int +set_zone_multi(dialogMenuItem *dmi) +{ + struct zone *zp = dmi->data; + int rv; + + if (!confirm_zone(zp->filename)) + return (DITEM_FAILURE | DITEM_RECREATE); + + rv = install_zoneinfo(zp->filename); + return (rv); +} + +static int +set_zone_whole_country(dialogMenuItem *dmi) +{ + struct country *cp = dmi->data; + int rv; + + if (!confirm_zone(cp->filename)) + return (DITEM_FAILURE | DITEM_RECREATE); + + rv = install_zoneinfo(cp->filename); + return (rv); +} + +#endif + +static int install_zoneinfo_file(const char *zoneinfo_file) { char buf[1024]; @@ -672,9 +724,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Creating symbolic link %s to %s", path_localtime, zoneinfo_file); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); #endif @@ -685,9 +739,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Could not delete %s: %s", path_localtime, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); @@ -697,9 +753,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Could not delete %s: %s", path_db, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); @@ -708,9 +766,11 @@ install_zoneinfo_file(const char *zonein snprintf(title, sizeof(title), "Done"); snprintf(prompt, sizeof(prompt), "Removed %s", path_localtime); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); #endif return (DITEM_LEAVE_MENU); @@ -723,9 +783,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Could not open %s: %s", zoneinfo_file, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } @@ -734,10 +796,12 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Could not unlink %s: %s", path_localtime, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) { snprintf(title, sizeof(title), "Error"); dialog_msgbox(title, prompt, 8, 72, 1); } else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } @@ -749,9 +813,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Could not open %s: %s", path_localtime, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } @@ -765,9 +831,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Error copying %s to %s %s", zoneinfo_file, path_localtime, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); /* Better to leave none than a corrupt one. */ unlink(path_localtime); @@ -781,9 +849,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Cannot access %s: %s", zoneinfo_file, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } @@ -791,10 +861,12 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Could not unlink %s: %s", path_localtime, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) { snprintf(title, sizeof(title), "Error"); dialog_msgbox(title, prompt, 8, 72, 1); } else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } @@ -804,9 +876,11 @@ install_zoneinfo_file(const char *zonein "Cannot create symbolic link %s to %s: %s", path_localtime, zoneinfo_file, strerror(errno)); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); return (DITEM_FAILURE | DITEM_RECREATE); } @@ -822,9 +896,11 @@ install_zoneinfo_file(const char *zonein snprintf(prompt, sizeof(prompt), "Created symbolic link from %s to %s", zoneinfo_file, path_localtime); +#ifdef HAVE_DIALOG if (usedialog) dialog_msgbox(title, prompt, 8, 72, 1); else +#endif fprintf(stderr, "%s\n", prompt); #endif } /* reallydoit */ @@ -855,51 +931,6 @@ install_zoneinfo(const char *zoneinfo) return (rv); } -static int -confirm_zone(const char *filename) -{ - char title[64], prompt[64]; - time_t t = time(0); - struct tm *tm; - int rv; - - setenv("TZ", filename == NULL ? "" : filename, 1); - tzset(); - tm = localtime(&t); - - snprintf(title, sizeof(title), "Confirmation"); - snprintf(prompt, sizeof(prompt), - "Does the abbreviation `%s' look reasonable?", tm->tm_zone); - rv = !dialog_yesno(title, prompt, 5, 72); - return (rv); -} - -static int -set_zone_multi(dialogMenuItem *dmi) -{ - struct zone *zp = dmi->data; - int rv; - - if (!confirm_zone(zp->filename)) - return (DITEM_FAILURE | DITEM_RECREATE); - - rv = install_zoneinfo(zp->filename); - return (rv); -} - -static int -set_zone_whole_country(dialogMenuItem *dmi) -{ - struct country *cp = dmi->data; - int rv; - - if (!confirm_zone(cp->filename)) - return (DITEM_FAILURE | DITEM_RECREATE); - - rv = install_zoneinfo(cp->filename); - return (rv); -} - static void usage(void) { @@ -912,8 +943,11 @@ usage(void) int main(int argc, char **argv) { +#ifdef HAVE_DIALOG char title[64], prompt[128]; - int c, fd, rv, skiputc; + int fd; +#endif + int c, rv, skiputc; char vm_guest[16] = ""; size_t len = sizeof(vm_guest); @@ -934,7 +968,9 @@ main(int argc, char **argv) break; case 'r': reinstall = 1; +#ifdef HAVE_DIALOG usedialog = 0; +#endif break; case 's': skiputc = 1; @@ -998,12 +1034,15 @@ main(int argc, char **argv) struct stat sb; if (stat(argv[optind], &sb) != 0) { +#ifdef HAVE_DIALOG usedialog = 0; +#endif rv = install_zoneinfo(argv[optind]); exit(rv & ~DITEM_LEAVE_MENU); } /* FALLTHROUGH */ } +#ifdef HAVE_DIALOG read_iso3166_table(); read_zones(); @@ -1064,5 +1103,8 @@ main(int argc, char **argv) dlg_clear(); end_dialog(); +#else + usage(); +#endif return (0); } From owner-svn-src-all@freebsd.org Sat Oct 22 22:36:33 2016 Return-Path: Delivered-To: svn-src-all@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 6A24FC1DA8D; Sat, 22 Oct 2016 22:36:33 +0000 (UTC) (envelope-from grog@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 3B8458EA; Sat, 22 Oct 2016 22:36:33 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MMaW7u052339; Sat, 22 Oct 2016 22:36:32 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MMaWg7052338; Sat, 22 Oct 2016 22:36:32 GMT (envelope-from grog@FreeBSD.org) Message-Id: <201610222236.u9MMaWg7052338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Sat, 22 Oct 2016 22:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r307803 - stable/10/usr.bin/calendar/calendars X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 22:36:33 -0000 Author: grog Date: Sat Oct 22 22:36:32 2016 New Revision: 307803 URL: https://svnweb.freebsd.org/changeset/base/307803 Log: Spelling, title. Modified: stable/10/usr.bin/calendar/calendars/calendar.holiday Modified: stable/10/usr.bin/calendar/calendars/calendar.holiday ============================================================================== --- stable/10/usr.bin/calendar/calendars/calendar.holiday Sat Oct 22 22:35:39 2016 (r307802) +++ stable/10/usr.bin/calendar/calendars/calendar.holiday Sat Oct 22 22:36:32 2016 (r307803) @@ -447,7 +447,7 @@ 10/20 Kenyatta Day in Kenya 10/21 Armed Forces Day in Honduras 10/21 Revolution Days (2 days) in Somalia -10/23 Chulalongkron's Day in Thailand +10/23 King Chulalongkorn Day in Thailand 10/24 Independence Day in Zambia 10/24 United Nations Day 10/25 Taiwan Restoration Day in Taiwan From owner-svn-src-all@freebsd.org Sat Oct 22 22:52:51 2016 Return-Path: Delivered-To: svn-src-all@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 A57E6C1D36A; Sat, 22 Oct 2016 22:52:51 +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 7F8CA32B; Sat, 22 Oct 2016 22:52:51 +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 u9MMqokL059700; Sat, 22 Oct 2016 22:52:50 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MMqoDB059696; Sat, 22 Oct 2016 22:52:50 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610222252.u9MMqoDB059696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 22:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307804 - head/sys/dev/evdev X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 22:52:51 -0000 Author: gonzo Date: Sat Oct 22 22:52:50 2016 New Revision: 307804 URL: https://svnweb.freebsd.org/changeset/base/307804 Log: EVDEV: Add shortcut functions for event types Add wrappers around generic evdev_push_event for specific event types: EV_KEY/EV_REL/EV_ABS etc... Submitted by: Vladimir Kondratiev Modified: head/sys/dev/evdev/evdev.c head/sys/dev/evdev/evdev.h head/sys/dev/evdev/evdev_utils.c Modified: head/sys/dev/evdev/evdev.c ============================================================================== --- head/sys/dev/evdev/evdev.c Sat Oct 22 22:36:32 2016 (r307803) +++ head/sys/dev/evdev/evdev.c Sat Oct 22 22:52:50 2016 (r307804) @@ -822,21 +822,6 @@ push: return (ret); } -inline int -evdev_sync(struct evdev_dev *evdev) -{ - - return (evdev_push_event(evdev, EV_SYN, SYN_REPORT, 1)); -} - - -inline int -evdev_mt_sync(struct evdev_dev *evdev) -{ - - return (evdev_push_event(evdev, EV_SYN, SYN_MT_REPORT, 1)); -} - int evdev_register_client(struct evdev_dev *evdev, struct evdev_client *client) { Modified: head/sys/dev/evdev/evdev.h ============================================================================== --- head/sys/dev/evdev/evdev.h Sat Oct 22 22:36:32 2016 (r307803) +++ head/sys/dev/evdev/evdev.h Sat Oct 22 22:52:50 2016 (r307804) @@ -97,8 +97,6 @@ int evdev_register(struct evdev_dev *); int evdev_register_mtx(struct evdev_dev *, struct mtx *); int evdev_unregister(struct evdev_dev *); int evdev_push_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); -int evdev_sync(struct evdev_dev *); -int evdev_mt_sync(struct evdev_dev *); void evdev_support_prop(struct evdev_dev *, uint16_t); void evdev_support_event(struct evdev_dev *, uint16_t); void evdev_support_key(struct evdev_dev *, uint16_t); @@ -129,4 +127,68 @@ void evdev_push_leds(struct evdev_dev *, void evdev_push_repeats(struct evdev_dev *, keyboard_t *); evdev_event_t evdev_ev_kbd_event; +/* Event reporting shortcuts: */ +static __inline int +evdev_sync(struct evdev_dev *evdev) +{ + + return (evdev_push_event(evdev, EV_SYN, SYN_REPORT, 1)); +} + +static __inline int +evdev_mt_sync(struct evdev_dev *evdev) +{ + + return (evdev_push_event(evdev, EV_SYN, SYN_MT_REPORT, 1)); +} + +static __inline int +evdev_push_key(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_KEY, code, value != 0)); +} + +static __inline int +evdev_push_rel(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_REL, code, value)); +} + +static __inline int +evdev_push_abs(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_ABS, code, value)); +} + +static __inline int +evdev_push_msc(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_MSC, code, value)); +} + +static __inline int +evdev_push_led(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_LED, code, value != 0)); +} + +static __inline int +evdev_push_snd(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_SND, code, value != 0)); +} + +static __inline int +evdev_push_sw(struct evdev_dev *evdev, uint16_t code, int32_t value) +{ + + return (evdev_push_event(evdev, EV_SW, code, value != 0)); +} + #endif /* _DEV_EVDEV_EVDEV_H */ Modified: head/sys/dev/evdev/evdev_utils.c ============================================================================== --- head/sys/dev/evdev/evdev_utils.c Sat Oct 22 22:36:32 2016 (r307803) +++ head/sys/dev/evdev/evdev_utils.c Sat Oct 22 22:52:50 2016 (r307804) @@ -271,8 +271,8 @@ evdev_push_mouse_btn(struct evdev_dev *e size_t i; for (i = 0; i < nitems(evdev_mouse_button_codes); i++) - evdev_push_event(evdev, EV_KEY, evdev_mouse_button_codes[i], - (buttons & (1 << i)) != 0); + evdev_push_key(evdev, evdev_mouse_button_codes[i], + buttons & (1 << i)); } void @@ -285,8 +285,7 @@ evdev_push_leds(struct evdev_dev *evdev, return; for (i = 0; i < nitems(evdev_led_codes); i++) - evdev_push_event(evdev, EV_LED, evdev_led_codes[i], - (leds & (1 << i)) != 0); + evdev_push_led(evdev, evdev_led_codes[i], leds & (1 << i)); } void From owner-svn-src-all@freebsd.org Sat Oct 22 22:55:11 2016 Return-Path: Delivered-To: svn-src-all@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 A3604C1D41A; Sat, 22 Oct 2016 22:55:11 +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 7EA0E6E6; Sat, 22 Oct 2016 22:55:11 +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 u9MMtAgR059844; Sat, 22 Oct 2016 22:55:10 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MMtA0p059843; Sat, 22 Oct 2016 22:55:10 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201610222255.u9MMtA0p059843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 22 Oct 2016 22:55:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307805 - head/sys/dev/usb/input X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 22:55:11 -0000 Author: gonzo Date: Sat Oct 22 22:55:10 2016 New Revision: 307805 URL: https://svnweb.freebsd.org/changeset/base/307805 Log: EVDEV: ums evdev support improvements: locking and event reporting - Use ums lock as evdev lock - Do not cap axes values to sysmouse limits for evdev reports - Do not map T-axis events to buttons for evdev reports - Use shortcuts for event reporting Submitted by: Vladimir Kondratiev MFC after: 1 week Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Sat Oct 22 22:52:50 2016 (r307804) +++ head/sys/dev/usb/input/ums.c Sat Oct 22 22:55:10 2016 (r307805) @@ -173,6 +173,8 @@ static usb_fifo_ioctl_t ums_fifo_ioctl; #ifdef EVDEV_SUPPORT static evdev_open_t ums_ev_open; static evdev_close_t ums_ev_close; +static void ums_evdev_push(struct ums_softc *, int32_t, int32_t, + int32_t, int32_t, int32_t); #endif static void ums_start_rx(struct ums_softc *); @@ -205,6 +207,9 @@ ums_put_queue_timeout(void *__sc) mtx_assert(&sc->sc_mtx, MA_OWNED); ums_put_queue(sc, 0, 0, 0, 0, 0); +#ifdef EVDEV_SUPPORT + ums_evdev_push(sc, 0, 0, 0, 0, 0); +#endif } static void @@ -216,6 +221,9 @@ ums_intr_callback(struct usb_xfer *xfer, uint8_t *buf = sc->sc_temp; int32_t buttons = 0; int32_t buttons_found = 0; +#ifdef EVDEV_SUPPORT + int32_t buttons_reported = 0; +#endif int32_t dw = 0; int32_t dx = 0; int32_t dy = 0; @@ -306,6 +314,9 @@ ums_intr_callback(struct usb_xfer *xfer, if (++info != &sc->sc_info[UMS_INFO_MAX]) goto repeat; +#ifdef EVDEV_SUPPORT + buttons_reported = buttons; +#endif /* keep old button value(s) for non-detected buttons */ buttons |= sc->sc_status.button & ~buttons_found; @@ -351,6 +362,11 @@ ums_intr_callback(struct usb_xfer *xfer, usb_callout_stop(&sc->sc_callout); ums_put_queue(sc, dx, dy, dz, dt, buttons); +#ifdef EVDEV_SUPPORT + ums_evdev_push(sc, dx, dy, dz, dt, + buttons_reported); +#endif + } } case USB_ST_SETUP: @@ -720,7 +736,7 @@ ums_attach(device_t dev) for (i = 0; i < info->sc_buttons; i++) evdev_support_key(sc->sc_evdev, BTN_MOUSE + i); - err = evdev_register(sc->sc_evdev); + err = evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx); if (err) goto detach; #endif @@ -891,27 +907,32 @@ ums_put_queue(struct ums_softc *sc, int3 } usb_fifo_put_data_linear(sc->sc_fifo.fp[USB_FIFO_RX], buf, sc->sc_mode.packetsize, 1); - -#ifdef EVDEV_SUPPORT - if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { - /* Push evdev event */ - evdev_push_event(sc->sc_evdev, EV_REL, REL_X, dx); - evdev_push_event(sc->sc_evdev, EV_REL, REL_Y, -dy); - evdev_push_event(sc->sc_evdev, EV_REL, REL_WHEEL, -dz); - evdev_push_event(sc->sc_evdev, EV_REL, REL_HWHEEL, dt); - evdev_push_mouse_btn(sc->sc_evdev, - (buttons & ~MOUSE_STDBUTTONS) | - (buttons & (1 << 2) ? MOUSE_BUTTON1DOWN : 0) | - (buttons & (1 << 1) ? MOUSE_BUTTON2DOWN : 0) | - (buttons & (1 << 0) ? MOUSE_BUTTON3DOWN : 0)); - evdev_sync(sc->sc_evdev); - } -#endif } else { DPRINTF("Buffer full, discarded packet\n"); } } +#ifdef EVDEV_SUPPORT +static void +ums_evdev_push(struct ums_softc *sc, int32_t dx, int32_t dy, + int32_t dz, int32_t dt, int32_t buttons) +{ + if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { + /* Push evdev event */ + evdev_push_rel(sc->sc_evdev, REL_X, dx); + evdev_push_rel(sc->sc_evdev, REL_Y, -dy); + evdev_push_rel(sc->sc_evdev, REL_WHEEL, -dz); + evdev_push_rel(sc->sc_evdev, REL_HWHEEL, dt); + evdev_push_mouse_btn(sc->sc_evdev, + (buttons & ~MOUSE_STDBUTTONS) | + (buttons & (1 << 2) ? MOUSE_BUTTON1DOWN : 0) | + (buttons & (1 << 1) ? MOUSE_BUTTON2DOWN : 0) | + (buttons & (1 << 0) ? MOUSE_BUTTON3DOWN : 0)); + evdev_sync(sc->sc_evdev); + } +} +#endif + static void ums_reset_buf(struct ums_softc *sc) { @@ -925,7 +946,7 @@ ums_ev_open(struct evdev_dev *evdev, voi { struct ums_softc *sc = (struct ums_softc *)ev_softc; - mtx_lock(&sc->sc_mtx); + mtx_assert(&sc->sc_mtx, MA_OWNED); sc->sc_evflags = UMS_EVDEV_OPENED; @@ -934,8 +955,6 @@ ums_ev_open(struct evdev_dev *evdev, voi ums_start_rx(sc); } - mtx_unlock(&sc->sc_mtx); - return (0); } @@ -944,14 +963,12 @@ ums_ev_close(struct evdev_dev *evdev, vo { struct ums_softc *sc = (struct ums_softc *)ev_softc; - mtx_lock(&sc->sc_mtx); + mtx_assert(&sc->sc_mtx, MA_OWNED); sc->sc_evflags = 0; if (sc->sc_fflags == 0) ums_stop_rx(sc); - - mtx_unlock(&sc->sc_mtx); } #endif From owner-svn-src-all@freebsd.org Sat Oct 22 23:05:45 2016 Return-Path: Delivered-To: svn-src-all@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 B21F7C1D670; Sat, 22 Oct 2016 23:05:45 +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 816A9B9B; Sat, 22 Oct 2016 23:05:45 +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 u9MN5isb063638; Sat, 22 Oct 2016 23:05:44 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MN5iwa063637; Sat, 22 Oct 2016 23:05:44 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222305.u9MN5iwa063637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 23:05:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307806 - head/share/doc/psd/contents X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 23:05:45 -0000 Author: bapt Date: Sat Oct 22 23:05:44 2016 New Revision: 307806 URL: https://svnweb.freebsd.org/changeset/base/307806 Log: Remove RCS entry from PSD content file, it is gone along with GNU RCS Modified: head/share/doc/psd/contents/contents.ms Modified: head/share/doc/psd/contents/contents.ms ============================================================================== --- head/share/doc/psd/contents/contents.ms Sat Oct 22 22:55:10 2016 (r307805) +++ head/share/doc/psd/contents/contents.ms Sat Oct 22 23:05:44 2016 (r307806) @@ -145,17 +145,6 @@ Indispensable tool for making sure large compiled with minimal effort. .sp .IP -.tl 'An Introduction to the Revision Control System''PSD:13' -.if \n(.U \{\ -.br -.>> 13.rcs/paper.html -.\} -.QP -RCS is a user-contributed tool for working together with other people -without stepping on each other's toes. -An alternative to \fIsccs\fR for controlling software changes. -.sp -.IP .tl 'An Introduction to the Source Code Control System''PSD:14' .QP A useful introductory article for those users with From owner-svn-src-all@freebsd.org Sat Oct 22 23:09:07 2016 Return-Path: Delivered-To: svn-src-all@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 E3765C1D6F3; Sat, 22 Oct 2016 23:09:07 +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 AF7C3D27; Sat, 22 Oct 2016 23:09:07 +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 u9MN96fL063786; Sat, 22 Oct 2016 23:09:06 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MN96Ob063785; Sat, 22 Oct 2016 23:09:06 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222309.u9MN96Ob063785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 23:09:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307807 - head/share/doc/psd/title X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 23:09:08 -0000 Author: bapt Date: Sat Oct 22 23:09:06 2016 New Revision: 307807 URL: https://svnweb.freebsd.org/changeset/base/307807 Log: Remove reference to RCS from PSD titles Modified: head/share/doc/psd/title/Title Modified: head/share/doc/psd/title/Title ============================================================================== --- head/share/doc/psd/title/Title Sat Oct 22 23:05:44 2016 (r307806) +++ head/share/doc/psd/title/Title Sat Oct 22 23:09:06 2016 (r307807) @@ -117,12 +117,6 @@ Permission is granted to make and distri this document provided the copyright notice and this permission notice are preserved on all copies. .sp 2 -Document PSD:13 is part of the user contributed software and is -copyright 1983 by Walter F. Tichy. -Permission to copy the RCS documentation or any portion thereof as -necessary for licensed use of the software is granted to licensees -of this software, provided this copyright notice is included. -.sp 2 The views and conclusions contained in this manual are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the Regents of the University of California. From owner-svn-src-all@freebsd.org Sat Oct 22 23:49:08 2016 Return-Path: Delivered-To: svn-src-all@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 50450C1DF75; Sat, 22 Oct 2016 23:49:08 +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 068F2E9C; Sat, 22 Oct 2016 23:49:07 +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 u9MNn7QR078957; Sat, 22 Oct 2016 23:49:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MNn7g6078956; Sat, 22 Oct 2016 23:49:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201610222349.u9MNn7g6078956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 22 Oct 2016 23:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307808 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 23:49:08 -0000 Author: emaste Date: Sat Oct 22 23:49:06 2016 New Revision: 307808 URL: https://svnweb.freebsd.org/changeset/base/307808 Log: elfcopy: select mode by the end of the program name The mode of operation (elfcopy, mcs, or strip) is chosen based on the program name. Broaden this to allow a substring match at the end of the name to allow prefixes - for example, bsdstrip or aarch64-freebsd-strip. This improves use of these tools as drop-in replacements for GNU objcopy and strip, which are often built with a limited set of supported targets and installed with a target prefix for cross tools. Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1663 Modified: head/contrib/elftoolchain/elfcopy/main.c Modified: head/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/main.c Sat Oct 22 23:09:06 2016 (r307807) +++ head/contrib/elftoolchain/elfcopy/main.c Sat Oct 22 23:49:06 2016 (r307808) @@ -1529,6 +1529,22 @@ print_version(void) exit(EXIT_SUCCESS); } +/* + * Compare the ending of s with end. + */ +static int +strrcmp(const char *s, const char *end) +{ + size_t endlen, slen; + + slen = strlen(s); + endlen = strlen(end); + + if (slen >= endlen) + s += slen - endlen; + return (strcmp(s, end)); +} + int main(int argc, char **argv) { @@ -1562,12 +1578,16 @@ main(int argc, char **argv) if ((ecp->progname = ELFTC_GETPROGNAME()) == NULL) ecp->progname = "elfcopy"; - if (strcmp(ecp->progname, "strip") == 0) + if (strrcmp(ecp->progname, "strip") == 0) strip_main(ecp, argc, argv); - else if (strcmp(ecp->progname, "mcs") == 0) + else if (strrcmp(ecp->progname, "mcs") == 0) mcs_main(ecp, argc, argv); - else + else { + if (strrcmp(ecp->progname, "elfcopy") != 0 && + strrcmp(ecp->progname, "objcopy") != 0) + warnx("program mode not known, defaulting to elfcopy"); elfcopy_main(ecp, argc, argv); + } free_sec_add(ecp); free_sec_act(ecp);