From owner-svn-src-stable-9@FreeBSD.ORG Sun May 3 07:18:07 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B65CDC3A; Sun, 3 May 2015 07:18:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3F601C28; Sun, 3 May 2015 07:18:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t437I73G097282; Sun, 3 May 2015 07:18:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t437I7hR097281; Sun, 3 May 2015 07:18:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201505030718.t437I7hR097281@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 3 May 2015 07:18:07 +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: r282363 - stable/9/sys/fs/nfsclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 May 2015 07:18:07 -0000 Author: mav Date: Sun May 3 07:18:06 2015 New Revision: 282363 URL: https://svnweb.freebsd.org/changeset/base/282363 Log: MFC r281738: Change wcommitsize default from one empirical value to another. The new value is more predictable with growing RAM size: hibufspace maxvnodes old new i386: 256MB 32980992 15800 2198732 2097152 2GB 94027776 107677 878764 4194304 amd64: 256MB 32980992 15800 2198732 2097152 1GB 114114560 68062 1678155 4194304 4GB 217055232 111807 1955452 4194304 16GB 1717846016 337308 5097465 16777216 64GB 1734918144 1164427 1490479 16777216 256GB 1734918144 4426453 391983 16777216 Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun May 3 07:16:47 2015 (r282362) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun May 3 07:18:06 2015 (r282363) @@ -1265,10 +1265,13 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; nmp->nm_readahead = NFS_DEFRAHEAD; - if (desiredvnodes >= 11000) - nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); - else - nmp->nm_wcommitsize = hibufspace / 10; + + /* This is empirical approximation of sqrt(hibufspace) * 256. */ + nmp->nm_wcommitsize = NFS_MAXBSIZE / 256; + while ((long)nmp->nm_wcommitsize * nmp->nm_wcommitsize < hibufspace) + nmp->nm_wcommitsize *= 2; + nmp->nm_wcommitsize *= 256; + nfs_decode_args(mp, nmp, argp, hst, cred, td); From owner-svn-src-stable-9@FreeBSD.ORG Mon May 4 19:35:00 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71F9EF4E; Mon, 4 May 2015 19:35:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FF851BBC; Mon, 4 May 2015 19:35:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t44JZ0RH098334; Mon, 4 May 2015 19:35:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t44JZ0J5098333; Mon, 4 May 2015 19:35:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201505041935.t44JZ0J5098333@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 4 May 2015 19:35:00 +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: r282428 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2015 19:35:00 -0000 Author: mav Date: Mon May 4 19:34:59 2015 New Revision: 282428 URL: https://svnweb.freebsd.org/changeset/base/282428 Log: MFC r281765: Activate write-only optimization if bpf device opened with O_WRONLY. dhclient opens bpf as write-only to send packets. It never reads received packets from that descriptor, but processing them in kernel takes time. Especially much time takes packet timestamping on systems with expensive timecounter, such as bhyve guest, where network speed dropped in half. Sponsored by: iXsystems, Inc. Modified: stable/9/sys/net/bpf.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/bpf.c ============================================================================== --- stable/9/sys/net/bpf.c Mon May 4 19:33:51 2015 (r282427) +++ stable/9/sys/net/bpf.c Mon May 4 19:34:59 2015 (r282428) @@ -617,7 +617,7 @@ bpf_attachd(struct bpf_d *d, struct bpf_ * Save sysctl value to protect from sysctl change * between reads */ - op_w = V_bpf_optimize_writers; + op_w = V_bpf_optimize_writers || d->bd_writer; if (d->bd_bif != NULL) bpf_detachd_locked(d); @@ -880,6 +880,8 @@ bpfopen(struct cdev *dev, int flags, int * particular buffer method. */ bpf_buffer_init(d); + if ((flags & FREAD) == 0) + d->bd_writer = 2; d->bd_hbuf_in_use = 0; d->bd_bufmode = BPF_BUFMODE_BUFFER; d->bd_sig = SIGIO; From owner-svn-src-stable-9@FreeBSD.ORG Tue May 5 08:16:48 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 08D18273; Tue, 5 May 2015 08:16:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB0AA1CC2; Tue, 5 May 2015 08:16:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t458Gl4L029260; Tue, 5 May 2015 08:16:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t458GlxU029259; Tue, 5 May 2015 08:16:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201505050816.t458GlxU029259@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 5 May 2015 08:16:47 +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: r282458 - stable/9/sys/vm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 08:16:48 -0000 Author: kib Date: Tue May 5 08:16:47 2015 New Revision: 282458 URL: https://svnweb.freebsd.org/changeset/base/282458 Log: MFC r282128: Do not sleep waiting for the MAP_ENTRY_IN_TRANSITION state ending with the vnode locked. Modified: stable/9/sys/vm/vm_fault.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_fault.c ============================================================================== --- stable/9/sys/vm/vm_fault.c Tue May 5 08:15:10 2015 (r282457) +++ stable/9/sys/vm/vm_fault.c Tue May 5 08:16:47 2015 (r282458) @@ -296,6 +296,10 @@ RetryFault:; vm_map_lock(fs.map); if (vm_map_lookup_entry(fs.map, vaddr, &fs.entry) && (fs.entry->eflags & MAP_ENTRY_IN_TRANSITION)) { + if (fs.vp != NULL) { + vput(fs.vp); + fs.vp = NULL; + } fs.entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP; vm_map_unlock_and_wait(fs.map, 0); } else From owner-svn-src-stable-9@FreeBSD.ORG Tue May 5 19:52:24 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D076F6E; Tue, 5 May 2015 19:52:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDF851268; Tue, 5 May 2015 19:52:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t45JqNHv076568; Tue, 5 May 2015 19:52:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t45JqMWJ076560; Tue, 5 May 2015 19:52:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505051952.t45JqMWJ076560@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 5 May 2015 19:52:22 +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: r282507 - in stable/9/sys: arm/arm ia64/ia64 mips/mips powerpc/powerpc x86/x86 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 19:52:24 -0000 Author: hselasky Date: Tue May 5 19:52:22 2015 New Revision: 282507 URL: https://svnweb.freebsd.org/changeset/base/282507 Log: MFC r282120: The add_bounce_page() function can be called when loading physical pages which pass a NULL virtual address. If the BUS_DMA_KEEP_PG_OFFSET flag is set, use the physical address to compute the page offset instead. The physical address should always be valid when adding bounce pages and should contain the same page offset like the virtual address. Submitted by: Svatopluk Kraus Reviewed by: jhb@ Modified: stable/9/sys/arm/arm/busdma_machdep.c stable/9/sys/ia64/ia64/busdma_machdep.c stable/9/sys/mips/mips/busdma_machdep.c stable/9/sys/powerpc/powerpc/busdma_machdep.c stable/9/sys/x86/x86/busdma_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/arm/arm/busdma_machdep.c ============================================================================== --- stable/9/sys/arm/arm/busdma_machdep.c Tue May 5 19:47:17 2015 (r282506) +++ stable/9/sys/arm/arm/busdma_machdep.c Tue May 5 19:52:22 2015 (r282507) @@ -1449,8 +1449,8 @@ add_bounce_page(bus_dma_tag_t dmat, bus_ if (dmat->flags & BUS_DMA_KEEP_PG_OFFSET) { /* Page offset needs to be preserved. */ - bpage->vaddr |= vaddr & PAGE_MASK; - bpage->busaddr |= vaddr & PAGE_MASK; + bpage->vaddr |= addr & PAGE_MASK; + bpage->busaddr |= addr & PAGE_MASK; } bpage->datavaddr = vaddr; bpage->dataaddr = addr; Modified: stable/9/sys/ia64/ia64/busdma_machdep.c ============================================================================== --- stable/9/sys/ia64/ia64/busdma_machdep.c Tue May 5 19:47:17 2015 (r282506) +++ stable/9/sys/ia64/ia64/busdma_machdep.c Tue May 5 19:52:22 2015 (r282507) @@ -899,8 +899,8 @@ add_bounce_page(bus_dma_tag_t dmat, bus_ if (dmat->flags & BUS_DMA_KEEP_PG_OFFSET) { /* Page offset needs to be preserved. */ - bpage->vaddr |= vaddr & PAGE_MASK; - bpage->busaddr |= vaddr & PAGE_MASK; + bpage->vaddr |= addr & PAGE_MASK; + bpage->busaddr |= addr & PAGE_MASK; } bpage->datavaddr = vaddr; bpage->dataaddr = addr; Modified: stable/9/sys/mips/mips/busdma_machdep.c ============================================================================== --- stable/9/sys/mips/mips/busdma_machdep.c Tue May 5 19:47:17 2015 (r282506) +++ stable/9/sys/mips/mips/busdma_machdep.c Tue May 5 19:52:22 2015 (r282507) @@ -1349,8 +1349,8 @@ add_bounce_page(bus_dma_tag_t dmat, bus_ if (dmat->flags & BUS_DMA_KEEP_PG_OFFSET) { /* Page offset needs to be preserved. */ - bpage->vaddr |= vaddr & PAGE_MASK; - bpage->busaddr |= vaddr & PAGE_MASK; + bpage->vaddr |= addr & PAGE_MASK; + bpage->busaddr |= addr & PAGE_MASK; } bpage->datavaddr = vaddr; bpage->dataaddr = addr; Modified: stable/9/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- stable/9/sys/powerpc/powerpc/busdma_machdep.c Tue May 5 19:47:17 2015 (r282506) +++ stable/9/sys/powerpc/powerpc/busdma_machdep.c Tue May 5 19:52:22 2015 (r282507) @@ -1108,8 +1108,8 @@ add_bounce_page(bus_dma_tag_t dmat, bus_ if (dmat->flags & BUS_DMA_KEEP_PG_OFFSET) { /* Page offset needs to be preserved. */ - bpage->vaddr |= vaddr & PAGE_MASK; - bpage->busaddr |= vaddr & PAGE_MASK; + bpage->vaddr |= addr & PAGE_MASK; + bpage->busaddr |= addr & PAGE_MASK; } bpage->datavaddr = vaddr; bpage->dataaddr = addr; Modified: stable/9/sys/x86/x86/busdma_machdep.c ============================================================================== --- stable/9/sys/x86/x86/busdma_machdep.c Tue May 5 19:47:17 2015 (r282506) +++ stable/9/sys/x86/x86/busdma_machdep.c Tue May 5 19:52:22 2015 (r282507) @@ -1134,8 +1134,8 @@ add_bounce_page(bus_dma_tag_t dmat, bus_ if (dmat->flags & BUS_DMA_KEEP_PG_OFFSET) { /* Page offset needs to be preserved. */ - bpage->vaddr |= vaddr & PAGE_MASK; - bpage->busaddr |= vaddr & PAGE_MASK; + bpage->vaddr |= addr & PAGE_MASK; + bpage->busaddr |= addr & PAGE_MASK; } bpage->datavaddr = vaddr; bpage->dataaddr = addr; From owner-svn-src-stable-9@FreeBSD.ORG Tue May 5 20:00:21 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94BCE695; Tue, 5 May 2015 20:00:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82CA112E2; Tue, 5 May 2015 20:00:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t45K0LDs078780; Tue, 5 May 2015 20:00:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t45K0Lsq078778; Tue, 5 May 2015 20:00:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505052000.t45K0Lsq078778@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 5 May 2015 20:00:21 +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: r282510 - stable/9/sys/dev/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 20:00:21 -0000 Author: hselasky Date: Tue May 5 20:00:20 2015 New Revision: 282510 URL: https://svnweb.freebsd.org/changeset/base/282510 Log: MFC r280598: Add definition of the ISOCHRONOUS endpoint usage bits. Refer to the USB v2.0 specification for more information. Modified: stable/9/sys/dev/usb/usb.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb.h ============================================================================== --- stable/9/sys/dev/usb/usb.h Tue May 5 19:59:15 2015 (r282509) +++ stable/9/sys/dev/usb/usb.h Tue May 5 20:00:20 2015 (r282510) @@ -536,6 +536,11 @@ struct usb_endpoint_descriptor { #define UE_ISO_ADAPT 0x08 #define UE_ISO_SYNC 0x0c #define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE) +#define UE_ISO_USAGE 0x30 +#define UE_ISO_USAGE_DATA 0x00 +#define UE_ISO_USAGE_FEEDBACK 0x10 +#define UE_ISO_USAGE_IMPLICT_FB 0x20 +#define UE_GET_ISO_USAGE(a) ((a) & UE_ISO_USAGE) uWord wMaxPacketSize; #define UE_ZERO_MPS 0xFFFF /* for internal use only */ uByte bInterval; From owner-svn-src-stable-9@FreeBSD.ORG Tue May 5 20:59:50 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0AECAD0A; Tue, 5 May 2015 20:59:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB52D1A02; Tue, 5 May 2015 20:59:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t45KxnAM008253; Tue, 5 May 2015 20:59:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t45KxieA008224; Tue, 5 May 2015 20:59:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505052059.t45KxieA008224@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 5 May 2015 20:59:44 +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: r282514 - in stable/9/sys/ofed/include: linux net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2015 20:59:50 -0000 Author: hselasky Date: Tue May 5 20:59:43 2015 New Revision: 282514 URL: https://svnweb.freebsd.org/changeset/base/282514 Log: MFC r277396, r278681, r278865, r278924, r279205, r280208, r280210, r280764 and r280768: Update the Linux compatibility layer: - Add more functions. - Add some missing includes which are needed when the header files are not included in a particular order. - The kasprintf() function cannot be inlined due to using a variable number of arguments. Move it to a C-file. - Fix problems about 32-bit ticks wraparound and unsigned long conversion. Jiffies or ticks in FreeBSD have integer type and are not long. - Add missing "order_base_2()" macro. - Fix BUILD_BUG_ON() macro. - Declare a missing symbol which is needed when compiling without -O2 - Clean up header file inclusions in the linux/completion.h, linux/in.h and linux/fs.h header files. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/bitops.h stable/9/sys/ofed/include/linux/cache.h stable/9/sys/ofed/include/linux/completion.h stable/9/sys/ofed/include/linux/device.h stable/9/sys/ofed/include/linux/dma-mapping.h stable/9/sys/ofed/include/linux/etherdevice.h stable/9/sys/ofed/include/linux/fs.h stable/9/sys/ofed/include/linux/gfp.h stable/9/sys/ofed/include/linux/in.h stable/9/sys/ofed/include/linux/io.h stable/9/sys/ofed/include/linux/jiffies.h stable/9/sys/ofed/include/linux/kernel.h stable/9/sys/ofed/include/linux/kref.h stable/9/sys/ofed/include/linux/ktime.h stable/9/sys/ofed/include/linux/linux_compat.c stable/9/sys/ofed/include/linux/log2.h stable/9/sys/ofed/include/linux/pci.h stable/9/sys/ofed/include/linux/slab.h stable/9/sys/ofed/include/linux/timer.h stable/9/sys/ofed/include/net/ip.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/bitops.h ============================================================================== --- stable/9/sys/ofed/include/linux/bitops.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/bitops.h Tue May 5 20:59:43 2015 (r282514) @@ -288,9 +288,15 @@ bitmap_empty(unsigned long *addr, int si #define NBLONG (NBBY * sizeof(long)) +#define __set_bit(i, a) \ + atomic_set_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % NBLONG)) + #define set_bit(i, a) \ atomic_set_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % NBLONG)) +#define __clear_bit(i, a) \ + atomic_clear_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % NBLONG)) + #define clear_bit(i, a) \ atomic_clear_long(&((volatile long *)(a))[(i)/NBLONG], 1UL << ((i) % NBLONG)) Modified: stable/9/sys/ofed/include/linux/cache.h ============================================================================== --- stable/9/sys/ofed/include/linux/cache.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/cache.h Tue May 5 20:59:43 2015 (r282514) @@ -30,8 +30,7 @@ #ifndef _LINUX_CACHE_H_ #define _LINUX_CACHE_H_ - #define cache_line_size() CACHE_LINE_SIZE - +#define L1_CACHE_BYTES CACHE_LINE_SIZE #endif /* _LINUX_CACHE_H_ */ Modified: stable/9/sys/ofed/include/linux/completion.h ============================================================================== --- stable/9/sys/ofed/include/linux/completion.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/completion.h Tue May 5 20:59:43 2015 (r282514) @@ -32,124 +32,35 @@ #include -#include -#include -#include -#include -#include - struct completion { unsigned int done; }; -#define INIT_COMPLETION(c) ((c).done = 0) -#define init_completion(c) ((c)->done = 0) - -static inline void -_complete_common(struct completion *c, int all) -{ - int wakeup_swapper; - - sleepq_lock(c); - c->done++; - if (all) - wakeup_swapper = sleepq_broadcast(c, SLEEPQ_SLEEP, 0, 0); - else - wakeup_swapper = sleepq_signal(c, SLEEPQ_SLEEP, 0, 0); - sleepq_release(c); - if (wakeup_swapper) - kick_proc0(); -} - -#define complete(c) _complete_common(c, 0) -#define complete_all(c) _complete_common(c, 1) - -/* - * Indefinite wait for done != 0 with or without signals. - */ -static inline long -_wait_for_common(struct completion *c, int flags) -{ - - flags |= SLEEPQ_SLEEP; - for (;;) { - sleepq_lock(c); - if (c->done) - break; - sleepq_add(c, NULL, "completion", flags, 0); - if (flags & SLEEPQ_INTERRUPTIBLE) { - if (sleepq_wait_sig(c, 0) != 0) - return (-ERESTARTSYS); - } else - sleepq_wait(c, 0); - } - c->done--; - sleepq_release(c); - - return (0); -} - -#define wait_for_completion(c) _wait_for_common(c, 0) -#define wait_for_completion_interuptible(c) \ - _wait_for_common(c, SLEEPQ_INTERRUPTIBLE) - -static inline long -_wait_for_timeout_common(struct completion *c, long timeout, int flags) -{ - long end; - - end = ticks + timeout; - flags |= SLEEPQ_SLEEP; - for (;;) { - sleepq_lock(c); - if (c->done) - break; - sleepq_add(c, NULL, "completion", flags, 0); - sleepq_set_timeout(c, end - ticks); - if (flags & SLEEPQ_INTERRUPTIBLE) { - if (sleepq_timedwait_sig(c, 0) != 0) - return (-ERESTARTSYS); - } else - sleepq_timedwait(c, 0); - } - c->done--; - sleepq_release(c); - timeout = end - ticks; - - return (timeout > 0 ? timeout : 1); -} - -#define wait_for_completion_timeout(c, timeout) \ - _wait_for_timeout_common(c, timeout, 0) -#define wait_for_completion_interruptible_timeout(c, timeout) \ - _wait_for_timeout_common(c, timeout, SLEEPQ_INTERRUPTIBLE) - -static inline int -try_wait_for_completion(struct completion *c) -{ - int isdone; - - isdone = 1; - sleepq_lock(c); - if (c->done) - c->done--; - else - isdone = 0; - sleepq_release(c); - return (isdone); -} - -static inline int -completion_done(struct completion *c) -{ - int isdone; - - isdone = 1; - sleepq_lock(c); - if (c->done == 0) - isdone = 0; - sleepq_release(c); - return (isdone); -} +#define INIT_COMPLETION(c) \ + ((c).done = 0) +#define init_completion(c) \ + ((c)->done = 0) +#define complete(c) \ + linux_complete_common((c), 0) +#define complete_all(c) \ + linux_complete_common((c), 1) +#define wait_for_completion(c) \ + linux_wait_for_common((c), 0) +#define wait_for_completion_interuptible(c) \ + linux_wait_for_common((c), 1) +#define wait_for_completion_timeout(c, timeout) \ + linux_wait_for_timeout_common((c), (timeout), 0) +#define wait_for_completion_interruptible_timeout(c, timeout) \ + linux_wait_for_timeout_common((c), (timeout), 1) +#define try_wait_for_completion(c) \ + linux_try_wait_for_completion(c) +#define completion_done(c) \ + linux_completion_done(c) + +extern void linux_complete_common(struct completion *, int); +extern long linux_wait_for_common(struct completion *, int); +extern long linux_wait_for_timeout_common(struct completion *, long, int); +extern int linux_try_wait_for_completion(struct completion *); +extern int linux_completion_done(struct completion *); -#endif /* _LINUX_COMPLETION_H_ */ +#endif /* _LINUX_COMPLETION_H_ */ Modified: stable/9/sys/ofed/include/linux/device.h ============================================================================== --- stable/9/sys/ofed/include/linux/device.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/device.h Tue May 5 20:59:43 2015 (r282514) @@ -431,17 +431,6 @@ static inline char *kvasprintf(gfp_t gfp return p; } -static inline char *kasprintf(gfp_t gfp, const char *fmt, ...) -{ - va_list ap; - char *p; - - va_start(ap, fmt); - p = kvasprintf(gfp, fmt, ap); - va_end(ap); - - return p; -} - +char *kasprintf(gfp_t, const char *, ...); #endif /* _LINUX_DEVICE_H_ */ Modified: stable/9/sys/ofed/include/linux/dma-mapping.h ============================================================================== --- stable/9/sys/ofed/include/linux/dma-mapping.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/dma-mapping.h Tue May 5 20:59:43 2015 (r282514) @@ -139,6 +139,14 @@ dma_alloc_coherent(struct device *dev, s *dma_handle = 0; return (mem); } + +static inline void * +dma_zalloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, + gfp_t flag) +{ + + return (dma_alloc_coherent(dev, size, dma_handle, flag | __GFP_ZERO)); +} static inline void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, Modified: stable/9/sys/ofed/include/linux/etherdevice.h ============================================================================== --- stable/9/sys/ofed/include/linux/etherdevice.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/etherdevice.h Tue May 5 20:59:43 2015 (r282514) @@ -89,6 +89,9 @@ static inline bool is_valid_ether_addr(c return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); } - +static inline void ether_addr_copy(u8 *dst, const u8 *src) +{ + memcpy(dst, src, 6); +} #endif /* _LINUX_ETHERDEVICE */ Modified: stable/9/sys/ofed/include/linux/fs.h ============================================================================== --- stable/9/sys/ofed/include/linux/fs.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/fs.h Tue May 5 20:59:43 2015 (r282514) @@ -29,6 +29,8 @@ #ifndef _LINUX_FS_H_ #define _LINUX_FS_H_ +#include +#include #include #include #include Modified: stable/9/sys/ofed/include/linux/gfp.h ============================================================================== --- stable/9/sys/ofed/include/linux/gfp.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/gfp.h Tue May 5 20:59:43 2015 (r282514) @@ -30,6 +30,8 @@ #ifndef _LINUX_GFP_H_ #define _LINUX_GFP_H_ +#include +#include #include #include @@ -103,6 +105,13 @@ __free_pages(void *p, unsigned int order kmem_free(kmem_map, (vm_offset_t)p, size); } +static inline void free_pages(uintptr_t addr, unsigned int order) +{ + if (addr == 0) + return; + __free_pages(virt_to_page((void *)addr), order); +} + /* * Alloc pages allocates directly from the buddy allocator on linux so * order specifies a power of two bucket of pages and the results @@ -122,6 +131,16 @@ alloc_pages(gfp_t gfp_mask, unsigned int return (virt_to_page(page)); } +static inline uintptr_t __get_free_pages(gfp_t gfp_mask, unsigned int order) +{ + struct page *page; + + page = alloc_pages(gfp_mask, order); + if (page == NULL) + return (0); + return ((uintptr_t)page_address(page)); +} + #define alloc_pages_node(node, mask, order) alloc_pages(mask, order) #define kmalloc_node(chunk, mask, node) kmalloc(chunk, mask) Modified: stable/9/sys/ofed/include/linux/in.h ============================================================================== --- stable/9/sys/ofed/include/linux/in.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/in.h Tue May 5 20:59:43 2015 (r282514) @@ -31,6 +31,9 @@ #include "opt_inet.h" +#include +#include +#include #include #include Modified: stable/9/sys/ofed/include/linux/io.h ============================================================================== --- stable/9/sys/ofed/include/linux/io.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/io.h Tue May 5 20:59:43 2015 (r282514) @@ -31,6 +31,7 @@ #define _LINUX_IO_H_ #include +#include static inline uint32_t __raw_readl(const volatile void *addr) @@ -89,6 +90,20 @@ writew(uint16_t b, void *addr) *(volatile uint16_t *)addr = b; } +#undef ioread32be +static inline uint32_t +ioread32be(const volatile void *addr) +{ + return be32toh(*(const volatile uint32_t *)addr); +} + +#undef iowrite32be +static inline void +iowrite32be(uint32_t v, volatile void *addr) +{ + *(volatile uint32_t *)addr = htobe32(v); +} + void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr); #define ioremap_nocache(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE) Modified: stable/9/sys/ofed/include/linux/jiffies.h ============================================================================== --- stable/9/sys/ofed/include/linux/jiffies.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/jiffies.h Tue May 5 20:59:43 2015 (r282514) @@ -45,14 +45,12 @@ msecs_to_jiffies(int msec) return (tvtohz(&tv)); } - #define jiffies ticks #define jiffies_to_msecs(x) (((int64_t)(x)) * 1000 / hz) - -#define time_after(a, b) ((long)(b) - (long)(a) < 0) +#define time_after(a, b) ((int)((b) - (a)) < 0) #define time_before(a, b) time_after(b,a) -#define time_after_eq(a, b) ((long)(a) - (long)(b) >= 0) +#define time_after_eq(a, b) ((int)((a) - (b)) >= 0) #define time_before_eq(a, b) time_after_eq(b, a) #define HZ hz Modified: stable/9/sys/ofed/include/linux/kernel.h ============================================================================== --- stable/9/sys/ofed/include/linux/kernel.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/kernel.h Tue May 5 20:59:43 2015 (r282514) @@ -29,6 +29,8 @@ #ifndef _LINUX_KERNEL_H_ #define _LINUX_KERNEL_H_ +#include +#include #include #include #include @@ -57,6 +59,8 @@ #define KERN_INFO "<6>" #define KERN_DEBUG "<7>" +#define BUILD_BUG_ON(x) CTASSERT(!(x)) + #define BUG() panic("BUG") #define BUG_ON(condition) do { if (condition) BUG(); } while(0) #define WARN_ON BUG_ON @@ -66,6 +70,7 @@ #undef PTR_ALIGN #define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a))) #define DIV_ROUND_UP howmany +#define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f) #define printk(X...) printf(X) @@ -86,6 +91,7 @@ #endif #define udelay(t) DELAY(t) +#define usleep_range(min,max) DELAY(min) #ifndef pr_fmt #define pr_fmt(fmt) fmt @@ -172,6 +178,7 @@ #define round_down(x, y) ((x) & ~__round_mask(x, y)) #define num_possible_cpus() mp_ncpus +#define num_online_cpus() mp_ncpus typedef struct pm_message { int event; Modified: stable/9/sys/ofed/include/linux/kref.h ============================================================================== --- stable/9/sys/ofed/include/linux/kref.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/kref.h Tue May 5 20:59:43 2015 (r282514) @@ -29,6 +29,7 @@ #ifndef _LINUX_KREF_H_ #define _LINUX_KREF_H_ +#include #include struct kref { Modified: stable/9/sys/ofed/include/linux/ktime.h ============================================================================== --- stable/9/sys/ofed/include/linux/ktime.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/ktime.h Tue May 5 20:59:43 2015 (r282514) @@ -288,4 +288,13 @@ static inline s64 ktime_to_ns(const ktim #endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */ +static inline s64 ktime_get_ns(void) +{ + struct timespec ts; + ktime_t kt; + ktime_get_ts(&ts); + kt = timespec_to_ktime(ts); + return (ktime_to_ns(kt)); +} + #endif /* _LINUX_KTIME_H */ Modified: stable/9/sys/ofed/include/linux/linux_compat.c ============================================================================== --- stable/9/sys/ofed/include/linux/linux_compat.c Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/linux_compat.c Tue May 5 20:59:43 2015 (r282514) @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -55,6 +57,8 @@ #include #include #include +#include +#include #include @@ -66,20 +70,17 @@ MALLOC_DEFINE(M_KMALLOC, "linux", "Linux #undef file #undef cdev #define RB_ROOT(head) (head)->rbh_root -#undef LIST_HEAD -/* From sys/queue.h */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} struct kobject class_root; struct device linux_rootdev; struct class miscclass; struct list_head pci_drivers; struct list_head pci_devices; +struct net init_net; spinlock_t pci_lock; +unsigned long linux_timer_hz_mask; + int panic_cmp(struct rb_node *one, struct rb_node *two) { @@ -595,7 +596,9 @@ struct vmmap { unsigned long vm_size; }; -LIST_HEAD(vmmaphd, vmmap); +struct vmmaphd { + struct vmmap *lh_first; +}; #define VMMAP_HASH_SIZE 64 #define VMMAP_HASH_MASK (VMMAP_HASH_SIZE - 1) #define VM_HASH(addr) ((uintptr_t)(addr) >> PAGE_SHIFT) & VMMAP_HASH_MASK @@ -686,6 +689,185 @@ vunmap(void *addr) kfree(vmmap); } + +char * +kasprintf(gfp_t gfp, const char *fmt, ...) +{ + va_list ap; + char *p; + + va_start(ap, fmt); + p = kvasprintf(gfp, fmt, ap); + va_end(ap); + + return p; +} + +static int +linux_timer_jiffies_until(unsigned long expires) +{ + int delta = expires - jiffies; + /* guard against already expired values */ + if (delta < 1) + delta = 1; + return (delta); +} + +static void +linux_timer_callback_wrapper(void *context) +{ + struct timer_list *timer; + + timer = context; + timer->function(timer->data); +} + +void +mod_timer(struct timer_list *timer, unsigned long expires) +{ + + timer->expires = expires; + callout_reset(&timer->timer_callout, + linux_timer_jiffies_until(expires), + &linux_timer_callback_wrapper, timer); +} + +void +add_timer(struct timer_list *timer) +{ + + callout_reset(&timer->timer_callout, + linux_timer_jiffies_until(timer->expires), + &linux_timer_callback_wrapper, timer); +} + +static void +linux_timer_init(void *arg) +{ + + /* + * Compute an internal HZ value which can divide 2**32 to + * avoid timer rounding problems when the tick value wraps + * around 2**32: + */ + linux_timer_hz_mask = 1; + while (linux_timer_hz_mask < (unsigned long)hz) + linux_timer_hz_mask *= 2; + linux_timer_hz_mask--; +} +SYSINIT(linux_timer, SI_SUB_DRIVERS, SI_ORDER_FIRST, linux_timer_init, NULL); + +void +linux_complete_common(struct completion *c, int all) +{ + int wakeup_swapper; + + sleepq_lock(c); + c->done++; + if (all) + wakeup_swapper = sleepq_broadcast(c, SLEEPQ_SLEEP, 0, 0); + else + wakeup_swapper = sleepq_signal(c, SLEEPQ_SLEEP, 0, 0); + sleepq_release(c); + if (wakeup_swapper) + kick_proc0(); +} + +/* + * Indefinite wait for done != 0 with or without signals. + */ +long +linux_wait_for_common(struct completion *c, int flags) +{ + + if (flags != 0) + flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; + else + flags = SLEEPQ_SLEEP; + for (;;) { + sleepq_lock(c); + if (c->done) + break; + sleepq_add(c, NULL, "completion", flags, 0); + if (flags & SLEEPQ_INTERRUPTIBLE) { + if (sleepq_wait_sig(c, 0) != 0) + return (-ERESTARTSYS); + } else + sleepq_wait(c, 0); + } + c->done--; + sleepq_release(c); + + return (0); +} + +/* + * Time limited wait for done != 0 with or without signals. + */ +long +linux_wait_for_timeout_common(struct completion *c, long timeout, int flags) +{ + long end = jiffies + timeout; + + if (flags != 0) + flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; + else + flags = SLEEPQ_SLEEP; + for (;;) { + int ret; + + sleepq_lock(c); + if (c->done) + break; + sleepq_add(c, NULL, "completion", flags, 0); + sleepq_set_timeout(c, linux_timer_jiffies_until(end)); + if (flags & SLEEPQ_INTERRUPTIBLE) + ret = sleepq_timedwait_sig(c, 0); + else + ret = sleepq_timedwait(c, 0); + if (ret != 0) { + /* check for timeout or signal */ + if (ret == EWOULDBLOCK) + return (0); + else + return (-ERESTARTSYS); + } + } + c->done--; + sleepq_release(c); + + /* return how many jiffies are left */ + return (linux_timer_jiffies_until(end)); +} + +int +linux_try_wait_for_completion(struct completion *c) +{ + int isdone; + + isdone = 1; + sleepq_lock(c); + if (c->done) + c->done--; + else + isdone = 0; + sleepq_release(c); + return (isdone); +} + +int +linux_completion_done(struct completion *c) +{ + int isdone; + + isdone = 1; + sleepq_lock(c); + if (c->done == 0) + isdone = 0; + sleepq_release(c); + return (isdone); +} + static void linux_compat_init(void *arg) { Modified: stable/9/sys/ofed/include/linux/log2.h ============================================================================== --- stable/9/sys/ofed/include/linux/log2.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/log2.h Tue May 5 20:59:43 2015 (r282514) @@ -167,4 +167,6 @@ int __ilog2_u64(u64 n) __ilog2_u64(n) \ ) +#define order_base_2(x) ilog2(roundup_pow_of_two(x)) + #endif /* _LINUX_LOG2_H_ */ Modified: stable/9/sys/ofed/include/linux/pci.h ============================================================================== --- stable/9/sys/ofed/include/linux/pci.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/pci.h Tue May 5 20:59:43 2015 (r282514) @@ -270,6 +270,14 @@ pci_set_master(struct pci_dev *pdev) } static inline int +pci_clear_master(struct pci_dev *pdev) +{ + + pci_disable_busmaster(pdev->dev.bsddev); + return (0); +} + +static inline int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) { int rid; @@ -592,6 +600,30 @@ pci_enable_msix(struct pci_dev *pdev, st return (0); } +#define pci_enable_msix_range linux_pci_enable_msix_range +static inline int +pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, + int minvec, int maxvec) +{ + int nvec = maxvec; + int rc; + + if (maxvec < minvec) + return (-ERANGE); + + do { + rc = pci_enable_msix(dev, entries, nvec); + if (rc < 0) { + return (rc); + } else if (rc > 0) { + if (rc < minvec) + return (-ENOSPC); + nvec = rc; + } + } while (rc); + return (nvec); +} + static inline int pci_channel_offline(struct pci_dev *pdev) { return false; Modified: stable/9/sys/ofed/include/linux/slab.h ============================================================================== --- stable/9/sys/ofed/include/linux/slab.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/slab.h Tue May 5 20:59:43 2015 (r282514) @@ -40,6 +40,7 @@ MALLOC_DECLARE(M_KMALLOC); #define kmalloc(size, flags) malloc((size), M_KMALLOC, (flags)) +#define kvmalloc(size) kmalloc((size), 0) #define kzalloc(size, flags) kmalloc((size), (flags) | M_ZERO) #define kzalloc_node(size, flags, node) kzalloc(size, flags) #define kfree(ptr) free(__DECONST(void *, (ptr)), M_KMALLOC) @@ -47,6 +48,7 @@ MALLOC_DECLARE(M_KMALLOC); #define kcalloc(n, size, flags) kmalloc((n) * (size), flags | M_ZERO) #define vzalloc(size) kzalloc(size, GFP_KERNEL | __GFP_NOWARN) #define vfree(arg) kfree(arg) +#define kvfree(arg) kfree(arg) #define vmalloc(size) kmalloc(size, GFP_KERNEL) #define vmalloc_node(size, node) kmalloc(size, GFP_KERNEL) Modified: stable/9/sys/ofed/include/linux/timer.h ============================================================================== --- stable/9/sys/ofed/include/linux/timer.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/linux/timer.h Tue May 5 20:59:43 2015 (r282514) @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LINUX_TIMER_H_ -#define _LINUX_TIMER_H_ +#define _LINUX_TIMER_H_ #include @@ -36,20 +36,13 @@ #include struct timer_list { - struct callout timer_callout; - void (*function)(unsigned long); - unsigned long data; - unsigned long expires; + struct callout timer_callout; + void (*function) (unsigned long); + unsigned long data; + unsigned long expires; }; -static inline void -_timer_fn(void *context) -{ - struct timer_list *timer; - - timer = context; - timer->function(timer->data); -} +extern unsigned long linux_timer_hz_mask; #define setup_timer(timer, func, dat) \ do { \ @@ -65,28 +58,15 @@ do { \ callout_init(&(timer)->timer_callout, CALLOUT_MPSAFE); \ } while (0) -#define mod_timer(timer, exp) \ -do { \ - (timer)->expires = (exp); \ - callout_reset(&(timer)->timer_callout, (exp) - jiffies, \ - _timer_fn, (timer)); \ -} while (0) - -#define add_timer(timer) \ - callout_reset(&(timer)->timer_callout, \ - (timer)->expires - jiffies, _timer_fn, (timer)) +extern void mod_timer(struct timer_list *, unsigned long); +extern void add_timer(struct timer_list *); #define del_timer(timer) callout_stop(&(timer)->timer_callout) #define del_timer_sync(timer) callout_drain(&(timer)->timer_callout) - #define timer_pending(timer) callout_pending(&(timer)->timer_callout) +#define round_jiffies(j) \ + ((unsigned long)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask)) +#define round_jiffies_relative(j) \ + round_jiffies(j) -static inline unsigned long -round_jiffies(unsigned long j) -{ - return roundup(j, hz); -} - -#define round_jiffies_relative(j) round_jiffies(j) - -#endif /* _LINUX_TIMER_H_ */ +#endif /* _LINUX_TIMER_H_ */ Modified: stable/9/sys/ofed/include/net/ip.h ============================================================================== --- stable/9/sys/ofed/include/net/ip.h Tue May 5 20:58:12 2015 (r282513) +++ stable/9/sys/ofed/include/net/ip.h Tue May 5 20:59:43 2015 (r282514) @@ -42,13 +42,17 @@ #include #include -#ifdef INET static inline void inet_get_local_port_range(int *low, int *high) { +#ifdef INET CURVNET_SET_QUIET(TD_TO_VNET(curthread)); *low = V_ipport_firstauto; *high = V_ipport_lastauto; CURVNET_RESTORE(); +#else + *low = IPPORT_EPHEMERALFIRST; /* 10000 */ + *high = IPPORT_EPHEMERALLAST; /* 65535 */ +#endif } static inline void @@ -79,6 +83,5 @@ ip_ib_mc_map(uint32_t addr, const unsign buf[18] = (addr >> 8) & 0xff; buf[19] = addr & 0xff; } -#endif #endif /* _LINUX_NET_IP_H_ */ From owner-svn-src-stable-9@FreeBSD.ORG Sat May 9 12:11:01 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3BC96180; Sat, 9 May 2015 12:11:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 290751E5D; Sat, 9 May 2015 12:11:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t49CB1nA054085; Sat, 9 May 2015 12:11:01 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t49CB0aa054057; Sat, 9 May 2015 12:11:00 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201505091211.t49CB0aa054057@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 9 May 2015 12:11:00 +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: r282677 - in stable/9/sys/fs: nfs nfsserver X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 May 2015 12:11:01 -0000 Author: rmacklem Date: Sat May 9 12:10:59 2015 New Revision: 282677 URL: https://svnweb.freebsd.org/changeset/base/282677 Log: MFC: r281628 mav@ has found that NFS servers exporting ZFS file systems can perform better when using a 128K read/write data size. This patch changes NFS_MAXDATA from 64K to 128K so that clients can use 128K for NFS mounts to allow this. The patch also renames NFS_MAXDATA to NFS_SRVMAXIO so that it is clear that it applies to the NFS server side only. It also avoids a name conflict with the NFS_MAXDATA defined in rpcsvc/nfs_prot.h, that is used for userland RPC. Modified: stable/9/sys/fs/nfs/nfs.h stable/9/sys/fs/nfs/nfs_commonport.c stable/9/sys/fs/nfs/nfsproto.h stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfs.h ============================================================================== --- stable/9/sys/fs/nfs/nfs.h Sat May 9 09:21:59 2015 (r282676) +++ stable/9/sys/fs/nfs/nfs.h Sat May 9 12:10:59 2015 (r282677) @@ -151,7 +151,7 @@ (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0) #define NFS_SRVMAXDATA(n) \ (((n)->nd_flag & (ND_NFSV3 | ND_NFSV4)) ? \ - NFS_MAXDATA : NFS_V2MAXDATA) + NFS_SRVMAXIO : NFS_V2MAXDATA) #define NFS64BITSSET 0xffffffffffffffffull #define NFS64BITSMINUS1 0xfffffffffffffffeull Modified: stable/9/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonport.c Sat May 9 09:21:59 2015 (r282676) +++ stable/9/sys/fs/nfs/nfs_commonport.c Sat May 9 12:10:59 2015 (r282677) @@ -274,11 +274,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int if (isdgram) pref = NFS_MAXDGRAMDATA; else - pref = NFS_MAXDATA; - sip->fs_rtmax = NFS_MAXDATA; + pref = NFS_SRVMAXIO; + sip->fs_rtmax = NFS_SRVMAXIO; sip->fs_rtpref = pref; sip->fs_rtmult = NFS_FABLKSIZE; - sip->fs_wtmax = NFS_MAXDATA; + sip->fs_wtmax = NFS_SRVMAXIO; sip->fs_wtpref = pref; sip->fs_wtmult = NFS_FABLKSIZE; sip->fs_dtpref = pref; Modified: stable/9/sys/fs/nfs/nfsproto.h ============================================================================== --- stable/9/sys/fs/nfs/nfsproto.h Sat May 9 09:21:59 2015 (r282676) +++ stable/9/sys/fs/nfs/nfsproto.h Sat May 9 12:10:59 2015 (r282677) @@ -54,17 +54,28 @@ #define NFS_VER4 4 #define NFS_V2MAXDATA 8192 #define NFS_MAXDGRAMDATA 16384 -#define NFS_MAXDATA NFS_MAXBSIZE #define NFS_MAXPATHLEN 1024 #define NFS_MAXNAMLEN 255 #define NFS_MAXPKTHDR 404 -#define NFS_MAXPACKET (NFS_MAXDATA + 2048) +#define NFS_MAXPACKET (NFS_SRVMAXIO + 2048) #define NFS_MINPACKET 20 #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #define NFSV4_MINORVERSION 0 /* V4 Minor version */ #define NFSV4_CBVERS 1 /* V4 CB Version */ #define NFSV4_SMALLSTR 50 /* Strings small enough for stack */ +/* + * This value isn't a fixed value in the RFCs. + * It is the maximum data size supported by NFSv3 or NFSv4 over TCP for + * the server. It should be set to the I/O size preferred by ZFS or + * MAXBSIZE, whichever is greater. + * ZFS currently prefers 128K. + * It used to be called NFS_MAXDATA, but has been renamed to clarify that + * it refers to server side only and doesn't conflict with the NFS_MAXDATA + * defined in rpcsvc/nfs_prot.h for userland. + */ +#define NFS_SRVMAXIO (128 * 1024) + /* Stat numbers for rpc returns (version 2, 3 and 4) */ /* * These numbers are hard-wired in the RFCs, so they can't be changed. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Sat May 9 09:21:59 2015 (r282676) +++ stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Sat May 9 12:10:59 2015 (r282677) @@ -862,7 +862,7 @@ nfsrvd_write(struct nfsrv_descript *nd, i = mbuf_len(mp); } - if (retlen > NFS_MAXDATA || retlen < 0) + if (retlen > NFS_SRVMAXIO || retlen < 0) nd->nd_repstat = EIO; if (vnode_vtype(vp) != VREG && !nd->nd_repstat) { if (nd->nd_flag & ND_NFSV3)