From owner-svn-src-stable@freebsd.org Sun Jul 30 08:00:56 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A9E2DB1938; Sun, 30 Jul 2017 08:00:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB976691B8; Sun, 30 Jul 2017 08:00:55 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6U80skS023131; Sun, 30 Jul 2017 08:00:54 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6U80sOI023130; Sun, 30 Jul 2017 08:00:54 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707300800.v6U80sOI023130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 30 Jul 2017 08:00: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: r321715 - stable/11/sys/fs/fdescfs X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/fs/fdescfs X-SVN-Commit-Revision: 321715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 08:00:56 -0000 Author: dchagin Date: Sun Jul 30 08:00:54 2017 New Revision: 321715 URL: https://svnweb.freebsd.org/changeset/base/321715 Log: MFC r320836: Eliminate bogus casts. Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 06:53:58 2017 (r321714) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 08:00:54 2017 (r321715) @@ -162,7 +162,7 @@ loop: * If a forced unmount is progressing, we need to drop it. The flags are * protected by the hashmtx. */ - fmp = (struct fdescmount *)mp->mnt_data; + fmp = mp->mnt_data; if (fmp == NULL || fmp->flags & FMNT_UNMOUNTF) { mtx_unlock(&fdesc_hashmtx); return (-1); @@ -207,7 +207,7 @@ loop: * If a forced unmount is progressing, we need to drop it. The flags are * protected by the hashmtx. */ - fmp = (struct fdescmount *)mp->mnt_data; + fmp = mp->mnt_data; if (fmp == NULL || fmp->flags & FMNT_UNMOUNTF) { mtx_unlock(&fdesc_hashmtx); vgone(vp); From owner-svn-src-stable@freebsd.org Sun Jul 30 08:02:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D982DB1B1F; Sun, 30 Jul 2017 08:02:08 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F07F369491; Sun, 30 Jul 2017 08:02:07 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6U827Wh027049; Sun, 30 Jul 2017 08:02:07 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6U8278X027048; Sun, 30 Jul 2017 08:02:07 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201707300802.v6U8278X027048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 30 Jul 2017 08:02: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: r321716 - stable/11/sys/fs/fdescfs X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/fs/fdescfs X-SVN-Commit-Revision: 321716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 08:02:08 -0000 Author: dchagin Date: Sun Jul 30 08:02:06 2017 New Revision: 321716 URL: https://svnweb.freebsd.org/changeset/base/321716 Log: MFC r320837: Style(9). Whitespace. Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 08:00:54 2017 (r321715) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 08:02:06 2017 (r321716) @@ -358,7 +358,7 @@ fdesc_lookup(struct vop_lookup_args *ap) error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, LK_EXCLUSIVE, &fvp); } - + if (error) goto bad; *vpp = fvp; From owner-svn-src-stable@freebsd.org Sun Jul 30 10:36:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A8B2DB3EA6; Sun, 30 Jul 2017 10:36:22 +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 4A5756C5C7; Sun, 30 Jul 2017 10:36:22 +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 v6UAaLQE087544; Sun, 30 Jul 2017 10:36:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6UAaKOf087535; Sun, 30 Jul 2017 10:36:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707301036.v6UAaKOf087535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 30 Jul 2017 10:36: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: r321717 - in stable/10: lib/libc/sys sys/sys sys/vm X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/10: lib/libc/sys sys/sys sys/vm X-SVN-Commit-Revision: 321717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 10:36:22 -0000 Author: kib Date: Sun Jul 30 10:36:20 2017 New Revision: 321717 URL: https://svnweb.freebsd.org/changeset/base/321717 Log: Merge MAP_GUARD. MFC r316687 (by markj), r320314, r320317, r320338, r320339, r320344, r320430, r320560 (by alc), r320801, r320843, r321173, r321230. Tested by: pho Sponsored by: The FreeBSD Foundation Modified: stable/10/lib/libc/sys/mmap.2 stable/10/lib/libc/sys/munmap.2 stable/10/sys/sys/mman.h stable/10/sys/sys/param.h stable/10/sys/vm/vm.h stable/10/sys/vm/vm_fault.c stable/10/sys/vm/vm_map.c stable/10/sys/vm/vm_map.h stable/10/sys/vm/vm_mmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/mmap.2 ============================================================================== --- stable/10/lib/libc/sys/mmap.2 Sun Jul 30 08:02:06 2017 (r321716) +++ stable/10/lib/libc/sys/mmap.2 Sun Jul 30 10:36:20 2017 (r321717) @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd September 17, 2014 +.Dd June 22, 2017 .Dt MMAP 2 .Os .Sh NAME @@ -173,9 +173,21 @@ In contrast, if .Dv MAP_EXCL is specified, the request will fail if a mapping already exists within the range. -.It Dv MAP_HASSEMAPHORE -Notify the kernel that the region may contain semaphores and that special -handling may be necessary. +.It Dv MAP_GUARD +Instead of a mapping, create a guard of the specified size. +Guards allow a process to create reservations in its address space, +which can later be replaced by actual mappings. +.Pp +.Fa mmap +will not create mappings in the address range of a guard unless +the request specifies +.Dv MAP_FIXED . +Guards can be destroyed with +.Xr munmap 2 . +Any memory access by a thread to the guarded range results +in the delivery of a +.Dv SIGSEGV +signal to that thread. .It Dv MAP_NOCORE Region is not included in a core file. .It Dv MAP_NOSYNC @@ -278,6 +290,7 @@ must include at least .Dv PROT_READ and .Dv PROT_WRITE . +.Pp This option creates a memory region that grows to at most .Fa len @@ -288,6 +301,12 @@ stack top is the starting address returned by the call bytes. The bottom of the stack at maximum growth is the starting address returned by the call. +.Pp +Stacks created with +.Dv MAP_STACK +automatically grow. +Guards prevent inadvertent use of the regions into which those +stacks can grow without requiring mapping the whole stack in advance. .El .Pp The @@ -375,6 +394,7 @@ were specified. .It Bq Er EINVAL None of .Dv MAP_ANON , +.Dv MAP_GUARD , .Dv MAP_PRIVATE , .Dv MAP_SHARED , or @@ -424,6 +444,25 @@ were specified, but the requested region is already us was specified, but .Dv MAP_FIXED was not. +.It Bq Er EINVAL +.Dv MAP_GUARD +was specified, but the +.Fa offset +argument was not zero, the +.Fa fd +argument was not -1, or the +.Fa prot +argument was not +.Dv PROT_NONE . +.It Bq Er EINVAL +.Dv MAP_GUARD +was specified together with one of the flags +.Dv MAP_ANON , +.Dv MAP_PREFAULT , +.Dv MAP_PREFAULT_READ , +.Dv MAP_PRIVATE , +.Dv MAP_SHARED , +.Dv MAP_STACK . .It Bq Er ENODEV .Dv MAP_ANON has not been specified and Modified: stable/10/lib/libc/sys/munmap.2 ============================================================================== --- stable/10/lib/libc/sys/munmap.2 Sun Jul 30 08:02:06 2017 (r321716) +++ stable/10/lib/libc/sys/munmap.2 Sun Jul 30 10:36:20 2017 (r321717) @@ -28,7 +28,7 @@ .\" @(#)munmap.2 8.3 (Berkeley) 5/27/94 .\" $FreeBSD$ .\" -.Dd May 27, 1994 +.Dd June 22, 2017 .Dt MUNMAP 2 .Os .Sh NAME @@ -44,7 +44,7 @@ The .Fn munmap system call -deletes the mappings for the specified address range, +deletes the mappings and guards for the specified address range, and causes further references to addresses within the range to generate invalid memory references. .Sh RETURN VALUES Modified: stable/10/sys/sys/mman.h ============================================================================== --- stable/10/sys/sys/mman.h Sun Jul 30 08:02:06 2017 (r321716) +++ stable/10/sys/sys/mman.h Sun Jul 30 10:36:20 2017 (r321717) @@ -90,6 +90,7 @@ /* * Extended flags */ +#define MAP_GUARD 0x00002000 /* reserve but don't map address range */ #define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */ #define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */ #define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */ Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Sun Jul 30 08:02:06 2017 (r321716) +++ stable/10/sys/sys/param.h Sun Jul 30 10:36:20 2017 (r321717) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1003515 /* Master, propagated to newvers */ +#define __FreeBSD_version 1003516 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, @@ -76,10 +76,11 @@ #undef __FreeBSD_kernel__ #define __FreeBSD_kernel__ -#ifdef _KERNEL +#if defined(_KERNEL) || defined(IN_RTLD) #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 #define P_OSREL_MAP_ANON 800104 +#define P_OSREL_MAP_GUARD 1200035 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif Modified: stable/10/sys/vm/vm.h ============================================================================== --- stable/10/sys/vm/vm.h Sun Jul 30 08:02:06 2017 (r321716) +++ stable/10/sys/vm/vm.h Sun Jul 30 10:36:20 2017 (r321717) @@ -78,6 +78,7 @@ typedef u_char vm_prot_t; /* protection codes */ #define VM_PROT_WRITE ((vm_prot_t) 0x02) #define VM_PROT_EXECUTE ((vm_prot_t) 0x04) #define VM_PROT_COPY ((vm_prot_t) 0x08) /* copy-on-read */ +#define VM_PROT_FAULT_LOOKUP ((vm_prot_t) 0x010) #define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE) #define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Sun Jul 30 08:02:06 2017 (r321716) +++ stable/10/sys/vm/vm_fault.c Sun Jul 30 10:36:20 2017 (r321717) @@ -336,7 +336,7 @@ vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot vm_prot_t prot; long ahead, behind; int alloc_req, era, faultcount, nera, reqpage, result; - boolean_t dead, growstack, is_first_object_locked, wired; + boolean_t dead, is_first_object_locked, wired; vm_object_t next_object; vm_page_t marray[VM_FAULT_READ_MAX]; int hardfault; @@ -345,7 +345,6 @@ vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot int locked, error; hardfault = 0; - growstack = TRUE; PCPU_INC(cnt.v_vm_faults); fs.vp = NULL; faultcount = reqpage = 0; @@ -357,17 +356,10 @@ RetryFault:; * search. */ fs.map = map; - result = vm_map_lookup(&fs.map, vaddr, fault_type, &fs.entry, - &fs.first_object, &fs.first_pindex, &prot, &wired); + result = vm_map_lookup(&fs.map, vaddr, fault_type | + VM_PROT_FAULT_LOOKUP, &fs.entry, &fs.first_object, + &fs.first_pindex, &prot, &wired); if (result != KERN_SUCCESS) { - if (growstack && result == KERN_INVALID_ADDRESS && - map != kernel_map) { - result = vm_map_growstack(curproc, vaddr); - if (result != KERN_SUCCESS) - return (KERN_FAILURE); - growstack = FALSE; - goto RetryFault; - } unlock_vp(&fs); return (result); } @@ -392,6 +384,8 @@ RetryFault:; vm_map_unlock(fs.map); goto RetryFault; } + + MPASS((fs.entry->eflags & MAP_ENTRY_GUARD) == 0); if (wired) fault_type = prot | (fault_type & VM_PROT_COPY); Modified: stable/10/sys/vm/vm_map.c ============================================================================== --- stable/10/sys/vm/vm_map.c Sun Jul 30 08:02:06 2017 (r321716) +++ stable/10/sys/vm/vm_map.c Sun Jul 30 10:36:20 2017 (r321717) @@ -133,6 +133,8 @@ static void _vm_map_init(vm_map_t map, pmap_t pmap, vm static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t system_map); static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry); static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry); +static int vm_map_growstack(vm_map_t map, vm_offset_t addr, + vm_map_entry_t gap_entry); #ifdef INVARIANTS static void vm_map_zdtor(void *mem, int size, void *arg); static void vmspace_zdtor(void *mem, int size, void *arg); @@ -1167,6 +1169,10 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof if (prev_entry->next != &map->header && prev_entry->next->start < end) return (KERN_NO_SPACE); + if ((cow & MAP_CREATE_GUARD) != 0 && (object != NULL || + max != VM_PROT_NONE)) + return (KERN_INVALID_ARGUMENT); + protoeflags = 0; if (cow & MAP_COPY_ON_WRITE) protoeflags |= MAP_ENTRY_COW | MAP_ENTRY_NEEDS_COPY; @@ -1182,13 +1188,19 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof protoeflags |= MAP_ENTRY_GROWS_UP; if (cow & MAP_VN_WRITECOUNT) protoeflags |= MAP_ENTRY_VN_WRITECNT; + if ((cow & MAP_CREATE_GUARD) != 0) + protoeflags |= MAP_ENTRY_GUARD; + if ((cow & MAP_CREATE_STACK_GAP_DN) != 0) + protoeflags |= MAP_ENTRY_STACK_GAP_DN; + if ((cow & MAP_CREATE_STACK_GAP_UP) != 0) + protoeflags |= MAP_ENTRY_STACK_GAP_UP; if (cow & MAP_INHERIT_SHARE) inheritance = VM_INHERIT_SHARE; else inheritance = VM_INHERIT_DEFAULT; cred = NULL; - if (cow & (MAP_ACC_NO_CHARGE | MAP_NOFAULT)) + if ((cow & (MAP_ACC_NO_CHARGE | MAP_NOFAULT | MAP_CREATE_GUARD)) != 0) goto charged; if ((cow & MAP_ACC_CHARGED) || ((prot & VM_PROT_WRITE) && ((protoeflags & MAP_ENTRY_NEEDS_COPY) || object == NULL))) { @@ -1237,7 +1249,8 @@ charged: if (prev_entry->inheritance == inheritance && prev_entry->protection == prot && prev_entry->max_protection == max) { - map->size += end - prev_entry->end; + if ((prev_entry->eflags & MAP_ENTRY_GUARD) == 0) + map->size += end - prev_entry->end; prev_entry->end = end; vm_map_entry_resize_free(map, prev_entry); vm_map_simplify_entry(map, prev_entry); @@ -1274,7 +1287,6 @@ charged: new_entry->eflags = protoeflags; new_entry->object.vm_object = object; new_entry->offset = offset; - new_entry->avail_ssize = 0; new_entry->inheritance = inheritance; new_entry->protection = prot; @@ -1292,7 +1304,8 @@ charged: * Insert the new entry into the list */ vm_map_entry_link(map, prev_entry, new_entry); - map->size += new_entry->end - new_entry->start; + if ((new_entry->eflags & MAP_ENTRY_GUARD) == 0) + map->size += new_entry->end - new_entry->start; /* * Try to coalesce the new entry with both the previous and next @@ -1496,6 +1509,25 @@ again: return (result); } +int +vm_map_find_min(vm_map_t map, vm_object_t object, vm_ooffset_t offset, + vm_offset_t *addr, vm_size_t length, vm_offset_t min_addr, + vm_offset_t max_addr, int find_space, vm_prot_t prot, vm_prot_t max, + int cow) +{ + vm_offset_t hint; + int rv; + + hint = *addr; + for (;;) { + rv = vm_map_find(map, object, offset, addr, length, max_addr, + find_space, prot, max, cow); + if (rv == KERN_SUCCESS || min_addr >= hint) + return (rv); + *addr = hint = min_addr; + } +} + /* * vm_map_simplify_entry: * @@ -1625,7 +1657,8 @@ _vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, * map. This is a bit of a hack, but is also about the best place to * put this improvement. */ - if (entry->object.vm_object == NULL && !map->system_map) { + if (entry->object.vm_object == NULL && !map->system_map && + (entry->eflags & MAP_ENTRY_GUARD) == 0) { vm_object_t object; object = vm_object_allocate(OBJT_DEFAULT, atop(entry->end - entry->start)); @@ -1702,7 +1735,8 @@ _vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, v * map. This is a bit of a hack, but is also about the best place to * put this improvement. */ - if (entry->object.vm_object == NULL && !map->system_map) { + if (entry->object.vm_object == NULL && !map->system_map && + (entry->eflags & MAP_ENTRY_GUARD) == 0) { vm_object_t object; object = vm_object_allocate(OBJT_DEFAULT, atop(entry->end - entry->start)); @@ -1929,8 +1963,10 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off /* * Make a first pass to check for protection violations. */ - current = entry; - while ((current != &map->header) && (current->start < end)) { + for (current = entry; current != &map->header && current->start < end; + current = current->next) { + if ((current->eflags & MAP_ENTRY_GUARD) != 0) + continue; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { vm_map_unlock(map); return (KERN_INVALID_ARGUMENT); @@ -1939,23 +1975,22 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off vm_map_unlock(map); return (KERN_PROTECTION_FAILURE); } - current = current->next; } - /* * Do an accounting pass for private read-only mappings that * now will do cow due to allowed write (e.g. debugger sets * breakpoint on text segment) */ - for (current = entry; (current != &map->header) && - (current->start < end); current = current->next) { + for (current = entry; current != &map->header && current->start < end; + current = current->next) { vm_map_clip_end(map, current, end); if (set_max || ((new_prot & ~(current->protection)) & VM_PROT_WRITE) == 0 || - ENTRY_CHARGED(current)) { + ENTRY_CHARGED(current) || + (current->eflags & MAP_ENTRY_GUARD) != 0) { continue; } @@ -2002,8 +2037,11 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off * Go back and fix up protections. [Note that clipping is not * necessary the second time.] */ - current = entry; - while ((current != &map->header) && (current->start < end)) { + for (current = entry; current != &map->header && current->start < end; + current = current->next) { + if ((current->eflags & MAP_ENTRY_GUARD) != 0) + continue; + old_prot = current->protection; if (set_max) @@ -2037,7 +2075,6 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off #undef MASK } vm_map_simplify_entry(map, current); - current = current->next; } vm_map_unlock(map); return (KERN_SUCCESS); @@ -2258,7 +2295,9 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off entry = temp_entry->next; while ((entry != &map->header) && (entry->start < end)) { vm_map_clip_end(map, entry, end); - entry->inheritance = new_inheritance; + if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || + new_inheritance != VM_INHERIT_ZERO) + entry->inheritance = new_inheritance; vm_map_simplify_entry(map, entry); entry = entry->next; } @@ -2864,6 +2903,15 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry vm_map_entry_unlink(map, entry); object = entry->object.vm_object; + + if ((entry->eflags & MAP_ENTRY_GUARD) != 0) { + MPASS(entry->cred == NULL); + MPASS((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0); + MPASS(object == NULL); + vm_map_entry_deallocate(entry, map->system_map); + return; + } + size = entry->end - entry->start; map->size -= size; @@ -3222,6 +3270,8 @@ vmspace_map_entry_forked(const struct vmspace *vm1, st vm_size_t entrysize; vm_offset_t newend; + if ((entry->eflags & MAP_ENTRY_GUARD) != 0) + return; entrysize = entry->end - entry->start; vm2->vm_map.size += entrysize; if (entry->eflags & (MAP_ENTRY_GROWS_DOWN | MAP_ENTRY_GROWS_UP)) { @@ -3258,6 +3308,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c vm_map_entry_t new_entry, old_entry; vm_object_t object; int locked; + vm_inherit_t inh; old_map = &vm1->vm_map; /* Copy immutable fields of vm1 to vm2. */ @@ -3280,7 +3331,12 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c if (old_entry->eflags & MAP_ENTRY_IS_SUB_MAP) panic("vm_map_fork: encountered a submap"); - switch (old_entry->inheritance) { + inh = old_entry->inheritance; + if ((old_entry->eflags & MAP_ENTRY_GUARD) != 0 && + inh != VM_INHERIT_NONE) + inh = VM_INHERIT_COPY; + + switch (inh) { case VM_INHERIT_NONE: break; @@ -3413,7 +3469,6 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c new_entry->start = old_entry->start; new_entry->end = old_entry->end; - new_entry->avail_ssize = old_entry->avail_ssize; new_entry->eflags = old_entry->eflags & ~(MAP_ENTRY_USER_WIRED | MAP_ENTRY_IN_TRANSITION | MAP_ENTRY_VN_WRITECNT); @@ -3476,30 +3531,40 @@ out: return (rv); } +static int stack_guard_page = 1; +SYSCTL_INT(_security_bsd, OID_AUTO, stack_guard_page, CTLFLAG_RWTUN, + &stack_guard_page, 0, + "Specifies the number of guard pages for a stack that grows"); + static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, vm_prot_t max, int cow) { vm_map_entry_t new_entry, prev_entry; - vm_offset_t bot, top; - vm_size_t init_ssize; + vm_offset_t bot, gap_bot, gap_top, top; + vm_size_t init_ssize, sgp; int orient, rv; /* * The stack orientation is piggybacked with the cow argument. * Extract it into orient and mask the cow argument so that we * don't pass it around further. - * NOTE: We explicitly allow bi-directional stacks. */ - orient = cow & (MAP_STACK_GROWS_DOWN|MAP_STACK_GROWS_UP); + orient = cow & (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP); KASSERT(orient != 0, ("No stack grow direction")); + KASSERT(orient != (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP), + ("bi-dir stack")); + sgp = (vm_size_t)stack_guard_page * PAGE_SIZE; if (addrbos < vm_map_min(map) || addrbos > vm_map_max(map) || - addrbos + max_ssize < addrbos) + addrbos + max_ssize < addrbos || + sgp >= max_ssize) return (KERN_NO_SPACE); - init_ssize = (max_ssize < growsize) ? max_ssize : growsize; + init_ssize = growsize; + if (max_ssize < init_ssize + sgp) + init_ssize = max_ssize - sgp; /* If addr is already mapped, no go */ if (vm_map_lookup_entry(map, addrbos, &prev_entry)) @@ -3507,12 +3572,6 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, /* * If we can't accomodate max_ssize in the current mapping, no go. - * However, we need to be aware that subsequent user mappings might - * map into the space we have reserved for stack, and currently this - * space is not protected. - * - * Hopefully we will at least detect this condition when we try to - * grow the stack. */ if ((prev_entry->next != &map->header) && (prev_entry->next->start < addrbos + max_ssize)) @@ -3528,58 +3587,53 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, * and cow to be 0. Possibly we should eliminate these as input * parameters, and just pass these values here in the insert call. */ - if (orient == MAP_STACK_GROWS_DOWN) + if (orient == MAP_STACK_GROWS_DOWN) { bot = addrbos + max_ssize - init_ssize; - else if (orient == MAP_STACK_GROWS_UP) + top = bot + init_ssize; + gap_bot = addrbos; + gap_top = bot; + } else /* if (orient == MAP_STACK_GROWS_UP) */ { bot = addrbos; - else - bot = round_page(addrbos + max_ssize/2 - init_ssize/2); - top = bot + init_ssize; - rv = vm_map_insert(map, NULL, 0, bot, top, prot, max, cow); - - /* Now set the avail_ssize amount. */ - if (rv == KERN_SUCCESS) { - new_entry = prev_entry->next; - if (new_entry->end != top || new_entry->start != bot) - panic("Bad entry start/end for new stack entry"); - - new_entry->avail_ssize = max_ssize - init_ssize; - KASSERT((orient & MAP_STACK_GROWS_DOWN) == 0 || - (new_entry->eflags & MAP_ENTRY_GROWS_DOWN) != 0, - ("new entry lacks MAP_ENTRY_GROWS_DOWN")); - KASSERT((orient & MAP_STACK_GROWS_UP) == 0 || - (new_entry->eflags & MAP_ENTRY_GROWS_UP) != 0, - ("new entry lacks MAP_ENTRY_GROWS_UP")); + top = bot + init_ssize; + gap_bot = top; + gap_top = addrbos + max_ssize; } - + rv = vm_map_insert(map, NULL, 0, bot, top, prot, max, cow); + if (rv != KERN_SUCCESS) + return (rv); + new_entry = prev_entry->next; + KASSERT(new_entry->end == top || new_entry->start == bot, + ("Bad entry start/end for new stack entry")); + KASSERT((orient & MAP_STACK_GROWS_DOWN) == 0 || + (new_entry->eflags & MAP_ENTRY_GROWS_DOWN) != 0, + ("new entry lacks MAP_ENTRY_GROWS_DOWN")); + KASSERT((orient & MAP_STACK_GROWS_UP) == 0 || + (new_entry->eflags & MAP_ENTRY_GROWS_UP) != 0, + ("new entry lacks MAP_ENTRY_GROWS_UP")); + rv = vm_map_insert(map, NULL, 0, gap_bot, gap_top, VM_PROT_NONE, + VM_PROT_NONE, MAP_CREATE_GUARD | (orient == MAP_STACK_GROWS_DOWN ? + MAP_CREATE_STACK_GAP_DN : MAP_CREATE_STACK_GAP_UP)); + if (rv != KERN_SUCCESS) + (void)vm_map_delete(map, bot, top); return (rv); } -static int stack_guard_page = 0; -TUNABLE_INT("security.bsd.stack_guard_page", &stack_guard_page); -SYSCTL_INT(_security_bsd, OID_AUTO, stack_guard_page, CTLFLAG_RW, - &stack_guard_page, 0, - "Insert stack guard page ahead of the growable segments."); - -/* Attempts to grow a vm stack entry. Returns KERN_SUCCESS if the - * desired address is already mapped, or if we successfully grow - * the stack. Also returns KERN_SUCCESS if addr is outside the - * stack range (this is strange, but preserves compatibility with - * the grow function in vm_machdep.c). +/* + * Attempts to grow a vm stack entry. Returns KERN_SUCCESS if we + * successfully grow the stack. */ -int -vm_map_growstack(struct proc *p, vm_offset_t addr) +static int +vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) { - vm_map_entry_t next_entry, prev_entry; - vm_map_entry_t new_entry, stack_entry; - struct vmspace *vm = p->p_vmspace; - vm_map_t map = &vm->vm_map; - vm_offset_t end; - vm_size_t growsize; - size_t grow_amount, max_grow; - rlim_t lmemlim, stacklim, vmemlim; - int is_procstack, rv; + vm_map_entry_t stack_entry; + struct proc *p; + struct vmspace *vm; struct ucred *cred; + vm_offset_t gap_end, gap_start, grow_start; + size_t grow_amount, guard, max_grow; + rlim_t lmemlim, stacklim, vmemlim; + int rv, rv1; + bool gap_deleted, grow_down, is_procstack; #ifdef notyet uint64_t limit; #endif @@ -3587,127 +3641,84 @@ vm_map_growstack(struct proc *p, vm_offset_t addr) int error; #endif -Retry: + p = curproc; + vm = p->p_vmspace; + + /* + * Disallow stack growth when the access is performed by a + * debugger or AIO daemon. The reason is that the wrong + * resource limits are applied. + */ + if (map != &p->p_vmspace->vm_map || p->p_textvp == NULL) + return (KERN_FAILURE); + + MPASS(!map->system_map); + + guard = stack_guard_page * PAGE_SIZE; PROC_LOCK(p); lmemlim = lim_cur(p, RLIMIT_MEMLOCK); stacklim = lim_cur(p, RLIMIT_STACK); vmemlim = lim_cur(p, RLIMIT_VMEM); PROC_UNLOCK(p); - - vm_map_lock_read(map); - - /* If addr is already in the entry range, no need to grow.*/ - if (vm_map_lookup_entry(map, addr, &prev_entry)) { - vm_map_unlock_read(map); +retry: + /* If addr is not in a hole for a stack grow area, no need to grow. */ + if (gap_entry == NULL && !vm_map_lookup_entry(map, addr, &gap_entry)) + return (KERN_FAILURE); + if ((gap_entry->eflags & MAP_ENTRY_GUARD) == 0) return (KERN_SUCCESS); - } - - next_entry = prev_entry->next; - if (!(prev_entry->eflags & MAP_ENTRY_GROWS_UP)) { - /* - * This entry does not grow upwards. Since the address lies - * beyond this entry, the next entry (if one exists) has to - * be a downward growable entry. The entry list header is - * never a growable entry, so it suffices to check the flags. - */ - if (!(next_entry->eflags & MAP_ENTRY_GROWS_DOWN)) { - vm_map_unlock_read(map); - return (KERN_SUCCESS); - } - stack_entry = next_entry; + if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { + stack_entry = gap_entry->next; + if ((stack_entry->eflags & MAP_ENTRY_GROWS_DOWN) == 0 || + stack_entry->start != gap_entry->end) + return (KERN_FAILURE); + grow_amount = round_page(stack_entry->start - addr); + grow_down = true; + } else if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_UP) != 0) { + stack_entry = gap_entry->prev; + if ((stack_entry->eflags & MAP_ENTRY_GROWS_UP) == 0 || + stack_entry->end != gap_entry->start) + return (KERN_FAILURE); + grow_amount = round_page(addr + 1 - stack_entry->end); + grow_down = false; } else { - /* - * This entry grows upward. If the next entry does not at - * least grow downwards, this is the entry we need to grow. - * otherwise we have two possible choices and we have to - * select one. - */ - if (next_entry->eflags & MAP_ENTRY_GROWS_DOWN) { - /* - * We have two choices; grow the entry closest to - * the address to minimize the amount of growth. - */ - if (addr - prev_entry->end <= next_entry->start - addr) - stack_entry = prev_entry; - else - stack_entry = next_entry; - } else - stack_entry = prev_entry; + return (KERN_FAILURE); } - - if (stack_entry == next_entry) { - KASSERT(stack_entry->eflags & MAP_ENTRY_GROWS_DOWN, ("foo")); - KASSERT(addr < stack_entry->start, ("foo")); - end = (prev_entry != &map->header) ? prev_entry->end : - stack_entry->start - stack_entry->avail_ssize; - grow_amount = roundup(stack_entry->start - addr, PAGE_SIZE); - max_grow = stack_entry->start - end; - } else { - KASSERT(stack_entry->eflags & MAP_ENTRY_GROWS_UP, ("foo")); - KASSERT(addr >= stack_entry->end, ("foo")); - end = (next_entry != &map->header) ? next_entry->start : - stack_entry->end + stack_entry->avail_ssize; - grow_amount = roundup(addr + 1 - stack_entry->end, PAGE_SIZE); - max_grow = end - stack_entry->end; - } - - if (grow_amount > stack_entry->avail_ssize) { - vm_map_unlock_read(map); + max_grow = gap_entry->end - gap_entry->start; + if (guard > max_grow) return (KERN_NO_SPACE); - } - - /* - * If there is no longer enough space between the entries nogo, and - * adjust the available space. Note: this should only happen if the - * user has mapped into the stack area after the stack was created, - * and is probably an error. - * - * This also effectively destroys any guard page the user might have - * intended by limiting the stack size. - */ - if (grow_amount + (stack_guard_page ? PAGE_SIZE : 0) > max_grow) { - if (vm_map_lock_upgrade(map)) - goto Retry; - - stack_entry->avail_ssize = max_grow; - - vm_map_unlock(map); + max_grow -= guard; + if (grow_amount > max_grow) return (KERN_NO_SPACE); - } - is_procstack = (addr >= (vm_offset_t)vm->vm_maxsaddr && - addr < (vm_offset_t)p->p_sysent->sv_usrstack) ? 1 : 0; - /* * If this is the main process stack, see if we're over the stack * limit. */ - if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) { - vm_map_unlock_read(map); + is_procstack = addr >= (vm_offset_t)vm->vm_maxsaddr && + addr < (vm_offset_t)p->p_sysent->sv_usrstack; + if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) return (KERN_NO_SPACE); - } + #ifdef RACCT if (racct_enable) { PROC_LOCK(p); if (is_procstack && racct_set(p, RACCT_STACK, ctob(vm->vm_ssize) + grow_amount)) { PROC_UNLOCK(p); - vm_map_unlock_read(map); return (KERN_NO_SPACE); } PROC_UNLOCK(p); } #endif - /* Round up the grow amount modulo sgrowsiz */ - growsize = sgrowsiz; - grow_amount = roundup(grow_amount, growsize); - if (grow_amount > stack_entry->avail_ssize) - grow_amount = stack_entry->avail_ssize; + grow_amount = roundup(grow_amount, sgrowsiz); + if (grow_amount > max_grow) + grow_amount = max_grow; if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) { grow_amount = trunc_page((vm_size_t)stacklim) - ctob(vm->vm_ssize); } + #ifdef notyet PROC_LOCK(p); limit = racct_get_available(p, RACCT_STACK); @@ -3715,9 +3726,9 @@ Retry: if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > limit)) grow_amount = limit - ctob(vm->vm_ssize); #endif - if (!old_mlock && map->flags & MAP_WIREFUTURE) { + + if (!old_mlock && (map->flags & MAP_WIREFUTURE) != 0) { if (ptoa(pmap_wired_count(map->pmap)) + grow_amount > lmemlim) { - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3727,7 +3738,6 @@ Retry: if (racct_set(p, RACCT_MEMLOCK, ptoa(pmap_wired_count(map->pmap)) + grow_amount)) { PROC_UNLOCK(p); - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3735,9 +3745,9 @@ Retry: } #endif } + /* If we would blow our VMEM resource limit, no go */ if (map->size + grow_amount > vmemlim) { - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3746,7 +3756,6 @@ Retry: PROC_LOCK(p); if (racct_set(p, RACCT_VMEM, map->size + grow_amount)) { PROC_UNLOCK(p); - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3754,62 +3763,42 @@ Retry: } #endif - if (vm_map_lock_upgrade(map)) - goto Retry; + if (vm_map_lock_upgrade(map)) { + gap_entry = NULL; + vm_map_lock_read(map); + goto retry; + } - if (stack_entry == next_entry) { - /* - * Growing downward. - */ - /* Get the preliminary new entry start value */ - addr = stack_entry->start - grow_amount; - - /* - * If this puts us into the previous entry, cut back our - * growth to the available space. Also, see the note above. - */ - if (addr < end) { - stack_entry->avail_ssize = max_grow; - addr = end; - if (stack_guard_page) - addr += PAGE_SIZE; + if (grow_down) { + grow_start = gap_entry->end - grow_amount; + if (gap_entry->start + grow_amount == gap_entry->end) { + gap_start = gap_entry->start; + gap_end = gap_entry->end; + vm_map_entry_delete(map, gap_entry); + gap_deleted = true; + } else { + MPASS(gap_entry->start < gap_entry->end - grow_amount); + gap_entry->end -= grow_amount; + vm_map_entry_resize_free(map, gap_entry); + gap_deleted = false; } - - rv = vm_map_insert(map, NULL, 0, addr, stack_entry->start, - next_entry->protection, next_entry->max_protection, + rv = vm_map_insert(map, NULL, 0, grow_start, + grow_start + grow_amount, + stack_entry->protection, stack_entry->max_protection, MAP_STACK_GROWS_DOWN); - - /* Adjust the available stack space by the amount we grew. */ - if (rv == KERN_SUCCESS) { - new_entry = prev_entry->next; - KASSERT(new_entry == stack_entry->prev, ("foo")); - KASSERT(new_entry->end == stack_entry->start, ("foo")); - KASSERT(new_entry->start == addr, ("foo")); - KASSERT((new_entry->eflags & MAP_ENTRY_GROWS_DOWN) != - 0, ("new entry lacks MAP_ENTRY_GROWS_DOWN")); - grow_amount = new_entry->end - new_entry->start; - new_entry->avail_ssize = stack_entry->avail_ssize - - grow_amount; - stack_entry->eflags &= ~MAP_ENTRY_GROWS_DOWN; + if (rv != KERN_SUCCESS) { + if (gap_deleted) { + rv1 = vm_map_insert(map, NULL, 0, gap_start, + gap_end, VM_PROT_NONE, VM_PROT_NONE, + MAP_CREATE_GUARD | MAP_CREATE_STACK_GAP_DN); + MPASS(rv1 == KERN_SUCCESS); + } else { + gap_entry->end += grow_amount; + vm_map_entry_resize_free(map, gap_entry); + } } } else { - /* - * Growing upward. - */ - addr = stack_entry->end + grow_amount; - - /* - * If this puts us into the next entry, cut back our growth - * to the available space. Also, see the note above. - */ - if (addr > end) { - stack_entry->avail_ssize = end - stack_entry->end; - addr = end; - if (stack_guard_page) - addr -= PAGE_SIZE; - } - - grow_amount = addr - stack_entry->end; + grow_start = stack_entry->end; cred = stack_entry->cred; if (cred == NULL && stack_entry->object.vm_object != NULL) cred = stack_entry->object.vm_object->cred; @@ -3821,35 +3810,32 @@ Retry: stack_entry->offset, (vm_size_t)(stack_entry->end - stack_entry->start), (vm_size_t)grow_amount, cred != NULL)) { - map->size += (addr - stack_entry->end); - /* Update the current entry. */ - stack_entry->end = addr; - stack_entry->avail_ssize -= grow_amount; + if (gap_entry->start + grow_amount == gap_entry->end) + vm_map_entry_delete(map, gap_entry); + else + gap_entry->start += grow_amount; + stack_entry->end += grow_amount; + map->size += grow_amount; vm_map_entry_resize_free(map, stack_entry); rv = KERN_SUCCESS; - - if (next_entry != &map->header) - vm_map_clip_start(map, next_entry, addr); } else rv = KERN_FAILURE; } - if (rv == KERN_SUCCESS && is_procstack) vm->vm_ssize += btoc(grow_amount); - vm_map_unlock(map); - /* * Heed the MAP_WIREFUTURE flag if it was set for this process. */ - if (rv == KERN_SUCCESS && (map->flags & MAP_WIREFUTURE)) { - vm_map_wire(map, - (stack_entry == next_entry) ? addr : addr - grow_amount, - (stack_entry == next_entry) ? stack_entry->start : addr, + if (rv == KERN_SUCCESS && (map->flags & MAP_WIREFUTURE) != 0) { + vm_map_unlock(map); + vm_map_wire(map, grow_start, grow_start + grow_amount, (p->p_flag & P_SYSTEM) ? VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES : VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); - } + vm_map_lock_read(map); + } else + vm_map_lock_downgrade(map); out: #ifdef RACCT @@ -3973,10 +3959,11 @@ vm_map_lookup(vm_map_t *var_map, /* IN/OUT */ vm_size_t size; struct ucred *cred; -RetryLookup:; +RetryLookup: vm_map_lock_read(map); +RetryLookupLocked: /* * Lookup the faulting address. */ @@ -4002,7 +3989,16 @@ RetryLookup:; * Check whether this task is allowed to have this page. */ prot = entry->protection; - fault_type &= (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + if ((fault_typea & VM_PROT_FAULT_LOOKUP) != 0) { + fault_typea &= ~VM_PROT_FAULT_LOOKUP; + if (prot == VM_PROT_NONE && map != kernel_map && + (entry->eflags & MAP_ENTRY_GUARD) != 0 && + (entry->eflags & (MAP_ENTRY_STACK_GAP_DN | + MAP_ENTRY_STACK_GAP_UP)) != 0 && + vm_map_growstack(map, vaddr, entry) == KERN_SUCCESS) + goto RetryLookupLocked; + } + fault_type &= VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE; if ((fault_type & prot) != fault_type || prot == VM_PROT_NONE) { vm_map_unlock_read(map); return (KERN_PROTECTION_FAILURE); @@ -4236,8 +4232,9 @@ vm_map_print(vm_map_t map) db_indent += 2; for (entry = map->header.next; entry != &map->header; entry = entry->next) { - db_iprintf("map entry %p: start=%p, end=%p\n", - (void *)entry, (void *)entry->start, (void *)entry->end); + db_iprintf("map entry %p: start=%p, end=%p, eflags=%#x, \n", *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Sun Jul 30 10:49:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53D62DB437F; Sun, 30 Jul 2017 10:49:15 +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 1CEF16CB63; Sun, 30 Jul 2017 10:49:15 +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 v6UAnE1u091571; Sun, 30 Jul 2017 10:49:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6UAnEuZ091570; Sun, 30 Jul 2017 10:49:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707301049.v6UAnEuZ091570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 30 Jul 2017 10:49:14 +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: r321718 - stable/10/sys/vm X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/vm X-SVN-Commit-Revision: 321718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 10:49:15 -0000 Author: kib Date: Sun Jul 30 10:49:13 2017 New Revision: 321718 URL: https://svnweb.freebsd.org/changeset/base/321718 Log: Restore layout of struct vm_map_entry after r321717, same as was done in r320889 for stable/11. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/vm/vm_map.h Modified: stable/10/sys/vm/vm_map.h ============================================================================== --- stable/10/sys/vm/vm_map.h Sun Jul 30 10:36:20 2017 (r321717) +++ stable/10/sys/vm/vm_map.h Sun Jul 30 10:49:13 2017 (r321718) @@ -103,6 +103,7 @@ struct vm_map_entry { struct vm_map_entry *right; /* right child in binary search tree */ vm_offset_t start; /* start address */ vm_offset_t end; /* end address */ + vm_offset_t pad0; vm_size_t adj_free; /* amount of adjacent free space */ vm_size_t max_free; /* max free space in subtree */ union vm_map_object object; /* object I point to */ From owner-svn-src-stable@freebsd.org Sun Jul 30 18:29:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58CE6DBFE8E; Sun, 30 Jul 2017 18:29:29 +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 1B39E7CCB2; Sun, 30 Jul 2017 18:29:29 +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 v6UITSwd081376; Sun, 30 Jul 2017 18:29:28 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6UITS4R081374; Sun, 30 Jul 2017 18:29:28 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201707301829.v6UITS4R081374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 30 Jul 2017 18:29: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: r321724 - stable/11/sys/net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/11/sys/net80211 X-SVN-Commit-Revision: 321724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 18:29:29 -0000 Author: avos Date: Sun Jul 30 18:29:28 2017 New Revision: 321724 URL: https://svnweb.freebsd.org/changeset/base/321724 Log: MFC r321401: net80211: do not allow to unload rate control module if it is still in use. Keep 'nrefs' counter up-to-date, so 'kldunload wlan_amrr' with 1+ active wlan(4) interface will not lead to kernel panic. Modified: stable/11/sys/net80211/ieee80211_amrr.c stable/11/sys/net80211/ieee80211_rssadapt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net80211/ieee80211_amrr.c ============================================================================== --- stable/11/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:01:34 2017 (r321723) +++ stable/11/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:29:28 2017 (r321724) @@ -117,6 +117,7 @@ amrr_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__)); + nrefs++; /* XXX locking */ amrr = vap->iv_rs = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr), M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (amrr == NULL) { @@ -133,6 +134,8 @@ static void amrr_deinit(struct ieee80211vap *vap) { IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); + KASSERT(nrefs > 0, ("imbalanced attach/detach")); + nrefs--; /* XXX locking */ } /* Modified: stable/11/sys/net80211/ieee80211_rssadapt.c ============================================================================== --- stable/11/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:01:34 2017 (r321723) +++ stable/11/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:29:28 2017 (r321724) @@ -131,7 +131,8 @@ rssadapt_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s: iv_rs already initialized", __func__)); - + + nrefs++; /* XXX locking */ vap->iv_rs = rs = IEEE80211_MALLOC(sizeof(struct ieee80211_rssadapt), M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (rs == NULL) { @@ -147,6 +148,8 @@ static void rssadapt_deinit(struct ieee80211vap *vap) { IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); + KASSERT(nrefs > 0, ("imbalanced attach/detach")); + nrefs--; /* XXX locking */ } static void From owner-svn-src-stable@freebsd.org Sun Jul 30 18:38:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95DC5DC000B; Sun, 30 Jul 2017 18:38:06 +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 55BCA7D08B; Sun, 30 Jul 2017 18:38:06 +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 v6UIc57e085408; Sun, 30 Jul 2017 18:38:05 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6UIc5SA085406; Sun, 30 Jul 2017 18:38:05 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201707301838.v6UIc5SA085406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 30 Jul 2017 18:38: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: r321725 - stable/10/sys/net80211 X-SVN-Group: stable-10 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/10/sys/net80211 X-SVN-Commit-Revision: 321725 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 18:38:06 -0000 Author: avos Date: Sun Jul 30 18:38:05 2017 New Revision: 321725 URL: https://svnweb.freebsd.org/changeset/base/321725 Log: MFC r321401: net80211: do not allow to unload rate control module if it is still in use. Keep 'nrefs' counter up-to-date, so 'kldunload wlan_amrr' with 1+ active wlan(4) interface will not lead to kernel panic. Modified: stable/10/sys/net80211/ieee80211_amrr.c stable/10/sys/net80211/ieee80211_rssadapt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net80211/ieee80211_amrr.c ============================================================================== --- stable/10/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:29:28 2017 (r321724) +++ stable/10/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:38:05 2017 (r321725) @@ -111,6 +111,7 @@ amrr_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__)); + nrefs++; /* XXX locking */ amrr = vap->iv_rs = malloc(sizeof(struct ieee80211_amrr), M_80211_RATECTL, M_NOWAIT|M_ZERO); if (amrr == NULL) { @@ -127,6 +128,8 @@ static void amrr_deinit(struct ieee80211vap *vap) { free(vap->iv_rs, M_80211_RATECTL); + KASSERT(nrefs > 0, ("imbalanced attach/detach")); + nrefs--; /* XXX locking */ } static int Modified: stable/10/sys/net80211/ieee80211_rssadapt.c ============================================================================== --- stable/10/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:29:28 2017 (r321724) +++ stable/10/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:38:05 2017 (r321725) @@ -127,7 +127,8 @@ rssadapt_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s: iv_rs already initialized", __func__)); - + + nrefs++; /* XXX locking */ vap->iv_rs = rs = malloc(sizeof(struct ieee80211_rssadapt), M_80211_RATECTL, M_NOWAIT|M_ZERO); if (rs == NULL) { @@ -143,6 +144,8 @@ static void rssadapt_deinit(struct ieee80211vap *vap) { free(vap->iv_rs, M_80211_RATECTL); + KASSERT(nrefs > 0, ("imbalanced attach/detach")); + nrefs--; /* XXX locking */ } static void From owner-svn-src-stable@freebsd.org Mon Jul 31 00:34:37 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91D9DDC5C5E; Mon, 31 Jul 2017 00:34: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 609491450; Mon, 31 Jul 2017 00:34: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 v6V0YaZw031796; Mon, 31 Jul 2017 00:34:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V0Ya5u031795; Mon, 31 Jul 2017 00:34:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707310034.v6V0Ya5u031795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 31 Jul 2017 00:34: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: r321738 - stable/11/sbin/savecore X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sbin/savecore X-SVN-Commit-Revision: 321738 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 00:34:37 -0000 Author: markj Date: Mon Jul 31 00:34:36 2017 New Revision: 321738 URL: https://svnweb.freebsd.org/changeset/base/321738 Log: MFC r321437: Fix style and wrap lines to 80 columns in savecore.c. Modified: stable/11/sbin/savecore/savecore.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/savecore/savecore.c ============================================================================== --- stable/11/sbin/savecore/savecore.c Mon Jul 31 00:05:49 2017 (r321737) +++ stable/11/sbin/savecore/savecore.c Mon Jul 31 00:34:36 2017 (r321738) @@ -101,30 +101,39 @@ static sig_atomic_t got_siginfo; static void infohandler(int); static void -printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *device, - int bounds, const int status) +printheader(xo_handle_t *xo, const struct kerneldumpheader *h, + const char *device, int bounds, const int status) { uint64_t dumplen; time_t t; const char *stat_str; xo_flush_h(xo); - xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n", device); - xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n", h->architecture); - xo_emit_h(xo, "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n", dtoh32(h->architectureversion)); + xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n", + device); + xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n", + h->architecture); + xo_emit_h(xo, + "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n", + dtoh32(h->architectureversion)); dumplen = dtoh64(h->dumplength); - xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n", (long long)dumplen); - xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n", dtoh32(h->blocksize)); + xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n", + (long long)dumplen); + xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n", + dtoh32(h->blocksize)); + t = dtoh64(h->dumptime); xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t)); xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname); xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic); - xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", h->versionstring); - xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring); + xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", + h->versionstring); + xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", + h->panicstring); xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity); xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds); - switch(status) { + switch (status) { case STATUS_BAD: stat_str = "bad"; break; @@ -133,13 +142,15 @@ printheader(xo_handle_t *xo, const struct kerneldumphe break; default: stat_str = "unknown"; + break; } xo_emit_h(xo, "{P: }{Lwc:Dump Status}{:dump_status/%s}\n", stat_str); xo_flush_h(xo); } static int -getbounds(void) { +getbounds(void) +{ FILE *fp; char buf[6]; int ret; @@ -170,7 +181,8 @@ getbounds(void) { } static void -writebounds(int bounds) { +writebounds(int bounds) +{ FILE *fp; if ((fp = fopen("bounds", "w")) == NULL) { @@ -372,8 +384,8 @@ DoRegularFile(int fd, off_t dumpsize, char *buf, const /* * At this point, we have a partial ordering: * nw <= hs <= he <= nr - * If hs > nw, buf[nw..hs] contains non-zero data. - * If he > hs, buf[hs..he] is all zeroes. + * If hs > nw, buf[nw..hs] contains non-zero + * data. If he > hs, buf[hs..he] is all zeroes. */ if (hs > nw) if (fwrite(buf + nw, hs - nw, 1, fp) @@ -675,7 +687,7 @@ DoFile(const char *savedir, const char *device) goto closefd; } - oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/ + oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file. */ if (compress) { snprintf(corename, sizeof(corename), "%s.%d.gz", istextdump ? "textdump.tar" : "vmcore", bounds); @@ -889,7 +901,8 @@ main(int argc, char **argv) } else if (nsaved == 0) { if (nerr != 0) { if (verbose) - syslog(LOG_WARNING, "unsaved dumps found but not saved"); + syslog(LOG_WARNING, + "unsaved dumps found but not saved"); exit(1); } else if (verbose) syslog(LOG_WARNING, "no unsaved dumps found"); From owner-svn-src-stable@freebsd.org Mon Jul 31 00:35:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76477DC5CC4; Mon, 31 Jul 2017 00:35:22 +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 42F6C15C8; Mon, 31 Jul 2017 00:35:22 +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 v6V0ZL6E031886; Mon, 31 Jul 2017 00:35:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V0ZLik031885; Mon, 31 Jul 2017 00:35:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707310035.v6V0ZLik031885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 31 Jul 2017 00: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: r321739 - stable/11/sys/dev/ksyms X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/dev/ksyms X-SVN-Commit-Revision: 321739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 00:35:22 -0000 Author: markj Date: Mon Jul 31 00:35:21 2017 New Revision: 321739 URL: https://svnweb.freebsd.org/changeset/base/321739 Log: MFC r321639: Restrict permissions on /dev/ksyms to 0400. Modified: stable/11/sys/dev/ksyms/ksyms.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ksyms/ksyms.c ============================================================================== --- stable/11/sys/dev/ksyms/ksyms.c Mon Jul 31 00:34:36 2017 (r321738) +++ stable/11/sys/dev/ksyms/ksyms.c Mon Jul 31 00:35:21 2017 (r321739) @@ -592,7 +592,7 @@ ksyms_modevent(module_t mod __unused, int type, void * case MOD_LOAD: mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, - 0444, KSYMS_DNAME); + 0400, KSYMS_DNAME); break; case MOD_UNLOAD: From owner-svn-src-stable@freebsd.org Mon Jul 31 00:39:24 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27390DC5D46; Mon, 31 Jul 2017 00:39:24 +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 DAE53171D; Mon, 31 Jul 2017 00:39: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 v6V0dNSA032071; Mon, 31 Jul 2017 00:39:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V0dN8J032070; Mon, 31 Jul 2017 00:39:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707310039.v6V0dN8J032070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 31 Jul 2017 00:39: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: r321740 - stable/10/sys/dev/ksyms X-SVN-Group: stable-10 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/10/sys/dev/ksyms X-SVN-Commit-Revision: 321740 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 00:39:24 -0000 Author: markj Date: Mon Jul 31 00:39:22 2017 New Revision: 321740 URL: https://svnweb.freebsd.org/changeset/base/321740 Log: MFC r321639: Restrict permissions on /dev/ksyms to 0400. Modified: stable/10/sys/dev/ksyms/ksyms.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ksyms/ksyms.c ============================================================================== --- stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:35:21 2017 (r321739) +++ stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:39:22 2017 (r321740) @@ -592,7 +592,7 @@ ksyms_modevent(module_t mod __unused, int type, void * case MOD_LOAD: mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, - 0444, KSYMS_DNAME); + 0400, KSYMS_DNAME); break; case MOD_UNLOAD: From owner-svn-src-stable@freebsd.org Mon Jul 31 00:40:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52EA8DC5DC5; Mon, 31 Jul 2017 00:40:15 +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 1C1FD1883; Mon, 31 Jul 2017 00:40:15 +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 v6V0eEJI032182; Mon, 31 Jul 2017 00:40:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V0eEQV032181; Mon, 31 Jul 2017 00:40:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707310040.v6V0eEQV032181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 31 Jul 2017 00:40: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: r321741 - stable/11/sys/dev/ksyms X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/dev/ksyms X-SVN-Commit-Revision: 321741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 00:40:15 -0000 Author: markj Date: Mon Jul 31 00:40:14 2017 New Revision: 321741 URL: https://svnweb.freebsd.org/changeset/base/321741 Log: MFC r321640: Fix style bugs in ksyms.c. Modified: stable/11/sys/dev/ksyms/ksyms.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ksyms/ksyms.c ============================================================================== --- stable/11/sys/dev/ksyms/ksyms.c Mon Jul 31 00:39:22 2017 (r321740) +++ stable/11/sys/dev/ksyms/ksyms.c Mon Jul 31 00:40:14 2017 (r321741) @@ -62,41 +62,40 @@ #define STR_SYMTAB ".symtab" #define STR_STRTAB ".strtab" -#define STR_SHSTRTAB ".shstrtab" +#define STR_SHSTRTAB ".shstrtab" #define KSYMS_DNAME "ksyms" -static d_open_t ksyms_open; -static d_read_t ksyms_read; -static d_close_t ksyms_close; -static d_ioctl_t ksyms_ioctl; -static d_mmap_t ksyms_mmap; +static d_open_t ksyms_open; +static d_read_t ksyms_read; +static d_close_t ksyms_close; +static d_ioctl_t ksyms_ioctl; +static d_mmap_t ksyms_mmap; static struct cdevsw ksyms_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE, - .d_open = ksyms_open, - .d_close = ksyms_close, - .d_read = ksyms_read, - .d_ioctl = ksyms_ioctl, - .d_mmap = ksyms_mmap, - .d_name = KSYMS_DNAME + .d_version = D_VERSION, + .d_flags = D_TRACKCLOSE, + .d_open = ksyms_open, + .d_close = ksyms_close, + .d_read = ksyms_read, + .d_ioctl = ksyms_ioctl, + .d_mmap = ksyms_mmap, + .d_name = KSYMS_DNAME }; struct ksyms_softc { LIST_ENTRY(ksyms_softc) sc_list; - vm_offset_t sc_uaddr; - size_t sc_usize; + vm_offset_t sc_uaddr; + size_t sc_usize; pmap_t sc_pmap; struct proc *sc_proc; }; -static struct mtx ksyms_mtx; -static struct cdev *ksyms_dev; -static LIST_HEAD(, ksyms_softc) ksyms_list = - LIST_HEAD_INITIALIZER(ksyms_list); +static struct mtx ksyms_mtx; +static struct cdev *ksyms_dev; +static LIST_HEAD(, ksyms_softc) ksyms_list = LIST_HEAD_INITIALIZER(ksyms_list); -static const char ksyms_shstrtab[] = +static const char ksyms_shstrtab[] = "\0" STR_SYMTAB "\0" STR_STRTAB "\0" STR_SHSTRTAB "\0"; struct ksyms_hdr { @@ -106,7 +105,7 @@ struct ksyms_hdr { Elf_Shdr kh_shdr[SHDR_NUM]; char kh_shstrtab[sizeof(ksyms_shstrtab)]; }; - + struct tsizes { size_t ts_symsz; size_t ts_strsz; @@ -123,7 +122,7 @@ static MALLOC_DEFINE(M_KSYMS, "KSYMS", "Kernel Symbol /* * Get the symbol and string table sizes for a kernel module. Add it to the - * running total. + * running total. */ static int ksyms_size_permod(linker_file_t lf, void *arg) @@ -132,35 +131,36 @@ ksyms_size_permod(linker_file_t lf, void *arg) const Elf_Sym *symtab; caddr_t strtab; long syms; - + ts = arg; - + syms = LINKER_SYMTAB_GET(lf, &symtab); ts->ts_symsz += syms * sizeof(Elf_Sym); ts->ts_strsz += LINKER_STRTAB_GET(lf, &strtab); - + return (0); } /* * For kernel module get the symbol and string table sizes, returning the - * totals in *ts. + * totals in *ts. */ -static void +static void ksyms_size_calc(struct tsizes *ts) { + ts->ts_symsz = 0; ts->ts_strsz = 0; - - (void) linker_file_foreach(ksyms_size_permod, ts); + + (void)linker_file_foreach(ksyms_size_permod, ts); } -#define KSYMS_EMIT(src, des, sz) do { \ - copyout(src, (void *)des, sz); \ - des += sz; \ - } while (0) +#define KSYMS_EMIT(src, des, sz) do { \ + copyout(src, (void *)des, sz); \ + des += sz; \ +} while (0) -#define SYMBLKSZ 256 * sizeof (Elf_Sym) +#define SYMBLKSZ (256 * sizeof(Elf_Sym)) /* * For a kernel module, add the symbol and string tables into the @@ -169,6 +169,7 @@ ksyms_size_calc(struct tsizes *ts) static int ksyms_add(linker_file_t lf, void *arg) { + char *buf; struct toffsets *to; const Elf_Sym *symtab; Elf_Sym *symp; @@ -176,43 +177,42 @@ ksyms_add(linker_file_t lf, void *arg) long symsz; size_t strsz, numsyms; linker_symval_t symval; - char *buf; int i, nsyms, len; - + to = arg; - + MOD_SLOCK; numsyms = LINKER_SYMTAB_GET(lf, &symtab); strsz = LINKER_STRTAB_GET(lf, &strtab); symsz = numsyms * sizeof(Elf_Sym); - + buf = malloc(SYMBLKSZ, M_KSYMS, M_WAITOK); - + while (symsz > 0) { len = min(SYMBLKSZ, symsz); bcopy(symtab, buf, len); - /* - * Fix up symbol table for kernel modules: - * string offsets need adjusted + /* + * Fix up symbol table for kernel modules: + * string offsets need adjusted * symbol values made absolute */ symp = (Elf_Sym *) buf; - nsyms = len / sizeof (Elf_Sym); + nsyms = len / sizeof(Elf_Sym); for (i = 0; i < nsyms; i++) { symp[i].st_name += to->to_stridx; - if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, - (c_linker_sym_t) &symtab[i], &symval) == 0) { - symp[i].st_value = (uintptr_t) symval.value; + if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, + (c_linker_sym_t)&symtab[i], &symval) == 0) { + symp[i].st_value = (uintptr_t)symval.value; } } - if (len > to->to_resid) { + if (len > to->to_resid) { MOD_SUNLOCK; free(buf, M_KSYMS); return (ENXIO); - } else - to->to_resid -= len; + } + to->to_resid -= len; KSYMS_EMIT(buf, to->to_symoff, len); symtab += nsyms; @@ -220,14 +220,13 @@ ksyms_add(linker_file_t lf, void *arg) } free(buf, M_KSYMS); MOD_SUNLOCK; - + if (strsz > to->to_resid) return (ENXIO); - else - to->to_resid -= strsz; + to->to_resid -= strsz; KSYMS_EMIT(strtab, to->to_stroff, strsz); to->to_stridx += strsz; - + return (0); } @@ -239,16 +238,14 @@ ksyms_add(linker_file_t lf, void *arg) static int ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, size_t resid) { - struct ksyms_hdr *hdr; - struct toffsets to; + struct toffsets to; int error = 0; - /* Be kernel stack friendly */ - hdr = malloc(sizeof (*hdr), M_KSYMS, M_WAITOK|M_ZERO); + hdr = malloc(sizeof(*hdr), M_KSYMS, M_WAITOK | M_ZERO); - /* - * Create the ELF header. + /* + * Create the ELF header. */ hdr->kh_ehdr.e_ident[EI_PAD] = 0; hdr->kh_ehdr.e_ident[EI_MAG0] = ELFMAG0; @@ -269,32 +266,32 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_ehdr.e_flags = 0; hdr->kh_ehdr.e_ehsize = sizeof(Elf_Ehdr); hdr->kh_ehdr.e_phentsize = sizeof(Elf_Phdr); - hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ + hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ hdr->kh_ehdr.e_shentsize = sizeof(Elf_Shdr); hdr->kh_ehdr.e_shnum = SHDR_NUM; hdr->kh_ehdr.e_shstrndx = SHDR_SHSTRTAB; - /* - * Add both the text and data Program headers. + /* + * Add both the text and data program headers. */ hdr->kh_txtphdr.p_type = PT_LOAD; /* XXX - is there a way to put the actual .text addr/size here? */ - hdr->kh_txtphdr.p_vaddr = 0; - hdr->kh_txtphdr.p_memsz = 0; + hdr->kh_txtphdr.p_vaddr = 0; + hdr->kh_txtphdr.p_memsz = 0; hdr->kh_txtphdr.p_flags = PF_R | PF_X; - + hdr->kh_datphdr.p_type = PT_LOAD; /* XXX - is there a way to put the actual .data addr/size here? */ - hdr->kh_datphdr.p_vaddr = 0; - hdr->kh_datphdr.p_memsz = 0; + hdr->kh_datphdr.p_vaddr = 0; + hdr->kh_datphdr.p_memsz = 0; hdr->kh_datphdr.p_flags = PF_R | PF_W | PF_X; - /* - * Add the Section headers: null, symtab, strtab, shstrtab, + /* + * Add the section headers: null, symtab, strtab, shstrtab. */ /* First section header - null */ - + /* Second section header - symtab */ hdr->kh_shdr[SHDR_SYMTAB].sh_name = 1; /* String offset (skip null) */ hdr->kh_shdr[SHDR_SYMTAB].sh_type = SHT_SYMTAB; @@ -302,31 +299,31 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_shdr[SHDR_SYMTAB].sh_addr = 0; hdr->kh_shdr[SHDR_SYMTAB].sh_offset = sizeof(*hdr); hdr->kh_shdr[SHDR_SYMTAB].sh_size = ts->ts_symsz; - hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; - hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); + hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; + hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); hdr->kh_shdr[SHDR_SYMTAB].sh_addralign = sizeof(long); hdr->kh_shdr[SHDR_SYMTAB].sh_entsize = sizeof(Elf_Sym); /* Third section header - strtab */ - hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); + hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); hdr->kh_shdr[SHDR_STRTAB].sh_type = SHT_STRTAB; hdr->kh_shdr[SHDR_STRTAB].sh_flags = 0; hdr->kh_shdr[SHDR_STRTAB].sh_addr = 0; - hdr->kh_shdr[SHDR_STRTAB].sh_offset = - hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; + hdr->kh_shdr[SHDR_STRTAB].sh_offset = + hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; hdr->kh_shdr[SHDR_STRTAB].sh_size = ts->ts_strsz; hdr->kh_shdr[SHDR_STRTAB].sh_link = 0; hdr->kh_shdr[SHDR_STRTAB].sh_info = 0; hdr->kh_shdr[SHDR_STRTAB].sh_addralign = sizeof(char); hdr->kh_shdr[SHDR_STRTAB].sh_entsize = 0; - + /* Fourth section - shstrtab */ hdr->kh_shdr[SHDR_SHSTRTAB].sh_name = 1 + sizeof(STR_SYMTAB) + sizeof(STR_STRTAB); hdr->kh_shdr[SHDR_SHSTRTAB].sh_type = SHT_STRTAB; hdr->kh_shdr[SHDR_SHSTRTAB].sh_flags = 0; hdr->kh_shdr[SHDR_SHSTRTAB].sh_addr = 0; - hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = + hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = offsetof(struct ksyms_hdr, kh_shstrtab); hdr->kh_shdr[SHDR_SHSTRTAB].sh_size = sizeof(ksyms_shstrtab); hdr->kh_shdr[SHDR_SHSTRTAB].sh_link = 0; @@ -334,9 +331,9 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_shdr[SHDR_SHSTRTAB].sh_addralign = 0 /* sizeof(char) */; hdr->kh_shdr[SHDR_SHSTRTAB].sh_entsize = 0; - /* Copy shstrtab into the header */ + /* Copy shstrtab into the header. */ bcopy(ksyms_shstrtab, hdr->kh_shstrtab, sizeof(ksyms_shstrtab)); - + to.to_symoff = uaddr + hdr->kh_shdr[SHDR_SYMTAB].sh_offset; to.to_stroff = uaddr + hdr->kh_shdr[SHDR_STRTAB].sh_offset; to.to_stridx = 0; @@ -346,13 +343,13 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s } to.to_resid = resid - sizeof(struct ksyms_hdr); - /* Emit Header */ + /* emit header */ copyout(hdr, (void *)uaddr, sizeof(struct ksyms_hdr)); - + free(hdr, M_KSYMS); - /* Add symbol and string tables for each kernelmodule */ - error = linker_file_foreach(ksyms_add, &to); + /* Add symbol and string tables for each kernel module. */ + error = linker_file_foreach(ksyms_add, &to); if (to.to_resid != 0) return (ENXIO); @@ -365,7 +362,7 @@ ksyms_cdevpriv_dtr(void *data) { struct ksyms_softc *sc; - sc = (struct ksyms_softc *)data; + sc = (struct ksyms_softc *)data; mtx_lock(&ksyms_mtx); LIST_REMOVE(sc, sc_list); @@ -373,19 +370,18 @@ ksyms_cdevpriv_dtr(void *data) free(sc, M_KSYMS); } -/* ARGSUSED */ static int ksyms_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { struct tsizes ts; + struct ksyms_softc *sc; size_t total_elf_sz; int error, try; - struct ksyms_softc *sc; - - /* - * Limit one open() per process. The process must close() - * before open()'ing again. - */ + + /* + * Limit one open() per process. The process must close() + * before open()'ing again. + */ mtx_lock(&ksyms_mtx); LIST_FOREACH(sc, &ksyms_list, sc_list) { if (sc->sc_proc == td->td_proc) { @@ -394,9 +390,7 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus } } - sc = (struct ksyms_softc *) malloc(sizeof (*sc), M_KSYMS, - M_NOWAIT|M_ZERO); - + sc = malloc(sizeof(*sc), M_KSYMS, M_NOWAIT | M_ZERO); if (sc == NULL) { mtx_unlock(&ksyms_mtx); return (ENOMEM); @@ -407,41 +401,39 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus mtx_unlock(&ksyms_mtx); error = devfs_set_cdevpriv(sc, ksyms_cdevpriv_dtr); - if (error) + if (error != 0) goto failed; /* - * MOD_SLOCK doesn't work here (because of a lock reversal with - * KLD_SLOCK). Therefore, simply try upto 3 times to get a "clean" + * MOD_SLOCK doesn't work here (because of a lock reversal with + * KLD_SLOCK). Therefore, simply try up to 3 times to get a "clean" * snapshot of the kernel symbol table. This should work fine in the * rare case of a kernel module being loaded/unloaded at the same - * time. + * time. */ - for(try = 0; try < 3; try++) { + for (try = 0; try < 3; try++) { /* - * Map a buffer in the calling process memory space and - * create a snapshot of the kernel symbol table in it. - */ - + * Map a buffer in the calling process memory space and + * create a snapshot of the kernel symbol table in it. + */ + /* Compute the size of buffer needed. */ ksyms_size_calc(&ts); - total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + - ts.ts_strsz; + total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + + ts.ts_strsz; - error = copyout_map(td, &(sc->sc_uaddr), - (vm_size_t) total_elf_sz); - if (error) + error = copyout_map(td, &sc->sc_uaddr, (vm_size_t)total_elf_sz); + if (error != 0) break; - sc->sc_usize = total_elf_sz; + sc->sc_usize = total_elf_sz; - error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); - if (!error) { - /* Successful Snapshot */ - return (0); - } - - /* Snapshot failed, unmap the memory and try again */ - (void) copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); + error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); + if (error == 0) + /* successful snapshot */ + return (0); + + /* Snapshot failed, unmap the memory and try again. */ + (void)copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); } failed: @@ -449,30 +441,28 @@ failed: return (error); } -/* ARGSUSED */ static int ksyms_read(struct cdev *dev, struct uio *uio, int flags __unused) { - int error; - size_t len, sz; struct ksyms_softc *sc; - off_t off; char *buf; + off_t off; + size_t len, sz; vm_size_t ubase; - + int error; + error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); - + off = uio->uio_offset; - len = uio->uio_resid; - + len = uio->uio_resid; + if (off < 0 || off > sc->sc_usize) return (EFAULT); - if (len > (sc->sc_usize - off)) + if (len > sc->sc_usize - off) len = sc->sc_usize - off; - if (len == 0) return (0); @@ -485,16 +475,14 @@ ksyms_read(struct cdev *dev, struct uio *uio, int flag ubase = sc->sc_uaddr + off; while (len) { - sz = min(PAGE_SIZE, len); - if (copyin((void *)ubase, buf, sz)) - error = EFAULT; + if (copyin((void *)ubase, buf, sz) != 0) + error = EFAULT; else error = uiomove(buf, sz, uio); - - if (error) + if (error != 0) break; - + len -= sz; ubase += sz; } @@ -503,27 +491,25 @@ ksyms_read(struct cdev *dev, struct uio *uio, int flag return (error); } -/* ARGSUSED */ static int ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int32_t flag __unused, struct thread *td __unused) { - int error = 0; struct ksyms_softc *sc; + int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); switch (cmd) { case KIOCGSIZE: - /* + /* * Return the size (in bytes) of the symbol table * snapshot. */ *(size_t *)data = sc->sc_usize; break; - case KIOCGADDR: /* * Return the address of the symbol table snapshot. @@ -531,7 +517,6 @@ ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data */ *(void **)data = (void *)sc->sc_uaddr; break; - default: error = ENOTTY; break; @@ -540,71 +525,64 @@ ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data return (error); } -/* ARGUSED */ static int ksyms_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot __unused, vm_memattr_t *memattr __unused) + int prot __unused, vm_memattr_t *memattr __unused) { - struct ksyms_softc *sc; + struct ksyms_softc *sc; int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); /* * XXX mmap() will actually map the symbol table into the process * address space again. */ - if (offset > round_page(sc->sc_usize) || - (*paddr = pmap_extract(sc->sc_pmap, - (vm_offset_t)sc->sc_uaddr + offset)) == 0) + if (offset > round_page(sc->sc_usize) || + (*paddr = pmap_extract(sc->sc_pmap, + (vm_offset_t)sc->sc_uaddr + offset)) == 0) return (-1); return (0); } -/* ARGUSED */ static int ksyms_close(struct cdev *dev, int flags __unused, int fmt __unused, - struct thread *td) + struct thread *td) { - int error = 0; struct ksyms_softc *sc; + int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); /* Unmap the buffer from the process address space. */ - error = copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); - - return (error); + return (copyout_unmap(td, sc->sc_uaddr, sc->sc_usize)); } -/* ARGSUSED */ static int ksyms_modevent(module_t mod __unused, int type, void *data __unused) { - int error = 0; + int error; + error = 0; switch (type) { case MOD_LOAD: mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, 0400, KSYMS_DNAME); break; - case MOD_UNLOAD: if (!LIST_EMPTY(&ksyms_list)) return (EBUSY); destroy_dev(ksyms_dev); mtx_destroy(&ksyms_mtx); break; - case MOD_SHUTDOWN: break; - default: error = EOPNOTSUPP; break; From owner-svn-src-stable@freebsd.org Mon Jul 31 00:41:07 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 151F4DC5F58; Mon, 31 Jul 2017 00:41:07 +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 B83B21B2D; Mon, 31 Jul 2017 00:41:06 +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 v6V0f56M033658; Mon, 31 Jul 2017 00:41:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V0f50X033657; Mon, 31 Jul 2017 00:41:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707310041.v6V0f50X033657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 31 Jul 2017 00:41: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: r321742 - stable/10/sys/dev/ksyms X-SVN-Group: stable-10 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/10/sys/dev/ksyms X-SVN-Commit-Revision: 321742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 00:41:07 -0000 Author: markj Date: Mon Jul 31 00:41:05 2017 New Revision: 321742 URL: https://svnweb.freebsd.org/changeset/base/321742 Log: MFC r321640: Fix style bugs in ksyms.c. Modified: stable/10/sys/dev/ksyms/ksyms.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ksyms/ksyms.c ============================================================================== --- stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:40:14 2017 (r321741) +++ stable/10/sys/dev/ksyms/ksyms.c Mon Jul 31 00:41:05 2017 (r321742) @@ -62,41 +62,40 @@ #define STR_SYMTAB ".symtab" #define STR_STRTAB ".strtab" -#define STR_SHSTRTAB ".shstrtab" +#define STR_SHSTRTAB ".shstrtab" #define KSYMS_DNAME "ksyms" -static d_open_t ksyms_open; -static d_read_t ksyms_read; -static d_close_t ksyms_close; -static d_ioctl_t ksyms_ioctl; -static d_mmap_t ksyms_mmap; +static d_open_t ksyms_open; +static d_read_t ksyms_read; +static d_close_t ksyms_close; +static d_ioctl_t ksyms_ioctl; +static d_mmap_t ksyms_mmap; static struct cdevsw ksyms_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE, - .d_open = ksyms_open, - .d_close = ksyms_close, - .d_read = ksyms_read, - .d_ioctl = ksyms_ioctl, - .d_mmap = ksyms_mmap, - .d_name = KSYMS_DNAME + .d_version = D_VERSION, + .d_flags = D_TRACKCLOSE, + .d_open = ksyms_open, + .d_close = ksyms_close, + .d_read = ksyms_read, + .d_ioctl = ksyms_ioctl, + .d_mmap = ksyms_mmap, + .d_name = KSYMS_DNAME }; struct ksyms_softc { LIST_ENTRY(ksyms_softc) sc_list; - vm_offset_t sc_uaddr; - size_t sc_usize; + vm_offset_t sc_uaddr; + size_t sc_usize; pmap_t sc_pmap; struct proc *sc_proc; }; -static struct mtx ksyms_mtx; -static struct cdev *ksyms_dev; -static LIST_HEAD(, ksyms_softc) ksyms_list = - LIST_HEAD_INITIALIZER(ksyms_list); +static struct mtx ksyms_mtx; +static struct cdev *ksyms_dev; +static LIST_HEAD(, ksyms_softc) ksyms_list = LIST_HEAD_INITIALIZER(ksyms_list); -static const char ksyms_shstrtab[] = +static const char ksyms_shstrtab[] = "\0" STR_SYMTAB "\0" STR_STRTAB "\0" STR_SHSTRTAB "\0"; struct ksyms_hdr { @@ -106,7 +105,7 @@ struct ksyms_hdr { Elf_Shdr kh_shdr[SHDR_NUM]; char kh_shstrtab[sizeof(ksyms_shstrtab)]; }; - + struct tsizes { size_t ts_symsz; size_t ts_strsz; @@ -123,7 +122,7 @@ static MALLOC_DEFINE(M_KSYMS, "KSYMS", "Kernel Symbol /* * Get the symbol and string table sizes for a kernel module. Add it to the - * running total. + * running total. */ static int ksyms_size_permod(linker_file_t lf, void *arg) @@ -132,35 +131,36 @@ ksyms_size_permod(linker_file_t lf, void *arg) const Elf_Sym *symtab; caddr_t strtab; long syms; - + ts = arg; - + syms = LINKER_SYMTAB_GET(lf, &symtab); ts->ts_symsz += syms * sizeof(Elf_Sym); ts->ts_strsz += LINKER_STRTAB_GET(lf, &strtab); - + return (0); } /* * For kernel module get the symbol and string table sizes, returning the - * totals in *ts. + * totals in *ts. */ -static void +static void ksyms_size_calc(struct tsizes *ts) { + ts->ts_symsz = 0; ts->ts_strsz = 0; - - (void) linker_file_foreach(ksyms_size_permod, ts); + + (void)linker_file_foreach(ksyms_size_permod, ts); } -#define KSYMS_EMIT(src, des, sz) do { \ - copyout(src, (void *)des, sz); \ - des += sz; \ - } while (0) +#define KSYMS_EMIT(src, des, sz) do { \ + copyout(src, (void *)des, sz); \ + des += sz; \ +} while (0) -#define SYMBLKSZ 256 * sizeof (Elf_Sym) +#define SYMBLKSZ (256 * sizeof(Elf_Sym)) /* * For a kernel module, add the symbol and string tables into the @@ -169,6 +169,7 @@ ksyms_size_calc(struct tsizes *ts) static int ksyms_add(linker_file_t lf, void *arg) { + char *buf; struct toffsets *to; const Elf_Sym *symtab; Elf_Sym *symp; @@ -176,43 +177,42 @@ ksyms_add(linker_file_t lf, void *arg) long symsz; size_t strsz, numsyms; linker_symval_t symval; - char *buf; int i, nsyms, len; - + to = arg; - + MOD_SLOCK; numsyms = LINKER_SYMTAB_GET(lf, &symtab); strsz = LINKER_STRTAB_GET(lf, &strtab); symsz = numsyms * sizeof(Elf_Sym); - + buf = malloc(SYMBLKSZ, M_KSYMS, M_WAITOK); - + while (symsz > 0) { len = min(SYMBLKSZ, symsz); bcopy(symtab, buf, len); - /* - * Fix up symbol table for kernel modules: - * string offsets need adjusted + /* + * Fix up symbol table for kernel modules: + * string offsets need adjusted * symbol values made absolute */ symp = (Elf_Sym *) buf; - nsyms = len / sizeof (Elf_Sym); + nsyms = len / sizeof(Elf_Sym); for (i = 0; i < nsyms; i++) { symp[i].st_name += to->to_stridx; - if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, - (c_linker_sym_t) &symtab[i], &symval) == 0) { - symp[i].st_value = (uintptr_t) symval.value; + if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, + (c_linker_sym_t)&symtab[i], &symval) == 0) { + symp[i].st_value = (uintptr_t)symval.value; } } - if (len > to->to_resid) { + if (len > to->to_resid) { MOD_SUNLOCK; free(buf, M_KSYMS); return (ENXIO); - } else - to->to_resid -= len; + } + to->to_resid -= len; KSYMS_EMIT(buf, to->to_symoff, len); symtab += nsyms; @@ -220,14 +220,13 @@ ksyms_add(linker_file_t lf, void *arg) } free(buf, M_KSYMS); MOD_SUNLOCK; - + if (strsz > to->to_resid) return (ENXIO); - else - to->to_resid -= strsz; + to->to_resid -= strsz; KSYMS_EMIT(strtab, to->to_stroff, strsz); to->to_stridx += strsz; - + return (0); } @@ -239,16 +238,14 @@ ksyms_add(linker_file_t lf, void *arg) static int ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, size_t resid) { - struct ksyms_hdr *hdr; - struct toffsets to; + struct toffsets to; int error = 0; - /* Be kernel stack friendly */ - hdr = malloc(sizeof (*hdr), M_KSYMS, M_WAITOK|M_ZERO); + hdr = malloc(sizeof(*hdr), M_KSYMS, M_WAITOK | M_ZERO); - /* - * Create the ELF header. + /* + * Create the ELF header. */ hdr->kh_ehdr.e_ident[EI_PAD] = 0; hdr->kh_ehdr.e_ident[EI_MAG0] = ELFMAG0; @@ -269,32 +266,32 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_ehdr.e_flags = 0; hdr->kh_ehdr.e_ehsize = sizeof(Elf_Ehdr); hdr->kh_ehdr.e_phentsize = sizeof(Elf_Phdr); - hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ + hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ hdr->kh_ehdr.e_shentsize = sizeof(Elf_Shdr); hdr->kh_ehdr.e_shnum = SHDR_NUM; hdr->kh_ehdr.e_shstrndx = SHDR_SHSTRTAB; - /* - * Add both the text and data Program headers. + /* + * Add both the text and data program headers. */ hdr->kh_txtphdr.p_type = PT_LOAD; /* XXX - is there a way to put the actual .text addr/size here? */ - hdr->kh_txtphdr.p_vaddr = 0; - hdr->kh_txtphdr.p_memsz = 0; + hdr->kh_txtphdr.p_vaddr = 0; + hdr->kh_txtphdr.p_memsz = 0; hdr->kh_txtphdr.p_flags = PF_R | PF_X; - + hdr->kh_datphdr.p_type = PT_LOAD; /* XXX - is there a way to put the actual .data addr/size here? */ - hdr->kh_datphdr.p_vaddr = 0; - hdr->kh_datphdr.p_memsz = 0; + hdr->kh_datphdr.p_vaddr = 0; + hdr->kh_datphdr.p_memsz = 0; hdr->kh_datphdr.p_flags = PF_R | PF_W | PF_X; - /* - * Add the Section headers: null, symtab, strtab, shstrtab, + /* + * Add the section headers: null, symtab, strtab, shstrtab. */ /* First section header - null */ - + /* Second section header - symtab */ hdr->kh_shdr[SHDR_SYMTAB].sh_name = 1; /* String offset (skip null) */ hdr->kh_shdr[SHDR_SYMTAB].sh_type = SHT_SYMTAB; @@ -302,31 +299,31 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_shdr[SHDR_SYMTAB].sh_addr = 0; hdr->kh_shdr[SHDR_SYMTAB].sh_offset = sizeof(*hdr); hdr->kh_shdr[SHDR_SYMTAB].sh_size = ts->ts_symsz; - hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; - hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); + hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; + hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); hdr->kh_shdr[SHDR_SYMTAB].sh_addralign = sizeof(long); hdr->kh_shdr[SHDR_SYMTAB].sh_entsize = sizeof(Elf_Sym); /* Third section header - strtab */ - hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); + hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); hdr->kh_shdr[SHDR_STRTAB].sh_type = SHT_STRTAB; hdr->kh_shdr[SHDR_STRTAB].sh_flags = 0; hdr->kh_shdr[SHDR_STRTAB].sh_addr = 0; - hdr->kh_shdr[SHDR_STRTAB].sh_offset = - hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; + hdr->kh_shdr[SHDR_STRTAB].sh_offset = + hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; hdr->kh_shdr[SHDR_STRTAB].sh_size = ts->ts_strsz; hdr->kh_shdr[SHDR_STRTAB].sh_link = 0; hdr->kh_shdr[SHDR_STRTAB].sh_info = 0; hdr->kh_shdr[SHDR_STRTAB].sh_addralign = sizeof(char); hdr->kh_shdr[SHDR_STRTAB].sh_entsize = 0; - + /* Fourth section - shstrtab */ hdr->kh_shdr[SHDR_SHSTRTAB].sh_name = 1 + sizeof(STR_SYMTAB) + sizeof(STR_STRTAB); hdr->kh_shdr[SHDR_SHSTRTAB].sh_type = SHT_STRTAB; hdr->kh_shdr[SHDR_SHSTRTAB].sh_flags = 0; hdr->kh_shdr[SHDR_SHSTRTAB].sh_addr = 0; - hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = + hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = offsetof(struct ksyms_hdr, kh_shstrtab); hdr->kh_shdr[SHDR_SHSTRTAB].sh_size = sizeof(ksyms_shstrtab); hdr->kh_shdr[SHDR_SHSTRTAB].sh_link = 0; @@ -334,9 +331,9 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s hdr->kh_shdr[SHDR_SHSTRTAB].sh_addralign = 0 /* sizeof(char) */; hdr->kh_shdr[SHDR_SHSTRTAB].sh_entsize = 0; - /* Copy shstrtab into the header */ + /* Copy shstrtab into the header. */ bcopy(ksyms_shstrtab, hdr->kh_shstrtab, sizeof(ksyms_shstrtab)); - + to.to_symoff = uaddr + hdr->kh_shdr[SHDR_SYMTAB].sh_offset; to.to_stroff = uaddr + hdr->kh_shdr[SHDR_STRTAB].sh_offset; to.to_stridx = 0; @@ -346,13 +343,13 @@ ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, s } to.to_resid = resid - sizeof(struct ksyms_hdr); - /* Emit Header */ + /* emit header */ copyout(hdr, (void *)uaddr, sizeof(struct ksyms_hdr)); - + free(hdr, M_KSYMS); - /* Add symbol and string tables for each kernelmodule */ - error = linker_file_foreach(ksyms_add, &to); + /* Add symbol and string tables for each kernel module. */ + error = linker_file_foreach(ksyms_add, &to); if (to.to_resid != 0) return (ENXIO); @@ -365,7 +362,7 @@ ksyms_cdevpriv_dtr(void *data) { struct ksyms_softc *sc; - sc = (struct ksyms_softc *)data; + sc = (struct ksyms_softc *)data; mtx_lock(&ksyms_mtx); LIST_REMOVE(sc, sc_list); @@ -373,19 +370,18 @@ ksyms_cdevpriv_dtr(void *data) free(sc, M_KSYMS); } -/* ARGSUSED */ static int ksyms_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { struct tsizes ts; + struct ksyms_softc *sc; size_t total_elf_sz; int error, try; - struct ksyms_softc *sc; - - /* - * Limit one open() per process. The process must close() - * before open()'ing again. - */ + + /* + * Limit one open() per process. The process must close() + * before open()'ing again. + */ mtx_lock(&ksyms_mtx); LIST_FOREACH(sc, &ksyms_list, sc_list) { if (sc->sc_proc == td->td_proc) { @@ -394,9 +390,7 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus } } - sc = (struct ksyms_softc *) malloc(sizeof (*sc), M_KSYMS, - M_NOWAIT|M_ZERO); - + sc = malloc(sizeof(*sc), M_KSYMS, M_NOWAIT | M_ZERO); if (sc == NULL) { mtx_unlock(&ksyms_mtx); return (ENOMEM); @@ -407,41 +401,39 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus mtx_unlock(&ksyms_mtx); error = devfs_set_cdevpriv(sc, ksyms_cdevpriv_dtr); - if (error) + if (error != 0) goto failed; /* - * MOD_SLOCK doesn't work here (because of a lock reversal with - * KLD_SLOCK). Therefore, simply try upto 3 times to get a "clean" + * MOD_SLOCK doesn't work here (because of a lock reversal with + * KLD_SLOCK). Therefore, simply try up to 3 times to get a "clean" * snapshot of the kernel symbol table. This should work fine in the * rare case of a kernel module being loaded/unloaded at the same - * time. + * time. */ - for(try = 0; try < 3; try++) { + for (try = 0; try < 3; try++) { /* - * Map a buffer in the calling process memory space and - * create a snapshot of the kernel symbol table in it. - */ - + * Map a buffer in the calling process memory space and + * create a snapshot of the kernel symbol table in it. + */ + /* Compute the size of buffer needed. */ ksyms_size_calc(&ts); - total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + - ts.ts_strsz; + total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + + ts.ts_strsz; - error = copyout_map(td, &(sc->sc_uaddr), - (vm_size_t) total_elf_sz); - if (error) + error = copyout_map(td, &sc->sc_uaddr, (vm_size_t)total_elf_sz); + if (error != 0) break; - sc->sc_usize = total_elf_sz; + sc->sc_usize = total_elf_sz; - error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); - if (!error) { - /* Successful Snapshot */ - return (0); - } - - /* Snapshot failed, unmap the memory and try again */ - (void) copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); + error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); + if (error == 0) + /* successful snapshot */ + return (0); + + /* Snapshot failed, unmap the memory and try again. */ + (void)copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); } failed: @@ -449,30 +441,28 @@ failed: return (error); } -/* ARGSUSED */ static int ksyms_read(struct cdev *dev, struct uio *uio, int flags __unused) { - int error; - size_t len, sz; struct ksyms_softc *sc; - off_t off; char *buf; + off_t off; + size_t len, sz; vm_size_t ubase; - + int error; + error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); - + off = uio->uio_offset; - len = uio->uio_resid; - + len = uio->uio_resid; + if (off < 0 || off > sc->sc_usize) return (EFAULT); - if (len > (sc->sc_usize - off)) + if (len > sc->sc_usize - off) len = sc->sc_usize - off; - if (len == 0) return (0); @@ -485,16 +475,14 @@ ksyms_read(struct cdev *dev, struct uio *uio, int flag ubase = sc->sc_uaddr + off; while (len) { - sz = min(PAGE_SIZE, len); - if (copyin((void *)ubase, buf, sz)) - error = EFAULT; + if (copyin((void *)ubase, buf, sz) != 0) + error = EFAULT; else error = uiomove(buf, sz, uio); - - if (error) + if (error != 0) break; - + len -= sz; ubase += sz; } @@ -503,27 +491,25 @@ ksyms_read(struct cdev *dev, struct uio *uio, int flag return (error); } -/* ARGSUSED */ static int ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int32_t flag __unused, struct thread *td __unused) { - int error = 0; struct ksyms_softc *sc; + int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); switch (cmd) { case KIOCGSIZE: - /* + /* * Return the size (in bytes) of the symbol table * snapshot. */ *(size_t *)data = sc->sc_usize; break; - case KIOCGADDR: /* * Return the address of the symbol table snapshot. @@ -531,7 +517,6 @@ ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data */ *(void **)data = (void *)sc->sc_uaddr; break; - default: error = ENOTTY; break; @@ -540,71 +525,64 @@ ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data return (error); } -/* ARGUSED */ static int ksyms_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot __unused, vm_memattr_t *memattr __unused) + int prot __unused, vm_memattr_t *memattr __unused) { - struct ksyms_softc *sc; + struct ksyms_softc *sc; int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); /* * XXX mmap() will actually map the symbol table into the process * address space again. */ - if (offset > round_page(sc->sc_usize) || - (*paddr = pmap_extract(sc->sc_pmap, - (vm_offset_t)sc->sc_uaddr + offset)) == 0) + if (offset > round_page(sc->sc_usize) || + (*paddr = pmap_extract(sc->sc_pmap, + (vm_offset_t)sc->sc_uaddr + offset)) == 0) return (-1); return (0); } -/* ARGUSED */ static int ksyms_close(struct cdev *dev, int flags __unused, int fmt __unused, - struct thread *td) + struct thread *td) { - int error = 0; struct ksyms_softc *sc; + int error; error = devfs_get_cdevpriv((void **)&sc); - if (error) + if (error != 0) return (error); /* Unmap the buffer from the process address space. */ - error = copyout_unmap(td, sc->sc_uaddr, sc->sc_usize); - - return (error); + return (copyout_unmap(td, sc->sc_uaddr, sc->sc_usize)); } -/* ARGSUSED */ static int ksyms_modevent(module_t mod __unused, int type, void *data __unused) { - int error = 0; + int error; + error = 0; switch (type) { case MOD_LOAD: mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, 0400, KSYMS_DNAME); break; - case MOD_UNLOAD: if (!LIST_EMPTY(&ksyms_list)) return (EBUSY); destroy_dev(ksyms_dev); mtx_destroy(&ksyms_mtx); break; - case MOD_SHUTDOWN: break; - default: error = EOPNOTSUPP; break; From owner-svn-src-stable@freebsd.org Mon Jul 31 02:33:51 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65530DC786C; Mon, 31 Jul 2017 02:33: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 3425263BD4; Mon, 31 Jul 2017 02:33: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 v6V2Xo5P080718; Mon, 31 Jul 2017 02:33:50 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V2Xoqd080716; Mon, 31 Jul 2017 02:33:50 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310233.v6V2Xoqd080716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 02:33: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: r321747 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 321747 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 02:33:51 -0000 Author: sephe Date: Mon Jul 31 02:33:49 2017 New Revision: 321747 URL: https://svnweb.freebsd.org/changeset/base/321747 Log: MFC 321406 ethernet: Add ethernet interface attached event and devctl notification. ifnet_arrival_event may not be adequate under certain situation; e.g. when the LLADDR is needed. So the ethernet ifattach event is announced after all necessary bits are setup. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11617 Modified: stable/11/sys/net/ethernet.h stable/11/sys/net/if_ethersubr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/ethernet.h ============================================================================== --- stable/11/sys/net/ethernet.h Mon Jul 31 01:36:51 2017 (r321746) +++ stable/11/sys/net/ethernet.h Mon Jul 31 02:33:49 2017 (r321747) @@ -403,6 +403,12 @@ void ether_vlan_mtap(struct bpf_if *, struct mbuf *, void *, u_int); struct mbuf *ether_vlanencap(struct mbuf *, uint16_t); +#ifdef _SYS_EVENTHANDLER_H_ +/* new ethernet interface attached event */ +typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t); +#endif + #else /* _KERNEL */ #include Modified: stable/11/sys/net/if_ethersubr.c ============================================================================== --- stable/11/sys/net/if_ethersubr.c Mon Jul 31 01:36:51 2017 (r321746) +++ stable/11/sys/net/if_ethersubr.c Mon Jul 31 02:33:49 2017 (r321747) @@ -38,6 +38,8 @@ #include #include +#include +#include #include #include #include @@ -933,6 +935,11 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla) if_printf(ifp, "Ethernet address: %6D\n", lla, ":"); uuid_ether_add(LLADDR(sdl)); + + /* Add necessary bits are setup; announce it now. */ + EVENTHANDLER_INVOKE(ether_ifattach_event, ifp); + if (IS_DEFAULT_VNET(curvnet)) + devctl_notify("ETHERNET", ifp->if_xname, "IFATTACH", NULL); } /* From owner-svn-src-stable@freebsd.org Mon Jul 31 02:48:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72F5CDC7D41; Mon, 31 Jul 2017 02:48: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 147E1642E2; Mon, 31 Jul 2017 02:48: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 v6V2mJgY085135; Mon, 31 Jul 2017 02:48:19 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V2mIFr085133; Mon, 31 Jul 2017 02:48:18 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310248.v6V2mIFr085133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 02:48: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: r321748 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 321748 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 02:48:20 -0000 Author: sephe Date: Mon Jul 31 02:48:18 2017 New Revision: 321748 URL: https://svnweb.freebsd.org/changeset/base/321748 Log: MFC 321407 hyperv/hn: Export VF list and VF-HN mapping The VF-HN map will be used later on to implement "transparent VF". Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11618 Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 02:33:49 2017 (r321747) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 02:48:18 2017 (r321748) @@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -119,6 +121,8 @@ __FBSDID("$FreeBSD$"); #define HN_RING_CNT_DEF_MAX 8 +#define HN_VFMAP_SIZE_DEF 8 + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -255,6 +259,11 @@ static int hn_ifmedia_upd(struct ifnet *); static void hn_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void hn_ifnet_event(void *, struct ifnet *, int); +static void hn_ifaddr_event(void *, struct ifnet *); +static void hn_ifnet_attevent(void *, struct ifnet *); +static void hn_ifnet_detevent(void *, struct ifnet *); + static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); static void hn_rndis_rx_data(struct hn_rx_ring *, @@ -303,6 +312,9 @@ static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARG static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -502,9 +514,21 @@ static int hn_tx_agg_pkts = -1; SYSCTL_INT(_hw_hn, OID_AUTO, tx_agg_pkts, CTLFLAG_RDTUN, &hn_tx_agg_pkts, 0, "Packet transmission aggregation packet limit"); +/* VF list */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTLTYPE_STRING, + 0, 0, hn_vflist_sysctl, "A", "VF list"); + +/* VF mapping */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, + 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue **hn_tx_taskque;/* shared TX taskqueues */ +static struct rmlock hn_vfmap_lock; +static int hn_vfmap_size; +static struct ifnet **hn_vfmap; + #ifndef RSS static const uint8_t hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { @@ -971,7 +995,7 @@ hn_update_vf_task(void *arg, int pending __unused) { struct hn_update_vf *uv = arg; - uv->rxr->hn_vf = uv->vf; + uv->rxr->hn_rxvf_ifp = uv->vf; } static void @@ -994,37 +1018,50 @@ hn_update_vf(struct hn_softc *sc, struct ifnet *vf) uv.vf = vf; vmbus_chan_run_task(rxr->hn_chan, &task); } else { - rxr->hn_vf = vf; + rxr->hn_rxvf_ifp = vf; } } } -static void -hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +static __inline bool +hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp) { - struct ifnet *hn_ifp; + const struct ifnet *hn_ifp; - HN_LOCK(sc); - - if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) - goto out; - hn_ifp = sc->hn_ifp; if (ifp == hn_ifp) - goto out; + return (false); if (ifp->if_alloctype != IFT_ETHER) - goto out; + return (false); /* Ignore lagg/vlan interfaces */ if (strcmp(ifp->if_dname, "lagg") == 0 || strcmp(ifp->if_dname, "vlan") == 0) - goto out; + return (false); if (bcmp(IF_LLADDR(ifp), IF_LLADDR(hn_ifp), ETHER_ADDR_LEN) != 0) + return (false); + + return (true); +} + +static void +hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +{ + struct ifnet *hn_ifp; + + HN_LOCK(sc); + + if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) goto out; + if (!hn_ismyvf(sc, ifp)) + goto out; + + hn_ifp = sc->hn_ifp; + /* Now we're sure 'ifp' is a real VF device. */ if (vf) { if (sc->hn_flags & HN_FLAG_VF) @@ -1037,7 +1074,7 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool goto out; sc->hn_flags &= ~HN_FLAG_VF; - if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + if (hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_rxfilter_config(sc); else hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE); @@ -1052,7 +1089,7 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool hn_suspend_mgmt(sc); sc->hn_link_flags &= ~(HN_LINK_FLAG_LINKUP | HN_LINK_FLAG_NETCHG); - if_link_state_change(sc->hn_ifp, LINK_STATE_DOWN); + if_link_state_change(hn_ifp, LINK_STATE_DOWN); } else { hn_resume_mgmt(sc); } @@ -1082,6 +1119,85 @@ hn_ifaddr_event(void *arg, struct ifnet *ifp) hn_set_vf(arg, ifp, ifp->if_flags & IFF_UP); } +static void +hn_ifnet_attevent(void *xsc, struct ifnet *ifp) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) + goto done; + + if (!hn_ismyvf(sc, ifp)) + goto done; + + if (sc->hn_vf_ifp != NULL) { + if_printf(sc->hn_ifp, "%s was attached as VF\n", + sc->hn_vf_ifp->if_xname); + goto done; + } + + rm_wlock(&hn_vfmap_lock); + + if (ifp->if_index >= hn_vfmap_size) { + struct ifnet **newmap; + int newsize; + + newsize = ifp->if_index + HN_VFMAP_SIZE_DEF; + newmap = malloc(sizeof(struct ifnet *) * newsize, M_DEVBUF, + M_WAITOK | M_ZERO); + + memcpy(newmap, hn_vfmap, + sizeof(struct ifnet *) * hn_vfmap_size); + free(hn_vfmap, M_DEVBUF); + hn_vfmap = newmap; + hn_vfmap_size = newsize; + } + KASSERT(hn_vfmap[ifp->if_index] == NULL, + ("%s: ifindex %d was mapped to %s", + ifp->if_xname, ifp->if_index, hn_vfmap[ifp->if_index]->if_xname)); + hn_vfmap[ifp->if_index] = sc->hn_ifp; + + rm_wunlock(&hn_vfmap_lock); + + sc->hn_vf_ifp = ifp; +done: + HN_UNLOCK(sc); +} + +static void +hn_ifnet_detevent(void *xsc, struct ifnet *ifp) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if (sc->hn_vf_ifp == NULL) + goto done; + + if (!hn_ismyvf(sc, ifp)) + goto done; + + sc->hn_vf_ifp = NULL; + + rm_wlock(&hn_vfmap_lock); + + KASSERT(ifp->if_index < hn_vfmap_size, + ("ifindex %d, vfmapsize %d", ifp->if_index, hn_vfmap_size)); + if (hn_vfmap[ifp->if_index] != NULL) { + KASSERT(hn_vfmap[ifp->if_index] == sc->hn_ifp, + ("%s: ifindex %d was mapped to %s", + ifp->if_xname, ifp->if_index, + hn_vfmap[ifp->if_index]->if_xname)); + hn_vfmap[ifp->if_index] = NULL; + } + + rm_wunlock(&hn_vfmap_lock); +done: + HN_UNLOCK(sc); +} + /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ static const struct hyperv_guid g_net_vsc_device_type = { .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, @@ -1322,6 +1438,9 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_vf_sysctl, "A", "Virtual Function's name"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxvf_sysctl, "A", "activated Virtual Function's name"); /* * Setup the ifmedia, which has been initialized earlier. @@ -1412,10 +1531,14 @@ hn_attach(device_t dev) sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); - sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifnet_atthand = EVENTHANDLER_REGISTER(ether_ifattach_event, + hn_ifnet_attevent, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifnet_dethand = EVENTHANDLER_REGISTER(ifnet_departure_event, + hn_ifnet_detevent, sc, EVENTHANDLER_PRI_ANY); + return (0); failed: if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) @@ -1428,13 +1551,26 @@ static int hn_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->hn_ifp; + struct ifnet *ifp = sc->hn_ifp, *vf_ifp; if (sc->hn_ifaddr_evthand != NULL) EVENTHANDLER_DEREGISTER(ifaddr_event, sc->hn_ifaddr_evthand); if (sc->hn_ifnet_evthand != NULL) EVENTHANDLER_DEREGISTER(ifnet_event, sc->hn_ifnet_evthand); + if (sc->hn_ifnet_atthand != NULL) { + EVENTHANDLER_DEREGISTER(ether_ifattach_event, + sc->hn_ifnet_atthand); + } + if (sc->hn_ifnet_dethand != NULL) { + EVENTHANDLER_DEREGISTER(ifnet_departure_event, + sc->hn_ifnet_dethand); + } + vf_ifp = sc->hn_vf_ifp; + __compiler_membar(); + if (vf_ifp != NULL) + hn_ifnet_detevent(sc, vf_ifp); + if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { /* * In case that the vmbus missed the orphan handler @@ -2326,7 +2462,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int int hash_type; /* If the VF is active, inject the packet through the VF */ - ifp = rxr->hn_vf ? rxr->hn_vf : rxr->hn_ifp; + ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : rxr->hn_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { /* @@ -3301,12 +3437,12 @@ static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; - char vf_name[128]; + char vf_name[IFNAMSIZ + 1]; struct ifnet *vf; HN_LOCK(sc); vf_name[0] = '\0'; - vf = sc->hn_rx_ring[0].hn_vf; + vf = sc->hn_vf_ifp; if (vf != NULL) snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); HN_UNLOCK(sc); @@ -3314,6 +3450,110 @@ hn_vf_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char vf_name[IFNAMSIZ + 1]; + struct ifnet *vf; + + HN_LOCK(sc); + vf_name[0] = '\0'; + vf = sc->hn_rx_ring[0].hn_rxvf_ifp; + if (vf != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + HN_UNLOCK(sc); + return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); +} + +static int +hn_vflist_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct rm_priotracker pt; + struct sbuf *sb; + int error, i; + bool first; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) + return (ENOMEM); + + rm_rlock(&hn_vfmap_lock, &pt); + + first = true; + for (i = 0; i < hn_vfmap_size; ++i) { + struct ifnet *ifp; + + if (hn_vfmap[i] == NULL) + continue; + + ifp = ifnet_byindex(i); + if (ifp != NULL) { + if (first) + sbuf_printf(sb, "%s", ifp->if_xname); + else + sbuf_printf(sb, " %s", ifp->if_xname); + first = false; + } + } + + rm_runlock(&hn_vfmap_lock, &pt); + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} + +static int +hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct rm_priotracker pt; + struct sbuf *sb; + int error, i; + bool first; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) + return (ENOMEM); + + rm_rlock(&hn_vfmap_lock, &pt); + + first = true; + for (i = 0; i < hn_vfmap_size; ++i) { + struct ifnet *ifp, *hn_ifp; + + hn_ifp = hn_vfmap[i]; + if (hn_ifp == NULL) + continue; + + ifp = ifnet_byindex(i); + if (ifp != NULL) { + if (first) { + sbuf_printf(sb, "%s:%s", ifp->if_xname, + hn_ifp->if_xname); + } else { + sbuf_printf(sb, " %s:%s", ifp->if_xname, + hn_ifp->if_xname); + } + first = false; + } + } + + rm_runlock(&hn_vfmap_lock, &pt); + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -5829,11 +6069,19 @@ hn_chan_callback(struct vmbus_channel *chan, void *xrx } static void -hn_tx_taskq_create(void *arg __unused) +hn_sysinit(void *arg __unused) { int i; /* + * Initialize VF map. + */ + rm_init_flags(&hn_vfmap_lock, "hn_vfmap", RM_SLEEPABLE); + hn_vfmap_size = HN_VFMAP_SIZE_DEF; + hn_vfmap = malloc(sizeof(struct ifnet *) * hn_vfmap_size, M_DEVBUF, + M_WAITOK | M_ZERO); + + /* * Fix the # of TX taskqueues. */ if (hn_tx_taskq_cnt <= 0) @@ -5869,11 +6117,10 @@ hn_tx_taskq_create(void *arg __unused) "hn tx%d", i); } } -SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_SECOND, - hn_tx_taskq_create, NULL); +SYSINIT(hn_sysinit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysinit, NULL); static void -hn_tx_taskq_destroy(void *arg __unused) +hn_sysuninit(void *arg __unused) { if (hn_tx_taskque != NULL) { @@ -5883,6 +6130,9 @@ hn_tx_taskq_destroy(void *arg __unused) taskqueue_free(hn_tx_taskque[i]); free(hn_tx_taskque, M_DEVBUF); } + + if (hn_vfmap != NULL) + free(hn_vfmap, M_DEVBUF); + rm_destroy(&hn_vfmap_lock); } -SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_SECOND, - hn_tx_taskq_destroy, NULL); +SYSUNINIT(hn_sysuninit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysuninit, NULL); Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Jul 31 02:33:49 2017 (r321747) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Jul 31 02:48:18 2017 (r321748) @@ -59,7 +59,7 @@ struct hn_tx_ring; struct hn_rx_ring { struct ifnet *hn_ifp; - struct ifnet *hn_vf; /* SR-IOV VF */ + struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ struct hn_tx_ring *hn_txr; void *hn_pktbuf; int hn_pktbuf_len; @@ -174,6 +174,7 @@ struct hn_tx_ring { */ struct hn_softc { struct ifnet *hn_ifp; + struct ifnet *hn_vf_ifp; /* SR-IOV VF */ struct ifmedia hn_media; device_t hn_dev; int hn_if_flags; @@ -238,6 +239,8 @@ struct hn_softc { eventhandler_tag hn_ifaddr_evthand; eventhandler_tag hn_ifnet_evthand; + eventhandler_tag hn_ifnet_atthand; + eventhandler_tag hn_ifnet_dethand; }; #define HN_FLAG_RXBUF_CONNECTED 0x0001 From owner-svn-src-stable@freebsd.org Mon Jul 31 02:57:40 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBDD6DC7FF9; Mon, 31 Jul 2017 02:57: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 7F7E464726; Mon, 31 Jul 2017 02:57: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 v6V2vdsJ089049; Mon, 31 Jul 2017 02:57:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V2vd0C089048; Mon, 31 Jul 2017 02:57:39 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310257.v6V2vd0C089048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 02:57: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: r321749 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 321749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 02:57:40 -0000 Author: sephe Date: Mon Jul 31 02:57:39 2017 New Revision: 321749 URL: https://svnweb.freebsd.org/changeset/base/321749 Log: MFC 321408 rndis: Add LINK_SPEED_CHANGE status Reviewed by: hselasky Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11650 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 Jul 31 02:48:18 2017 (r321748) +++ stable/11/sys/net/rndis.h Mon Jul 31 02:57:39 2017 (r321749) @@ -31,6 +31,7 @@ #define RNDIS_STATUS_PENDING 0x00000103L #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL +#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L #define RNDIS_STATUS_NETWORK_CHANGE 0x40010018L #define RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG 0x40020006L #define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L From owner-svn-src-stable@freebsd.org Mon Jul 31 03:04:40 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBE4DDC8211; Mon, 31 Jul 2017 03:04: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 6FD7B64F6E; Mon, 31 Jul 2017 03:04: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 v6V34d8M093928; Mon, 31 Jul 2017 03:04:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V34doH093927; Mon, 31 Jul 2017 03:04:39 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310304.v6V34doH093927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 03:04: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: r321750 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 321750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 03:04:40 -0000 Author: sephe Date: Mon Jul 31 03:04:39 2017 New Revision: 321750 URL: https://svnweb.freebsd.org/changeset/base/321750 Log: MFC 321409 hyperv/hn: Ignore LINK_SPEED_CHANGE status. This status will be reported if the backend NIC is wireless; it's not useful. Due to the high frequency of the reporting, this could be pretty annoying; ignore it. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11651 Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 02:57:39 2017 (r321749) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 03:04:39 2017 (r321750) @@ -5574,6 +5574,7 @@ hn_rndis_rx_status(struct hn_softc *sc, const void *da break; case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: + case RNDIS_STATUS_LINK_SPEED_CHANGE: /* Not really useful; ignore. */ break; From owner-svn-src-stable@freebsd.org Mon Jul 31 03:49:09 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD122DC89D8; Mon, 31 Jul 2017 03:49:09 +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 793C065ED6; Mon, 31 Jul 2017 03:49: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 v6V3n8ec010308; Mon, 31 Jul 2017 03:49:08 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V3n82L010306; Mon, 31 Jul 2017 03:49:08 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310349.v6V3n82L010306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 03:49:08 +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: r321752 - stable/10/sys/net X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/net X-SVN-Commit-Revision: 321752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 03:49:09 -0000 Author: sephe Date: Mon Jul 31 03:49:08 2017 New Revision: 321752 URL: https://svnweb.freebsd.org/changeset/base/321752 Log: MFC 321406 ethernet: Add ethernet interface attached event and devctl notification. ifnet_arrival_event may not be adequate under certain situation; e.g. when the LLADDR is needed. So the ethernet ifattach event is announced after all necessary bits are setup. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11617 Modified: stable/10/sys/net/ethernet.h stable/10/sys/net/if_ethersubr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/ethernet.h ============================================================================== --- stable/10/sys/net/ethernet.h Mon Jul 31 03:19:16 2017 (r321751) +++ stable/10/sys/net/ethernet.h Mon Jul 31 03:49:08 2017 (r321752) @@ -384,6 +384,12 @@ void ether_vlan_mtap(struct bpf_if *, struct mbuf *, void *, u_int); struct mbuf *ether_vlanencap(struct mbuf *, uint16_t); +#ifdef SYS_EVENTHANDLER_H +/* new ethernet interface attached event */ +typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t); +#endif + #else /* _KERNEL */ #include Modified: stable/10/sys/net/if_ethersubr.c ============================================================================== --- stable/10/sys/net/if_ethersubr.c Mon Jul 31 03:19:16 2017 (r321751) +++ stable/10/sys/net/if_ethersubr.c Mon Jul 31 03:49:08 2017 (r321752) @@ -39,6 +39,8 @@ #include #include +#include +#include #include #include #include @@ -933,6 +935,11 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla) if_printf(ifp, "Ethernet address: %6D\n", lla, ":"); uuid_ether_add(LLADDR(sdl)); + + /* Add necessary bits are setup; announce it now. */ + EVENTHANDLER_INVOKE(ether_ifattach_event, ifp); + if (IS_DEFAULT_VNET(curvnet)) + devctl_notify("ETHERNET", ifp->if_xname, "IFATTACH", NULL); } /* From owner-svn-src-stable@freebsd.org Mon Jul 31 03:57:47 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4ABBCDC8FE6; Mon, 31 Jul 2017 03:57:47 +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 1346866351; Mon, 31 Jul 2017 03:57:47 +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 v6V3vkFu014556; Mon, 31 Jul 2017 03:57:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V3vkRV014554; Mon, 31 Jul 2017 03:57:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707310357.v6V3vkRV014554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 31 Jul 2017 03:57: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: r321753 - in stable/10/share/examples/tests/tests: atf plain X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/10/share/examples/tests/tests: atf plain X-SVN-Commit-Revision: 321753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 03:57:47 -0000 Author: ngie Date: Mon Jul 31 03:57:45 2017 New Revision: 321753 URL: https://svnweb.freebsd.org/changeset/base/321753 Log: MFC Note: ${FILES} documentation change omitted since r299094 will not be MFCed to ^/stable/10 . MFC r320442: share/examples/tests/{atf,plain}/Makefile: tweak example Makefile snippets - Including bsd.own.mk isn't required since no MK_ knobs are being manipulated. - Update documentation to note that ${FILES} is installed via bsd.progs.mk, not bsd.prog.mk. Modified: stable/10/share/examples/tests/tests/atf/Makefile stable/10/share/examples/tests/tests/plain/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/examples/tests/tests/atf/Makefile ============================================================================== --- stable/10/share/examples/tests/tests/atf/Makefile Mon Jul 31 03:49:08 2017 (r321752) +++ stable/10/share/examples/tests/tests/atf/Makefile Mon Jul 31 03:57:45 2017 (r321753) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include - # Directory into which the Kyuafile provided by this directory will be # installed. # Modified: stable/10/share/examples/tests/tests/plain/Makefile ============================================================================== --- stable/10/share/examples/tests/tests/plain/Makefile Mon Jul 31 03:49:08 2017 (r321752) +++ stable/10/share/examples/tests/tests/plain/Makefile Mon Jul 31 03:57:45 2017 (r321753) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include - # Directory into which the Kyuafile provided by this directory will be # installed. # From owner-svn-src-stable@freebsd.org Mon Jul 31 03:59:00 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D239DC9059; Mon, 31 Jul 2017 03:59:00 +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 EDF5866484; Mon, 31 Jul 2017 03:58:59 +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 v6V3wxNT014681; Mon, 31 Jul 2017 03:58:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V3wxNf014679; Mon, 31 Jul 2017 03:58:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707310358.v6V3wxNf014679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 31 Jul 2017 03:58: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: r321754 - in stable/11: contrib/atf/atf-sh libexec/atf/atf-sh X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11: contrib/atf/atf-sh libexec/atf/atf-sh X-SVN-Commit-Revision: 321754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 03:59:00 -0000 Author: ngie Date: Mon Jul 31 03:58:58 2017 New Revision: 321754 URL: https://svnweb.freebsd.org/changeset/base/321754 Log: MFC r320491: atf-sh(3): document atf_init_test_cases(3) fully The function was missing from the NAME/SYNOPSIS sections. Add a manpage link to complete the documentation reference. Modified: stable/11/contrib/atf/atf-sh/atf-sh.3 stable/11/libexec/atf/atf-sh/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/atf/atf-sh/atf-sh.3 ============================================================================== --- stable/11/contrib/atf/atf-sh/atf-sh.3 Mon Jul 31 03:57:45 2017 (r321753) +++ stable/11/contrib/atf/atf-sh/atf-sh.3 Mon Jul 31 03:58:58 2017 (r321754) @@ -40,6 +40,7 @@ .Nm atf_fail , .Nm atf_get , .Nm atf_get_srcdir , +.Nm atf_init_test_cases , .Nm atf_pass , .Nm atf_require_prog , .Nm atf_set , @@ -82,6 +83,8 @@ .Nm atf_get .Qq var_name .Nm atf_get_srcdir +.Nm atf_init_test_cases +.Qq name .Nm atf_pass .Nm atf_require_prog .Qq prog_name Modified: stable/11/libexec/atf/atf-sh/Makefile ============================================================================== --- stable/11/libexec/atf/atf-sh/Makefile Mon Jul 31 03:57:45 2017 (r321753) +++ stable/11/libexec/atf/atf-sh/Makefile Mon Jul 31 03:58:58 2017 (r321754) @@ -52,6 +52,7 @@ MLINKS+= \ atf-sh.3 atf_fail.3 \ atf-sh.3 atf_get.3 \ atf-sh.3 atf_get_srcdir.3 \ + atf-sh.3 atf_init_test_cases.3 \ atf-sh.3 atf_pass.3 \ atf-sh.3 atf_require_prog.3 \ atf-sh.3 atf_set.3 \ From owner-svn-src-stable@freebsd.org Mon Jul 31 03:59:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8332CDC9094; Mon, 31 Jul 2017 03:59:08 +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 4BBC3664E9; Mon, 31 Jul 2017 03:59:08 +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 v6V3x7dD014736; Mon, 31 Jul 2017 03:59:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V3x73f014734; Mon, 31 Jul 2017 03:59:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707310359.v6V3x73f014734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 31 Jul 2017 03:59: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: r321755 - in stable/10: contrib/atf/atf-sh libexec/atf/atf-sh X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/10: contrib/atf/atf-sh libexec/atf/atf-sh X-SVN-Commit-Revision: 321755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 03:59:08 -0000 Author: ngie Date: Mon Jul 31 03:59:07 2017 New Revision: 321755 URL: https://svnweb.freebsd.org/changeset/base/321755 Log: MFC r320491: atf-sh(3): document atf_init_test_cases(3) fully The function was missing from the NAME/SYNOPSIS sections. Add a manpage link to complete the documentation reference. Modified: stable/10/contrib/atf/atf-sh/atf-sh.3 stable/10/libexec/atf/atf-sh/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/atf/atf-sh/atf-sh.3 ============================================================================== --- stable/10/contrib/atf/atf-sh/atf-sh.3 Mon Jul 31 03:58:58 2017 (r321754) +++ stable/10/contrib/atf/atf-sh/atf-sh.3 Mon Jul 31 03:59:07 2017 (r321755) @@ -40,6 +40,7 @@ .Nm atf_fail , .Nm atf_get , .Nm atf_get_srcdir , +.Nm atf_init_test_cases , .Nm atf_pass , .Nm atf_require_prog , .Nm atf_set , @@ -82,6 +83,8 @@ .Nm atf_get .Qq var_name .Nm atf_get_srcdir +.Nm atf_init_test_cases +.Qq name .Nm atf_pass .Nm atf_require_prog .Qq prog_name Modified: stable/10/libexec/atf/atf-sh/Makefile ============================================================================== --- stable/10/libexec/atf/atf-sh/Makefile Mon Jul 31 03:58:58 2017 (r321754) +++ stable/10/libexec/atf/atf-sh/Makefile Mon Jul 31 03:59:07 2017 (r321755) @@ -51,6 +51,7 @@ MLINKS+= \ atf-sh.3 atf_fail.3 \ atf-sh.3 atf_get.3 \ atf-sh.3 atf_get_srcdir.3 \ + atf-sh.3 atf_init_test_cases.3 \ atf-sh.3 atf_pass.3 \ atf-sh.3 atf_require_prog.3 \ atf-sh.3 atf_set.3 \ From owner-svn-src-stable@freebsd.org Mon Jul 31 06:27:44 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD526DCAE7A; Mon, 31 Jul 2017 06:27: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 7E69369AFF; Mon, 31 Jul 2017 06:27: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 v6V6RhGl074862; Mon, 31 Jul 2017 06:27:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V6RhHh074860; Mon, 31 Jul 2017 06:27:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310627.v6V6RhHh074860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 06:27:43 +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: r321759 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 321759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 06:27:44 -0000 Author: sephe Date: Mon Jul 31 06:27:43 2017 New Revision: 321759 URL: https://svnweb.freebsd.org/changeset/base/321759 Log: MFC 321407 hyperv/hn: Export VF list and VF-HN mapping The VF-HN map will be used later on to implement "transparent VF". Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11618 Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 05:23:32 2017 (r321758) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 06:27:43 2017 (r321759) @@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -118,6 +120,8 @@ __FBSDID("$FreeBSD$"); #define HN_RING_CNT_DEF_MAX 8 +#define HN_VFMAP_SIZE_DEF 8 + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -250,6 +254,11 @@ static int hn_ifmedia_upd(struct ifnet *); static void hn_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void hn_ifnet_event(void *, struct ifnet *, int); +static void hn_ifaddr_event(void *, struct ifnet *); +static void hn_ifnet_attevent(void *, struct ifnet *); +static void hn_ifnet_detevent(void *, struct ifnet *); + static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); static void hn_rndis_rx_data(struct hn_rx_ring *, @@ -296,6 +305,9 @@ static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARG static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -493,9 +505,21 @@ static int hn_tx_agg_pkts = -1; SYSCTL_INT(_hw_hn, OID_AUTO, tx_agg_pkts, CTLFLAG_RDTUN, &hn_tx_agg_pkts, 0, "Packet transmission aggregation packet limit"); +/* VF list */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTLTYPE_STRING, + 0, 0, hn_vflist_sysctl, "A", "VF list"); + +/* VF mapping */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, + 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue **hn_tx_taskque;/* shared TX taskqueues */ +static struct rmlock hn_vfmap_lock; +static int hn_vfmap_size; +static struct ifnet **hn_vfmap; + static const uint8_t hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, @@ -958,7 +982,7 @@ hn_update_vf_task(void *arg, int pending __unused) { struct hn_update_vf *uv = arg; - uv->rxr->hn_vf = uv->vf; + uv->rxr->hn_rxvf_ifp = uv->vf; } static void @@ -981,37 +1005,50 @@ hn_update_vf(struct hn_softc *sc, struct ifnet *vf) uv.vf = vf; vmbus_chan_run_task(rxr->hn_chan, &task); } else { - rxr->hn_vf = vf; + rxr->hn_rxvf_ifp = vf; } } } -static void -hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +static __inline bool +hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp) { - struct ifnet *hn_ifp; + const struct ifnet *hn_ifp; - HN_LOCK(sc); - - if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) - goto out; - hn_ifp = sc->hn_ifp; if (ifp == hn_ifp) - goto out; + return (false); if (ifp->if_alloctype != IFT_ETHER) - goto out; + return (false); /* Ignore lagg/vlan interfaces */ if (strcmp(ifp->if_dname, "lagg") == 0 || strcmp(ifp->if_dname, "vlan") == 0) - goto out; + return (false); if (bcmp(IF_LLADDR(ifp), IF_LLADDR(hn_ifp), ETHER_ADDR_LEN) != 0) + return (false); + + return (true); +} + +static void +hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +{ + struct ifnet *hn_ifp; + + HN_LOCK(sc); + + if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) goto out; + if (!hn_ismyvf(sc, ifp)) + goto out; + + hn_ifp = sc->hn_ifp; + /* Now we're sure 'ifp' is a real VF device. */ if (vf) { if (sc->hn_flags & HN_FLAG_VF) @@ -1024,7 +1061,7 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool goto out; sc->hn_flags &= ~HN_FLAG_VF; - if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) + if (hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_rxfilter_config(sc); else hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE); @@ -1039,7 +1076,7 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool hn_suspend_mgmt(sc); sc->hn_link_flags &= ~(HN_LINK_FLAG_LINKUP | HN_LINK_FLAG_NETCHG); - if_link_state_change(sc->hn_ifp, LINK_STATE_DOWN); + if_link_state_change(hn_ifp, LINK_STATE_DOWN); } else { hn_resume_mgmt(sc); } @@ -1069,6 +1106,85 @@ hn_ifaddr_event(void *arg, struct ifnet *ifp) hn_set_vf(arg, ifp, ifp->if_flags & IFF_UP); } +static void +hn_ifnet_attevent(void *xsc, struct ifnet *ifp) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) + goto done; + + if (!hn_ismyvf(sc, ifp)) + goto done; + + if (sc->hn_vf_ifp != NULL) { + if_printf(sc->hn_ifp, "%s was attached as VF\n", + sc->hn_vf_ifp->if_xname); + goto done; + } + + rm_wlock(&hn_vfmap_lock); + + if (ifp->if_index >= hn_vfmap_size) { + struct ifnet **newmap; + int newsize; + + newsize = ifp->if_index + HN_VFMAP_SIZE_DEF; + newmap = malloc(sizeof(struct ifnet *) * newsize, M_DEVBUF, + M_WAITOK | M_ZERO); + + memcpy(newmap, hn_vfmap, + sizeof(struct ifnet *) * hn_vfmap_size); + free(hn_vfmap, M_DEVBUF); + hn_vfmap = newmap; + hn_vfmap_size = newsize; + } + KASSERT(hn_vfmap[ifp->if_index] == NULL, + ("%s: ifindex %d was mapped to %s", + ifp->if_xname, ifp->if_index, hn_vfmap[ifp->if_index]->if_xname)); + hn_vfmap[ifp->if_index] = sc->hn_ifp; + + rm_wunlock(&hn_vfmap_lock); + + sc->hn_vf_ifp = ifp; +done: + HN_UNLOCK(sc); +} + +static void +hn_ifnet_detevent(void *xsc, struct ifnet *ifp) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if (sc->hn_vf_ifp == NULL) + goto done; + + if (!hn_ismyvf(sc, ifp)) + goto done; + + sc->hn_vf_ifp = NULL; + + rm_wlock(&hn_vfmap_lock); + + KASSERT(ifp->if_index < hn_vfmap_size, + ("ifindex %d, vfmapsize %d", ifp->if_index, hn_vfmap_size)); + if (hn_vfmap[ifp->if_index] != NULL) { + KASSERT(hn_vfmap[ifp->if_index] == sc->hn_ifp, + ("%s: ifindex %d was mapped to %s", + ifp->if_xname, ifp->if_index, + hn_vfmap[ifp->if_index]->if_xname)); + hn_vfmap[ifp->if_index] = NULL; + } + + rm_wunlock(&hn_vfmap_lock); +done: + HN_UNLOCK(sc); +} + /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ static const struct hyperv_guid g_net_vsc_device_type = { .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, @@ -1300,6 +1416,9 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_vf_sysctl, "A", "Virtual Function's name"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxvf_sysctl, "A", "activated Virtual Function's name"); /* * Setup the ifmedia, which has been initialized earlier. @@ -1395,10 +1514,14 @@ hn_attach(device_t dev) sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); - sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifnet_atthand = EVENTHANDLER_REGISTER(ether_ifattach_event, + hn_ifnet_attevent, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifnet_dethand = EVENTHANDLER_REGISTER(ifnet_departure_event, + hn_ifnet_detevent, sc, EVENTHANDLER_PRI_ANY); + return (0); failed: if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) @@ -1411,13 +1534,26 @@ static int hn_detach(device_t dev) { struct hn_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->hn_ifp; + struct ifnet *ifp = sc->hn_ifp, *vf_ifp; if (sc->hn_ifaddr_evthand != NULL) EVENTHANDLER_DEREGISTER(ifaddr_event, sc->hn_ifaddr_evthand); if (sc->hn_ifnet_evthand != NULL) EVENTHANDLER_DEREGISTER(ifnet_event, sc->hn_ifnet_evthand); + if (sc->hn_ifnet_atthand != NULL) { + EVENTHANDLER_DEREGISTER(ether_ifattach_event, + sc->hn_ifnet_atthand); + } + if (sc->hn_ifnet_dethand != NULL) { + EVENTHANDLER_DEREGISTER(ifnet_departure_event, + sc->hn_ifnet_dethand); + } + vf_ifp = sc->hn_vf_ifp; + __compiler_membar(); + if (vf_ifp != NULL) + hn_ifnet_detevent(sc, vf_ifp); + if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { /* * In case that the vmbus missed the orphan handler @@ -2315,7 +2451,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int int hash_type = M_HASHTYPE_OPAQUE; /* If the VF is active, inject the packet through the VF */ - ifp = rxr->hn_vf ? rxr->hn_vf : rxr->hn_ifp; + ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : rxr->hn_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { /* @@ -3284,12 +3420,12 @@ static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; - char vf_name[128]; + char vf_name[IFNAMSIZ + 1]; struct ifnet *vf; HN_LOCK(sc); vf_name[0] = '\0'; - vf = sc->hn_rx_ring[0].hn_vf; + vf = sc->hn_vf_ifp; if (vf != NULL) snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); HN_UNLOCK(sc); @@ -3297,6 +3433,110 @@ hn_vf_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char vf_name[IFNAMSIZ + 1]; + struct ifnet *vf; + + HN_LOCK(sc); + vf_name[0] = '\0'; + vf = sc->hn_rx_ring[0].hn_rxvf_ifp; + if (vf != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + HN_UNLOCK(sc); + return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); +} + +static int +hn_vflist_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct rm_priotracker pt; + struct sbuf *sb; + int error, i; + bool first; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) + return (ENOMEM); + + rm_rlock(&hn_vfmap_lock, &pt); + + first = true; + for (i = 0; i < hn_vfmap_size; ++i) { + struct ifnet *ifp; + + if (hn_vfmap[i] == NULL) + continue; + + ifp = ifnet_byindex(i); + if (ifp != NULL) { + if (first) + sbuf_printf(sb, "%s", ifp->if_xname); + else + sbuf_printf(sb, " %s", ifp->if_xname); + first = false; + } + } + + rm_runlock(&hn_vfmap_lock, &pt); + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} + +static int +hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct rm_priotracker pt; + struct sbuf *sb; + int error, i; + bool first; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) + return (ENOMEM); + + rm_rlock(&hn_vfmap_lock, &pt); + + first = true; + for (i = 0; i < hn_vfmap_size; ++i) { + struct ifnet *ifp, *hn_ifp; + + hn_ifp = hn_vfmap[i]; + if (hn_ifp == NULL) + continue; + + ifp = ifnet_byindex(i); + if (ifp != NULL) { + if (first) { + sbuf_printf(sb, "%s:%s", ifp->if_xname, + hn_ifp->if_xname); + } else { + sbuf_printf(sb, " %s:%s", ifp->if_xname, + hn_ifp->if_xname); + } + first = false; + } + } + + rm_runlock(&hn_vfmap_lock, &pt); + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -5781,11 +6021,19 @@ hn_chan_callback(struct vmbus_channel *chan, void *xrx } static void -hn_tx_taskq_create(void *arg __unused) +hn_sysinit(void *arg __unused) { int i; /* + * Initialize VF map. + */ + rm_init_flags(&hn_vfmap_lock, "hn_vfmap", RM_SLEEPABLE); + hn_vfmap_size = HN_VFMAP_SIZE_DEF; + hn_vfmap = malloc(sizeof(struct ifnet *) * hn_vfmap_size, M_DEVBUF, + M_WAITOK | M_ZERO); + + /* * Fix the # of TX taskqueues. */ if (hn_tx_taskq_cnt <= 0) @@ -5821,11 +6069,10 @@ hn_tx_taskq_create(void *arg __unused) "hn tx%d", i); } } -SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_SECOND, - hn_tx_taskq_create, NULL); +SYSINIT(hn_sysinit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysinit, NULL); static void -hn_tx_taskq_destroy(void *arg __unused) +hn_sysuninit(void *arg __unused) { if (hn_tx_taskque != NULL) { @@ -5835,6 +6082,9 @@ hn_tx_taskq_destroy(void *arg __unused) taskqueue_free(hn_tx_taskque[i]); free(hn_tx_taskque, M_DEVBUF); } + + if (hn_vfmap != NULL) + free(hn_vfmap, M_DEVBUF); + rm_destroy(&hn_vfmap_lock); } -SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_SECOND, - hn_tx_taskq_destroy, NULL); +SYSUNINIT(hn_sysuninit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysuninit, NULL); Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Mon Jul 31 05:23:32 2017 (r321758) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Mon Jul 31 06:27:43 2017 (r321759) @@ -59,7 +59,7 @@ struct hn_tx_ring; struct hn_rx_ring { struct ifnet *hn_ifp; - struct ifnet *hn_vf; /* SR-IOV VF */ + struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ struct hn_tx_ring *hn_txr; void *hn_pktbuf; int hn_pktbuf_len; @@ -175,6 +175,7 @@ struct hn_tx_ring { struct hn_softc { struct ifnet *hn_ifp; struct arpcom arpcom; + struct ifnet *hn_vf_ifp; /* SR-IOV VF */ struct ifmedia hn_media; device_t hn_dev; int hn_if_flags; @@ -239,6 +240,8 @@ struct hn_softc { eventhandler_tag hn_ifaddr_evthand; eventhandler_tag hn_ifnet_evthand; + eventhandler_tag hn_ifnet_atthand; + eventhandler_tag hn_ifnet_dethand; }; #define HN_FLAG_RXBUF_CONNECTED 0x0001 From owner-svn-src-stable@freebsd.org Mon Jul 31 06:40:10 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DADB3DCB1E5; Mon, 31 Jul 2017 06:40: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 A7A6169FE8; Mon, 31 Jul 2017 06:40:10 +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 v6V6e9UG079299; Mon, 31 Jul 2017 06:40:09 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V6e976079298; Mon, 31 Jul 2017 06:40:09 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310640.v6V6e976079298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 06:40: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: r321760 - stable/10/sys/net X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/net X-SVN-Commit-Revision: 321760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 06:40:11 -0000 Author: sephe Date: Mon Jul 31 06:40:09 2017 New Revision: 321760 URL: https://svnweb.freebsd.org/changeset/base/321760 Log: MFC 321408 rndis: Add LINK_SPEED_CHANGE status Reviewed by: hselasky Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11650 Modified: stable/10/sys/net/rndis.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/rndis.h ============================================================================== --- stable/10/sys/net/rndis.h Mon Jul 31 06:27:43 2017 (r321759) +++ stable/10/sys/net/rndis.h Mon Jul 31 06:40:09 2017 (r321760) @@ -31,6 +31,7 @@ #define RNDIS_STATUS_PENDING 0x00000103L #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL +#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L #define RNDIS_STATUS_NETWORK_CHANGE 0x40010018L #define RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG 0x40020006L #define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L From owner-svn-src-stable@freebsd.org Mon Jul 31 06:53:44 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 985D4DCB635; Mon, 31 Jul 2017 06:53: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 578C06A78C; Mon, 31 Jul 2017 06:53: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 v6V6rhNx086942; Mon, 31 Jul 2017 06:53:43 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V6rh1w086941; Mon, 31 Jul 2017 06:53:43 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201707310653.v6V6rh1w086941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 31 Jul 2017 06:53:43 +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: r321761 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 321761 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 06:53:44 -0000 Author: sephe Date: Mon Jul 31 06:53:43 2017 New Revision: 321761 URL: https://svnweb.freebsd.org/changeset/base/321761 Log: MFC 321409 hyperv/hn: Ignore LINK_SPEED_CHANGE status. This status will be reported if the backend NIC is wireless; it's not useful. Due to the high frequency of the reporting, this could be pretty annoying; ignore it. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11651 Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 06:40:09 2017 (r321760) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 31 06:53:43 2017 (r321761) @@ -5526,6 +5526,7 @@ hn_rndis_rx_status(struct hn_softc *sc, const void *da break; case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: + case RNDIS_STATUS_LINK_SPEED_CHANGE: /* Not really useful; ignore. */ break; From owner-svn-src-stable@freebsd.org Mon Jul 31 08:19:45 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D913ADCCEF9; Mon, 31 Jul 2017 08:19: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 A5FDD6D2B2; Mon, 31 Jul 2017 08:19:45 +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 v6V8Jifh019790; Mon, 31 Jul 2017 08:19:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V8JiBc019789; Mon, 31 Jul 2017 08:19:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707310819.v6V8JiBc019789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 31 Jul 2017 08:19: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: r321770 - stable/11/usr.bin/ar X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/usr.bin/ar X-SVN-Commit-Revision: 321770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 08:19:46 -0000 Author: emaste Date: Mon Jul 31 08:19:44 2017 New Revision: 321770 URL: https://svnweb.freebsd.org/changeset/base/321770 Log: MFC r321436: ar: handle partial writes from archive_write_data libarchive may limit a single archive_write_data call to handling 0x7fffffff bytes. Add a loop to handle partial writes. Sponsored by: The FreeBSD Foundation Modified: stable/11/usr.bin/ar/write.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/ar/write.c ============================================================================== --- stable/11/usr.bin/ar/write.c Mon Jul 31 08:16:12 2017 (r321769) +++ stable/11/usr.bin/ar/write.c Mon Jul 31 08:19:44 2017 (r321770) @@ -586,10 +586,17 @@ prefault_buffer(const char *buf, size_t s) static void write_data(struct bsdar *bsdar, struct archive *a, const void *buf, size_t s) { + ssize_t written; + prefault_buffer(buf, s); - if (archive_write_data(a, buf, s) != (ssize_t)s) - bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", - archive_error_string(a)); + while (s > 0) { + written = archive_write_data(a, buf, s); + if (written < 0) + bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", + archive_error_string(a)); + buf = (const char *)buf + written; + s -= written; + } } /* From owner-svn-src-stable@freebsd.org Mon Jul 31 09:28:44 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C013DCE969; Mon, 31 Jul 2017 09:28:44 +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 682ED6FC48; Mon, 31 Jul 2017 09:28: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 v6V9Sh7x048773; Mon, 31 Jul 2017 09:28:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6V9Sh8X048772; Mon, 31 Jul 2017 09:28:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707310928.v6V9Sh8X048772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 31 Jul 2017 09:28:43 +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: r321775 - stable/10/usr.bin/ar X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/usr.bin/ar X-SVN-Commit-Revision: 321775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 09:28:44 -0000 Author: emaste Date: Mon Jul 31 09:28:43 2017 New Revision: 321775 URL: https://svnweb.freebsd.org/changeset/base/321775 Log: MFC r321436: ar: handle partial writes from archive_write_data libarchive may limit a single archive_write_data call to handling 0x7fffffff bytes. Add a loop to handle partial writes. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.bin/ar/write.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/ar/write.c ============================================================================== --- stable/10/usr.bin/ar/write.c Mon Jul 31 09:18:53 2017 (r321774) +++ stable/10/usr.bin/ar/write.c Mon Jul 31 09:28:43 2017 (r321775) @@ -581,10 +581,17 @@ prefault_buffer(const char *buf, size_t s) static void write_data(struct bsdar *bsdar, struct archive *a, const void *buf, size_t s) { + ssize_t written; + prefault_buffer(buf, s); - if (archive_write_data(a, buf, s) != (ssize_t)s) - bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", - archive_error_string(a)); + while (s > 0) { + written = archive_write_data(a, buf, s); + if (written < 0) + bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s", + archive_error_string(a)); + buf = (const char *)buf + written; + s -= written; + } } /* From owner-svn-src-stable@freebsd.org Mon Jul 31 19:48:30 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77743DBC11C; Mon, 31 Jul 2017 19:48:30 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4645065C30; Mon, 31 Jul 2017 19:48:30 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6VJmTZe007059; Mon, 31 Jul 2017 19:48:29 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6VJmT8V007058; Mon, 31 Jul 2017 19:48:29 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201707311948.v6VJmT8V007058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Mon, 31 Jul 2017 19:48: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: r321811 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/11/sys/netpfil/ipfw X-SVN-Commit-Revision: 321811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 19:48:30 -0000 Author: philip Date: Mon Jul 31 19:48:29 2017 New Revision: 321811 URL: https://svnweb.freebsd.org/changeset/base/321811 Log: MFC r320941: Fix GRE over IPv6 tunnels with IPFW Previously, GRE packets in IPv6 tunnels would be dropped by IPFW (unless net.inet6.ip6.fw.deny_unknown_exthdrs was unset). PR: 220640 Submitted by: Kun Xie Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/11/sys/netpfil/ipfw/ip_fw2.c Mon Jul 31 19:34:38 2017 (r321810) +++ stable/11/sys/netpfil/ipfw/ip_fw2.c Mon Jul 31 19:48:29 2017 (r321811) @@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include /* for struct grehdr */ + #include #include /* XXX for in_cksum */ @@ -1160,6 +1162,11 @@ do { \ case IPPROTO_PIM: /* XXX PIM header check? */ PULLUP_TO(hlen, ulp, struct pim); + break; + + case IPPROTO_GRE: /* RFC 1701 */ + /* XXX GRE header check? */ + PULLUP_TO(hlen, ulp, struct grehdr); break; case IPPROTO_CARP: From owner-svn-src-stable@freebsd.org Mon Jul 31 21:34:18 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0579BDBE2DE; Mon, 31 Jul 2017 21:34:18 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wr0-x236.google.com (mail-wr0-x236.google.com [IPv6:2a00:1450:400c:c0c::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 8F2446996A; Mon, 31 Jul 2017 21:34:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wr0-x236.google.com with SMTP id k71so130613617wrc.2; Mon, 31 Jul 2017 14:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ePoEDXOTV4tNbUsk7KOdRiFYKh+Me4RvGtJ7HjMjmeg=; b=kRLkNmEYPgnj/W4BAoAMPKL5zpwk0L0UMih/nWyAMv2E8c5QUXLASygBS+YwqoefLF scUrEshfj+hKgBDuzEyeEzqRCiKhGr3DldQZNXaiE9Kh7SvhR+NifsAzE6kNl0M0MBwp jIoZwNJgxme/h1VJFylYryRYM6uUqR/ItQnJr21MX4xlkPN5xk7zC23RTOvxDMTnPNAD qMGslSaTzdQ9laugaglTgzbYb9y78PpEMQ5dMFgBswRfIrTxN41GYUC6KhbYhZYp/kTM +f6Z1sHKWkLk/+XsUYC5a7yq1aHXvPxxwRLdlg/d0ceE7DBz0q5c+fCk4uWsi3GY7RYU FNmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ePoEDXOTV4tNbUsk7KOdRiFYKh+Me4RvGtJ7HjMjmeg=; b=X79DuK/PZo70T2vBozVYiIr9BRPNrP9p2oRfuzcdAJUymJXkxc4BSQl5JryouaGvdO gLJfgdMLHT6eqcRWxKCDbul9MKCmbYFsJB+D2/jqQYFqCXGRAnoB93nCmW9vlBMZgLXt z5LTTkNPNpIzLAHRprqarZnJ2UUuY6D1hbbdc35wJUFKAHlK8PUzaTUhlF8cOLFyNxkK Th3/f5I74FXjhXtyVAoE3RwzZsLBgNy7hSoBDIgKgCi7YiJwp56Dqduzac8fEYpUJgM4 1ipz0q+4TDMHWrIBxkGIYSlEc3i/SyykQTwWc5YBWfYpbZAs5/1+TsouHdIzt/sZ5Hyh UmBw== X-Gm-Message-State: AIVw111CWAPnl3Ud1Xd1vls16NJSHdwZRmY6VZu/mfRI3EFzXjAA6xiT fLvFpqU3gtW0/qUCWkbIOqxCMHsZ72ns X-Received: by 10.223.174.209 with SMTP id y75mr12381378wrc.19.1501536855005; Mon, 31 Jul 2017 14:34:15 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.28.208.3 with HTTP; Mon, 31 Jul 2017 14:34:14 -0700 (PDT) In-Reply-To: <201707172112.v6HLC2In057796@repo.freebsd.org> References: <201707172112.v6HLC2In057796@repo.freebsd.org> From: Alan Somers Date: Mon, 31 Jul 2017 15:34:14 -0600 X-Google-Sender-Auth: 51n7hh27qLUN5-gSsD8UMUSzeX4 Message-ID: Subject: Re: svn commit: r321093 - in stable/10: bin/ln bin/ln/tests etc/mtree To: Ngie Cooper Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 21:34:18 -0000 On Mon, Jul 17, 2017 at 3:12 PM, Ngie Cooper wrote: > Author: ngie > Date: Mon Jul 17 21:12:02 2017 > New Revision: 321093 > URL: https://svnweb.freebsd.org/changeset/base/321093 > > Log: > MFC r319857: > > ln(1): wordsmith -F option description > > Added: > stable/10/bin/ln/tests/ > - copied from r319714, head/bin/ln/tests/ > Modified: > stable/10/bin/ln/Makefile > stable/10/etc/mtree/BSD.tests.dist > Directory Properties: > stable/10/ (props changed) It looks like the commit message for this one was wrong, though the merge tracking info is correct. The commit message should've read: MFC r319714: Add tests for ln(1) * Verify that when creating a hard link to a symbolic link, '-L' option creates a hard link to the target of the symbolic link * Verify that when creating a hard link to a symbolic link, '-P' option creates a hard link to the symbolic link itself * Verify that if the target file already exists, '-f' option unlinks it so that link may occur * Verify that if the target file or directory is a symbolic link, '-shf' option prevents following the link * Verify that if the target file or directory is a symbolic link, '-snf' option prevents following the link * Verify that '-s' option creates a symbolic link * Verify that '-w' option produces a warning if the source of a symbolic link does not currently exist Submitted by: shivansh Reviewed by: asomers, ngie MFC after: 1 month Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11084 From owner-svn-src-stable@freebsd.org Mon Jul 31 21:42:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 020D7DBE75A; Mon, 31 Jul 2017 21:42:20 +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 BE94169FAC; Mon, 31 Jul 2017 21:42:19 +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 v6VLgIuj055692; Mon, 31 Jul 2017 21:42:18 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6VLgIX5055691; Mon, 31 Jul 2017 21:42:18 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707312142.v6VLgIX5055691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 31 Jul 2017 21:42:18 +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: r321819 - stable/10/bin/ln/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/bin/ln/tests X-SVN-Commit-Revision: 321819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 21:42:20 -0000 Author: asomers Date: Mon Jul 31 21:42:18 2017 New Revision: 321819 URL: https://svnweb.freebsd.org/changeset/base/321819 Log: MFC r319854: bin/ln: Set umask appropriately before creating files for testing These changes were missed in D11084 Submitted by: shivansh Reviewed by: asomers X-MFC-With: 319714 Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11158 Modified: stable/10/bin/ln/tests/ln_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/ln/tests/ln_test.sh ============================================================================== --- stable/10/bin/ln/tests/ln_test.sh Mon Jul 31 21:08:31 2017 (r321818) +++ stable/10/bin/ln/tests/ln_test.sh Mon Jul 31 21:42:18 2017 (r321819) @@ -98,6 +98,7 @@ target_exists_hard_head() target_exists_hard_body() { + set_umask atf_check touch A B atf_check -s exit:1 -e inline:'ln: B: File exists\n' \ ln A B @@ -112,6 +113,7 @@ target_exists_symbolic_head() target_exists_symbolic_body() { + set_umask atf_check touch A B atf_check -s exit:1 -e inline:'ln: B: File exists\n' \ ln -s A B @@ -171,6 +173,7 @@ sf_flag_head() sf_flag_body() { + set_umask atf_check touch A B atf_check ln -sf A B atf_check -o inline:'B: symbolic link to A\n' file B From owner-svn-src-stable@freebsd.org Mon Jul 31 21:52:09 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B85E9DBE9C6; Mon, 31 Jul 2017 21:52:09 +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 877F36A549; Mon, 31 Jul 2017 21:52:09 +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 v6VLq8N5060071; Mon, 31 Jul 2017 21:52:08 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6VLq8P3060070; Mon, 31 Jul 2017 21:52:08 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707312152.v6VLq8P3060070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 31 Jul 2017 21:52:08 +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: r321820 - stable/10/usr.sbin/makefs/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/usr.sbin/makefs/tests X-SVN-Commit-Revision: 321820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 21:52:09 -0000 Author: asomers Date: Mon Jul 31 21:52:08 2017 New Revision: 321820 URL: https://svnweb.freebsd.org/changeset/base/321820 Log: MFC r320163: Fix usr.sbin/makefs/makefs_ffs_tests when /etc/fstab does not exist dumpfs prints a harmless warning message (via ufs_disk_fillout(3) and getfsfile(3)), when /etc/fstab does not exist. We can ignore it. PR: 220165 Reported by: gjb Sponsored by: Spectra Logic Corp Modified: stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh ============================================================================== --- stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh Mon Jul 31 21:42:18 2017 (r321819) +++ stable/10/usr.sbin/makefs/tests/makefs_ffs_tests.sh Mon Jul 31 21:52:08 2017 (r321820) @@ -182,7 +182,7 @@ o_flag_version_1_body() $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR mount_image - atf_check -e empty -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR + atf_check -e ignore -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR check_ffs_image_contents } o_flag_version_1_cleanup() @@ -214,7 +214,7 @@ o_flag_version_2_body() $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR mount_image - atf_check -e empty -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR + atf_check -e ignore -o match:"$ffs_label" dumpfs $TEST_MOUNT_DIR check_ffs_image_contents } o_flag_version_2_cleanup() From owner-svn-src-stable@freebsd.org Mon Jul 31 22:19:41 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE646DBF0A0; Mon, 31 Jul 2017 22:19:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC1D26B685; Mon, 31 Jul 2017 22:19:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6VMJdFK069077; Mon, 31 Jul 2017 22:19:39 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6VMJdAl069073; Mon, 31 Jul 2017 22:19:39 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201707312219.v6VMJdAl069073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 31 Jul 2017 22:19: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: r321825 - in stable/10: . gnu/usr.bin/groff/tmac lib/clang sys/conf X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10: . gnu/usr.bin/groff/tmac lib/clang sys/conf X-SVN-Commit-Revision: 321825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 22:19:41 -0000 Author: marius Date: Mon Jul 31 22:19:39 2017 New Revision: 321825 URL: https://svnweb.freebsd.org/changeset/base/321825 Log: Update stable/10 from 10.3-STABLE to 10.4-PRERELEASE as part of the 10.4 release cycle, also belatedly marking the official start of the code slush. Set the default mdoc(7) version to 10.4, and update the clang(1) TARGET_TRIPLE to reflect 10.4. While at it, add missing FreeBSD major versions to mdoc(7). Approved by: re (implicit) Modified: stable/10/Makefile.inc1 stable/10/gnu/usr.bin/groff/tmac/mdoc.local.in stable/10/lib/clang/clang.build.mk stable/10/sys/conf/newvers.sh Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Mon Jul 31 22:00:27 2017 (r321824) +++ stable/10/Makefile.inc1 Mon Jul 31 22:19:39 2017 (r321825) @@ -359,7 +359,7 @@ TARGET_ABI= gnueabi .else TARGET_ABI= unknown .endif -TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0 +TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.4 XFLAGS+= -target ${TARGET_TRIPLE} .endif .endif Modified: stable/10/gnu/usr.bin/groff/tmac/mdoc.local.in ============================================================================== --- stable/10/gnu/usr.bin/groff/tmac/mdoc.local.in Mon Jul 31 22:00:27 2017 (r321824) +++ stable/10/gnu/usr.bin/groff/tmac/mdoc.local.in Mon Jul 31 22:19:39 2017 (r321825) @@ -50,7 +50,7 @@ .ds doc-str-Lb-libstdthreads C11 Threads Library (libstdthreads, \-lstdthreads) . .\" Default .Os value -.ds doc-default-operating-system FreeBSD\~10.3 +.ds doc-default-operating-system FreeBSD\~10.4 . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 @@ -63,7 +63,9 @@ .ds doc-operating-system-FreeBSD-10.1 10.1 .ds doc-operating-system-FreeBSD-10.2 10.2 .ds doc-operating-system-FreeBSD-10.3 10.3 +.ds doc-operating-system-FreeBSD-10.4 10.4 .ds doc-operating-system-FreeBSD-11.0 11.0 +.ds doc-operating-system-FreeBSD-11.1 11.1 . .\" Definitions for other *BSDs not (yet) in doc-common .ds doc-operating-system-NetBSD-7.0 7.0 Modified: stable/10/lib/clang/clang.build.mk ============================================================================== --- stable/10/lib/clang/clang.build.mk Mon Jul 31 22:00:27 2017 (r321824) +++ stable/10/lib/clang/clang.build.mk Mon Jul 31 22:19:39 2017 (r321825) @@ -27,8 +27,8 @@ TARGET_ABI= gnueabi TARGET_ABI= unknown .endif -TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.3 -BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.3 +TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.4 +BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.4 CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \ -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" \ -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Mon Jul 31 22:00:27 2017 (r321824) +++ stable/10/sys/conf/newvers.sh Mon Jul 31 22:19:39 2017 (r321825) @@ -31,8 +31,8 @@ # $FreeBSD$ TYPE="FreeBSD" -REVISION="10.3" -BRANCH="STABLE" +REVISION="10.4" +BRANCH="PRERELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable@freebsd.org Mon Jul 31 22:28:34 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C09F4DBF338; Mon, 31 Jul 2017 22:28:34 +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 8CD6D6BE33; Mon, 31 Jul 2017 22:28:34 +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 v6VMSXMv073208; Mon, 31 Jul 2017 22:28:33 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6VMSXcx073206; Mon, 31 Jul 2017 22:28:33 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707312228.v6VMSXcx073206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 31 Jul 2017 22:28:33 +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: r321827 - in stable/10/sbin/devd: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10/sbin/devd: . tests X-SVN-Commit-Revision: 321827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 22:28:34 -0000 Author: asomers Date: Mon Jul 31 22:28:33 2017 New Revision: 321827 URL: https://svnweb.freebsd.org/changeset/base/321827 Log: MFC r320165-r320166 r320165: devd(8): Remove pidfile on shutdown Sponsored by: Spectra Logic Corp r320166: Require devd to be running for its ATF tests to run The ATF tests communicate with the system's running devd PR: 220169 Reported by: gjb Sponsored by: Spectra Logic Corp Modified: stable/10/sbin/devd/devd.cc stable/10/sbin/devd/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/devd/devd.cc ============================================================================== --- stable/10/sbin/devd/devd.cc Mon Jul 31 22:26:30 2017 (r321826) +++ stable/10/sbin/devd/devd.cc Mon Jul 31 22:28:33 2017 (r321827) @@ -1070,6 +1070,7 @@ event_loop(void) if (FD_ISSET(seqpacket_fd, &fds)) new_client(seqpacket_fd, SOCK_SEQPACKET); } + cfg.remove_pidfile(); close(seqpacket_fd); close(stream_fd); close(fd); Modified: stable/10/sbin/devd/tests/Makefile ============================================================================== --- stable/10/sbin/devd/tests/Makefile Mon Jul 31 22:26:30 2017 (r321826) +++ stable/10/sbin/devd/tests/Makefile Mon Jul 31 22:28:33 2017 (r321827) @@ -1,7 +1,8 @@ # $FreeBSD$ ATF_TESTS_C= client_test -TEST_METADATA.client_test= required_programs="devd" +TEST_METADATA.client_test= required_files="/var/run/devd.pid" +TEST_METADATA.client_test+= required_programs="devd" TEST_METADATA.client_test+= required_user="root" TEST_METADATA.client_test+= timeout=15 From owner-svn-src-stable@freebsd.org Mon Jul 31 22:36:04 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFE67DBF585; Mon, 31 Jul 2017 22:36:04 +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 ABB786C333; Mon, 31 Jul 2017 22:36:04 +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 v6VMa38g077123; Mon, 31 Jul 2017 22:36:03 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6VMa31R077121; Mon, 31 Jul 2017 22:36:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707312236.v6VMa31R077121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 31 Jul 2017 22:36: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: r321829 - in stable/10: lib/libc/sys share/man/man4 X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: lib/libc/sys share/man/man4 X-SVN-Commit-Revision: 321829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 22:36:04 -0000 Author: asomers Date: Mon Jul 31 22:36:03 2017 New Revision: 321829 URL: https://svnweb.freebsd.org/changeset/base/321829 Log: Clarify usage of aio(4) with kqueue(2) Reviewed by: jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D11299 Modified: stable/10/lib/libc/sys/kqueue.2 stable/10/share/man/man4/aio.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/kqueue.2 ============================================================================== --- stable/10/lib/libc/sys/kqueue.2 Mon Jul 31 22:32:11 2017 (r321828) +++ stable/10/lib/libc/sys/kqueue.2 Mon Jul 31 22:36:03 2017 (r321829) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2016 +.Dd June 22, 2017 .Dt KQUEUE 2 .Os .Sh NAME @@ -327,33 +327,18 @@ identical to the .Dv EVFILT_READ case. .It Dv EVFILT_AIO -The sigevent portion of the AIO request is filled in, with -.Va sigev_notify_kqueue -containing the descriptor of the kqueue that the event should -be attached to, -.Va sigev_notify_kevent_flags -containing the kevent flags which should be -.Dv EV_ONESHOT , -.Dv EV_CLEAR -or -.Dv EV_DISPATCH , -.Va sigev_value -containing the udata value, and -.Va sigev_notify -set to -.Dv SIGEV_KEVENT . -When the -.Fn aio_* -system call is made, the event will be registered -with the specified kqueue, and the -.Va ident -argument set to the -.Fa struct aiocb -returned by the -.Fn aio_* -system call. +Events for this filter are not registered with +.Fn kevent +directly but are registered via the +.Va aio_sigevent +member of an asychronous I/O request when it is scheduled via an asychronous I/O +system call such as +.Fn aio_read . The filter returns under the same conditions as .Fn aio_error . +For more details on this filter see +.Xr sigevent 3 and +.Xr aio 4 . .It Dv EVFILT_VNODE Takes a file descriptor as the identifier and the events to watch for in .Va fflags , Modified: stable/10/share/man/man4/aio.4 ============================================================================== --- stable/10/share/man/man4/aio.4 Mon Jul 31 22:32:11 2017 (r321828) +++ stable/10/share/man/man4/aio.4 Mon Jul 31 22:36:03 2017 (r321829) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd June 22, 2017 .Dt AIO 4 .Os .Sh NAME @@ -59,11 +59,27 @@ field which can be used to request notification when a For .Dv SIGEV_KEVENT notifications, -the posted kevent will contain: +the +.Va sigevent +.Ap +s +.Va sigev_notify_kqueue +field should contain the descriptor of the kqueue that the event should be attached +to, its +.Va sigev_notify_kevent_flags +field may contain +.Dv EV_ONESHOT , +.Dv EV_CLEAR , and/or +.Dv EV_DISPATCH , and its +.Va sigev_notify +field should be set to +.Dv SIGEV_KEVENT . +The posted kevent will contain: .Bl -column ".Va filter" .It Sy Member Ta Sy Value .It Va ident Ta asynchronous I/O control buffer pointer .It Va filter Ta Dv EVFILT_AIO +.It Va flags Ta Dv EV_EOF .It Va udata Ta value stored in .Va aio_sigevent.sigev_value From owner-svn-src-stable@freebsd.org Mon Jul 31 22:57:30 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C212DBFB03 for ; Mon, 31 Jul 2017 22:57:30 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::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 C324A6CB3B for ; Mon, 31 Jul 2017 22:57:29 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wr0-x244.google.com with SMTP id c24so13682wra.2 for ; Mon, 31 Jul 2017 15:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:cc; bh=JqI8217HcOKvtz25HaA5IzgFx3oNoSVKLWSFm/0zx2s=; b=glZgSi90WY1W27sSbgE6MSt6eRhQZLxQT5FD5eCV1hNV8uLy+cJYfxpa0xiaEE3Llj 4XmU0MuzBqZpvpKQ2WJMINex1AVVSCtFDRk0MWHfT7mUJp30Riw+eJZ1WrIz2o52lRHx 8muUNPbeLU79iX+xFlkSksi+VEbUI4sk779xi1qdyXcE9keqq7Fq6LkrxLQPJoUkLAVB OTRb9nFNYU+gwOfWmZnGJfphyI1sYNudmJ4VpWL34YJop9HigfJWkYWdbnxdICrOjdfh ER6MF/E/zeFhsWhMMJxn/ZdKSoOlrJwitohc9gyfXHYarp8p9I4wWklEjl8aHXlUT50Y 45QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:cc; bh=JqI8217HcOKvtz25HaA5IzgFx3oNoSVKLWSFm/0zx2s=; b=dt5ENG3tB3kE3bbl+q69uzBERak5BsEmaR9fRtOUtMr8vO8nlqCMXqo5/iO5bJLO6B rhlJL6ewWykzO3vl5BUcOMlv+BUqinZKQI5WI2TgmnrBsdeKcbwoUo0y/q/ir4EA5UMk 7adwx+vp5BHLMwWW54XQwL2uRIKUMLhhKVy0WAiM2+kmhorWkUQybm32ARf0PKfQo4up SmCVsOHxlYrL0UY7qhfATGaEx1nTTQhpVD67Op7mfhGl3hLfzk4fT6fg3sc8pFpVWa5V eChoixAlP2hso0pwh0OWNYftTLyydxKUcQEZ+zxmwTzDhLt4v4e571fACd5meDIZZeFT fBGA== X-Gm-Message-State: AIVw113NVXgYDZnUo3Uw2JKWUKkUaTiAjVKOAqfMiDpxe6TGXQl52hC5 +dJ3v2hHiRtzOFMgjOOSlsDD8DC3vA== X-Received: by 10.223.174.209 with SMTP id y75mt13604455wrc.19.1501541848288; Mon, 31 Jul 2017 15:57:28 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.28.208.3 with HTTP; Mon, 31 Jul 2017 15:57:27 -0700 (PDT) In-Reply-To: <201707312236.v6VMa31R077121@repo.freebsd.org> References: <201707312236.v6VMa31R077121@repo.freebsd.org> From: Alan Somers Date: Mon, 31 Jul 2017 16:57:27 -0600 X-Google-Sender-Auth: XxGll0vCoNqDwzGDrJCSrBc6RRM Message-ID: Subject: Re: svn commit: r321829 - in stable/10: lib/libc/sys share/man/man4 Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 22:57:30 -0000 On Mon, Jul 31, 2017 at 4:36 PM, Alan Somers wrote: > Author: asomers > Date: Mon Jul 31 22:36:03 2017 > New Revision: 321829 > URL: https://svnweb.freebsd.org/changeset/base/321829 > > Log: > Clarify usage of aio(4) with kqueue(2) > > Reviewed by: jhb > MFC after: 3 weeks > Differential Revision: https://reviews.freebsd.org/D11299 > > Modified: > stable/10/lib/libc/sys/kqueue.2 > stable/10/share/man/man4/aio.4 > Directory Properties: > stable/10/ (props changed) Oops, I truncated the commit message. The full commit message should've been: MFC r320255: Clarify usage of aio(4) with kqueue(2) Reviewed by: jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D11299 From owner-svn-src-stable@freebsd.org Mon Jul 31 23:03:11 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80B34DBFCD3; Mon, 31 Jul 2017 23:03:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44C3F6CF13; Mon, 31 Jul 2017 23:03:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6VN3AeZ089196; Mon, 31 Jul 2017 23:03:10 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6VN3AMi089195; Mon, 31 Jul 2017 23:03:10 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201707312303.v6VN3AMi089195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 31 Jul 2017 23:03: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: r321830 - stable/10/bin/echo/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/bin/echo/tests X-SVN-Commit-Revision: 321830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2017 23:03:11 -0000 Author: asomers Date: Mon Jul 31 23:03:10 2017 New Revision: 321830 URL: https://svnweb.freebsd.org/changeset/base/321830 Log: MFC r320269: style fixes in bin/echo/tests Submitted by: shivansh Reviewed by: asomers X-MFC-With: 319626 Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11318 Modified: stable/10/bin/echo/tests/echo_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/echo/tests/echo_test.sh ============================================================================== --- stable/10/bin/echo/tests/echo_test.sh Mon Jul 31 22:36:03 2017 (r321829) +++ stable/10/bin/echo/tests/echo_test.sh Mon Jul 31 23:03:10 2017 (r321830) @@ -27,29 +27,33 @@ # atf_test_case n_output -n_output_head() { - atf_set "descr" "Verify that echo(1) does not print the trailing " \ - "newline character with option '-n'" +n_output_head() +{ + atf_set "descr" "Verify that echo(1) does not print the trailing " \ + "newline character with option '-n'" } -n_output_body() { - atf_check -s ignore -o inline:"Hello world" \ - /bin/echo -n "Hello world" +n_output_body() +{ + atf_check -s ignore -o inline:"Hello world" \ + /bin/echo -n "Hello world" } atf_test_case append_c_output -append_c_output_head() { - atf_set "descr" "Verify that echo(1) does not print the trailing newline " \ - "character when '\c' is appended to the end of the string" +append_c_output_head() +{ + atf_set "descr" "Verify that echo(1) does not print the trailing newline " \ + "character when '\c' is appended to the end of the string" } -append_c_output_body() { - atf_check -s ignore -o inline:"Hello world" \ - /bin/echo "Hello world\c" +append_c_output_body() +{ + atf_check -s ignore -o inline:"Hello world" \ + /bin/echo "Hello world\c" } atf_init_test_cases() { - atf_add_test_case n_output - atf_add_test_case append_c_output + atf_add_test_case n_output + atf_add_test_case append_c_output } From owner-svn-src-stable@freebsd.org Tue Aug 1 01:23:56 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33E32DC2EE5; Tue, 1 Aug 2017 01:23:56 +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 02B9C70EAC; Tue, 1 Aug 2017 01:23:55 +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 v711NtQI046673; Tue, 1 Aug 2017 01:23:55 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v711Nte5046672; Tue, 1 Aug 2017 01:23:55 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708010123.v711Nte5046672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 1 Aug 2017 01: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: r321832 - stable/11/lib/libthr/thread X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/lib/libthr/thread X-SVN-Commit-Revision: 321832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 01:23:56 -0000 Author: pfg Date: Tue Aug 1 01:23:55 2017 New Revision: 321832 URL: https://svnweb.freebsd.org/changeset/base/321832 Log: MFC r320990, r321011: libthr: Avoid checking for negative values in usigned count. Check for overflow instead. Modified: stable/11/lib/libthr/thread/thr_barrier.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libthr/thread/thr_barrier.c ============================================================================== --- stable/11/lib/libthr/thread/thr_barrier.c Mon Jul 31 23:04:12 2017 (r321831) +++ stable/11/lib/libthr/thread/thr_barrier.c Tue Aug 1 01:23:55 2017 (r321832) @@ -100,7 +100,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier, pthread_barrier_t bar; int pshared; - if (barrier == NULL || count <= 0) + if (barrier == NULL || count == 0 || count > INT_MAX) return (EINVAL); if (attr == NULL || *attr == NULL || From owner-svn-src-stable@freebsd.org Tue Aug 1 01:25:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BAF9DC306D; Tue, 1 Aug 2017 01:25:19 +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 0811F71054; Tue, 1 Aug 2017 01:25:18 +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 v711PIgU046796; Tue, 1 Aug 2017 01:25:18 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v711PIUP046795; Tue, 1 Aug 2017 01:25:18 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708010125.v711PIUP046795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 1 Aug 2017 01:25:18 +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: r321833 - stable/10/lib/libthr/thread X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/lib/libthr/thread X-SVN-Commit-Revision: 321833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 01:25:19 -0000 Author: pfg Date: Tue Aug 1 01:25:18 2017 New Revision: 321833 URL: https://svnweb.freebsd.org/changeset/base/321833 Log: MFC r320990, r321011: libthr: Avoid checking for negative values in usigned count. Check for overflow instead. Modified: stable/10/lib/libthr/thread/thr_barrier.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libthr/thread/thr_barrier.c ============================================================================== --- stable/10/lib/libthr/thread/thr_barrier.c Tue Aug 1 01:23:55 2017 (r321832) +++ stable/10/lib/libthr/thread/thr_barrier.c Tue Aug 1 01:25:18 2017 (r321833) @@ -83,7 +83,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier, (void)attr; - if (barrier == NULL || count <= 0) + if (barrier == NULL || count == 0 || count > INT_MAX) return (EINVAL); bar = calloc(1, sizeof(struct pthread_barrier)); From owner-svn-src-stable@freebsd.org Tue Aug 1 12:40:59 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E7AEDAB3C5; Tue, 1 Aug 2017 12:40:59 +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 BF73975639; Tue, 1 Aug 2017 12:40:58 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1dcWTi-000Jmy-74; Tue, 01 Aug 2017 15:40:50 +0300 Date: Tue, 1 Aug 2017 15:40:50 +0300 From: Slawa Olhovchenkov To: Marius Strobl Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r321825 - in stable/10: . gnu/usr.bin/groff/tmac lib/clang sys/conf Message-ID: <20170801124050.GG18123@zxy.spb.ru> References: <201707312219.v6VMJdAl069073@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201707312219.v6VMJdAl069073@repo.freebsd.org> 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-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 12:40:59 -0000 On Mon, Jul 31, 2017 at 10:19:39PM +0000, Marius Strobl wrote: > Author: marius > Date: Mon Jul 31 22:19:39 2017 > New Revision: 321825 > URL: https://svnweb.freebsd.org/changeset/base/321825 > > Log: > Update stable/10 from 10.3-STABLE to 10.4-PRERELEASE as part of > the 10.4 release cycle, also belatedly marking the official start > of the code slush. > > Set the default mdoc(7) version to 10.4, and update the clang(1) > TARGET_TRIPLE to reflect 10.4. While at it, add missing FreeBSD > major versions to mdoc(7). > > Approved by: re (implicit) ix netmap code is broken for me in 10-STABLE. Could ypou please test and/or confirm and ask responsible ones to fix this problem before release? https://lists.freebsd.org/pipermail/svn-src-all/2017-June/147797.html From owner-svn-src-stable@freebsd.org Tue Aug 1 12:58:49 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA19ADAB9E0; Tue, 1 Aug 2017 12:58:49 +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 A945E76177; Tue, 1 Aug 2017 12:58:49 +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 v71Cwmhv031228; Tue, 1 Aug 2017 12:58:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71CwmJF031227; Tue, 1 Aug 2017 12:58:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708011258.v71CwmJF031227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 1 Aug 2017 12:58: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: r321867 - stable/11/sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/isp X-SVN-Commit-Revision: 321867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 12:58:50 -0000 Author: mav Date: Tue Aug 1 12:58:48 2017 New Revision: 321867 URL: https://svnweb.freebsd.org/changeset/base/321867 Log: MFC r320492: Polish target_id/target_lun setting for ATIOs/INOTs. For ATIOs it is pointless to report isp_loopid to CAM, since in other places it operates with port database record IDs, not with loop IDs. For INOTs target_id/target_lun seems were never set, so wildcard INOTs probably were not working correctly when LUN IDs were important. Modified: stable/11/sys/dev/isp/isp_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Tue Aug 1 11:51:35 2017 (r321866) +++ stable/11/sys/dev/isp/isp_freebsd.c Tue Aug 1 12:58:48 2017 (r321867) @@ -1608,7 +1608,7 @@ isp_target_putback_atio(union ccb *ccb) } at->at_status = CT_OK; at->at_rxid = cso->tag_id; - at->at_iid = cso->ccb_h.target_id; + at->at_iid = cso->init_id; if (isp_target_put_entry(isp, at)) { callout_reset(&PISP_PCMD(ccb)->wdog, 10, isp_refire_putback_atio, ccb); @@ -1693,7 +1693,7 @@ isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t atp->state = ATPD_STATE_ATIO; SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, atiop->ccb_h.path, "Take FREE ATIO\n"); - atiop->ccb_h.target_id = fcp->isp_loopid; + atiop->ccb_h.target_id = ISP_MAX_TARGETS(isp); atiop->ccb_h.target_lun = lun; /* @@ -1872,7 +1872,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, atiop->ccb_h.path, "Take FREE ATIO\n"); atiop->init_id = FC_PORTDB_TGT(isp, chan, lp); - atiop->ccb_h.target_id = FCPARAM(isp, chan)->isp_loopid; + atiop->ccb_h.target_id = ISP_MAX_TARGETS(isp); atiop->ccb_h.target_lun = lun; atiop->sense_len = 0; cdbxlen = aep->at_cmnd.fcp_cmnd_alen_datadir >> FCP_CMND_ADDTL_CDBLEN_SHIFT; @@ -2357,6 +2357,8 @@ isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_no goto bad; } + inot->ccb_h.target_id = ISP_MAX_TARGETS(isp); + inot->ccb_h.target_lun = lun; if (isp_find_pdb_by_portid(isp, notify->nt_channel, notify->nt_sid, &lp) == 0 && isp_find_pdb_by_handle(isp, notify->nt_channel, notify->nt_nphdl, &lp) == 0) { inot->initiator_id = CAM_TARGET_WILDCARD; From owner-svn-src-stable@freebsd.org Tue Aug 1 12:59:38 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F19BCDABA59; Tue, 1 Aug 2017 12:59:38 +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 BE6AE762A7; Tue, 1 Aug 2017 12:59:38 +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 v71CxbnR031313; Tue, 1 Aug 2017 12:59:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71Cxb50031311; Tue, 1 Aug 2017 12:59:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708011259.v71Cxb50031311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 1 Aug 2017 12:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321868 - stable/11/sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/isp X-SVN-Commit-Revision: 321868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 12:59:39 -0000 Author: mav Date: Tue Aug 1 12:59:37 2017 New Revision: 321868 URL: https://svnweb.freebsd.org/changeset/base/321868 Log: MFC r320574: Slightly unify SNS requests for post- and pre-24xx. Modified: stable/11/sys/dev/isp/isp.c stable/11/sys/dev/isp/ispmbox.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Tue Aug 1 12:58:48 2017 (r321867) +++ stable/11/sys/dev/isp/isp.c Tue Aug 1 12:59:37 2017 (r321868) @@ -117,13 +117,11 @@ static uint64_t isp_get_wwn(ispsoftc_t *, int, int, in static int isp_fclink_test(ispsoftc_t *, int, int); static int isp_pdb_sync(ispsoftc_t *, int); static int isp_scan_loop(ispsoftc_t *, int); -static int isp_gid_ft_sns(ispsoftc_t *, int); -static int isp_gid_ft_ct_passthru(ispsoftc_t *, int); +static int isp_gid_ft(ispsoftc_t *, int); static int isp_scan_fabric(ispsoftc_t *, int); static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *); static int isp_send_change_request(ispsoftc_t *, int); static int isp_register_fc4_type(ispsoftc_t *, int); -static int isp_register_fc4_type_24xx(ispsoftc_t *, int); static int isp_register_fc4_features_24xx(ispsoftc_t *, int); static int isp_register_port_name_24xx(ispsoftc_t *, int); static int isp_register_node_name_24xx(ispsoftc_t *, int); @@ -3042,7 +3040,7 @@ isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay if (IS_24XX(isp)) { fcp->isp_fabric_params = mbs.param[7]; fcp->isp_sns_hdl = NPH_SNS_ID; - r = isp_register_fc4_type_24xx(isp, chan); + r = isp_register_fc4_type(isp, chan); if (fcp->isp_loopstate < LOOP_TESTING_LINK) goto abort; if (r != 0) @@ -3417,40 +3415,17 @@ abort: #define NGENT ((GIDLEN - 16) >> 2) static int -isp_gid_ft_sns(ispsoftc_t *isp, int chan) +isp_ct_sns(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt) { - union { - sns_gid_ft_req_t _x; - uint8_t _y[SNS_GID_FT_REQ_SIZE]; - } un; fcparam *fcp = FCPARAM(isp, chan); - sns_gid_ft_req_t *rq = &un._x; - uint8_t *scp = fcp->isp_scratch; mbreg_t mbs; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT via SNS", chan); - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT SNS request", cmd_bcnt, fcp->isp_scratch); + MEMORYBARRIER(isp, SYNC_SFORDEV, 0, cmd_bcnt, chan); - ISP_MEMZERO(rq, SNS_GID_FT_REQ_SIZE); - rq->snscb_rblen = GIDLEN >> 1; - rq->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma); - rq->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma); - rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma); - rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma); - rq->snscb_sblen = 6; - rq->snscb_cmd = SNS_GID_FT; - rq->snscb_mword_div_2 = NGENT; - rq->snscb_fc4_type = FC4_SCSI; - - isp_put_gid_ft_request(isp, rq, (sns_gid_ft_req_t *)scp); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE, chan); - MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 10000000); - mbs.param[0] = MBOX_SEND_SNS; - mbs.param[1] = SNS_GID_FT_REQ_SIZE >> 1; + mbs.param[1] = cmd_bcnt >> 1; mbs.param[2] = DMA_WD1(fcp->isp_scdma); mbs.param[3] = DMA_WD0(fcp->isp_scdma); mbs.param[6] = DMA_WD3(fcp->isp_scdma); @@ -3463,12 +3438,10 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan) return (-1); } } - MEMORYBARRIER(isp, SYNC_SFORCPU, 0, GIDLEN, chan); + + MEMORYBARRIER(isp, SYNC_SFORCPU, 0, rsp_bcnt, chan); if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_bytes(isp, "CT response", GIDLEN, scp); - isp_get_gid_ft_response(isp, (sns_gid_ft_rsp_t *)scp, - (sns_gid_ft_rsp_t *)fcp->isp_scanscratch, NGENT); - FC_SCRATCH_RELEASE(isp, chan); + isp_print_bytes(isp, "CT response", rsp_bcnt, fcp->isp_scratch); return (0); } @@ -3480,6 +3453,9 @@ isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cm void *reqp; uint8_t resp[QENTRY_LEN]; + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT request", cmd_bcnt, fcp->isp_scratch); + /* * Build a Passthrough IOCB in memory. */ @@ -3538,47 +3514,63 @@ isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cm return (-1); } + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "CT response", rsp_bcnt, fcp->isp_scratch); + return (0); } static int -isp_gid_ft_ct_passthru(ispsoftc_t *isp, int chan) +isp_gid_ft(ispsoftc_t *isp, int chan) { fcparam *fcp = FCPARAM(isp, chan); ct_hdr_t ct; + sns_gid_ft_req_t rq; uint32_t *rp; uint8_t *scp = fcp->isp_scratch; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT via CT", chan); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT", chan); if (FC_SCRATCH_ACQUIRE(isp, chan)) { isp_prt(isp, ISP_LOGERR, sacq); return (-1); } - /* - * Build the CT header and command in memory. - */ - ISP_MEMZERO(&ct, sizeof (ct)); - ct.ct_revision = CT_REVISION; - ct.ct_fcs_type = CT_FC_TYPE_FC; - ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS; - ct.ct_cmd_resp = SNS_GID_FT; - ct.ct_bcnt_resid = (GIDLEN - 16) >> 2; - isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp); - rp = (uint32_t *) &scp[sizeof(ct)]; - ISP_IOZPUT_32(isp, FC4_SCSI, rp); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "CT request", - sizeof(ct) + sizeof(uint32_t), scp); - } + if (IS_24XX(isp)) { + /* Build the CT command and execute via pass-through. */ + ISP_MEMZERO(&ct, sizeof (ct)); + ct.ct_revision = CT_REVISION; + ct.ct_fcs_type = CT_FC_TYPE_FC; + ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS; + ct.ct_cmd_resp = SNS_GID_FT; + ct.ct_bcnt_resid = (GIDLEN - 16) >> 2; + isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp); + rp = (uint32_t *) &scp[sizeof(ct)]; + ISP_IOZPUT_32(isp, FC4_SCSI, rp); - if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) { - FC_SCRATCH_RELEASE(isp, chan); - return (-1); + if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) { + FC_SCRATCH_RELEASE(isp, chan); + return (-1); + } + } else { + /* Build the SNS request and execute via firmware. */ + ISP_MEMZERO(&rq, SNS_GID_FT_REQ_SIZE); + rq.snscb_rblen = GIDLEN >> 1; + rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma); + rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma); + rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma); + rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma); + rq.snscb_sblen = 6; + rq.snscb_cmd = SNS_GID_FT; + rq.snscb_mword_div_2 = NGENT; + rq.snscb_fc4_type = FC4_SCSI; + isp_put_gid_ft_request(isp, &rq, (sns_gid_ft_req_t *)scp); + + if (isp_ct_sns(isp, chan, sizeof(rq), NGENT)) { + FC_SCRATCH_RELEASE(isp, chan); + return (-1); + } } - if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_bytes(isp, "CT response", GIDLEN, scp); isp_get_gid_ft_response(isp, (sns_gid_ft_rsp_t *)scp, (sns_gid_ft_rsp_t *)fcp->isp_scanscratch, NGENT); FC_SCRATCH_RELEASE(isp, chan); @@ -3635,10 +3627,7 @@ fail: } /* Get list of port IDs from SNS. */ - if (IS_24XX(isp)) - r = isp_gid_ft_ct_passthru(isp, chan); - else - r = isp_gid_ft_sns(isp, chan); + r = isp_gid_ft(isp, chan); if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; if (r > 0) { @@ -3918,50 +3907,10 @@ static int isp_register_fc4_type(ispsoftc_t *isp, int chan) { fcparam *fcp = FCPARAM(isp, chan); + rft_id_t rp; + ct_hdr_t *ct = &rp.rftid_hdr; uint8_t local[SNS_RFT_ID_REQ_SIZE]; sns_screq_t *reqp = (sns_screq_t *) local; - mbreg_t mbs; - - ISP_MEMZERO((void *) reqp, SNS_RFT_ID_REQ_SIZE); - reqp->snscb_rblen = SNS_RFT_ID_RESP_SIZE >> 1; - reqp->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma + 0x100); - reqp->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma + 0x100); - reqp->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma + 0x100); - reqp->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma + 0x100); - reqp->snscb_sblen = 22; - reqp->snscb_data[0] = SNS_RFT_ID; - reqp->snscb_data[4] = fcp->isp_portid & 0xffff; - reqp->snscb_data[5] = (fcp->isp_portid >> 16) & 0xff; - reqp->snscb_data[6] = (1 << FC4_SCSI); - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } - isp_put_sns_request(isp, reqp, (sns_screq_t *) fcp->isp_scratch); - MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 1000000); - mbs.param[1] = SNS_RFT_ID_REQ_SIZE >> 1; - mbs.param[2] = DMA_WD1(fcp->isp_scdma); - mbs.param[3] = DMA_WD0(fcp->isp_scdma); - mbs.param[6] = DMA_WD3(fcp->isp_scdma); - mbs.param[7] = DMA_WD2(fcp->isp_scdma); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_RFT_ID_REQ_SIZE, chan); - isp_mboxcmd(isp, &mbs); - FC_SCRATCH_RELEASE(isp, chan); - if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { - return (0); - } else { - isp_prt(isp, ISP_LOGWARN, "Chan %d Register FC4 Type: 0x%x", - chan, mbs.param[0]); - return (-1); - } -} - -static int -isp_register_fc4_type_24xx(ispsoftc_t *isp, int chan) -{ - fcparam *fcp = FCPARAM(isp, chan); - ct_hdr_t *ct; - rft_id_t rp; uint8_t *scp = fcp->isp_scratch; if (FC_SCRATCH_ACQUIRE(isp, chan)) { @@ -3969,27 +3918,43 @@ isp_register_fc4_type_24xx(ispsoftc_t *isp, int chan) return (-1); } - /* - * Build the CT header and command in memory. - */ - ISP_MEMZERO(&rp, sizeof(rp)); - ct = &rp.rftid_hdr; - ct->ct_revision = CT_REVISION; - ct->ct_fcs_type = CT_FC_TYPE_FC; - ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS; - ct->ct_cmd_resp = SNS_RFT_ID; - ct->ct_bcnt_resid = (sizeof (rft_id_t) - sizeof (ct_hdr_t)) >> 2; - rp.rftid_portid[0] = fcp->isp_portid >> 16; - rp.rftid_portid[1] = fcp->isp_portid >> 8; - rp.rftid_portid[2] = fcp->isp_portid; - rp.rftid_fc4types[FC4_SCSI >> 5] = 1 << (FC4_SCSI & 0x1f); - isp_put_rft_id(isp, &rp, (rft_id_t *)scp); - if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_bytes(isp, "CT request", sizeof(rft_id_t), scp); + if (IS_24XX(isp)) { + /* Build the CT command and execute via pass-through. */ + ISP_MEMZERO(&rp, sizeof(rp)); + ct->ct_revision = CT_REVISION; + ct->ct_fcs_type = CT_FC_TYPE_FC; + ct->ct_fcs_subtype = CT_FC_SUBTYPE_NS; + ct->ct_cmd_resp = SNS_RFT_ID; + ct->ct_bcnt_resid = (sizeof (rft_id_t) - sizeof (ct_hdr_t)) >> 2; + rp.rftid_portid[0] = fcp->isp_portid >> 16; + rp.rftid_portid[1] = fcp->isp_portid >> 8; + rp.rftid_portid[2] = fcp->isp_portid; + rp.rftid_fc4types[FC4_SCSI >> 5] = 1 << (FC4_SCSI & 0x1f); + isp_put_rft_id(isp, &rp, (rft_id_t *)scp); - if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) { - FC_SCRATCH_RELEASE(isp, chan); - return (-1); + if (isp_ct_passthru(isp, chan, sizeof(rft_id_t), sizeof(ct_hdr_t))) { + FC_SCRATCH_RELEASE(isp, chan); + return (-1); + } + } else { + /* Build the SNS request and execute via firmware. */ + ISP_MEMZERO((void *) reqp, SNS_RFT_ID_REQ_SIZE); + reqp->snscb_rblen = sizeof (ct_hdr_t) >> 1; + reqp->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma); + reqp->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma); + reqp->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma); + reqp->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma); + reqp->snscb_sblen = 22; + reqp->snscb_data[0] = SNS_RFT_ID; + reqp->snscb_data[4] = fcp->isp_portid & 0xffff; + reqp->snscb_data[5] = (fcp->isp_portid >> 16) & 0xff; + reqp->snscb_data[6] = (1 << FC4_SCSI); + isp_put_sns_request(isp, reqp, (sns_screq_t *)scp); + + if (isp_ct_sns(isp, chan, SNS_RFT_ID_REQ_SIZE, sizeof(ct_hdr_t))) { + FC_SCRATCH_RELEASE(isp, chan); + return (-1); + } } isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); @@ -4105,8 +4070,6 @@ isp_register_port_name_24xx(ispsoftc_t *isp, int chan) len += rp.rspnid_length; ct->ct_bcnt_resid = (len - sizeof(ct_hdr_t)) >> 2; isp_put_rspn_id(isp, &rp, (rspn_id_t *)scp); - if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_bytes(isp, "CT request", len, scp); if (isp_ct_passthru(isp, chan, len, sizeof(ct_hdr_t))) { FC_SCRATCH_RELEASE(isp, chan); @@ -4163,8 +4126,6 @@ isp_register_node_name_24xx(ispsoftc_t *isp, int chan) len += rp.rsnnnn_length; ct->ct_bcnt_resid = (len - sizeof(ct_hdr_t)) >> 2; isp_put_rsnn_nn(isp, &rp, (rsnn_nn_t *)scp); - if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_bytes(isp, "CT request", len, scp); if (isp_ct_passthru(isp, chan, len, sizeof(ct_hdr_t))) { FC_SCRATCH_RELEASE(isp, chan); Modified: stable/11/sys/dev/isp/ispmbox.h ============================================================================== --- stable/11/sys/dev/isp/ispmbox.h Tue Aug 1 12:58:48 2017 (r321867) +++ stable/11/sys/dev/isp/ispmbox.h Tue Aug 1 12:59:37 2017 (r321868) @@ -1553,6 +1553,7 @@ typedef struct { #define SNS_GNN_ID 0x113 #define SNS_GFF_ID 0x11F #define SNS_GID_FT 0x171 +#define SNS_GID_PT 0x1A1 #define SNS_RFT_ID 0x217 #define SNS_RSPN_ID 0x218 #define SNS_RFF_ID 0x21F @@ -1667,7 +1668,6 @@ typedef struct { } snscb_ports[1]; } sns_gid_ft_rsp_t; #define SNS_GID_FT_RESP_SIZE(x) ((sizeof (sns_gid_ft_rsp_t)) + ((x - 1) << 2)) -#define SNS_RFT_ID_RESP_SIZE (sizeof (ct_hdr_t)) /* * Other Misc Structures From owner-svn-src-stable@freebsd.org Tue Aug 1 13:00:14 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E24CDABAFD; Tue, 1 Aug 2017 13:00: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 4C90F763E4; Tue, 1 Aug 2017 13:00:14 +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 v71D0Dhd031435; Tue, 1 Aug 2017 13:00:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71D0DaG031434; Tue, 1 Aug 2017 13:00:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708011300.v71D0DaG031434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 1 Aug 2017 13:00: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: r321869 - stable/11/sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/isp X-SVN-Commit-Revision: 321869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 13:00:14 -0000 Author: mav Date: Tue Aug 1 13:00:13 2017 New Revision: 321869 URL: https://svnweb.freebsd.org/changeset/base/321869 Log: MFC r320575: Move comment respecting previous commit. Modified: stable/11/sys/dev/isp/isp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Tue Aug 1 12:59:37 2017 (r321868) +++ stable/11/sys/dev/isp/isp.c Tue Aug 1 13:00:13 2017 (r321869) @@ -3401,19 +3401,6 @@ abort: return (0); } -/* - * Scan the fabric for devices and add them to our port database. - * - * Use the GID_FT command to get all Port IDs for FC4 SCSI devices it knows. - * - * For 2100-23XX cards, we use the SNS mailbox command to pass simple name - * server commands to the switch management server via the QLogic f/w. - * - * For the 24XX and above card, we use CT Pass-through IOCB. - */ -#define GIDLEN ISP_FC_SCRLEN -#define NGENT ((GIDLEN - 16) >> 2) - static int isp_ct_sns(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt) { @@ -3519,6 +3506,19 @@ isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cm return (0); } + +/* + * Scan the fabric for devices and add them to our port database. + * + * Use the GID_FT command to get all Port IDs for FC4 SCSI devices it knows. + * + * For 2100-23XX cards, we use the SNS mailbox command to pass simple name + * server commands to the switch management server via the QLogic f/w. + * + * For the 24XX and above card, we use CT Pass-through IOCB. + */ +#define GIDLEN ISP_FC_SCRLEN +#define NGENT ((GIDLEN - 16) >> 2) static int isp_gid_ft(ispsoftc_t *isp, int chan) From owner-svn-src-stable@freebsd.org Tue Aug 1 13:03:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88094DABDE3; Tue, 1 Aug 2017 13:03:08 +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 40A6476A37; Tue, 1 Aug 2017 13:03:08 +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 v71D378K035296; Tue, 1 Aug 2017 13:03:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71D36Ko035289; Tue, 1 Aug 2017 13:03:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708011303.v71D36Ko035289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 1 Aug 2017 13:03: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: r321870 - in stable/11: share/man/man4 sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/isp X-SVN-Commit-Revision: 321870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 13:03:08 -0000 Author: mav Date: Tue Aug 1 13:03:06 2017 New Revision: 321870 URL: https://svnweb.freebsd.org/changeset/base/321870 Log: MFC r320604, r320865: Switch fabric scans from GID_FT to GID_PT+GFF_ID/GFT_ID. Instead of using GID_FT SNS request to get list of registered FCP ports, use GID_PT to get list of all Nx_Ports, and then use GFF_ID and/or GFT_ID requests to find whether they are FCP and target capable. The problem with old approach is that GID_FT does not report ports without FC-4 type registered. In particular it was impossible to boot OS from FreeBSD FC target using QLogic FC BIOS, since one does not register FC-4 type even on new cards and so ignored by old code as incompatible. As a side bonus this allows initiator to skip pointless logins to other initiators by fetching that information from SNS instead. In case some switches do not implement GFF_ID/GFT_ID correctly, add sysctls to disable that functionality. I handled broken GFF_ID of my Brocade 200E, but there may be other switches with different bugs. Linux also uses GID_PT, but GFF_ID is disabled by default there, and GFT_ID is not supported. Sponsored by: iXsystems, Inc. Modified: stable/11/share/man/man4/isp.4 stable/11/sys/dev/isp/isp.c stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_library.c stable/11/sys/dev/isp/isp_library.h stable/11/sys/dev/isp/ispmbox.h stable/11/sys/dev/isp/ispvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/isp.4 ============================================================================== --- stable/11/share/man/man4/isp.4 Tue Aug 1 13:00:13 2017 (r321869) +++ stable/11/share/man/man4/isp.4 Tue Aug 1 13:03:06 2017 (r321870) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2009-2015 Alexander Motin +.\" Copyright (c) 2009-2017 Alexander Motin .\" Copyright (c) 2006 Marcus Alves Grando .\" Copyright (c) 1998-2001 Matthew Jacob, for NASA/Ames Research Center .\" @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 20, 2016 +.Dd July 3, 2017 .Dt ISP 4 .Os .Sh NAME @@ -221,6 +221,15 @@ This value says how long to wait for devices to reappe disappear due to loop or fabric events. While this timeout is running, I/O to those devices will simply be held. +.It Va dev.isp.N.use_gff_id +.It Va dev.isp.N.use_gft_id +Setting those options to 0 allows to disable use of GFF_ID and GFT_ID SNS +requests during FC fabric scan. +It may be useful if switch does not implement them correctly, +preventing some devices from being found. +Disabling them may cause unneeded logins to ports not supporting target role +or even FCP at all. +The default is 1 (enabled). .It Va dev.isp.N.wwnn This is the readonly World Wide Node Name value for this port. .It Va dev.isp.N.wwpn @@ -239,7 +248,7 @@ The driver was written by .An Matthew Jacob originally for NetBSD at NASA/Ames Research Center. -Some later improvement was done by +Later improvement was done by .An Alexander Motin Aq Mt mav@FreeBSD.org . .Sh BUGS The driver currently ignores some NVRAM settings. Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Tue Aug 1 13:00:13 2017 (r321869) +++ stable/11/sys/dev/isp/isp.c Tue Aug 1 13:03:06 2017 (r321870) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2009-2017 Alexander Motin * Copyright (c) 1997-2009 by Matthew Jacob * All rights reserved. * @@ -117,7 +118,7 @@ static uint64_t isp_get_wwn(ispsoftc_t *, int, int, in static int isp_fclink_test(ispsoftc_t *, int, int); static int isp_pdb_sync(ispsoftc_t *, int); static int isp_scan_loop(ispsoftc_t *, int); -static int isp_gid_ft(ispsoftc_t *, int); +static int isp_gid_pt(ispsoftc_t *, int); static int isp_scan_fabric(ispsoftc_t *, int); static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *); static int isp_send_change_request(ispsoftc_t *, int); @@ -3496,7 +3497,7 @@ isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cm isp_get_ct_pt(isp, (isp_ct_pt_t *)resp, &pt); if (pt.ctp_status && pt.ctp_status != RQCS_DATA_UNDERRUN) { isp_prt(isp, ISP_LOGWARN, - "Chan %d GID_FT CT Passthrough returned 0x%x", + "Chan %d CT pass-through returned 0x%x", chan, pt.ctp_status); return (-1); } @@ -3510,7 +3511,8 @@ isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cm /* * Scan the fabric for devices and add them to our port database. * - * Use the GID_FT command to get all Port IDs for FC4 SCSI devices it knows. + * Use the GID_PT command to get list of all Nx_Port IDs SNS knows. + * Use GFF_ID and GFT_ID to check port type (FCP) and features (target). * * For 2100-23XX cards, we use the SNS mailbox command to pass simple name * server commands to the switch management server via the QLogic f/w. @@ -3521,15 +3523,14 @@ isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cm #define NGENT ((GIDLEN - 16) >> 2) static int -isp_gid_ft(ispsoftc_t *isp, int chan) +isp_gid_pt(ispsoftc_t *isp, int chan) { fcparam *fcp = FCPARAM(isp, chan); ct_hdr_t ct; - sns_gid_ft_req_t rq; - uint32_t *rp; + sns_gid_pt_req_t rq; uint8_t *scp = fcp->isp_scratch; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT", chan); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_PT", chan); if (FC_SCRATCH_ACQUIRE(isp, chan)) { isp_prt(isp, ISP_LOGERR, sacq); return (-1); @@ -3541,11 +3542,13 @@ isp_gid_ft(ispsoftc_t *isp, int chan) ct.ct_revision = CT_REVISION; ct.ct_fcs_type = CT_FC_TYPE_FC; ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS; - ct.ct_cmd_resp = SNS_GID_FT; + ct.ct_cmd_resp = SNS_GID_PT; ct.ct_bcnt_resid = (GIDLEN - 16) >> 2; isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp); - rp = (uint32_t *) &scp[sizeof(ct)]; - ISP_IOZPUT_32(isp, FC4_SCSI, rp); + scp[sizeof(ct)] = 0x7f; /* Port Type = Nx_Port */ + scp[sizeof(ct)+1] = 0; /* Domain_ID = any */ + scp[sizeof(ct)+2] = 0; /* Area_ID = any */ + scp[sizeof(ct)+3] = 0; /* Flags = no Area_ID */ if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), GIDLEN)) { FC_SCRATCH_RELEASE(isp, chan); @@ -3553,17 +3556,20 @@ isp_gid_ft(ispsoftc_t *isp, int chan) } } else { /* Build the SNS request and execute via firmware. */ - ISP_MEMZERO(&rq, SNS_GID_FT_REQ_SIZE); + ISP_MEMZERO(&rq, SNS_GID_PT_REQ_SIZE); rq.snscb_rblen = GIDLEN >> 1; rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma); rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma); rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma); rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma); rq.snscb_sblen = 6; - rq.snscb_cmd = SNS_GID_FT; + rq.snscb_cmd = SNS_GID_PT; rq.snscb_mword_div_2 = NGENT; - rq.snscb_fc4_type = FC4_SCSI; - isp_put_gid_ft_request(isp, &rq, (sns_gid_ft_req_t *)scp); + rq.snscb_port_type = 0x7f; /* Port Type = Nx_Port */ + rq.snscb_domain = 0; /* Domain_ID = any */ + rq.snscb_area = 0; /* Area_ID = any */ + rq.snscb_flags = 0; /* Flags = no Area_ID */ + isp_put_gid_pt_request(isp, &rq, (sns_gid_pt_req_t *)scp); if (isp_ct_sns(isp, chan, sizeof(rq), NGENT)) { FC_SCRATCH_RELEASE(isp, chan); @@ -3571,13 +3577,147 @@ isp_gid_ft(ispsoftc_t *isp, int chan) } } - isp_get_gid_ft_response(isp, (sns_gid_ft_rsp_t *)scp, - (sns_gid_ft_rsp_t *)fcp->isp_scanscratch, NGENT); + isp_get_gid_xx_response(isp, (sns_gid_xx_rsp_t *)scp, + (sns_gid_xx_rsp_t *)fcp->isp_scanscratch, NGENT); FC_SCRATCH_RELEASE(isp, chan); return (0); } static int +isp_gff_id(ispsoftc_t *isp, int chan, uint32_t portid) +{ + fcparam *fcp = FCPARAM(isp, chan); + ct_hdr_t ct; + uint32_t *rp; + uint8_t *scp = fcp->isp_scratch; + sns_gff_id_rsp_t rsp; + int i, res = -1; + + if (!fcp->isp_use_gff_id) /* User may block GFF_ID use. */ + return (res); + + if (!IS_24XX(isp)) /* Old chips can't request GFF_ID. */ + return (res); + + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GFF_ID", chan); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (res); + } + + /* Build the CT command and execute via pass-through. */ + ISP_MEMZERO(&ct, sizeof (ct)); + ct.ct_revision = CT_REVISION; + ct.ct_fcs_type = CT_FC_TYPE_FC; + ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS; + ct.ct_cmd_resp = SNS_GFF_ID; + ct.ct_bcnt_resid = (SNS_GFF_ID_RESP_SIZE - sizeof(ct)) / 4; + isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp); + rp = (uint32_t *) &scp[sizeof(ct)]; + ISP_IOZPUT_32(isp, portid, rp); + + if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), + SNS_GFF_ID_RESP_SIZE)) { + FC_SCRATCH_RELEASE(isp, chan); + return (res); + } + + isp_get_gff_id_response(isp, (sns_gff_id_rsp_t *)scp, &rsp); + if (rsp.snscb_cthdr.ct_cmd_resp == LS_ACC) { + for (i = 0; i < 32; i++) { + if (rsp.snscb_fc4_features[i] != 0) { + res = 0; + break; + } + } + if (((rsp.snscb_fc4_features[FC4_SCSI / 8] >> + ((FC4_SCSI % 8) * 4)) & 0x01) != 0) + res = 1; + /* Workaround for broken Brocade firmware. */ + if (((ISP_SWAP32(isp, rsp.snscb_fc4_features[FC4_SCSI / 8]) >> + ((FC4_SCSI % 8) * 4)) & 0x01) != 0) + res = 1; + } + FC_SCRATCH_RELEASE(isp, chan); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d GFF_ID result is %d", chan, res); + return (res); +} + +static int +isp_gft_id(ispsoftc_t *isp, int chan, uint32_t portid) +{ + fcparam *fcp = FCPARAM(isp, chan); + ct_hdr_t ct; + sns_gxx_id_req_t rq; + uint32_t *rp; + uint8_t *scp = fcp->isp_scratch; + sns_gft_id_rsp_t rsp; + int i, res = -1; + + if (!fcp->isp_use_gft_id) /* User may block GFT_ID use. */ + return (res); + + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GFT_ID", chan); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (res); + } + + if (IS_24XX(isp)) { + /* Build the CT command and execute via pass-through. */ + ISP_MEMZERO(&ct, sizeof (ct)); + ct.ct_revision = CT_REVISION; + ct.ct_fcs_type = CT_FC_TYPE_FC; + ct.ct_fcs_subtype = CT_FC_SUBTYPE_NS; + ct.ct_cmd_resp = SNS_GFT_ID; + ct.ct_bcnt_resid = (SNS_GFT_ID_RESP_SIZE - sizeof(ct)) / 4; + isp_put_ct_hdr(isp, &ct, (ct_hdr_t *)scp); + rp = (uint32_t *) &scp[sizeof(ct)]; + ISP_IOZPUT_32(isp, portid, rp); + + if (isp_ct_passthru(isp, chan, sizeof(ct) + sizeof(uint32_t), + SNS_GFT_ID_RESP_SIZE)) { + FC_SCRATCH_RELEASE(isp, chan); + return (res); + } + } else { + /* Build the SNS request and execute via firmware. */ + ISP_MEMZERO(&rq, SNS_GXX_ID_REQ_SIZE); + rq.snscb_rblen = SNS_GFT_ID_RESP_SIZE >> 1; + rq.snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma); + rq.snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma); + rq.snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma); + rq.snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma); + rq.snscb_sblen = 6; + rq.snscb_cmd = SNS_GFT_ID; + rq.snscb_mword_div_2 = (SNS_GFT_ID_RESP_SIZE - sizeof(ct)) / 4; + rq.snscb_portid = portid; + isp_put_gxx_id_request(isp, &rq, (sns_gxx_id_req_t *)scp); + + if (isp_ct_sns(isp, chan, sizeof(rq), SNS_GFT_ID_RESP_SIZE)) { + FC_SCRATCH_RELEASE(isp, chan); + return (res); + } + } + + isp_get_gft_id_response(isp, (sns_gft_id_rsp_t *)scp, &rsp); + if (rsp.snscb_cthdr.ct_cmd_resp == LS_ACC) { + for (i = 0; i < 8; i++) { + if (rsp.snscb_fc4_types[i] != 0) { + res = 0; + break; + } + } + if (((rsp.snscb_fc4_types[FC4_SCSI / 32] >> + (FC4_SCSI % 32)) & 0x01) != 0) + res = 1; + } + FC_SCRATCH_RELEASE(isp, chan); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d GFT_ID result is %d", chan, res); + return (res); +} + +static int isp_scan_fabric(ispsoftc_t *isp, int chan) { fcparam *fcp = FCPARAM(isp, chan); @@ -3586,7 +3726,7 @@ isp_scan_fabric(ispsoftc_t *isp, int chan) uint16_t nphdl; isp_pdb_t pdb; int portidx, portlim, r; - sns_gid_ft_rsp_t *rs; + sns_gid_xx_rsp_t *rs; if (fcp->isp_loopstate < LOOP_LSCAN_DONE) return (-1); @@ -3627,7 +3767,7 @@ fail: } /* Get list of port IDs from SNS. */ - r = isp_gid_ft(isp, chan); + r = isp_gid_pt(isp, chan); if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; if (r > 0) { @@ -3638,17 +3778,20 @@ fail: return (-1); } - rs = (sns_gid_ft_rsp_t *) fcp->isp_scanscratch; + rs = (sns_gid_xx_rsp_t *) fcp->isp_scanscratch; if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; if (rs->snscb_cthdr.ct_cmd_resp != LS_ACC) { int level; - if (rs->snscb_cthdr.ct_reason == 9 && rs->snscb_cthdr.ct_explanation == 7) { + /* FC-4 Type and Port Type not registered are not errors. */ + if (rs->snscb_cthdr.ct_reason == 9 && + (rs->snscb_cthdr.ct_explanation == 0x07 || + rs->snscb_cthdr.ct_explanation == 0x0a)) { level = ISP_LOG_SANCFG; } else { level = ISP_LOGWARN; } - isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_FT" + isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_PT" " (Reason=0x%x Expl=0x%x)", chan, rs->snscb_cthdr.ct_reason, rs->snscb_cthdr.ct_explanation); @@ -3777,6 +3920,20 @@ relogin: if ((fcp->role & ISP_ROLE_INITIATOR) == 0) { isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Port 0x%06x is not logged in", chan, portid); + continue; + } + + r = isp_gff_id(isp, chan, portid); + if (r == 0) { + isp_prt(isp, ISP_LOG_SANCFG, + "Chan %d Port 0x%06x is not an FCP target", chan, portid); + continue; + } + if (r < 0) + r = isp_gft_id(isp, chan, portid); + if (r == 0) { + isp_prt(isp, ISP_LOG_SANCFG, + "Chan %d Port 0x%06x is not FCP", chan, portid); continue; } Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Tue Aug 1 13:00:13 2017 (r321869) +++ stable/11/sys/dev/isp/isp_freebsd.c Tue Aug 1 13:03:06 2017 (r321870) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2009-2017 Alexander Motin * Copyright (c) 1997-2009 by Matthew Jacob * All rights reserved. * @@ -169,6 +170,8 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq fc->path = path; fc->isp = isp; fc->ready = 1; + fcp->isp_use_gft_id = 1; + fcp->isp_use_gff_id = 1; callout_init_mtx(&fc->gdt, &isp->isp_lock, 0); TASK_INIT(&fc->gtask, 1, isp_gdt_task, fc); @@ -235,6 +238,12 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "topo", CTLFLAG_RD, &fcp->isp_topo, 0, "Connection topology"); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "use_gft_id", CTLFLAG_RWTUN, &fcp->isp_use_gft_id, 0, + "Use GFT_ID during fabric scan"); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "use_gff_id", CTLFLAG_RWTUN, &fcp->isp_use_gff_id, 0, + "Use GFF_ID during fabric scan"); } return (0); } Modified: stable/11/sys/dev/isp/isp_library.c ============================================================================== --- stable/11/sys/dev/isp/isp_library.c Tue Aug 1 13:00:13 2017 (r321869) +++ stable/11/sys/dev/isp/isp_library.c Tue Aug 1 13:03:06 2017 (r321870) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2009-2017 Alexander Motin * Copyright (c) 1997-2009 by Matthew Jacob * All rights reserved. * @@ -1742,7 +1743,7 @@ isp_put_gid_ft_request(ispsoftc_t *isp, sns_gid_ft_req } void -isp_put_gxn_id_request(ispsoftc_t *isp, sns_gxn_id_req_t *src, sns_gxn_id_req_t *dst) +isp_put_gid_pt_request(ispsoftc_t *isp, sns_gid_pt_req_t *src, sns_gid_pt_req_t *dst) { ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen); ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0); @@ -1753,48 +1754,46 @@ isp_put_gxn_id_request(ispsoftc_t *isp, sns_gxn_id_req ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen); ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1); ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd); - ISP_IOXPUT_16(isp, src->snscb_reserved2, &dst->snscb_reserved2); + ISP_IOXPUT_16(isp, src->snscb_mword_div_2, &dst->snscb_mword_div_2); ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3); - ISP_IOXPUT_32(isp, src->snscb_portid, &dst->snscb_portid); + ISP_IOXPUT_8(isp, src->snscb_port_type, &dst->snscb_port_type); + ISP_IOXPUT_8(isp, src->snscb_domain, &dst->snscb_domain); + ISP_IOXPUT_8(isp, src->snscb_area, &dst->snscb_area); + ISP_IOXPUT_8(isp, src->snscb_flags, &dst->snscb_flags); } -/* - * Generic SNS response - not particularly useful since the per-command data - * isn't always 16 bit words. - */ void -isp_get_sns_response(ispsoftc_t *isp, sns_scrsp_t *src, sns_scrsp_t *dst, int nwords) +isp_put_gxx_id_request(ispsoftc_t *isp, sns_gxx_id_req_t *src, sns_gxx_id_req_t *dst) { - int i; - isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); - ISP_IOXGET_8(isp, &src->snscb_port_type, dst->snscb_port_type); - for (i = 0; i < 3; i++) { - ISP_IOXGET_8(isp, &src->snscb_port_id[i], - dst->snscb_port_id[i]); - } - for (i = 0; i < 8; i++) { - ISP_IOXGET_8(isp, &src->snscb_portname[i], - dst->snscb_portname[i]); - } - for (i = 0; i < nwords; i++) { - ISP_IOXGET_16(isp, &src->snscb_data[i], dst->snscb_data[i]); - } + ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen); + ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0); + ISP_IOXPUT_16(isp, src->snscb_addr[0], &dst->snscb_addr[0]); + ISP_IOXPUT_16(isp, src->snscb_addr[1], &dst->snscb_addr[1]); + ISP_IOXPUT_16(isp, src->snscb_addr[2], &dst->snscb_addr[2]); + ISP_IOXPUT_16(isp, src->snscb_addr[3], &dst->snscb_addr[3]); + ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen); + ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1); + ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd); + ISP_IOXPUT_16(isp, src->snscb_mword_div_2, &dst->snscb_mword_div_2); + ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3); + ISP_IOXPUT_32(isp, src->snscb_portid, &dst->snscb_portid); } void -isp_get_gid_ft_response(ispsoftc_t *isp, sns_gid_ft_rsp_t *src, sns_gid_ft_rsp_t *dst, int nwords) +isp_get_gid_xx_response(ispsoftc_t *isp, sns_gid_xx_rsp_t *src, sns_gid_xx_rsp_t *dst, int nwords) { - int i; + int i, j; + isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); for (i = 0; i < nwords; i++) { - int j; - ISP_IOXGET_8(isp, &src->snscb_ports[i].control, dst->snscb_ports[i].control); + ISP_IOZGET_8(isp, &src->snscb_ports[i].control, + dst->snscb_ports[i].control); for (j = 0; j < 3; j++) { - ISP_IOXGET_8(isp, &src->snscb_ports[i].portid[j], dst->snscb_ports[i].portid[j]); + ISP_IOZGET_8(isp, &src->snscb_ports[i].portid[j], + dst->snscb_ports[i].portid[j]); } - if (dst->snscb_ports[i].control & 0x80) { + if (dst->snscb_ports[i].control & 0x80) break; - } } } @@ -1802,9 +1801,21 @@ void isp_get_gxn_id_response(ispsoftc_t *isp, sns_gxn_id_rsp_t *src, sns_gxn_id_rsp_t *dst) { int i; + isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); + for (i = 0; i < 8; i++) + ISP_IOZGET_8(isp, &src->snscb_wwn[i], dst->snscb_wwn[i]); +} + +void +isp_get_gft_id_response(ispsoftc_t *isp, sns_gft_id_rsp_t *src, sns_gft_id_rsp_t *dst) +{ + int i; + + isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); for (i = 0; i < 8; i++) { - ISP_IOXGET_8(isp, &src->snscb_wwn[i], dst->snscb_wwn[i]); + ISP_IOZGET_32(isp, &src->snscb_fc4_types[i], + dst->snscb_fc4_types[i]); } } @@ -1812,9 +1823,11 @@ void isp_get_gff_id_response(ispsoftc_t *isp, sns_gff_id_rsp_t *src, sns_gff_id_rsp_t *dst) { int i; + isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); for (i = 0; i < 32; i++) { - ISP_IOXGET_32(isp, &src->snscb_fc4_features[i], dst->snscb_fc4_features[i]); + ISP_IOZGET_32(isp, &src->snscb_fc4_features[i], + dst->snscb_fc4_features[i]); } } @@ -1823,42 +1836,42 @@ isp_get_ga_nxt_response(ispsoftc_t *isp, sns_ga_nxt_rs { int i; isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); - ISP_IOXGET_8(isp, &src->snscb_port_type, dst->snscb_port_type); + ISP_IOZGET_8(isp, &src->snscb_port_type, dst->snscb_port_type); for (i = 0; i < 3; i++) { - ISP_IOXGET_8(isp, &src->snscb_port_id[i], dst->snscb_port_id[i]); + ISP_IOZGET_8(isp, &src->snscb_port_id[i], dst->snscb_port_id[i]); } for (i = 0; i < 8; i++) { - ISP_IOXGET_8(isp, &src->snscb_portname[i], dst->snscb_portname[i]); + ISP_IOZGET_8(isp, &src->snscb_portname[i], dst->snscb_portname[i]); } - ISP_IOXGET_8(isp, &src->snscb_pnlen, dst->snscb_pnlen); + ISP_IOZGET_8(isp, &src->snscb_pnlen, dst->snscb_pnlen); for (i = 0; i < 255; i++) { - ISP_IOXGET_8(isp, &src->snscb_pname[i], dst->snscb_pname[i]); + ISP_IOZGET_8(isp, &src->snscb_pname[i], dst->snscb_pname[i]); } for (i = 0; i < 8; i++) { - ISP_IOXGET_8(isp, &src->snscb_nodename[i], dst->snscb_nodename[i]); + ISP_IOZGET_8(isp, &src->snscb_nodename[i], dst->snscb_nodename[i]); } - ISP_IOXGET_8(isp, &src->snscb_nnlen, dst->snscb_nnlen); + ISP_IOZGET_8(isp, &src->snscb_nnlen, dst->snscb_nnlen); for (i = 0; i < 255; i++) { - ISP_IOXGET_8(isp, &src->snscb_nname[i], dst->snscb_nname[i]); + ISP_IOZGET_8(isp, &src->snscb_nname[i], dst->snscb_nname[i]); } for (i = 0; i < 8; i++) { - ISP_IOXGET_8(isp, &src->snscb_ipassoc[i], dst->snscb_ipassoc[i]); + ISP_IOZGET_8(isp, &src->snscb_ipassoc[i], dst->snscb_ipassoc[i]); } for (i = 0; i < 16; i++) { - ISP_IOXGET_8(isp, &src->snscb_ipaddr[i], dst->snscb_ipaddr[i]); + ISP_IOZGET_8(isp, &src->snscb_ipaddr[i], dst->snscb_ipaddr[i]); } for (i = 0; i < 4; i++) { - ISP_IOXGET_8(isp, &src->snscb_svc_class[i], dst->snscb_svc_class[i]); + ISP_IOZGET_8(isp, &src->snscb_svc_class[i], dst->snscb_svc_class[i]); } for (i = 0; i < 32; i++) { - ISP_IOXGET_8(isp, &src->snscb_fc4_types[i], dst->snscb_fc4_types[i]); + ISP_IOZGET_8(isp, &src->snscb_fc4_types[i], dst->snscb_fc4_types[i]); } for (i = 0; i < 8; i++) { - ISP_IOXGET_8(isp, &src->snscb_fpname[i], dst->snscb_fpname[i]); + ISP_IOZGET_8(isp, &src->snscb_fpname[i], dst->snscb_fpname[i]); } - ISP_IOXGET_8(isp, &src->snscb_reserved, dst->snscb_reserved); + ISP_IOZGET_8(isp, &src->snscb_reserved, dst->snscb_reserved); for (i = 0; i < 3; i++) { - ISP_IOXGET_8(isp, &src->snscb_hardaddr[i], dst->snscb_hardaddr[i]); + ISP_IOZGET_8(isp, &src->snscb_hardaddr[i], dst->snscb_hardaddr[i]); } } Modified: stable/11/sys/dev/isp/isp_library.h ============================================================================== --- stable/11/sys/dev/isp/isp_library.h Tue Aug 1 13:00:13 2017 (r321869) +++ stable/11/sys/dev/isp/isp_library.h Tue Aug 1 13:03:06 2017 (r321870) @@ -1,5 +1,6 @@ /* $FreeBSD$ */ /*- + * Copyright (c) 2009-2017 Alexander Motin * Copyright (c) 1997-2009 by Matthew Jacob * All rights reserved. * @@ -127,10 +128,11 @@ void isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp void isp_put_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *); void isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *); void isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *, sns_gid_ft_req_t *); -void isp_put_gxn_id_request(ispsoftc_t *, sns_gxn_id_req_t *, sns_gxn_id_req_t *); -void isp_get_sns_response(ispsoftc_t *, sns_scrsp_t *, sns_scrsp_t *, int); -void isp_get_gid_ft_response(ispsoftc_t *, sns_gid_ft_rsp_t *, sns_gid_ft_rsp_t *, int); +void isp_put_gid_pt_request(ispsoftc_t *, sns_gid_pt_req_t *, sns_gid_pt_req_t *); +void isp_put_gxx_id_request(ispsoftc_t *, sns_gxx_id_req_t *, sns_gxx_id_req_t *); +void isp_get_gid_xx_response(ispsoftc_t *, sns_gid_xx_rsp_t *, sns_gid_xx_rsp_t *, int); void isp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *, sns_gxn_id_rsp_t *); +void isp_get_gft_id_response(ispsoftc_t *, sns_gft_id_rsp_t *, sns_gft_id_rsp_t *); void isp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *, sns_gff_id_rsp_t *); void isp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *, sns_ga_nxt_rsp_t *); void isp_get_els(ispsoftc_t *, els_t *, els_t *); Modified: stable/11/sys/dev/isp/ispmbox.h ============================================================================== --- stable/11/sys/dev/isp/ispmbox.h Tue Aug 1 13:00:13 2017 (r321869) +++ stable/11/sys/dev/isp/ispmbox.h Tue Aug 1 13:03:06 2017 (r321870) @@ -1,5 +1,6 @@ /* $FreeBSD$ */ /*- + * Copyright (c) 2009-2017 Alexander Motin * Copyright (c) 1997-2009 by Matthew Jacob * All rights reserved. * @@ -1551,6 +1552,7 @@ typedef struct { #define SNS_GA_NXT 0x100 #define SNS_GPN_ID 0x112 #define SNS_GNN_ID 0x113 +#define SNS_GFT_ID 0x117 #define SNS_GFF_ID 0x11F #define SNS_GID_FT 0x171 #define SNS_GID_PT 0x1A1 @@ -1580,18 +1582,18 @@ typedef struct { } sns_ga_nxt_req_t; #define SNS_GA_NXT_REQ_SIZE (sizeof (sns_ga_nxt_req_t)) -typedef struct { +typedef struct { /* Used for GFT_ID, GFF_ID, etc. */ uint16_t snscb_rblen; /* response buffer length (words) */ uint16_t snscb_reserved0; uint16_t snscb_addr[4]; /* response buffer address */ uint16_t snscb_sblen; /* subcommand buffer length (words) */ uint16_t snscb_reserved1; uint16_t snscb_cmd; - uint16_t snscb_reserved2; + uint16_t snscb_mword_div_2; uint32_t snscb_reserved3; uint32_t snscb_portid; -} sns_gxn_id_req_t; -#define SNS_GXN_ID_REQ_SIZE (sizeof (sns_gxn_id_req_t)) +} sns_gxx_id_req_t; +#define SNS_GXX_ID_REQ_SIZE (sizeof (sns_gxx_id_req_t)) typedef struct { uint16_t snscb_rblen; /* response buffer length (words) */ @@ -1613,6 +1615,22 @@ typedef struct { uint16_t snscb_sblen; /* subcommand buffer length (words) */ uint16_t snscb_reserved1; uint16_t snscb_cmd; + uint16_t snscb_mword_div_2; + uint32_t snscb_reserved3; + uint8_t snscb_port_type; + uint8_t snscb_domain; + uint8_t snscb_area; + uint8_t snscb_flags; +} sns_gid_pt_req_t; +#define SNS_GID_PT_REQ_SIZE (sizeof (sns_gid_pt_req_t)) + +typedef struct { + uint16_t snscb_rblen; /* response buffer length (words) */ + uint16_t snscb_reserved0; + uint16_t snscb_addr[4]; /* response buffer address */ + uint16_t snscb_sblen; /* subcommand buffer length (words) */ + uint16_t snscb_reserved1; + uint16_t snscb_cmd; uint16_t snscb_reserved2; uint32_t snscb_reserved3; uint32_t snscb_port; @@ -1656,18 +1674,24 @@ typedef struct { typedef struct { ct_hdr_t snscb_cthdr; + uint32_t snscb_fc4_types[8]; +} sns_gft_id_rsp_t; +#define SNS_GFT_ID_RESP_SIZE (sizeof (sns_gft_id_rsp_t)) + +typedef struct { + ct_hdr_t snscb_cthdr; uint32_t snscb_fc4_features[32]; } sns_gff_id_rsp_t; #define SNS_GFF_ID_RESP_SIZE (sizeof (sns_gff_id_rsp_t)) -typedef struct { +typedef struct { /* Used for GID_FT, GID_PT, etc. */ ct_hdr_t snscb_cthdr; struct { uint8_t control; uint8_t portid[3]; } snscb_ports[1]; -} sns_gid_ft_rsp_t; -#define SNS_GID_FT_RESP_SIZE(x) ((sizeof (sns_gid_ft_rsp_t)) + ((x - 1) << 2)) +} sns_gid_xx_rsp_t; +#define SNS_GID_XX_RESP_SIZE(x) ((sizeof (sns_gid_xx_rsp_t)) + ((x - 1) << 2)) /* * Other Misc Structures Modified: stable/11/sys/dev/isp/ispvar.h ============================================================================== --- stable/11/sys/dev/isp/ispvar.h Tue Aug 1 13:00:13 2017 (r321869) +++ stable/11/sys/dev/isp/ispvar.h Tue Aug 1 13:03:06 2017 (r321870) @@ -1,5 +1,6 @@ /* $FreeBSD$ */ /*- + * Copyright (c) 2009-2017 Alexander Motin * Copyright (c) 1997-2009 by Matthew Jacob * All rights reserved. * @@ -446,6 +447,8 @@ typedef struct { uint16_t isp_login_hdl; /* Logging in handle */ uint8_t isp_retry_delay; uint8_t isp_retry_count; + int isp_use_gft_id; /* Use GFT_ID */ + int isp_use_gff_id; /* Use GFF_ID */ /* * Current active WWNN/WWPN From owner-svn-src-stable@freebsd.org Tue Aug 1 13:07:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B433ADAD05F; Tue, 1 Aug 2017 13:07:06 +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 838BD76DBF; Tue, 1 Aug 2017 13:07:06 +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 v71D75OU035516; Tue, 1 Aug 2017 13:07:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71D7522035515; Tue, 1 Aug 2017 13:07:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708011307.v71D7522035515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 1 Aug 2017 13:07: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: r321871 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/ctl X-SVN-Commit-Revision: 321871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 13:07:06 -0000 Author: mav Date: Tue Aug 1 13:07:05 2017 New Revision: 321871 URL: https://svnweb.freebsd.org/changeset/base/321871 Log: MFC r320493: Unify INOT/ATIO setup. Modified: stable/11/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Tue Aug 1 13:03:06 2017 (r321870) +++ stable/11/sys/cam/ctl/scsi_ctl.c Tue Aug 1 13:07:05 2017 (r321871) @@ -529,7 +529,7 @@ ctlferegister(struct cam_periph *periph, void *arg) new_ccb->ccb_h.io_ptr = new_io; LIST_INSERT_HEAD(&softc->atio_list, &new_ccb->ccb_h, periph_links.le); - xpt_setup_ccb(&new_ccb->ccb_h, periph->path, /*priority*/ 1); + xpt_setup_ccb(&new_ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); new_ccb->ccb_h.func_code = XPT_ACCEPT_TARGET_IO; new_ccb->ccb_h.cbfcnp = ctlfedone; new_ccb->ccb_h.flags |= CAM_UNLOCKED; @@ -576,7 +576,7 @@ ctlferegister(struct cam_periph *periph, void *arg) new_ccb->ccb_h.io_ptr = new_io; LIST_INSERT_HEAD(&softc->inot_list, &new_ccb->ccb_h, periph_links.le); - xpt_setup_ccb(&new_ccb->ccb_h, periph->path, /*priority*/ 1); + xpt_setup_ccb(&new_ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); new_ccb->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY; new_ccb->ccb_h.cbfcnp = ctlfedone; new_ccb->ccb_h.flags |= CAM_UNLOCKED; @@ -1009,10 +1009,7 @@ ctlfe_requeue_ccb(struct cam_periph *periph, union ccb * target/lun. Reset the target and LUN fields back to the wildcard * values before we send them back down to the SIM. */ - if (softc->flags & CTLFE_LUN_WILDCARD) { - ccb->ccb_h.target_id = CAM_TARGET_WILDCARD; - ccb->ccb_h.target_lun = CAM_LUN_WILDCARD; - } + xpt_setup_ccb(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); xpt_action(ccb); } From owner-svn-src-stable@freebsd.org Tue Aug 1 13:07:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63255DAD12A; Tue, 1 Aug 2017 13:07:55 +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 3217676EFE; Tue, 1 Aug 2017 13:07: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 v71D7sZo035601; Tue, 1 Aug 2017 13:07:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71D7sqU035600; Tue, 1 Aug 2017 13:07:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708011307.v71D7sqU035600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 1 Aug 2017 13:07: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: r321872 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/ctl X-SVN-Commit-Revision: 321872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 13:07:55 -0000 Author: mav Date: Tue Aug 1 13:07:54 2017 New Revision: 321872 URL: https://svnweb.freebsd.org/changeset/base/321872 Log: MFC r320495: Allow status aggregation for ramdisk reads. Modified: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Aug 1 13:07:05 2017 (r321871) +++ stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Aug 1 13:07:54 2017 (r321872) @@ -525,6 +525,11 @@ nospc: io->scsiio.kern_sg_entries = sgs; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; PRIV(io)->len += lbas; + if ((ARGS(io)->flags & CTL_LLF_READ) && + ARGS(io)->len <= PRIV(io)->len) { + ctl_set_success(&io->scsiio); + ctl_serseq_done(io); + } #ifdef CTL_TIME_IO getbinuptime(&io->io_hdr.dma_start_bt); #endif From owner-svn-src-stable@freebsd.org Tue Aug 1 13:15:31 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0482DAD3CD; Tue, 1 Aug 2017 13:15:31 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EBE277315; Tue, 1 Aug 2017 13:15:31 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v71DFUac039448; Tue, 1 Aug 2017 13:15:30 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71DFUQf039447; Tue, 1 Aug 2017 13:15:30 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201708011315.v71DFUQf039447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Tue, 1 Aug 2017 13:15: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: r321873 - stable/10/sys/netpfil/ipfw X-SVN-Group: stable-10 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/10/sys/netpfil/ipfw X-SVN-Commit-Revision: 321873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 13:15:31 -0000 Author: philip Date: Tue Aug 1 13:15:30 2017 New Revision: 321873 URL: https://svnweb.freebsd.org/changeset/base/321873 Log: MFC r320941: Fix GRE over IPv6 tunnels with IPFW Previously, GRE packets in IPv6 tunnels would be dropped by IPFW (unless net.inet6.ip6.fw.deny_unknown_exthdrs was unset). PR: 220640 Submitted by: Kun Xie Modified: stable/10/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/10/sys/netpfil/ipfw/ip_fw2.c Tue Aug 1 13:07:54 2017 (r321872) +++ stable/10/sys/netpfil/ipfw/ip_fw2.c Tue Aug 1 13:15:30 2017 (r321873) @@ -87,6 +87,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include /* for struct grehdr */ + #include #include /* XXX for in_cksum */ @@ -1141,6 +1143,11 @@ do { \ case IPPROTO_PIM: /* XXX PIM header check? */ PULLUP_TO(hlen, ulp, struct pim); + break; + + case IPPROTO_GRE: /* RFC 1701 */ + /* XXX GRE header check? */ + PULLUP_TO(hlen, ulp, struct grehdr); break; case IPPROTO_CARP: From owner-svn-src-stable@freebsd.org Tue Aug 1 13:40:38 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC39CDADE64; Tue, 1 Aug 2017 13:40:38 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB2B477D58; Tue, 1 Aug 2017 13:40:38 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v71DebNv048472; Tue, 1 Aug 2017 13:40:37 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71DebaQ048471; Tue, 1 Aug 2017 13:40:37 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201708011340.v71DebaQ048471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Tue, 1 Aug 2017 13:40:37 +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: r321874 - stable/9/sys/netpfil/ipfw X-SVN-Group: stable-9 X-SVN-Commit-Author: philip X-SVN-Commit-Paths: stable/9/sys/netpfil/ipfw X-SVN-Commit-Revision: 321874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 13:40:39 -0000 Author: philip Date: Tue Aug 1 13:40:37 2017 New Revision: 321874 URL: https://svnweb.freebsd.org/changeset/base/321874 Log: MFC r320941: Fix GRE over IPv6 tunnels with IPFW Previously, GRE packets in IPv6 tunnels would be dropped by IPFW (unless net.inet6.ip6.fw.deny_unknown_exthdrs was unset). PR: 220640 Submitted by: Kun Xie Modified: stable/9/sys/netpfil/ipfw/ip_fw2.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/netpfil/ (props changed) Modified: stable/9/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw2.c Tue Aug 1 13:15:30 2017 (r321873) +++ stable/9/sys/netpfil/ipfw/ip_fw2.c Tue Aug 1 13:40:37 2017 (r321874) @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include /* for struct gre_h */ + #include #include /* XXX for in_cksum */ @@ -1142,6 +1144,11 @@ do { \ case IPPROTO_PIM: /* XXX PIM header check? */ PULLUP_TO(hlen, ulp, struct pim); + break; + + case IPPROTO_GRE: /* RFC 1701 */ + /* XXX GRE header check? */ + PULLUP_TO(hlen, ulp, struct gre_h); break; case IPPROTO_CARP: From owner-svn-src-stable@freebsd.org Tue Aug 1 14:25:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC71ADAEED9; Tue, 1 Aug 2017 14:25:28 +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 89D987D5A0; Tue, 1 Aug 2017 14:25:28 +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 v71EPRfT067757; Tue, 1 Aug 2017 14:25:27 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71EPRvf067756; Tue, 1 Aug 2017 14:25:27 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708011425.v71EPRvf067756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 1 Aug 2017 14:25: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: r321875 - stable/11/sys/fs/nfs X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/sys/fs/nfs X-SVN-Commit-Revision: 321875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 14:25:28 -0000 Author: trasz Date: Tue Aug 1 14:25:27 2017 New Revision: 321875 URL: https://svnweb.freebsd.org/changeset/base/321875 Log: MFC r320359: Add vfs.nfsd.nfsd_enable_uidtostring, which works just like vfs.nfsd.nfsd_enable_stringtouid, but in reverse - when set to 1, it forces the NFSv4 server to return numeric UIDs and GIDs instead of "user@domain" strings. This helps with clients that can't translate returned identifiers, eg when rerooting. The same can be achieved by just never running nfsuserd(8), but the sysctl is useful to toggle the behaviour back and forth without rebooting. MFC r320409: Revert part of r320359, as suggested by rmacklem@. That case is only used for nfsuserd -manage-gids and shouldn't depend on sysctl. MFC r321196: Rename vfs.nfsd.enable_uidtostring to vfs.nfs.enable_uidtostring. It applies to both NFS client and NFS server, and is useful for both. This is different from vfs.nfsd.enable_stringtouid, which is specific to server side. Sponsored by: DARPA, AFRL Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Aug 1 13:40:37 2017 (r321874) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Aug 1 14:25:27 2017 (r321875) @@ -68,10 +68,15 @@ gid_t nfsrv_defaultgid = GID_NOGROUP; int nfsrv_lease = NFSRV_LEASE; int ncl_mbuf_mlen = MLEN; int nfsd_enable_stringtouid = 0; +static int nfs_enable_uidtostring = 0; NFSNAMEIDMUTEX; NFSSOCKMUTEX; extern int nfsrv_lughashsize; +SYSCTL_DECL(_vfs_nfs); +SYSCTL_INT(_vfs_nfs, OID_AUTO, enable_uidtostring, CTLFLAG_RW, + &nfs_enable_uidtostring, 0, "Make nfs always send numeric owner_names"); + /* * This array of structures indicates, for V4: * retfh - which of 3 types of calling args are used @@ -2588,7 +2593,7 @@ nfsv4_uidtostr(uid_t uid, u_char **cpp, int *retlenp, cnt = 0; tryagain: - if (nfsrv_dnsnamelen > 0) { + if (nfsrv_dnsnamelen > 0 && !nfs_enable_uidtostring) { /* * Always map nfsrv_defaultuid to "nobody". */ @@ -2850,7 +2855,7 @@ nfsv4_gidtostr(gid_t gid, u_char **cpp, int *retlenp, cnt = 0; tryagain: - if (nfsrv_dnsnamelen > 0) { + if (nfsrv_dnsnamelen > 0 && !nfs_enable_uidtostring) { /* * Always map nfsrv_defaultgid to "nogroup". */ From owner-svn-src-stable@freebsd.org Tue Aug 1 15:51:18 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2387FDB138D; Tue, 1 Aug 2017 15:51:18 +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 DE40F80510; Tue, 1 Aug 2017 15:51:17 +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 v71FpHon003520; Tue, 1 Aug 2017 15:51:17 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71FpH83003519; Tue, 1 Aug 2017 15:51:17 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708011551.v71FpH83003519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 1 Aug 2017 15:51:17 +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: r321877 - stable/10/sys/fs/nfs X-SVN-Group: stable-10 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/10/sys/fs/nfs X-SVN-Commit-Revision: 321877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 15:51:18 -0000 Author: trasz Date: Tue Aug 1 15:51:16 2017 New Revision: 321877 URL: https://svnweb.freebsd.org/changeset/base/321877 Log: MFC r320359: Add vfs.nfsd.nfsd_enable_uidtostring, which works just like vfs.nfsd.nfsd_enable_stringtouid, but in reverse - when set to 1, it forces the NFSv4 server to return numeric UIDs and GIDs instead of "user@domain" strings. This helps with clients that can't translate returned identifiers, eg when rerooting. The same can be achieved by just never running nfsuserd(8), but the sysctl is useful to toggle the behaviour back and forth without rebooting. MFC r320409: Revert part of r320359, as suggested by rmacklem@. That case is only used for nfsuserd -manage-gids and shouldn't depend on sysctl. MFC r321196: Rename vfs.nfsd.enable_uidtostring to vfs.nfs.enable_uidtostring. It applies to both NFS client and NFS server, and is useful for both. This is different from vfs.nfsd.enable_stringtouid, which is specific to server side. Sponsored by: DARPA, AFRL Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Aug 1 14:54:25 2017 (r321876) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Aug 1 15:51:16 2017 (r321877) @@ -68,10 +68,15 @@ gid_t nfsrv_defaultgid = GID_NOGROUP; int nfsrv_lease = NFSRV_LEASE; int ncl_mbuf_mlen = MLEN; int nfsd_enable_stringtouid = 0; +static int nfs_enable_uidtostring = 0; NFSNAMEIDMUTEX; NFSSOCKMUTEX; extern int nfsrv_lughashsize; +SYSCTL_DECL(_vfs_nfs); +SYSCTL_INT(_vfs_nfs, OID_AUTO, enable_uidtostring, CTLFLAG_RW, + &nfs_enable_uidtostring, 0, "Make nfs always send numeric owner_names"); + /* * This array of structures indicates, for V4: * retfh - which of 3 types of calling args are used @@ -2576,7 +2581,7 @@ nfsv4_uidtostr(uid_t uid, u_char **cpp, int *retlenp, cnt = 0; tryagain: - if (nfsrv_dnsnamelen > 0) { + if (nfsrv_dnsnamelen > 0 && !nfs_enable_uidtostring) { /* * Always map nfsrv_defaultuid to "nobody". */ @@ -2838,7 +2843,7 @@ nfsv4_gidtostr(gid_t gid, u_char **cpp, int *retlenp, cnt = 0; tryagain: - if (nfsrv_dnsnamelen > 0) { + if (nfsrv_dnsnamelen > 0 && !nfs_enable_uidtostring) { /* * Always map nfsrv_defaultgid to "nogroup". */ From owner-svn-src-stable@freebsd.org Tue Aug 1 16:00:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB8F5DB1969; Tue, 1 Aug 2017 16:00:22 +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 A893480E40; Tue, 1 Aug 2017 16:00:22 +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 v71G0Lek005319; Tue, 1 Aug 2017 16:00:21 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71G0L92005317; Tue, 1 Aug 2017 16:00:21 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708011600.v71G0L92005317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 1 Aug 2017 16:00: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: r321878 - in stable/10: contrib/netbsd-tests/lib/libc/gen lib/libc/tests/gen X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/10: contrib/netbsd-tests/lib/libc/gen lib/libc/tests/gen X-SVN-Commit-Revision: 321878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 16:00:22 -0000 Author: asomers Date: Tue Aug 1 16:00:21 2017 New Revision: 321878 URL: https://svnweb.freebsd.org/changeset/base/321878 Log: MFC r320737, r320914 r320737: Fix cleanup in lib/libc/gen/setdomainname_test ATF cleanup routines run in separate processes from the tests themselves, so they can't share global variables. Also, setdomainname_test needs to be is_exclusive because the test cases access a global resource. PR: 219967 Reviewed by: ngie Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11188 r320914: Remove an extraneous strlen from t_setdomainname.c Reported by: Coverity CID: 1377568 X-MFC-With: 320737 Sponsored by: Spectra Logic Corp Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c stable/10/lib/libc/tests/gen/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Tue Aug 1 15:51:16 2017 (r321877) +++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Tue Aug 1 16:00:21 2017 (r321878) @@ -34,11 +34,13 @@ __RCSID("$NetBSD: t_setdomainname.c,v 1.2 2012/03/25 0 #include #include +#include #include +#include #include #include -static char domain[MAXHOSTNAMELEN]; +#define DOMAIN_BACKUP_FILE "domain.bak" static const char domains[][MAXHOSTNAMELEN] = { "1234567890", @@ -47,6 +49,45 @@ static const char domains[][MAXHOSTNAMELEN] = { "--------------------------------------------------------------------" }; +static void +backup_domain(void) +{ + char domain[MAXHOSTNAMELEN]; + int fd; + size_t l; + ssize_t r,n = 0; + + memset(domain, 0, sizeof(domain)); + + ATF_REQUIRE_EQ(0, getdomainname(domain, sizeof(domain))); + l = strnlen(domain, MAXHOSTNAMELEN); + fd = open(DOMAIN_BACKUP_FILE, O_WRONLY | O_CREAT | O_EXCL, 0644); + ATF_REQUIRE(fd >= 0); + while ((r = write(fd, domain + n, l - n)) > 0) + n += r; + ATF_REQUIRE_EQ(0, r); + close(fd); +} + +static void +restore_domain(void) +{ + char domain[MAXHOSTNAMELEN]; + int fd; + ssize_t r, n = 0; + + memset(domain, 0, sizeof(domain)); + if ((fd = open(DOMAIN_BACKUP_FILE, O_RDONLY)) < 0) + err(1, "open"); + while ((r = read(fd, domain + n, sizeof(domain) - n)) > 0) + n += r; + if (r < 0) + err(1, "read"); + if (setdomainname(domain, n) != 0) + err(1, "setdomainname"); + close(fd); +} + ATF_TC_WITH_CLEANUP(setdomainname_basic); ATF_TC_HEAD(setdomainname_basic, tc) { @@ -59,6 +100,7 @@ ATF_TC_BODY(setdomainname_basic, tc) char name[MAXHOSTNAMELEN]; size_t i; + backup_domain(); for (i = 0; i < __arraycount(domains); i++) { (void)memset(name, 0, sizeof(name)); @@ -80,12 +122,11 @@ ATF_TC_BODY(setdomainname_basic, tc) ATF_REQUIRE(strcmp(domains[i], name) == 0); } - (void)setdomainname(domain, sizeof(domain)); } ATF_TC_CLEANUP(setdomainname_basic, tc) { - (void)setdomainname(domain, sizeof(domain)); + restore_domain(); } ATF_TC_WITH_CLEANUP(setdomainname_limit); @@ -100,6 +141,7 @@ ATF_TC_BODY(setdomainname_limit, tc) char name[MAXHOSTNAMELEN + 1]; (void)memset(name, 0, sizeof(name)); + backup_domain(); #ifdef __FreeBSD__ ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN - 1 ) == 0); @@ -110,10 +152,10 @@ ATF_TC_BODY(setdomainname_limit, tc) ATF_TC_CLEANUP(setdomainname_limit, tc) { - (void)setdomainname(domain, sizeof(domain)); + restore_domain(); } -ATF_TC_WITH_CLEANUP(setdomainname_perm); +ATF_TC(setdomainname_perm); ATF_TC_HEAD(setdomainname_perm, tc) { atf_tc_set_md_var(tc, "descr", "Can normal user set the domain name?"); @@ -122,24 +164,16 @@ ATF_TC_HEAD(setdomainname_perm, tc) ATF_TC_BODY(setdomainname_perm, tc) { + char domain[MAXHOSTNAMELEN]; - errno = 0; + memset(domain, 0, sizeof(domain)); + errno = 0; ATF_REQUIRE_ERRNO(EPERM, setdomainname(domain, sizeof(domain)) == -1); } -ATF_TC_CLEANUP(setdomainname_perm, tc) -{ - (void)setdomainname(domain, sizeof(domain)); -} - ATF_TP_ADD_TCS(tp) { - - (void)memset(domain, 0, sizeof(domain)); - - ATF_REQUIRE(getdomainname(domain, sizeof(domain)) == 0); - ATF_TP_ADD_TC(tp, setdomainname_basic); ATF_TP_ADD_TC(tp, setdomainname_limit); ATF_TP_ADD_TC(tp, setdomainname_perm); Modified: stable/10/lib/libc/tests/gen/Makefile ============================================================================== --- stable/10/lib/libc/tests/gen/Makefile Tue Aug 1 15:51:16 2017 (r321877) +++ stable/10/lib/libc/tests/gen/Makefile Tue Aug 1 16:00:21 2017 (r321878) @@ -76,6 +76,7 @@ CFLAGS+= -I${.CURDIR} SRCS.fmtcheck2_test= fmtcheck_test.c SRCS.fnmatch2_test= fnmatch_test.c +TEST_METADATA.setdomainname_test+= is_exclusive=true TESTS_SUBDIRS= execve TESTS_SUBDIRS+= posix_spawn From owner-svn-src-stable@freebsd.org Tue Aug 1 16:48:35 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22FF8DB3204; Tue, 1 Aug 2017 16:48:35 +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 E46EF8308B; Tue, 1 Aug 2017 16:48:34 +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 v71GmXhJ026544; Tue, 1 Aug 2017 16:48:33 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71GmXmd026543; Tue, 1 Aug 2017 16:48:33 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708011648.v71GmXmd026543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 1 Aug 2017 16:48:33 +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: r321883 - stable/10/usr.bin/stdbuf X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/usr.bin/stdbuf X-SVN-Commit-Revision: 321883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 16:48:35 -0000 Author: asomers Date: Tue Aug 1 16:48:33 2017 New Revision: 321883 URL: https://svnweb.freebsd.org/changeset/base/321883 Log: MFC r320807: stdbuf(1): Add buffer definition "B" to the usage message This option has been missing from the usage message ever since the program was first imported. Submitted by: shivansh Reviewed by: asomers Sponsored by: Google, Inc (GSoC 2017) Differential Revision: https://reviews.freebsd.org/D11529 Modified: stable/10/usr.bin/stdbuf/stdbuf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/stdbuf/stdbuf.c ============================================================================== --- stable/10/usr.bin/stdbuf/stdbuf.c Tue Aug 1 16:41:17 2017 (r321882) +++ stable/10/usr.bin/stdbuf/stdbuf.c Tue Aug 1 16:48:33 2017 (r321883) @@ -40,7 +40,7 @@ static void usage(int s) { - fprintf(stderr, "Usage: %s [-e 0|L|] [-i 0|L|] [-o 0|L|] " + fprintf(stderr, "Usage: %s [-e 0|L|B|] [-i 0|L|B|] [-o 0|L|B|] " " [args ...]\n", __progname); exit(s); } From owner-svn-src-stable@freebsd.org Tue Aug 1 21:41:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C4AADBDE72; Tue, 1 Aug 2017 21:41:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66AAB6A2FE; Tue, 1 Aug 2017 21:41:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v71LfEhD054014; Tue, 1 Aug 2017 21:41:14 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71LfExB054013; Tue, 1 Aug 2017 21:41:14 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708012141.v71LfExB054013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Tue, 1 Aug 2017 21:41:14 +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: r321895 - stable/10/usr.sbin/tzsetup X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/usr.sbin/tzsetup X-SVN-Commit-Revision: 321895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 21:41:15 -0000 Author: marius Date: Tue Aug 1 21:41:14 2017 New Revision: 321895 URL: https://svnweb.freebsd.org/changeset/base/321895 Log: MFC: r281733, r298033, r301131 - Remove set but unused variable. - Use NULL instead of 0 for pointers. - Fix tzsetup not installing /etc/localtime for UTC. Modified: stable/10/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/10/usr.sbin/tzsetup/tzsetup.c Tue Aug 1 20:28:11 2017 (r321894) +++ stable/10/usr.sbin/tzsetup/tzsetup.c Tue Aug 1 21:41:14 2017 (r321895) @@ -198,6 +198,7 @@ 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 *); @@ -343,7 +344,7 @@ read_iso3166_table(void) err(1, "%s", path_iso3166); lineno = 0; - while ((s = fgetln(fp, &len)) != 0) { + while ((s = fgetln(fp, &len)) != NULL) { lineno++; if (s[len - 1] != '\n') errx(1, "%s:%d: invalid format", path_iso3166, lineno); @@ -353,7 +354,7 @@ read_iso3166_table(void) /* Isolate the two-letter code. */ t = strsep(&s, "\t"); - if (t == 0 || strlen(t) != 2) + if (t == NULL || strlen(t) != 2) errx(1, "%s:%d: invalid format", path_iso3166, lineno); if (t[0] < 'A' || t[0] > 'Z' || t[1] < 'A' || t[1] > 'Z') errx(1, "%s:%d: invalid code `%s'", path_iso3166, @@ -361,10 +362,10 @@ read_iso3166_table(void) /* Now skip past the three-letter and numeric codes. */ name = strsep(&s, "\t"); /* 3-let */ - if (name == 0 || strlen(name) != 3) + if (name == NULL || strlen(name) != 3) errx(1, "%s:%d: invalid format", path_iso3166, lineno); name = strsep(&s, "\t"); /* numeric */ - if (name == 0 || strlen(name) != 3) + if (name == NULL || strlen(name) != 3) errx(1, "%s:%d: invalid format", path_iso3166, lineno); name = s; @@ -406,7 +407,7 @@ add_zone_to_country(int lineno, const char *tlc, const path_zonetab, lineno); zp = malloc(sizeof(*zp)); - if (zp == 0) + if (zp == NULL) errx(1, "malloc(%zu)", sizeof(*zp)); if (cp->nzones == 0) @@ -474,7 +475,7 @@ read_zones(void) FILE *fp; struct continent *cont; size_t len; - char *line, *tlc, *coord, *file, *descr, *p; + char *line, *tlc, *file, *descr, *p; int lineno; fp = fopen(path_zonetab, "r"); @@ -482,7 +483,7 @@ read_zones(void) err(1, "%s", path_zonetab); lineno = 0; - while ((line = fgetln(fp, &len)) != 0) { + while ((line = fgetln(fp, &len)) != NULL) { lineno++; if (line[len - 1] != '\n') errx(1, "%s:%d: invalid format", path_zonetab, lineno); @@ -494,10 +495,10 @@ read_zones(void) if (strlen(tlc) != 2) errx(1, "%s:%d: invalid country code `%s'", path_zonetab, lineno, tlc); - coord = strsep(&line, "\t"); /* Unused */ + /* coord = */ strsep(&line, "\t"); /* Unused */ file = strsep(&line, "\t"); p = strchr(file, '/'); - if (p == 0) + if (p == NULL) errx(1, "%s:%d: invalid zone name `%s'", path_zonetab, lineno, file); contbuf[0] = '\0'; @@ -557,7 +558,7 @@ make_menus(void) continent_names[i].continent->menu = malloc(sizeof(dialogMenuItem) * continent_names[i].continent->nitems); - if (continent_names[i].continent->menu == 0) + if (continent_names[i].continent->menu == NULL) errx(1, "malloc for continent menu"); continent_names[i].continent->nitems = 0; continents[i].prompt = continent_items[i].prompt; @@ -632,13 +633,13 @@ set_zone_menu(dialogMenuItem *dmi) return (DITEM_LEAVE_MENU); } -int +static int set_zone_utc(void) { if (!confirm_zone(NULL)) return (DITEM_FAILURE | DITEM_RECREATE); - return (install_zoneinfo_file(NULL)); + return (install_zoneinfo("UTC")); } static int From owner-svn-src-stable@freebsd.org Wed Aug 2 05:17:03 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D044DC6355; Wed, 2 Aug 2017 05:17:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDEED75ED5; Wed, 2 Aug 2017 05:17:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v725H2gv037802; Wed, 2 Aug 2017 05:17:02 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v725H2QX037801; Wed, 2 Aug 2017 05:17:02 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708020517.v725H2QX037801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 2 Aug 2017 05:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321904 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 321904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 05:17:03 -0000 Author: delphij Date: Wed Aug 2 05:17:01 2017 New Revision: 321904 URL: https://svnweb.freebsd.org/changeset/base/321904 Log: MFC r321713: Bump copyright year. Modified: stable/11/sys/sys/copyright.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/copyright.h ============================================================================== --- stable/11/sys/sys/copyright.h Wed Aug 2 03:18:24 2017 (r321903) +++ stable/11/sys/sys/copyright.h Wed Aug 2 05:17:01 2017 (r321904) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 1992-2016 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2017 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-stable@freebsd.org Wed Aug 2 05:17:48 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1606DC63CF; Wed, 2 Aug 2017 05:17:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 987BB76006; Wed, 2 Aug 2017 05:17:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v725HlG2037879; Wed, 2 Aug 2017 05:17:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v725HlLc037878; Wed, 2 Aug 2017 05:17:47 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708020517.v725HlLc037878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 2 Aug 2017 05:17:47 +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: r321905 - stable/10/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/10/sys/sys X-SVN-Commit-Revision: 321905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 05:17:48 -0000 Author: delphij Date: Wed Aug 2 05:17:47 2017 New Revision: 321905 URL: https://svnweb.freebsd.org/changeset/base/321905 Log: MFC r321713: Bump copyright year. Modified: stable/10/sys/sys/copyright.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/copyright.h ============================================================================== --- stable/10/sys/sys/copyright.h Wed Aug 2 05:17:01 2017 (r321904) +++ stable/10/sys/sys/copyright.h Wed Aug 2 05:17:47 2017 (r321905) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 1992-2016 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2017 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-stable@freebsd.org Wed Aug 2 05:30:42 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80010DC682C; Wed, 2 Aug 2017 05:30:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FD707653D; Wed, 2 Aug 2017 05:30:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v725UfUF043852; Wed, 2 Aug 2017 05:30:41 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v725UffE043835; Wed, 2 Aug 2017 05:30:41 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708020530.v725UffE043835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 2 Aug 2017 05:30: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: r321906 - stable/11/sbin/init X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/sbin/init X-SVN-Commit-Revision: 321906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 05:30:42 -0000 Author: delphij Date: Wed Aug 2 05:30:41 2017 New Revision: 321906 URL: https://svnweb.freebsd.org/changeset/base/321906 Log: MFC r320761: - Use strlcat() instead of strncat(). - Use asprintf() and handle allocation errors. Modified: stable/11/sbin/init/init.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/init/init.c ============================================================================== --- stable/11/sbin/init/init.c Wed Aug 2 05:17:47 2017 (r321905) +++ stable/11/sbin/init/init.c Wed Aug 2 05:30:41 2017 (r321906) @@ -1271,8 +1271,8 @@ new_session(session_t *sprev, struct ttyent *typ) sp->se_flags |= SE_PRESENT; - sp->se_device = malloc(sizeof(_PATH_DEV) + strlen(typ->ty_name)); - sprintf(sp->se_device, "%s%s", _PATH_DEV, typ->ty_name); + if (asprintf(&sp->se_device, "%s%s", _PATH_DEV, typ->ty_name) < 0) + err(1, "asprintf"); /* * Attempt to open the device, if we get "device not configured" @@ -1315,8 +1315,8 @@ setupargv(session_t *sp, struct ttyent *typ) free(sp->se_getty_argv_space); free(sp->se_getty_argv); } - sp->se_getty = malloc(strlen(typ->ty_getty) + strlen(typ->ty_name) + 2); - sprintf(sp->se_getty, "%s %s", typ->ty_getty, typ->ty_name); + if (asprintf(&sp->se_getty, "%s %s", typ->ty_getty, typ->ty_name) < 0) + err(1, "asprintf"); sp->se_getty_argv_space = strdup(sp->se_getty); sp->se_getty_argv = construct_argv(sp->se_getty_argv_space); if (sp->se_getty_argv == NULL) { @@ -1429,7 +1429,7 @@ start_window_system(session_t *sp) if (sp->se_type) { /* Don't use malloc after fork */ strcpy(term, "TERM="); - strncat(term, sp->se_type, sizeof(term) - 6); + strlcat(term, sp->se_type, sizeof(term)); env[0] = term; env[1] = 0; } @@ -1493,7 +1493,7 @@ start_getty(session_t *sp) if (sp->se_type) { /* Don't use malloc after fork */ strcpy(term, "TERM="); - strncat(term, sp->se_type, sizeof(term) - 6); + strlcat(term, sp->se_type, sizeof(term)); env[0] = term; env[1] = 0; } else From owner-svn-src-stable@freebsd.org Wed Aug 2 05:47:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 643D7DC6B69; Wed, 2 Aug 2017 05:47:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 261B576B9F; Wed, 2 Aug 2017 05:47:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v725lQQS050061; Wed, 2 Aug 2017 05:47:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v725lQ8G050060; Wed, 2 Aug 2017 05:47:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708020547.v725lQ8G050060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 2 Aug 2017 05:47: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: r321907 - stable/10/sbin/init X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/10/sbin/init X-SVN-Commit-Revision: 321907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 05:47:27 -0000 Author: delphij Date: Wed Aug 2 05:47:26 2017 New Revision: 321907 URL: https://svnweb.freebsd.org/changeset/base/321907 Log: MFC r320761: - Use strlcat() instead of strncat(). - Use asprintf() and handle allocation errors. Modified: stable/10/sbin/init/init.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/init/init.c ============================================================================== --- stable/10/sbin/init/init.c Wed Aug 2 05:30:41 2017 (r321906) +++ stable/10/sbin/init/init.c Wed Aug 2 05:47:26 2017 (r321907) @@ -1278,8 +1278,8 @@ new_session(session_t *sprev, int session_index, struc sp->se_index = session_index; sp->se_flags |= SE_PRESENT; - sp->se_device = malloc(sizeof(_PATH_DEV) + strlen(typ->ty_name)); - sprintf(sp->se_device, "%s%s", _PATH_DEV, typ->ty_name); + if (asprintf(&sp->se_device, "%s%s", _PATH_DEV, typ->ty_name) < 0) + err(1, "asprintf"); /* * Attempt to open the device, if we get "device not configured" @@ -1322,8 +1322,8 @@ setupargv(session_t *sp, struct ttyent *typ) free(sp->se_getty_argv_space); free(sp->se_getty_argv); } - sp->se_getty = malloc(strlen(typ->ty_getty) + strlen(typ->ty_name) + 2); - sprintf(sp->se_getty, "%s %s", typ->ty_getty, typ->ty_name); + if (asprintf(&sp->se_getty, "%s %s", typ->ty_getty, typ->ty_name) < 0) + err(1, "asprintf"); sp->se_getty_argv_space = strdup(sp->se_getty); sp->se_getty_argv = construct_argv(sp->se_getty_argv_space); if (sp->se_getty_argv == 0) { @@ -1437,7 +1437,7 @@ start_window_system(session_t *sp) if (sp->se_type) { /* Don't use malloc after fork */ strcpy(term, "TERM="); - strncat(term, sp->se_type, sizeof(term) - 6); + strlcat(term, sp->se_type, sizeof(term)); env[0] = term; env[1] = 0; } @@ -1501,7 +1501,7 @@ start_getty(session_t *sp) if (sp->se_type) { /* Don't use malloc after fork */ strcpy(term, "TERM="); - strncat(term, sp->se_type, sizeof(term) - 6); + strlcat(term, sp->se_type, sizeof(term)); env[0] = term; env[1] = 0; } else From owner-svn-src-stable@freebsd.org Wed Aug 2 07:58:38 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A1F4DC8CAE; Wed, 2 Aug 2017 07:58:38 +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 DD3967E140; Wed, 2 Aug 2017 07:58:37 +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 v727wblj002330; Wed, 2 Aug 2017 07:58:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v727wb4p002329; Wed, 2 Aug 2017 07:58:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708020758.v727wb4p002329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 2 Aug 2017 07:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321908 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 321908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 07:58:38 -0000 Author: kib Date: Wed Aug 2 07:58:36 2017 New Revision: 321908 URL: https://svnweb.freebsd.org/changeset/base/321908 Log: MFC r321512: Mark name_PCTRIE_LOOKUP_LE() generated function unused. Modified: stable/11/sys/sys/pctrie.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/pctrie.h ============================================================================== --- stable/11/sys/sys/pctrie.h Wed Aug 2 05:47:26 2017 (r321907) +++ stable/11/sys/sys/pctrie.h Wed Aug 2 07:58:36 2017 (r321908) @@ -76,7 +76,7 @@ name##_PCTRIE_LOOKUP(struct pctrie *ptree, uint64_t ke return name##_PCTRIE_VAL2PTR(pctrie_lookup(ptree, key)); \ } \ \ -static __inline struct type * \ +static __inline __unused struct type * \ name##_PCTRIE_LOOKUP_LE(struct pctrie *ptree, uint64_t key) \ { \ \ From owner-svn-src-stable@freebsd.org Wed Aug 2 08:03:41 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA6B3DC914D; Wed, 2 Aug 2017 08:03:41 +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 782907E63E; Wed, 2 Aug 2017 08:03:41 +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 v7283erC006187; Wed, 2 Aug 2017 08:03:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7283enl006186; Wed, 2 Aug 2017 08:03:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708020803.v7283enl006186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 2 Aug 2017 08:03: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: r321909 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/fs/nfsclient X-SVN-Commit-Revision: 321909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 08:03:41 -0000 Author: kib Date: Wed Aug 2 08:03:40 2017 New Revision: 321909 URL: https://svnweb.freebsd.org/changeset/base/321909 Log: MFC r321580: Move rtvals initialization out of the region protected by NFS node lock. Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clbio.c Wed Aug 2 07:58:36 2017 (r321908) +++ stable/11/sys/fs/nfsclient/nfs_clbio.c Wed Aug 2 08:03:40 2017 (r321909) @@ -306,10 +306,6 @@ ncl_putpages(struct vop_putpages_args *ap) printf("ncl_putpages: called on noncache-able vnode\n"); mtx_lock(&np->n_mtx); } - - for (i = 0; i < npages; i++) - rtvals[i] = VM_PAGER_ERROR; - /* * When putting pages, do not extend file past EOF. */ @@ -319,6 +315,9 @@ ncl_putpages(struct vop_putpages_args *ap) count = 0; } mtx_unlock(&np->n_mtx); + + for (i = 0; i < npages; i++) + rtvals[i] = VM_PAGER_ERROR; PCPU_INC(cnt.v_vnodeout); PCPU_ADD(cnt.v_vnodepgsout, count); From owner-svn-src-stable@freebsd.org Wed Aug 2 08:07:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A243DC9356; Wed, 2 Aug 2017 08:07:15 +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 048A27E890; Wed, 2 Aug 2017 08:07:14 +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 v7287E2V006357; Wed, 2 Aug 2017 08:07:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7287DsY006353; Wed, 2 Aug 2017 08:07:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708020807.v7287DsY006353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 2 Aug 2017 08:07: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: r321910 - in stable/11/sys: fs/nfsclient fs/smbfs vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: fs/nfsclient fs/smbfs vm X-SVN-Commit-Revision: 321910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 08:07:15 -0000 Author: kib Date: Wed Aug 2 08:07:13 2017 New Revision: 321910 URL: https://svnweb.freebsd.org/changeset/base/321910 Log: MFC r321581: Mark pages after EOF as clean after pageout. Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c stable/11/sys/fs/smbfs/smbfs_io.c stable/11/sys/vm/vnode_pager.c stable/11/sys/vm/vnode_pager.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clbio.c Wed Aug 2 08:03:40 2017 (r321909) +++ stable/11/sys/fs/nfsclient/nfs_clbio.c Wed Aug 2 08:07:13 2017 (r321910) @@ -336,8 +336,10 @@ ncl_putpages(struct vop_putpages_args *ap) cred); crfree(cred); - if (error == 0 || !nfs_keep_dirty_on_error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); + if (error == 0 || !nfs_keep_dirty_on_error) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + np->n_size - offset, npages * PAGE_SIZE); + } return (rtvals[0]); } Modified: stable/11/sys/fs/smbfs/smbfs_io.c ============================================================================== --- stable/11/sys/fs/smbfs/smbfs_io.c Wed Aug 2 08:03:40 2017 (r321909) +++ stable/11/sys/fs/smbfs/smbfs_io.c Wed Aug 2 08:07:13 2017 (r321910) @@ -621,9 +621,11 @@ smbfs_putpages(ap) relpbuf(bp, &smbfs_pbuf_freecnt); - if (!error) - vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid); - return rtvals[0]; + if (error == 0) { + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + npages * PAGE_SIZE, npages * PAGE_SIZE); + } + return (rtvals[0]); #endif /* SMBFS_RWGENERIC */ } Modified: stable/11/sys/vm/vnode_pager.c ============================================================================== --- stable/11/sys/vm/vnode_pager.c Wed Aug 2 08:03:40 2017 (r321909) +++ stable/11/sys/vm/vnode_pager.c Wed Aug 2 08:07:13 2017 (r321910) @@ -1276,13 +1276,24 @@ vnode_pager_putpages_ioflags(int pager_flags) return (ioflags); } +/* + * vnode_pager_undirty_pages(). + * + * A helper to mark pages as clean after pageout that was possibly + * done with a short write. The lpos argument specifies the page run + * length in bytes, and the written argument specifies how many bytes + * were actually written. eof is the offset past the last valid byte + * in the vnode using the absolute file position of the first byte in + * the run as the base from which it is computed. + */ void -vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written) +vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, off_t eof, + int lpos) { vm_object_t obj; - int i, pos; + int i, pos, pos_devb; - if (written == 0) + if (written == 0 && eof >= lpos) return; obj = ma[0]->object; VM_OBJECT_WLOCK(obj); @@ -1296,6 +1307,37 @@ vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, vm_page_clear_dirty(ma[i], 0, written & PAGE_MASK); } } + if (eof >= lpos) /* avoid truncation */ + goto done; + for (pos = eof, i = OFF_TO_IDX(trunc_page(pos)); pos < lpos; i++) { + if (pos != trunc_page(pos)) { + /* + * The page contains the last valid byte in + * the vnode, mark the rest of the page as + * clean, potentially making the whole page + * clean. + */ + pos_devb = roundup2(pos & PAGE_MASK, DEV_BSIZE); + vm_page_clear_dirty(ma[i], pos_devb, PAGE_SIZE - + pos_devb); + + /* + * If the page was cleaned, report the pageout + * on it as successful. msync() no longer + * needs to write out the page, endlessly + * creating write requests and dirty buffers. + */ + if (ma[i]->dirty == 0) + rtvals[i] = VM_PAGER_OK; + + pos = round_page(pos); + } else { + /* vm_pageout_flush() clears dirty */ + rtvals[i] = VM_PAGER_BAD; + pos += PAGE_SIZE; + } + } +done: VM_OBJECT_WUNLOCK(obj); } Modified: stable/11/sys/vm/vnode_pager.h ============================================================================== --- stable/11/sys/vm/vnode_pager.h Wed Aug 2 08:03:40 2017 (r321909) +++ stable/11/sys/vm/vnode_pager.h Wed Aug 2 08:07:13 2017 (r321910) @@ -50,7 +50,8 @@ int vnode_pager_local_getpages_async(struct vop_getpag int vnode_pager_putpages_ioflags(int pager_flags); void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written); +void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, + off_t eof, int lpos); void vnode_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); From owner-svn-src-stable@freebsd.org Wed Aug 2 14:43:14 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32CB4DD24D8; Wed, 2 Aug 2017 14: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 0CDF5675D7; Wed, 2 Aug 2017 14: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 v72EhDjk071431; Wed, 2 Aug 2017 14:43:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72EhDFe071429; Wed, 2 Aug 2017 14:43:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708021443.v72EhDFe071429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 2 Aug 2017 14:43: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: r321927 - stable/11/usr.sbin/diskinfo X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/usr.sbin/diskinfo X-SVN-Commit-Revision: 321927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 14:43:14 -0000 Author: mav Date: Wed Aug 2 14:43:12 2017 New Revision: 321927 URL: https://svnweb.freebsd.org/changeset/base/321927 Log: MFC r320555, r320576 (by allanjude): Add -s (serial) and -p (physpath) to diskinfo Return the bare requested information, intended for scripting. The serial number of a SAS/SCSI device can be returned with 'camcontrol inquiry disk -S', but there is no similar switch for SATA. This provides a way to get this information from both SAS and SATA disks the -s and -p flags are mutually exclusive, and cannot be used with any other flags. Modified: stable/11/usr.sbin/diskinfo/diskinfo.8 stable/11/usr.sbin/diskinfo/diskinfo.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/diskinfo/diskinfo.8 ============================================================================== --- stable/11/usr.sbin/diskinfo/diskinfo.8 Wed Aug 2 14:27:27 2017 (r321926) +++ stable/11/usr.sbin/diskinfo/diskinfo.8 Wed Aug 2 14:43:12 2017 (r321927) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 22, 2016 +.Dd July 1, 2017 .Dt DISKINFO 8 .Os .Sh NAME @@ -38,6 +38,12 @@ .Nm .Op Fl citv .Ar disk ... +.Nm +.Op Fl p +.Ar disk ... +.Nm +.Op Fl s +.Ar disk ... .Sh DESCRIPTION The .Nm @@ -52,6 +58,12 @@ Print fields one per line with a descriptive comment. Perform a simple measurement of the I/O read command overhead. .It Fl i Perform a simple IOPS benchmark. +.It Fl p +Return the physical path of the disk. +This is a string that identifies the physical path to the disk in the +storage enclosure. +.It Fl s +Return the disk serial number .It Fl t Perform a simple and rather naive benchmark of the disks seek and transfer performance. @@ -62,6 +74,13 @@ with the following fields: device name, sectorsize, me media size in sectors, stripe size, stripe offset, firmware cylinders, firmware heads, and firmware sectors. The last three fields are only present if the information is available. +.It Fl i +Return the disk ident, usually the serial number. +.It Fl p +Return the physical path of the disk. +This is a string that identifies the physical path to the disk in the +storage enclosure. +.El .Sh HISTORY The .Nm Modified: stable/11/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- stable/11/usr.sbin/diskinfo/diskinfo.c Wed Aug 2 14:27:27 2017 (r321926) +++ stable/11/usr.sbin/diskinfo/diskinfo.c Wed Aug 2 14:43:12 2017 (r321927) @@ -55,7 +55,7 @@ usage(void) exit (1); } -static int opt_c, opt_i, opt_t, opt_v; +static int opt_c, opt_i, opt_p, opt_s, opt_t, opt_v; static void speeddisk(int fd, off_t mediasize, u_int sectorsize); static void commandtime(int fd, off_t mediasize, u_int sectorsize); @@ -74,7 +74,7 @@ main(int argc, char **argv) u_int sectorsize, fwsectors, fwheads, zoned = 0; uint32_t zone_mode; - while ((ch = getopt(argc, argv, "citv")) != -1) { + while ((ch = getopt(argc, argv, "cipstv")) != -1) { switch (ch) { case 'c': opt_c = 1; @@ -84,6 +84,12 @@ main(int argc, char **argv) opt_i = 1; opt_v = 1; break; + case 'p': + opt_p = 1; + break; + case 's': + opt_s = 1; + break; case 't': opt_t = 1; opt_v = 1; @@ -101,6 +107,11 @@ main(int argc, char **argv) if (argc < 1) usage(); + if ((opt_p && opt_s) || ((opt_p || opt_s) && (opt_c || opt_i || opt_t || opt_v))) { + warnx("-p or -s cannot be used with other options"); + usage(); + } + for (i = 0; i < argc; i++) { fd = open(argv[i], O_RDONLY | O_DIRECT); if (fd < 0 && errno == ENOENT && *argv[i] != '/') { @@ -124,7 +135,27 @@ main(int argc, char **argv) fwheads = 0; stripesize = sb.st_blksize; stripeoffset = 0; + if (opt_p || opt_s) { + warnx("-p and -s only operate on physical devices: %s", argv[i]); + goto out; + } } else { + if (opt_p) { + if (ioctl(fd, DIOCGPHYSPATH, physpath) == 0) { + printf("%s\n", physpath); + } else { + warnx("Failed to determine physpath for: %s", argv[i]); + } + goto out; + } + if (opt_s) { + if (ioctl(fd, DIOCGIDENT, ident) == 0) { + printf("%s\n", ident); + } else { + warnx("Failed to determine serial number for: %s", argv[i]); + } + goto out; + } error = ioctl(fd, DIOCGMEDIASIZE, &mediasize); if (error) { warnx("%s: ioctl(DIOCGMEDIASIZE) failed, probably not a disk.", argv[i]); From owner-svn-src-stable@freebsd.org Wed Aug 2 14:45:23 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDD19DD25A7; Wed, 2 Aug 2017 14:45:23 +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 BA8C167736; Wed, 2 Aug 2017 14:45:23 +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 v72EjMtt071579; Wed, 2 Aug 2017 14:45:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72EjMJf071577; Wed, 2 Aug 2017 14:45:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708021445.v72EjMJf071577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 2 Aug 2017 14:45: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: r321928 - stable/11/usr.sbin/diskinfo X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/usr.sbin/diskinfo X-SVN-Commit-Revision: 321928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 14:45:24 -0000 Author: mav Date: Wed Aug 2 14:45:22 2017 New Revision: 321928 URL: https://svnweb.freebsd.org/changeset/base/321928 Log: MFC r320683: Add naive benchmark for SSDs in ZFS SLOG role. ZFS SLOGs have very specific access pattern with many cache flushes, which none of benchmarks I know can simulate. Since SSD vendors rarely specify cache flush time, this measurement can be useful to explain why some ZFS pools are slower then expected. This test writes data chunks of different size followed by cache flush, alike to what ZFS SLOG does, and measures average time. To illustrate, here is result for 6 years old SATA Intel 710 Series SSD: Synchronous random writes: 0.5 kbytes: 138.3 usec/IO = 3.5 Mbytes/s 1 kbytes: 137.7 usec/IO = 7.1 Mbytes/s 2 kbytes: 151.1 usec/IO = 12.9 Mbytes/s 4 kbytes: 158.2 usec/IO = 24.7 Mbytes/s 8 kbytes: 175.6 usec/IO = 44.5 Mbytes/s 16 kbytes: 210.1 usec/IO = 74.4 Mbytes/s 32 kbytes: 274.2 usec/IO = 114.0 Mbytes/s 64 kbytes: 416.5 usec/IO = 150.1 Mbytes/s 128 kbytes: 776.6 usec/IO = 161.0 Mbytes/s 256 kbytes: 1503.1 usec/IO = 166.3 Mbytes/s 512 kbytes: 2968.7 usec/IO = 168.4 Mbytes/s 1024 kbytes: 5866.8 usec/IO = 170.5 Mbytes/s 2048 kbytes: 11696.6 usec/IO = 171.0 Mbytes/s 4096 kbytes: 23329.6 usec/IO = 171.5 Mbytes/s 8192 kbytes: 46779.5 usec/IO = 171.0 Mbytes/s , and much newer and supposedly much faster NVMe Samsung 950 PRO SSD: Synchronous random writes: 0.5 kbytes: 2092.9 usec/IO = 0.2 Mbytes/s 1 kbytes: 2013.1 usec/IO = 0.5 Mbytes/s 2 kbytes: 2014.8 usec/IO = 1.0 Mbytes/s 4 kbytes: 2090.7 usec/IO = 1.9 Mbytes/s 8 kbytes: 2044.5 usec/IO = 3.8 Mbytes/s 16 kbytes: 2084.8 usec/IO = 7.5 Mbytes/s 32 kbytes: 2137.1 usec/IO = 14.6 Mbytes/s 64 kbytes: 2173.4 usec/IO = 28.8 Mbytes/s 128 kbytes: 2923.9 usec/IO = 42.8 Mbytes/s 256 kbytes: 3085.3 usec/IO = 81.0 Mbytes/s 512 kbytes: 3112.2 usec/IO = 160.7 Mbytes/s 1024 kbytes: 2430.6 usec/IO = 411.4 Mbytes/s 2048 kbytes: 3788.9 usec/IO = 527.9 Mbytes/s 4096 kbytes: 6198.0 usec/IO = 645.4 Mbytes/s 8192 kbytes: 10764.9 usec/IO = 743.2 Mbytes/s While the first one obviously has maximal throughput limitations, the second one has so high cache flush latency (about 2 millisecond), that it makes one almost useless in SLOG role, despite of its good throughput numbers. Power loss protection is out of scope of this test, but I suspect it can be related. Modified: stable/11/usr.sbin/diskinfo/diskinfo.8 stable/11/usr.sbin/diskinfo/diskinfo.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/diskinfo/diskinfo.8 ============================================================================== --- stable/11/usr.sbin/diskinfo/diskinfo.8 Wed Aug 2 14:43:12 2017 (r321927) +++ stable/11/usr.sbin/diskinfo/diskinfo.8 Wed Aug 2 14:45:22 2017 (r321928) @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2003 Poul-Henning Kamp +.\" Copyright (c) 2017 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -28,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2017 +.Dd July 4, 2017 .Dt DISKINFO 8 .Os .Sh NAME @@ -36,7 +37,7 @@ .Nd get information about disk device .Sh SYNOPSIS .Nm -.Op Fl citv +.Op Fl citSvw .Ar disk ... .Nm .Op Fl p @@ -64,9 +65,16 @@ This is a string that identifies the physical path to storage enclosure. .It Fl s Return the disk serial number +.It Fl S +Perform synchronous random write test (ZFS SLOG test), +measuring time required to write data blocks of different size and +flush disk cache. +Blocks of more then 128KB are written with multiple parallel operations. .It Fl t Perform a simple and rather naive benchmark of the disks seek and transfer performance. +.It Fl w +Allow disruptive write tests. .El .Pp If given no arguments, the output will be a single line per specified device Modified: stable/11/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- stable/11/usr.sbin/diskinfo/diskinfo.c Wed Aug 2 14:43:12 2017 (r321927) +++ stable/11/usr.sbin/diskinfo/diskinfo.c Wed Aug 2 14:45:22 2017 (r321928) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003 Poul-Henning Kamp * Copyright (c) 2015 Spectra Logic Corporation + * Copyright (c) 2017 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -51,15 +53,16 @@ static void usage(void) { - fprintf(stderr, "usage: diskinfo [-citv] disk ...\n"); + fprintf(stderr, "usage: diskinfo [-cipsStvw] disk ...\n"); exit (1); } -static int opt_c, opt_i, opt_p, opt_s, opt_t, opt_v; +static int opt_c, opt_i, opt_p, opt_s, opt_S, opt_t, opt_v, opt_w; static void speeddisk(int fd, off_t mediasize, u_int sectorsize); static void commandtime(int fd, off_t mediasize, u_int sectorsize); static void iopsbench(int fd, off_t mediasize, u_int sectorsize); +static void slogbench(int fd, int isreg, off_t mediasize, u_int sectorsize); static int zonecheck(int fd, uint32_t *zone_mode, char *zone_str, size_t zone_str_len); @@ -71,10 +74,10 @@ main(int argc, char **argv) char buf[BUFSIZ], ident[DISK_IDENT_SIZE], physpath[MAXPATHLEN]; char zone_desc[64]; off_t mediasize, stripesize, stripeoffset; - u_int sectorsize, fwsectors, fwheads, zoned = 0; + u_int sectorsize, fwsectors, fwheads, zoned = 0, isreg; uint32_t zone_mode; - while ((ch = getopt(argc, argv, "cipstv")) != -1) { + while ((ch = getopt(argc, argv, "cipsStvw")) != -1) { switch (ch) { case 'c': opt_c = 1; @@ -90,6 +93,10 @@ main(int argc, char **argv) case 's': opt_s = 1; break; + case 'S': + opt_S = 1; + opt_v = 1; + break; case 't': opt_t = 1; opt_v = 1; @@ -97,6 +104,9 @@ main(int argc, char **argv) case 'v': opt_v = 1; break; + case 'w': + opt_w = 1; + break; default: usage(); } @@ -112,8 +122,13 @@ main(int argc, char **argv) usage(); } + if (opt_S && !opt_w) { + warnx("-S require also -w"); + usage(); + } + for (i = 0; i < argc; i++) { - fd = open(argv[i], O_RDONLY | O_DIRECT); + fd = open(argv[i], (opt_w ? O_RDWR : O_RDONLY) | O_DIRECT); if (fd < 0 && errno == ENOENT && *argv[i] != '/') { snprintf(buf, BUFSIZ, "%s%s", _PATH_DEV, argv[i]); fd = open(buf, O_RDONLY); @@ -128,7 +143,8 @@ main(int argc, char **argv) exitval = 1; goto out; } - if (S_ISREG(sb.st_mode)) { + isreg = S_ISREG(sb.st_mode); + if (isreg) { mediasize = sb.st_size; sectorsize = S_BLKSIZE; fwsectors = 0; @@ -228,16 +244,18 @@ main(int argc, char **argv) speeddisk(fd, mediasize, sectorsize); if (opt_i) iopsbench(fd, mediasize, sectorsize); + if (opt_S) + slogbench(fd, isreg, mediasize, sectorsize); out: close(fd); } exit (exitval); } +#define MAXTX (8*1024*1024) +#define MEGATX (1024*1024) +static uint8_t buf[MAXTX]; -static char sector[65536]; -static char mega[1024 * 1024]; - static void rdsect(int fd, off_t blockno, u_int sectorsize) { @@ -245,7 +263,7 @@ rdsect(int fd, off_t blockno, u_int sectorsize) if (lseek(fd, (off_t)blockno * sectorsize, SEEK_SET) == -1) err(1, "lseek"); - error = read(fd, sector, sectorsize); + error = read(fd, buf, sectorsize); if (error == -1) err(1, "read"); if (error != (int)sectorsize) @@ -257,10 +275,10 @@ rdmega(int fd) { int error; - error = read(fd, mega, sizeof(mega)); + error = read(fd, buf, MEGATX); if (error == -1) err(1, "read"); - if (error != sizeof(mega)) + if (error != MEGATX) errx(1, "disk too small for test."); } @@ -321,6 +339,16 @@ TI(double count) } static void +TS(u_int size, int count) +{ + double dt; + + dt = delta_t(); + printf("%8.1f usec/IO = %8.1f Mbytes/s\n", + dt * 1000000.0 / count, size * count / dt / (1024 * 1024)); +} + +static void speeddisk(int fd, off_t mediasize, u_int sectorsize) { int bulk, i; @@ -555,6 +583,69 @@ iopsbench(int fd, off_t mediasize, u_int sectorsize) iops(fd, mediasize, 128 * 1024); printf("\n"); +} + +#define MAXIO (128*1024) +#define MAXIOS (MAXTX / MAXIO) + +static void +parwrite(int fd, size_t size, off_t off) +{ + struct aiocb aios[MAXIOS]; + off_t o; + size_t s; + int n, error; + struct aiocb *aiop; + + for (n = 0, o = 0; size > MAXIO; n++, size -= s, o += s) { + s = (size >= MAXIO) ? MAXIO : size; + aiop = &aios[n]; + bzero(aiop, sizeof(*aiop)); + aiop->aio_buf = &buf[o]; + aiop->aio_fildes = fd; + aiop->aio_offset = off + o; + aiop->aio_nbytes = s; + error = aio_write(aiop); + if (error != 0) + err(EX_IOERR, "AIO write submit error"); + } + error = pwrite(fd, &buf[o], size, off + o); + if (error < 0) + err(EX_IOERR, "Sync write error"); + for (; n > 0; n--) { + error = aio_waitcomplete(&aiop, NULL); + if (error < 0) + err(EX_IOERR, "AIO write wait error"); + } +} + +static void +slogbench(int fd, int isreg, off_t mediasize, u_int sectorsize) +{ + off_t off; + u_int size; + int error, n, N; + + printf("Synchronous random writes:\n"); + for (size = sectorsize; size <= MAXTX; size *= 2) { + printf("\t%4.4g kbytes: ", (double)size / 1024); + N = 0; + T0(); + do { + for (n = 0; n < 250; n++) { + off = random() % (mediasize / size); + parwrite(fd, size, off * size); + if (isreg) + error = fsync(fd); + else + error = ioctl(fd, DIOCGFLUSH); + if (error < 0) + err(EX_IOERR, "Flush error"); + } + N += 250; + } while (delta_t() < 1.0); + TS(size, N); + } } static int From owner-svn-src-stable@freebsd.org Wed Aug 2 14:45:59 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C983DD260D; Wed, 2 Aug 2017 14:45:59 +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 6C02D6786F; Wed, 2 Aug 2017 14:45:59 +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 v72EjwkD071656; Wed, 2 Aug 2017 14:45:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72Ejw0o071655; Wed, 2 Aug 2017 14:45:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708021445.v72Ejw0o071655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 2 Aug 2017 14:45: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: r321929 - stable/11/usr.sbin/diskinfo X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/usr.sbin/diskinfo X-SVN-Commit-Revision: 321929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 14:45:59 -0000 Author: mav Date: Wed Aug 2 14:45:58 2017 New Revision: 321929 URL: https://svnweb.freebsd.org/changeset/base/321929 Log: MFC r320730: Report device descr in addition to ident. Serial number without device model is somewhat less useful. Modified: stable/11/usr.sbin/diskinfo/diskinfo.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- stable/11/usr.sbin/diskinfo/diskinfo.c Wed Aug 2 14:45:22 2017 (r321928) +++ stable/11/usr.sbin/diskinfo/diskinfo.c Wed Aug 2 14:45:58 2017 (r321929) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -73,6 +74,7 @@ main(int argc, char **argv) int i, ch, fd, error, exitval = 0; char buf[BUFSIZ], ident[DISK_IDENT_SIZE], physpath[MAXPATHLEN]; char zone_desc[64]; + struct diocgattr_arg arg; off_t mediasize, stripesize, stripeoffset; u_int sectorsize, fwsectors, fwheads, zoned = 0, isreg; uint32_t zone_mode; @@ -230,6 +232,10 @@ main(int argc, char **argv) printf("\t%-12u\t# Heads according to firmware.\n", fwheads); printf("\t%-12u\t# Sectors according to firmware.\n", fwsectors); } + strlcpy(arg.name, "GEOM::descr", sizeof(arg.name)); + arg.len = sizeof(arg.value.str); + if (ioctl(fd, DIOCGATTR, &arg) == 0) + printf("\t%-12s\t# Disk descr.\n", arg.value.str); if (ioctl(fd, DIOCGIDENT, ident) == 0) printf("\t%-12s\t# Disk ident.\n", ident); if (ioctl(fd, DIOCGPHYSPATH, physpath) == 0) From owner-svn-src-stable@freebsd.org Wed Aug 2 15:11:07 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D55DEDD2CF9; Wed, 2 Aug 2017 15:11:07 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE94F686FC; Wed, 2 Aug 2017 15:11:07 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v72FB6Jc080137; Wed, 2 Aug 2017 15:11:06 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72FB665080136; Wed, 2 Aug 2017 15:11:06 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201708021511.v72FB665080136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 2 Aug 2017 15:11: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: r321931 - stable/11/sys/dev/ichsmb X-SVN-Group: stable-11 X-SVN-Commit-Author: gavin X-SVN-Commit-Paths: stable/11/sys/dev/ichsmb X-SVN-Commit-Revision: 321931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 15:11:07 -0000 Author: gavin Date: Wed Aug 2 15:11:06 2017 New Revision: 321931 URL: https://svnweb.freebsd.org/changeset/base/321931 Log: Merge r316113,316184,316413 from head: - Remove #define PCIS_SERIALBUS_SMBUS_PROGIF, unused since r200091 - Switch device_probe() from large case statement to a lookup table - Add several missing SMBus controllers Modified: stable/11/sys/dev/ichsmb/ichsmb_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/11/sys/dev/ichsmb/ichsmb_pci.c Wed Aug 2 14:54:54 2017 (r321930) +++ stable/11/sys/dev/ichsmb/ichsmb_pci.c Wed Aug 2 15:11:06 2017 (r321931) @@ -67,35 +67,89 @@ __FBSDID("$FreeBSD$"); #include /* PCI unique identifiers */ -#define ID_82801AA 0x24138086 -#define ID_82801AB 0x24238086 -#define ID_82801BA 0x24438086 -#define ID_82801CA 0x24838086 -#define ID_82801DC 0x24C38086 -#define ID_82801EB 0x24D38086 -#define ID_82801FB 0x266A8086 -#define ID_82801GB 0x27da8086 -#define ID_82801H 0x283e8086 -#define ID_82801I 0x29308086 -#define ID_82801JI 0x3a308086 -#define ID_PCH 0x3b308086 -#define ID_6300ESB 0x25a48086 -#define ID_631xESB 0x269b8086 -#define ID_DH89XXCC 0x23308086 -#define ID_PATSBURG 0x1d228086 -#define ID_CPT 0x1c228086 -#define ID_PPT 0x1e228086 -#define ID_AVOTON 0x1f3c8086 -#define ID_COLETOCRK 0x23B08086 -#define ID_LPT 0x8c228086 -#define ID_LPTLP 0x9c228086 -#define ID_WCPT 0x8ca28086 -#define ID_WCPTLP 0x9ca28086 -#define ID_WELLSBURG 0x8d228086 -#define ID_SRPT 0xa1238086 -#define ID_SRPTLP 0x9d238086 +#define PCI_VENDOR_INTEL 0x8086 +#define ID_82801AA 0x2413 +#define ID_82801AB 0x2423 +#define ID_82801BA 0x2443 +#define ID_82801CA 0x2483 +#define ID_82801DC 0x24C3 +#define ID_82801EB 0x24D3 +#define ID_82801FB 0x266A +#define ID_82801GB 0x27da +#define ID_82801H 0x283e +#define ID_82801I 0x2930 +#define ID_EP80579 0x5032 +#define ID_82801JI 0x3a30 +#define ID_82801JD 0x3a60 +#define ID_PCH 0x3b30 +#define ID_6300ESB 0x25a4 +#define ID_631xESB 0x269b +#define ID_DH89XXCC 0x2330 +#define ID_PATSBURG 0x1d22 +#define ID_CPT 0x1c22 +#define ID_PPT 0x1e22 +#define ID_AVOTON 0x1f3c +#define ID_COLETOCRK 0x23B0 +#define ID_LPT 0x8c22 +#define ID_LPTLP 0x9c22 +#define ID_WCPT 0x8ca2 +#define ID_WCPTLP 0x9ca2 +#define ID_BAYTRAIL 0x0f12 +#define ID_BRASWELL 0x2292 +#define ID_WELLSBURG 0x8d22 +#define ID_SRPT 0xa123 +#define ID_SRPTLP 0x9d23 +#define ID_DENVERTON 0x19df +#define ID_BROXTON 0x5ad4 +#define ID_LEWISBURG 0xa1a3 +#define ID_LEWISBURG2 0xa223 +#define ID_KABYLAKE 0xa2a3 -#define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 +static const struct ichsmb_device { + uint16_t id; + const char *name; +} ichsmb_devices[] = { + { ID_82801AA, "Intel 82801AA (ICH) SMBus controller" }, + { ID_82801AB, "Intel 82801AB (ICH0) SMBus controller" }, + { ID_82801BA, "Intel 82801BA (ICH2) SMBus controller" }, + { ID_82801CA, "Intel 82801CA (ICH3) SMBus controller" }, + { ID_82801DC, "Intel 82801DC (ICH4) SMBus controller" }, + { ID_82801EB, "Intel 82801EB (ICH5) SMBus controller" }, + { ID_82801FB, "Intel 82801FB (ICH6) SMBus controller" }, + { ID_82801GB, "Intel 82801GB (ICH7) SMBus controller" }, + { ID_82801H, "Intel 82801H (ICH8) SMBus controller" }, + { ID_82801I, "Intel 82801I (ICH9) SMBus controller" }, + { ID_82801GB, "Intel 82801GB (ICH7) SMBus controller" }, + { ID_82801H, "Intel 82801H (ICH8) SMBus controller" }, + { ID_82801I, "Intel 82801I (ICH9) SMBus controller" }, + { ID_EP80579, "Intel EP80579 SMBus controller" }, + { ID_82801JI, "Intel 82801JI (ICH10) SMBus controller" }, + { ID_82801JD, "Intel 82801JD (ICH10) SMBus controller" }, + { ID_PCH, "Intel PCH SMBus controller" }, + { ID_6300ESB, "Intel 6300ESB (ICH) SMBus controller" }, + { ID_631xESB, "Intel 631xESB/6321ESB (ESB2) SMBus controller" }, + { ID_DH89XXCC, "Intel DH89xxCC SMBus controller" }, + { ID_PATSBURG, "Intel Patsburg SMBus controller" }, + { ID_CPT, "Intel Cougar Point SMBus controller" }, + { ID_PPT, "Intel Panther Point SMBus controller" }, + { ID_AVOTON, "Intel Avoton SMBus controller" }, + { ID_LPT, "Intel Lynx Point SMBus controller" }, + { ID_LPTLP, "Intel Lynx Point-LP SMBus controller" }, + { ID_WCPT, "Intel Wildcat Point SMBus controller" }, + { ID_WCPTLP, "Intel Wildcat Point-LP SMBus controller" }, + { ID_BAYTRAIL, "Intel Baytrail SMBus controller" }, + { ID_BRASWELL, "Intel Braswell SMBus controller" }, + { ID_COLETOCRK, "Intel Coleto Creek SMBus controller" }, + { ID_WELLSBURG, "Intel Wellsburg SMBus controller" }, + { ID_SRPT, "Intel Sunrise Point-H SMBus controller" }, + { ID_SRPTLP, "Intel Sunrise Point-LP SMBus controller" }, + { ID_DENVERTON, "Intel Denverton SMBus controller" }, + { ID_BROXTON, "Intel Broxton SMBus controller" }, + { ID_LEWISBURG, "Intel Lewisburg SMBus controller" }, + { ID_LEWISBURG2,"Intel Lewisburg SMBus controller" }, + { ID_KABYLAKE, "Intel Kaby Lake SMBus controller" }, + { 0, NULL }, +}; /* Internal functions */ static int ichsmb_pci_probe(device_t dev); @@ -141,95 +195,19 @@ DRIVER_MODULE(ichsmb, pci, ichsmb_pci_driver, ichsmb_p static int ichsmb_pci_probe(device_t dev) { - /* Check PCI identifier */ - switch (pci_get_devid(dev)) { - case ID_82801AA: - device_set_desc(dev, "Intel 82801AA (ICH) SMBus controller"); - break; - case ID_82801AB: - device_set_desc(dev, "Intel 82801AB (ICH0) SMBus controller"); - break; - case ID_82801BA: - device_set_desc(dev, "Intel 82801BA (ICH2) SMBus controller"); - break; - case ID_82801CA: - device_set_desc(dev, "Intel 82801CA (ICH3) SMBus controller"); - break; - case ID_82801DC: - device_set_desc(dev, "Intel 82801DC (ICH4) SMBus controller"); - break; - case ID_82801EB: - device_set_desc(dev, "Intel 82801EB (ICH5) SMBus controller"); - break; - case ID_82801FB: - device_set_desc(dev, "Intel 82801FB (ICH6) SMBus controller"); - break; - case ID_82801GB: - device_set_desc(dev, "Intel 82801GB (ICH7) SMBus controller"); - break; - case ID_82801H: - device_set_desc(dev, "Intel 82801H (ICH8) SMBus controller"); - break; - case ID_82801I: - device_set_desc(dev, "Intel 82801I (ICH9) SMBus controller"); - break; - case ID_82801JI: - device_set_desc(dev, "Intel 82801JI (ICH10) SMBus controller"); - break; - case ID_PCH: - device_set_desc(dev, "Intel PCH SMBus controller"); - break; - case ID_6300ESB: - device_set_desc(dev, "Intel 6300ESB (ICH) SMBus controller"); - break; - case ID_631xESB: - device_set_desc(dev, "Intel 631xESB/6321ESB (ESB2) SMBus controller"); - break; - case ID_DH89XXCC: - device_set_desc(dev, "Intel DH89xxCC SMBus controller"); - break; - case ID_PATSBURG: - device_set_desc(dev, "Intel Patsburg SMBus controller"); - break; - case ID_CPT: - device_set_desc(dev, "Intel Cougar Point SMBus controller"); - break; - case ID_PPT: - device_set_desc(dev, "Intel Panther Point SMBus controller"); - break; - case ID_AVOTON: - device_set_desc(dev, "Intel Avoton SMBus controller"); - break; - case ID_LPT: - device_set_desc(dev, "Intel Lynx Point SMBus controller"); - break; - case ID_LPTLP: - device_set_desc(dev, "Intel Lynx Point-LP SMBus controller"); - break; - case ID_WCPT: - device_set_desc(dev, "Intel Wildcat Point SMBus controller"); - break; - case ID_WCPTLP: - device_set_desc(dev, "Intel Wildcat Point-LP SMBus controller"); - break; - case ID_COLETOCRK: - device_set_desc(dev, "Intel Coleto Creek SMBus controller"); - break; - case ID_WELLSBURG: - device_set_desc(dev, "Intel Wellsburg SMBus controller"); - break; - case ID_SRPT: - device_set_desc(dev, "Intel Sunrise Point-H SMBus controller"); - break; - case ID_SRPTLP: - device_set_desc(dev, "Intel Sunrise Point-LP SMBus controller"); - break; - default: + const struct ichsmb_device *device; + + if (pci_get_vendor(dev) != PCI_VENDOR_INTEL) return (ENXIO); + + for (device = ichsmb_devices; device->name != NULL; device++) { + if (pci_get_device(dev) == device->id) { + device_set_desc(dev, device->name); + return (ichsmb_probe(dev)); + } } - /* Done */ - return (ichsmb_probe(dev)); + return (ENXIO); } static int From owner-svn-src-stable@freebsd.org Wed Aug 2 15:13:14 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDF27DD2E7C; Wed, 2 Aug 2017 15:13:14 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65EDA68931; Wed, 2 Aug 2017 15:13:14 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v72FDDkp083977; Wed, 2 Aug 2017 15:13:13 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72FDDPa083976; Wed, 2 Aug 2017 15:13:13 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201708021513.v72FDDPa083976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 2 Aug 2017 15:13:13 +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: r321932 - stable/10/sys/dev/ichsmb X-SVN-Group: stable-10 X-SVN-Commit-Author: gavin X-SVN-Commit-Paths: stable/10/sys/dev/ichsmb X-SVN-Commit-Revision: 321932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 15:13:14 -0000 Author: gavin Date: Wed Aug 2 15:13:13 2017 New Revision: 321932 URL: https://svnweb.freebsd.org/changeset/base/321932 Log: Merge r316113,316184,316413 from head: - Remove #define PCIS_SERIALBUS_SMBUS_PROGIF, unused since r200091 - Switch device_probe() from large case statement to a lookup table - Add several missing SMBus controllers Modified: stable/10/sys/dev/ichsmb/ichsmb_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/10/sys/dev/ichsmb/ichsmb_pci.c Wed Aug 2 15:11:06 2017 (r321931) +++ stable/10/sys/dev/ichsmb/ichsmb_pci.c Wed Aug 2 15:13:13 2017 (r321932) @@ -67,35 +67,89 @@ __FBSDID("$FreeBSD$"); #include /* PCI unique identifiers */ -#define ID_82801AA 0x24138086 -#define ID_82801AB 0x24238086 -#define ID_82801BA 0x24438086 -#define ID_82801CA 0x24838086 -#define ID_82801DC 0x24C38086 -#define ID_82801EB 0x24D38086 -#define ID_82801FB 0x266A8086 -#define ID_82801GB 0x27da8086 -#define ID_82801H 0x283e8086 -#define ID_82801I 0x29308086 -#define ID_82801JI 0x3a308086 -#define ID_PCH 0x3b308086 -#define ID_6300ESB 0x25a48086 -#define ID_631xESB 0x269b8086 -#define ID_DH89XXCC 0x23308086 -#define ID_PATSBURG 0x1d228086 -#define ID_CPT 0x1c228086 -#define ID_PPT 0x1e228086 -#define ID_AVOTON 0x1f3c8086 -#define ID_COLETOCRK 0x23B08086 -#define ID_LPT 0x8c228086 -#define ID_LPTLP 0x9c228086 -#define ID_WCPT 0x8ca28086 -#define ID_WCPTLP 0x9ca28086 -#define ID_WELLSBURG 0x8d228086 -#define ID_SRPT 0xa1238086 -#define ID_SRPTLP 0x9d238086 +#define PCI_VENDOR_INTEL 0x8086 +#define ID_82801AA 0x2413 +#define ID_82801AB 0x2423 +#define ID_82801BA 0x2443 +#define ID_82801CA 0x2483 +#define ID_82801DC 0x24C3 +#define ID_82801EB 0x24D3 +#define ID_82801FB 0x266A +#define ID_82801GB 0x27da +#define ID_82801H 0x283e +#define ID_82801I 0x2930 +#define ID_EP80579 0x5032 +#define ID_82801JI 0x3a30 +#define ID_82801JD 0x3a60 +#define ID_PCH 0x3b30 +#define ID_6300ESB 0x25a4 +#define ID_631xESB 0x269b +#define ID_DH89XXCC 0x2330 +#define ID_PATSBURG 0x1d22 +#define ID_CPT 0x1c22 +#define ID_PPT 0x1e22 +#define ID_AVOTON 0x1f3c +#define ID_COLETOCRK 0x23B0 +#define ID_LPT 0x8c22 +#define ID_LPTLP 0x9c22 +#define ID_WCPT 0x8ca2 +#define ID_WCPTLP 0x9ca2 +#define ID_BAYTRAIL 0x0f12 +#define ID_BRASWELL 0x2292 +#define ID_WELLSBURG 0x8d22 +#define ID_SRPT 0xa123 +#define ID_SRPTLP 0x9d23 +#define ID_DENVERTON 0x19df +#define ID_BROXTON 0x5ad4 +#define ID_LEWISBURG 0xa1a3 +#define ID_LEWISBURG2 0xa223 +#define ID_KABYLAKE 0xa2a3 -#define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 +static const struct ichsmb_device { + uint16_t id; + const char *name; +} ichsmb_devices[] = { + { ID_82801AA, "Intel 82801AA (ICH) SMBus controller" }, + { ID_82801AB, "Intel 82801AB (ICH0) SMBus controller" }, + { ID_82801BA, "Intel 82801BA (ICH2) SMBus controller" }, + { ID_82801CA, "Intel 82801CA (ICH3) SMBus controller" }, + { ID_82801DC, "Intel 82801DC (ICH4) SMBus controller" }, + { ID_82801EB, "Intel 82801EB (ICH5) SMBus controller" }, + { ID_82801FB, "Intel 82801FB (ICH6) SMBus controller" }, + { ID_82801GB, "Intel 82801GB (ICH7) SMBus controller" }, + { ID_82801H, "Intel 82801H (ICH8) SMBus controller" }, + { ID_82801I, "Intel 82801I (ICH9) SMBus controller" }, + { ID_82801GB, "Intel 82801GB (ICH7) SMBus controller" }, + { ID_82801H, "Intel 82801H (ICH8) SMBus controller" }, + { ID_82801I, "Intel 82801I (ICH9) SMBus controller" }, + { ID_EP80579, "Intel EP80579 SMBus controller" }, + { ID_82801JI, "Intel 82801JI (ICH10) SMBus controller" }, + { ID_82801JD, "Intel 82801JD (ICH10) SMBus controller" }, + { ID_PCH, "Intel PCH SMBus controller" }, + { ID_6300ESB, "Intel 6300ESB (ICH) SMBus controller" }, + { ID_631xESB, "Intel 631xESB/6321ESB (ESB2) SMBus controller" }, + { ID_DH89XXCC, "Intel DH89xxCC SMBus controller" }, + { ID_PATSBURG, "Intel Patsburg SMBus controller" }, + { ID_CPT, "Intel Cougar Point SMBus controller" }, + { ID_PPT, "Intel Panther Point SMBus controller" }, + { ID_AVOTON, "Intel Avoton SMBus controller" }, + { ID_LPT, "Intel Lynx Point SMBus controller" }, + { ID_LPTLP, "Intel Lynx Point-LP SMBus controller" }, + { ID_WCPT, "Intel Wildcat Point SMBus controller" }, + { ID_WCPTLP, "Intel Wildcat Point-LP SMBus controller" }, + { ID_BAYTRAIL, "Intel Baytrail SMBus controller" }, + { ID_BRASWELL, "Intel Braswell SMBus controller" }, + { ID_COLETOCRK, "Intel Coleto Creek SMBus controller" }, + { ID_WELLSBURG, "Intel Wellsburg SMBus controller" }, + { ID_SRPT, "Intel Sunrise Point-H SMBus controller" }, + { ID_SRPTLP, "Intel Sunrise Point-LP SMBus controller" }, + { ID_DENVERTON, "Intel Denverton SMBus controller" }, + { ID_BROXTON, "Intel Broxton SMBus controller" }, + { ID_LEWISBURG, "Intel Lewisburg SMBus controller" }, + { ID_LEWISBURG2,"Intel Lewisburg SMBus controller" }, + { ID_KABYLAKE, "Intel Kaby Lake SMBus controller" }, + { 0, NULL }, +}; /* Internal functions */ static int ichsmb_pci_probe(device_t dev); @@ -141,95 +195,19 @@ DRIVER_MODULE(ichsmb, pci, ichsmb_pci_driver, ichsmb_p static int ichsmb_pci_probe(device_t dev) { - /* Check PCI identifier */ - switch (pci_get_devid(dev)) { - case ID_82801AA: - device_set_desc(dev, "Intel 82801AA (ICH) SMBus controller"); - break; - case ID_82801AB: - device_set_desc(dev, "Intel 82801AB (ICH0) SMBus controller"); - break; - case ID_82801BA: - device_set_desc(dev, "Intel 82801BA (ICH2) SMBus controller"); - break; - case ID_82801CA: - device_set_desc(dev, "Intel 82801CA (ICH3) SMBus controller"); - break; - case ID_82801DC: - device_set_desc(dev, "Intel 82801DC (ICH4) SMBus controller"); - break; - case ID_82801EB: - device_set_desc(dev, "Intel 82801EB (ICH5) SMBus controller"); - break; - case ID_82801FB: - device_set_desc(dev, "Intel 82801FB (ICH6) SMBus controller"); - break; - case ID_82801GB: - device_set_desc(dev, "Intel 82801GB (ICH7) SMBus controller"); - break; - case ID_82801H: - device_set_desc(dev, "Intel 82801H (ICH8) SMBus controller"); - break; - case ID_82801I: - device_set_desc(dev, "Intel 82801I (ICH9) SMBus controller"); - break; - case ID_82801JI: - device_set_desc(dev, "Intel 82801JI (ICH10) SMBus controller"); - break; - case ID_PCH: - device_set_desc(dev, "Intel PCH SMBus controller"); - break; - case ID_6300ESB: - device_set_desc(dev, "Intel 6300ESB (ICH) SMBus controller"); - break; - case ID_631xESB: - device_set_desc(dev, "Intel 631xESB/6321ESB (ESB2) SMBus controller"); - break; - case ID_DH89XXCC: - device_set_desc(dev, "Intel DH89xxCC SMBus controller"); - break; - case ID_PATSBURG: - device_set_desc(dev, "Intel Patsburg SMBus controller"); - break; - case ID_CPT: - device_set_desc(dev, "Intel Cougar Point SMBus controller"); - break; - case ID_PPT: - device_set_desc(dev, "Intel Panther Point SMBus controller"); - break; - case ID_AVOTON: - device_set_desc(dev, "Intel Avoton SMBus controller"); - break; - case ID_LPT: - device_set_desc(dev, "Intel Lynx Point SMBus controller"); - break; - case ID_LPTLP: - device_set_desc(dev, "Intel Lynx Point-LP SMBus controller"); - break; - case ID_WCPT: - device_set_desc(dev, "Intel Wildcat Point SMBus controller"); - break; - case ID_WCPTLP: - device_set_desc(dev, "Intel Wildcat Point-LP SMBus controller"); - break; - case ID_COLETOCRK: - device_set_desc(dev, "Intel Coleto Creek SMBus controller"); - break; - case ID_WELLSBURG: - device_set_desc(dev, "Intel Wellsburg SMBus controller"); - break; - case ID_SRPT: - device_set_desc(dev, "Intel Sunrise Point-H SMBus controller"); - break; - case ID_SRPTLP: - device_set_desc(dev, "Intel Sunrise Point-LP SMBus controller"); - break; - default: + const struct ichsmb_device *device; + + if (pci_get_vendor(dev) != PCI_VENDOR_INTEL) return (ENXIO); + + for (device = ichsmb_devices; device->name != NULL; device++) { + if (pci_get_device(dev) == device->id) { + device_set_desc(dev, device->name); + return (ichsmb_probe(dev)); + } } - /* Done */ - return (ichsmb_probe(dev)); + return (ENXIO); } static int From owner-svn-src-stable@freebsd.org Wed Aug 2 20:24:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1AFFDB3B75; Wed, 2 Aug 2017 20:24: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 A567C76696; Wed, 2 Aug 2017 20:24: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 v72KOQeK019033; Wed, 2 Aug 2017 20:24:26 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72KOQoT019032; Wed, 2 Aug 2017 20:24:26 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708022024.v72KOQoT019032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 2 Aug 2017 20:24: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: r321944 - stable/11/sys/dev/isp X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: stable/11/sys/dev/isp X-SVN-Commit-Revision: 321944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 20:24:28 -0000 Author: ken Date: Wed Aug 2 20:24:26 2017 New Revision: 321944 URL: https://svnweb.freebsd.org/changeset/base/321944 Log: MFC r321622, r321623: ------------------------------------------------------------------------ r321622 | ken | 2017-07-27 09:33:57 -0600 (Thu, 27 Jul 2017) | 44 lines Fix probing FC targets with hard addressing turned on. This largely reverts FreeBSD SVN change 289937 from October 25th, 2015. The intent of that change was to keep loop IDs persistent across chip reinits. The problem is that the change turned on the PREVLOOP / PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the Qlogic chip to not participate in the loop if it can't get the requested loop address. It also turned off soft addressing on 2400 (4Gb) and newer controllers. The isp(4) driver defaults to loop address 0, and the tape drives I have tested default to loop address 0 if hard addressing is turned on. So when hard loop addressing is turned on on the drive, the isp(4) driver just refuses to participate in the loop. The solution is to largely revert that change. I left some elements in place that are related to virtual ports, since they were new. This does work with IBM tape drives with hard and soft addressing turned on. I have tested it with 4Gb, 8Gb, and 16Gb controllers. sys/dev/isp.c: Largely revert FreeBSD SVN change 289937. I left the ispmbox.h changes in place. Don't use the PREV_ADDRESS bit on initialization. It tells the chip to not participate if it can't get the requested loop ID. Do use soft addressing on 2400 and newer chips. Use hard addressing when the user has requested a specific initiator ID. (hint.isp.X.iid=N in /boot/loader.conf) Leave some of the virtual port options from that change in place, but don't turn on the PREV_ADDRESS bit. Reviewed by: mav Sponsored by: Spectra Logic ------------------------------------------------------------------------ r321623 | ken | 2017-07-27 09:51:56 -0600 (Thu, 27 Jul 2017) | 6 lines Remove duplicate assignments from r321622. Submitted by: mav Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/11/sys/dev/isp/isp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Wed Aug 2 20:23:25 2017 (r321943) +++ stable/11/sys/dev/isp/isp.c Wed Aug 2 20:24:26 2017 (r321944) @@ -1631,6 +1631,7 @@ isp_fibre_init(ispsoftc_t *isp) fcparam *fcp; isp_icb_t local, *icbp = &local; mbreg_t mbs; + int ownloopid; /* * We only support one channel on non-24XX cards @@ -1709,15 +1710,22 @@ isp_fibre_init(ispsoftc_t *isp) } icbp->icb_retry_delay = fcp->isp_retry_delay; icbp->icb_retry_count = fcp->isp_retry_count; - if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - icbp->icb_hardaddr = fcp->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; - else - icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS; + icbp->icb_hardaddr = fcp->isp_loopid; + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; + if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) { + icbp->icb_hardaddr = 0; + ownloopid = 0; } /* + * Our life seems so much better with 2200s and later with + * the latest f/w if we set Hard Address. + */ + if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) { + icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; + } + + /* * Right now we just set extended options to prefer point-to-point * over loop based upon some soft config options. * @@ -1951,6 +1959,7 @@ isp_fibre_init_2400(ispsoftc_t *isp) isp_icb_2400_t local, *icbp = &local; mbreg_t mbs; int chan; + int ownloopid = 0; /* * Check to see whether all channels have *some* kind of role @@ -2023,14 +2032,17 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_xchgcnt >>= 1; } - if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - icbp->icb_hardaddr = fcp->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; - else - icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS; + + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; + icbp->icb_hardaddr = fcp->isp_loopid; + if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) { + icbp->icb_hardaddr = 0; + ownloopid = 0; } + if (ownloopid) + icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; + if (isp->isp_confopts & ISP_CFG_NOFCTAPE) { icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE; } @@ -2132,6 +2144,9 @@ isp_fibre_init_2400(ispsoftc_t *isp) break; } } + if (ownloopid == 0) { + icbp->icb_fwoptions3 |= ICB2400_OPT3_SOFTID; + } icbp->icb_logintime = ICB_LOGIN_TOV; if (fcp->isp_wwnn && fcp->isp_wwpn) { @@ -2244,14 +2259,13 @@ isp_fibre_init_2400(ispsoftc_t *isp) pi.vp_port_options |= ICB2400_VPOPT_INI_ENABLE; if ((fcp2->role & ISP_ROLE_TARGET) == 0) pi.vp_port_options |= ICB2400_VPOPT_TGT_DISABLE; + if (fcp2->isp_loopid < LOCAL_LOOP_LIM) { + pi.vp_port_loopid = fcp2->isp_loopid; + if (isp->isp_confopts & ISP_CFG_OWNLOOPID) + pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS; + } + } - if (fcp2->isp_loopid < LOCAL_LOOP_LIM) { - pi.vp_port_loopid = fcp2->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS; - else - pi.vp_port_options |= ICB2400_VPOPT_PREV_ADDRESS; - } MAKE_NODE_NAME_FROM_WWN(pi.vp_port_portname, fcp2->isp_wwpn); MAKE_NODE_NAME_FROM_WWN(pi.vp_port_nodename, fcp2->isp_wwnn); off = fcp->isp_scratch; @@ -2329,8 +2343,6 @@ isp_fc_enable_vp(ispsoftc_t *isp, int chan) vp.vp_mod_ports[0].loopid = fcp->isp_loopid; if (isp->isp_confopts & ISP_CFG_OWNLOOPID) vp.vp_mod_ports[0].options |= ICB2400_VPOPT_HARD_ADDRESS; - else - vp.vp_mod_ports[0].options |= ICB2400_VPOPT_PREV_ADDRESS; } MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwpn, fcp->isp_wwpn); MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwnn, fcp->isp_wwnn); From owner-svn-src-stable@freebsd.org Wed Aug 2 20:24:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E422DB3B7D; Wed, 2 Aug 2017 20:24:29 +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 3A50676697; Wed, 2 Aug 2017 20:24:29 +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 v72KOS9m019078; Wed, 2 Aug 2017 20:24:28 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72KOSbT019077; Wed, 2 Aug 2017 20:24:28 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708022024.v72KOSbT019077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 2 Aug 2017 20:24: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: r321945 - stable/10/sys/dev/isp X-SVN-Group: stable-10 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: stable/10/sys/dev/isp X-SVN-Commit-Revision: 321945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 20:24:29 -0000 Author: ken Date: Wed Aug 2 20:24:28 2017 New Revision: 321945 URL: https://svnweb.freebsd.org/changeset/base/321945 Log: MFC r321622, r321623: ------------------------------------------------------------------------ r321622 | ken | 2017-07-27 09:33:57 -0600 (Thu, 27 Jul 2017) | 44 lines Fix probing FC targets with hard addressing turned on. This largely reverts FreeBSD SVN change 289937 from October 25th, 2015. The intent of that change was to keep loop IDs persistent across chip reinits. The problem is that the change turned on the PREVLOOP / PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the Qlogic chip to not participate in the loop if it can't get the requested loop address. It also turned off soft addressing on 2400 (4Gb) and newer controllers. The isp(4) driver defaults to loop address 0, and the tape drives I have tested default to loop address 0 if hard addressing is turned on. So when hard loop addressing is turned on on the drive, the isp(4) driver just refuses to participate in the loop. The solution is to largely revert that change. I left some elements in place that are related to virtual ports, since they were new. This does work with IBM tape drives with hard and soft addressing turned on. I have tested it with 4Gb, 8Gb, and 16Gb controllers. sys/dev/isp.c: Largely revert FreeBSD SVN change 289937. I left the ispmbox.h changes in place. Don't use the PREV_ADDRESS bit on initialization. It tells the chip to not participate if it can't get the requested loop ID. Do use soft addressing on 2400 and newer chips. Use hard addressing when the user has requested a specific initiator ID. (hint.isp.X.iid=N in /boot/loader.conf) Leave some of the virtual port options from that change in place, but don't turn on the PREV_ADDRESS bit. Reviewed by: mav Sponsored by: Spectra Logic ------------------------------------------------------------------------ r321623 | ken | 2017-07-27 09:51:56 -0600 (Thu, 27 Jul 2017) | 6 lines Remove duplicate assignments from r321622. Submitted by: mav Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Wed Aug 2 20:24:26 2017 (r321944) +++ stable/10/sys/dev/isp/isp.c Wed Aug 2 20:24:28 2017 (r321945) @@ -1632,6 +1632,7 @@ isp_fibre_init(ispsoftc_t *isp) fcparam *fcp; isp_icb_t local, *icbp = &local; mbreg_t mbs; + int ownloopid; /* * We only support one channel on non-24XX cards @@ -1710,15 +1711,22 @@ isp_fibre_init(ispsoftc_t *isp) } icbp->icb_retry_delay = fcp->isp_retry_delay; icbp->icb_retry_count = fcp->isp_retry_count; - if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - icbp->icb_hardaddr = fcp->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; - else - icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS; + icbp->icb_hardaddr = fcp->isp_loopid; + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; + if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) { + icbp->icb_hardaddr = 0; + ownloopid = 0; } /* + * Our life seems so much better with 2200s and later with + * the latest f/w if we set Hard Address. + */ + if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) { + icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; + } + + /* * Right now we just set extended options to prefer point-to-point * over loop based upon some soft config options. * @@ -1952,6 +1960,7 @@ isp_fibre_init_2400(ispsoftc_t *isp) isp_icb_2400_t local, *icbp = &local; mbreg_t mbs; int chan; + int ownloopid = 0; /* * Check to see whether all channels have *some* kind of role @@ -2024,14 +2033,17 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_xchgcnt >>= 1; } - if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - icbp->icb_hardaddr = fcp->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; - else - icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS; + + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; + icbp->icb_hardaddr = fcp->isp_loopid; + if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) { + icbp->icb_hardaddr = 0; + ownloopid = 0; } + if (ownloopid) + icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; + if (isp->isp_confopts & ISP_CFG_NOFCTAPE) { icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE; } @@ -2133,6 +2145,9 @@ isp_fibre_init_2400(ispsoftc_t *isp) break; } } + if (ownloopid == 0) { + icbp->icb_fwoptions3 |= ICB2400_OPT3_SOFTID; + } icbp->icb_logintime = ICB_LOGIN_TOV; if (fcp->isp_wwnn && fcp->isp_wwpn) { @@ -2245,14 +2260,13 @@ isp_fibre_init_2400(ispsoftc_t *isp) pi.vp_port_options |= ICB2400_VPOPT_INI_ENABLE; if ((fcp2->role & ISP_ROLE_TARGET) == 0) pi.vp_port_options |= ICB2400_VPOPT_TGT_DISABLE; + if (fcp2->isp_loopid < LOCAL_LOOP_LIM) { + pi.vp_port_loopid = fcp2->isp_loopid; + if (isp->isp_confopts & ISP_CFG_OWNLOOPID) + pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS; + } + } - if (fcp2->isp_loopid < LOCAL_LOOP_LIM) { - pi.vp_port_loopid = fcp2->isp_loopid; - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) - pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS; - else - pi.vp_port_options |= ICB2400_VPOPT_PREV_ADDRESS; - } MAKE_NODE_NAME_FROM_WWN(pi.vp_port_portname, fcp2->isp_wwpn); MAKE_NODE_NAME_FROM_WWN(pi.vp_port_nodename, fcp2->isp_wwnn); off = fcp->isp_scratch; @@ -2330,8 +2344,6 @@ isp_fc_enable_vp(ispsoftc_t *isp, int chan) vp.vp_mod_ports[0].loopid = fcp->isp_loopid; if (isp->isp_confopts & ISP_CFG_OWNLOOPID) vp.vp_mod_ports[0].options |= ICB2400_VPOPT_HARD_ADDRESS; - else - vp.vp_mod_ports[0].options |= ICB2400_VPOPT_PREV_ADDRESS; } MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwpn, fcp->isp_wwpn); MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwnn, fcp->isp_wwnn); From owner-svn-src-stable@freebsd.org Wed Aug 2 20:27:32 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D3CFDB3CE1; Wed, 2 Aug 2017 20:27:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 068C376933; Wed, 2 Aug 2017 20:27:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v72KRVuL019223; Wed, 2 Aug 2017 20:27:31 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v72KRU9F019219; Wed, 2 Aug 2017 20:27:30 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708022027.v72KRU9F019219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 2 Aug 2017 20:27: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: r321946 - in stable/10/sys: arm/freescale/imx conf powerpc/mpc85xx X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10/sys: arm/freescale/imx conf powerpc/mpc85xx X-SVN-Commit-Revision: 321946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 20:27:32 -0000 Author: marius Date: Wed Aug 2 20:27:30 2017 New Revision: 321946 URL: https://svnweb.freebsd.org/changeset/base/321946 Log: Apply the other half of merges to sdhci_imx(4) and sdhci_fsl(4) that somehow stayed local when committing r318198, probably due to the associated tree conflicts. While at it, register the dependency of sdhci_fsl(4) on sdhci(4) and allow the former to be built. Modified: stable/10/sys/arm/freescale/imx/imx_sdhci.c stable/10/sys/conf/files.powerpc stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c stable/10/sys/powerpc/mpc85xx/fsl_sdhc.h Modified: stable/10/sys/arm/freescale/imx/imx_sdhci.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_sdhci.c Wed Aug 2 20:24:28 2017 (r321945) +++ stable/10/sys/arm/freescale/imx/imx_sdhci.c Wed Aug 2 20:27:30 2017 (r321946) @@ -59,10 +59,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include + +#include "mmcbr_if.h" #include "sdhci_if.h" struct imx_sdhci_softc { @@ -803,7 +803,6 @@ static device_method_t imx_sdhci_methods[] = { /* Bus interface */ DEVMETHOD(bus_read_ivar, sdhci_generic_read_ivar), DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), - DEVMETHOD(bus_print_child, bus_generic_print_child), /* MMC bridge interface */ DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), @@ -822,7 +821,7 @@ static device_method_t imx_sdhci_methods[] = { DEVMETHOD(sdhci_write_4, imx_sdhci_write_4), DEVMETHOD(sdhci_write_multi_4, imx_sdhci_write_multi_4), - { 0, 0 } + DEVMETHOD_END }; static devclass_t imx_sdhci_devclass; @@ -833,7 +832,7 @@ static driver_t imx_sdhci_driver = { sizeof(struct imx_sdhci_softc), }; -DRIVER_MODULE(sdhci_imx, simplebus, imx_sdhci_driver, imx_sdhci_devclass, 0, 0); +DRIVER_MODULE(sdhci_imx, simplebus, imx_sdhci_driver, imx_sdhci_devclass, + NULL, NULL); MODULE_DEPEND(sdhci_imx, sdhci, 1, 1, 1); -DRIVER_MODULE(mmc, sdhci_imx, mmc_driver, mmc_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_imx, mmc, 1, 1, 1); +MMC_DECLARE_BRIDGE(sdhci_imx); Modified: stable/10/sys/conf/files.powerpc ============================================================================== --- stable/10/sys/conf/files.powerpc Wed Aug 2 20:24:28 2017 (r321945) +++ stable/10/sys/conf/files.powerpc Wed Aug 2 20:27:30 2017 (r321946) @@ -131,6 +131,7 @@ powerpc/mpc85xx/ds1553_bus_fdt.c optional ds1553 fdt powerpc/mpc85xx/ds1553_core.c optional ds1553 powerpc/mpc85xx/i2c.c optional iicbus fdt powerpc/mpc85xx/isa.c optional mpc85xx isa +powerpc/mpc85xx/fsl_sdhc.c optional mpc85xx sdhci powerpc/mpc85xx/lbc.c optional mpc85xx powerpc/mpc85xx/mpc85xx.c optional mpc85xx powerpc/mpc85xx/platform_mpc85xx.c optional mpc85xx Modified: stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c ============================================================================== --- stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c Wed Aug 2 20:24:28 2017 (r321945) +++ stable/10/sys/powerpc/mpc85xx/fsl_sdhc.c Wed Aug 2 20:27:30 2017 (r321946) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -112,7 +111,7 @@ static device_method_t fsl_sdhc_methods[] = { DEVMETHOD(mmcbr_acquire_host, fsl_sdhc_acquire_host), DEVMETHOD(mmcbr_release_host, fsl_sdhc_release_host), - {0, 0}, + DEVMETHOD_END }; /* kobj_class definition */ @@ -124,9 +123,9 @@ static driver_t fsl_sdhc_driver = { static devclass_t fsl_sdhc_devclass; -DRIVER_MODULE(sdhci, simplebus, fsl_sdhc_driver, fsl_sdhc_devclass, 0, 0); -DRIVER_MODULE(mmc, sdhci_fsl, mmc_driver, mmc_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_fsl, mmc, 1, 1, 1); +DRIVER_MODULE(sdhci, simplebus, fsl_sdhc_driver, fsl_sdhc_devclass, NULL, NULL); +MODULE_DEPEND(sdhci_fsl, sdhci, 1, 1, 1); +MMC_DECLARE_BRIDGE(sdhci_fsl); /***************************************************************************** * Private methods Modified: stable/10/sys/powerpc/mpc85xx/fsl_sdhc.h ============================================================================== --- stable/10/sys/powerpc/mpc85xx/fsl_sdhc.h Wed Aug 2 20:24:28 2017 (r321945) +++ stable/10/sys/powerpc/mpc85xx/fsl_sdhc.h Wed Aug 2 20:27:30 2017 (r321946) @@ -46,12 +46,8 @@ #include #include -#include #include -#include "mmcbr_if.h" - - /***************************************************************************** * Private defines *****************************************************************************/ @@ -112,7 +108,6 @@ struct fsl_sdhc_softc { #define FSL_SDHC_DMA_SEGMENT_SIZE (1024) #define FSL_SDHC_DMA_ALIGNMENT (4) #define FSL_SDHC_DMA_BLOCK_SIZE FSL_SDHC_MAX_BLOCK_SIZE - /* * Offsets of SD HC registers From owner-svn-src-stable@freebsd.org Wed Aug 2 20:43:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 435A0DB4640; Wed, 2 Aug 2017 20:43:22 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x22c.google.com (mail-pg0-x22c.google.com [IPv6:2607:f8b0:400e:c05::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 0C6037738D; Wed, 2 Aug 2017 20:43:22 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x22c.google.com with SMTP id l64so25500360pge.5; Wed, 02 Aug 2017 13:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=l/XfYYMttiUGoq4YGghKRNUePTkZ+V1iINoXJ1Pnsy8=; b=hd7fZeeWb+vI6pw/I696H5ykHORQZZLB/6Jp7XUQM5W/3x53E7fxLYELNlAC6FSYy5 Lo/BkerhM0FL3KCtLJkybffEyeAqUa9djH8nClZH7EuzQj8TxelsaNPVNU67vvCc4zSY FXmOBbkMa8GOG2AbZpb0TUFB3T0l5DAetb5epnH7bzZQfT06CLH10qusCx60dhlTlMOq GXpjqUQ+R70DFeWTKlzHObXicVXmrO1RJ6FqaXyLPQFMDCdG2JdWgr/pON0KMX5ysnli 4NOLqMMStU1hO6kAfe7ZpDsukwwftSlbve8QpjYInRwgj4MGNJ3AS/34ea8DtdbH0DPy oayQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=l/XfYYMttiUGoq4YGghKRNUePTkZ+V1iINoXJ1Pnsy8=; b=lHsZyOjLNG1NpzKiwH1KGTXUQiWvacPoht/SUMKycxGc+8UBoG1F8C5pKOwOe8s+ii vBBLd8EPcqcgEwy/MBGj4q6UyhB7T2Uu2qlssQm0+o8KIkc5Ja/UJXLHIh8bBP7Yi7ge 7hycgvF2M/ywMAXYIyO2wcm64ZwifQJvdvVQJZNxQE3DxG4SL8f50f2IcpoiLdoB3SKf ZJmoJZqttlkO0b63vfmctGSMPkHYvhvkJCFSTIRi/0F2lqo9XINc5dFChCL2lbyqT+9r rlqYR5iwOK/2tPAr3XiGQU17mC8f/nCEk9f+qjT9EUZg4ZVpgfpbB2JrlnJyNOAZ+vy8 yTtQ== X-Gm-Message-State: AIVw113CToRPt+Ej1s6V2JUNVM0fIGsz6/bFMOK1xnRnKxlUhb5JU6ZV A+P+z7W08vIPwabFmw4= X-Received: by 10.98.58.210 with SMTP id v79mr24281916pfj.162.1501706600929; Wed, 02 Aug 2017 13:43:20 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id i133sm27545656pgc.0.2017.08.02.13.43.19 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Aug 2017 13:43:20 -0700 (PDT) Subject: Re: svn commit: r321093 - in stable/10: bin/ln bin/ln/tests etc/mtree Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_7A6671DF-83BA-4A91-9B05-F6BEE593163B"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Wed, 2 Aug 2017 13:43:18 -0700 Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Message-Id: References: <201707172112.v6HLC2In057796@repo.freebsd.org> To: Alan Somers X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Aug 2017 20:43:22 -0000 --Apple-Mail=_7A6671DF-83BA-4A91-9B05-F6BEE593163B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 31, 2017, at 14:34, Alan Somers wrote: >=20 > On Mon, Jul 17, 2017 at 3:12 PM, Ngie Cooper wrote: >> Author: ngie >> Date: Mon Jul 17 21:12:02 2017 >> New Revision: 321093 >> URL: https://svnweb.freebsd.org/changeset/base/321093 >>=20 >> Log: >> MFC r319857: >>=20 >> ln(1): wordsmith -F option description >>=20 >> Added: >> stable/10/bin/ln/tests/ >> - copied from r319714, head/bin/ln/tests/ >> Modified: >> stable/10/bin/ln/Makefile >> stable/10/etc/mtree/BSD.tests.dist >> Directory Properties: >> stable/10/ (props changed) >=20 > It looks like the commit message for this one was wrong, though the > merge tracking info is correct. The commit message should've read: >=20 > MFC r319714: >=20 > Add tests for ln(1) >=20 > * Verify that when creating a hard link to a symbolic link, '-L' = option > creates a hard link to the target of the symbolic link > * Verify that when creating a hard link to a symbolic link, '-P' = option > creates a hard link to the symbolic link itself > * Verify that if the target file already exists, '-f' option unlinks = it so > that link may occur > * Verify that if the target file or directory is a symbolic link, = '-shf' > option prevents following the link > * Verify that if the target file or directory is a symbolic link, = '-snf' > option prevents following the link > * Verify that '-s' option creates a symbolic link > * Verify that '-w' option produces a warning if the source of a = symbolic > link does not currently exist >=20 > Submitted by: shivansh > Reviewed by: asomers, ngie > MFC after: 1 month > Sponsored by: Google, Inc (GSoC 2017) > Differential Revision: https://reviews.freebsd.org/D11084 Whoops =E2=80=94 yeah, I might have screwed that up by accident = :(. Thanks for the clarification! -Ngie --Apple-Mail=_7A6671DF-83BA-4A91-9B05-F6BEE593163B 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 iQIcBAEBCgAGBQJZgjlnAAoJEPWDqSZpMIYVCvsQANTKrLzPfDuQD7D4mK/15WFA tRTn3S728KCy61WX1XBVhd26GCB5VKLlJOG3IxnmeVrjNfah/1E2NPW5OBTAAwm0 V360DzTs8VkJejqHsiRLv6lSSCtQfbDamH5JtyLN5p14Gu8NyUfYteJQxyKHvQUt KkAW3H/5OgqlDEua/Dg+UQa+D5pTELz1KGqYNBh7nOMPZHBDb4rL+VKrnRYuETEg udLPsuRx1rb5uQ2V9x99W8dlFhFzUa7DRIfRYrGYBlo5PW72o7GXOsle5r5nnvJD Hk6q2yeS1i7fkpNmcGdhw5cgk+sjiuDHLYeRTxwqebhGTOgX76iraN+ZRKKK4Hqb 689QB2ySZduKQc5FYi8UzWboU/811zEDJiORT2FLZD6q+TWl0wS8Nn7YlDEaA+JC qKkzZri0keDXPik8yt7PeB9azOHkU3QSgbneEFGvqnqPXvTWC06Vsi72ox4QyjxY lx+BNjfe7qGs7UQ2LtriU1Pa15WX48mJRmrM2Fz7uvfv8jx57ToFwUTdWvyBxoVM WnRBEqxup8tYNzbVanFEESThq274OnkIrOIEE2hfd77fUSd0KnlM90nVrqcXd9p5 6Fs2r4d5vY6/uK1oQ407UL59Q0t3Lr88Iue+zfWtTASBGlD5eIUmmEQ6OX3AB28H qTT60oi5ZD/xZ2wejf8K =e8C0 -----END PGP SIGNATURE----- --Apple-Mail=_7A6671DF-83BA-4A91-9B05-F6BEE593163B-- From owner-svn-src-stable@freebsd.org Thu Aug 3 01:40:07 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18FABDBED5D; Thu, 3 Aug 2017 01:40:07 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB5A9E6; Thu, 3 Aug 2017 01:40:06 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v731e5tn047362; Thu, 3 Aug 2017 01:40:05 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v731e5fU047355; Thu, 3 Aug 2017 01:40:05 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201708030140.v731e5fU047355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 3 Aug 2017 01:40: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: r321964 - in stable/10: contrib/bmake contrib/bmake/PSD.doc contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake X-SVN-Group: stable-10 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/10: contrib/bmake contrib/bmake/PSD.doc contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake X-SVN-Commit-Revision: 321964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 01:40:07 -0000 Author: sjg Date: Thu Aug 3 01:40:05 2017 New Revision: 321964 URL: https://svnweb.freebsd.org/changeset/base/321964 Log: MFC bmake-20170720 PR: 221023 Added: stable/10/contrib/bmake/mk/files.mk - copied unchanged from r318163, head/contrib/bmake/mk/files.mk stable/10/contrib/bmake/mk/sys.debug.mk - copied unchanged from r310304, head/contrib/bmake/mk/sys.debug.mk stable/10/contrib/bmake/mk/sys.vars.mk - copied, changed from r310304, head/contrib/bmake/mk/sys.vars.mk Modified: stable/10/contrib/bmake/ChangeLog stable/10/contrib/bmake/Makefile stable/10/contrib/bmake/PSD.doc/tutorial.ms stable/10/contrib/bmake/README stable/10/contrib/bmake/arch.c stable/10/contrib/bmake/bmake.1 stable/10/contrib/bmake/bmake.cat1 stable/10/contrib/bmake/boot-strap stable/10/contrib/bmake/buf.h stable/10/contrib/bmake/compat.c stable/10/contrib/bmake/cond.c stable/10/contrib/bmake/config.h.in stable/10/contrib/bmake/configure stable/10/contrib/bmake/configure.in stable/10/contrib/bmake/dir.c stable/10/contrib/bmake/dir.h stable/10/contrib/bmake/dirname.c stable/10/contrib/bmake/for.c stable/10/contrib/bmake/getopt.c stable/10/contrib/bmake/hash.h stable/10/contrib/bmake/job.c stable/10/contrib/bmake/main.c stable/10/contrib/bmake/make-bootstrap.sh.in stable/10/contrib/bmake/make.1 stable/10/contrib/bmake/make.c stable/10/contrib/bmake/make.h stable/10/contrib/bmake/make_malloc.c stable/10/contrib/bmake/meta.c stable/10/contrib/bmake/meta.h stable/10/contrib/bmake/mk/ChangeLog stable/10/contrib/bmake/mk/FILES stable/10/contrib/bmake/mk/auto.dep.mk stable/10/contrib/bmake/mk/auto.obj.mk stable/10/contrib/bmake/mk/autodep.mk stable/10/contrib/bmake/mk/dirdeps.mk stable/10/contrib/bmake/mk/doc.mk stable/10/contrib/bmake/mk/dpadd.mk stable/10/contrib/bmake/mk/final.mk stable/10/contrib/bmake/mk/gendirdeps.mk stable/10/contrib/bmake/mk/inc.mk stable/10/contrib/bmake/mk/init.mk stable/10/contrib/bmake/mk/install-mk stable/10/contrib/bmake/mk/lib.mk stable/10/contrib/bmake/mk/libnames.mk stable/10/contrib/bmake/mk/meta.autodep.mk stable/10/contrib/bmake/mk/meta.stage.mk stable/10/contrib/bmake/mk/meta.sys.mk stable/10/contrib/bmake/mk/meta2deps.py stable/10/contrib/bmake/mk/meta2deps.sh stable/10/contrib/bmake/mk/mkopt.sh stable/10/contrib/bmake/mk/nls.mk stable/10/contrib/bmake/mk/own.mk stable/10/contrib/bmake/mk/prog.mk stable/10/contrib/bmake/mk/scripts.mk stable/10/contrib/bmake/mk/subdir.mk stable/10/contrib/bmake/mk/sys.clean-env.mk stable/10/contrib/bmake/mk/sys.dependfile.mk stable/10/contrib/bmake/mk/sys.mk stable/10/contrib/bmake/mk/sys/AIX.mk stable/10/contrib/bmake/mk/sys/Darwin.mk stable/10/contrib/bmake/mk/sys/Generic.mk stable/10/contrib/bmake/mk/sys/HP-UX.mk stable/10/contrib/bmake/mk/sys/IRIX.mk stable/10/contrib/bmake/mk/sys/Linux.mk stable/10/contrib/bmake/mk/sys/NetBSD.mk stable/10/contrib/bmake/mk/sys/OSF1.mk stable/10/contrib/bmake/mk/sys/OpenBSD.mk stable/10/contrib/bmake/mk/sys/SunOS.mk stable/10/contrib/bmake/mk/sys/UnixWare.mk stable/10/contrib/bmake/mk/warnings.mk stable/10/contrib/bmake/nonints.h stable/10/contrib/bmake/os.sh stable/10/contrib/bmake/parse.c stable/10/contrib/bmake/sprite.h stable/10/contrib/bmake/str.c stable/10/contrib/bmake/suff.c stable/10/contrib/bmake/targ.c stable/10/contrib/bmake/unit-tests/export-env.exp stable/10/contrib/bmake/unit-tests/export-env.mk stable/10/contrib/bmake/unit-tests/modmatch.exp stable/10/contrib/bmake/unit-tests/modmatch.mk stable/10/contrib/bmake/unit-tests/modts.exp stable/10/contrib/bmake/unit-tests/modts.mk stable/10/contrib/bmake/unit-tests/varmisc.exp stable/10/contrib/bmake/unit-tests/varmisc.mk stable/10/contrib/bmake/var.c stable/10/usr.bin/bmake/Makefile stable/10/usr.bin/bmake/Makefile.inc stable/10/usr.bin/bmake/config.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bmake/ChangeLog ============================================================================== --- stable/10/contrib/bmake/ChangeLog Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/ChangeLog Thu Aug 3 01:40:05 2017 (r321964) @@ -1,3 +1,296 @@ +2017-07-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170720 + Merge with NetBSD make, pick up + o compat.c: pass SIGINT etc onto child and wait for it to exit + before we self-terminate. + +2017-07-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170711 + forgot to update after merge on 20170708 ;-) + o main.c: refactor to reduce size of main function. + add -v option to always fully expand values. + o meta.c: ensure command output in meta file has ending newline + even when filemon not being used. + When matching ${.MAKE.META.IGNORE_PATTERNS} do not use + pathname via ':L' since any ':' in pathname breaks that. + Instead set a '${.p.}' to pathname in the target context and + use that. + +2017-05-10 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170510 + Merge with NetBSD make, pick up + o main.c: Main_SetObjdir: ensure buf2 is in scope + +2017-05-08 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170505 + see mk/ChangeLog + +2017-05-05 Simon J. Gerraty + + * parse.c: not everyone has stdint.h + +2017-05-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170501 + see mk/ChangeLog + +2017-04-21 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170421 + Merge with NetBSD make, pick up + o str.c: Str_Match: fix closure tests for [^] and add unit-test. + +2017-04-20 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170420 + Merge with NetBSD make, pick up + o main.c: only use -C arg "as is" if it contains no + relative component. + +2017-04-18 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170418 + Merge with NetBSD make, pick up + o main.c: fix Main_SetObjdir() for relative paths (eg obj). + +2017-04-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170417 + Merge with NetBSD make, pick up + o fixes a number of coverity complaints + - check return value of fseek, fcntl + - plug memory leak in Dir_FindFile, Var_LoopExpand, + JobPrintCommand, ParseTraditionalInclude + - use bmake_malloc() where NULL is not tollerated + - use MAKE_ATTR_UNUSED rather that kludges like + return(unused ? 0 : 0) + - use purge_cached_realpaths() rather than abuse cached_realpath() + +2017-04-13 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170413 + Merge with NetBSD make, pick up + o main.c: when setting .OBJDIR ignore '$' in paths. + + * job.c: use MALLOC_OPTIONS to set malloc_options. + +2017-04-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170411 + Merge with NetBSD make, pick up + o str.c: Str_Match: allow [^a-z] to behave as expected. + +2017-03-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170326 + Merge with NetBSD make, pick up + o main.c: purge relative paths from realpath cache when .OBJDIR + is changed. + +2017-03-11 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170311 + Merge with NetBSD make, pick up + o main.c: only use -C arg "as is" if it starts with '/'. + +2017-03-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170301 + Merge with NetBSD make, pick up + o main.c: use -C arg "as is" rather than getcwd() + if they identify the same directory. + o parse.c: ensure loadfile buffer is \n terminated in non-mmap case + +2017-02-01 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170201 + Merge with NetBSD make, pick up + o var.c: allow :_=var and avoid use of special context. + +2017-01-30 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170130 + Merge with NetBSD make, pick up + o var.c: add :range and :_ + o main.c: partially initialize Dir_* before MainParseArgs() + can be called. + If -V, skip Main_ExportMAKEFLAGS() + +2017-01-14 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20170114 + Merge with NetBSD make, pick up + o var.c: allow specifying the utc value used by :{gm,local}time + +2016-12-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161212 + Merge with NetBSD make, pick up + o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too. + +2016-12-09 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161209 + Merge with NetBSD make, pick up + o main.c: cleanup setting of .OBJDIR + o parse.c: avoid coredump from (var)=val + +2016-11-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161126 + Merge with NetBSD make, pick up + o make.c: Make_OODate: report src node name if path not set + +2016-09-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160926 + Merge with NetBSD make, pick up + o support for .DELETE_ON_ERROR: (remove targets that fail) + +2016-09-26 Simon J. Gerraty + + * Makefile MAN: tweak .Dt to match ${PROG} + +2016-08-18 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160818 + its a neater number; pick up whitespace fixes to man page. + +2016-08-17 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160817 + Merge with NetBSD make, pick up + o meta.c: move handling of .MAKE.META.IGNORE_* to meta_ignore() + so we can call it before adding entries to missingFiles. + Thus we do not track files we have been told to ignore. + +2016-08-15 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160815 + Merge with NetBSD make, pick up + o meta_oodate: apply .MAKE.META.IGNORE_FILTER (if defined) to + pathnames, and skip if the expansion is empty. + Useful for dirdeps.mk when checking DIRDEPS_CACHE. + +2016-08-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160812 + Merge with NetBSD make, pick up + o meta.c: remove all missingFiles entries that match a deleted + dir. + o main.c: set .ERROR_CMD if possible. + +2016-06-06 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160606 + Merge with NetBSD make, pick up + o dir.c: extend mtimes cache to others via cached_stat() + +2016-06-04 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160604 + Merge with NetBSD make, pick up + o meta.c: missing filemon data is only relevant if we read a + meta file. + Also do not return oodate for a missing metafile if gn->path + points to .CURDIR + +2016-06-02 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160602 + Merge with NetBSD make, pick up + o cached_realpath(): avoid hitting filesystem more than necessary. + o meta.c: refactor need_meta decision, add knobs for + missing meta file and filemon data wrt out-of-datedness. + +2016-05-28 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160528 + + * boot-strap, make-bootstrap.sh.in: Makefile now uses _MAKE_VERSION + +2016-05-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160512 + Merge with NetBSD make, pick up + o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS + this is useful for gcov builds. + o propagate errors from filemon(4). + +2016-05-09 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160509 + Merge with NetBSD make, pick up + o remove use of non-standard types u_int etc. + o meta.c: apply realpath() before matching against metaIgnorePaths + +2016-04-04 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160404 + Merge with NetBSD make, pick up + o allow makefile to set .MAKE.JOBS + + * Makefile (PROG_NAME): use ${_MAKE_VERSION} + +2016-03-15 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160315 + Merge with NetBSD make, pick up + o fix handling of archive members + +2016-03-13 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): rename variable to avoid interference + with checks for ${MAKE_VERSION} + +2016-03-10 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160310 + Merge with NetBSD make, pick up + o meta.c: treat missing Read file same as Write, incase we Delete it. + +2016-03-07 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160307 + Merge with NetBSD make, pick up + o var.c: fix :ts\nnn to be octal by default. + o meta.c: meta_finish() to cleanup memory. + +2016-02-26 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160226 + Merge with NetBSD make, pick up + o meta.c: allow meta file for makeDepend if makefiles want it. + +2016-02-19 Simon J. Gerraty + + * var.c: default .MAKE.SAVE_DOLLARS to FALSE + for backwards compatability. + + * Makefile (MAKE_VERSION): 20160220 + Merge with NetBSD make, pick up + o var.c: add knob to control handling of '$$' in := + +2016-02-18 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160218 + Merge with NetBSD make, pick up + o var.c: add .export-literal allows us to fix sys.clean-env.mk + post the changes to Var_Subst. + Var_Subst now takes flags, and does not consume '$$' in := + +2016-02-17 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20160217 + Merge with NetBSD make, pick up + o var.c: preserve '$$' in := + o parse.c: add .dinclude for handling included + makefile like .depend + 2015-12-20 Simon J. Gerraty * Makefile (MAKE_VERSION): 20151220 Modified: stable/10/contrib/bmake/Makefile ============================================================================== --- stable/10/contrib/bmake/Makefile Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/Makefile Thu Aug 3 01:40:05 2017 (r321964) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.49 2015/12/20 22:54:40 sjg Exp $ +# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $ # Base version on src date -MAKE_VERSION= 20151220 +_MAKE_VERSION= 20170720 PROG= bmake @@ -76,7 +76,7 @@ CFLAGS+= ${CPPFLAGS} CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\" CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}} -COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\"" +COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\"" # meta mode can be useful even without filemon FILEMON_H ?= /usr/include/dev/filemon/filemon.h @@ -131,9 +131,9 @@ OPTIONS_DEFAULT_NO+= \ .include .if ${MK_PROG_VERSION} == "yes" -PROG_NAME= ${PROG}-${MAKE_VERSION} +PROG_NAME= ${PROG}-${_MAKE_VERSION} .if ${MK_PROG_LINK} == "yes" -SYMLINKS+= ${PROG}-${MAKE_VERSION} ${BINDIR}/${PROG} +SYMLINKS+= ${PROG_NAME} ${BINDIR}/${PROG} .endif .endif @@ -156,7 +156,10 @@ my.history: ${MAKEFILE} .NOPATH: ${MAN} ${MAN}: make.1 my.history @echo making $@ - @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \ + @sed \ + -e '/^.Dt/s/MAKE/${PROG:tu}/' \ + -e 's/^.Nx/NetBSD/' \ + -e '/^.Nm/s/make/${PROG}/' \ -e '/^.Sh HISTORY/rmy.history' \ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@ Modified: stable/10/contrib/bmake/PSD.doc/tutorial.ms ============================================================================== --- stable/10/contrib/bmake/PSD.doc/tutorial.ms Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/PSD.doc/tutorial.ms Thu Aug 3 01:40:05 2017 (r321964) @@ -1,4 +1,4 @@ -.\" $NetBSD: tutorial.ms,v 1.12 2014/09/30 21:33:14 christos Exp $ +.\" $NetBSD: tutorial.ms,v 1.13 2017/03/01 13:05:11 kre Exp $ .\" Copyright (c) 1988, 1989, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -117,6 +117,15 @@ .de No .br .ne 0.5i +.ie n \{\ +.nr g3 \w'NOTE ' +.po -\\n(g3u +.br +NOTE +.br +.po +\\n(g3u +.\} +.el \{\ .po -0.5i .br .mk @@ -148,12 +157,14 @@ .rt .ft \\n(g3 .ps \\n(g4 +.\} .. .de Bp .ie !\\n(.$ .IP \(bu 2 .el .IP "\&" 2 .. -.po +.3i +.ie n .po +\w'NOTE 'u +.el .po +.3i .TL PMake \*- A Tutorial .AU Modified: stable/10/contrib/bmake/README ============================================================================== --- stable/10/contrib/bmake/README Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/README Thu Aug 3 01:40:05 2017 (r321964) @@ -1,47 +1,52 @@ bmake + ***** -This directory contains a port of the BSD make tool (from NetBSD) -I have run it on SunOS,Solaris,HP-UX,AIX,IRIX,FreeBSD and Linux. +This directory contains a port of the BSD make tool (from NetBSD). +Since 1993 I have run it on AIX, BSDi, Darwin, FreeBSD, HP-UX, IRIX, +Linux, Minix, OSF, Solaris, SunOS and even UTS. +Others have run it on many more systems. -Version 3 was re-worked from scratch to better facilitate -importing newer make(1) versions from NetBSD. The original code base -was NetBSD-1.0, so version 3 was built by doing a fresh import of the -NetBSD-1.0 usr.bin/make, adding the autoconf and other portability -patches to sync it with bmake v2, and then NetBSD's make -of Feb 20, 2000 was imported and conflicts dealt with. -NetBSD's make was again imported on June 6 and December 15, 2000. +Currently each release is tested on NetBSD, FreeBSD, Solaris and Linux. -In 2003 bmake switched to a date based version (first was 20030714) +Since 2003 bmake switched to a date based version (first was 20030714) which generally represents the date it was last merged with NetBSD's make. Since then, NetBSD's make is imported within a week of any interesting changes, so that bmake tracks it very closely. -Building: +Building +======== -The preferred way to bootstrap bmake is: +The preferred way to bootstrap bmake is:: -./bmake/boot-strap + ./bmake/boot-strap there are a number of args - most of which get passed to configure, eg. +:: -./bmake/boot-strap --prefix=/opt + ./bmake/boot-strap --prefix=/opt see the boot-strap script for details. +For folk that hate to read anything, since 20121212 you can also use +the GNU standard process of:: + + ./configure; make; make install + To make much use of bmake you will need the bsd.*.mk macros or my -portable *.mk macros. See +portable *.mk macros which are included with bmake since 20121212 +and separately available from http://www.crufty.net/ftp/pub/sjg/mk.tar.gz which will be links to the latest versions. -On a non-BSD system, you would want to unpack mk[-YYYYmmdd].tar.gz in -the same directory as bmake (so ./mk and ./bmake exist), and -./bmake/boot-strap will do the rest. +Porting +======= -If you want to do it all by hand then read boot-strap first to get the -idea. +If you encounter a system that bmake does not build or work on *out of +the box*, I welcome patches. +If you can provide access to a suitable machine - even better. -Even if you have an earlier version of bmake installed, use boot-strap -to ensure that all goes well. +More info can be found at http://www.crufty.net/help/sjg/bmake.htm ---sjg +--sjg + Modified: stable/10/contrib/bmake/arch.c ============================================================================== --- stable/10/contrib/bmake/arch.c Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/arch.c Thu Aug 3 01:40:05 2017 (r321964) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $ */ +/* $NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $"); +__RCSID("$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $"); #endif #endif /* not lint */ #endif @@ -136,7 +136,6 @@ __RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sj #include #include #include -#include #ifdef HAVE_AR_H #include #else @@ -156,7 +155,6 @@ struct ar_hdr { #if defined(HAVE_RANLIB_H) && !(defined(__ELF__) || defined(NO_RANLIB)) #include #endif -#include #include #include #ifdef HAVE_UTIME_H @@ -254,8 +252,7 @@ ArchFree(void *ap) free(Hash_GetValue(entry)); free(a->name); - if (a->fnametab) - free(a->fnametab); + free(a->fnametab); Hash_DeleteTable(&a->members); free(a); } @@ -310,9 +307,10 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * void *freeIt; char *result; - result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt); - if (freeIt) - free(freeIt); + result = Var_Parse(cp, ctxt, VARF_UNDEFERR|VARF_WANTRES, + &length, &freeIt); + free(freeIt); + if (result == var_Error) { return(FAILURE); } else { @@ -325,7 +323,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * *cp++ = '\0'; if (subLibName) { - libName = Var_Subst(NULL, libName, ctxt, TRUE, TRUE); + libName = Var_Subst(NULL, libName, ctxt, VARF_UNDEFERR|VARF_WANTRES); } @@ -351,9 +349,10 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * void *freeIt; char *result; - result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt); - if (freeIt) - free(freeIt); + result = Var_Parse(cp, ctxt, VARF_UNDEFERR|VARF_WANTRES, + &length, &freeIt); + free(freeIt); + if (result == var_Error) { return(FAILURE); } else { @@ -404,7 +403,8 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * char *oldMemName = memName; size_t sz; - memName = Var_Subst(NULL, memName, ctxt, TRUE, TRUE); + memName = Var_Subst(NULL, memName, ctxt, + VARF_UNDEFERR|VARF_WANTRES); /* * Now form an archive spec and recurse to deal with nested @@ -726,7 +726,8 @@ ArchStatMember(char *archive, char *member, Boolean ha if (fread(memName, elen, 1, arch) != 1) goto badarch; memName[elen] = '\0'; - fseek(arch, -elen, SEEK_CUR); + if (fseek(arch, -elen, SEEK_CUR) != 0) + goto badarch; if (DEBUG(ARCH) || DEBUG(MAKE)) { fprintf(debug_file, "ArchStat: Extended format entry for %s\n", memName); } @@ -737,7 +738,8 @@ ArchStatMember(char *archive, char *member, Boolean ha Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr))); memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr)); } - fseek(arch, (size + 1) & ~1, SEEK_CUR); + if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) + goto badarch; } fclose(arch); @@ -759,8 +761,7 @@ ArchStatMember(char *archive, char *member, Boolean ha badarch: fclose(arch); Hash_DeleteTable(&ar->members); - if (ar->fnametab) - free(ar->fnametab); + free(ar->fnametab); free(ar); return NULL; } @@ -833,7 +834,7 @@ ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE } if (DEBUG(ARCH)) { fprintf(debug_file, "Found svr4 archive name table with %lu entries\n", - (u_long)entry); + (unsigned long)entry); } return 0; } @@ -851,7 +852,7 @@ ArchSVR4Entry(Arch *ar, char *name, size_t size, FILE if (entry >= ar->fnamesize) { if (DEBUG(ARCH)) { fprintf(debug_file, "SVR4 entry offset %s is greater than %lu\n", - name, (u_long)ar->fnamesize); + name, (unsigned long)ar->fnamesize); } return 2; } @@ -957,7 +958,10 @@ ArchFindMember(char *archive, char *member, struct ar_ * the file at the actual member, rather than its header, but * not here... */ - fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR); + if (fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } return (arch); } } else @@ -987,10 +991,17 @@ ArchFindMember(char *archive, char *member, struct ar_ } if (strncmp(ename, member, len) == 0) { /* Found as extended name */ - fseek(arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR); + if (fseek(arch, -sizeof(struct ar_hdr) - elen, + SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } return (arch); } - fseek(arch, -elen, SEEK_CUR); + if (fseek(arch, -elen, SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } goto skip; } else #endif @@ -1003,9 +1014,12 @@ skip: * extract the size of the file from the 'size' field of the * header and round it up during the seek. */ - arhPtr->ar_size[sizeof(arhPtr->AR_SIZE)-1] = '\0'; + arhPtr->AR_SIZE[sizeof(arhPtr->AR_SIZE)-1] = '\0'; size = (int)strtol(arhPtr->AR_SIZE, NULL, 10); - fseek(arch, (size + 1) & ~1, SEEK_CUR); + if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) { + fclose(arch); + return NULL; + } } } @@ -1045,10 +1059,10 @@ Arch_Touch(GNode *gn) arch = ArchFindMember(Var_Value(ARCHIVE, gn, &p1), Var_Value(MEMBER, gn, &p2), &arh, "r+"); - if (p1) - free(p1); - if (p2) - free(p2); + + free(p1); + free(p2); + snprintf(arh.AR_DATE, sizeof(arh.AR_DATE), "%-12ld", (long) now); if (arch != NULL) { @@ -1127,10 +1141,9 @@ Arch_MTime(GNode *gn) arhPtr = ArchStatMember(Var_Value(ARCHIVE, gn, &p1), Var_Value(MEMBER, gn, &p2), TRUE); - if (p1) - free(p1); - if (p2) - free(p2); + + free(p1); + free(p2); if (arhPtr != NULL) { modTime = (time_t)strtol(arhPtr->AR_DATE, NULL, 10); Modified: stable/10/contrib/bmake/bmake.1 ============================================================================== --- stable/10/contrib/bmake/bmake.1 Thu Aug 3 00:38:13 2017 (r321963) +++ stable/10/contrib/bmake/bmake.1 Thu Aug 3 01:40:05 2017 (r321964) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.249 2015/06/05 07:33:40 wiz Exp $ +.\" $NetBSD: make.1,v 1.271 2017/07/03 21:34:20 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,8 +29,8 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 4, 2015 -.Dt MAKE 1 +.Dd June 22, 2017 +.Dt BMAKE 1 .Os .Sh NAME .Nm bmake @@ -48,6 +48,7 @@ .Op Fl m Ar directory .Op Fl T Ar file .Op Fl V Ar variable +.Op Fl v Ar variable .Op Ar variable=value .Op Ar target ... .Sh DESCRIPTION @@ -206,7 +207,9 @@ Print debugging information about target list maintena .It Ar V Force the .Fl V -option to print raw values of variables. +option to print raw values of variables, overriding the default behavior +set via +.Va .MAKE.EXPAND_VARIABLES . .It Ar v Print debugging information about variable assignment. .It Ar x @@ -293,7 +296,7 @@ then will search for the specified file or directory named in the remaining part of the argument string. The search starts with the current directory of -the Makefile and then works upward towards the root of the filesystem. +the Makefile and then works upward towards the root of the file system. If the search is successful, then the resulting directory replaces the .Qq \&.../ specification in the @@ -334,20 +337,39 @@ for each job started and completed. Rather than re-building a target as specified in the makefile, create it or update its modification time to make it appear up-to-date. .It Fl V Ar variable -Print -.Nm Ns 's -idea of the value of -.Ar variable , -in the global context. +Print the value of +.Ar variable . Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or undefined variable. +The value printed is extracted from the global context after all +makefiles have been read. +By default, the raw variable contents (which may +include additional unexpanded variable references) are shown. If .Ar variable contains a .Ql \&$ -then the value will be expanded before printing. +then the value will be recursively expanded to its complete resultant +text before printing. +The expanded value will also be printed if +.Va .MAKE.EXPAND_VARIABLES +is set to true and +the +.Fl dV +option has not been used to override it. +Note that loop-local and target-local variables, as well as values +taken temporarily by global variables during makefile processing, are +not accessible via this option. +The +.Fl dv +debug mode can be used to see these at the cost of generating +substantial extraneous output. +.It Fl v Ar variable +Like +.Fl V +but the variable is always expanded to its complete value. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -657,7 +679,7 @@ The seven local variables are as follows: .Bl -tag -width ".ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as -.Ql Va \&\*[Gt] . +.Ql Va \&> . .It Va .ARCHIVE The name of the archive file; also known as .Ql Va \&! . @@ -666,7 +688,7 @@ In suffix-transformation rules, the name/path of the s target is to be transformed (the .Dq implied source); also known as -.Ql Va \&\*[Lt] . +.Ql Va \&< . It is not defined in explicit rules. .It Va .MEMBER The name of the archive member; also known as @@ -685,12 +707,15 @@ or it will not be recognized. .It Va .TARGET The name of the target; also known as .Ql Va @ . +For compatibility with other makes this is an alias for +.Ic .ARCHIVE +in archive member rules. .El .Pp The shorter forms -.Ql ( Va \*[Gt] , +.Ql ( Va > , .Ql Va \&! , -.Ql Va \*[Lt] , +.Ql Va < , .Ql Va % , .Ql Va \&? , .Ql Va * , @@ -773,6 +798,10 @@ from which generated dependencies are read. A boolean that controls the default behavior of the .Fl V option. +If true, variable values printed with +.Fl V +are fully expanded; if false, the raw variable contents (which may +include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . @@ -843,7 +872,7 @@ Can affect the mode that .Nm runs in. It can contain a number of keywords: -.Bl -hang -width ignore-cmd +.Bl -hang -width missing-filemon=bf. .It Pa compat Like .Fl B , @@ -867,8 +896,19 @@ will not create .meta files in This can be overridden by setting .Va bf to a value which represents True. +.It Pa missing-meta= Ar bf +If +.Va bf +is True, then a missing .meta file makes the target out-of-date. +.It Pa missing-filemon= Ar bf +If +.Va bf +is True, then missing filemon data makes the target out-of-date. +.It Pa nofilemon +Do not use +.Xr filemon 4 . .It Pa env -For debugging, it can be useful to inlcude the environment +For debugging, it can be useful to include the environment in the .meta file. .It Pa verbose If in "meta" mode, print a clue about the target being built. @@ -910,6 +950,12 @@ Provides a list of path prefixes that should be ignore because the contents are expected to change over time. The default list includes: .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp +.It Va .MAKE.META.IGNORE_PATTERNS +Provides a list of patterns to match against pathnames. +Ignore any that match. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX Defines the message printed for each meta file updated in "meta verbose" mode. The default value is: @@ -918,7 +964,7 @@ The default value is: This variable is used to record the names of variables assigned to on the command line, so that they may be exported as part of .Ql Ev MAKEFLAGS . -This behaviour can be disabled by assigning an empty value to +This behavior can be disabled by assigning an empty value to .Ql Va .MAKEOVERRIDES within a makefile. Extra variables can be exported from a makefile @@ -941,10 +987,35 @@ The process-id of .It Va .MAKE.PPID The parent process-id of .Nm . +.It Va .MAKE.SAVE_DOLLARS +value should be a boolean that controls whether +.Ql $$ +are preserved when doing +.Ql := +assignments. +The default is false, for backwards compatibility. +Set to true for compatability with other makes. +If set to false, +.Ql $$ +becomes +.Ql $ +per normal evaluation rules. .It Va MAKE_PRINT_VAR_ON_ERROR When .Nm -stops due to an error, it prints its name and the value of +stops due to an error, it sets +.Ql Va .ERROR_TARGET +to the name of the target that failed, +.Ql Va .ERROR_CMD +to the commands of the failed target, +and in "meta" mode, it also sets +.Ql Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Ql Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of .Ql Va .CURDIR as well as the value of any variables named in .Ql Va MAKE_PRINT_VAR_ON_ERROR . @@ -1044,7 +1115,7 @@ sets to the value of .Ql Ev PWD instead. -This behaviour is disabled if +This behavior is disabled if .Ql Ev MAKEOBJDIRPREFIX is set or .Ql Ev MAKEOBJDIR @@ -1114,7 +1185,7 @@ The wildcard characters may be escaped with a backslas As a consequence of the way values are split into words, matched, and then joined, a construct like .Dl ${VAR:M*} -will normalise the inter-word spacing, removing all leading and +will normalize the inter-word spacing, removing all leading and trailing space, and converting multiple consecutive spaces to single spaces. . @@ -1134,7 +1205,7 @@ Randomize words in variable. The results will be different each time you are referring to the modified variable; use the assignment with expansion .Pq Ql Cm \&:= -to prevent such behaviour. +to prevent such behavior. For example, .Bd -literal -offset indent LIST= uno due tre quattro @@ -1160,18 +1231,28 @@ safely through recursive invocations of .Nm . .It Cm \&:R Replaces each word in the variable with everything but its suffix. -.It Cm \&:gmtime +.It Cm \&:range[=count] +The value is an integer sequence representing the words of the original +value, or the supplied +.Va count . +.It Cm \&:gmtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr gmtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:hash -Compute a 32bit hash of the value and encode it as hex digits. -.It Cm \&:localtime +Compute a 32-bit hash of the value and encode it as hex digits. +.It Cm \&:localtime[=utc] The value is a format string for .Xr strftime 3 , -using the current +using .Xr localtime 3 . +If a +.Va utc +value is not provided or is 0, the current time is used. .It Cm \&:tA Attempt to convert variable to an absolute path using .Xr realpath 3 , @@ -1232,7 +1313,7 @@ it is anchored at the end of each word. Inside .Ar new_string , an ampersand -.Pq Ql \*[Am] +.Pq Ql & is replaced by .Ar old_string (without any @@ -1371,6 +1452,27 @@ For example. .Pp However a single character variable is often more readable: .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} +.It Cm \&:_[=var] +Save the current variable value in +.Ql $_ +or the named +.Va var +for later reference. +Example usage: +.Bd -literal -offset indent +M_cmpv.units = 1 1000 1000000 +M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\ +\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh + +.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Aug 3 07:17:43 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0825DDCE03A; Thu, 3 Aug 2017 07:17:43 +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 C607C6A846; Thu, 3 Aug 2017 07:17:42 +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 v737HfQU085755; Thu, 3 Aug 2017 07:17:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v737HfxK085754; Thu, 3 Aug 2017 07:17:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708030717.v737HfxK085754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 3 Aug 2017 07:17: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: r321975 - stable/11/usr.bin/w X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/usr.bin/w X-SVN-Commit-Revision: 321975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 07:17:43 -0000 Author: mav Date: Thu Aug 3 07:17:41 2017 New Revision: 321975 URL: https://svnweb.freebsd.org/changeset/base/321975 Log: MFC r321620: Fix singular/plural "users" output. It was broken during libxo'fication. PR: 221039 Submitted by: timur@ Modified: stable/11/usr.bin/w/w.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/w/w.c ============================================================================== --- stable/11/usr.bin/w/w.c Thu Aug 3 07:00:55 2017 (r321974) +++ stable/11/usr.bin/w/w.c Thu Aug 3 07:17:41 2017 (r321975) @@ -511,7 +511,7 @@ pr_header(time_t *nowp, int nusers) } /* Print number of users logged in to system */ - xo_emit(" {:users/%d} {N:user%s}", nusers, nusers == 1 ? "" : "s"); + xo_emit(" {:users/%d} {Np:user,users}", nusers); /* * Print 1, 5, and 15 minute load averages. From owner-svn-src-stable@freebsd.org Thu Aug 3 07:20:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96FD6DCE200; Thu, 3 Aug 2017 07:20:20 +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 619DA6A9E0; Thu, 3 Aug 2017 07:20:20 +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 v737KJXp085939; Thu, 3 Aug 2017 07:20:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v737KJEE085938; Thu, 3 Aug 2017 07:20:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708030720.v737KJEE085938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 3 Aug 2017 07:20: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: r321976 - stable/11/sys/cam/ata X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/ata X-SVN-Commit-Revision: 321976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 07:20:20 -0000 Author: mav Date: Thu Aug 3 07:20:19 2017 New Revision: 321976 URL: https://svnweb.freebsd.org/changeset/base/321976 Log: MFC r321606: adaasync(): Set ADA_STATE_WCACHE based on ADA_FLAG_CAN_WCACHE The attached patch lets adaasync() set ADA_STATE_WCACHE based on ADA_FLAG_CAN_WCACHE instead of ADA_FLAG_CAN_RAHEAD. This fixes a regression introduced in r300207 which changed the flag names. PR: 220948 Submitted by: Fabian Keil Obtained from: ElectroBSD Modified: stable/11/sys/cam/ata/ata_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_da.c ============================================================================== --- stable/11/sys/cam/ata/ata_da.c Thu Aug 3 07:17:41 2017 (r321975) +++ stable/11/sys/cam/ata/ata_da.c Thu Aug 3 07:20:19 2017 (r321976) @@ -1288,7 +1288,7 @@ adaasync(void *callback_arg, u_int32_t code, xpt_action((union ccb *)&cgd); if (ADA_RA >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) softc->state = ADA_STATE_RAHEAD; - else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) + else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_WCACHE) softc->state = ADA_STATE_WCACHE; else if ((softc->flags & ADA_FLAG_CAN_LOG) && (softc->zone_mode != ADA_ZONE_NONE)) From owner-svn-src-stable@freebsd.org Thu Aug 3 07:28:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2644DCE627; Thu, 3 Aug 2017 07:28:55 +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 6BD1F6AEA3; Thu, 3 Aug 2017 07:28:55 +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 v737SsCT090215; Thu, 3 Aug 2017 07:28:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v737SsZd090213; Thu, 3 Aug 2017 07:28:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708030728.v737SsZd090213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 3 Aug 2017 07:28: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: r321977 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 321977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 07:28:55 -0000 Author: kib Date: Thu Aug 3 07:28:54 2017 New Revision: 321977 URL: https://svnweb.freebsd.org/changeset/base/321977 Log: MFC r321625: Make the number of children for pctrie node available outside subr_pctrie.c. Modified: stable/11/sys/kern/subr_pctrie.c stable/11/sys/sys/pctrie.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_pctrie.c ============================================================================== --- stable/11/sys/kern/subr_pctrie.c Thu Aug 3 07:20:19 2017 (r321976) +++ stable/11/sys/kern/subr_pctrie.c Thu Aug 3 07:28:54 2017 (r321977) @@ -58,18 +58,6 @@ __FBSDID("$FreeBSD$"); #include #endif -/* - * These widths should allow the pointers to a node's children to fit within - * a single cache line. The extra levels from a narrow width should not be - * a problem thanks to path compression. - */ -#ifdef __LP64__ -#define PCTRIE_WIDTH 4 -#else -#define PCTRIE_WIDTH 3 -#endif - -#define PCTRIE_COUNT (1 << PCTRIE_WIDTH) #define PCTRIE_MASK (PCTRIE_COUNT - 1) #define PCTRIE_LIMIT (howmany(sizeof(uint64_t) * NBBY, PCTRIE_WIDTH) - 1) Modified: stable/11/sys/sys/pctrie.h ============================================================================== --- stable/11/sys/sys/pctrie.h Thu Aug 3 07:20:19 2017 (r321976) +++ stable/11/sys/sys/pctrie.h Thu Aug 3 07:28:54 2017 (r321977) @@ -133,5 +133,18 @@ pctrie_is_empty(struct pctrie *ptree) return (ptree->pt_root == 0); } +/* + * These widths should allow the pointers to a node's children to fit within + * a single cache line. The extra levels from a narrow width should not be + * a problem thanks to path compression. + */ +#ifdef __LP64__ +#define PCTRIE_WIDTH 4 +#else +#define PCTRIE_WIDTH 3 +#endif + +#define PCTRIE_COUNT (1 << PCTRIE_WIDTH) + #endif /* _KERNEL */ #endif /* !_SYS_PCTRIE_H_ */ From owner-svn-src-stable@freebsd.org Thu Aug 3 07:30:36 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AFCFDCE734; Thu, 3 Aug 2017 07:30:36 +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 1833E6B02A; Thu, 3 Aug 2017 07:30:36 +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 v737UZEo091004; Thu, 3 Aug 2017 07:30:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v737UZ7N091003; Thu, 3 Aug 2017 07:30:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708030730.v737UZ7N091003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 3 Aug 2017 07:30: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: r321978 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 321978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 07:30:36 -0000 Author: kib Date: Thu Aug 3 07:30:35 2017 New Revision: 321978 URL: https://svnweb.freebsd.org/changeset/base/321978 Log: MFC r321627: Make it possible to request nosys logging to console. Modified: stable/11/sys/kern/kern_sig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sig.c ============================================================================== --- stable/11/sys/kern/kern_sig.c Thu Aug 3 07:28:54 2017 (r321977) +++ stable/11/sys/kern/kern_sig.c Thu Aug 3 07:30:35 2017 (r321978) @@ -3595,9 +3595,14 @@ nosys(td, args) PROC_LOCK(p); tdsignal(td, SIGSYS); PROC_UNLOCK(p); - if (kern_lognosys) + if (kern_lognosys == 1 || kern_lognosys == 3) { uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, td->td_sa.code); + } + if (kern_lognosys == 2 || kern_lognosys == 3) { + printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, + td->td_sa.code); + } return (ENOSYS); } From owner-svn-src-stable@freebsd.org Thu Aug 3 07:50:47 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67E64DCF168; Thu, 3 Aug 2017 07:50:47 +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 42ABE6BAF0; Thu, 3 Aug 2017 07:50:47 +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 v737ok9Z098303; Thu, 3 Aug 2017 07:50:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v737okWI098302; Thu, 3 Aug 2017 07:50:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708030750.v737okWI098302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 07:50: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: r321980 - stable/11/sys/dev/usb/wlan X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb/wlan X-SVN-Commit-Revision: 321980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 07:50:47 -0000 Author: hselasky Date: Thu Aug 3 07:50:46 2017 New Revision: 321980 URL: https://svnweb.freebsd.org/changeset/base/321980 Log: MFC r321722: Properly range check length of parsed information elements in RSU driver. Found by: Ilja van Sprundel Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/wlan/if_rsu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- stable/11/sys/dev/usb/wlan/if_rsu.c Thu Aug 3 07:42:08 2017 (r321979) +++ stable/11/sys/dev/usb/wlan/if_rsu.c Thu Aug 3 07:50:46 2017 (r321980) @@ -1481,6 +1481,8 @@ rsu_hwrssi_to_rssi(struct rsu_softc *sc, int hw_rssi) return (v); } +CTASSERT(MCLBYTES > sizeof(struct ieee80211_frame)); + static void rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len) { @@ -1489,28 +1491,31 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, i struct ndis_wlan_bssid_ex *bss; struct ieee80211_rx_stats rxs; struct mbuf *m; - int pktlen; + uint32_t ieslen; + uint32_t pktlen; if (__predict_false(len < sizeof(*bss))) return; bss = (struct ndis_wlan_bssid_ex *)buf; - if (__predict_false(len < sizeof(*bss) + le32toh(bss->ieslen))) + ieslen = le32toh(bss->ieslen); + /* range check length of information element */ + if (__predict_false(ieslen > (uint32_t)(len - sizeof(*bss)))) return; RSU_DPRINTF(sc, RSU_DEBUG_SCAN, "%s: found BSS %s: len=%d chan=%d inframode=%d " "networktype=%d privacy=%d, RSSI=%d\n", __func__, - ether_sprintf(bss->macaddr), le32toh(bss->len), + ether_sprintf(bss->macaddr), ieslen, le32toh(bss->config.dsconfig), le32toh(bss->inframode), le32toh(bss->networktype), le32toh(bss->privacy), le32toh(bss->rssi)); /* Build a fake beacon frame to let net80211 do all the parsing. */ /* XXX TODO: just call the new scan API methods! */ - pktlen = sizeof(*wh) + le32toh(bss->ieslen); - if (__predict_false(pktlen > MCLBYTES)) + if (__predict_false(ieslen > (size_t)(MCLBYTES - sizeof(*wh)))) return; + pktlen = sizeof(*wh) + ieslen; m = m_get2(pktlen, M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) return; @@ -1523,7 +1528,7 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, i IEEE80211_ADDR_COPY(wh->i_addr2, bss->macaddr); IEEE80211_ADDR_COPY(wh->i_addr3, bss->macaddr); *(uint16_t *)wh->i_seq = 0; - memcpy(&wh[1], (uint8_t *)&bss[1], le32toh(bss->ieslen)); + memcpy(&wh[1], (uint8_t *)&bss[1], ieslen); /* Finalize mbuf. */ m->m_pkthdr.len = m->m_len = pktlen; @@ -2621,6 +2626,8 @@ rsu_fw_loadsection(struct rsu_softc *sc, const uint8_t return (0); } +CTASSERT(sizeof(size_t) >= sizeof(uint32_t)); + static int rsu_load_firmware(struct rsu_softc *sc) { @@ -2628,7 +2635,7 @@ rsu_load_firmware(struct rsu_softc *sc) struct r92s_fw_priv *dmem; struct ieee80211com *ic = &sc->sc_ic; const uint8_t *imem, *emem; - int imemsz, ememsz; + uint32_t imemsz, ememsz; const struct firmware *fw; size_t size; uint32_t reg; @@ -2679,7 +2686,8 @@ rsu_load_firmware(struct rsu_softc *sc) imemsz = le32toh(hdr->imemsz); ememsz = le32toh(hdr->sramsz); /* Check that all FW sections fit in image. */ - if (size < sizeof(*hdr) + imemsz + ememsz) { + if (imemsz > (size_t)(size - sizeof(*hdr)) || + ememsz > (size_t)(size - sizeof(*hdr) - imemsz)) { device_printf(sc->sc_dev, "firmware too short\n"); error = EINVAL; goto fail; From owner-svn-src-stable@freebsd.org Thu Aug 3 07:56:40 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 618A6DCF576; Thu, 3 Aug 2017 07:56:40 +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 3C01E6BEC7; Thu, 3 Aug 2017 07:56:40 +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 v737udQW002192; Thu, 3 Aug 2017 07:56:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v737udi4002191; Thu, 3 Aug 2017 07:56:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708030756.v737udi4002191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 07:56: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: r321981 - stable/10/sys/dev/usb/wlan X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/usb/wlan X-SVN-Commit-Revision: 321981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 07:56:40 -0000 Author: hselasky Date: Thu Aug 3 07:56:39 2017 New Revision: 321981 URL: https://svnweb.freebsd.org/changeset/base/321981 Log: MFC r321722: Properly range check length of parsed information elements in RSU driver. Found by: Ilja van Sprundel Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/wlan/if_rsu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_rsu.c Thu Aug 3 07:50:46 2017 (r321980) +++ stable/10/sys/dev/usb/wlan/if_rsu.c Thu Aug 3 07:56:39 2017 (r321981) @@ -1126,6 +1126,8 @@ rsu_disconnect(struct rsu_softc *sc) return (rsu_fw_cmd(sc, R92S_CMD_DISCONNECT, &zero, sizeof(zero))); } +CTASSERT(MCLBYTES > sizeof(struct ieee80211_frame)); + static void rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len) { @@ -1135,34 +1137,30 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, i struct ieee80211_channel *c; struct ndis_wlan_bssid_ex *bss; struct mbuf *m; - int pktlen; + uint32_t ieslen; + uint32_t pktlen; if (__predict_false(len < sizeof(*bss))) return; bss = (struct ndis_wlan_bssid_ex *)buf; - if (__predict_false(len < sizeof(*bss) + le32toh(bss->ieslen))) + ieslen = le32toh(bss->ieslen); + /* range check length of information element */ + if (__predict_false(ieslen > (uint32_t)(len - sizeof(*bss)))) return; DPRINTFN(2, "found BSS %s: len=%d chan=%d inframode=%d " "networktype=%d privacy=%d\n", - ether_sprintf(bss->macaddr), le32toh(bss->len), + ether_sprintf(bss->macaddr), ieslen, le32toh(bss->config.dsconfig), le32toh(bss->inframode), le32toh(bss->networktype), le32toh(bss->privacy)); /* Build a fake beacon frame to let net80211 do all the parsing. */ - pktlen = sizeof(*wh) + le32toh(bss->ieslen); - if (__predict_false(pktlen > MCLBYTES)) + if (__predict_false(ieslen > (size_t)(MCLBYTES - sizeof(*wh)))) return; - MGETHDR(m, M_NOWAIT, MT_DATA); + pktlen = sizeof(*wh) + ieslen; + m = m_get2(pktlen, M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) return; - if (pktlen > MHLEN) { - MCLGET(m, M_NOWAIT); - if (!(m->m_flags & M_EXT)) { - m_free(m); - return; - } - } wh = mtod(m, struct ieee80211_frame *); wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON; @@ -1172,7 +1170,7 @@ rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, i IEEE80211_ADDR_COPY(wh->i_addr2, bss->macaddr); IEEE80211_ADDR_COPY(wh->i_addr3, bss->macaddr); *(uint16_t *)wh->i_seq = 0; - memcpy(&wh[1], (uint8_t *)&bss[1], le32toh(bss->ieslen)); + memcpy(&wh[1], (uint8_t *)&bss[1], ieslen); /* Finalize mbuf. */ m->m_pkthdr.len = m->m_len = pktlen; @@ -2123,13 +2121,15 @@ rsu_fw_loadsection(struct rsu_softc *sc, const uint8_t return (0); } +CTASSERT(sizeof(size_t) >= sizeof(uint32_t)); + static int rsu_load_firmware(struct rsu_softc *sc) { const struct r92s_fw_hdr *hdr; struct r92s_fw_priv *dmem; const uint8_t *imem, *emem; - int imemsz, ememsz; + uint32_t imemsz, ememsz; const struct firmware *fw; size_t size; uint32_t reg; @@ -2178,7 +2178,8 @@ rsu_load_firmware(struct rsu_softc *sc) imemsz = le32toh(hdr->imemsz); ememsz = le32toh(hdr->sramsz); /* Check that all FW sections fit in image. */ - if (size < sizeof(*hdr) + imemsz + ememsz) { + if (imemsz > (size_t)(size - sizeof(*hdr)) || + ememsz > (size_t)(size - sizeof(*hdr) - imemsz)) { device_printf(sc->sc_dev, "firmware too short\n"); error = EINVAL; goto fail; From owner-svn-src-stable@freebsd.org Thu Aug 3 13:45:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7CCBDBD6C1; Thu, 3 Aug 2017 13:45:27 +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 7C3DB7C59E; Thu, 3 Aug 2017 13:45:27 +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 v73DjQRV045591; Thu, 3 Aug 2017 13:45:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73DjQkL045590; Thu, 3 Aug 2017 13:45:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031345.v73DjQkL045590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 13:45: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: r321990 - stable/11/sys/dev/usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb/controller X-SVN-Commit-Revision: 321990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 13:45:27 -0000 Author: hselasky Date: Thu Aug 3 13:45:26 2017 New Revision: 321990 URL: https://svnweb.freebsd.org/changeset/base/321990 Log: MFC r320773: Implement fix for BULK IN-token retry mechanism. When the hardware is programmed for infinite IN token retry after NAK, the SAF1761 hardware, however, does not retry the IN-token. This problem is described in the SAF1761 errata, section 18.1.1. While at it: - Add some minor chip specific initialization for RTEMS. - Add debug print for status registers in the interrupt filter. Submitted by: Christian Mauderer Modified: stable/11/sys/dev/usb/controller/saf1761_otg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/controller/saf1761_otg.c ============================================================================== --- stable/11/sys/dev/usb/controller/saf1761_otg.c Thu Aug 3 13:26:51 2017 (r321989) +++ stable/11/sys/dev/usb/controller/saf1761_otg.c Thu Aug 3 13:45:26 2017 (r321990) @@ -516,7 +516,25 @@ saf1761_host_bulk_data_rx(struct saf1761_otg_softc *sc DPRINTFN(5, "STATUS=0x%08x\n", status); if (status & SOTG_PTD_DW3_ACTIVE) { - goto busy; + temp = saf1761_peek_host_status_le_4(sc, + pdt_addr + SOTG_PTD_DW0); + if (temp & SOTG_PTD_DW0_VALID) { + goto busy; + } else { + status = saf1761_peek_host_status_le_4(sc, + pdt_addr + SOTG_PTD_DW3); + + /* check if still active */ + if (status & SOTG_PTD_DW3_ACTIVE) { + saf1761_host_channel_free(sc, td); + goto retry; + } else if (status & SOTG_PTD_DW3_HALTED) { + if (!(status & SOTG_PTD_DW3_ERRORS)) + td->error_stall = 1; + td->error_any = 1; + goto complete; + } + } } else if (status & SOTG_PTD_DW3_HALTED) { if (!(status & SOTG_PTD_DW3_ERRORS)) td->error_stall = 1; @@ -560,6 +578,7 @@ saf1761_host_bulk_data_rx(struct saf1761_otg_softc *sc } saf1761_host_channel_free(sc, td); } +retry: if (saf1761_host_channel_alloc(sc, td)) goto busy; @@ -1589,6 +1608,8 @@ saf1761_otg_filter_interrupt(void *arg) (void) SAF1761_READ_LE_4(sc, SOTG_INT_PTD_DONE_PTD); (void) SAF1761_READ_LE_4(sc, SOTG_ISO_PTD_DONE_PTD); + DPRINTFN(9, "HCINTERRUPT=0x%08x DCINTERRUPT=0x%08x\n", hcstat, status); + if (status & SOTG_DCINTERRUPT_IEPSOF) { if ((sc->sc_host_async_busy_map[1] | sc->sc_host_async_busy_map[0] | sc->sc_host_intr_busy_map[1] | sc->sc_host_intr_busy_map[0] | @@ -2446,11 +2467,15 @@ saf1761_otg_init(struct saf1761_otg_softc *sc) */ SAF1761_WRITE_LE_4(sc, SOTG_CTRL_SET_CLR, SOTG_CTRL_CLR(0xFFFF)); +#ifdef __rtems__ SAF1761_WRITE_LE_4(sc, SOTG_CTRL_SET_CLR, + SOTG_CTRL_SET(SOTG_CTRL_SEL_CP_EXT | SOTG_CTRL_VBUS_DRV)); +#else + SAF1761_WRITE_LE_4(sc, SOTG_CTRL_SET_CLR, SOTG_CTRL_SET(SOTG_CTRL_SW_SEL_HC_DC | SOTG_CTRL_BDIS_ACON_EN | SOTG_CTRL_SEL_CP_EXT | SOTG_CTRL_VBUS_DRV)); - +#endif /* disable device address */ SAF1761_WRITE_LE_4(sc, SOTG_ADDRESS, 0); From owner-svn-src-stable@freebsd.org Thu Aug 3 13:51:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C750DDBDE2C; Thu, 3 Aug 2017 13:51:19 +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 8F03E7CABA; Thu, 3 Aug 2017 13:51:19 +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 v73DpIn5046704; Thu, 3 Aug 2017 13:51:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73DpIYK046702; Thu, 3 Aug 2017 13:51:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031351.v73DpIYK046702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 13:51: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: r321992 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 321992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 13:51:19 -0000 Author: hselasky Date: Thu Aug 3 13:51:18 2017 New Revision: 321992 URL: https://svnweb.freebsd.org/changeset/base/321992 Log: MFC r312526: Update firmware interface structures and definitions adding support for new features and commands. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ifc.h Thu Aug 3 13:50:46 2017 (r321991) +++ stable/11/sys/dev/mlx5/mlx5_ifc.h Thu Aug 3 13:51:18 2017 (r321992) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,13 +23,8 @@ * SUCH DAMAGE. * * $FreeBSD$ + */ - Autogenerated file. - Date: 2015-04-13 14:59 - Source Document Name: Mellanox - Source Document Version: 0.28 - Generated by adb_to_c.py (EAT.ME Version: 1.0.70) -*/ #ifndef MLX5_IFC_H #define MLX5_IFC_H @@ -56,6 +51,8 @@ enum { MLX5_EVENT_TYPE_CODING_TEMP_WARNING_EVENT = 0x17, MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19, MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT = 0x1e, + MLX5_EVENT_TYPE_CODING_PPS_EVENT = 0x25, + MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT = 0x22, MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a, MLX5_EVENT_TYPE_STALL_EVENT = 0x1b, MLX5_EVENT_TYPE_DROPPED_PACKET_LOGGED_EVENT = 0x1f, @@ -89,6 +86,8 @@ enum { MLX5_CMD_OP_QUERY_ISSI = 0x10a, MLX5_CMD_OP_SET_ISSI = 0x10b, MLX5_CMD_OP_SET_DRIVER_VERSION = 0x10d, + MLX5_CMD_OP_QUERY_OTHER_HCA_CAP = 0x10e, + MLX5_CMD_OP_MODIFY_OTHER_HCA_CAP = 0x10f, MLX5_CMD_OP_CREATE_MKEY = 0x200, MLX5_CMD_OP_QUERY_MKEY = 0x201, MLX5_CMD_OP_DESTROY_MKEY = 0x202, @@ -190,6 +189,12 @@ enum { MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY = 0x82b, MLX5_CMD_OP_SET_WOL_ROL = 0x830, MLX5_CMD_OP_QUERY_WOL_ROL = 0x831, + MLX5_CMD_OP_CREATE_LAG = 0x840, + MLX5_CMD_OP_MODIFY_LAG = 0x841, + MLX5_CMD_OP_QUERY_LAG = 0x842, + MLX5_CMD_OP_DESTROY_LAG = 0x843, + MLX5_CMD_OP_CREATE_VPORT_LAG = 0x844, + MLX5_CMD_OP_DESTROY_VPORT_LAG = 0x845, MLX5_CMD_OP_CREATE_TIR = 0x900, MLX5_CMD_OP_MODIFY_TIR = 0x901, MLX5_CMD_OP_DESTROY_TIR = 0x902, @@ -206,6 +211,8 @@ enum { MLX5_CMD_OP_MODIFY_RMP = 0x90d, MLX5_CMD_OP_DESTROY_RMP = 0x90e, MLX5_CMD_OP_QUERY_RMP = 0x90f, + MLX5_CMD_OP_SET_DELAY_DROP_PARAMS = 0x910, + MLX5_CMD_OP_QUERY_DELAY_DROP_PARAMS = 0x911, MLX5_CMD_OP_CREATE_TIS = 0x912, MLX5_CMD_OP_MODIFY_TIS = 0x913, MLX5_CMD_OP_DESTROY_TIS = 0x914, @@ -226,7 +233,10 @@ enum { MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY = 0x938, MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939, MLX5_CMD_OP_DEALLOC_FLOW_COUNTER = 0x93a, - MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b + MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b, + MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c, + MLX5_CMD_OP_ALLOC_ENCAP_HEADER = 0x93d, + MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e, }; enum { @@ -271,7 +281,11 @@ struct mlx5_ifc_flow_table_fields_supported_bits { u8 outer_gre_protocol[0x1]; u8 outer_gre_key[0x1]; u8 outer_vxlan_vni[0x1]; - u8 reserved_2[0x5]; + u8 outer_geneve_vni[0x1]; + u8 outer_geneve_oam[0x1]; + u8 outer_geneve_protocol_type[0x1]; + u8 outer_geneve_opt_len[0x1]; + u8 reserved_2[0x1]; u8 source_eswitch_port[0x1]; u8 inner_dmac[0x1]; @@ -299,10 +313,12 @@ struct mlx5_ifc_flow_table_fields_supported_bits { u8 inner_tcp_flags[0x1]; u8 reserved_5[0x9]; - u8 reserved_6[0x1f]; + u8 reserved_6[0x1a]; + u8 bth_dst_qp[0x1]; + u8 reserved_7[0x4]; u8 source_sqn[0x1]; - u8 reserved_7[0x20]; + u8 reserved_8[0x20]; }; struct mlx5_ifc_eth_discard_cntrs_grp_bits { @@ -356,7 +372,11 @@ struct mlx5_ifc_eth_discard_cntrs_grp_bits { u8 egress_stp_filter_low[0x20]; - u8 reserved_at_340[0x480]; + u8 egress_hoq_stall_high[0x20]; + + u8 egress_hoq_stall_low[0x20]; + + u8 reserved_at_340[0x440]; }; struct mlx5_ifc_flow_table_prop_layout_bits { u8 ft_support[0x1]; @@ -411,6 +431,7 @@ enum { MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT = 0x0, MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE = 0x1, MLX5_FLOW_CONTEXT_DEST_TYPE_TIR = 0x2, + MLX5_FLOW_CONTEXT_DEST_TYPE_QP = 0x3, }; struct mlx5_ifc_dest_format_struct_bits { @@ -490,9 +511,14 @@ struct mlx5_ifc_fte_match_set_misc_bits { u8 reserved_6[0xc]; u8 inner_ipv6_flow_label[0x14]; - u8 reserved7[0x10]; + u8 reserved_7[0xa]; + u8 geneve_opt_len[0x6]; u8 geneve_protocol_type[0x10]; - u8 reserved8[0xc0]; + + u8 reserved_8[0x8]; + u8 bth_dst_qp[0x18]; + + u8 reserved_9[0xa0]; }; struct mlx5_ifc_cmd_pas_bits { @@ -698,7 +724,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_b u8 lro_psh_flag[0x1]; u8 lro_time_stamp[0x1]; u8 lro_max_msg_sz_mode[0x2]; - u8 reserved_0[0x2]; + u8 wqe_vlan_insert[0x1]; + u8 self_lb_en_modifiable[0x1]; u8 self_lb_mc[0x1]; u8 self_lb_uc[0x1]; u8 max_lso_cap[0x5]; @@ -715,7 +742,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_b u8 swp[0x1]; u8 swp_csum[0x1]; u8 swp_lso[0x1]; - u8 reserved_2[0x1c]; + u8 reserved_2[0x1b]; + u8 max_geneve_opt_len[0x1]; u8 tunnel_stateless_geneve_rx[0x1]; u8 reserved_3[0x10]; @@ -910,7 +938,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 vport_counters[0x1]; u8 retransmission_q_counters[0x1]; u8 debug[0x1]; - u8 reserved_16[0x2]; + u8 modify_rq_counters_set_id[0x1]; + u8 rq_delay_drop[0x1]; u8 max_qp_cnt[0xa]; u8 pkey_table_size[0x10]; @@ -980,7 +1009,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 cq_oi[0x1]; u8 cq_resize[0x1]; u8 cq_moderation[0x1]; - u8 reserved_31[0x3]; + u8 cq_period_mode_modify[0x1]; + u8 cq_invalidate[0x1]; + u8 reserved_at_225[0x1]; u8 cq_eq_remap[0x1]; u8 pg[0x1]; u8 block_lb_mc[0x1]; @@ -1068,7 +1099,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 log_max_wq_sz[0x5]; u8 nic_vport_change_event[0x1]; - u8 reserved_59[0xa]; + u8 disable_local_lb[0x1]; + u8 reserved_59[0x9]; u8 log_max_vlan_list[0x5]; u8 reserved_60[0x3]; u8 log_max_current_mc_list[0x5]; @@ -1312,6 +1344,8 @@ enum { MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_CQ_MAX_COUNT = 0x2, MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_OI = 0x4, MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_C_EQN = 0x8, + MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_CQ_PERIOD_MODE = 0x10, + MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_STATUS = 0x20, }; struct mlx5_ifc_modify_field_select_bits { @@ -2239,9 +2273,15 @@ enum { MLX5_RQC_STATE_ERR = 0x3, }; +enum { + MLX5_RQC_DROPLESS_MODE_DISABLE = 0x0, + MLX5_RQC_DROPLESS_MODE_ENABLE = 0x1, +}; + struct mlx5_ifc_rqc_bits { - u8 rlky[0x1]; - u8 reserved_0[0x2]; + u8 rlkey[0x1]; + u8 delay_drop_en[0x1]; + u8 scatter_fcs[0x1]; u8 vlan_strip_disable[0x1]; u8 mem_rq_type[0x4]; u8 state[0x4]; @@ -2293,7 +2333,9 @@ enum { struct mlx5_ifc_nic_vport_context_bits { u8 reserved_0[0x5]; u8 min_wqe_inline_mode[0x3]; - u8 reserved_1[0x17]; + u8 reserved_1[0x15]; + u8 disable_mc_local_lb[0x1]; + u8 disable_uc_local_lb[0x1]; u8 roce_en[0x1]; u8 arm_change_event[0x1]; @@ -3075,6 +3117,50 @@ struct mlx5_ifc_teardown_hca_in_bits { u8 reserved_3[0x20]; }; +struct mlx5_ifc_set_delay_drop_params_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x40]; +}; + +struct mlx5_ifc_set_delay_drop_params_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x10]; + u8 delay_drop_timeout[0x10]; +}; + +struct mlx5_ifc_query_delay_drop_params_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x10]; + u8 delay_drop_timeout[0x10]; +}; + +struct mlx5_ifc_query_delay_drop_params_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 reserved_at_40[0x40]; +}; + struct mlx5_ifc_suspend_qp_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -4076,31 +4162,39 @@ struct mlx5_ifc_query_q_counter_out_bits { u8 out_of_buffer[0x20]; - u8 reserved_7[0x20]; + u8 reserved_7[0x20]; u8 out_of_sequence[0x20]; - u8 reserved_8[0x20]; + u8 reserved_8[0x20]; - u8 duplicate_request[0x20]; + u8 duplicate_request[0x20]; - u8 reserved_9[0x20]; + u8 reserved_9[0x20]; - u8 rnr_nak_retry_err[0x20]; + u8 rnr_nak_retry_err[0x20]; - u8 reserved_10[0x20]; + u8 reserved_10[0x20]; - u8 packet_seq_err[0x20]; + u8 packet_seq_err[0x20]; - u8 reserved_11[0x20]; + u8 reserved_11[0x20]; - u8 implied_nak_seq_err[0x20]; + u8 implied_nak_seq_err[0x20]; - u8 reserved_12[0x20]; + u8 reserved_12[0x20]; - u8 local_ack_timeout_err[0x20]; + u8 local_ack_timeout_err[0x20]; - u8 reserved_13[0x4e0]; + u8 reserved_13[0x20]; + + u8 resp_rnr_nak[0x20]; + + u8 reserved_14[0x20]; + + u8 req_rnr_retries_exceeded[0x20]; + + u8 reserved_15[0x460]; }; struct mlx5_ifc_query_q_counter_in_bits { @@ -5204,7 +5298,9 @@ struct mlx5_ifc_modify_nic_vport_context_out_bits { }; struct mlx5_ifc_modify_nic_vport_field_select_bits { - u8 reserved_0[0x16]; + u8 reserved_0[0x14]; + u8 disable_uc_local_lb[0x1]; + u8 disable_mc_local_lb[0x1]; u8 node_guid[0x1]; u8 port_guid[0x1]; u8 min_wqe_inline_mode[0x1]; @@ -7958,6 +8054,42 @@ struct mlx5_ifc_phys_layer_cntrs_bits { u8 reserved_0[0x180]; }; +struct mlx5_ifc_phys_layer_statistical_cntrs_bits { + u8 time_since_last_clear_high[0x20]; + + u8 time_since_last_clear_low[0x20]; + + u8 phy_received_bits_high[0x20]; + + u8 phy_received_bits_low[0x20]; + + u8 phy_symbol_errors_high[0x20]; + + u8 phy_symbol_errors_low[0x20]; + + u8 phy_corrected_bits_high[0x20]; + + u8 phy_corrected_bits_low[0x20]; + + u8 phy_corrected_bits_lane0_high[0x20]; + + u8 phy_corrected_bits_lane0_low[0x20]; + + u8 phy_corrected_bits_lane1_high[0x20]; + + u8 phy_corrected_bits_lane1_low[0x20]; + + u8 phy_corrected_bits_lane2_high[0x20]; + + u8 phy_corrected_bits_lane2_low[0x20]; + + u8 phy_corrected_bits_lane3_high[0x20]; + + u8 phy_corrected_bits_lane3_low[0x20]; + + u8 reserved_at_200[0x5c0]; +}; + struct mlx5_ifc_infiniband_port_cntrs_bits { u8 symbol_error_counter[0x10]; u8 link_error_recovery_counter[0x8]; @@ -9187,6 +9319,7 @@ union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits { struct mlx5_ifc_eth_discard_cntrs_grp_bits eth_discard_cntrs_grp; struct mlx5_ifc_eth_per_prio_grp_data_layout_bits eth_per_prio_grp_data_layout; struct mlx5_ifc_phys_layer_cntrs_bits phys_layer_cntrs; + struct mlx5_ifc_phys_layer_statistical_cntrs_bits phys_layer_statistical_cntrs; struct mlx5_ifc_infiniband_port_cntrs_bits infiniband_port_cntrs; u8 reserved_0[0x7c0]; }; From owner-svn-src-stable@freebsd.org Thu Aug 3 13:52:41 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B65E7DBDF7E; Thu, 3 Aug 2017 13:52:41 +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 59AEC7CDD8; Thu, 3 Aug 2017 13:52:41 +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 v73DqebI049673; Thu, 3 Aug 2017 13:52:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73DqeFB049672; Thu, 3 Aug 2017 13:52:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031352.v73DqeFB049672@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 13:52: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: r321993 - stable/10/sys/dev/mlx5 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5 X-SVN-Commit-Revision: 321993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 13:52:41 -0000 Author: hselasky Date: Thu Aug 3 13:52:39 2017 New Revision: 321993 URL: https://svnweb.freebsd.org/changeset/base/321993 Log: MFC r312526: Update firmware interface structures and definitions adding support for new features and commands. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_ifc.h Thu Aug 3 13:51:18 2017 (r321992) +++ stable/10/sys/dev/mlx5/mlx5_ifc.h Thu Aug 3 13:52:39 2017 (r321993) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,13 +23,8 @@ * SUCH DAMAGE. * * $FreeBSD$ + */ - Autogenerated file. - Date: 2015-04-13 14:59 - Source Document Name: Mellanox - Source Document Version: 0.28 - Generated by adb_to_c.py (EAT.ME Version: 1.0.70) -*/ #ifndef MLX5_IFC_H #define MLX5_IFC_H @@ -56,6 +51,8 @@ enum { MLX5_EVENT_TYPE_CODING_TEMP_WARNING_EVENT = 0x17, MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19, MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT = 0x1e, + MLX5_EVENT_TYPE_CODING_PPS_EVENT = 0x25, + MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT = 0x22, MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a, MLX5_EVENT_TYPE_STALL_EVENT = 0x1b, MLX5_EVENT_TYPE_DROPPED_PACKET_LOGGED_EVENT = 0x1f, @@ -89,6 +86,8 @@ enum { MLX5_CMD_OP_QUERY_ISSI = 0x10a, MLX5_CMD_OP_SET_ISSI = 0x10b, MLX5_CMD_OP_SET_DRIVER_VERSION = 0x10d, + MLX5_CMD_OP_QUERY_OTHER_HCA_CAP = 0x10e, + MLX5_CMD_OP_MODIFY_OTHER_HCA_CAP = 0x10f, MLX5_CMD_OP_CREATE_MKEY = 0x200, MLX5_CMD_OP_QUERY_MKEY = 0x201, MLX5_CMD_OP_DESTROY_MKEY = 0x202, @@ -190,6 +189,12 @@ enum { MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY = 0x82b, MLX5_CMD_OP_SET_WOL_ROL = 0x830, MLX5_CMD_OP_QUERY_WOL_ROL = 0x831, + MLX5_CMD_OP_CREATE_LAG = 0x840, + MLX5_CMD_OP_MODIFY_LAG = 0x841, + MLX5_CMD_OP_QUERY_LAG = 0x842, + MLX5_CMD_OP_DESTROY_LAG = 0x843, + MLX5_CMD_OP_CREATE_VPORT_LAG = 0x844, + MLX5_CMD_OP_DESTROY_VPORT_LAG = 0x845, MLX5_CMD_OP_CREATE_TIR = 0x900, MLX5_CMD_OP_MODIFY_TIR = 0x901, MLX5_CMD_OP_DESTROY_TIR = 0x902, @@ -206,6 +211,8 @@ enum { MLX5_CMD_OP_MODIFY_RMP = 0x90d, MLX5_CMD_OP_DESTROY_RMP = 0x90e, MLX5_CMD_OP_QUERY_RMP = 0x90f, + MLX5_CMD_OP_SET_DELAY_DROP_PARAMS = 0x910, + MLX5_CMD_OP_QUERY_DELAY_DROP_PARAMS = 0x911, MLX5_CMD_OP_CREATE_TIS = 0x912, MLX5_CMD_OP_MODIFY_TIS = 0x913, MLX5_CMD_OP_DESTROY_TIS = 0x914, @@ -226,7 +233,10 @@ enum { MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY = 0x938, MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939, MLX5_CMD_OP_DEALLOC_FLOW_COUNTER = 0x93a, - MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b + MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b, + MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c, + MLX5_CMD_OP_ALLOC_ENCAP_HEADER = 0x93d, + MLX5_CMD_OP_DEALLOC_ENCAP_HEADER = 0x93e, }; enum { @@ -271,7 +281,11 @@ struct mlx5_ifc_flow_table_fields_supported_bits { u8 outer_gre_protocol[0x1]; u8 outer_gre_key[0x1]; u8 outer_vxlan_vni[0x1]; - u8 reserved_2[0x5]; + u8 outer_geneve_vni[0x1]; + u8 outer_geneve_oam[0x1]; + u8 outer_geneve_protocol_type[0x1]; + u8 outer_geneve_opt_len[0x1]; + u8 reserved_2[0x1]; u8 source_eswitch_port[0x1]; u8 inner_dmac[0x1]; @@ -299,10 +313,12 @@ struct mlx5_ifc_flow_table_fields_supported_bits { u8 inner_tcp_flags[0x1]; u8 reserved_5[0x9]; - u8 reserved_6[0x1f]; + u8 reserved_6[0x1a]; + u8 bth_dst_qp[0x1]; + u8 reserved_7[0x4]; u8 source_sqn[0x1]; - u8 reserved_7[0x20]; + u8 reserved_8[0x20]; }; struct mlx5_ifc_eth_discard_cntrs_grp_bits { @@ -356,7 +372,11 @@ struct mlx5_ifc_eth_discard_cntrs_grp_bits { u8 egress_stp_filter_low[0x20]; - u8 reserved_at_340[0x480]; + u8 egress_hoq_stall_high[0x20]; + + u8 egress_hoq_stall_low[0x20]; + + u8 reserved_at_340[0x440]; }; struct mlx5_ifc_flow_table_prop_layout_bits { u8 ft_support[0x1]; @@ -411,6 +431,7 @@ enum { MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT = 0x0, MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE = 0x1, MLX5_FLOW_CONTEXT_DEST_TYPE_TIR = 0x2, + MLX5_FLOW_CONTEXT_DEST_TYPE_QP = 0x3, }; struct mlx5_ifc_dest_format_struct_bits { @@ -490,9 +511,14 @@ struct mlx5_ifc_fte_match_set_misc_bits { u8 reserved_6[0xc]; u8 inner_ipv6_flow_label[0x14]; - u8 reserved7[0x10]; + u8 reserved_7[0xa]; + u8 geneve_opt_len[0x6]; u8 geneve_protocol_type[0x10]; - u8 reserved8[0xc0]; + + u8 reserved_8[0x8]; + u8 bth_dst_qp[0x18]; + + u8 reserved_9[0xa0]; }; struct mlx5_ifc_cmd_pas_bits { @@ -698,7 +724,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_b u8 lro_psh_flag[0x1]; u8 lro_time_stamp[0x1]; u8 lro_max_msg_sz_mode[0x2]; - u8 reserved_0[0x2]; + u8 wqe_vlan_insert[0x1]; + u8 self_lb_en_modifiable[0x1]; u8 self_lb_mc[0x1]; u8 self_lb_uc[0x1]; u8 max_lso_cap[0x5]; @@ -715,7 +742,8 @@ struct mlx5_ifc_per_protocol_networking_offload_caps_b u8 swp[0x1]; u8 swp_csum[0x1]; u8 swp_lso[0x1]; - u8 reserved_2[0x1c]; + u8 reserved_2[0x1b]; + u8 max_geneve_opt_len[0x1]; u8 tunnel_stateless_geneve_rx[0x1]; u8 reserved_3[0x10]; @@ -910,7 +938,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 vport_counters[0x1]; u8 retransmission_q_counters[0x1]; u8 debug[0x1]; - u8 reserved_16[0x2]; + u8 modify_rq_counters_set_id[0x1]; + u8 rq_delay_drop[0x1]; u8 max_qp_cnt[0xa]; u8 pkey_table_size[0x10]; @@ -980,7 +1009,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 cq_oi[0x1]; u8 cq_resize[0x1]; u8 cq_moderation[0x1]; - u8 reserved_31[0x3]; + u8 cq_period_mode_modify[0x1]; + u8 cq_invalidate[0x1]; + u8 reserved_at_225[0x1]; u8 cq_eq_remap[0x1]; u8 pg[0x1]; u8 block_lb_mc[0x1]; @@ -1068,7 +1099,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 log_max_wq_sz[0x5]; u8 nic_vport_change_event[0x1]; - u8 reserved_59[0xa]; + u8 disable_local_lb[0x1]; + u8 reserved_59[0x9]; u8 log_max_vlan_list[0x5]; u8 reserved_60[0x3]; u8 log_max_current_mc_list[0x5]; @@ -1312,6 +1344,8 @@ enum { MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_CQ_MAX_COUNT = 0x2, MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_OI = 0x4, MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_C_EQN = 0x8, + MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_CQ_PERIOD_MODE = 0x10, + MLX5_MODIFY_FIELD_SELECT_MODIFY_FIELD_SELECT_STATUS = 0x20, }; struct mlx5_ifc_modify_field_select_bits { @@ -2239,9 +2273,15 @@ enum { MLX5_RQC_STATE_ERR = 0x3, }; +enum { + MLX5_RQC_DROPLESS_MODE_DISABLE = 0x0, + MLX5_RQC_DROPLESS_MODE_ENABLE = 0x1, +}; + struct mlx5_ifc_rqc_bits { - u8 rlky[0x1]; - u8 reserved_0[0x2]; + u8 rlkey[0x1]; + u8 delay_drop_en[0x1]; + u8 scatter_fcs[0x1]; u8 vlan_strip_disable[0x1]; u8 mem_rq_type[0x4]; u8 state[0x4]; @@ -2293,7 +2333,9 @@ enum { struct mlx5_ifc_nic_vport_context_bits { u8 reserved_0[0x5]; u8 min_wqe_inline_mode[0x3]; - u8 reserved_1[0x17]; + u8 reserved_1[0x15]; + u8 disable_mc_local_lb[0x1]; + u8 disable_uc_local_lb[0x1]; u8 roce_en[0x1]; u8 arm_change_event[0x1]; @@ -3075,6 +3117,50 @@ struct mlx5_ifc_teardown_hca_in_bits { u8 reserved_3[0x20]; }; +struct mlx5_ifc_set_delay_drop_params_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x40]; +}; + +struct mlx5_ifc_set_delay_drop_params_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x10]; + u8 delay_drop_timeout[0x10]; +}; + +struct mlx5_ifc_query_delay_drop_params_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x10]; + u8 delay_drop_timeout[0x10]; +}; + +struct mlx5_ifc_query_delay_drop_params_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 reserved_at_40[0x40]; +}; + struct mlx5_ifc_suspend_qp_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -4076,31 +4162,39 @@ struct mlx5_ifc_query_q_counter_out_bits { u8 out_of_buffer[0x20]; - u8 reserved_7[0x20]; + u8 reserved_7[0x20]; u8 out_of_sequence[0x20]; - u8 reserved_8[0x20]; + u8 reserved_8[0x20]; - u8 duplicate_request[0x20]; + u8 duplicate_request[0x20]; - u8 reserved_9[0x20]; + u8 reserved_9[0x20]; - u8 rnr_nak_retry_err[0x20]; + u8 rnr_nak_retry_err[0x20]; - u8 reserved_10[0x20]; + u8 reserved_10[0x20]; - u8 packet_seq_err[0x20]; + u8 packet_seq_err[0x20]; - u8 reserved_11[0x20]; + u8 reserved_11[0x20]; - u8 implied_nak_seq_err[0x20]; + u8 implied_nak_seq_err[0x20]; - u8 reserved_12[0x20]; + u8 reserved_12[0x20]; - u8 local_ack_timeout_err[0x20]; + u8 local_ack_timeout_err[0x20]; - u8 reserved_13[0x4e0]; + u8 reserved_13[0x20]; + + u8 resp_rnr_nak[0x20]; + + u8 reserved_14[0x20]; + + u8 req_rnr_retries_exceeded[0x20]; + + u8 reserved_15[0x460]; }; struct mlx5_ifc_query_q_counter_in_bits { @@ -5204,7 +5298,9 @@ struct mlx5_ifc_modify_nic_vport_context_out_bits { }; struct mlx5_ifc_modify_nic_vport_field_select_bits { - u8 reserved_0[0x16]; + u8 reserved_0[0x14]; + u8 disable_uc_local_lb[0x1]; + u8 disable_mc_local_lb[0x1]; u8 node_guid[0x1]; u8 port_guid[0x1]; u8 min_wqe_inline_mode[0x1]; @@ -7958,6 +8054,42 @@ struct mlx5_ifc_phys_layer_cntrs_bits { u8 reserved_0[0x180]; }; +struct mlx5_ifc_phys_layer_statistical_cntrs_bits { + u8 time_since_last_clear_high[0x20]; + + u8 time_since_last_clear_low[0x20]; + + u8 phy_received_bits_high[0x20]; + + u8 phy_received_bits_low[0x20]; + + u8 phy_symbol_errors_high[0x20]; + + u8 phy_symbol_errors_low[0x20]; + + u8 phy_corrected_bits_high[0x20]; + + u8 phy_corrected_bits_low[0x20]; + + u8 phy_corrected_bits_lane0_high[0x20]; + + u8 phy_corrected_bits_lane0_low[0x20]; + + u8 phy_corrected_bits_lane1_high[0x20]; + + u8 phy_corrected_bits_lane1_low[0x20]; + + u8 phy_corrected_bits_lane2_high[0x20]; + + u8 phy_corrected_bits_lane2_low[0x20]; + + u8 phy_corrected_bits_lane3_high[0x20]; + + u8 phy_corrected_bits_lane3_low[0x20]; + + u8 reserved_at_200[0x5c0]; +}; + struct mlx5_ifc_infiniband_port_cntrs_bits { u8 symbol_error_counter[0x10]; u8 link_error_recovery_counter[0x8]; @@ -9187,6 +9319,7 @@ union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits { struct mlx5_ifc_eth_discard_cntrs_grp_bits eth_discard_cntrs_grp; struct mlx5_ifc_eth_per_prio_grp_data_layout_bits eth_per_prio_grp_data_layout; struct mlx5_ifc_phys_layer_cntrs_bits phys_layer_cntrs; + struct mlx5_ifc_phys_layer_statistical_cntrs_bits phys_layer_statistical_cntrs; struct mlx5_ifc_infiniband_port_cntrs_bits infiniband_port_cntrs; u8 reserved_0[0x7c0]; }; From owner-svn-src-stable@freebsd.org Thu Aug 3 13:55:41 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4184ADBE1C4; Thu, 3 Aug 2017 13:55:41 +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 1B8917D06B; Thu, 3 Aug 2017 13:55:41 +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 v73Dte9W049955; Thu, 3 Aug 2017 13:55:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73DtdDZ049951; Thu, 3 Aug 2017 13:55:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031355.v73DtdDZ049951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 13:55: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: r321995 - in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 321995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 13:55:41 -0000 Author: hselasky Date: Thu Aug 3 13:55:39 2017 New Revision: 321995 URL: https://svnweb.freebsd.org/changeset/base/321995 Log: MFC r312527: Add runtime support for modifying the SQ and RQ completion event moderation mode. The presence of this feature is indicated through the firmware capabilities. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/cq.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/cq.h ============================================================================== --- stable/11/sys/dev/mlx5/cq.h Thu Aug 3 13:54:46 2017 (r321994) +++ stable/11/sys/dev/mlx5/cq.h Thu Aug 3 13:55:39 2017 (r321995) @@ -88,6 +88,7 @@ enum { MLX5_CQ_MODIFY_PERIOD = 1 << 0, MLX5_CQ_MODIFY_COUNT = 1 << 1, MLX5_CQ_MODIFY_OVERRUN = 1 << 2, + MLX5_CQ_MODIFY_PERIOD_MODE = 1 << 4, }; enum { @@ -165,6 +166,11 @@ int mlx5_core_modify_cq(struct mlx5_core_dev *dev, str int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u16 cq_period, u16 cq_max_count); +int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev, + struct mlx5_core_cq *cq, + u16 cq_period, + u16 cq_max_count, + u8 cq_mode); int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Aug 3 13:54:46 2017 (r321994) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Aug 3 13:55:39 2017 (r321995) @@ -266,6 +266,28 @@ int mlx5_core_modify_cq_moderation(struct mlx5_core_de return mlx5_core_modify_cq(dev, cq, &in, sizeof(in)); } +int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev, + struct mlx5_core_cq *cq, + u16 cq_period, + u16 cq_max_count, + u8 cq_mode) +{ + struct mlx5_modify_cq_mbox_in in; + + memset(&in, 0, sizeof(in)); + + in.cqn = cpu_to_be32(cq->cqn); + in.ctx.cq_period = cpu_to_be16(cq_period); + in.ctx.cq_max_count = cpu_to_be16(cq_max_count); + in.ctx.cqe_sz_flags = (cq_mode & 2) >> 1; + in.ctx.st = (cq_mode & 1) << 7; + in.field_select = cpu_to_be32(MLX5_CQ_MODIFY_PERIOD | + MLX5_CQ_MODIFY_COUNT | + MLX5_CQ_MODIFY_PERIOD_MODE); + + return mlx5_core_modify_cq(dev, cq, &in, sizeof(in)); +} + int mlx5_init_cq_table(struct mlx5_core_dev *dev) { struct mlx5_cq_table *table = &dev->priv.cq_table; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 13:54:46 2017 (r321994) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 13:55:39 2017 (r321995) @@ -92,6 +92,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; uint64_t value; + int mode_modify; int was_opened; int error; @@ -114,6 +115,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) goto done; } was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); + mode_modify = MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify); switch (MLX5_PARAM_OFFSET(arg[arg2])) { case MLX5_PARAM_OFFSET(rx_coalesce_usecs): @@ -266,7 +268,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) case MLX5_PARAM_OFFSET(rx_coalesce_mode): /* network interface must be down */ - if (was_opened) + if (was_opened != 0 && mode_modify == 0) mlx5e_close_locked(priv->ifp); /* import RX coalesce mode */ @@ -276,13 +278,17 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) priv->params_ethtool.rx_coalesce_mode; /* restart network interface, if any */ - if (was_opened) - mlx5e_open_locked(priv->ifp); + if (was_opened != 0) { + if (mode_modify == 0) + mlx5e_open_locked(priv->ifp); + else + error = mlx5e_refresh_channel_params(priv); + } break; case MLX5_PARAM_OFFSET(tx_coalesce_mode): /* network interface must be down */ - if (was_opened) + if (was_opened != 0 && mode_modify == 0) mlx5e_close_locked(priv->ifp); /* import TX coalesce mode */ @@ -292,8 +298,12 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) priv->params_ethtool.tx_coalesce_mode; /* restart network interface, if any */ - if (was_opened) - mlx5e_open_locked(priv->ifp); + if (was_opened != 0) { + if (mode_modify == 0) + mlx5e_open_locked(priv->ifp); + else + error = mlx5e_refresh_channel_params(priv); + } break; case MLX5_PARAM_OFFSET(hw_lro): Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 13:54:46 2017 (r321994) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 13:55:39 2017 (r321995) @@ -1780,6 +1780,25 @@ mlx5e_close_channels(struct mlx5e_priv *priv) static int mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struct mlx5e_sq *sq) { + + if (MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify)) { + uint8_t cq_mode; + + switch (priv->params.tx_cq_moderation_mode) { + case 0: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; + break; + default: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE; + break; + } + + return (mlx5_core_modify_cq_moderation_mode(priv->mdev, &sq->cq.mcq, + priv->params.tx_cq_moderation_usec, + priv->params.tx_cq_moderation_pkts, + cq_mode)); + } + return (mlx5_core_modify_cq_moderation(priv->mdev, &sq->cq.mcq, priv->params.tx_cq_moderation_usec, priv->params.tx_cq_moderation_pkts)); @@ -1788,6 +1807,28 @@ mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struc static int mlx5e_refresh_rq_params(struct mlx5e_priv *priv, struct mlx5e_rq *rq) { + + if (MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify)) { + uint8_t cq_mode; + int retval; + + switch (priv->params.rx_cq_moderation_mode) { + case 0: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; + break; + default: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE; + break; + } + + retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, + priv->params.rx_cq_moderation_usec, + priv->params.rx_cq_moderation_pkts, + cq_mode); + + return (retval); + } + return (mlx5_core_modify_cq_moderation(priv->mdev, &rq->cq.mcq, priv->params.rx_cq_moderation_usec, priv->params.rx_cq_moderation_pkts)); From owner-svn-src-stable@freebsd.org Thu Aug 3 13:57:19 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A48BDBE319; Thu, 3 Aug 2017 13:57:19 +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 3681F7D1D0; Thu, 3 Aug 2017 13:57:19 +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 v73DvIna050100; Thu, 3 Aug 2017 13:57:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73DvI1S050096; Thu, 3 Aug 2017 13:57:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031357.v73DvI1S050096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 13:57:18 +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: r321996 - in stable/10/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 321996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 13:57:19 -0000 Author: hselasky Date: Thu Aug 3 13:57:17 2017 New Revision: 321996 URL: https://svnweb.freebsd.org/changeset/base/321996 Log: MFC r312527: Add runtime support for modifying the SQ and RQ completion event moderation mode. The presence of this feature is indicated through the firmware capabilities. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/cq.h stable/10/sys/dev/mlx5/mlx5_core/mlx5_cq.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/cq.h ============================================================================== --- stable/10/sys/dev/mlx5/cq.h Thu Aug 3 13:55:39 2017 (r321995) +++ stable/10/sys/dev/mlx5/cq.h Thu Aug 3 13:57:17 2017 (r321996) @@ -88,6 +88,7 @@ enum { MLX5_CQ_MODIFY_PERIOD = 1 << 0, MLX5_CQ_MODIFY_COUNT = 1 << 1, MLX5_CQ_MODIFY_OVERRUN = 1 << 2, + MLX5_CQ_MODIFY_PERIOD_MODE = 1 << 4, }; enum { @@ -165,6 +166,11 @@ int mlx5_core_modify_cq(struct mlx5_core_dev *dev, str int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, u16 cq_period, u16 cq_max_count); +int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev, + struct mlx5_core_cq *cq, + u16 cq_period, + u16 cq_max_count, + u8 cq_mode); int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_cq.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Aug 3 13:55:39 2017 (r321995) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_cq.c Thu Aug 3 13:57:17 2017 (r321996) @@ -266,6 +266,28 @@ int mlx5_core_modify_cq_moderation(struct mlx5_core_de return mlx5_core_modify_cq(dev, cq, &in, sizeof(in)); } +int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev, + struct mlx5_core_cq *cq, + u16 cq_period, + u16 cq_max_count, + u8 cq_mode) +{ + struct mlx5_modify_cq_mbox_in in; + + memset(&in, 0, sizeof(in)); + + in.cqn = cpu_to_be32(cq->cqn); + in.ctx.cq_period = cpu_to_be16(cq_period); + in.ctx.cq_max_count = cpu_to_be16(cq_max_count); + in.ctx.cqe_sz_flags = (cq_mode & 2) >> 1; + in.ctx.st = (cq_mode & 1) << 7; + in.field_select = cpu_to_be32(MLX5_CQ_MODIFY_PERIOD | + MLX5_CQ_MODIFY_COUNT | + MLX5_CQ_MODIFY_PERIOD_MODE); + + return mlx5_core_modify_cq(dev, cq, &in, sizeof(in)); +} + int mlx5_init_cq_table(struct mlx5_core_dev *dev) { struct mlx5_cq_table *table = &dev->priv.cq_table; Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 13:55:39 2017 (r321995) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 13:57:17 2017 (r321996) @@ -92,6 +92,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; uint64_t value; + int mode_modify; int was_opened; int error; @@ -114,6 +115,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) goto done; } was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); + mode_modify = MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify); switch (MLX5_PARAM_OFFSET(arg[arg2])) { case MLX5_PARAM_OFFSET(rx_coalesce_usecs): @@ -266,7 +268,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) case MLX5_PARAM_OFFSET(rx_coalesce_mode): /* network interface must be down */ - if (was_opened) + if (was_opened != 0 && mode_modify == 0) mlx5e_close_locked(priv->ifp); /* import RX coalesce mode */ @@ -276,13 +278,17 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) priv->params_ethtool.rx_coalesce_mode; /* restart network interface, if any */ - if (was_opened) - mlx5e_open_locked(priv->ifp); + if (was_opened != 0) { + if (mode_modify == 0) + mlx5e_open_locked(priv->ifp); + else + error = mlx5e_refresh_channel_params(priv); + } break; case MLX5_PARAM_OFFSET(tx_coalesce_mode): /* network interface must be down */ - if (was_opened) + if (was_opened != 0 && mode_modify == 0) mlx5e_close_locked(priv->ifp); /* import TX coalesce mode */ @@ -292,8 +298,12 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) priv->params_ethtool.tx_coalesce_mode; /* restart network interface, if any */ - if (was_opened) - mlx5e_open_locked(priv->ifp); + if (was_opened != 0) { + if (mode_modify == 0) + mlx5e_open_locked(priv->ifp); + else + error = mlx5e_refresh_channel_params(priv); + } break; case MLX5_PARAM_OFFSET(hw_lro): Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 13:55:39 2017 (r321995) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 13:57:17 2017 (r321996) @@ -1787,6 +1787,25 @@ mlx5e_close_channels(struct mlx5e_priv *priv) static int mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struct mlx5e_sq *sq) { + + if (MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify)) { + uint8_t cq_mode; + + switch (priv->params.tx_cq_moderation_mode) { + case 0: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; + break; + default: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE; + break; + } + + return (mlx5_core_modify_cq_moderation_mode(priv->mdev, &sq->cq.mcq, + priv->params.tx_cq_moderation_usec, + priv->params.tx_cq_moderation_pkts, + cq_mode)); + } + return (mlx5_core_modify_cq_moderation(priv->mdev, &sq->cq.mcq, priv->params.tx_cq_moderation_usec, priv->params.tx_cq_moderation_pkts)); @@ -1795,6 +1814,28 @@ mlx5e_refresh_sq_params(struct mlx5e_priv *priv, struc static int mlx5e_refresh_rq_params(struct mlx5e_priv *priv, struct mlx5e_rq *rq) { + + if (MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify)) { + uint8_t cq_mode; + int retval; + + switch (priv->params.rx_cq_moderation_mode) { + case 0: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_EQE; + break; + default: + cq_mode = MLX5_CQ_PERIOD_MODE_START_FROM_CQE; + break; + } + + retval = mlx5_core_modify_cq_moderation_mode(priv->mdev, &rq->cq.mcq, + priv->params.rx_cq_moderation_usec, + priv->params.rx_cq_moderation_pkts, + cq_mode); + + return (retval); + } + return (mlx5_core_modify_cq_moderation(priv->mdev, &rq->cq.mcq, priv->params.rx_cq_moderation_usec, priv->params.rx_cq_moderation_pkts)); From owner-svn-src-stable@freebsd.org Thu Aug 3 14:00:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04D37DBE581; Thu, 3 Aug 2017 14:00:28 +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 D2CEA7D3DE; Thu, 3 Aug 2017 14:00:27 +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 v73E0QWV050304; Thu, 3 Aug 2017 14:00:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E0QDa050301; Thu, 3 Aug 2017 14:00:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031400.v73E0QDa050301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:00: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: r321997 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 321997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:00:28 -0000 Author: hselasky Date: Thu Aug 3 14:00:26 2017 New Revision: 321997 URL: https://svnweb.freebsd.org/changeset/base/321997 Log: MFC r312528: Make draining a sendqueue more robust. Add own state variable to track if a sendqueue is stopped or not. This will prevent traffic from entering the sendqueue while it is being destroyed. Update drain function to wait for traffic to be transmitted before returning when the link state is active. Add extra checks in transmit path for stopped SQ's. While at it: - Use likely() for a mbuf pointer check. - Remove redundant IFF_DRV_RUNNING check. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 13:57:17 2017 (r321996) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:00:26 2017 (r321997) @@ -507,10 +507,11 @@ struct mlx5e_sq { u16 bf_offset; u16 cev_counter; /* completion event counter */ u16 cev_factor; /* completion event factor */ - u32 cev_next_state; /* next completion event state */ + u16 cev_next_state; /* next completion event state */ #define MLX5E_CEV_STATE_INITIAL 0 /* timer not started */ #define MLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */ #define MLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */ + u16 stopped; /* set if SQ is stopped */ struct callout cev_callout; union { u32 d32[2]; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 13:57:17 2017 (r321996) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:00:26 2017 (r321997) @@ -1233,8 +1233,25 @@ mlx5e_sq_cev_timeout(void *arg) void mlx5e_drain_sq(struct mlx5e_sq *sq) { + int error; + /* + * Check if already stopped. + * + * NOTE: The "stopped" variable is only written when both the + * priv's configuration lock and the SQ's lock is locked. It + * can therefore safely be read when only one of the two locks + * is locked. This function is always called when the priv's + * configuration lock is locked. + */ + if (sq->stopped != 0) + return; + mtx_lock(&sq->lock); + + /* don't put more packets into the SQ */ + sq->stopped = 1; + /* teardown event factor timer, if any */ sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS; callout_stop(&sq->cev_callout); @@ -1246,14 +1263,29 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* make sure it is safe to free the callout */ callout_drain(&sq->cev_callout); + /* wait till SQ is empty or link is down */ + mtx_lock(&sq->lock); + while (sq->cc != sq->pc && + (sq->priv->media_status_last & IFM_ACTIVE) != 0) { + mtx_unlock(&sq->lock); + msleep(1); + sq->cq.mcq.comp(&sq->cq.mcq); + mtx_lock(&sq->lock); + } + mtx_unlock(&sq->lock); + /* error out remaining requests */ - mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); + error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); + if (error != 0) { + if_printf(sq->ifp, + "mlx5e_modify_sq() from RDY to ERR failed: %d\n", error); + } /* wait till SQ is empty */ mtx_lock(&sq->lock); while (sq->cc != sq->pc) { mtx_unlock(&sq->lock); - msleep(4); + msleep(1); sq->cq.mcq.comp(&sq->cq.mcq); mtx_lock(&sq->lock); } Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 13:57:17 2017 (r321996) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 14:00:26 2017 (r321997) @@ -81,11 +81,15 @@ static struct mlx5e_sq * mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) { struct mlx5e_priv *priv = ifp->if_softc; + struct mlx5e_channel * volatile *ppch; + struct mlx5e_channel *pch; u32 ch; u32 tc; + ppch = priv->channel; + /* check if channels are successfully opened */ - if (unlikely(priv->channel == NULL)) + if (unlikely(ppch == NULL)) return (NULL); /* obtain VLAN information if present */ @@ -123,11 +127,11 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) #endif } - /* check if channel is allocated */ - if (unlikely(priv->channel[ch] == NULL)) - return (NULL); - - return (&priv->channel[ch]->sq[tc]); + /* check if channel is allocated and not stopped */ + pch = ppch[ch]; + if (likely(pch != NULL && pch->sq[tc].stopped == 0)) + return (&pch->sq[tc]); + return (NULL); } static inline u16 @@ -445,19 +449,22 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * struct mbuf *next; int err = 0; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - if (mb) - err = drbr_enqueue(ifp, sq->br, mb); - return (err); - } - - if (mb != NULL) + if (likely(mb != NULL)) { /* * If we can't insert mbuf into drbr, try to xmit anyway. * We keep the error we got so we could return that after xmit. */ err = drbr_enqueue(ifp, sq->br, mb); + } + /* + * Check if the network interface is closed or if the SQ is + * being stopped: + */ + if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + sq->stopped != 0)) + return (err); + /* Process the queue */ while ((next = drbr_peek(ifp, sq->br)) != NULL) { if (mlx5e_sq_xmit(sq, &next) != 0) { @@ -470,8 +477,6 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * break; } drbr_advance(ifp, sq->br); - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - break; } /* Check if we need to write the doorbell */ if (likely(sq->doorbell.d64 != 0)) { From owner-svn-src-stable@freebsd.org Thu Aug 3 14:01:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A260FDBE64E; Thu, 3 Aug 2017 14:01:26 +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 6452F7D6A4; Thu, 3 Aug 2017 14:01:26 +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 v73E1Po0054198; Thu, 3 Aug 2017 14:01:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E1PYJ054195; Thu, 3 Aug 2017 14:01:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031401.v73E1PYJ054195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:01: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: r321998 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 321998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:01:26 -0000 Author: hselasky Date: Thu Aug 3 14:01:25 2017 New Revision: 321998 URL: https://svnweb.freebsd.org/changeset/base/321998 Log: MFC r312528: Make draining a sendqueue more robust. Add own state variable to track if a sendqueue is stopped or not. This will prevent traffic from entering the sendqueue while it is being destroyed. Update drain function to wait for traffic to be transmitted before returning when the link state is active. Add extra checks in transmit path for stopped SQ's. While at it: - Use likely() for a mbuf pointer check. - Remove redundant IFF_DRV_RUNNING check. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:00:26 2017 (r321997) +++ stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:01:25 2017 (r321998) @@ -517,10 +517,11 @@ struct mlx5e_sq { u16 bf_offset; u16 cev_counter; /* completion event counter */ u16 cev_factor; /* completion event factor */ - u32 cev_next_state; /* next completion event state */ + u16 cev_next_state; /* next completion event state */ #define MLX5E_CEV_STATE_INITIAL 0 /* timer not started */ #define MLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */ #define MLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */ + u16 stopped; /* set if SQ is stopped */ struct callout cev_callout; union { u32 d32[2]; Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:00:26 2017 (r321997) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:01:25 2017 (r321998) @@ -1240,8 +1240,25 @@ mlx5e_sq_cev_timeout(void *arg) void mlx5e_drain_sq(struct mlx5e_sq *sq) { + int error; + /* + * Check if already stopped. + * + * NOTE: The "stopped" variable is only written when both the + * priv's configuration lock and the SQ's lock is locked. It + * can therefore safely be read when only one of the two locks + * is locked. This function is always called when the priv's + * configuration lock is locked. + */ + if (sq->stopped != 0) + return; + mtx_lock(&sq->lock); + + /* don't put more packets into the SQ */ + sq->stopped = 1; + /* teardown event factor timer, if any */ sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS; callout_stop(&sq->cev_callout); @@ -1253,14 +1270,29 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* make sure it is safe to free the callout */ callout_drain(&sq->cev_callout); + /* wait till SQ is empty or link is down */ + mtx_lock(&sq->lock); + while (sq->cc != sq->pc && + (sq->priv->media_status_last & IFM_ACTIVE) != 0) { + mtx_unlock(&sq->lock); + msleep(1); + sq->cq.mcq.comp(&sq->cq.mcq); + mtx_lock(&sq->lock); + } + mtx_unlock(&sq->lock); + /* error out remaining requests */ - mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); + error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); + if (error != 0) { + if_printf(sq->ifp, + "mlx5e_modify_sq() from RDY to ERR failed: %d\n", error); + } /* wait till SQ is empty */ mtx_lock(&sq->lock); while (sq->cc != sq->pc) { mtx_unlock(&sq->lock); - msleep(4); + msleep(1); sq->cq.mcq.comp(&sq->cq.mcq); mtx_lock(&sq->lock); } Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 14:00:26 2017 (r321997) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 14:01:25 2017 (r321998) @@ -81,11 +81,15 @@ static struct mlx5e_sq * mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) { struct mlx5e_priv *priv = ifp->if_softc; + struct mlx5e_channel * volatile *ppch; + struct mlx5e_channel *pch; u32 ch; u32 tc; + ppch = priv->channel; + /* check if channels are successfully opened */ - if (unlikely(priv->channel == NULL)) + if (unlikely(ppch == NULL)) return (NULL); /* obtain VLAN information if present */ @@ -123,11 +127,11 @@ mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb) #endif } - /* check if channel is allocated */ - if (unlikely(priv->channel[ch] == NULL)) - return (NULL); - - return (&priv->channel[ch]->sq[tc]); + /* check if channel is allocated and not stopped */ + pch = ppch[ch]; + if (likely(pch != NULL && pch->sq[tc].stopped == 0)) + return (&pch->sq[tc]); + return (NULL); } static inline u16 @@ -445,19 +449,22 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * struct mbuf *next; int err = 0; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - if (mb) - err = drbr_enqueue(ifp, sq->br, mb); - return (err); - } - - if (mb != NULL) + if (likely(mb != NULL)) { /* * If we can't insert mbuf into drbr, try to xmit anyway. * We keep the error we got so we could return that after xmit. */ err = drbr_enqueue(ifp, sq->br, mb); + } + /* + * Check if the network interface is closed or if the SQ is + * being stopped: + */ + if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + sq->stopped != 0)) + return (err); + /* Process the queue */ while ((next = drbr_peek(ifp, sq->br)) != NULL) { if (mlx5e_sq_xmit(sq, &next) != 0) { @@ -470,8 +477,6 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * break; } drbr_advance(ifp, sq->br); - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - break; } /* Check if we need to write the doorbell */ if (likely(sq->doorbell.d64 != 0)) { From owner-svn-src-stable@freebsd.org Thu Aug 3 14:03:50 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D76BDBE9FF; Thu, 3 Aug 2017 14:03:50 +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 DC3987D9C6; Thu, 3 Aug 2017 14:03:49 +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 v73E3nCl054355; Thu, 3 Aug 2017 14:03:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E3mAW054351; Thu, 3 Aug 2017 14:03:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031403.v73E3mAW054351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:03: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: r321999 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 321999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:03:50 -0000 Author: hselasky Date: Thu Aug 3 14:03:48 2017 New Revision: 321999 URL: https://svnweb.freebsd.org/changeset/base/321999 Log: MFC r312536: Allow transmit packet bufring in software to be disabled. - Add new sysctl node to control the transmit packet bufring. - Add optimised version of the transmit routine which output packets directly to the DMA ring instead of using bufring in case the transmit lock is congested. This can reduce the number of taskswitches which in turn influence the overall system CPU usage, depending on the workload. - Add " TX" suffix to debug name for transmit mutexes to silence some witness warnings about aquiring duplicate locks having same name. Sponsored by: Mellanox Technologies Suggested by: gallatin @ Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:01:25 2017 (r321998) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:03:48 2017 (r321999) @@ -402,6 +402,7 @@ struct mlx5e_params { m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64 tx_bufring_disable, "tx_bufring_disable", "0: Enable bufring 1: Disable bufring") \ m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:01:25 2017 (r321998) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:03:48 2017 (r321999) @@ -352,6 +352,18 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; + case MLX5_PARAM_OFFSET(tx_bufring_disable): + /* rangecheck input value */ + priv->params_ethtool.tx_bufring_disable = + priv->params_ethtool.tx_bufring_disable ? 1 : 0; + + /* reconfigure the sendqueues, if any */ + if (was_opened) { + mlx5e_close_locked(priv->ifp); + mlx5e_open_locked(priv->ifp); + } + break; + case MLX5_PARAM_OFFSET(tx_completion_fact): /* network interface must be down */ if (was_opened) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:01:25 2017 (r321998) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:03:48 2017 (r321999) @@ -439,7 +439,8 @@ mlx5e_update_stats_work(struct work_struct *work) tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; tx_queue_dropped += sq_stats->dropped; - tx_queue_dropped += sq_br->br_drops; + if (sq_br != NULL) + tx_queue_dropped += sq_br->br_drops; tx_defragged += sq_stats->defragged; tx_offload_none += sq_stats->csum_offload_none; } @@ -1001,34 +1002,37 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->priv = priv; sq->tc = tc; - sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN, - M_WAITOK, &sq->lock); - if (sq->br == NULL) { - if_printf(c->ifp, "%s: Failed allocating sq drbr buffer\n", - __func__); - err = -ENOMEM; - goto err_free_sq_db; - } + /* check if we should allocate a second packet buffer */ + if (priv->params_ethtool.tx_bufring_disable == 0) { + sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN, + M_WAITOK, &sq->lock); + if (sq->br == NULL) { + if_printf(c->ifp, "%s: Failed allocating sq drbr buffer\n", + __func__); + err = -ENOMEM; + goto err_free_sq_db; + } - sq->sq_tq = taskqueue_create_fast("mlx5e_que", M_WAITOK, - taskqueue_thread_enqueue, &sq->sq_tq); - if (sq->sq_tq == NULL) { - if_printf(c->ifp, "%s: Failed allocating taskqueue\n", - __func__); - err = -ENOMEM; - goto err_free_drbr; - } + sq->sq_tq = taskqueue_create_fast("mlx5e_que", M_WAITOK, + taskqueue_thread_enqueue, &sq->sq_tq); + if (sq->sq_tq == NULL) { + if_printf(c->ifp, "%s: Failed allocating taskqueue\n", + __func__); + err = -ENOMEM; + goto err_free_drbr; + } - TASK_INIT(&sq->sq_task, 0, mlx5e_tx_que, sq); + TASK_INIT(&sq->sq_task, 0, mlx5e_tx_que, sq); #ifdef RSS - cpu_id = rss_getcpu(c->ix % rss_getnumbuckets()); - CPU_SETOF(cpu_id, &cpu_mask); - taskqueue_start_threads_cpuset(&sq->sq_tq, 1, PI_NET, &cpu_mask, - "%s TX SQ%d.%d CPU%d", c->ifp->if_xname, c->ix, tc, cpu_id); + cpu_id = rss_getcpu(c->ix % rss_getnumbuckets()); + CPU_SETOF(cpu_id, &cpu_mask); + taskqueue_start_threads_cpuset(&sq->sq_tq, 1, PI_NET, &cpu_mask, + "%s TX SQ%d.%d CPU%d", c->ifp->if_xname, c->ix, tc, cpu_id); #else - taskqueue_start_threads(&sq->sq_tq, 1, PI_NET, - "%s TX SQ%d.%d", c->ifp->if_xname, c->ix, tc); + taskqueue_start_threads(&sq->sq_tq, 1, PI_NET, + "%s TX SQ%d.%d", c->ifp->if_xname, c->ix, tc); #endif + } snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); mlx5e_create_stats(&sq->stats.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), buffer, mlx5e_sq_stats_desc, MLX5E_SQ_STATS_NUM, @@ -1061,9 +1065,12 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq) mlx5e_free_sq_db(sq); mlx5_wq_destroy(&sq->wq_ctrl); mlx5_unmap_free_uar(sq->priv->mdev, &sq->uar); - taskqueue_drain(sq->sq_tq, &sq->sq_task); - taskqueue_free(sq->sq_tq); - buf_ring_free(sq->br, M_MLX5EN); + if (sq->sq_tq != NULL) { + taskqueue_drain(sq->sq_tq, &sq->sq_task); + taskqueue_free(sq->sq_tq); + } + if (sq->br != NULL) + buf_ring_free(sq->br, M_MLX5EN); } int @@ -1511,9 +1518,10 @@ mlx5e_chan_mtx_init(struct mlx5e_channel *c) for (tc = 0; tc < c->num_tc; tc++) { struct mlx5e_sq *sq = c->sq + tc; - mtx_init(&sq->lock, "mlx5tx", MTX_NETWORK_LOCK, MTX_DEF); - mtx_init(&sq->comp_lock, "mlx5comp", MTX_NETWORK_LOCK, - MTX_DEF); + mtx_init(&sq->lock, "mlx5tx", + MTX_NETWORK_LOCK " TX", MTX_DEF); + mtx_init(&sq->comp_lock, "mlx5comp", + MTX_NETWORK_LOCK " TX", MTX_DEF); callout_init_mtx(&sq->cev_callout, &sq->lock, 0); Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 14:01:25 2017 (r321998) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 14:03:48 2017 (r321999) @@ -439,7 +439,8 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) sq->cc = sqcc; - if (atomic_cmpset_int(&sq->queue_state, MLX5E_SQ_FULL, MLX5E_SQ_READY)) + if (sq->sq_tq != NULL && + atomic_cmpset_int(&sq->queue_state, MLX5E_SQ_FULL, MLX5E_SQ_READY)) taskqueue_enqueue(sq->sq_tq, &sq->sq_task); } @@ -498,6 +499,45 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * return (err); } +static int +mlx5e_xmit_locked_no_br(struct ifnet *ifp, struct mlx5e_sq *sq, struct mbuf *mb) +{ + int err = 0; + + if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + sq->stopped != 0)) { + m_freem(mb); + return (ENETDOWN); + } + + /* Do transmit */ + if (mlx5e_sq_xmit(sq, &mb) != 0) { + /* NOTE: m_freem() is NULL safe */ + m_freem(mb); + err = ENOBUFS; + } + + /* Check if we need to write the doorbell */ + if (likely(sq->doorbell.d64 != 0)) { + mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0); + sq->doorbell.d64 = 0; + } + + /* + * Check if we need to start the event timer which flushes the + * transmit ring on timeout: + */ + if (unlikely(sq->cev_next_state == MLX5E_CEV_STATE_INITIAL && + sq->cev_factor != 1)) { + /* start the timer */ + mlx5e_sq_cev_timeout(sq); + } else { + /* don't send NOPs yet */ + sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS; + } + return (err); +} + int mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) { @@ -510,7 +550,13 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) m_freem(mb); return (ENXIO); } - if (mtx_trylock(&sq->lock)) { + + if (unlikely(sq->br == NULL)) { + /* rate limited traffic */ + mtx_lock(&sq->lock); + ret = mlx5e_xmit_locked_no_br(ifp, sq, mb); + mtx_unlock(&sq->lock); + } else if (mtx_trylock(&sq->lock)) { ret = mlx5e_xmit_locked(ifp, sq, mb); mtx_unlock(&sq->lock); } else { From owner-svn-src-stable@freebsd.org Thu Aug 3 14:05:05 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08950DBEB72; Thu, 3 Aug 2017 14:05:05 +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 D36D77DB30; Thu, 3 Aug 2017 14:05:04 +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 v73E53DV054477; Thu, 3 Aug 2017 14:05:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E534G054473; Thu, 3 Aug 2017 14:05:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031405.v73E534G054473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:05: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: r322000 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:05:05 -0000 Author: hselasky Date: Thu Aug 3 14:05:03 2017 New Revision: 322000 URL: https://svnweb.freebsd.org/changeset/base/322000 Log: MFC r312536: Allow transmit packet bufring in software to be disabled. - Add new sysctl node to control the transmit packet bufring. - Add optimised version of the transmit routine which output packets directly to the DMA ring instead of using bufring in case the transmit lock is congested. This can reduce the number of taskswitches which in turn influence the overall system CPU usage, depending on the workload. - Add " TX" suffix to debug name for transmit mutexes to silence some witness warnings about aquiring duplicate locks having same name. Sponsored by: Mellanox Technologies Suggested by: gallatin @ Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:03:48 2017 (r321999) +++ stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:05:03 2017 (r322000) @@ -408,6 +408,7 @@ struct mlx5e_params { m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ + m(+1, u64 tx_bufring_disable, "tx_bufring_disable", "0: Enable bufring 1: Disable bufring") \ m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:03:48 2017 (r321999) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:05:03 2017 (r322000) @@ -352,6 +352,18 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; + case MLX5_PARAM_OFFSET(tx_bufring_disable): + /* rangecheck input value */ + priv->params_ethtool.tx_bufring_disable = + priv->params_ethtool.tx_bufring_disable ? 1 : 0; + + /* reconfigure the sendqueues, if any */ + if (was_opened) { + mlx5e_close_locked(priv->ifp); + mlx5e_open_locked(priv->ifp); + } + break; + case MLX5_PARAM_OFFSET(tx_completion_fact): /* network interface must be down */ if (was_opened) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:03:48 2017 (r321999) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:05:03 2017 (r322000) @@ -439,7 +439,8 @@ mlx5e_update_stats_work(struct work_struct *work) tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; tx_queue_dropped += sq_stats->dropped; - tx_queue_dropped += sq_br->br_drops; + if (sq_br != NULL) + tx_queue_dropped += sq_br->br_drops; tx_defragged += sq_stats->defragged; tx_offload_none += sq_stats->csum_offload_none; } @@ -1008,34 +1009,37 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->priv = priv; sq->tc = tc; - sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN, - M_WAITOK, &sq->lock); - if (sq->br == NULL) { - if_printf(c->ifp, "%s: Failed allocating sq drbr buffer\n", - __func__); - err = -ENOMEM; - goto err_free_sq_db; - } + /* check if we should allocate a second packet buffer */ + if (priv->params_ethtool.tx_bufring_disable == 0) { + sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN, + M_WAITOK, &sq->lock); + if (sq->br == NULL) { + if_printf(c->ifp, "%s: Failed allocating sq drbr buffer\n", + __func__); + err = -ENOMEM; + goto err_free_sq_db; + } - sq->sq_tq = taskqueue_create_fast("mlx5e_que", M_WAITOK, - taskqueue_thread_enqueue, &sq->sq_tq); - if (sq->sq_tq == NULL) { - if_printf(c->ifp, "%s: Failed allocating taskqueue\n", - __func__); - err = -ENOMEM; - goto err_free_drbr; - } + sq->sq_tq = taskqueue_create_fast("mlx5e_que", M_WAITOK, + taskqueue_thread_enqueue, &sq->sq_tq); + if (sq->sq_tq == NULL) { + if_printf(c->ifp, "%s: Failed allocating taskqueue\n", + __func__); + err = -ENOMEM; + goto err_free_drbr; + } - TASK_INIT(&sq->sq_task, 0, mlx5e_tx_que, sq); + TASK_INIT(&sq->sq_task, 0, mlx5e_tx_que, sq); #ifdef RSS - cpu_id = rss_getcpu(c->ix % rss_getnumbuckets()); - CPU_SETOF(cpu_id, &cpu_mask); - taskqueue_start_threads_cpuset(&sq->sq_tq, 1, PI_NET, &cpu_mask, - "%s TX SQ%d.%d CPU%d", c->ifp->if_xname, c->ix, tc, cpu_id); + cpu_id = rss_getcpu(c->ix % rss_getnumbuckets()); + CPU_SETOF(cpu_id, &cpu_mask); + taskqueue_start_threads_cpuset(&sq->sq_tq, 1, PI_NET, &cpu_mask, + "%s TX SQ%d.%d CPU%d", c->ifp->if_xname, c->ix, tc, cpu_id); #else - taskqueue_start_threads(&sq->sq_tq, 1, PI_NET, - "%s TX SQ%d.%d", c->ifp->if_xname, c->ix, tc); + taskqueue_start_threads(&sq->sq_tq, 1, PI_NET, + "%s TX SQ%d.%d", c->ifp->if_xname, c->ix, tc); #endif + } snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); mlx5e_create_stats(&sq->stats.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), buffer, mlx5e_sq_stats_desc, MLX5E_SQ_STATS_NUM, @@ -1068,9 +1072,12 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq) mlx5e_free_sq_db(sq); mlx5_wq_destroy(&sq->wq_ctrl); mlx5_unmap_free_uar(sq->priv->mdev, &sq->uar); - taskqueue_drain(sq->sq_tq, &sq->sq_task); - taskqueue_free(sq->sq_tq); - buf_ring_free(sq->br, M_MLX5EN); + if (sq->sq_tq != NULL) { + taskqueue_drain(sq->sq_tq, &sq->sq_task); + taskqueue_free(sq->sq_tq); + } + if (sq->br != NULL) + buf_ring_free(sq->br, M_MLX5EN); } int @@ -1518,9 +1525,10 @@ mlx5e_chan_mtx_init(struct mlx5e_channel *c) for (tc = 0; tc < c->num_tc; tc++) { struct mlx5e_sq *sq = c->sq + tc; - mtx_init(&sq->lock, "mlx5tx", MTX_NETWORK_LOCK, MTX_DEF); - mtx_init(&sq->comp_lock, "mlx5comp", MTX_NETWORK_LOCK, - MTX_DEF); + mtx_init(&sq->lock, "mlx5tx", + MTX_NETWORK_LOCK " TX", MTX_DEF); + mtx_init(&sq->comp_lock, "mlx5comp", + MTX_NETWORK_LOCK " TX", MTX_DEF); callout_init_mtx(&sq->cev_callout, &sq->lock, 0); Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 14:03:48 2017 (r321999) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Aug 3 14:05:03 2017 (r322000) @@ -439,7 +439,8 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget) sq->cc = sqcc; - if (atomic_cmpset_int(&sq->queue_state, MLX5E_SQ_FULL, MLX5E_SQ_READY)) + if (sq->sq_tq != NULL && + atomic_cmpset_int(&sq->queue_state, MLX5E_SQ_FULL, MLX5E_SQ_READY)) taskqueue_enqueue(sq->sq_tq, &sq->sq_task); } @@ -498,6 +499,45 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq * return (err); } +static int +mlx5e_xmit_locked_no_br(struct ifnet *ifp, struct mlx5e_sq *sq, struct mbuf *mb) +{ + int err = 0; + + if (unlikely((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + sq->stopped != 0)) { + m_freem(mb); + return (ENETDOWN); + } + + /* Do transmit */ + if (mlx5e_sq_xmit(sq, &mb) != 0) { + /* NOTE: m_freem() is NULL safe */ + m_freem(mb); + err = ENOBUFS; + } + + /* Check if we need to write the doorbell */ + if (likely(sq->doorbell.d64 != 0)) { + mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0); + sq->doorbell.d64 = 0; + } + + /* + * Check if we need to start the event timer which flushes the + * transmit ring on timeout: + */ + if (unlikely(sq->cev_next_state == MLX5E_CEV_STATE_INITIAL && + sq->cev_factor != 1)) { + /* start the timer */ + mlx5e_sq_cev_timeout(sq); + } else { + /* don't send NOPs yet */ + sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS; + } + return (err); +} + int mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) { @@ -510,7 +550,13 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) m_freem(mb); return (ENXIO); } - if (mtx_trylock(&sq->lock)) { + + if (unlikely(sq->br == NULL)) { + /* rate limited traffic */ + mtx_lock(&sq->lock); + ret = mlx5e_xmit_locked_no_br(ifp, sq, mb); + mtx_unlock(&sq->lock); + } else if (mtx_trylock(&sq->lock)) { ret = mlx5e_xmit_locked(ifp, sq, mb); mtx_unlock(&sq->lock); } else { From owner-svn-src-stable@freebsd.org Thu Aug 3 14:06:23 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE9EFDBECD1; Thu, 3 Aug 2017 14:06:23 +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 7B4DA7DCA8; Thu, 3 Aug 2017 14:06:23 +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 v73E6MSF054578; Thu, 3 Aug 2017 14:06:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E6MVu054577; Thu, 3 Aug 2017 14:06:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031406.v73E6MVu054577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:06: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: r322001 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:06:23 -0000 Author: hselasky Date: Thu Aug 3 14:06:22 2017 New Revision: 322001 URL: https://svnweb.freebsd.org/changeset/base/322001 Log: MFC r312537: Remove superfluous return statement. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:05:03 2017 (r322000) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:06:22 2017 (r322001) @@ -1205,7 +1205,6 @@ done: mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0); sq->doorbell.d64 = 0; } - return; } void From owner-svn-src-stable@freebsd.org Thu Aug 3 14:07:15 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71CC1DBED97; Thu, 3 Aug 2017 14:07:15 +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 405537DDEC; Thu, 3 Aug 2017 14:07:15 +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 v73E7Eob054669; Thu, 3 Aug 2017 14:07:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E7EV2054668; Thu, 3 Aug 2017 14:07:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031407.v73E7EV2054668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:07:14 +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: r322002 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:07:15 -0000 Author: hselasky Date: Thu Aug 3 14:07:14 2017 New Revision: 322002 URL: https://svnweb.freebsd.org/changeset/base/322002 Log: MFC r312537: Remove superfluous return statement. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:06:22 2017 (r322001) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:07:14 2017 (r322002) @@ -1212,7 +1212,6 @@ done: mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0); sq->doorbell.d64 = 0; } - return; } void From owner-svn-src-stable@freebsd.org Thu Aug 3 14:08:39 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C53ADBEEE1; Thu, 3 Aug 2017 14:08:39 +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 D9BB27DF60; Thu, 3 Aug 2017 14:08:38 +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 v73E8c19054771; Thu, 3 Aug 2017 14:08:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E8ccr054770; Thu, 3 Aug 2017 14:08:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031408.v73E8ccr054770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322003 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:08:39 -0000 Author: hselasky Date: Thu Aug 3 14:08:37 2017 New Revision: 322003 URL: https://svnweb.freebsd.org/changeset/base/322003 Log: MFC r312865: Enforce reading the consumer and producer counters once to ensure consistent return values from the mlx5e_sq_has_room_for() function. The two counters are incremented by different threads under different locks. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:07:14 2017 (r322002) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:08:37 2017 (r322003) @@ -546,8 +546,10 @@ struct mlx5e_sq { static inline bool mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n) { - return ((sq->wq.sz_m1 & (sq->cc - sq->pc)) >= n || - sq->cc == sq->pc); + u16 cc = sq->cc; + u16 pc = sq->pc; + + return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc); } struct mlx5e_channel { From owner-svn-src-stable@freebsd.org Thu Aug 3 14:09:37 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C167ADBEFD1; Thu, 3 Aug 2017 14:09:37 +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 8DCAD7E176; Thu, 3 Aug 2017 14:09:37 +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 v73E9aOL054905; Thu, 3 Aug 2017 14:09:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73E9aWR054904; Thu, 3 Aug 2017 14:09:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031409.v73E9aWR054904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:09:36 +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: r322005 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 322005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:09:37 -0000 Author: hselasky Date: Thu Aug 3 14:09:36 2017 New Revision: 322005 URL: https://svnweb.freebsd.org/changeset/base/322005 Log: MFC r312865: Enforce reading the consumer and producer counters once to ensure consistent return values from the mlx5e_sq_has_room_for() function. The two counters are incremented by different threads under different locks. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:08:39 2017 (r322004) +++ stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:09:36 2017 (r322005) @@ -556,8 +556,10 @@ struct mlx5e_sq { static inline bool mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n) { - return ((sq->wq.sz_m1 & (sq->cc - sq->pc)) >= n || - sq->cc == sq->pc); + u16 cc = sq->cc; + u16 pc = sq->pc; + + return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc); } struct mlx5e_channel { From owner-svn-src-stable@freebsd.org Thu Aug 3 14:12:24 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C54A4DBF2E9; Thu, 3 Aug 2017 14:12:24 +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 8F9437E589; Thu, 3 Aug 2017 14:12:24 +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 v73ECN01058829; Thu, 3 Aug 2017 14:12:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73ECNA9058822; Thu, 3 Aug 2017 14:12:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031412.v73ECNA9058822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:12: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: r322006 - in stable/11/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Commit-Revision: 322006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:12:24 -0000 Author: hselasky Date: Thu Aug 3 14:12:23 2017 New Revision: 322006 URL: https://svnweb.freebsd.org/changeset/base/322006 Log: MFC r312872: Add support for reading advanced diagnostic counters. By default reading the diagnostic counters is disabled. The firmware decides which counters are supported and only those supported show up in the dev.mce.X.diagnostics sysctl tree. To enable reading of diagnostic counters set one or more of the following sysctls to one: dev.mce.X.conf.diag_general_enable=1 dev.mce.X.conf.diag_pci_enable=1 Sponsored by: Mellanox Technologies Added: stable/11/sys/dev/mlx5/diagnostics.h - copied unchanged from r312872, head/sys/dev/mlx5/diagnostics.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c - copied unchanged from r312872, head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Modified: stable/11/sys/conf/files stable/11/sys/dev/mlx5/mlx5_en/en.h stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/11/sys/modules/mlx5/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu Aug 3 14:09:36 2017 (r322005) +++ stable/11/sys/conf/files Thu Aug 3 14:12:23 2017 (r322006) @@ -4288,6 +4288,8 @@ dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_diagnostics.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_flow_table.c optional mlx5 pci \ Copied: stable/11/sys/dev/mlx5/diagnostics.h (from r312872, head/sys/dev/mlx5/diagnostics.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mlx5/diagnostics.h Thu Aug 3 14:12:23 2017 (r322006, copy of r312872, head/sys/dev/mlx5/diagnostics.h) @@ -0,0 +1,138 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef MLX5_CORE_DIAGNOSTICS_H +#define MLX5_CORE_DIAGNOSTICS_H + +#define MLX5_CORE_DIAGNOSTICS_NUM(n, s, t) n +#define MLX5_CORE_DIAGNOSTICS_STRUCT(n, s, t) s, +#define MLX5_CORE_DIAGNOSTICS_ENTRY(n, s, t) { #s, (t) }, + +struct mlx5_core_diagnostics_entry { + const char *const desc; + u16 counter_id; +}; + +#define MLX5_CORE_PCI_DIAGNOSTICS(m) \ +m(+1, pxd_ready_bp, 0x0401) \ +m(+1, pci_write_bp, 0x0402) \ +m(+1, pci_read_bp, 0x0403) \ +m(+1, pci_read_stuck_no_completion_buffer, 0x0404) \ +m(+1, max_pci_bw, 0x0405) \ +m(+1, used_pci_bw, 0x0406) \ +m(+1, rx_pci_errors, 0) \ +m(+1, tx_pci_errors, 0) \ +m(+1, tx_pci_correctable_errors, 0) \ +m(+1, tx_pci_non_fatal_errors, 0) \ +m(+1, tx_pci_fatal_errors, 0) + +#define MLX5_CORE_PCI_DIAGNOSTICS_NUM \ + (0 MLX5_CORE_PCI_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_NUM)) + +union mlx5_core_pci_diagnostics { + u64 array[MLX5_CORE_PCI_DIAGNOSTICS_NUM]; + struct { + u64 MLX5_CORE_PCI_DIAGNOSTICS( + MLX5_CORE_DIAGNOSTICS_STRUCT) dummy[0]; + } counter; +}; + +extern const struct mlx5_core_diagnostics_entry + mlx5_core_pci_diagnostics_table[MLX5_CORE_PCI_DIAGNOSTICS_NUM]; + +#define MLX5_CORE_GENERAL_DIAGNOSTICS(m) \ +m(+1, l0_mtt_miss, 0x0801) \ +m(+1, l0_mtt_hit, 0x0802) \ +m(+1, l1_mtt_miss, 0x0803) \ +m(+1, l1_mtt_hit, 0x0804) \ +m(+1, l0_mpt_miss, 0x0805) \ +m(+1, l0_mpt_hit, 0x0806) \ +m(+1, l1_mpt_miss, 0x0807) \ +m(+1, l1_mpt_hit, 0x0808) \ +m(+1, rxb_no_slow_path_credits, 0x0c01) \ +m(+1, rxb_no_fast_path_credits, 0x0c02) \ +m(+1, rxb_rxt_no_slow_path_cred_perf_count, 0x0c03) \ +m(+1, rxb_rxt_no_fast_path_cred_perf_count, 0x0c04) \ +m(+1, rxt_ctrl_perf_slice_load_slow, 0x1001) \ +m(+1, rxt_ctrl_perf_slice_load_fast, 0x1002) \ +m(+1, rxt_steering_perf_count_steering0_rse_work_rate, 0x1003) \ +m(+1, rxt_steering_perf_count_steering1_rse_work_rate, 0x1004) \ +m(+1, perf_count_tpt_credit, 0x1401) \ +m(+1, perf_wb_miss, 0x1402) \ +m(+1, perf_wb_hit, 0x1403) \ +m(+1, rxw_perf_rx_l1_slow_miss_ldb, 0x1404) \ +m(+1, rxw_perf_rx_l1_slow_hit_ldb, 0x1405) \ +m(+1, rxw_perf_rx_l1_fast_miss_ldb, 0x1406) \ +m(+1, rxw_perf_rx_l1_fast_hit_ldb, 0x1407) \ +m(+1, rxw_perf_l2_cache_read_miss_ldb, 0x1408) \ +m(+1, rxw_perf_l2_cache_read_hit_ldb, 0x1409) \ +m(+1, rxw_perf_rx_l1_slow_miss_reqsl, 0x140a) \ +m(+1, rxw_perf_rx_l1_slow_hit_reqsl, 0x140b) \ +m(+1, rxw_perf_rx_l1_fast_miss_reqsl, 0x140c) \ +m(+1, rxw_perf_rx_l1_fast_hit_reqsl, 0x140d) \ +m(+1, rxw_perf_l2_cache_read_miss_reqsl, 0x140e) \ +m(+1, rxw_perf_l2_cache_read_hit_reqsl, 0x140f) \ +m(+1, rxs_no_pxt_credits, 0x1801) \ +m(+1, rxc_eq_all_slices_busy, 0x1c01) \ +m(+1, rxc_cq_all_slices_busy, 0x1c02) \ +m(+1, rxc_msix_all_slices_busy, 0x1c03) \ +m(+1, sxw_qp_done_due_to_vl_limited, 0x2001) \ +m(+1, sxw_qp_done_due_to_desched, 0x2002) \ +m(+1, sxw_qp_done_due_to_work_done, 0x2003) \ +m(+1, sxw_qp_done_due_to_limited, 0x2004) \ +m(+1, sxw_qp_done_due_to_e2e_credits, 0x2005) \ +m(+1, sxw_packet_send_sxw2sxp_go_vld, 0x2006) \ +m(+1, sxw_perf_count_steering_hit, 0x2007) \ +m(+1, sxw_perf_count_steering_miss, 0x2008) \ +m(+1, sxw_perf_count_steering_rse_0, 0x2009) \ +m(+1, sxd_no_sched_credits, 0x2401) \ +m(+1, sxd_no_slow_path_sched_credits, 0x2402) \ +m(+1, tpt_indirect_mem_key, 0x2801) + +#define MLX5_CORE_GENERAL_DIAGNOSTICS_NUM \ + (0 MLX5_CORE_GENERAL_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_NUM)) + +union mlx5_core_general_diagnostics { + u64 array[MLX5_CORE_GENERAL_DIAGNOSTICS_NUM]; + struct { + u64 MLX5_CORE_GENERAL_DIAGNOSTICS( + MLX5_CORE_DIAGNOSTICS_STRUCT) dummy[0]; + } counter; +}; + +extern const struct mlx5_core_diagnostics_entry + mlx5_core_general_diagnostics_table[MLX5_CORE_GENERAL_DIAGNOSTICS_NUM]; + +/* function prototypes */ +int mlx5_core_set_diagnostics_full(struct mlx5_core_dev *mdev, + u8 enable_pci, u8 enable_general); +int mlx5_core_get_diagnostics_full(struct mlx5_core_dev *mdev, + union mlx5_core_pci_diagnostics *ppci, + union mlx5_core_general_diagnostics *pgen); +int mlx5_core_supports_diagnostics(struct mlx5_core_dev *mdev, u16 counter_id); + +#endif /* MLX5_CORE_DIAGNOSTICS_H */ Copied: stable/11/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c (from r312872, head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Thu Aug 3 14:12:23 2017 (r322006, copy of r312872, head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c) @@ -0,0 +1,286 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +const struct mlx5_core_diagnostics_entry + mlx5_core_pci_diagnostics_table[ + MLX5_CORE_PCI_DIAGNOSTICS_NUM] = { + MLX5_CORE_PCI_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_ENTRY) +}; + +const struct mlx5_core_diagnostics_entry + mlx5_core_general_diagnostics_table[ + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM] = { + MLX5_CORE_GENERAL_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_ENTRY) +}; + +static int mlx5_core_get_index_of_diag_counter( + const struct mlx5_core_diagnostics_entry *entry, + int size, u16 counter_id) +{ + int x; + + /* check for invalid counter ID */ + if (counter_id == 0) + return -1; + + /* lookup counter ID in table */ + for (x = 0; x != size; x++) { + if (entry[x].counter_id == counter_id) + return x; + } + return -1; +} + +static void mlx5_core_put_diag_counter( + const struct mlx5_core_diagnostics_entry *entry, + u64 *array, int size, u16 counter_id, u64 value) +{ + int x; + + /* check for invalid counter ID */ + if (counter_id == 0) + return; + + /* lookup counter ID in table */ + for (x = 0; x != size; x++) { + if (entry[x].counter_id == counter_id) { + array[x] = value; + break; + } + } +} + +int mlx5_core_set_diagnostics_full(struct mlx5_core_dev *dev, + u8 enable_pci, u8 enable_general) +{ + void *diag_params_ctx; + void *in; + int numcounters; + int inlen; + int err; + int x; + int y; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + if (numcounters == 0) + return 0; + + inlen = MLX5_ST_SZ_BYTES(set_diagnostic_params_in) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * numcounters; + in = mlx5_vzalloc(inlen); + if (in == NULL) + return -ENOMEM; + + diag_params_ctx = MLX5_ADDR_OF(set_diagnostic_params_in, in, + diagnostic_params_ctx); + + MLX5_SET(diagnostic_params_context, diag_params_ctx, + enable, enable_pci || enable_general); + MLX5_SET(diagnostic_params_context, diag_params_ctx, + single, 1); + MLX5_SET(diagnostic_params_context, diag_params_ctx, + on_demand, 1); + + /* collect the counters we want to enable */ + for (x = y = 0; x != numcounters; x++) { + u16 counter_id = + MLX5_CAP_DEBUG(dev, diagnostic_counter[x].counter_id); + int index = -1; + + if (index < 0 && enable_pci != 0) { + /* check if counter ID exists in local table */ + index = mlx5_core_get_index_of_diag_counter( + mlx5_core_pci_diagnostics_table, + MLX5_CORE_PCI_DIAGNOSTICS_NUM, + counter_id); + } + if (index < 0 && enable_general != 0) { + /* check if counter ID exists in local table */ + index = mlx5_core_get_index_of_diag_counter( + mlx5_core_general_diagnostics_table, + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM, + counter_id); + } + if (index < 0) + continue; + + MLX5_SET(diagnostic_params_context, + diag_params_ctx, + counter_id[y].counter_id, + counter_id); + y++; + } + + /* recompute input length */ + inlen = MLX5_ST_SZ_BYTES(set_diagnostic_params_in) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * y; + + /* set number of counters */ + MLX5_SET(diagnostic_params_context, diag_params_ctx, + num_of_counters, y); + + /* execute firmware command */ + err = mlx5_set_diagnostic_params(dev, in, inlen); + + kvfree(in); + + return err; +} + +int mlx5_core_get_diagnostics_full(struct mlx5_core_dev *dev, + union mlx5_core_pci_diagnostics *pdiag, + union mlx5_core_general_diagnostics *pgen) +{ + void *out; + void *in; + int numcounters; + int outlen; + int inlen; + int err; + int x; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + if (numcounters == 0) + return 0; + + outlen = MLX5_ST_SZ_BYTES(query_diagnostic_counters_out) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * numcounters; + + out = mlx5_vzalloc(outlen); + if (out == NULL) + return -ENOMEM; + + err = mlx5_query_diagnostic_counters(dev, 1, 0, out, outlen); + if (err == 0) { + for (x = 0; x != numcounters; x++) { + u16 counter_id = MLX5_GET( + query_diagnostic_counters_out, + out, diag_counter[x].counter_id); + u64 counter_value = MLX5_GET64( + query_diagnostic_counters_out, + out, diag_counter[x].counter_value_h); + + if (pdiag != NULL) { + mlx5_core_put_diag_counter( + mlx5_core_pci_diagnostics_table, + pdiag->array, + MLX5_CORE_PCI_DIAGNOSTICS_NUM, + counter_id, counter_value); + } + if (pgen != NULL) { + mlx5_core_put_diag_counter( + mlx5_core_general_diagnostics_table, + pgen->array, + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM, + counter_id, counter_value); + } + } + } + kvfree(out); + + if (pdiag != NULL) { + inlen = MLX5_ST_SZ_BYTES(mpcnt_reg); + outlen = MLX5_ST_SZ_BYTES(mpcnt_reg); + + in = mlx5_vzalloc(inlen); + if (in == NULL) + return -ENOMEM; + + out = mlx5_vzalloc(outlen); + if (out == NULL) { + kvfree(in); + return -ENOMEM; + } + MLX5_SET(mpcnt_reg, in, grp, + MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP); + + err = mlx5_core_access_reg(dev, in, inlen, out, outlen, + MLX5_REG_MPCNT, 0, 0); + if (err == 0) { + void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, + counter_set.pcie_performance_counters_data_layout); + + pdiag->counter.rx_pci_errors = + MLX5_GET(pcie_performance_counters_data_layout, + pcounters, rx_errors); + pdiag->counter.tx_pci_errors = + MLX5_GET(pcie_performance_counters_data_layout, + pcounters, tx_errors); + } + MLX5_SET(mpcnt_reg, in, grp, + MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP); + + err = mlx5_core_access_reg(dev, in, inlen, out, outlen, + MLX5_REG_MPCNT, 0, 0); + if (err == 0) { + void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, + counter_set.pcie_timers_and_states_data_layout); + + pdiag->counter.tx_pci_non_fatal_errors = + MLX5_GET(pcie_timers_and_states_data_layout, + pcounters, non_fatal_err_msg_sent); + pdiag->counter.tx_pci_fatal_errors = + MLX5_GET(pcie_timers_and_states_data_layout, + pcounters, fatal_err_msg_sent); + } + kvfree(in); + kvfree(out); + } + return 0; +} + +int mlx5_core_supports_diagnostics(struct mlx5_core_dev *dev, u16 counter_id) +{ + int numcounters; + int x; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + /* check for any counter */ + if (counter_id == 0) + return 1; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + + /* check if counter ID exists in debug capability */ + for (x = 0; x != numcounters; x++) { + if (MLX5_CAP_DEBUG(dev, diagnostic_counter[x].counter_id) == + counter_id) + return 1; + } + return 0; /* not supported counter */ +} Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:09:36 2017 (r322005) +++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:12:23 2017 (r322006) @@ -63,6 +63,7 @@ #include #include #include +#include #include #include @@ -406,7 +407,9 @@ struct mlx5e_params { m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ - m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") + m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") \ + m(+1, u64 diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \ + m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) @@ -660,6 +663,8 @@ struct mlx5e_priv { struct mlx5e_params params; struct mlx5e_params_ethtool params_ethtool; + union mlx5_core_pci_diagnostics params_pci; + union mlx5_core_general_diagnostics params_general; struct mtx async_events_mtx; /* sync hw events */ struct work_struct update_stats_work; struct work_struct update_carrier_work; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:09:36 2017 (r322005) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:12:23 2017 (r322006) @@ -377,6 +377,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; + case MLX5_PARAM_OFFSET(diag_pci_enable): + priv->params_ethtool.diag_pci_enable = + priv->params_ethtool.diag_pci_enable ? 1 : 0; + + error = -mlx5_core_set_diagnostics_full(priv->mdev, + priv->params_ethtool.diag_pci_enable, + priv->params_ethtool.diag_general_enable); + break; + + case MLX5_PARAM_OFFSET(diag_general_enable): + priv->params_ethtool.diag_general_enable = + priv->params_ethtool.diag_general_enable ? 1 : 0; + + error = -mlx5_core_set_diagnostics_full(priv->mdev, + priv->params_ethtool.diag_pci_enable, + priv->params_ethtool.diag_general_enable); + break; + default: break; } @@ -624,6 +642,45 @@ mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) return (error); } +static void +mlx5e_create_diagnostics(struct mlx5e_priv *priv) +{ + struct mlx5_core_diagnostics_entry entry; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *node; + int x; + + /* sysctl context we are using */ + ctx = &priv->sysctl_ctx; + + /* create root node */ + node = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, + "diagnostics", CTLFLAG_RD, NULL, "Diagnostics"); + if (node == NULL) + return; + + /* create PCI diagnostics */ + for (x = 0; x != MLX5_CORE_PCI_DIAGNOSTICS_NUM; x++) { + entry = mlx5_core_pci_diagnostics_table[x]; + if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) + continue; + SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, + entry.desc, CTLFLAG_RD, priv->params_pci.array + x, + "PCI diagnostics counter"); + } + + /* create general diagnostics */ + for (x = 0; x != MLX5_CORE_GENERAL_DIAGNOSTICS_NUM; x++) { + entry = mlx5_core_general_diagnostics_table[x]; + if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) + continue; + SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, + entry.desc, CTLFLAG_RD, priv->params_general.array + x, + "General diagnostics counter"); + } +} + void mlx5e_create_ethtool(struct mlx5e_priv *priv) { @@ -705,4 +762,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, "eeprom_info", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, mlx5e_read_eeprom, "I", "EEPROM information"); + + /* Diagnostics support */ + mlx5e_create_diagnostics(priv); } Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:09:36 2017 (r322005) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:12:23 2017 (r322006) @@ -573,6 +573,16 @@ mlx5e_update_stats_work(struct work_struct *work) free_out: kvfree(out); + + /* Update diagnostics, if any */ + if (priv->params_ethtool.diag_pci_enable || + priv->params_ethtool.diag_general_enable) { + int error = mlx5_core_get_diagnostics_full(mdev, + priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL, + priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL); + if (error != 0) + if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error); + } PRIV_UNLOCK(priv); } Modified: stable/11/sys/modules/mlx5/Makefile ============================================================================== --- stable/11/sys/modules/mlx5/Makefile Thu Aug 3 14:09:36 2017 (r322005) +++ stable/11/sys/modules/mlx5/Makefile Thu Aug 3 14:12:23 2017 (r322006) @@ -6,6 +6,7 @@ SRCS= \ mlx5_alloc.c \ mlx5_cmd.c \ mlx5_cq.c \ +mlx5_diagnostics.c \ mlx5_eq.c \ mlx5_eswitch_vacl.c \ mlx5_flow_table.c \ From owner-svn-src-stable@freebsd.org Thu Aug 3 14:14:14 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E21EBDBF5AF; Thu, 3 Aug 2017 14:14:14 +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 A5BC87E726; Thu, 3 Aug 2017 14:14:14 +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 v73EEDea058946; Thu, 3 Aug 2017 14:14:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73EEDSt058939; Thu, 3 Aug 2017 14:14:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031414.v73EEDSt058939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:14:13 +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: r322007 - in stable/10/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Commit-Revision: 322007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:14:15 -0000 Author: hselasky Date: Thu Aug 3 14:14:13 2017 New Revision: 322007 URL: https://svnweb.freebsd.org/changeset/base/322007 Log: MFC r312872: Add support for reading advanced diagnostic counters. By default reading the diagnostic counters is disabled. The firmware decides which counters are supported and only those supported show up in the dev.mce.X.diagnostics sysctl tree. To enable reading of diagnostic counters set one or more of the following sysctls to one: dev.mce.X.conf.diag_general_enable=1 dev.mce.X.conf.diag_pci_enable=1 Sponsored by: Mellanox Technologies Added: stable/10/sys/dev/mlx5/diagnostics.h - copied unchanged from r312872, head/sys/dev/mlx5/diagnostics.h stable/10/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c - copied unchanged from r312872, head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Modified: stable/10/sys/conf/files stable/10/sys/dev/mlx5/mlx5_en/en.h stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/10/sys/modules/mlx5/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Aug 3 14:12:23 2017 (r322006) +++ stable/10/sys/conf/files Thu Aug 3 14:14:13 2017 (r322007) @@ -3939,6 +3939,8 @@ dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_diagnostics.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_flow_table.c optional mlx5 pci \ Copied: stable/10/sys/dev/mlx5/diagnostics.h (from r312872, head/sys/dev/mlx5/diagnostics.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/mlx5/diagnostics.h Thu Aug 3 14:14:13 2017 (r322007, copy of r312872, head/sys/dev/mlx5/diagnostics.h) @@ -0,0 +1,138 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef MLX5_CORE_DIAGNOSTICS_H +#define MLX5_CORE_DIAGNOSTICS_H + +#define MLX5_CORE_DIAGNOSTICS_NUM(n, s, t) n +#define MLX5_CORE_DIAGNOSTICS_STRUCT(n, s, t) s, +#define MLX5_CORE_DIAGNOSTICS_ENTRY(n, s, t) { #s, (t) }, + +struct mlx5_core_diagnostics_entry { + const char *const desc; + u16 counter_id; +}; + +#define MLX5_CORE_PCI_DIAGNOSTICS(m) \ +m(+1, pxd_ready_bp, 0x0401) \ +m(+1, pci_write_bp, 0x0402) \ +m(+1, pci_read_bp, 0x0403) \ +m(+1, pci_read_stuck_no_completion_buffer, 0x0404) \ +m(+1, max_pci_bw, 0x0405) \ +m(+1, used_pci_bw, 0x0406) \ +m(+1, rx_pci_errors, 0) \ +m(+1, tx_pci_errors, 0) \ +m(+1, tx_pci_correctable_errors, 0) \ +m(+1, tx_pci_non_fatal_errors, 0) \ +m(+1, tx_pci_fatal_errors, 0) + +#define MLX5_CORE_PCI_DIAGNOSTICS_NUM \ + (0 MLX5_CORE_PCI_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_NUM)) + +union mlx5_core_pci_diagnostics { + u64 array[MLX5_CORE_PCI_DIAGNOSTICS_NUM]; + struct { + u64 MLX5_CORE_PCI_DIAGNOSTICS( + MLX5_CORE_DIAGNOSTICS_STRUCT) dummy[0]; + } counter; +}; + +extern const struct mlx5_core_diagnostics_entry + mlx5_core_pci_diagnostics_table[MLX5_CORE_PCI_DIAGNOSTICS_NUM]; + +#define MLX5_CORE_GENERAL_DIAGNOSTICS(m) \ +m(+1, l0_mtt_miss, 0x0801) \ +m(+1, l0_mtt_hit, 0x0802) \ +m(+1, l1_mtt_miss, 0x0803) \ +m(+1, l1_mtt_hit, 0x0804) \ +m(+1, l0_mpt_miss, 0x0805) \ +m(+1, l0_mpt_hit, 0x0806) \ +m(+1, l1_mpt_miss, 0x0807) \ +m(+1, l1_mpt_hit, 0x0808) \ +m(+1, rxb_no_slow_path_credits, 0x0c01) \ +m(+1, rxb_no_fast_path_credits, 0x0c02) \ +m(+1, rxb_rxt_no_slow_path_cred_perf_count, 0x0c03) \ +m(+1, rxb_rxt_no_fast_path_cred_perf_count, 0x0c04) \ +m(+1, rxt_ctrl_perf_slice_load_slow, 0x1001) \ +m(+1, rxt_ctrl_perf_slice_load_fast, 0x1002) \ +m(+1, rxt_steering_perf_count_steering0_rse_work_rate, 0x1003) \ +m(+1, rxt_steering_perf_count_steering1_rse_work_rate, 0x1004) \ +m(+1, perf_count_tpt_credit, 0x1401) \ +m(+1, perf_wb_miss, 0x1402) \ +m(+1, perf_wb_hit, 0x1403) \ +m(+1, rxw_perf_rx_l1_slow_miss_ldb, 0x1404) \ +m(+1, rxw_perf_rx_l1_slow_hit_ldb, 0x1405) \ +m(+1, rxw_perf_rx_l1_fast_miss_ldb, 0x1406) \ +m(+1, rxw_perf_rx_l1_fast_hit_ldb, 0x1407) \ +m(+1, rxw_perf_l2_cache_read_miss_ldb, 0x1408) \ +m(+1, rxw_perf_l2_cache_read_hit_ldb, 0x1409) \ +m(+1, rxw_perf_rx_l1_slow_miss_reqsl, 0x140a) \ +m(+1, rxw_perf_rx_l1_slow_hit_reqsl, 0x140b) \ +m(+1, rxw_perf_rx_l1_fast_miss_reqsl, 0x140c) \ +m(+1, rxw_perf_rx_l1_fast_hit_reqsl, 0x140d) \ +m(+1, rxw_perf_l2_cache_read_miss_reqsl, 0x140e) \ +m(+1, rxw_perf_l2_cache_read_hit_reqsl, 0x140f) \ +m(+1, rxs_no_pxt_credits, 0x1801) \ +m(+1, rxc_eq_all_slices_busy, 0x1c01) \ +m(+1, rxc_cq_all_slices_busy, 0x1c02) \ +m(+1, rxc_msix_all_slices_busy, 0x1c03) \ +m(+1, sxw_qp_done_due_to_vl_limited, 0x2001) \ +m(+1, sxw_qp_done_due_to_desched, 0x2002) \ +m(+1, sxw_qp_done_due_to_work_done, 0x2003) \ +m(+1, sxw_qp_done_due_to_limited, 0x2004) \ +m(+1, sxw_qp_done_due_to_e2e_credits, 0x2005) \ +m(+1, sxw_packet_send_sxw2sxp_go_vld, 0x2006) \ +m(+1, sxw_perf_count_steering_hit, 0x2007) \ +m(+1, sxw_perf_count_steering_miss, 0x2008) \ +m(+1, sxw_perf_count_steering_rse_0, 0x2009) \ +m(+1, sxd_no_sched_credits, 0x2401) \ +m(+1, sxd_no_slow_path_sched_credits, 0x2402) \ +m(+1, tpt_indirect_mem_key, 0x2801) + +#define MLX5_CORE_GENERAL_DIAGNOSTICS_NUM \ + (0 MLX5_CORE_GENERAL_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_NUM)) + +union mlx5_core_general_diagnostics { + u64 array[MLX5_CORE_GENERAL_DIAGNOSTICS_NUM]; + struct { + u64 MLX5_CORE_GENERAL_DIAGNOSTICS( + MLX5_CORE_DIAGNOSTICS_STRUCT) dummy[0]; + } counter; +}; + +extern const struct mlx5_core_diagnostics_entry + mlx5_core_general_diagnostics_table[MLX5_CORE_GENERAL_DIAGNOSTICS_NUM]; + +/* function prototypes */ +int mlx5_core_set_diagnostics_full(struct mlx5_core_dev *mdev, + u8 enable_pci, u8 enable_general); +int mlx5_core_get_diagnostics_full(struct mlx5_core_dev *mdev, + union mlx5_core_pci_diagnostics *ppci, + union mlx5_core_general_diagnostics *pgen); +int mlx5_core_supports_diagnostics(struct mlx5_core_dev *mdev, u16 counter_id); + +#endif /* MLX5_CORE_DIAGNOSTICS_H */ Copied: stable/10/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c (from r312872, head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Thu Aug 3 14:14:13 2017 (r322007, copy of r312872, head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c) @@ -0,0 +1,286 @@ +/*- + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +const struct mlx5_core_diagnostics_entry + mlx5_core_pci_diagnostics_table[ + MLX5_CORE_PCI_DIAGNOSTICS_NUM] = { + MLX5_CORE_PCI_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_ENTRY) +}; + +const struct mlx5_core_diagnostics_entry + mlx5_core_general_diagnostics_table[ + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM] = { + MLX5_CORE_GENERAL_DIAGNOSTICS(MLX5_CORE_DIAGNOSTICS_ENTRY) +}; + +static int mlx5_core_get_index_of_diag_counter( + const struct mlx5_core_diagnostics_entry *entry, + int size, u16 counter_id) +{ + int x; + + /* check for invalid counter ID */ + if (counter_id == 0) + return -1; + + /* lookup counter ID in table */ + for (x = 0; x != size; x++) { + if (entry[x].counter_id == counter_id) + return x; + } + return -1; +} + +static void mlx5_core_put_diag_counter( + const struct mlx5_core_diagnostics_entry *entry, + u64 *array, int size, u16 counter_id, u64 value) +{ + int x; + + /* check for invalid counter ID */ + if (counter_id == 0) + return; + + /* lookup counter ID in table */ + for (x = 0; x != size; x++) { + if (entry[x].counter_id == counter_id) { + array[x] = value; + break; + } + } +} + +int mlx5_core_set_diagnostics_full(struct mlx5_core_dev *dev, + u8 enable_pci, u8 enable_general) +{ + void *diag_params_ctx; + void *in; + int numcounters; + int inlen; + int err; + int x; + int y; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + if (numcounters == 0) + return 0; + + inlen = MLX5_ST_SZ_BYTES(set_diagnostic_params_in) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * numcounters; + in = mlx5_vzalloc(inlen); + if (in == NULL) + return -ENOMEM; + + diag_params_ctx = MLX5_ADDR_OF(set_diagnostic_params_in, in, + diagnostic_params_ctx); + + MLX5_SET(diagnostic_params_context, diag_params_ctx, + enable, enable_pci || enable_general); + MLX5_SET(diagnostic_params_context, diag_params_ctx, + single, 1); + MLX5_SET(diagnostic_params_context, diag_params_ctx, + on_demand, 1); + + /* collect the counters we want to enable */ + for (x = y = 0; x != numcounters; x++) { + u16 counter_id = + MLX5_CAP_DEBUG(dev, diagnostic_counter[x].counter_id); + int index = -1; + + if (index < 0 && enable_pci != 0) { + /* check if counter ID exists in local table */ + index = mlx5_core_get_index_of_diag_counter( + mlx5_core_pci_diagnostics_table, + MLX5_CORE_PCI_DIAGNOSTICS_NUM, + counter_id); + } + if (index < 0 && enable_general != 0) { + /* check if counter ID exists in local table */ + index = mlx5_core_get_index_of_diag_counter( + mlx5_core_general_diagnostics_table, + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM, + counter_id); + } + if (index < 0) + continue; + + MLX5_SET(diagnostic_params_context, + diag_params_ctx, + counter_id[y].counter_id, + counter_id); + y++; + } + + /* recompute input length */ + inlen = MLX5_ST_SZ_BYTES(set_diagnostic_params_in) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * y; + + /* set number of counters */ + MLX5_SET(diagnostic_params_context, diag_params_ctx, + num_of_counters, y); + + /* execute firmware command */ + err = mlx5_set_diagnostic_params(dev, in, inlen); + + kvfree(in); + + return err; +} + +int mlx5_core_get_diagnostics_full(struct mlx5_core_dev *dev, + union mlx5_core_pci_diagnostics *pdiag, + union mlx5_core_general_diagnostics *pgen) +{ + void *out; + void *in; + int numcounters; + int outlen; + int inlen; + int err; + int x; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + if (numcounters == 0) + return 0; + + outlen = MLX5_ST_SZ_BYTES(query_diagnostic_counters_out) + + MLX5_ST_SZ_BYTES(diagnostic_counter) * numcounters; + + out = mlx5_vzalloc(outlen); + if (out == NULL) + return -ENOMEM; + + err = mlx5_query_diagnostic_counters(dev, 1, 0, out, outlen); + if (err == 0) { + for (x = 0; x != numcounters; x++) { + u16 counter_id = MLX5_GET( + query_diagnostic_counters_out, + out, diag_counter[x].counter_id); + u64 counter_value = MLX5_GET64( + query_diagnostic_counters_out, + out, diag_counter[x].counter_value_h); + + if (pdiag != NULL) { + mlx5_core_put_diag_counter( + mlx5_core_pci_diagnostics_table, + pdiag->array, + MLX5_CORE_PCI_DIAGNOSTICS_NUM, + counter_id, counter_value); + } + if (pgen != NULL) { + mlx5_core_put_diag_counter( + mlx5_core_general_diagnostics_table, + pgen->array, + MLX5_CORE_GENERAL_DIAGNOSTICS_NUM, + counter_id, counter_value); + } + } + } + kvfree(out); + + if (pdiag != NULL) { + inlen = MLX5_ST_SZ_BYTES(mpcnt_reg); + outlen = MLX5_ST_SZ_BYTES(mpcnt_reg); + + in = mlx5_vzalloc(inlen); + if (in == NULL) + return -ENOMEM; + + out = mlx5_vzalloc(outlen); + if (out == NULL) { + kvfree(in); + return -ENOMEM; + } + MLX5_SET(mpcnt_reg, in, grp, + MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP); + + err = mlx5_core_access_reg(dev, in, inlen, out, outlen, + MLX5_REG_MPCNT, 0, 0); + if (err == 0) { + void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, + counter_set.pcie_performance_counters_data_layout); + + pdiag->counter.rx_pci_errors = + MLX5_GET(pcie_performance_counters_data_layout, + pcounters, rx_errors); + pdiag->counter.tx_pci_errors = + MLX5_GET(pcie_performance_counters_data_layout, + pcounters, tx_errors); + } + MLX5_SET(mpcnt_reg, in, grp, + MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP); + + err = mlx5_core_access_reg(dev, in, inlen, out, outlen, + MLX5_REG_MPCNT, 0, 0); + if (err == 0) { + void *pcounters = MLX5_ADDR_OF(mpcnt_reg, out, + counter_set.pcie_timers_and_states_data_layout); + + pdiag->counter.tx_pci_non_fatal_errors = + MLX5_GET(pcie_timers_and_states_data_layout, + pcounters, non_fatal_err_msg_sent); + pdiag->counter.tx_pci_fatal_errors = + MLX5_GET(pcie_timers_and_states_data_layout, + pcounters, fatal_err_msg_sent); + } + kvfree(in); + kvfree(out); + } + return 0; +} + +int mlx5_core_supports_diagnostics(struct mlx5_core_dev *dev, u16 counter_id) +{ + int numcounters; + int x; + + if (MLX5_CAP_GEN(dev, debug) == 0) + return 0; + + /* check for any counter */ + if (counter_id == 0) + return 1; + + numcounters = MLX5_CAP_GEN(dev, num_of_diagnostic_counters); + + /* check if counter ID exists in debug capability */ + for (x = 0; x != numcounters; x++) { + if (MLX5_CAP_DEBUG(dev, diagnostic_counter[x].counter_id) == + counter_id) + return 1; + } + return 0; /* not supported counter */ +} Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:12:23 2017 (r322006) +++ stable/10/sys/dev/mlx5/mlx5_en/en.h Thu Aug 3 14:14:13 2017 (r322007) @@ -69,6 +69,7 @@ #include #include #include +#include #include #include @@ -412,7 +413,9 @@ struct mlx5e_params { m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ - m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") + m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled") \ + m(+1, u64 diag_pci_enable, "diag_pci_enable", "0: Disabled 1: Enabled") \ + m(+1, u64 diag_general_enable, "diag_general_enable", "0: Disabled 1: Enabled") #define MLX5E_PARAMS_NUM (0 MLX5E_PARAMS(MLX5E_STATS_COUNT)) @@ -670,6 +673,8 @@ struct mlx5e_priv { struct mlx5e_params params; struct mlx5e_params_ethtool params_ethtool; + union mlx5_core_pci_diagnostics params_pci; + union mlx5_core_general_diagnostics params_general; struct mtx async_events_mtx; /* sync hw events */ struct work_struct update_stats_work; struct work_struct update_carrier_work; Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:12:23 2017 (r322006) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 3 14:14:13 2017 (r322007) @@ -377,6 +377,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; + case MLX5_PARAM_OFFSET(diag_pci_enable): + priv->params_ethtool.diag_pci_enable = + priv->params_ethtool.diag_pci_enable ? 1 : 0; + + error = -mlx5_core_set_diagnostics_full(priv->mdev, + priv->params_ethtool.diag_pci_enable, + priv->params_ethtool.diag_general_enable); + break; + + case MLX5_PARAM_OFFSET(diag_general_enable): + priv->params_ethtool.diag_general_enable = + priv->params_ethtool.diag_general_enable ? 1 : 0; + + error = -mlx5_core_set_diagnostics_full(priv->mdev, + priv->params_ethtool.diag_pci_enable, + priv->params_ethtool.diag_general_enable); + break; + default: break; } @@ -624,6 +642,45 @@ mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) return (error); } +static void +mlx5e_create_diagnostics(struct mlx5e_priv *priv) +{ + struct mlx5_core_diagnostics_entry entry; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *node; + int x; + + /* sysctl context we are using */ + ctx = &priv->sysctl_ctx; + + /* create root node */ + node = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, + "diagnostics", CTLFLAG_RD, NULL, "Diagnostics"); + if (node == NULL) + return; + + /* create PCI diagnostics */ + for (x = 0; x != MLX5_CORE_PCI_DIAGNOSTICS_NUM; x++) { + entry = mlx5_core_pci_diagnostics_table[x]; + if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) + continue; + SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, + entry.desc, CTLFLAG_RD, priv->params_pci.array + x, + "PCI diagnostics counter"); + } + + /* create general diagnostics */ + for (x = 0; x != MLX5_CORE_GENERAL_DIAGNOSTICS_NUM; x++) { + entry = mlx5_core_general_diagnostics_table[x]; + if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) + continue; + SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, + entry.desc, CTLFLAG_RD, priv->params_general.array + x, + "General diagnostics counter"); + } +} + void mlx5e_create_ethtool(struct mlx5e_priv *priv) { @@ -705,4 +762,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, "eeprom_info", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, mlx5e_read_eeprom, "I", "EEPROM information"); + + /* Diagnostics support */ + mlx5e_create_diagnostics(priv); } Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:12:23 2017 (r322006) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 3 14:14:13 2017 (r322007) @@ -573,6 +573,16 @@ mlx5e_update_stats_work(struct work_struct *work) free_out: kvfree(out); + + /* Update diagnostics, if any */ + if (priv->params_ethtool.diag_pci_enable || + priv->params_ethtool.diag_general_enable) { + int error = mlx5_core_get_diagnostics_full(mdev, + priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL, + priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL); + if (error != 0) + if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error); + } PRIV_UNLOCK(priv); } Modified: stable/10/sys/modules/mlx5/Makefile ============================================================================== --- stable/10/sys/modules/mlx5/Makefile Thu Aug 3 14:12:23 2017 (r322006) +++ stable/10/sys/modules/mlx5/Makefile Thu Aug 3 14:14:13 2017 (r322007) @@ -6,6 +6,7 @@ SRCS= \ mlx5_alloc.c \ mlx5_cmd.c \ mlx5_cq.c \ +mlx5_diagnostics.c \ mlx5_eq.c \ mlx5_eswitch_vacl.c \ mlx5_flow_table.c \ From owner-svn-src-stable@freebsd.org Thu Aug 3 14:16:32 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7654DBF798; Thu, 3 Aug 2017 14:16:32 +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 C164D7E8D3; Thu, 3 Aug 2017 14:16:32 +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 v73EGVg7059098; Thu, 3 Aug 2017 14:16:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73EGVZd059096; Thu, 3 Aug 2017 14:16:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031416.v73EGVZd059096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:16: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: r322008 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:16:33 -0000 Author: hselasky Date: Thu Aug 3 14:16:31 2017 New Revision: 322008 URL: https://svnweb.freebsd.org/changeset/base/322008 Log: MFC r312876: Use ffs() to scan for first bit instead of using a for() loop. Minor code refactor while at it. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Thu Aug 3 14:14:13 2017 (r322007) +++ stable/11/sys/dev/mlx5/driver.h Thu Aug 3 14:16:31 2017 (r322008) @@ -859,7 +859,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu Aug 3 14:14:13 2017 (r322007) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu Aug 3 14:16:31 2017 (r322008) @@ -760,7 +760,7 @@ static void cmd_work_handler(struct work_struct *work) poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ rmb(); - mlx5_cmd_comp_handler(dev, 1UL << ent->idx); + mlx5_cmd_comp_handler(dev, 1U << ent->idx); } } @@ -1104,7 +1104,7 @@ static void free_msg(struct mlx5_core_dev *dev, struct } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector) { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; @@ -1112,60 +1112,63 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, void *context; int err; int i; + struct semaphore *sem; s64 ds; struct mlx5_cmd_stats *stats; unsigned long flags; - for (i = 0; i < (1 << cmd->log_sz); i++) { - if (test_bit(i, &vector)) { - struct semaphore *sem; - - ent = cmd->ent_arr[i]; - if (ent->page_queue) - sem = &cmd->pages_sem; + while (vector != 0) { + i = ffs(vector) - 1; + vector &= ~(1U << i); + ent = cmd->ent_arr[i]; + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; + ent->ts2 = ktime_get_ns(); + memcpy(ent->out->first.data, ent->lay->out, + sizeof(ent->lay->out)); + dump_command(dev, ent, 0); + if (!ent->ret) { + if (!cmd->checksum_disabled) + ent->ret = verify_signature(ent); else - sem = &cmd->sem; - ent->ts2 = ktime_get_ns(); - memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); - dump_command(dev, ent, 0); - if (!ent->ret) { - if (!cmd->checksum_disabled) - ent->ret = verify_signature(ent); - else - ent->ret = 0; - ent->status = ent->lay->status_own >> 1; - mlx5_core_dbg(dev, "command completed. ret 0x%x, delivery status %s(0x%x)\n", - ent->ret, deliv_status_to_str(ent->status), ent->status); + ent->ret = 0; + ent->status = ent->lay->status_own >> 1; + mlx5_core_dbg(dev, + "FW command ret 0x%x, status %s(0x%x)\n", + ent->ret, + deliv_status_to_str(ent->status), + ent->status); + } + free_ent(cmd, ent->idx); + if (ent->callback) { + ds = ent->ts2 - ent->ts1; + if (ent->op < ARRAY_SIZE(cmd->stats)) { + stats = &cmd->stats[ent->op]; + spin_lock_irqsave(&stats->lock, flags); + stats->sum += ds; + ++stats->n; + spin_unlock_irqrestore(&stats->lock, flags); } - free_ent(cmd, ent->idx); - if (ent->callback) { - ds = ent->ts2 - ent->ts1; - if (ent->op < ARRAY_SIZE(cmd->stats)) { - stats = &cmd->stats[ent->op]; - spin_lock_irqsave(&stats->lock, flags); - stats->sum += ds; - ++stats->n; - spin_unlock_irqrestore(&stats->lock, flags); - } - callback = ent->callback; - context = ent->context; - err = ent->ret; - if (!err) - err = mlx5_copy_from_msg(ent->uout, - ent->out, - ent->uout_size); + callback = ent->callback; + context = ent->context; + err = ent->ret; + if (!err) + err = mlx5_copy_from_msg(ent->uout, + ent->out, + ent->uout_size); - mlx5_free_cmd_msg(dev, ent->out); - free_msg(dev, ent->in); + mlx5_free_cmd_msg(dev, ent->out); + free_msg(dev, ent->in); - free_cmd(ent); - callback(err, context); - } else { - complete(&ent->done); - } - up(sem); + free_cmd(ent); + callback(err, context); + } else { + complete(&ent->done); } + up(sem); } } EXPORT_SYMBOL(mlx5_cmd_comp_handler); From owner-svn-src-stable@freebsd.org Thu Aug 3 14:17:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D13DDBF849; Thu, 3 Aug 2017 14:17:26 +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 795AE7EA10; Thu, 3 Aug 2017 14:17:26 +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 v73EHPX4059187; Thu, 3 Aug 2017 14:17:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73EHPmP059185; Thu, 3 Aug 2017 14:17:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031417.v73EHPmP059185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:17: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: r322009 - in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322009 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:17:26 -0000 Author: hselasky Date: Thu Aug 3 14:17:25 2017 New Revision: 322009 URL: https://svnweb.freebsd.org/changeset/base/322009 Log: MFC r312876: Use ffs() to scan for first bit instead of using a for() loop. Minor code refactor while at it. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/driver.h stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/driver.h ============================================================================== --- stable/10/sys/dev/mlx5/driver.h Thu Aug 3 14:16:31 2017 (r322008) +++ stable/10/sys/dev/mlx5/driver.h Thu Aug 3 14:17:25 2017 (r322009) @@ -859,7 +859,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu Aug 3 14:16:31 2017 (r322008) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu Aug 3 14:17:25 2017 (r322009) @@ -760,7 +760,7 @@ static void cmd_work_handler(struct work_struct *work) poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ rmb(); - mlx5_cmd_comp_handler(dev, 1UL << ent->idx); + mlx5_cmd_comp_handler(dev, 1U << ent->idx); } } @@ -1104,7 +1104,7 @@ static void free_msg(struct mlx5_core_dev *dev, struct } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector) { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; @@ -1112,60 +1112,63 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, void *context; int err; int i; + struct semaphore *sem; s64 ds; struct mlx5_cmd_stats *stats; unsigned long flags; - for (i = 0; i < (1 << cmd->log_sz); i++) { - if (test_bit(i, &vector)) { - struct semaphore *sem; - - ent = cmd->ent_arr[i]; - if (ent->page_queue) - sem = &cmd->pages_sem; + while (vector != 0) { + i = ffs(vector) - 1; + vector &= ~(1U << i); + ent = cmd->ent_arr[i]; + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; + ent->ts2 = ktime_get_ns(); + memcpy(ent->out->first.data, ent->lay->out, + sizeof(ent->lay->out)); + dump_command(dev, ent, 0); + if (!ent->ret) { + if (!cmd->checksum_disabled) + ent->ret = verify_signature(ent); else - sem = &cmd->sem; - ent->ts2 = ktime_get_ns(); - memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); - dump_command(dev, ent, 0); - if (!ent->ret) { - if (!cmd->checksum_disabled) - ent->ret = verify_signature(ent); - else - ent->ret = 0; - ent->status = ent->lay->status_own >> 1; - mlx5_core_dbg(dev, "command completed. ret 0x%x, delivery status %s(0x%x)\n", - ent->ret, deliv_status_to_str(ent->status), ent->status); + ent->ret = 0; + ent->status = ent->lay->status_own >> 1; + mlx5_core_dbg(dev, + "FW command ret 0x%x, status %s(0x%x)\n", + ent->ret, + deliv_status_to_str(ent->status), + ent->status); + } + free_ent(cmd, ent->idx); + if (ent->callback) { + ds = ent->ts2 - ent->ts1; + if (ent->op < ARRAY_SIZE(cmd->stats)) { + stats = &cmd->stats[ent->op]; + spin_lock_irqsave(&stats->lock, flags); + stats->sum += ds; + ++stats->n; + spin_unlock_irqrestore(&stats->lock, flags); } - free_ent(cmd, ent->idx); - if (ent->callback) { - ds = ent->ts2 - ent->ts1; - if (ent->op < ARRAY_SIZE(cmd->stats)) { - stats = &cmd->stats[ent->op]; - spin_lock_irqsave(&stats->lock, flags); - stats->sum += ds; - ++stats->n; - spin_unlock_irqrestore(&stats->lock, flags); - } - callback = ent->callback; - context = ent->context; - err = ent->ret; - if (!err) - err = mlx5_copy_from_msg(ent->uout, - ent->out, - ent->uout_size); + callback = ent->callback; + context = ent->context; + err = ent->ret; + if (!err) + err = mlx5_copy_from_msg(ent->uout, + ent->out, + ent->uout_size); - mlx5_free_cmd_msg(dev, ent->out); - free_msg(dev, ent->in); + mlx5_free_cmd_msg(dev, ent->out); + free_msg(dev, ent->in); - free_cmd(ent); - callback(err, context); - } else { - complete(&ent->done); - } - up(sem); + free_cmd(ent); + callback(err, context); + } else { + complete(&ent->done); } + up(sem); } } EXPORT_SYMBOL(mlx5_cmd_comp_handler); From owner-svn-src-stable@freebsd.org Thu Aug 3 14:19:28 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11C7EDBFA0A; Thu, 3 Aug 2017 14:19:28 +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 D1ED97EBDA; Thu, 3 Aug 2017 14:19:27 +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 v73EJRqA059308; Thu, 3 Aug 2017 14:19:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73EJR49059307; Thu, 3 Aug 2017 14:19:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031419.v73EJR49059307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:19: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: r322010 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 322010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:19:28 -0000 Author: hselasky Date: Thu Aug 3 14:19:26 2017 New Revision: 322010 URL: https://svnweb.freebsd.org/changeset/base/322010 Log: MFC r312983: Make "desc" pointer non-constant inside the mlx5_core_diagnostics_entry structure. This fixes compilation with amd64-xtoolchain-gcc. PR: 216588 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/diagnostics.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/diagnostics.h ============================================================================== --- stable/11/sys/dev/mlx5/diagnostics.h Thu Aug 3 14:17:25 2017 (r322009) +++ stable/11/sys/dev/mlx5/diagnostics.h Thu Aug 3 14:19:26 2017 (r322010) @@ -33,7 +33,7 @@ #define MLX5_CORE_DIAGNOSTICS_ENTRY(n, s, t) { #s, (t) }, struct mlx5_core_diagnostics_entry { - const char *const desc; + const char *desc; u16 counter_id; }; From owner-svn-src-stable@freebsd.org Thu Aug 3 14:20:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7FF2DBFB73; Thu, 3 Aug 2017 14:20:20 +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 732917ED9B; Thu, 3 Aug 2017 14:20:20 +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 v73EKJRr059439; Thu, 3 Aug 2017 14:20:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73EKJIV059438; Thu, 3 Aug 2017 14:20:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708031420.v73EKJIV059438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Aug 2017 14:20: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: r322011 - stable/10/sys/dev/mlx5 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5 X-SVN-Commit-Revision: 322011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:20:20 -0000 Author: hselasky Date: Thu Aug 3 14:20:19 2017 New Revision: 322011 URL: https://svnweb.freebsd.org/changeset/base/322011 Log: MFC r312983: Make "desc" pointer non-constant inside the mlx5_core_diagnostics_entry structure. This fixes compilation with amd64-xtoolchain-gcc. PR: 216588 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/diagnostics.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/diagnostics.h ============================================================================== --- stable/10/sys/dev/mlx5/diagnostics.h Thu Aug 3 14:19:26 2017 (r322010) +++ stable/10/sys/dev/mlx5/diagnostics.h Thu Aug 3 14:20:19 2017 (r322011) @@ -33,7 +33,7 @@ #define MLX5_CORE_DIAGNOSTICS_ENTRY(n, s, t) { #s, (t) }, struct mlx5_core_diagnostics_entry { - const char *const desc; + const char *desc; u16 counter_id; }; From owner-svn-src-stable@freebsd.org Thu Aug 3 14:22:49 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3403FDBFF7D; Thu, 3 Aug 2017 14:22:49 +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 F3DC17F23D; Thu, 3 Aug 2017 14:22:48 +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 v73EMmFN063088; Thu, 3 Aug 2017 14:22:48 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73EMmQ5063087; Thu, 3 Aug 2017 14:22:48 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708031422.v73EMmQ5063087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 3 Aug 2017 14:22: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: r322012 - in stable: 10/contrib/ipfilter 11/contrib/ipfilter X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/contrib/ipfilter 11/contrib/ipfilter X-SVN-Commit-Revision: 322012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:22:49 -0000 Author: cy Date: Thu Aug 3 14:22:48 2017 New Revision: 322012 URL: https://svnweb.freebsd.org/changeset/base/322012 Log: MFC r321605: As in r315225, discard 3072 bytes of RC4 bytestream instead of 1024. (This implementation of arc4rand(9) is used by the userland ipftest utility as it approximates ipfilter kernelspace in userspace.) PR: 217920 Submitted by: codarren@hackers.mu Reviewed by: emaste, cem Approved by: so (implicit, in r315225) Differential Revision: D11747 Patterned after: r315225 Modified: stable/11/contrib/ipfilter/arc4random.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/arc4random.c Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/ipfilter/arc4random.c ============================================================================== --- stable/11/contrib/ipfilter/arc4random.c Thu Aug 3 14:20:19 2017 (r322011) +++ stable/11/contrib/ipfilter/arc4random.c Thu Aug 3 14:22:48 2017 (r322012) @@ -109,9 +109,9 @@ arc4_randomstir (void) /* * Throw away the first N words of output, as suggested in the * paper "Weaknesses in the Key Scheduling Algorithm of RC4" - * by Fluher, Mantin, and Shamir. (N = 256 in our case.) + * by Fluher, Mantin, and Shamir. (N = 768 in our case.) */ - for (n = 0; n < 256*4; n++) + for (n = 0; n < 768*4; n++) arc4_randbyte(); MUTEX_EXIT(&arc4_mtx); } From owner-svn-src-stable@freebsd.org Thu Aug 3 14:22:49 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64C22DBFF81; Thu, 3 Aug 2017 14:22:49 +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 32D847F23E; Thu, 3 Aug 2017 14:22:49 +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 v73EMmI9063094; Thu, 3 Aug 2017 14:22:48 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v73EMmd5063093; Thu, 3 Aug 2017 14:22:48 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708031422.v73EMmd5063093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 3 Aug 2017 14:22:48 +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: r322012 - in stable: 10/contrib/ipfilter 11/contrib/ipfilter X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/contrib/ipfilter 11/contrib/ipfilter X-SVN-Commit-Revision: 322012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 14:22:49 -0000 Author: cy Date: Thu Aug 3 14:22:48 2017 New Revision: 322012 URL: https://svnweb.freebsd.org/changeset/base/322012 Log: MFC r321605: As in r315225, discard 3072 bytes of RC4 bytestream instead of 1024. (This implementation of arc4rand(9) is used by the userland ipftest utility as it approximates ipfilter kernelspace in userspace.) PR: 217920 Submitted by: codarren@hackers.mu Reviewed by: emaste, cem Approved by: so (implicit, in r315225) Differential Revision: D11747 Patterned after: r315225 Modified: stable/10/contrib/ipfilter/arc4random.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/arc4random.c Directory Properties: stable/11/ (props changed) Modified: stable/10/contrib/ipfilter/arc4random.c ============================================================================== --- stable/10/contrib/ipfilter/arc4random.c Thu Aug 3 14:20:19 2017 (r322011) +++ stable/10/contrib/ipfilter/arc4random.c Thu Aug 3 14:22:48 2017 (r322012) @@ -109,9 +109,9 @@ arc4_randomstir (void) /* * Throw away the first N words of output, as suggested in the * paper "Weaknesses in the Key Scheduling Algorithm of RC4" - * by Fluher, Mantin, and Shamir. (N = 256 in our case.) + * by Fluher, Mantin, and Shamir. (N = 768 in our case.) */ - for (n = 0; n < 256*4; n++) + for (n = 0; n < 768*4; n++) arc4_randbyte(); MUTEX_EXIT(&arc4_mtx); } From owner-svn-src-stable@freebsd.org Fri Aug 4 08:12:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC139DCC479; Fri, 4 Aug 2017 08:12:20 +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 AA02282EE3; Fri, 4 Aug 2017 08:12:20 +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 v748CJDE015961; Fri, 4 Aug 2017 08:12:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v748CJIZ015960; Fri, 4 Aug 2017 08:12:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708040812.v748CJIZ015960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Aug 2017 08:12: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: r322042 - stable/11/lib/libc/x86/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/x86/sys X-SVN-Commit-Revision: 322042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 08:12:21 -0000 Author: kib Date: Fri Aug 4 08:12:19 2017 New Revision: 322042 URL: https://svnweb.freebsd.org/changeset/base/322042 Log: MFC r321652: Simplify flow control. Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- stable/11/lib/libc/x86/sys/__vdso_gettc.c Fri Aug 4 04:23:23 2017 (r322041) +++ stable/11/lib/libc/x86/sys/__vdso_gettc.c Fri Aug 4 08:12:19 2017 (r322042) @@ -146,25 +146,24 @@ __vdso_init_hpet(uint32_t u) if (old_map != NULL) return; - if (cap_getmode(&mode) == 0 && mode != 0) - goto fail; + /* + * Explicitely check for the capability mode to avoid + * triggering trap_enocap on the device open by absolute path. + */ + if ((cap_getmode(&mode) == 0 && mode != 0) || + (fd = _open(devname, O_RDONLY)) == -1) { + /* Prevent the caller from re-entering. */ + atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], + (uintptr_t)old_map, (uintptr_t)MAP_FAILED); + return; + } - fd = _open(devname, O_RDONLY); - if (fd == -1) - goto fail; - new_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0); _close(fd); if (atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], (uintptr_t)old_map, (uintptr_t)new_map) == 0 && new_map != MAP_FAILED) munmap((void *)new_map, PAGE_SIZE); - - return; -fail: - /* Prevent the caller from re-entering. */ - atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u], - (uintptr_t)old_map, (uintptr_t)MAP_FAILED); } #ifdef WANT_HYPERV From owner-svn-src-stable@freebsd.org Fri Aug 4 08:16:06 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC1D5DCC6DC; Fri, 4 Aug 2017 08:16:06 +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 A82C7830CC; Fri, 4 Aug 2017 08:16:06 +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 v748G5s6016166; Fri, 4 Aug 2017 08:16:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v748G5iV016165; Fri, 4 Aug 2017 08:16:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708040816.v748G5iV016165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Aug 2017 08:16: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: r322043 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 322043 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 08:16:07 -0000 Author: kib Date: Fri Aug 4 08:16:05 2017 New Revision: 322043 URL: https://svnweb.freebsd.org/changeset/base/322043 Log: MFC r321347: Account for lock recursion when transfering snaplock to the vnode lock in ffs_snapremove(). Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:12:19 2017 (r322042) +++ stable/11/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:16:05 2017 (r322043) @@ -1607,7 +1607,7 @@ ffs_snapremove(vp) struct buf *ibp; struct fs *fs; ufs2_daddr_t numblks, blkno, dblk; - int error, loc, last; + int error, i, last, loc; struct snapdata *sn; ip = VTOI(vp); @@ -1627,10 +1627,14 @@ ffs_snapremove(vp) ip->i_nextsnap.tqe_prev = 0; VI_UNLOCK(devvp); lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); + for (i = 0; i < sn->sn_lock.lk_recurse; i++) + lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); KASSERT(vp->v_vnlock == &sn->sn_lock, ("ffs_snapremove: lost lock mutation")); vp->v_vnlock = &vp->v_lock; VI_LOCK(devvp); + while (sn->sn_lock.lk_recurse > 0) + lockmgr(&sn->sn_lock, LK_RELEASE, NULL); lockmgr(&sn->sn_lock, LK_RELEASE, NULL); try_free_snapdata(devvp); } else From owner-svn-src-stable@freebsd.org Fri Aug 4 08:18:18 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85870DCC86F; Fri, 4 Aug 2017 08:18:18 +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 548CC83267; Fri, 4 Aug 2017 08:18:18 +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 v748IHkQ016292; Fri, 4 Aug 2017 08:18:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v748IHN9016291; Fri, 4 Aug 2017 08:18:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708040818.v748IHN9016291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Aug 2017 08:18: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: r322044 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 322044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 08:18:18 -0000 Author: kib Date: Fri Aug 4 08:18:17 2017 New Revision: 322044 URL: https://svnweb.freebsd.org/changeset/base/322044 Log: MFC r321348: Unlock correct lock in ffs_snapblkfree(). Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:16:05 2017 (r322043) +++ stable/11/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:18:17 2017 (r322044) @@ -1944,7 +1944,7 @@ retry: */ if (error != 0 && wkhd != NULL) softdep_freework(wkhd); - lockmgr(vp->v_vnlock, LK_RELEASE, NULL); + lockmgr(&sn->sn_lock, LK_RELEASE, NULL); return (error); } From owner-svn-src-stable@freebsd.org Fri Aug 4 08:20:27 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92CD0DCCA5A; Fri, 4 Aug 2017 08:20:27 +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 619C0833E4; Fri, 4 Aug 2017 08:20:27 +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 v748KQiD016432; Fri, 4 Aug 2017 08:20:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v748KQCY016431; Fri, 4 Aug 2017 08:20:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708040820.v748KQCY016431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Aug 2017 08:20: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: r322045 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 322045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 08:20:27 -0000 Author: kib Date: Fri Aug 4 08:20:26 2017 New Revision: 322045 URL: https://svnweb.freebsd.org/changeset/base/322045 Log: MFC r321349: Improve publication of the newly allocated snapdata. Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:18:17 2017 (r322044) +++ stable/11/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:20:26 2017 (r322045) @@ -2647,8 +2647,8 @@ try_free_snapdata(struct vnode *devvp) static struct snapdata * ffs_snapdata_acquire(struct vnode *devvp) { - struct snapdata *nsn; - struct snapdata *sn; + struct snapdata *nsn, *sn; + int error; /* * Allocate a free snapdata. This is done before acquiring the @@ -2656,23 +2656,37 @@ ffs_snapdata_acquire(struct vnode *devvp) * held. */ nsn = ffs_snapdata_alloc(); - /* - * If there snapshots already exist on this filesystem grab a - * reference to the shared lock. Otherwise this is the first - * snapshot on this filesystem and we need to use our - * pre-allocated snapdata. - */ - VI_LOCK(devvp); - if (devvp->v_rdev->si_snapdata == NULL) { - devvp->v_rdev->si_snapdata = nsn; - nsn = NULL; + + for (;;) { + VI_LOCK(devvp); + sn = devvp->v_rdev->si_snapdata; + if (sn == NULL) { + /* + * This is the first snapshot on this + * filesystem and we use our pre-allocated + * snapdata. Publish sn with the sn_lock + * owned by us, to avoid the race. + */ + error = lockmgr(&nsn->sn_lock, LK_EXCLUSIVE | + LK_NOWAIT, NULL); + if (error != 0) + panic("leaked sn, lockmgr error %d", error); + sn = devvp->v_rdev->si_snapdata = nsn; + VI_UNLOCK(devvp); + nsn = NULL; + break; + } + + /* + * There is a snapshots which already exists on this + * filesystem, grab a reference to the common lock. + */ + error = lockmgr(&sn->sn_lock, LK_INTERLOCK | + LK_EXCLUSIVE | LK_SLEEPFAIL, VI_MTX(devvp)); + if (error == 0) + break; } - sn = devvp->v_rdev->si_snapdata; - /* - * Acquire the snapshot lock. - */ - lockmgr(&sn->sn_lock, - LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, VI_MTX(devvp)); + /* * Free any unused snapdata. */ From owner-svn-src-stable@freebsd.org Fri Aug 4 08:25:04 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C728DCCEA8; Fri, 4 Aug 2017 08:25:04 +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 43332837F2; Fri, 4 Aug 2017 08:25:04 +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 v748P3oL020262; Fri, 4 Aug 2017 08:25:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v748P3HP020261; Fri, 4 Aug 2017 08:25:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708040825.v748P3HP020261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Aug 2017 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: r322046 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/ufs/ffs X-SVN-Commit-Revision: 322046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 08:25:04 -0000 Author: kib Date: Fri Aug 4 08:25:03 2017 New Revision: 322046 URL: https://svnweb.freebsd.org/changeset/base/322046 Log: MFC r321347: Account for lock recursion when transfering snaplock to the vnode lock in ffs_snapremove(). Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:20:26 2017 (r322045) +++ stable/10/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:25:03 2017 (r322046) @@ -1607,7 +1607,7 @@ ffs_snapremove(vp) struct buf *ibp; struct fs *fs; ufs2_daddr_t numblks, blkno, dblk; - int error, loc, last; + int error, i, last, loc; struct snapdata *sn; ip = VTOI(vp); @@ -1627,10 +1627,14 @@ ffs_snapremove(vp) ip->i_nextsnap.tqe_prev = 0; VI_UNLOCK(devvp); lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); + for (i = 0; i < sn->sn_lock.lk_recurse; i++) + lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); KASSERT(vp->v_vnlock == &sn->sn_lock, ("ffs_snapremove: lost lock mutation")); vp->v_vnlock = &vp->v_lock; VI_LOCK(devvp); + while (sn->sn_lock.lk_recurse > 0) + lockmgr(&sn->sn_lock, LK_RELEASE, NULL); lockmgr(&sn->sn_lock, LK_RELEASE, NULL); try_free_snapdata(devvp); } else From owner-svn-src-stable@freebsd.org Fri Aug 4 08:26:20 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE962DCCFAD; Fri, 4 Aug 2017 08:26:20 +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 7C33E83950; Fri, 4 Aug 2017 08:26:20 +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 v748QJ66020356; Fri, 4 Aug 2017 08:26:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v748QJmk020355; Fri, 4 Aug 2017 08:26:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708040826.v748QJmk020355@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Aug 2017 08:26: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: r322047 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/ufs/ffs X-SVN-Commit-Revision: 322047 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 08:26:20 -0000 Author: kib Date: Fri Aug 4 08:26:19 2017 New Revision: 322047 URL: https://svnweb.freebsd.org/changeset/base/322047 Log: MFC r321348: Unlock correct lock in ffs_snapblkfree(). Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:25:03 2017 (r322046) +++ stable/10/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:26:19 2017 (r322047) @@ -1944,7 +1944,7 @@ retry: */ if (error != 0 && wkhd != NULL) softdep_freework(wkhd); - lockmgr(vp->v_vnlock, LK_RELEASE, NULL); + lockmgr(&sn->sn_lock, LK_RELEASE, NULL); return (error); } From owner-svn-src-stable@freebsd.org Fri Aug 4 08:27:35 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEACDDCD09C; Fri, 4 Aug 2017 08:27:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BC7D83A91; Fri, 4 Aug 2017 08:27:35 +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 v748RYiN020450; Fri, 4 Aug 2017 08:27:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v748RYQV020449; Fri, 4 Aug 2017 08:27:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708040827.v748RYQV020449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Aug 2017 08:27:34 +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: r322048 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/ufs/ffs X-SVN-Commit-Revision: 322048 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 08:27:35 -0000 Author: kib Date: Fri Aug 4 08:27:34 2017 New Revision: 322048 URL: https://svnweb.freebsd.org/changeset/base/322048 Log: MFC r321349: Improve publication of the newly allocated snapdata. Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:26:19 2017 (r322047) +++ stable/10/sys/ufs/ffs/ffs_snapshot.c Fri Aug 4 08:27:34 2017 (r322048) @@ -2643,8 +2643,8 @@ try_free_snapdata(struct vnode *devvp) static struct snapdata * ffs_snapdata_acquire(struct vnode *devvp) { - struct snapdata *nsn; - struct snapdata *sn; + struct snapdata *nsn, *sn; + int error; /* * Allocate a free snapdata. This is done before acquiring the @@ -2652,23 +2652,37 @@ ffs_snapdata_acquire(struct vnode *devvp) * held. */ nsn = ffs_snapdata_alloc(); - /* - * If there snapshots already exist on this filesystem grab a - * reference to the shared lock. Otherwise this is the first - * snapshot on this filesystem and we need to use our - * pre-allocated snapdata. - */ - VI_LOCK(devvp); - if (devvp->v_rdev->si_snapdata == NULL) { - devvp->v_rdev->si_snapdata = nsn; - nsn = NULL; + + for (;;) { + VI_LOCK(devvp); + sn = devvp->v_rdev->si_snapdata; + if (sn == NULL) { + /* + * This is the first snapshot on this + * filesystem and we use our pre-allocated + * snapdata. Publish sn with the sn_lock + * owned by us, to avoid the race. + */ + error = lockmgr(&nsn->sn_lock, LK_EXCLUSIVE | + LK_NOWAIT, NULL); + if (error != 0) + panic("leaked sn, lockmgr error %d", error); + sn = devvp->v_rdev->si_snapdata = nsn; + VI_UNLOCK(devvp); + nsn = NULL; + break; + } + + /* + * There is a snapshots which already exists on this + * filesystem, grab a reference to the common lock. + */ + error = lockmgr(&sn->sn_lock, LK_INTERLOCK | + LK_EXCLUSIVE | LK_SLEEPFAIL, VI_MTX(devvp)); + if (error == 0) + break; } - sn = devvp->v_rdev->si_snapdata; - /* - * Acquire the snapshot lock. - */ - lockmgr(&sn->sn_lock, - LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, VI_MTX(devvp)); + /* * Free any unused snapdata. */ From owner-svn-src-stable@freebsd.org Fri Aug 4 20:22:45 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F09DADC72F8; Fri, 4 Aug 2017 20:22: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 B9BB276E48; Fri, 4 Aug 2017 20:22: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 v74KMhlp017999; Fri, 4 Aug 2017 20:22:43 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v74KMhqe017997; Fri, 4 Aug 2017 20:22:43 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708042022.v74KMhqe017997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 4 Aug 2017 20:22: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: r322060 - stable/11/sys/net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/11/sys/net80211 X-SVN-Commit-Revision: 322060 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 20:22:45 -0000 Author: pfg Date: Fri Aug 4 20:22:43 2017 New Revision: 322060 URL: https://svnweb.freebsd.org/changeset/base/322060 Log: MFC r321838: sys/net8021: Add missing braces in setcurchan(). Also fix some indentation. Obtained from: DragonFlyBSD (git c69e37d6) Modified: stable/11/sys/net80211/ieee80211_ioctl.c stable/11/sys/net80211/ieee80211_mesh.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net80211/ieee80211_ioctl.c ============================================================================== --- stable/11/sys/net80211/ieee80211_ioctl.c Fri Aug 4 18:02:54 2017 (r322059) +++ stable/11/sys/net80211/ieee80211_ioctl.c Fri Aug 4 20:22:43 2017 (r322060) @@ -1964,9 +1964,10 @@ setcurchan(struct ieee80211vap *vap, struct ieee80211_ /* XXX need state machine for other vap's to follow */ ieee80211_setcurchan(ic, vap->iv_des_chan); vap->iv_bss->ni_chan = ic->ic_curchan; - } else + } else { ic->ic_curchan = vap->iv_des_chan; ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); + } } else { /* * Need to go through the state machine in case we Modified: stable/11/sys/net80211/ieee80211_mesh.c ============================================================================== --- stable/11/sys/net80211/ieee80211_mesh.c Fri Aug 4 18:02:54 2017 (r322059) +++ stable/11/sys/net80211/ieee80211_mesh.c Fri Aug 4 20:22:43 2017 (r322060) @@ -2630,7 +2630,7 @@ mesh_recv_action_meshgate(struct ieee80211_node *ni, /* popagate only if decremented ttl >= 1 && forwarding is enabled */ if ((ie.gann_ttl - 1) < 1 && !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) return 0; - pgann.gann_flags = ie.gann_flags; /* Reserved */ + pgann.gann_flags = ie.gann_flags; /* Reserved */ pgann.gann_hopcount = ie.gann_hopcount + 1; pgann.gann_ttl = ie.gann_ttl - 1; IEEE80211_ADDR_COPY(pgann.gann_addr, ie.gann_addr); From owner-svn-src-stable@freebsd.org Fri Aug 4 20:24:24 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74F64DC7421; Fri, 4 Aug 2017 20:24:24 +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 41EA276F94; Fri, 4 Aug 2017 20:24:24 +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 v74KONV3018118; Fri, 4 Aug 2017 20:24:23 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v74KON0t018115; Fri, 4 Aug 2017 20:24:23 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708042024.v74KON0t018115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 4 Aug 2017 20:24: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: r322061 - stable/10/sys/net80211 X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/sys/net80211 X-SVN-Commit-Revision: 322061 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 20:24:24 -0000 Author: pfg Date: Fri Aug 4 20:24:23 2017 New Revision: 322061 URL: https://svnweb.freebsd.org/changeset/base/322061 Log: MFC r321838: sys/net8021: Add missing braces in setcurchan(). Also fix some indentation. Obtained from: DragonFlyBSD (git c69e37d6) Modified: stable/10/sys/net80211/ieee80211_ioctl.c stable/10/sys/net80211/ieee80211_mesh.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net80211/ieee80211_ioctl.c ============================================================================== --- stable/10/sys/net80211/ieee80211_ioctl.c Fri Aug 4 20:22:43 2017 (r322060) +++ stable/10/sys/net80211/ieee80211_ioctl.c Fri Aug 4 20:24:23 2017 (r322061) @@ -1970,9 +1970,10 @@ setcurchan(struct ieee80211vap *vap, struct ieee80211_ /* XXX need state machine for other vap's to follow */ ieee80211_setcurchan(ic, vap->iv_des_chan); vap->iv_bss->ni_chan = ic->ic_curchan; - } else + } else { ic->ic_curchan = vap->iv_des_chan; ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); + } } else { /* * Need to go through the state machine in case we Modified: stable/10/sys/net80211/ieee80211_mesh.c ============================================================================== --- stable/10/sys/net80211/ieee80211_mesh.c Fri Aug 4 20:22:43 2017 (r322060) +++ stable/10/sys/net80211/ieee80211_mesh.c Fri Aug 4 20:24:23 2017 (r322061) @@ -2653,7 +2653,7 @@ mesh_recv_action_meshgate(struct ieee80211_node *ni, /* popagate only if decremented ttl >= 1 && forwarding is enabled */ if ((ie.gann_ttl - 1) < 1 && !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) return 0; - pgann.gann_flags = ie.gann_flags; /* Reserved */ + pgann.gann_flags = ie.gann_flags; /* Reserved */ pgann.gann_hopcount = ie.gann_hopcount + 1; pgann.gann_ttl = ie.gann_ttl - 1; IEEE80211_ADDR_COPY(pgann.gann_addr, ie.gann_addr); From owner-svn-src-stable@freebsd.org Fri Aug 4 21:38:35 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C333DCA42B; Fri, 4 Aug 2017 21:38:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B8147CFBA; Fri, 4 Aug 2017 21:38:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v74LcYpT046694; Fri, 4 Aug 2017 21:38:34 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v74LcYBd046693; Fri, 4 Aug 2017 21:38:34 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708042138.v74LcYBd046693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 4 Aug 2017 21:38:34 +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: r322063 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/amd64/amd64 X-SVN-Commit-Revision: 322063 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 21:38:35 -0000 Author: marius Date: Fri Aug 4 21:38:34 2017 New Revision: 322063 URL: https://svnweb.freebsd.org/changeset/base/322063 Log: MFC: r290156, r318354 pmap_change_attr: Only fixup DMAP for DMAPed ranges Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Fri Aug 4 21:06:47 2017 (r322062) +++ stable/10/sys/amd64/amd64/pmap.c Fri Aug 4 21:38:34 2017 (r322063) @@ -6559,7 +6559,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size */ for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); - if (*pdpe == 0) + if (pdpe == NULL || *pdpe == 0) return (EINVAL); if (*pdpe & PG_PS) { /* @@ -6632,7 +6632,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size X86_PG_PDE_CACHE); changed = TRUE; } - if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (tmpva >= VM_MIN_KERNEL_ADDRESS && + (*pdpe & PG_PS_FRAME) < dmaplimit) { if (pa_start == pa_end) { /* Start physical address run. */ pa_start = *pdpe & PG_PS_FRAME; @@ -6661,7 +6662,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size X86_PG_PDE_CACHE); changed = TRUE; } - if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (tmpva >= VM_MIN_KERNEL_ADDRESS && + (*pde & PG_PS_FRAME) < dmaplimit) { if (pa_start == pa_end) { /* Start physical address run. */ pa_start = *pde & PG_PS_FRAME; @@ -6688,7 +6690,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size X86_PG_PTE_CACHE); changed = TRUE; } - if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (tmpva >= VM_MIN_KERNEL_ADDRESS && + (*pte & PG_FRAME) < dmaplimit) { if (pa_start == pa_end) { /* Start physical address run. */ pa_start = *pte & PG_FRAME; From owner-svn-src-stable@freebsd.org Fri Aug 4 23:34:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D68EDCEE01; Fri, 4 Aug 2017 23:34:26 +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 51F6A80429; Fri, 4 Aug 2017 23:34:26 +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 v74NYPKk095333; Fri, 4 Aug 2017 23:34:25 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v74NYPgK095331; Fri, 4 Aug 2017 23:34:25 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201708042334.v74NYPgK095331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 4 Aug 2017 23:34: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: r322071 - stable/11/contrib/libarchive/libarchive X-SVN-Group: stable-11 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: stable/11/contrib/libarchive/libarchive X-SVN-Commit-Revision: 322071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 23:34:26 -0000 Author: mm Date: Fri Aug 4 23:34:25 2017 New Revision: 322071 URL: https://svnweb.freebsd.org/changeset/base/322071 Log: MFH r321674: Sync libarchive with vendor. Relevant vendor changes: PR #926: ensure ar strtab is null terminated PR: 220462 Modified: stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Aug 4 23:04:24 2017 (r322070) +++ stable/11/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Aug 4 23:34:25 2017 (r322071) @@ -64,7 +64,7 @@ typedef struct { } archive_crypto_ctx; #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) -#include +#include /* Common in other bcrypt implementations, but missing from VS2008. */ #ifndef BCRYPT_SUCCESS Modified: stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Aug 4 23:04:24 2017 (r322070) +++ stable/11/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Aug 4 23:34:25 2017 (r322071) @@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const v return (ARCHIVE_WARN); } - ar->strtab = (char *)malloc(s); + ar->strtab = (char *)malloc(s + 1); if (ar->strtab == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate strtab buffer"); return (ARCHIVE_FATAL); } - strncpy(ar->strtab, buff, s); + memcpy(ar->strtab, buff, s); + ar->strtab[s] = '\0'; ar->has_strtab = 1; } From owner-svn-src-stable@freebsd.org Fri Aug 4 23:34:41 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FD5DDCEE50; Fri, 4 Aug 2017 23:34:41 +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 1B009804E3; Fri, 4 Aug 2017 23:34:41 +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 v74NYewo095400; Fri, 4 Aug 2017 23:34:40 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v74NYeEV095398; Fri, 4 Aug 2017 23:34:40 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201708042334.v74NYeEV095398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 4 Aug 2017 23:34: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: r322072 - stable/10/contrib/libarchive/libarchive X-SVN-Group: stable-10 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: stable/10/contrib/libarchive/libarchive X-SVN-Commit-Revision: 322072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 23:34:41 -0000 Author: mm Date: Fri Aug 4 23:34:39 2017 New Revision: 322072 URL: https://svnweb.freebsd.org/changeset/base/322072 Log: MFH r321674: Sync libarchive with vendor. Relevant vendor changes: PR #926: ensure ar strtab is null terminated PR: 220462 Modified: stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Aug 4 23:34:25 2017 (r322071) +++ stable/10/contrib/libarchive/libarchive/archive_cryptor_private.h Fri Aug 4 23:34:39 2017 (r322072) @@ -64,7 +64,7 @@ typedef struct { } archive_crypto_ctx; #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) -#include +#include /* Common in other bcrypt implementations, but missing from VS2008. */ #ifndef BCRYPT_SUCCESS Modified: stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Aug 4 23:34:25 2017 (r322071) +++ stable/10/contrib/libarchive/libarchive/archive_write_set_format_ar.c Fri Aug 4 23:34:39 2017 (r322072) @@ -374,13 +374,14 @@ archive_write_ar_data(struct archive_write *a, const v return (ARCHIVE_WARN); } - ar->strtab = (char *)malloc(s); + ar->strtab = (char *)malloc(s + 1); if (ar->strtab == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate strtab buffer"); return (ARCHIVE_FATAL); } - strncpy(ar->strtab, buff, s); + memcpy(ar->strtab, buff, s); + ar->strtab[s] = '\0'; ar->has_strtab = 1; } From owner-svn-src-stable@freebsd.org Sat Aug 5 08:35:14 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD663DC648A; Sat, 5 Aug 2017 08:35: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 9BEF26B065; Sat, 5 Aug 2017 08:35:14 +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 v758ZD8J017579; Sat, 5 Aug 2017 08:35:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v758ZD6H017578; Sat, 5 Aug 2017 08:35:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708050835.v758ZD6H017578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 5 Aug 2017 08:35: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: r322078 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 322078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 08:35:14 -0000 Author: mav Date: Sat Aug 5 08:35:13 2017 New Revision: 322078 URL: https://svnweb.freebsd.org/changeset/base/322078 Log: MFC r321921: Add compat shim part missed at r305197. This fixes compatibility between old kernel and new ZFS tools. It seems to be tradition to forget it. PR: 221112 Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Sat Aug 5 07:52:15 2017 (r322077) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Sat Aug 5 08:35:13 2017 (r322078) @@ -74,6 +74,9 @@ zcmd_ioctl(int fd, int request, zfs_cmd_t *zc) if (zfs_ioctl_version >= ZFS_IOCVER_DEADMAN) { switch (zfs_ioctl_version) { + case ZFS_IOCVER_INLANES: + cflag = ZFS_CMD_COMPAT_INLANES; + break; case ZFS_IOCVER_RESUME: cflag = ZFS_CMD_COMPAT_RESUME; break; From owner-svn-src-stable@freebsd.org Sat Aug 5 08:36:05 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3287DC659B; Sat, 5 Aug 2017 08:36:05 +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 A17946B23F; Sat, 5 Aug 2017 08:36:05 +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 v758a4Xi017696; Sat, 5 Aug 2017 08:36:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v758a45b017695; Sat, 5 Aug 2017 08:36:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708050836.v758a45b017695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 5 Aug 2017 08:36: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: r322079 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-10 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/10/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 322079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 08:36:05 -0000 Author: mav Date: Sat Aug 5 08:36:04 2017 New Revision: 322079 URL: https://svnweb.freebsd.org/changeset/base/322079 Log: MFC r321921: Add compat shim part missed at r305197. This fixes compatibility between old kernel and new ZFS tools. It seems to be tradition to forget it. PR: 221112 Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Sat Aug 5 08:35:13 2017 (r322078) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c Sat Aug 5 08:36:04 2017 (r322079) @@ -74,6 +74,9 @@ zcmd_ioctl(int fd, int request, zfs_cmd_t *zc) if (zfs_ioctl_version >= ZFS_IOCVER_DEADMAN) { switch (zfs_ioctl_version) { + case ZFS_IOCVER_INLANES: + cflag = ZFS_CMD_COMPAT_INLANES; + break; case ZFS_IOCVER_RESUME: cflag = ZFS_CMD_COMPAT_RESUME; break; From owner-svn-src-stable@freebsd.org Sat Aug 5 08:37:10 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FD0BDC674A; Sat, 5 Aug 2017 08:37:10 +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 F2C276B442; Sat, 5 Aug 2017 08:37:09 +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 v758b9Z1017819; Sat, 5 Aug 2017 08:37:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v758b9oa017818; Sat, 5 Aug 2017 08:37:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708050837.v758b9oa017818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 5 Aug 2017 08:37: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: r322080 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 322080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 08:37:10 -0000 Author: mav Date: Sat Aug 5 08:37:08 2017 New Revision: 322080 URL: https://svnweb.freebsd.org/changeset/base/322080 Log: MFC r321685: Fix IORDY bits definition. According to the ATA specs, IORDYDIS should be bit 10, IORDY -- bit 11. PR: 221049 Submitted by: aaron.styx@baesystems.com Modified: stable/11/sys/sys/ata.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/ata.h ============================================================================== --- stable/11/sys/sys/ata.h Sat Aug 5 08:36:04 2017 (r322079) +++ stable/11/sys/sys/ata.h Sat Aug 5 08:37:08 2017 (r322080) @@ -68,8 +68,8 @@ struct ata_params { /*049*/ u_int16_t capabilities1; #define ATA_SUPPORT_DMA 0x0100 #define ATA_SUPPORT_LBA 0x0200 -#define ATA_SUPPORT_IORDY 0x0400 -#define ATA_SUPPORT_IORDYDIS 0x0800 +#define ATA_SUPPORT_IORDYDIS 0x0400 +#define ATA_SUPPORT_IORDY 0x0800 #define ATA_SUPPORT_OVERLAP 0x4000 /*050*/ u_int16_t capabilities2; From owner-svn-src-stable@freebsd.org Sat Aug 5 08:37:39 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE644DC67EA; Sat, 5 Aug 2017 08:37:39 +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 7DD0E6B576; Sat, 5 Aug 2017 08:37:39 +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 v758bcQe017903; Sat, 5 Aug 2017 08:37:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v758bc2Q017902; Sat, 5 Aug 2017 08:37:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708050837.v758bc2Q017902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 5 Aug 2017 08:37: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: r322081 - stable/10/sys/sys X-SVN-Group: stable-10 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/10/sys/sys X-SVN-Commit-Revision: 322081 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 08:37:39 -0000 Author: mav Date: Sat Aug 5 08:37:38 2017 New Revision: 322081 URL: https://svnweb.freebsd.org/changeset/base/322081 Log: MFC r321685: Fix IORDY bits definition. According to the ATA specs, IORDYDIS should be bit 10, IORDY -- bit 11. PR: 221049 Submitted by: aaron.styx@baesystems.com Modified: stable/10/sys/sys/ata.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/ata.h ============================================================================== --- stable/10/sys/sys/ata.h Sat Aug 5 08:37:08 2017 (r322080) +++ stable/10/sys/sys/ata.h Sat Aug 5 08:37:38 2017 (r322081) @@ -68,8 +68,8 @@ struct ata_params { /*049*/ u_int16_t capabilities1; #define ATA_SUPPORT_DMA 0x0100 #define ATA_SUPPORT_LBA 0x0200 -#define ATA_SUPPORT_IORDY 0x0400 -#define ATA_SUPPORT_IORDYDIS 0x0800 +#define ATA_SUPPORT_IORDYDIS 0x0400 +#define ATA_SUPPORT_IORDY 0x0800 #define ATA_SUPPORT_OVERLAP 0x4000 /*050*/ u_int16_t capabilities2; From owner-svn-src-stable@freebsd.org Sat Aug 5 09:32:04 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5545DC9627; Sat, 5 Aug 2017 09:32:04 +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 92C3B6D1F1; Sat, 5 Aug 2017 09:32:04 +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 v759W3Fe042001; Sat, 5 Aug 2017 09:32:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759W3sm042000; Sat, 5 Aug 2017 09:32:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050932.v759W3sm042000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:32: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: r322082 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 322082 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:32:04 -0000 Author: trasz Date: Sat Aug 5 09:32:03 2017 New Revision: 322082 URL: https://svnweb.freebsd.org/changeset/base/322082 Log: MFC r318182: Improve build(7): add missing "buildkernel" and "installkernel" to the example, change the architectures to something more common, and improve description of defaults for TARGET. Modified: stable/11/share/man/man7/build.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/build.7 ============================================================================== --- stable/11/share/man/man7/build.7 Sat Aug 5 08:37:38 2017 (r322081) +++ stable/11/share/man/man7/build.7 Sat Aug 5 09:32:03 2017 (r322082) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd May 11, 2017 .Dt BUILD 7 .Os .Sh NAME @@ -518,7 +518,10 @@ and .Va TARGET Ns = Ns Li pc98 . If not set, .Va TARGET -defaults to the current hardware platform. +defaults to the current hardware platform, unless +.Va TARGET_ARCH +is also set, in which case it defaults to the appropriate +value for that architecture. .It Va TARGET_ARCH The target machine processor architecture. This is analogous to the @@ -663,11 +666,11 @@ section in .Pa src/UPDATING . .Pp The following sequence of commands can be used to cross-build the -system for the sparc64 architecture on an i386 host: +system for the armv6 architecture on an amd64 host: .Bd -literal -offset indent cd /usr/src -make TARGET=sparc64 buildworld -make TARGET=sparc64 DESTDIR=/clients/sparc64 installworld +make TARGET_ARCH=armv6 buildworld buildkernel +make TARGET_ARCH=armv6 DESTDIR=/clients/arm64 installworld installkernel .Ed .Sh SEE ALSO .Xr cc 1 , @@ -676,6 +679,7 @@ make TARGET=sparc64 DESTDIR=/clients/sparc64 installwo .Xr svn 1 , .Xr make.conf 5 , .Xr src.conf 5 , +.Xr arch 7 , .Xr ports 7 , .Xr release 7 , .Xr tests 7 , From owner-svn-src-stable@freebsd.org Sat Aug 5 09:34:10 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9ADFDC9850; Sat, 5 Aug 2017 09:34:10 +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 8837A6D3A0; Sat, 5 Aug 2017 09:34:10 +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 v759Y9Tq042160; Sat, 5 Aug 2017 09:34:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759Y9Mm042159; Sat, 5 Aug 2017 09:34:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050934.v759Y9Mm042159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:34: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: r322083 - stable/11/sys/geom X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/sys/geom X-SVN-Commit-Revision: 322083 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:34:10 -0000 Author: trasz Date: Sat Aug 5 09:34:09 2017 New Revision: 322083 URL: https://svnweb.freebsd.org/changeset/base/322083 Log: MFC r318444: Fix typo. Modified: stable/11/sys/geom/geom_vfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/geom_vfs.c ============================================================================== --- stable/11/sys/geom/geom_vfs.c Sat Aug 5 09:32:03 2017 (r322082) +++ stable/11/sys/geom/geom_vfs.c Sat Aug 5 09:34:09 2017 (r322083) @@ -168,7 +168,7 @@ g_vfs_strategy(struct bufobj *bo, struct buf *bp) sc = cp->geom->softc; /* - * If the provider has orphaned us, just return EXIO. + * If the provider has orphaned us, just return ENXIO. */ mtx_lock(&sc->sc_mtx); if (sc->sc_orphaned) { From owner-svn-src-stable@freebsd.org Sat Aug 5 09:38:16 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFE89DC9B83; Sat, 5 Aug 2017 09:38:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CA5A6D569; Sat, 5 Aug 2017 09:38:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v759cFcv042466; Sat, 5 Aug 2017 09:38:15 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759cFLv042465; Sat, 5 Aug 2017 09:38:15 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050938.v759cFLv042465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:38: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: r322084 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 322084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:38:16 -0000 Author: trasz Date: Sat Aug 5 09:38:15 2017 New Revision: 322084 URL: https://svnweb.freebsd.org/changeset/base/322084 Log: MFC r319499: Consistently use lowercase hex numbers in ascii(7). Modified: stable/11/share/man/man7/ascii.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/ascii.7 ============================================================================== --- stable/11/share/man/man7/ascii.7 Sat Aug 5 09:34:09 2017 (r322083) +++ stable/11/share/man/man7/ascii.7 Sat Aug 5 09:38:15 2017 (r322084) @@ -64,9 +64,9 @@ The set: .Bd -literal -offset left 00 NUL 01 SOH 02 STX 03 ETX 04 EOT 05 ENQ 06 ACK 07 BEL -08 BS 09 HT 0A LF 0B VT 0C FF 0D CR 0E SO 0F SI +08 BS 09 HT 0a LF 0b VT 0c FF 0d CR 0e SO 0f SI 10 DLE 11 DC1 12 DC2 13 DC3 14 DC4 15 NAK 16 SYN 17 ETB -18 CAN 19 EM 1A SUB 1B ESC 1C FS 1D GS 1E RS 1F US +18 CAN 19 EM 1a SUB 1b ESC 1c FS 1d GS 1e RS 1f US 20 SP 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2a * 2b + 2c , 2d - 2e . 2f / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 From owner-svn-src-stable@freebsd.org Sat Aug 5 09:39:17 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38A71DC9C63; Sat, 5 Aug 2017 09:39:17 +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 05B0A6D6B1; Sat, 5 Aug 2017 09:39:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v759dG2L042559; Sat, 5 Aug 2017 09:39:16 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759dGVu042558; Sat, 5 Aug 2017 09:39:16 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050939.v759dGVu042558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:39: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: r322085 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 322085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:39:17 -0000 Author: trasz Date: Sat Aug 5 09:39:15 2017 New Revision: 322085 URL: https://svnweb.freebsd.org/changeset/base/322085 Log: MFC r319775: /usr/share/doc/bind is gone since 20040925. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sat Aug 5 09:38:15 2017 (r322084) +++ stable/11/share/man/man7/hier.7 Sat Aug 5 09:39:15 2017 (r322085) @@ -488,8 +488,6 @@ association) Frequently Asked Questions .It Pa IPv6/ implementation notes for IPv6 -.It Pa bind/ -documents pertaining to BIND (the Berkeley Internet Name Domain) .It Pa es/ Spanish translations of documents in /usr/share/doc .It Pa handbook/ From owner-svn-src-stable@freebsd.org Sat Aug 5 09:40:05 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 544AFDC9D73; Sat, 5 Aug 2017 09:40:05 +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 213716D7F9; Sat, 5 Aug 2017 09:40:05 +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 v759e4Jo042671; Sat, 5 Aug 2017 09:40:04 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759e4xf042670; Sat, 5 Aug 2017 09:40:04 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050940.v759e4xf042670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:40: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: r322086 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 322086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:40:05 -0000 Author: trasz Date: Sat Aug 5 09:40:04 2017 New Revision: 322086 URL: https://svnweb.freebsd.org/changeset/base/322086 Log: MFC r319774: Improve formatting by removing yet another case of '-width ".Pa'. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sat Aug 5 09:39:15 2017 (r322085) +++ stable/11/share/man/man7/hier.7 Sat Aug 5 09:40:04 2017 (r322086) @@ -693,7 +693,7 @@ source for files in .Pa /usr/share .It Pa sys/ kernel source code -.Bl -tag -width ".Pa opencrypto/" -compact +.Bl -tag -width "opencrypto/" -compact .It Pa amd64/ AMD64 architecture support .It Pa arm/ From owner-svn-src-stable@freebsd.org Sat Aug 5 09:40:57 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 609CCDC9E63; Sat, 5 Aug 2017 09:40:57 +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 2DD276D98E; Sat, 5 Aug 2017 09:40:57 +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 v759eupr042754; Sat, 5 Aug 2017 09:40:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759euac042753; Sat, 5 Aug 2017 09:40:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050940.v759euac042753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:40: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: r322087 - stable/11/sys/boot/forth X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/sys/boot/forth X-SVN-Commit-Revision: 322087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:40:57 -0000 Author: trasz Date: Sat Aug 5 09:40:56 2017 New Revision: 322087 URL: https://svnweb.freebsd.org/changeset/base/322087 Log: MFC r319798: Switch the example name for variables controlling loading memory images in /boot/defaults/loader.conf to something that's actually commonly used, "mdroot". It's arbitrary, but it's easier to find this way. Modified: stable/11/sys/boot/forth/loader.conf Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/forth/loader.conf ============================================================================== --- stable/11/sys/boot/forth/loader.conf Sat Aug 5 09:40:04 2017 (r322086) +++ stable/11/sys/boot/forth/loader.conf Sat Aug 5 09:40:56 2017 (r322087) @@ -70,9 +70,9 @@ ram_blacklist_type="ram_blacklist" # Required for the ### Initial memory disk settings ########################### ############################################################## -#initmd_load="YES" # The "initmd" prefix is arbitrary. -#initmd_type="md_image" # Create md(4) disk at boot. -#initmd_name="/boot/root.img" # Path to a file containing the image. +#mdroot_load="YES" # The "mdroot" prefix is arbitrary. +#mdroot_type="md_image" # Create md(4) disk at boot. +#mdroot_name="/boot/root.img" # Path to a file containing the image. #rootdev="ufs:/dev/md0" # Set the root filesystem to md(4) device. From owner-svn-src-stable@freebsd.org Sat Aug 5 09:42:45 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92FD9DCA11D; Sat, 5 Aug 2017 09:42:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 600456DE4A; Sat, 5 Aug 2017 09:42:45 +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 v759gi5n046682; Sat, 5 Aug 2017 09:42:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759giOH046681; Sat, 5 Aug 2017 09:42:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050942.v759giOH046681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:42: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: r322088 - stable/11/share/man/man4 X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/share/man/man4 X-SVN-Commit-Revision: 322088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:42:45 -0000 Author: trasz Date: Sat Aug 5 09:42:44 2017 New Revision: 322088 URL: https://svnweb.freebsd.org/changeset/base/322088 Log: MFC r320671: Use more canonical .Dt for vt(4). Modified: stable/11/share/man/man4/vt.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/vt.4 ============================================================================== --- stable/11/share/man/man4/vt.4 Sat Aug 5 09:40:56 2017 (r322087) +++ stable/11/share/man/man4/vt.4 Sat Aug 5 09:42:44 2017 (r322088) @@ -25,7 +25,7 @@ .\" $FreeBSD$ .\" .Dd July 19, 2016 -.Dt "VIRTUAL TERMINALS" 4 +.Dt "VT" 4 .Os .Sh NAME .Nm vt From owner-svn-src-stable@freebsd.org Sat Aug 5 09:44:22 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF964DCA24B; Sat, 5 Aug 2017 09:44:22 +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 8E3676E01A; Sat, 5 Aug 2017 09:44:22 +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 v759iLo9046810; Sat, 5 Aug 2017 09:44:21 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759iLuV046809; Sat, 5 Aug 2017 09:44:21 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050944.v759iLuV046809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:44: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: r322089 - stable/11/usr.bin/ktrace X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/usr.bin/ktrace X-SVN-Commit-Revision: 322089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:44:22 -0000 Author: trasz Date: Sat Aug 5 09:44:21 2017 New Revision: 322089 URL: https://svnweb.freebsd.org/changeset/base/322089 Log: MFC r321327: Use more usual formatting for the EXAMPLES section of ktrace(1). Modified: stable/11/usr.bin/ktrace/ktrace.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/ktrace/ktrace.1 ============================================================================== --- stable/11/usr.bin/ktrace/ktrace.1 Sat Aug 5 09:42:44 2017 (r322088) +++ stable/11/usr.bin/ktrace/ktrace.1 Sat Aug 5 09:44:21 2017 (r322089) @@ -28,7 +28,7 @@ .\" @(#)ktrace.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 31, 2016 +.Dd July 24, 2017 .Dt KTRACE 1 .Os .Sh NAME @@ -148,31 +148,31 @@ and .Ar command options are mutually exclusive. .Sh EXAMPLES -# trace all kernel operations of process id 34 +Trace all kernel operations of process id 34: .Dl $ ktrace -p 34 .Pp -# trace all kernel operations of processes in process group 15 and -# pass the trace flags to all current and future children +Trace all kernel operations of processes in process group 15 and +pass the trace flags to all current and future children: .Dl $ ktrace -idg 15 .Pp -# disable all tracing of process 65 +Disable all tracing of process 65: .Dl $ ktrace -cp 65 .Pp -# disable tracing signals on process 70 and all current children +Disable tracing signals on process 70 and all current children: .Dl $ ktrace -t s -cdp 70 .Pp -# enable tracing of +Enable tracing of .Tn I/O -on process 67 +on process 67: .Dl $ ktrace -ti -p 67 .Pp -# run the command "w", tracing only system calls +Run the command "w", tracing only system calls: .Dl $ ktrace -tc w .Pp -# disable all tracing to the file "tracedata" +Disable all tracing to the file "tracedata": .Dl $ ktrace -c -f tracedata .Pp -# disable tracing of all user-owned processes +Disable tracing of all user-owned processes: .Dl $ ktrace -C .Sh SEE ALSO .Xr kdump 1 , From owner-svn-src-stable@freebsd.org Sat Aug 5 09:45:09 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A11C3DCA34E; Sat, 5 Aug 2017 09:45:09 +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 6FB9B6E15F; Sat, 5 Aug 2017 09:45:09 +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 v759j8A4046902; Sat, 5 Aug 2017 09:45:08 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759j8pD046901; Sat, 5 Aug 2017 09:45:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050945.v759j8pD046901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:45: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: r322090 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 322090 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:45:09 -0000 Author: trasz Date: Sat Aug 5 09:45:08 2017 New Revision: 322090 URL: https://svnweb.freebsd.org/changeset/base/322090 Log: MFC r321328: Use more usual formatting for the EXAMPLES section of truss(1). Modified: stable/11/usr.bin/truss/truss.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/truss.1 ============================================================================== --- stable/11/usr.bin/truss/truss.1 Sat Aug 5 09:44:21 2017 (r322089) +++ stable/11/usr.bin/truss/truss.1 Sat Aug 5 09:45:08 2017 (r322090) @@ -92,11 +92,13 @@ and options are mutually exclusive.) .El .Sh EXAMPLES -# Follow the system calls used in echoing "hello" +Follow the system calls used in echoing "hello": .Dl $ truss /bin/echo hello -# Do the same, but put the output into a file +.Pp +Do the same, but put the output into a file: .Dl $ truss -o /tmp/truss.out /bin/echo hello -# Follow an already-running process +.Pp +Follow an already-running process: .Dl $ truss -p 34 .Sh SEE ALSO .Xr kdump 1 , From owner-svn-src-stable@freebsd.org Sat Aug 5 09:45:50 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11FEDDCA42F; Sat, 5 Aug 2017 09:45:50 +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 D49B16E291; Sat, 5 Aug 2017 09:45:49 +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 v759jnFq046978; Sat, 5 Aug 2017 09:45:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759jn0q046977; Sat, 5 Aug 2017 09:45:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050945.v759jn0q046977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:45: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: r322091 - stable/11/usr.bin/truss X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/usr.bin/truss X-SVN-Commit-Revision: 322091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:45:50 -0000 Author: trasz Date: Sat Aug 5 09:45:48 2017 New Revision: 322091 URL: https://svnweb.freebsd.org/changeset/base/322091 Log: MFC r321329: Make truss(1) cross-reference dtrace(1) and bump .Dd. Modified: stable/11/usr.bin/truss/truss.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/truss/truss.1 ============================================================================== --- stable/11/usr.bin/truss/truss.1 Sat Aug 5 09:45:08 2017 (r322090) +++ stable/11/usr.bin/truss/truss.1 Sat Aug 5 09:45:48 2017 (r322091) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd February 23, 2016 +.Dd July 24, 2017 .Dt TRUSS 1 .Os .Sh NAME @@ -101,6 +101,7 @@ Do the same, but put the output into a file: Follow an already-running process: .Dl $ truss -p 34 .Sh SEE ALSO +.Xr dtrace 1 , .Xr kdump 1 , .Xr ktrace 1 , .Xr ptrace 2 , From owner-svn-src-stable@freebsd.org Sat Aug 5 09:48:59 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75817DCA698; Sat, 5 Aug 2017 09:48:59 +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 443A06E435; Sat, 5 Aug 2017 09:48:59 +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 v759mwNZ047161; Sat, 5 Aug 2017 09:48:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v759mwFE047160; Sat, 5 Aug 2017 09:48:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201708050948.v759mwFE047160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 5 Aug 2017 09:48: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: r322092 - stable/11/bin/ps X-SVN-Group: stable-11 X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: stable/11/bin/ps X-SVN-Commit-Revision: 322092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 09:48:59 -0000 Author: trasz Date: Sat Aug 5 09:48:58 2017 New Revision: 322092 URL: https://svnweb.freebsd.org/changeset/base/322092 Log: MFC r321368: Use the "tree" word in ps(1) -d option description, to make it easier to find. Modified: stable/11/bin/ps/ps.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/ps/ps.1 ============================================================================== --- stable/11/bin/ps/ps.1 Sat Aug 5 09:45:48 2017 (r322091) +++ stable/11/bin/ps/ps.1 Sat Aug 5 09:48:58 2017 (r322092) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd August 12, 2016 +.Dd July 25, 2017 .Dt PS 1 .Os .Sh NAME @@ -129,7 +129,7 @@ time (this normally has no effect). .It Fl d Arrange processes into descendancy order and prefix each command with -indentation text showing sibling and parent/child relationships. +indentation text showing sibling and parent/child relationships as a tree. If either of the .Fl m and From owner-svn-src-stable@freebsd.org Sat Aug 5 12:33:02 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB244DD39D4; Sat, 5 Aug 2017 12:33:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4B1573A87; Sat, 5 Aug 2017 12:33:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v75CX1Pi016179; Sat, 5 Aug 2017 12:33:01 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75CX1GJ016171; Sat, 5 Aug 2017 12:33:01 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708051233.v75CX1GJ016171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 5 Aug 2017 12:33:01 +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: r322094 - in stable/10: . gnu/usr.bin lib share/mk tools/build/mk tools/build/options usr.bin usr.sbin X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10: . gnu/usr.bin lib share/mk tools/build/mk tools/build/options usr.bin usr.sbin X-SVN-Commit-Revision: 322094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 12:33:03 -0000 Author: marius Date: Sat Aug 5 12:33:00 2017 New Revision: 322094 URL: https://svnweb.freebsd.org/changeset/base/322094 Log: MFC: r306375 Add a WITHOUT_DIALOG src.conf(5) knob. It also turns off dependencies (bsdinstall, bsdconfig, dpv, tzsetup). Added: stable/10/tools/build/options/WITHOUT_DIALOG - copied unchanged from r306375, head/tools/build/options/WITHOUT_DIALOG Modified: stable/10/Makefile.inc1 stable/10/gnu/usr.bin/Makefile stable/10/lib/Makefile stable/10/share/mk/bsd.own.mk stable/10/tools/build/mk/OptionalObsoleteFiles.inc stable/10/usr.bin/Makefile stable/10/usr.sbin/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Sat Aug 5 10:03:47 2017 (r322093) +++ stable/10/Makefile.inc1 Sat Aug 5 12:33:00 2017 (r322094) @@ -1713,13 +1713,17 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ ${_cddl_lib_libzfs_core} \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_lib_libldns} \ - ${_secure_lib_libssh} ${_secure_lib_libssl} \ - gnu/lib/libdialog + ${_secure_lib_libssh} ${_secure_lib_libssl} .if ${MK_GNUCXX} != no _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ gnu/lib/libstdc++__L: lib/msun__L .endif +.if ${MK_DIALOG} != "no" +_prebuild_libs+= gnu/lib/libdialog +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L +.endif + .if ${MK_LIBCPLUSPLUS} != "no" _prebuild_libs+= lib/libc++ .endif @@ -1850,8 +1854,6 @@ _lib_libypclnt= lib/libypclnt .if ${MK_OPENSSL} == "no" lib/libradius__L: lib/libmd__L .endif - -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L .for _lib in ${_prereq_libs} ${_lib}__PL: .PHONY .MAKE Modified: stable/10/gnu/usr.bin/Makefile ============================================================================== --- stable/10/gnu/usr.bin/Makefile Sat Aug 5 10:03:47 2017 (r322093) +++ stable/10/gnu/usr.bin/Makefile Sat Aug 5 12:33:00 2017 (r322094) @@ -4,7 +4,7 @@ SUBDIR= ${_binutils} \ ${_cc} \ - dialog \ + ${_dialog} \ diff \ diff3 \ ${_dtc} \ @@ -24,6 +24,10 @@ _gperf= gperf .if ${MK_GROFF} != "no" _groff= groff .endif +.endif + +.if ${MK_DIALOG} != "no" +_dialog= dialog .endif .if ${MK_GPL_DTC} != "no" Modified: stable/10/lib/Makefile ============================================================================== --- stable/10/lib/Makefile Sat Aug 5 10:03:47 2017 (r322093) +++ stable/10/lib/Makefile Sat Aug 5 12:33:00 2017 (r322094) @@ -40,7 +40,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ libdevctl \ libdevinfo \ libdevstat \ - libdpv \ + ${_libdpv} \ libdwarf \ libedit \ ${_libefi} \ @@ -162,6 +162,10 @@ _libbsnmp= libbsnmp .if ${MK_CLANG} != "no" && !defined(COMPAT_32BIT) _clang= clang +.endif + +.if ${MK_DIALOG} != "no" +_libdpv= libdpv .endif .if ${MK_FILE} != "no" Modified: stable/10/share/mk/bsd.own.mk ============================================================================== --- stable/10/share/mk/bsd.own.mk Sat Aug 5 10:03:47 2017 (r322093) +++ stable/10/share/mk/bsd.own.mk Sat Aug 5 12:33:00 2017 (r322094) @@ -288,6 +288,7 @@ __DEFAULT_YES_OPTIONS = \ CRYPT \ CTM \ CXX \ + DIALOG \ DICT \ DYNAMICROOT \ ED_CRYPTO \ @@ -549,6 +550,10 @@ MK_KERBEROS:= no .if ${MK_CXX} == "no" MK_CLANG:= no MK_GROFF:= no +.endif + +.if ${MK_DIALOG} == "no" +MK_BSDINSTALL:= no .endif .if ${MK_MAIL} == "no" Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/10/tools/build/mk/OptionalObsoleteFiles.inc Sat Aug 5 10:03:47 2017 (r322093) +++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc Sat Aug 5 12:33:00 2017 (r322094) @@ -1057,6 +1057,27 @@ OLD_FILES+=usr/bin/g++ OLD_FILES+=usr/libexec/cc1plus .endif +.if ${MK_DIALOG} == no +OLD_FILES+=usr/bin/dialog +OLD_FILES+=usr/bin/dpv +OLD_FILES+=usr/lib/libdialog.a +OLD_FILES+=usr/lib/libdialog.so +OLD_FILES+=usr/lib/libdialog.so.8 +OLD_FILES+=usr/lib/libdialog_p.a +OLD_FILES+=usr/lib/libdpv.a +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 + .if ${MK_FMTREE} == no OLD_FILES+=usr/sbin/fmtree OLD_FILES+=usr/share/man/man8/fmtree.8.gz Copied: stable/10/tools/build/options/WITHOUT_DIALOG (from r306375, head/tools/build/options/WITHOUT_DIALOG) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/build/options/WITHOUT_DIALOG Sat Aug 5 12:33:00 2017 (r322094, copy of r306375, head/tools/build/options/WITHOUT_DIALOG) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build dialog(1), dialog(1,3), and dpv(1,3). Modified: stable/10/usr.bin/Makefile ============================================================================== --- stable/10/usr.bin/Makefile Sat Aug 5 10:03:47 2017 (r322093) +++ stable/10/usr.bin/Makefile Sat Aug 5 12:33:00 2017 (r322094) @@ -37,7 +37,7 @@ SUBDIR= alias \ ctlstat \ cut \ dirname \ - dpv \ + ${_dpv} \ du \ elf2aout \ elfdump \ @@ -225,6 +225,10 @@ SUBDIR+= calendar .if ${MK_CLANG} != "no" _clang= clang +.endif + +.if ${MK_DIALOG} != "no" +_dpv= dpv .endif .if ${MK_EE} != "no" Modified: stable/10/usr.sbin/Makefile ============================================================================== --- stable/10/usr.sbin/Makefile Sat Aug 5 10:03:47 2017 (r322093) +++ stable/10/usr.sbin/Makefile Sat Aug 5 12:33:00 2017 (r322094) @@ -6,7 +6,7 @@ SUBDIR= adduser \ arp \ binmiscctl \ - bsdconfig \ + ${_bsdconfig} \ camdd \ cdcontrol \ chkgrp \ @@ -89,7 +89,7 @@ SUBDIR= adduser \ tcpdump \ traceroute \ trpt \ - tzsetup \ + ${_tzsetup} \ uefisign \ ugidfw \ vigr \ @@ -150,6 +150,11 @@ SUBDIR+= ctm .if ${MK_CXGBETOOL} != "no" SUBDIR+= cxgbetool +.endif + +.if ${MK_DIALOG} != "no" +_bsdconfig= bsdconfig +_tzsetup= tzsetup .endif .if ${MK_FLOPPY} != "no" From owner-svn-src-stable@freebsd.org Sat Aug 5 12:34:33 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B728DD3B0C; Sat, 5 Aug 2017 12:34:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE55673BF9; Sat, 5 Aug 2017 12:34:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v75CYVZP016264; Sat, 5 Aug 2017 12:34:31 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75CYV3P016263; Sat, 5 Aug 2017 12:34:31 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708051234.v75CYV3P016263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 5 Aug 2017 12:34:31 +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: r322095 - stable/10/share/man/man5 X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/share/man/man5 X-SVN-Commit-Revision: 322095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 12:34:33 -0000 Author: marius Date: Sat Aug 5 12:34:31 2017 New Revision: 322095 URL: https://svnweb.freebsd.org/changeset/base/322095 Log: Regenerate src.conf.5 after r322094. Modified: stable/10/share/man/man5/src.conf.5 Modified: stable/10/share/man/man5/src.conf.5 ============================================================================== --- stable/10/share/man/man5/src.conf.5 Sat Aug 5 12:33:00 2017 (r322094) +++ stable/10/share/man/man5/src.conf.5 Sat Aug 5 12:34:31 2017 (r322095) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: stable/10/tools/build/options/makeman 318614 2017-05-22 06:08:20Z ngie .\" $FreeBSD$ -.Dd July 5, 2017 +.Dd August 5, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -371,6 +371,15 @@ The debug files will be placed in a subdirectory of .Pa /usr/lib/debug and are located automatically by .Xr gdb 1 . +.It Va WITHOUT_DIALOG +.\" from FreeBSD: stable/10/tools/build/options/WITHOUT_DIALOG 322094 2017-08-05 12:33:00Z marius +Set to not build dialog(1), dialog(1,3), and dpv(1,3). +When set, it also enforces the following options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_BSDINSTALL +.El .It Va WITHOUT_DICT .\" from FreeBSD: stable/10/tools/build/options/WITHOUT_DICT 156932 2006-03-21 07:50:50Z ru Set to not build the Webster dictionary files. From owner-svn-src-stable@freebsd.org Sat Aug 5 12:54:09 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14915DD4C0C; Sat, 5 Aug 2017 12:54:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D531874748; Sat, 5 Aug 2017 12:54:08 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v75Cs8kY024504; Sat, 5 Aug 2017 12:54:08 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75Cs789024498; Sat, 5 Aug 2017 12:54:07 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708051254.v75Cs789024498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 5 Aug 2017 12:54: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: r322096 - in stable/10: tools/build/mk usr.sbin usr.sbin/bsdconfig/timezone usr.sbin/tzsetup X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10: tools/build/mk usr.sbin usr.sbin/bsdconfig/timezone usr.sbin/tzsetup X-SVN-Commit-Revision: 322096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 12:54:09 -0000 Author: marius Date: Sat Aug 5 12:54:07 2017 New Revision: 322096 URL: https://svnweb.freebsd.org/changeset/base/322096 Log: MFC: r274394, r274399, r307802 - Default `bsdconfig timezone' and `tzsetup' to `-s' in a VM. - 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. Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc stable/10/usr.sbin/Makefile stable/10/usr.sbin/bsdconfig/timezone/timezone stable/10/usr.sbin/tzsetup/Makefile stable/10/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/10/tools/build/mk/OptionalObsoleteFiles.inc Sat Aug 5 12:34:31 2017 (r322095) +++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc Sat Aug 5 12:54:07 2017 (r322096) @@ -1069,12 +1069,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: stable/10/usr.sbin/Makefile ============================================================================== --- stable/10/usr.sbin/Makefile Sat Aug 5 12:34:31 2017 (r322095) +++ stable/10/usr.sbin/Makefile Sat Aug 5 12:54:07 2017 (r322096) @@ -89,7 +89,7 @@ SUBDIR= adduser \ tcpdump \ traceroute \ trpt \ - ${_tzsetup} \ + tzsetup \ uefisign \ ugidfw \ vigr \ @@ -154,7 +154,6 @@ SUBDIR+= cxgbetool .if ${MK_DIALOG} != "no" _bsdconfig= bsdconfig -_tzsetup= tzsetup .endif .if ${MK_FLOPPY} != "no" Modified: stable/10/usr.sbin/bsdconfig/timezone/timezone ============================================================================== --- stable/10/usr.sbin/bsdconfig/timezone/timezone Sat Aug 5 12:34:31 2017 (r322095) +++ stable/10/usr.sbin/bsdconfig/timezone/timezone Sat Aug 5 12:54:07 2017 (r322096) @@ -62,7 +62,7 @@ _PATH_WALL_CMOS_CLOCK="/etc/wall_cmos_clock" REALLYDOIT=1 REINSTALL= USEDIALOG=1 -SKIPUTC= +SKIPUTC= # See MAIN VERBOSE= TZ_OR_FAIL= CHROOTENV= @@ -118,6 +118,9 @@ dialog_menu_main() } ############################################################ MAIN + +# Skip initial question regarding UTC v. Wall-Clock time if run in VM +[ "$( sysctl -n kern.vm_guest 2> /dev/null )" = "none" ] || SKIPUTC=1 # Incorporate rc-file if it exists [ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" Modified: stable/10/usr.sbin/tzsetup/Makefile ============================================================================== --- stable/10/usr.sbin/tzsetup/Makefile Sat Aug 5 12:34:31 2017 (r322095) +++ stable/10/usr.sbin/tzsetup/Makefile Sat Aug 5 12:54:07 2017 (r322096) @@ -1,16 +1,18 @@ # $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 DPADD= ${LIBDIALOG} ${LIBM} LDADD= -ldialog -lm - -.include +.endif .if ${MK_NCURSESW} == "no" DPADD+= ${LIBNCURSES} Modified: stable/10/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/10/usr.sbin/tzsetup/tzsetup.c Sat Aug 5 12:34:31 2017 (r322095) +++ stable/10/usr.sbin/tzsetup/tzsetup.c Sat Aug 5 12:54:07 2017 (r322096) @@ -47,8 +47,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#ifdef HAVE_DIALOG #include +#endif #define _PATH_ZONETAB "/usr/share/zoneinfo/zone.tab" #define _PATH_ISO3166 "/usr/share/misc/iso3166" @@ -71,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; @@ -186,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 *); @@ -643,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]; @@ -671,9 +724,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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 @@ -684,9 +739,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); @@ -696,9 +753,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); @@ -707,9 +766,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); @@ -722,9 +783,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); } @@ -733,10 +796,12 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); } @@ -748,9 +813,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); } @@ -764,9 +831,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); @@ -780,9 +849,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); } @@ -790,10 +861,12 @@ install_zoneinfo_file(const char *zoneinfo_file) 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); } @@ -803,9 +876,11 @@ install_zoneinfo_file(const char *zoneinfo_file) "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); } @@ -821,9 +896,11 @@ install_zoneinfo_file(const char *zoneinfo_file) 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 */ @@ -854,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) { @@ -911,10 +943,21 @@ 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); skiputc = 0; + + /* Default skiputc to 1 for VM guests */ + if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) == 0 && + strcmp(vm_guest, "none") != 0) + skiputc = 1; + while ((c = getopt(argc, argv, "C:nrs")) != -1) { switch(c) { case 'C': @@ -925,7 +968,9 @@ main(int argc, char **argv) break; case 'r': reinstall = 1; +#ifdef HAVE_DIALOG usedialog = 0; +#endif break; case 's': skiputc = 1; @@ -989,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(); @@ -1055,5 +1103,8 @@ main(int argc, char **argv) dlg_clear(); end_dialog(); +#else + usage(); +#endif return (0); } From owner-svn-src-stable@freebsd.org Sat Aug 5 14:49:42 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 086E1DAB76F; Sat, 5 Aug 2017 14:49:42 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C12D27793D; Sat, 5 Aug 2017 14:49:41 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v75Enewk068903; Sat, 5 Aug 2017 14:49:40 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75EneLs068902; Sat, 5 Aug 2017 14:49:40 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708051449.v75EneLs068902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sat, 5 Aug 2017 14:49: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: r322098 - stable/10/usr.sbin/tzsetup X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/usr.sbin/tzsetup X-SVN-Commit-Revision: 322098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 14:49:42 -0000 Author: marius Date: Sat Aug 5 14:49:40 2017 New Revision: 322098 URL: https://svnweb.freebsd.org/changeset/base/322098 Log: Fix a stable/10-specific mismerge in r322096; the MK_NCURSESW handling should be within the MK_DIALOG block as libncurses{,w} isn't required when building tzsetup(8) without dialog(3) support. Modified: stable/10/usr.sbin/tzsetup/Makefile Modified: stable/10/usr.sbin/tzsetup/Makefile ============================================================================== --- stable/10/usr.sbin/tzsetup/Makefile Sat Aug 5 12:59:03 2017 (r322097) +++ stable/10/usr.sbin/tzsetup/Makefile Sat Aug 5 14:49:40 2017 (r322098) @@ -12,14 +12,13 @@ WARNS?= 3 CFLAGS+= -I${.CURDIR}/../../contrib/dialog -DHAVE_DIALOG DPADD= ${LIBDIALOG} ${LIBM} LDADD= -ldialog -lm -.endif - .if ${MK_NCURSESW} == "no" DPADD+= ${LIBNCURSES} LDADD+= -lncurses .else DPADD+= ${LIBNCURSESW} LDADD+= -lncursesw +.endif .endif .include From owner-svn-src-stable@freebsd.org Sat Aug 5 16:44:32 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA843DBCE9F; Sat, 5 Aug 2017 16:44: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 9066D7ECF4; Sat, 5 Aug 2017 16:44:32 +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 v75GiVHd017066; Sat, 5 Aug 2017 16:44:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75GiVFE017061; Sat, 5 Aug 2017 16:44:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051644.v75GiVFE017061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 16:44: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: r322099 - in stable/11: etc/mtree share/mk share/zoneinfo share/zoneinfo/tests tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/11: etc/mtree share/mk share/zoneinfo share/zoneinfo/tests tools/build/options X-SVN-Commit-Revision: 322099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 16:44:32 -0000 Author: ngie Date: Sat Aug 5 16:44:31 2017 New Revision: 322099 URL: https://svnweb.freebsd.org/changeset/base/322099 Log: MFC r320702,r320703: r320702: Formalize LEAPSECONDS and OLDTIMEZONES in share/zoneinfo/... as `MK_ZONEINFO_LEAPSECONDS_SUPPORT == yes` and `MK_ZONEINFO_OLD_TIMEZONES_SUPPORT == yes`. Keep `LEAPSECONDS` and `OLDTIMEZONES` for backwards compatibility, but print out a warning notifying users that they should use the new variables, in an effort to migrate them to the variables. This is being done mostly for automated build tools, etc, that might rely on these variables being set. The variables will be removed in the future on ^/head, e.g., after ^/stable/12 is cut. Relnotes: yes r320703: Add tests to help verify Links functionality for .../contrib/tzdata/backwards MFC with: r320702 Added: stable/11/share/zoneinfo/tests/ - copied from r320703, head/share/zoneinfo/tests/ stable/11/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT - copied unchanged from r320702, head/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT stable/11/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT - copied unchanged from r320702, head/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/share/mk/src.opts.mk stable/11/share/zoneinfo/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Sat Aug 5 14:49:40 2017 (r322098) +++ stable/11/etc/mtree/BSD.tests.dist Sat Aug 5 16:44:31 2017 (r322099) @@ -388,6 +388,8 @@ .. .. .. + zoneinfo + .. .. sys acl Modified: stable/11/share/mk/src.opts.mk ============================================================================== --- stable/11/share/mk/src.opts.mk Sat Aug 5 14:49:40 2017 (r322098) +++ stable/11/share/mk/src.opts.mk Sat Aug 5 16:44:31 2017 (r322099) @@ -194,6 +194,8 @@ __DEFAULT_NO_OPTIONS = \ SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ + ZONEINFO_LEAPSECONDS_SUPPORT \ + ZONEINFO_OLD_TIMEZONES_SUPPORT \ # @@ -371,6 +373,11 @@ MK_DTRACE_TESTS:= no .if ${MK_TEXTPROC} == "no" MK_GROFF:= no +.endif + +.if ${MK_ZONEINFO} == "no" +MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no +MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no .endif .if ${MK_CROSS_COMPILER} == "no" Modified: stable/11/share/zoneinfo/Makefile ============================================================================== --- stable/11/share/zoneinfo/Makefile Sat Aug 5 14:49:40 2017 (r322098) +++ stable/11/share/zoneinfo/Makefile Sat Aug 5 16:44:31 2017 (r322099) @@ -28,12 +28,24 @@ # $ svn commit # Commit message: "MFV of tzdata2008X" # +.include + CLEANFILES+= yearistype CLEANDIRS+= builddir CONTRIBDIR= ${.CURDIR}/../../contrib/tzdata/ .PATH: ${CONTRIBDIR} .if defined(LEAPSECONDS) +.warning "Using backwards compatibility variable for LEAPSECONDS; please use WITH_ZONEINFO_LEAPSECONDS_SUPPORT instead" +MK_ZONEINFO_LEAPSECONDS_SUPPORT= yes +.endif + +.if defined(OLDTIMEZONES) +.warning "Using backwards compatibility variable for OLDTIMEZONES; please use WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT instead" +MK_ZONEINFO_OLD_TIMEZONES_SUPPORT= yes +.endif + +.if ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no" LEAPFILE= -L ${CONTRIBDIR}leapseconds .else LEAPFILE= @@ -43,7 +55,7 @@ TZFILES= africa antarctica asia australasia etcetera e factory northamerica southamerica POSIXRULES= America/New_York -.if defined(OLDTIMEZONES) +.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no" TZFILES+= backward systemv .endif @@ -67,7 +79,7 @@ TZBUILDSUBDIRS= \ Pacific \ SystemV -.if defined(OLDTIMEZONES) +.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no" TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil .endif @@ -113,5 +125,9 @@ afterinstall: else \ echo "Run tzsetup(8) manually to update /etc/localtime."; \ fi + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Copied: stable/11/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT (from r320702, head/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT Sat Aug 5 16:44:31 2017 (r322099, copy of r320702, head/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build leapsecond information in to the timezone database. Copied: stable/11/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT (from r320702, head/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT Sat Aug 5 16:44:31 2017 (r322099, copy of r320702, head/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to build backward compatibility timezone aliases in to the timezone +database. From owner-svn-src-stable@freebsd.org Sat Aug 5 16:55:08 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C44F6DBD5B5; Sat, 5 Aug 2017 16:55:08 +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 A05447F1C9; Sat, 5 Aug 2017 16:55:08 +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 v75Gt7Up021045; Sat, 5 Aug 2017 16:55:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75Gt7uv021039; Sat, 5 Aug 2017 16:55:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051655.v75Gt7uv021039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 16:55: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: r322100 - in stable/10: etc/mtree share/mk share/zoneinfo share/zoneinfo/tests tools/build/options X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/10: etc/mtree share/mk share/zoneinfo share/zoneinfo/tests tools/build/options X-SVN-Commit-Revision: 322100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 16:55:08 -0000 Author: ngie Date: Sat Aug 5 16:55:07 2017 New Revision: 322100 URL: https://svnweb.freebsd.org/changeset/base/322100 Log: MFC r320702,r320703: r320702: Formalize LEAPSECONDS and OLDTIMEZONES in share/zoneinfo/... as `MK_ZONEINFO_LEAPSECONDS_SUPPORT == yes` and `MK_ZONEINFO_OLD_TIMEZONES_SUPPORT == yes`. Keep `LEAPSECONDS` and `OLDTIMEZONES` for backwards compatibility, but print out a warning notifying users that they should use the new variables, in an effort to migrate them to the variables. This is being done mostly for automated build tools, etc, that might rely on these variables being set. The variables will be removed in the future on ^/head, e.g., after ^/stable/12 is cut. Relnotes: yes r320703: Add tests to help verify Links functionality for .../contrib/tzdata/backwards MFC with: r320702 Added: stable/10/share/zoneinfo/tests/ - copied from r320703, head/share/zoneinfo/tests/ stable/10/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT - copied unchanged from r320702, head/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT stable/10/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT - copied unchanged from r320702, head/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/share/mk/bsd.own.mk stable/10/share/zoneinfo/Makefile stable/10/share/zoneinfo/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Sat Aug 5 16:44:31 2017 (r322099) +++ stable/10/etc/mtree/BSD.tests.dist Sat Aug 5 16:55:07 2017 (r322100) @@ -374,6 +374,8 @@ .. .. .. + zoneinfo + .. .. sys acl Modified: stable/10/share/mk/bsd.own.mk ============================================================================== --- stable/10/share/mk/bsd.own.mk Sat Aug 5 16:44:31 2017 (r322099) +++ stable/10/share/mk/bsd.own.mk Sat Aug 5 16:55:07 2017 (r322100) @@ -411,8 +411,11 @@ __DEFAULT_NO_OPTIONS = \ SHARED_TOOLCHAIN \ SVN \ TESTS \ - USB_GADGET_EXAMPLES + USB_GADGET_EXAMPLES \ + ZONEINFO_LEAPSECONDS_SUPPORT \ + ZONEINFO_OLD_TIMEZONES_SUPPORT \ + # # Default behaviour of some options depends on the architecture. Unfortunately # this means that we have to test TARGET_ARCH (the buildworld case) as well @@ -584,6 +587,11 @@ MK_BINUTILS:= no MK_CLANG:= no MK_GCC:= no MK_GDB:= no +.endif + +.if ${MK_ZONEINFO} == "no" +MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no +MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no .endif .if ${MK_CLANG} == "no" Modified: stable/10/share/zoneinfo/Makefile ============================================================================== --- stable/10/share/zoneinfo/Makefile Sat Aug 5 16:44:31 2017 (r322099) +++ stable/10/share/zoneinfo/Makefile Sat Aug 5 16:55:07 2017 (r322100) @@ -28,12 +28,24 @@ # $ svn update # Commit message: "MFV of tzdata2008X" # +.include + CLEANFILES+= yearistype CLEANDIRS+= builddir CONTRIBDIR= ${.CURDIR}/../../contrib/tzdata/ .PATH: ${CONTRIBDIR} .if defined(LEAPSECONDS) +.warning "Using backwards compatibility variable for LEAPSECONDS; please use WITH_ZONEINFO_LEAPSECONDS_SUPPORT instead" +MK_ZONEINFO_LEAPSECONDS_SUPPORT= yes +.endif + +.if defined(OLDTIMEZONES) +.warning "Using backwards compatibility variable for OLDTIMEZONES; please use WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT instead" +MK_ZONEINFO_OLD_TIMEZONES_SUPPORT= yes +.endif + +.if ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no" LEAPFILE= -L ${CONTRIBDIR}leapseconds .else LEAPFILE= @@ -43,7 +55,7 @@ TZFILES= africa antarctica asia australasia etcetera e factory northamerica southamerica POSIXRULES= America/New_York -.if defined(OLDTIMEZONES) +.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no" TZFILES+= backward systemv .endif @@ -67,7 +79,7 @@ TZBUILDSUBDIRS= \ Pacific \ SystemV -.if defined(OLDTIMEZONES) +.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no" TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil .endif @@ -110,5 +122,9 @@ afterinstall: else \ echo "Run tzsetup(8) manually to update /etc/localtime."; \ fi + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Modified: stable/10/share/zoneinfo/tests/Makefile ============================================================================== --- head/share/zoneinfo/tests/Makefile Thu Jul 6 04:30:06 2017 (r320703) +++ stable/10/share/zoneinfo/tests/Makefile Sat Aug 5 16:55:07 2017 (r322100) @@ -1,11 +1,10 @@ # $FreeBSD$ -.include +.include .PATH: ${SRCTOP}/contrib/tzdata -PACKAGE= tests - +FILESGROUPS= FILES FILESGROUPS+= TESTFILES .if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no" @@ -14,7 +13,6 @@ TESTFILES+= backward .endif TESTFILES+= zoneinfo_common.sh -TESTFILESPACKAGE= ${PACKAGE} TESTFILESDIR= ${TESTSDIR} .include Copied: stable/10/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT (from r320702, head/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT Sat Aug 5 16:55:07 2017 (r322100, copy of r320702, head/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build leapsecond information in to the timezone database. Copied: stable/10/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT (from r320702, head/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT Sat Aug 5 16:55:07 2017 (r322100, copy of r320702, head/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to build backward compatibility timezone aliases in to the timezone +database. From owner-svn-src-stable@freebsd.org Sat Aug 5 17:00:23 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4087DBDB9A; Sat, 5 Aug 2017 17:00:23 +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 B2ABE7F75D; Sat, 5 Aug 2017 17:00:23 +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 v75H0MqV021584; Sat, 5 Aug 2017 17:00:22 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75H0ML2021583; Sat, 5 Aug 2017 17:00:22 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051700.v75H0ML2021583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 17:00: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: r322102 - stable/11/share/man/man5 X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/share/man/man5 X-SVN-Commit-Revision: 322102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 17:00:24 -0000 Author: ngie Date: Sat Aug 5 17:00:22 2017 New Revision: 322102 URL: https://svnweb.freebsd.org/changeset/base/322102 Log: Regenerate src.conf(5) per r322099 Modified: stable/11/share/man/man5/src.conf.5 Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Sat Aug 5 16:58:02 2017 (r322101) +++ stable/11/share/man/man5/src.conf.5 Sat Aug 5 17:00:22 2017 (r322102) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd July 5, 2017 +.Dd August 5, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1510,6 +1510,19 @@ protocols (usable only via 802.1X). Set to not build ZFS file system. .It Va WITHOUT_ZONEINFO Set to not build the timezone database. +When set, it enforces these options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_ZONEINFO_LEAPSECONDS_SUPPORT +.It +.Va WITHOUT_ZONEINFO_OLD_TIMEZONES_SUPPORT +.El +.It Va WITH_ZONEINFO_LEAPSECONDS_SUPPORT +Set to build leapsecond information in to the timezone database. +.It Va WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT +Set to build backward compatibility timezone aliases in to the timezone +database. .El .Sh FILES .Bl -tag -compact -width Pa From owner-svn-src-stable@freebsd.org Sat Aug 5 17:01:01 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDE77DBDDB2; Sat, 5 Aug 2017 17:01:01 +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 9A6397F982; Sat, 5 Aug 2017 17:01:01 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v75H10W8022312; Sat, 5 Aug 2017 17:01:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75H102u022311; Sat, 5 Aug 2017 17:01:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051701.v75H102u022311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 17:01:00 +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: r322103 - stable/10/share/man/man5 X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/share/man/man5 X-SVN-Commit-Revision: 322103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 17:01:01 -0000 Author: ngie Date: Sat Aug 5 17:01:00 2017 New Revision: 322103 URL: https://svnweb.freebsd.org/changeset/base/322103 Log: Regenerate src.conf(5) per r322100 Modified: stable/10/share/man/man5/src.conf.5 Modified: stable/10/share/man/man5/src.conf.5 ============================================================================== --- stable/10/share/man/man5/src.conf.5 Sat Aug 5 17:00:22 2017 (r322102) +++ stable/10/share/man/man5/src.conf.5 Sat Aug 5 17:01:00 2017 (r322103) @@ -1213,6 +1213,21 @@ Set to not build ZFS file system. .It Va WITHOUT_ZONEINFO .\" from FreeBSD: stable/10/tools/build/options/WITHOUT_ZONEINFO 235342 2012-05-12 16:12:36Z gjb Set to not build the timezone database. +When set, it also enforces the following options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_ZONEINFO_LEAPSECONDS_SUPPORT +.It +.Va WITHOUT_ZONEINFO_OLD_TIMEZONES_SUPPORT +.El +.It Va WITH_ZONEINFO_LEAPSECONDS_SUPPORT +.\" from FreeBSD: stable/10/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT 322100 2017-08-05 16:54:40Z ngie +Set to build leapsecond information in to the timezone database. +.It Va WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT +.\" from FreeBSD: stable/10/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT 322100 2017-08-05 16:54:40Z ngie +Set to build backward compatibility timezone aliases in to the timezone +database. .El .Sh FILES .Bl -tag -compact -width Pa From owner-svn-src-stable@freebsd.org Sat Aug 5 17:01:59 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BE7BDBE253; Sat, 5 Aug 2017 17:01:59 +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 18C267FC6A; Sat, 5 Aug 2017 17:01:59 +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 v75H1wKb023147; Sat, 5 Aug 2017 17:01:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75H1wGR023146; Sat, 5 Aug 2017 17:01:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051701.v75H1wGR023146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 17:01: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: r322104 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 322104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 17:01:59 -0000 Author: ngie Date: Sat Aug 5 17:01:58 2017 New Revision: 322104 URL: https://svnweb.freebsd.org/changeset/base/322104 Log: MFC r321951: Some minor doc fixups - Tweak a sentence by placing the modifier before an adjective to make it flow better. - Fix a typo. Modified: stable/11/share/mk/bsd.opts.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.opts.mk ============================================================================== --- stable/11/share/mk/bsd.opts.mk Sat Aug 5 17:01:00 2017 (r322103) +++ stable/11/share/mk/bsd.opts.mk Sat Aug 5 17:01:58 2017 (r322104) @@ -4,7 +4,7 @@ # # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} -# with sensible (usually) defaults. +# with (usually) sensible defaults. # # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that # are applicable for that Makefile (typically there are none, but sometimes there @@ -41,7 +41,7 @@ ____: # # Only these options are used by bsd.*.mk. KERBEROS and OPENSSH are -# unforutnately needed to support statically linking the entire +# unfortunately needed to support statically linking the entire # tree. su(1) wouldn't link since it depends on PAM which depends on # ssh libraries when building with OPENSSH, and likewise for KERBEROS. From owner-svn-src-stable@freebsd.org Sat Aug 5 17:02:55 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5127DDBE3F1; Sat, 5 Aug 2017 17:02:55 +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 EF35B7FF5A; Sat, 5 Aug 2017 17:02:54 +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 v75H2s7d025361; Sat, 5 Aug 2017 17:02:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75H2s9u025360; Sat, 5 Aug 2017 17:02:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051702.v75H2s9u025360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 17:02: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: r322105 - stable/10/lib/libcrypt X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/lib/libcrypt X-SVN-Commit-Revision: 322105 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 17:02:55 -0000 Author: ngie Date: Sat Aug 5 17:02:53 2017 New Revision: 322105 URL: https://svnweb.freebsd.org/changeset/base/322105 Log: MFC r321915: Remove bogus bsd.subdir.mk .include bsd.subdir.mk is included from bsd.obj.mk, which is included via bsd.lib.mk. Modified: stable/10/lib/libcrypt/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libcrypt/Makefile ============================================================================== --- stable/10/lib/libcrypt/Makefile Sat Aug 5 17:01:58 2017 (r322104) +++ stable/10/lib/libcrypt/Makefile Sat Aug 5 17:02:53 2017 (r322105) @@ -45,4 +45,3 @@ SUBDIR+= tests .endif .include -.include From owner-svn-src-stable@freebsd.org Sat Aug 5 17:02:58 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80E20DBE421; Sat, 5 Aug 2017 17:02:58 +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 458307FF5F; Sat, 5 Aug 2017 17:02:58 +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 v75H2vYd025409; Sat, 5 Aug 2017 17:02:57 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75H2vNY025408; Sat, 5 Aug 2017 17:02:57 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051702.v75H2vNY025408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 17:02: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: r322106 - stable/11/lib/libcrypt X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/lib/libcrypt X-SVN-Commit-Revision: 322106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 17:02:58 -0000 Author: ngie Date: Sat Aug 5 17:02:57 2017 New Revision: 322106 URL: https://svnweb.freebsd.org/changeset/base/322106 Log: MFC r321915: Remove bogus bsd.subdir.mk .include bsd.subdir.mk is included from bsd.obj.mk, which is included via bsd.lib.mk. Modified: stable/11/lib/libcrypt/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libcrypt/Makefile ============================================================================== --- stable/11/lib/libcrypt/Makefile Sat Aug 5 17:02:53 2017 (r322105) +++ stable/11/lib/libcrypt/Makefile Sat Aug 5 17:02:57 2017 (r322106) @@ -47,4 +47,3 @@ SUBDIR+= tests .endif .include -.include From owner-svn-src-stable@freebsd.org Sat Aug 5 17:11:42 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B545DBED7C; Sat, 5 Aug 2017 17:11:42 +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 072CA8076E; Sat, 5 Aug 2017 17:11:41 +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 v75HBfMD029688; Sat, 5 Aug 2017 17:11:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v75HBf6g029687; Sat, 5 Aug 2017 17:11:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708051711.v75HBf6g029687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 5 Aug 2017 17:11: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: r322107 - stable/11/tools/tools/zfsboottest X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/tools/tools/zfsboottest X-SVN-Commit-Revision: 322107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2017 17:11:42 -0000 Author: ngie Date: Sat Aug 5 17:11:40 2017 New Revision: 322107 URL: https://svnweb.freebsd.org/changeset/base/322107 Log: MFC r321845: Standardize on SRCTOP instead of .CURDIR-relative paths Modified: stable/11/tools/tools/zfsboottest/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/tools/zfsboottest/Makefile ============================================================================== --- stable/11/tools/tools/zfsboottest/Makefile Sat Aug 5 17:02:57 2017 (r322106) +++ stable/11/tools/tools/zfsboottest/Makefile Sat Aug 5 17:11:40 2017 (r322107) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../../sys/boot/zfs ${.CURDIR}/../../../sys/cddl/boot/zfs +.PATH: ${SRCTOP}/sys/boot/zfs ${SRCTOP}/sys/cddl/boot/zfs BINDIR?= /usr/bin SCRIPTSDIR?= /usr/bin @@ -11,8 +11,8 @@ SCRIPTSNAME= zfsboottest.sh MAN= CFLAGS= -O1 \ - -I${.CURDIR}/../../../sys/boot/zfs \ - -I${.CURDIR}/../../../sys/cddl/boot/zfs \ + -I${SRCTOP}/sys/boot/zfs \ + -I${SRCTOP}/sys/cddl/boot/zfs \ -I. \ -fdiagnostics-show-option \ -W -Wextra -Wno-sign-compare -Wno-unused-parameter @@ -23,7 +23,7 @@ LIBADD+= md beforedepend zfsboottest.o: machine CLEANFILES+= machine machine: - ln -sf ${.CURDIR}/../../../sys/i386/include machine + ln -sf ${SRCTOP}/sys/i386/include machine .endif .include