From owner-svn-src-stable-10@freebsd.org Sun Dec 27 00:37:06 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86CAEA53F66; Sun, 27 Dec 2015 00:37:06 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 407981981; Sun, 27 Dec 2015 00:37:06 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBR0b537028991; Sun, 27 Dec 2015 00:37:05 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBR0b56i028989; Sun, 27 Dec 2015 00:37:05 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201512270037.tBR0b56i028989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Sun, 27 Dec 2015 00:37: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: r292760 - in stable/10: include lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 00:37:06 -0000 Author: ume Date: Sun Dec 27 00:37:04 2015 New Revision: 292760 URL: https://svnweb.freebsd.org/changeset/base/292760 Log: MFC r292514: addrinfo.ai_family is an address family, not a protocol family. PR: 162434 Modified: stable/10/include/netdb.h stable/10/lib/libc/net/getaddrinfo.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/include/netdb.h ============================================================================== --- stable/10/include/netdb.h Sat Dec 26 23:01:34 2015 (r292759) +++ stable/10/include/netdb.h Sun Dec 27 00:37:04 2015 (r292760) @@ -122,7 +122,7 @@ struct protoent { struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ - int ai_family; /* PF_xxx */ + int ai_family; /* AF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ socklen_t ai_addrlen; /* length of ai_addr */ Modified: stable/10/lib/libc/net/getaddrinfo.3 ============================================================================== --- stable/10/lib/libc/net/getaddrinfo.3 Sat Dec 26 23:01:34 2015 (r292759) +++ stable/10/lib/libc/net/getaddrinfo.3 Sun Dec 27 00:37:04 2015 (r292760) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2015 +.Dd December 21, 2015 .Dt GETADDRINFO 3 .Os .Sh NAME @@ -78,7 +78,7 @@ as defined by .Bd -literal struct addrinfo { int ai_flags; /* input flags */ - int ai_family; /* protocol family for socket */ + int ai_family; /* address family for socket */ int ai_socktype; /* socket type */ int ai_protocol; /* protocol for socket */ socklen_t ai_addrlen; /* length of socket-address */ @@ -94,12 +94,12 @@ The caller can supply the following stru .Fa hints : .Bl -tag -width "ai_socktypeXX" .It Fa ai_family -The protocol family that should be used. +The address family that should be used. When .Fa ai_family is set to -.Dv PF_UNSPEC , -it means the caller will accept any protocol family supported by the +.Dv AF_UNSPEC , +it means the caller will accept any address family supported by the operating system. .It Fa ai_socktype Denotes the type of socket that is wanted: @@ -261,7 +261,7 @@ behaves as if the caller provided a with .Fa ai_family set to -.Dv PF_UNSPEC +.Dv AF_UNSPEC and all other elements set to zero or .Dv NULL . .Pp @@ -373,7 +373,7 @@ int s; const char *cause = NULL; memset(&hints, 0, sizeof(hints)); -hints.ai_family = PF_UNSPEC; +hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo("www.kame.net", "http", &hints, &res0); if (error) { @@ -416,7 +416,7 @@ int nsock; const char *cause = NULL; memset(&hints, 0, sizeof(hints)); -hints.ai_family = PF_UNSPEC; +hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; error = getaddrinfo(NULL, "http", &hints, &res0); From owner-svn-src-stable-10@freebsd.org Sun Dec 27 00:42:15 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CCDDA4C20D; Sun, 27 Dec 2015 00:42: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 CF8161E60; Sun, 27 Dec 2015 00:42: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 tBR0gD1t031841; Sun, 27 Dec 2015 00:42:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBR0gDUg031840; Sun, 27 Dec 2015 00:42:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512270042.tBR0gDUg031840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Dec 2015 00:42: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: r292762 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 00:42:15 -0000 Author: kib Date: Sun Dec 27 00:42:13 2015 New Revision: 292762 URL: https://svnweb.freebsd.org/changeset/base/292762 Log: MFC r292510: Fix lockf(3) cancellation behaviour. Modified: stable/10/lib/libc/gen/lockf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/lockf.c ============================================================================== --- stable/10/lib/libc/gen/lockf.c Sun Dec 27 00:38:57 2015 (r292761) +++ stable/10/lib/libc/gen/lockf.c Sun Dec 27 00:42:13 2015 (r292762) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "un-namespace.h" +#include "libc_private.h" int lockf(int filedes, int function, off_t size) @@ -62,9 +63,12 @@ lockf(int filedes, int function, off_t s break; case F_TEST: fl.l_type = F_WRLCK; - if (_fcntl(filedes, F_GETLK, &fl) == -1) + if (((int (*)(int, int, ...)) + __libc_interposing[INTERPOS_fcntl])(filedes, F_GETLK, &fl) + == -1) return (-1); - if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && fl.l_pid == getpid())) + if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && + fl.l_pid == getpid())) return (0); errno = EAGAIN; return (-1); @@ -75,5 +79,6 @@ lockf(int filedes, int function, off_t s /* NOTREACHED */ } - return (_fcntl(filedes, cmd, &fl)); + return (((int (*)(int, int, ...)) + __libc_interposing[INTERPOS_fcntl])(filedes, cmd, &fl)); } From owner-svn-src-stable-10@freebsd.org Sun Dec 27 11:04:13 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E5C0A52738; Sun, 27 Dec 2015 11:04:13 +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 D8B6B1DAC; Sun, 27 Dec 2015 11:04:12 +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 tBRB4Bu2013470; Sun, 27 Dec 2015 11:04:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRB4Bc4013469; Sun, 27 Dec 2015 11:04:11 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512271104.tBRB4Bc4013469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Dec 2015 11:04:11 +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: r292768 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 11:04:13 -0000 Author: ngie Date: Sun Dec 27 11:04:11 2015 New Revision: 292768 URL: https://svnweb.freebsd.org/changeset/base/292768 Log: MFC r292500,r292501,r292504,r292509: r292500: Simplify Kyuafile generation logic with KYUAFILE == auto and related complexity with variables Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff) Reviewed by: emaste, Evan Cramer Sponsored by: EMC / Isilon Storage Division r292501: Fix typo in r292500 by adding missing conditional statement Pointyhat to: ngie Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff) Sponsored by: EMC / Isilon Storage Division r292504: Deal with another hardcoded reference to Kyuafile in the KYUAFILE == auto case Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff) Reviewed by: emaste, Evan Cramer Sponsored by: EMC / Isilon Storage Division r292509: Clean up Kyuafile.tmp, not Kyuafile.auto.tmp Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff) Reviewed by: emaste, Evan Cramer Sponsored by: EMC / Isilon Storage Division Modified: stable/10/share/mk/suite.test.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/suite.test.mk ============================================================================== --- stable/10/share/mk/suite.test.mk Sun Dec 27 07:50:11 2015 (r292767) +++ stable/10/share/mk/suite.test.mk Sun Dec 27 11:04:11 2015 (r292768) @@ -45,20 +45,17 @@ KYUAFILE?= auto # hierarchy specified by this variable. KYUA_PREFIX?= /usr/local -.if ${KYUAFILE:tl} == "yes" +.if ${KYUAFILE:tl} != "no" FILES+= Kyuafile FILESDIR_Kyuafile= ${TESTSDIR} +.endif -CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp -.elif ${KYUAFILE:tl} == "auto" -FILES+= Kyuafile.auto -FILESDIR_Kyuafile.auto= ${TESTSDIR} -FILESNAME_Kyuafile.auto= Kyuafile - -CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp +.if ${KYUAFILE:tl} == "auto" +CLEANFILES+= Kyuafile Kyuafile.tmp +.endif -.NOPATH: Kyuafile.auto -Kyuafile.auto: Makefile +.if ${KYUAFILE:tl} == "auto" +Kyuafile: Makefile @{ \ echo '-- Automatically generated by bsd.test.mk.'; \ echo; \ @@ -66,20 +63,20 @@ Kyuafile.auto: Makefile echo; \ echo 'test_suite("${TESTSUITE}")'; \ echo; \ - } >Kyuafile.auto.tmp + } > ${.TARGET}.tmp .for _T in ${_TESTS} .if defined(.PARSEDIR) @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \ - >>Kyuafile.auto.tmp + >>${.TARGET}.tmp .else @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \ >>Kyuafile.auto.tmp .endif .endfor .for _T in ${TESTS_SUBDIRS:N.WAIT} - @echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.auto.tmp + @echo "include(\"${_T}/${.TARGET}\")" >>${.TARGET}.tmp .endfor - @mv Kyuafile.auto.tmp Kyuafile.auto + @mv ${.TARGET}.tmp ${.TARGET} .endif KYUA?= ${KYUA_PREFIX}/bin/kyua From owner-svn-src-stable-10@freebsd.org Sun Dec 27 11:12:10 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0AFCA52950; Sun, 27 Dec 2015 11:12:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85B62111D; Sun, 27 Dec 2015 11:12:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRBC9in015770; Sun, 27 Dec 2015 11:12:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRBC9dp015769; Sun, 27 Dec 2015 11:12:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512271112.tBRBC9dp015769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Dec 2015 11:12: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: r292769 - stable/10/tools/regression/lib/msun X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 11:12:10 -0000 Author: ngie Date: Sun Dec 27 11:12:09 2015 New Revision: 292769 URL: https://svnweb.freebsd.org/changeset/base/292769 Log: MFC r292493: Don't run test-fma on i386 It completely fails all assertions on i386 on both stable/9 and stable/10 PR: 205448 X-MFC to: stable/10 Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tools/regression/lib/msun/test-fma.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/lib/msun/test-fma.c ============================================================================== --- stable/10/tools/regression/lib/msun/test-fma.c Sun Dec 27 11:04:11 2015 (r292768) +++ stable/10/tools/regression/lib/msun/test-fma.c Sun Dec 27 11:12:09 2015 (r292769) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "test-utils.h" @@ -475,6 +476,11 @@ main(int argc, char *argv[]) int rmodes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO }; int i; +#if defined(__i386__) + printf("1..0 # SKIP all testcases fail on i386\n"); + exit(0); +#endif + printf("1..19\n"); for (i = 0; i < 4; i++) { From owner-svn-src-stable-10@freebsd.org Sun Dec 27 13:37:15 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E97B2A4C99F; Sun, 27 Dec 2015 13:37:15 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCD211EF6; Sun, 27 Dec 2015 13:37:15 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRDbEwc058357; Sun, 27 Dec 2015 13:37:14 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRDbEh4058356; Sun, 27 Dec 2015 13:37:14 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201512271337.tBRDbEh4058356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Sun, 27 Dec 2015 13:37: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: r292770 - stable/10/sys/netgraph X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 13:37:16 -0000 Author: julian Date: Sun Dec 27 13:37:14 2015 New Revision: 292770 URL: https://svnweb.freebsd.org/changeset/base/292770 Log: MFH: r278640 Revise default limit for maximum of netgraph data items. With modern internet speeds the limit can be reached even on a single L2TP link. Modified: stable/10/sys/netgraph/ng_base.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netgraph/ng_base.c ============================================================================== --- stable/10/sys/netgraph/ng_base.c Sun Dec 27 11:12:09 2015 (r292769) +++ stable/10/sys/netgraph/ng_base.c Sun Dec 27 13:37:14 2015 (r292770) @@ -2947,7 +2947,7 @@ uma_zone_t ng_qzone; uma_zone_t ng_qdzone; static int numthreads = 0; /* number of queue threads */ static int maxalloc = 4096;/* limit the damage of a leak */ -static int maxdata = 512; /* limit the damage of a DoS */ +static int maxdata = 4096; /* limit the damage of a DoS */ TUNABLE_INT("net.graph.threads", &numthreads); SYSCTL_INT(_net_graph, OID_AUTO, threads, CTLFLAG_RDTUN, &numthreads, From owner-svn-src-stable-10@freebsd.org Sun Dec 27 14:39:49 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02406A4DFBC; Sun, 27 Dec 2015 14:39:49 +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 B84EA1E2A; Sun, 27 Dec 2015 14:39:48 +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 tBREdl0P076817; Sun, 27 Dec 2015 14:39:47 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBREdlhl076813; Sun, 27 Dec 2015 14:39:47 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271439.tBREdlhl076813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 14:39: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: r292771 - in stable/10/sys/sparc64: include sparc64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 14:39:49 -0000 Author: marius Date: Sun Dec 27 14:39:47 2015 New Revision: 292771 URL: https://svnweb.freebsd.org/changeset/base/292771 Log: MFC: r291121 Merge from r290547: Since r289279 bufinit() uses mp_ncpus so adapt to what x86 does and set this variable already in cpu_mp_setmaxid(). While at it, rename cpu_cpuid_prop() to cpu_portid_prop() as well as the MD cpuid variable to portid to avoid confusion with the MI use of "cpuid" and make some variable static/global in order to reduce stack usage. PR: 204685 Modified: stable/10/sys/sparc64/include/md_var.h stable/10/sys/sparc64/sparc64/machdep.c stable/10/sys/sparc64/sparc64/mp_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sparc64/include/md_var.h ============================================================================== --- stable/10/sys/sparc64/include/md_var.h Sun Dec 27 13:37:14 2015 (r292770) +++ stable/10/sys/sparc64/include/md_var.h Sun Dec 27 14:39:47 2015 (r292771) @@ -47,9 +47,9 @@ extern vm_paddr_t kstack0_phys; struct pcpu; struct md_utrap; -const char *cpu_cpuid_prop(u_int cpu_impl); uint32_t cpu_get_mid(u_int cpu_impl); void cpu_identify(u_long vers, u_int clock, u_int id); +const char *cpu_portid_prop(u_int cpu_impl); void cpu_setregs(struct pcpu *pc); int is_physical_memory(vm_paddr_t addr); struct md_utrap *utrap_alloc(void); Modified: stable/10/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/machdep.c Sun Dec 27 13:37:14 2015 (r292770) +++ stable/10/sys/sparc64/sparc64/machdep.c Sun Dec 27 14:39:47 2015 (r292771) @@ -249,7 +249,7 @@ find_bsp(phandle_t node, uint32_t bspid, { char type[sizeof("cpu")]; phandle_t child; - uint32_t cpuid; + uint32_t portid; for (; node != 0; node = OF_peer(node)) { child = OF_child(node); @@ -263,10 +263,10 @@ find_bsp(phandle_t node, uint32_t bspid, continue; if (strcmp(type, "cpu") != 0) continue; - if (OF_getprop(node, cpu_cpuid_prop(cpu_impl), &cpuid, - sizeof(cpuid)) <= 0) + if (OF_getprop(node, cpu_portid_prop(cpu_impl), + &portid, sizeof(portid)) <= 0) continue; - if (cpuid == bspid) + if (portid == bspid) return (node); } } @@ -274,7 +274,7 @@ find_bsp(phandle_t node, uint32_t bspid, } const char * -cpu_cpuid_prop(u_int cpu_impl) +cpu_portid_prop(u_int cpu_impl) { switch (cpu_impl) { Modified: stable/10/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/mp_machdep.c Sun Dec 27 13:37:14 2015 (r292770) +++ stable/10/sys/sparc64/sparc64/mp_machdep.c Sun Dec 27 14:39:47 2015 (r292771) @@ -119,9 +119,11 @@ struct mtx ipi_mtx; cpu_ipi_selected_t *cpu_ipi_selected; cpu_ipi_single_t *cpu_ipi_single; -static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; +static u_int cpuids = 1; static volatile cpuset_t shutdown_cpus; +static char ipi_pbuf[CPUSETBUFSIZ]; +static vm_offset_t mp_tramp; static void ap_count(phandle_t node, u_int mid, u_int cpu_impl); static void ap_start(phandle_t node, u_int mid, u_int cpu_impl); @@ -165,13 +167,12 @@ static void foreach_ap(phandle_t node, void (*func)(phandle_t node, u_int mid, u_int cpu_impl)) { - char type[sizeof("cpu")]; + static char type[sizeof("cpu")]; phandle_t child; - u_int cpuid; - uint32_t cpu_impl; + uint32_t cpu_impl, portid; /* There's no need to traverse the whole OFW tree twice. */ - if (mp_maxid > 0 && mp_ncpus >= mp_maxid + 1) + if (mp_maxid > 0 && cpuids > mp_maxid) return; for (; node != 0; node = OF_peer(node)) { @@ -188,13 +189,13 @@ foreach_ap(phandle_t node, void (*func)( sizeof(cpu_impl)) <= 0) panic("%s: couldn't determine CPU " "implementation", __func__); - if (OF_getprop(node, cpu_cpuid_prop(cpu_impl), &cpuid, - sizeof(cpuid)) <= 0) - panic("%s: couldn't determine CPU module ID", + if (OF_getprop(node, cpu_portid_prop(cpu_impl), + &portid, sizeof(portid)) <= 0) + panic("%s: couldn't determine CPU port ID", __func__); - if (cpuid == PCPU_GET(mid)) + if (portid == PCPU_GET(mid)) continue; - (*func)(node, cpuid, cpu_impl); + (*func)(node, portid, cpu_impl); } } } @@ -208,16 +209,17 @@ cpu_mp_setmaxid(void) CPU_SETOF(curcpu, &all_cpus); mp_ncpus = 1; - mp_maxid = 0; foreach_ap(OF_child(OF_peer(0)), ap_count); + mp_ncpus = MIN(mp_ncpus, MAXCPU); + mp_maxid = mp_ncpus - 1; } static void ap_count(phandle_t node __unused, u_int mid __unused, u_int cpu_impl __unused) { - mp_maxid++; + mp_ncpus++; } int @@ -306,7 +308,7 @@ ap_start(phandle_t node, u_int mid, u_in u_int cpuid; uint32_t clock; - if (mp_ncpus > MAXCPU) + if (cpuids > mp_maxid) return; if (OF_getprop(node, "clock-frequency", &clock, sizeof(clock)) <= 0) @@ -334,7 +336,7 @@ ap_start(phandle_t node, u_int mid, u_in csa->csa_tick = csa->csa_stick = 0; intr_restore(s); - cpuid = mp_ncpus++; + cpuid = cpuids++; cpuid_to_mid[cpuid] = mid; cpu_identify(csa->csa_ver, clock, cpuid); @@ -659,7 +661,6 @@ cheetah_ipi_single(u_int cpu, u_long d0, static void cheetah_ipi_selected(cpuset_t cpus, u_long d0, u_long d1, u_long d2) { - char pbuf[CPUSETBUFSIZ]; register_t s; u_long ids; u_int bnp; @@ -675,14 +676,14 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo ("%s: outstanding dispatch", __func__)); ids = 0; - for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { + for (i = 0; i < IPI_RETRIES * smp_cpus; i++) { s = intr_disable(); stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0); stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1); stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2); membar(Sync); bnp = 0; - for (cpu = 0; cpu < mp_ncpus; cpu++) { + for (cpu = 0; cpu < smp_cpus; cpu++) { if (CPU_ISSET(cpu, &cpus)) { stxa(AA_INTR_SEND | (cpuid_to_mid[cpu] << IDC_ITID_SHIFT) | bnp << IDC_BN_SHIFT, @@ -698,7 +699,7 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo ; intr_restore(s); bnp = 0; - for (cpu = 0; cpu < mp_ncpus; cpu++) { + for (cpu = 0; cpu < smp_cpus; cpu++) { if (CPU_ISSET(cpu, &cpus)) { if ((ids & (IDR_NACK << (2 * bnp))) == 0) CPU_CLR(cpu, &cpus); @@ -710,10 +711,10 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", - __func__, cpusetobj_strprint(pbuf, &cpus), ids); + __func__, cpusetobj_strprint(ipi_pbuf, &cpus), ids); else panic("%s: couldn't send IPI (cpus=%s ids=0x%lu)", - __func__, cpusetobj_strprint(pbuf, &cpus), ids); + __func__, cpusetobj_strprint(ipi_pbuf, &cpus), ids); } static void @@ -760,7 +761,6 @@ jalapeno_ipi_single(u_int cpu, u_long d0 static void jalapeno_ipi_selected(cpuset_t cpus, u_long d0, u_long d1, u_long d2) { - char pbuf[CPUSETBUFSIZ]; register_t s; u_long ids; u_int cpu; @@ -775,13 +775,13 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l ("%s: outstanding dispatch", __func__)); ids = 0; - for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { + for (i = 0; i < IPI_RETRIES * smp_cpus; i++) { s = intr_disable(); stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0); stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1); stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2); membar(Sync); - for (cpu = 0; cpu < mp_ncpus; cpu++) { + for (cpu = 0; cpu < smp_cpus; cpu++) { if (CPU_ISSET(cpu, &cpus)) { stxa(AA_INTR_SEND | (cpuid_to_mid[cpu] << IDC_ITID_SHIFT), ASI_SDB_INTR_W, 0); @@ -795,7 +795,7 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l if ((ids & (IDR_CHEETAH_ALL_BUSY | IDR_CHEETAH_ALL_NACK)) == 0) return; - for (cpu = 0; cpu < mp_ncpus; cpu++) + for (cpu = 0; cpu < smp_cpus; cpu++) if (CPU_ISSET(cpu, &cpus)) if ((ids & (IDR_NACK << (2 * cpuid_to_mid[cpu]))) == 0) @@ -803,8 +803,8 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", - __func__, cpusetobj_strprint(pbuf, &cpus), ids); + __func__, cpusetobj_strprint(ipi_pbuf, &cpus), ids); else panic("%s: couldn't send IPI (cpus=%s ids=0x%lu)", - __func__, cpusetobj_strprint(pbuf, &cpus), ids); + __func__, cpusetobj_strprint(ipi_pbuf, &cpus), ids); } From owner-svn-src-stable-10@freebsd.org Sun Dec 27 15:18:02 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A2A3A52B30; Sun, 27 Dec 2015 15:18: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 58230144B; Sun, 27 Dec 2015 15:18: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 tBRFI1fi089220; Sun, 27 Dec 2015 15:18:01 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRFI167089219; Sun, 27 Dec 2015 15:18:01 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271518.tBRFI167089219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 15:18: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: r292775 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 15:18:02 -0000 Author: marius Date: Sun Dec 27 15:18:01 2015 New Revision: 292775 URL: https://svnweb.freebsd.org/changeset/base/292775 Log: MFC: r286785, r291088, r291120 - Reformat x86 bounce buffer synchronization code to reduce indentation. No functional change. - Avoid a NULL pointer dereference in bounce_bus_dmamap_sync() when the map has been created via bounce_bus_dmamem_alloc(). Even for coherent DMA - which bus_dmamem_alloc(9) typically is used for -, calling of bus_dmamap_sync(9) isn't optional. [1] - Avoid a NULL pointer dereference in bounce_bus_dmamap_unload() when the map has been created via bounce_bus_dmamem_alloc(). In that case bus_dmamap_unload(9) typically isn't called during normal operation but still should be during detach, cleanup from failed attach etc. [2] PR: 188899 (non-original problem) [1] Submitted by: yongari [2] Modified: stable/10/sys/x86/x86/busdma_bounce.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/busdma_bounce.c ============================================================================== --- stable/10/sys/x86/x86/busdma_bounce.c Sun Dec 27 14:53:31 2015 (r292774) +++ stable/10/sys/x86/x86/busdma_bounce.c Sun Dec 27 15:18:01 2015 (r292775) @@ -751,6 +751,9 @@ bounce_bus_dmamap_unload(bus_dma_tag_t d { struct bounce_page *bpage; + if (map == NULL) + return; + while ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { STAILQ_REMOVE_HEAD(&map->bpages, links); free_bounce_page(dmat, bpage); @@ -763,47 +766,43 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma { struct bounce_page *bpage; - if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - /* - * Handle data bouncing. We might also - * want to add support for invalidating - * the caches on broken hardware - */ - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x " - "performing bounce", __func__, dmat, - dmat->common.flags, op); - - if ((op & BUS_DMASYNC_PREWRITE) != 0) { - while (bpage != NULL) { - if (bpage->datavaddr != 0) { - bcopy((void *)bpage->datavaddr, - (void *)bpage->vaddr, - bpage->datacount); - } else { - physcopyout(bpage->dataaddr, - (void *)bpage->vaddr, - bpage->datacount); - } - bpage = STAILQ_NEXT(bpage, links); + if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL) + return; + + /* + * Handle data bouncing. We might also want to add support for + * invalidating the caches on broken hardware. + */ + CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x " + "performing bounce", __func__, dmat, dmat->common.flags, op); + + if ((op & BUS_DMASYNC_PREWRITE) != 0) { + while (bpage != NULL) { + if (bpage->datavaddr != 0) { + bcopy((void *)bpage->datavaddr, + (void *)bpage->vaddr, bpage->datacount); + } else { + physcopyout(bpage->dataaddr, + (void *)bpage->vaddr, bpage->datacount); } - dmat->bounce_zone->total_bounced++; + bpage = STAILQ_NEXT(bpage, links); } + dmat->bounce_zone->total_bounced++; + } - if ((op & BUS_DMASYNC_POSTREAD) != 0) { - while (bpage != NULL) { - if (bpage->datavaddr != 0) { - bcopy((void *)bpage->vaddr, - (void *)bpage->datavaddr, - bpage->datacount); - } else { - physcopyin((void *)bpage->vaddr, - bpage->dataaddr, - bpage->datacount); - } - bpage = STAILQ_NEXT(bpage, links); + if ((op & BUS_DMASYNC_POSTREAD) != 0) { + while (bpage != NULL) { + if (bpage->datavaddr != 0) { + bcopy((void *)bpage->vaddr, + (void *)bpage->datavaddr, + bpage->datacount); + } else { + physcopyin((void *)bpage->vaddr, + bpage->dataaddr, bpage->datacount); } - dmat->bounce_zone->total_bounced++; + bpage = STAILQ_NEXT(bpage, links); } + dmat->bounce_zone->total_bounced++; } } @@ -822,12 +821,14 @@ SYSINIT(bpages, SI_SUB_LOCK, SI_ORDER_AN static struct sysctl_ctx_list * busdma_sysctl_tree(struct bounce_zone *bz) { + return (&bz->sysctl_tree); } static struct sysctl_oid * busdma_sysctl_tree_top(struct bounce_zone *bz) { + return (bz->sysctl_tree_top); } From owner-svn-src-stable-10@freebsd.org Sun Dec 27 15:30:15 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45000A52FD5; Sun, 27 Dec 2015 15:30:15 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9D701B34; Sun, 27 Dec 2015 15:30:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRFUDsP092369; Sun, 27 Dec 2015 15:30:13 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRFUDmA092367; Sun, 27 Dec 2015 15:30:13 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512271530.tBRFUDmA092367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 27 Dec 2015 15:30: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: r292776 - stable/10/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 15:30:15 -0000 Author: jilles Date: Sun Dec 27 15:30:13 2015 New Revision: 292776 URL: https://svnweb.freebsd.org/changeset/base/292776 Log: MFC r292513: clock_gettime(2),gettimeofday(2): Remove [EFAULT] error. Depending on system configuration and parameters, clock_gettime() and gettimeofday() may not be system calls. If so, passing an invalid pointer will cause a signal and not an [EFAULT] error. From a standards perspective, this is OK since passing an invalid pointer is undefined behaviour. Modified: stable/10/lib/libc/sys/clock_gettime.2 stable/10/lib/libc/sys/gettimeofday.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/clock_gettime.2 ============================================================================== --- stable/10/lib/libc/sys/clock_gettime.2 Sun Dec 27 15:18:01 2015 (r292775) +++ stable/10/lib/libc/sys/clock_gettime.2 Sun Dec 27 15:30:13 2015 (r292776) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 29, 2009 +.Dd December 20, 2015 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -136,10 +136,6 @@ The .Fa clock_id argument was not a valid value. -.It Bq Er EFAULT -The -.Fa *tp -argument address referenced invalid memory. .It Bq Er EPERM A user other than the super-user attempted to set the time. .El Modified: stable/10/lib/libc/sys/gettimeofday.2 ============================================================================== --- stable/10/lib/libc/sys/gettimeofday.2 Sun Dec 27 15:18:01 2015 (r292775) +++ stable/10/lib/libc/sys/gettimeofday.2 Sun Dec 27 15:30:13 2015 (r292776) @@ -28,7 +28,7 @@ .\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95 .\" $FreeBSD$ .\" -.Dd May 26, 1995 +.Dd December 20, 2015 .Dt GETTIMEOFDAY 2 .Os .Sh NAME @@ -110,8 +110,6 @@ system call even when the system is secu The following error codes may be set in .Va errno : .Bl -tag -width Er -.It Bq Er EFAULT -An argument address referenced invalid memory. .It Bq Er EPERM A user other than the super-user attempted to set the time. .El From owner-svn-src-stable-10@freebsd.org Sun Dec 27 17:12:56 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DE42A52EB2; Sun, 27 Dec 2015 17:12:56 +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 C136C1CE6; Sun, 27 Dec 2015 17:12:55 +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 tBRHCtd8025820; Sun, 27 Dec 2015 17:12:55 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRHCsX7025812; Sun, 27 Dec 2015 17:12:54 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271712.tBRHCsX7025812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 17:12: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: r292780 - in stable/10/sys: conf dev/mii dev/re dev/rl modules/rl pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 17:12:56 -0000 Author: marius Date: Sun Dec 27 17:12:54 2015 New Revision: 292780 URL: https://svnweb.freebsd.org/changeset/base/292780 Log: MFC: r271864 Move rl(4) to dev/rl. Added: stable/10/sys/dev/rl/ - copied from r271864, head/sys/dev/rl/ Replaced: stable/10/sys/dev/rl/if_rl.c - copied, changed from r292779, stable/10/sys/pci/if_rl.c stable/10/sys/dev/rl/if_rlreg.h - copied unchanged from r292779, stable/10/sys/pci/if_rlreg.h Deleted: stable/10/sys/pci/if_rl.c stable/10/sys/pci/if_rlreg.h Modified: stable/10/sys/conf/files stable/10/sys/dev/mii/rgephy.c stable/10/sys/dev/mii/rlphy.c stable/10/sys/dev/mii/rlswitch.c stable/10/sys/dev/re/if_re.c stable/10/sys/modules/rl/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Sun Dec 27 17:09:23 2015 (r292779) +++ stable/10/sys/conf/files Sun Dec 27 17:12:54 2015 (r292780) @@ -2211,6 +2211,7 @@ dev/random/hash.c optional random dev/random/rwfile.c optional random dev/rc/rc.c optional rc dev/re/if_re.c optional re +dev/rl/if_rl.c optional rl pci dev/rndtest/rndtest.c optional rndtest dev/rp/rp.c optional rp dev/rp/rp_isa.c optional rp isa @@ -3995,7 +3996,6 @@ opencrypto/xform.c optional crypto pci/alpm.c optional alpm pci pci/amdpm.c optional amdpm pci | nfpm pci pci/amdsmb.c optional amdsmb pci -pci/if_rl.c optional rl pci pci/intpm.c optional intpm pci pci/ncr.c optional ncr pci \ compile-with "${NORMAL_C} -Wno-unused" Modified: stable/10/sys/dev/mii/rgephy.c ============================================================================== --- stable/10/sys/dev/mii/rgephy.c Sun Dec 27 17:09:23 2015 (r292779) +++ stable/10/sys/dev/mii/rgephy.c Sun Dec 27 17:12:54 2015 (r292780) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" #include -#include +#include static int rgephy_probe(device_t); static int rgephy_attach(device_t); Modified: stable/10/sys/dev/mii/rlphy.c ============================================================================== --- stable/10/sys/dev/mii/rlphy.c Sun Dec 27 17:09:23 2015 (r292779) +++ stable/10/sys/dev/mii/rlphy.c Sun Dec 27 17:12:54 2015 (r292780) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include "miidevs.h" #include -#include +#include #include "miibus_if.h" Modified: stable/10/sys/dev/mii/rlswitch.c ============================================================================== --- stable/10/sys/dev/mii/rlswitch.c Sun Dec 27 17:09:23 2015 (r292779) +++ stable/10/sys/dev/mii/rlswitch.c Sun Dec 27 17:12:54 2015 (r292780) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include "miidevs.h" #include -#include +#include #include "miibus_if.h" Modified: stable/10/sys/dev/re/if_re.c ============================================================================== --- stable/10/sys/dev/re/if_re.c Sun Dec 27 17:09:23 2015 (r292779) +++ stable/10/sys/dev/re/if_re.c Sun Dec 27 17:12:54 2015 (r292780) @@ -147,7 +147,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include MODULE_DEPEND(re, pci, 1, 1, 1); MODULE_DEPEND(re, ether, 1, 1, 1); Copied and modified: stable/10/sys/dev/rl/if_rl.c (from r292779, stable/10/sys/pci/if_rl.c) ============================================================================== --- stable/10/sys/pci/if_rl.c Sun Dec 27 17:09:23 2015 (r292779, copy source) +++ stable/10/sys/dev/rl/if_rl.c Sun Dec 27 17:12:54 2015 (r292780) @@ -126,7 +126,7 @@ MODULE_DEPEND(rl, miibus, 1, 1, 1); /* "device miibus" required. See GENERIC if you get errors here. */ #include "miibus_if.h" -#include +#include /* * Various supported device vendors/types and their names. Copied: stable/10/sys/dev/rl/if_rlreg.h (from r292779, stable/10/sys/pci/if_rlreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/rl/if_rlreg.h Sun Dec 27 17:12:54 2015 (r292780, copy of r292779, stable/10/sys/pci/if_rlreg.h) @@ -0,0 +1,1160 @@ +/*- + * Copyright (c) 1997, 1998-2003 + * Bill Paul . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD + * 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$ + */ + +/* + * RealTek 8129/8139 register offsets + */ +#define RL_IDR0 0x0000 /* ID register 0 (station addr) */ +#define RL_IDR1 0x0001 /* Must use 32-bit accesses (?) */ +#define RL_IDR2 0x0002 +#define RL_IDR3 0x0003 +#define RL_IDR4 0x0004 +#define RL_IDR5 0x0005 + /* 0006-0007 reserved */ +#define RL_MAR0 0x0008 /* Multicast hash table */ +#define RL_MAR1 0x0009 +#define RL_MAR2 0x000A +#define RL_MAR3 0x000B +#define RL_MAR4 0x000C +#define RL_MAR5 0x000D +#define RL_MAR6 0x000E +#define RL_MAR7 0x000F + +#define RL_TXSTAT0 0x0010 /* status of TX descriptor 0 */ +#define RL_TXSTAT1 0x0014 /* status of TX descriptor 1 */ +#define RL_TXSTAT2 0x0018 /* status of TX descriptor 2 */ +#define RL_TXSTAT3 0x001C /* status of TX descriptor 3 */ + +#define RL_TXADDR0 0x0020 /* address of TX descriptor 0 */ +#define RL_TXADDR1 0x0024 /* address of TX descriptor 1 */ +#define RL_TXADDR2 0x0028 /* address of TX descriptor 2 */ +#define RL_TXADDR3 0x002C /* address of TX descriptor 3 */ + +#define RL_RXADDR 0x0030 /* RX ring start address */ +#define RL_RX_EARLY_BYTES 0x0034 /* RX early byte count */ +#define RL_RX_EARLY_STAT 0x0036 /* RX early status */ +#define RL_COMMAND 0x0037 /* command register */ +#define RL_CURRXADDR 0x0038 /* current address of packet read */ +#define RL_CURRXBUF 0x003A /* current RX buffer address */ +#define RL_IMR 0x003C /* interrupt mask register */ +#define RL_ISR 0x003E /* interrupt status register */ +#define RL_TXCFG 0x0040 /* transmit config */ +#define RL_RXCFG 0x0044 /* receive config */ +#define RL_TIMERCNT 0x0048 /* timer count register */ +#define RL_MISSEDPKT 0x004C /* missed packet counter */ +#define RL_EECMD 0x0050 /* EEPROM command register */ + +/* RTL8139/RTL8139C+ only */ +#define RL_8139_CFG0 0x0051 /* config register #0 */ +#define RL_8139_CFG1 0x0052 /* config register #1 */ +#define RL_8139_CFG3 0x0059 /* config register #3 */ +#define RL_8139_CFG4 0x005A /* config register #4 */ +#define RL_8139_CFG5 0x00D8 /* config register #5 */ + +#define RL_CFG0 0x0051 /* config register #0 */ +#define RL_CFG1 0x0052 /* config register #1 */ +#define RL_CFG2 0x0053 /* config register #2 */ +#define RL_CFG3 0x0054 /* config register #3 */ +#define RL_CFG4 0x0055 /* config register #4 */ +#define RL_CFG5 0x0056 /* config register #5 */ + /* 0057 reserved */ +#define RL_MEDIASTAT 0x0058 /* media status register (8139) */ + /* 0059-005A reserved */ +#define RL_MII 0x005A /* 8129 chip only */ +#define RL_HALTCLK 0x005B +#define RL_MULTIINTR 0x005C /* multiple interrupt */ +#define RL_PCIREV 0x005E /* PCI revision value */ + /* 005F reserved */ +#define RL_TXSTAT_ALL 0x0060 /* TX status of all descriptors */ + +/* Direct PHY access registers only available on 8139 */ +#define RL_BMCR 0x0062 /* PHY basic mode control */ +#define RL_BMSR 0x0064 /* PHY basic mode status */ +#define RL_ANAR 0x0066 /* PHY autoneg advert */ +#define RL_LPAR 0x0068 /* PHY link partner ability */ +#define RL_ANER 0x006A /* PHY autoneg expansion */ + +#define RL_DISCCNT 0x006C /* disconnect counter */ +#define RL_FALSECAR 0x006E /* false carrier counter */ +#define RL_NWAYTST 0x0070 /* NWAY test register */ +#define RL_RX_ER 0x0072 /* RX_ER counter */ +#define RL_CSCFG 0x0074 /* CS configuration register */ + +/* + * When operating in special C+ mode, some of the registers in an + * 8139C+ chip have different definitions. These are also used for + * the 8169 gigE chip. + */ +#define RL_DUMPSTATS_LO 0x0010 /* counter dump command register */ +#define RL_DUMPSTATS_HI 0x0014 /* counter dump command register */ +#define RL_TXLIST_ADDR_LO 0x0020 /* 64 bits, 256 byte alignment */ +#define RL_TXLIST_ADDR_HI 0x0024 /* 64 bits, 256 byte alignment */ +#define RL_TXLIST_ADDR_HPRIO_LO 0x0028 /* 64 bits, 256 byte alignment */ +#define RL_TXLIST_ADDR_HPRIO_HI 0x002C /* 64 bits, 256 byte alignment */ +#define RL_CFG2 0x0053 +#define RL_TIMERINT 0x0054 /* interrupt on timer expire */ +#define RL_TXSTART 0x00D9 /* 8 bits */ +#define RL_CPLUS_CMD 0x00E0 /* 16 bits */ +#define RL_RXLIST_ADDR_LO 0x00E4 /* 64 bits, 256 byte alignment */ +#define RL_RXLIST_ADDR_HI 0x00E8 /* 64 bits, 256 byte alignment */ +#define RL_EARLY_TX_THRESH 0x00EC /* 8 bits */ + +/* + * Registers specific to the 8169 gigE chip + */ +#define RL_GTXSTART 0x0038 /* 8 bits */ +#define RL_TIMERINT_8169 0x0058 /* different offset than 8139 */ +#define RL_PHYAR 0x0060 +#define RL_TBICSR 0x0064 +#define RL_TBI_ANAR 0x0068 +#define RL_TBI_LPAR 0x006A +#define RL_GMEDIASTAT 0x006C /* 8 bits */ +#define RL_MACDBG 0x006D /* 8 bits, 8168C SPIN2 only */ +#define RL_GPIO 0x006E /* 8 bits, 8168C SPIN2 only */ +#define RL_PMCH 0x006F /* 8 bits */ +#define RL_MAXRXPKTLEN 0x00DA /* 16 bits, chip multiplies by 8 */ +#define RL_INTRMOD 0x00E2 /* 16 bits */ +#define RL_MISC 0x00F0 + +/* + * TX config register bits + */ +#define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ +#define RL_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RL_TXCFG_QUEUE_EMPTY 0x00000800 /* 8168E-VL or higher */ +#define RL_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ +#define RL_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ +#define RL_TXCFG_IFG2 0x00080000 /* 8169 only */ +#define RL_TXCFG_IFG 0x03000000 /* interframe gap */ +#define RL_TXCFG_HWREV 0x7CC00000 + +#define RL_LOOPTEST_OFF 0x00000000 +#define RL_LOOPTEST_ON 0x00020000 +#define RL_LOOPTEST_ON_CPLUS 0x00060000 + +/* Known revision codes. */ +#define RL_HWREV_8169 0x00000000 +#define RL_HWREV_8169S 0x00800000 +#define RL_HWREV_8110S 0x04000000 +#define RL_HWREV_8169_8110SB 0x10000000 +#define RL_HWREV_8169_8110SC 0x18000000 +#define RL_HWREV_8401E 0x24000000 +#define RL_HWREV_8102EL 0x24800000 +#define RL_HWREV_8102EL_SPIN1 0x24C00000 +#define RL_HWREV_8168D 0x28000000 +#define RL_HWREV_8168DP 0x28800000 +#define RL_HWREV_8168E 0x2C000000 +#define RL_HWREV_8168E_VL 0x2C800000 +#define RL_HWREV_8168B_SPIN1 0x30000000 +#define RL_HWREV_8100E 0x30800000 +#define RL_HWREV_8101E 0x34000000 +#define RL_HWREV_8102E 0x34800000 +#define RL_HWREV_8103E 0x34C00000 +#define RL_HWREV_8168B_SPIN2 0x38000000 +#define RL_HWREV_8168B_SPIN3 0x38400000 +#define RL_HWREV_8168C 0x3C000000 +#define RL_HWREV_8168C_SPIN2 0x3C400000 +#define RL_HWREV_8168CP 0x3C800000 +#define RL_HWREV_8105E 0x40800000 +#define RL_HWREV_8105E_SPIN1 0x40C00000 +#define RL_HWREV_8402 0x44000000 +#define RL_HWREV_8106E 0x44800000 +#define RL_HWREV_8168F 0x48000000 +#define RL_HWREV_8411 0x48800000 +#define RL_HWREV_8168G 0x4C000000 +#define RL_HWREV_8168EP 0x50000000 +#define RL_HWREV_8168GU 0x50800000 +#define RL_HWREV_8411B 0x5C800000 +#define RL_HWREV_8139 0x60000000 +#define RL_HWREV_8139A 0x70000000 +#define RL_HWREV_8139AG 0x70800000 +#define RL_HWREV_8139B 0x78000000 +#define RL_HWREV_8130 0x7C000000 +#define RL_HWREV_8139C 0x74000000 +#define RL_HWREV_8139D 0x74400000 +#define RL_HWREV_8139CPLUS 0x74800000 +#define RL_HWREV_8101 0x74C00000 +#define RL_HWREV_8100 0x78800000 +#define RL_HWREV_8169_8110SBL 0x7CC00000 +#define RL_HWREV_8169_8110SCE 0x98000000 + +#define RL_TXDMA_16BYTES 0x00000000 +#define RL_TXDMA_32BYTES 0x00000100 +#define RL_TXDMA_64BYTES 0x00000200 +#define RL_TXDMA_128BYTES 0x00000300 +#define RL_TXDMA_256BYTES 0x00000400 +#define RL_TXDMA_512BYTES 0x00000500 +#define RL_TXDMA_1024BYTES 0x00000600 +#define RL_TXDMA_2048BYTES 0x00000700 + +/* + * Transmit descriptor status register bits. + */ +#define RL_TXSTAT_LENMASK 0x00001FFF +#define RL_TXSTAT_OWN 0x00002000 +#define RL_TXSTAT_TX_UNDERRUN 0x00004000 +#define RL_TXSTAT_TX_OK 0x00008000 +#define RL_TXSTAT_EARLY_THRESH 0x003F0000 +#define RL_TXSTAT_COLLCNT 0x0F000000 +#define RL_TXSTAT_CARR_HBEAT 0x10000000 +#define RL_TXSTAT_OUTOFWIN 0x20000000 +#define RL_TXSTAT_TXABRT 0x40000000 +#define RL_TXSTAT_CARRLOSS 0x80000000 + +/* + * Interrupt status register bits. + */ +#define RL_ISR_RX_OK 0x0001 +#define RL_ISR_RX_ERR 0x0002 +#define RL_ISR_TX_OK 0x0004 +#define RL_ISR_TX_ERR 0x0008 +#define RL_ISR_RX_OVERRUN 0x0010 +#define RL_ISR_PKT_UNDERRUN 0x0020 +#define RL_ISR_LINKCHG 0x0020 /* 8169 only */ +#define RL_ISR_FIFO_OFLOW 0x0040 /* 8139 only */ +#define RL_ISR_TX_DESC_UNAVAIL 0x0080 /* C+ only */ +#define RL_ISR_SWI 0x0100 /* C+ only */ +#define RL_ISR_CABLE_LEN_CHGD 0x2000 +#define RL_ISR_PCS_TIMEOUT 0x4000 /* 8129 only */ +#define RL_ISR_TIMEOUT_EXPIRED 0x4000 +#define RL_ISR_SYSTEM_ERR 0x8000 + +#define RL_INTRS \ + (RL_ISR_TX_OK|RL_ISR_RX_OK|RL_ISR_RX_ERR|RL_ISR_TX_ERR| \ + RL_ISR_RX_OVERRUN|RL_ISR_PKT_UNDERRUN|RL_ISR_FIFO_OFLOW| \ + RL_ISR_PCS_TIMEOUT|RL_ISR_SYSTEM_ERR) + +#ifdef RE_TX_MODERATION +#define RL_INTRS_CPLUS \ + (RL_ISR_RX_OK|RL_ISR_RX_ERR|RL_ISR_TX_ERR| \ + RL_ISR_RX_OVERRUN|RL_ISR_PKT_UNDERRUN|RL_ISR_FIFO_OFLOW| \ + RL_ISR_PCS_TIMEOUT|RL_ISR_SYSTEM_ERR|RL_ISR_TIMEOUT_EXPIRED) +#else +#define RL_INTRS_CPLUS \ + (RL_ISR_RX_OK|RL_ISR_RX_ERR|RL_ISR_TX_ERR|RL_ISR_TX_OK| \ + RL_ISR_RX_OVERRUN|RL_ISR_PKT_UNDERRUN|RL_ISR_FIFO_OFLOW| \ + RL_ISR_PCS_TIMEOUT|RL_ISR_SYSTEM_ERR|RL_ISR_TIMEOUT_EXPIRED) +#endif + +/* + * Media status register. (8139 only) + */ +#define RL_MEDIASTAT_RXPAUSE 0x01 +#define RL_MEDIASTAT_TXPAUSE 0x02 +#define RL_MEDIASTAT_LINK 0x04 +#define RL_MEDIASTAT_SPEED10 0x08 +#define RL_MEDIASTAT_RXFLOWCTL 0x40 /* duplex mode */ +#define RL_MEDIASTAT_TXFLOWCTL 0x80 /* duplex mode */ + +/* + * Receive config register. + */ +#define RL_RXCFG_RX_ALLPHYS 0x00000001 /* accept all nodes */ +#define RL_RXCFG_RX_INDIV 0x00000002 /* match filter */ +#define RL_RXCFG_RX_MULTI 0x00000004 /* accept all multicast */ +#define RL_RXCFG_RX_BROAD 0x00000008 /* accept all broadcast */ +#define RL_RXCFG_RX_RUNT 0x00000010 +#define RL_RXCFG_RX_ERRPKT 0x00000020 +#define RL_RXCFG_WRAP 0x00000080 +#define RL_RXCFG_EARLYOFFV2 0x00000800 +#define RL_RXCFG_MAXDMA 0x00000700 +#define RL_RXCFG_BUFSZ 0x00001800 +#define RL_RXCFG_EARLYOFF 0x00003800 +#define RL_RXCFG_FIFOTHRESH 0x0000E000 +#define RL_RXCFG_EARLYTHRESH 0x07000000 + +#define RL_RXDMA_16BYTES 0x00000000 +#define RL_RXDMA_32BYTES 0x00000100 +#define RL_RXDMA_64BYTES 0x00000200 +#define RL_RXDMA_128BYTES 0x00000300 +#define RL_RXDMA_256BYTES 0x00000400 +#define RL_RXDMA_512BYTES 0x00000500 +#define RL_RXDMA_1024BYTES 0x00000600 +#define RL_RXDMA_UNLIMITED 0x00000700 + +#define RL_RXBUF_8 0x00000000 +#define RL_RXBUF_16 0x00000800 +#define RL_RXBUF_32 0x00001000 +#define RL_RXBUF_64 0x00001800 + +#define RL_RXFIFO_16BYTES 0x00000000 +#define RL_RXFIFO_32BYTES 0x00002000 +#define RL_RXFIFO_64BYTES 0x00004000 +#define RL_RXFIFO_128BYTES 0x00006000 +#define RL_RXFIFO_256BYTES 0x00008000 +#define RL_RXFIFO_512BYTES 0x0000A000 +#define RL_RXFIFO_1024BYTES 0x0000C000 +#define RL_RXFIFO_NOTHRESH 0x0000E000 + +/* + * Bits in RX status header (included with RX'ed packet + * in ring buffer). + */ +#define RL_RXSTAT_RXOK 0x00000001 +#define RL_RXSTAT_ALIGNERR 0x00000002 +#define RL_RXSTAT_CRCERR 0x00000004 +#define RL_RXSTAT_GIANT 0x00000008 +#define RL_RXSTAT_RUNT 0x00000010 +#define RL_RXSTAT_BADSYM 0x00000020 +#define RL_RXSTAT_BROAD 0x00002000 +#define RL_RXSTAT_INDIV 0x00004000 +#define RL_RXSTAT_MULTI 0x00008000 +#define RL_RXSTAT_LENMASK 0xFFFF0000 +#define RL_RXSTAT_UNFINISHED 0x0000FFF0 /* DMA still in progress */ + +/* + * Command register. + */ +#define RL_CMD_EMPTY_RXBUF 0x0001 +#define RL_CMD_TX_ENB 0x0004 +#define RL_CMD_RX_ENB 0x0008 +#define RL_CMD_RESET 0x0010 +#define RL_CMD_STOPREQ 0x0080 + +/* + * Twister register values. These are completely undocumented and derived + * from public sources. + */ +#define RL_CSCFG_LINK_OK 0x0400 +#define RL_CSCFG_CHANGE 0x0800 +#define RL_CSCFG_STATUS 0xf000 +#define RL_CSCFG_ROW3 0x7000 +#define RL_CSCFG_ROW2 0x3000 +#define RL_CSCFG_ROW1 0x1000 +#define RL_CSCFG_LINK_DOWN_OFF_CMD 0x03c0 +#define RL_CSCFG_LINK_DOWN_CMD 0xf3c0 + +#define RL_NWAYTST_RESET 0 +#define RL_NWAYTST_CBL_TEST 0x20 + +#define RL_PARA78 0x78 +#define RL_PARA78_DEF 0x78fa8388 +#define RL_PARA7C 0x7C +#define RL_PARA7C_DEF 0xcb38de43 +#define RL_PARA7C_RETUNE 0xfb38de03 + +/* + * EEPROM control register + */ +#define RL_EE_DATAOUT 0x01 /* Data out */ +#define RL_EE_DATAIN 0x02 /* Data in */ +#define RL_EE_CLK 0x04 /* clock */ +#define RL_EE_SEL 0x08 /* chip select */ +#define RL_EE_MODE (0x40|0x80) + +#define RL_EEMODE_OFF 0x00 +#define RL_EEMODE_AUTOLOAD 0x40 +#define RL_EEMODE_PROGRAM 0x80 +#define RL_EEMODE_WRITECFG (0x80|0x40) + +/* 9346 EEPROM commands */ +#define RL_9346_ADDR_LEN 6 /* 93C46 1K: 128x16 */ +#define RL_9356_ADDR_LEN 8 /* 93C56 2K: 256x16 */ + +#define RL_9346_WRITE 0x5 +#define RL_9346_READ 0x6 +#define RL_9346_ERASE 0x7 +#define RL_9346_EWEN 0x4 +#define RL_9346_EWEN_ADDR 0x30 +#define RL_9456_EWDS 0x4 +#define RL_9346_EWDS_ADDR 0x00 + +#define RL_EECMD_WRITE 0x140 +#define RL_EECMD_READ_6BIT 0x180 +#define RL_EECMD_READ_8BIT 0x600 +#define RL_EECMD_ERASE 0x1c0 + +#define RL_EE_ID 0x00 +#define RL_EE_PCI_VID 0x01 +#define RL_EE_PCI_DID 0x02 +/* Location of station address inside EEPROM */ +#define RL_EE_EADDR 0x07 + +/* + * MII register (8129 only) + */ +#define RL_MII_CLK 0x01 +#define RL_MII_DATAIN 0x02 +#define RL_MII_DATAOUT 0x04 +#define RL_MII_DIR 0x80 /* 0 == input, 1 == output */ + +/* + * Config 0 register + */ +#define RL_CFG0_ROM0 0x01 +#define RL_CFG0_ROM1 0x02 +#define RL_CFG0_ROM2 0x04 +#define RL_CFG0_PL0 0x08 +#define RL_CFG0_PL1 0x10 +#define RL_CFG0_10MBPS 0x20 /* 10 Mbps internal mode */ +#define RL_CFG0_PCS 0x40 +#define RL_CFG0_SCR 0x80 + +/* + * Config 1 register + */ +#define RL_CFG1_PWRDWN 0x01 +#define RL_CFG1_PME 0x01 +#define RL_CFG1_SLEEP 0x02 +#define RL_CFG1_VPDEN 0x02 +#define RL_CFG1_IOMAP 0x04 +#define RL_CFG1_MEMMAP 0x08 +#define RL_CFG1_RSVD 0x10 +#define RL_CFG1_LWACT 0x10 +#define RL_CFG1_DRVLOAD 0x20 +#define RL_CFG1_LED0 0x40 +#define RL_CFG1_FULLDUPLEX 0x40 /* 8129 only */ +#define RL_CFG1_LED1 0x80 + +/* + * Config 2 register + */ +#define RL_CFG2_PCI33MHZ 0x00 +#define RL_CFG2_PCI66MHZ 0x01 +#define RL_CFG2_PCI64BIT 0x08 +#define RL_CFG2_AUXPWR 0x10 +#define RL_CFG2_MSI 0x20 + +/* + * Config 3 register + */ +#define RL_CFG3_GRANTSEL 0x80 +#define RL_CFG3_WOL_MAGIC 0x20 +#define RL_CFG3_WOL_LINK 0x10 +#define RL_CFG3_JUMBO_EN0 0x04 /* RTL8168C or later. */ +#define RL_CFG3_FAST_B2B 0x01 + +/* + * Config 4 register + */ +#define RL_CFG4_LWPTN 0x04 +#define RL_CFG4_LWPME 0x10 +#define RL_CFG4_JUMBO_EN1 0x02 /* RTL8168C or later. */ + +/* + * Config 5 register + */ +#define RL_CFG5_WOL_BCAST 0x40 +#define RL_CFG5_WOL_MCAST 0x20 +#define RL_CFG5_WOL_UCAST 0x10 +#define RL_CFG5_WOL_LANWAKE 0x02 +#define RL_CFG5_PME_STS 0x01 + +/* + * 8139C+ register definitions + */ + +/* RL_DUMPSTATS_LO register */ +#define RL_DUMPSTATS_START 0x00000008 + +/* Transmit start register */ +#define RL_TXSTART_SWI 0x01 /* generate TX interrupt */ +#define RL_TXSTART_START 0x40 /* start normal queue transmit */ +#define RL_TXSTART_HPRIO_START 0x80 /* start hi prio queue transmit */ + +/* + * Config 2 register, 8139C+/8169/8169S/8110S only + */ +#define RL_CFG2_BUSFREQ 0x07 +#define RL_CFG2_BUSWIDTH 0x08 +#define RL_CFG2_AUXPWRSTS 0x10 + +#define RL_BUSFREQ_33MHZ 0x00 +#define RL_BUSFREQ_66MHZ 0x01 + +#define RL_BUSWIDTH_32BITS 0x00 +#define RL_BUSWIDTH_64BITS 0x08 + +/* C+ mode command register */ +#define RL_CPLUSCMD_TXENB 0x0001 /* enable C+ transmit mode */ +#define RL_CPLUSCMD_RXENB 0x0002 /* enable C+ receive mode */ +#define RL_CPLUSCMD_PCI_MRW 0x0008 /* enable PCI multi-read/write */ +#define RL_CPLUSCMD_PCI_DAC 0x0010 /* PCI dual-address cycle only */ +#define RL_CPLUSCMD_RXCSUM_ENB 0x0020 /* enable RX checksum offload */ +#define RL_CPLUSCMD_VLANSTRIP 0x0040 /* enable VLAN tag stripping */ +#define RL_CPLUSCMD_MACSTAT_DIS 0x0080 /* 8168B/C/CP */ +#define RL_CPLUSCMD_ASF 0x0100 /* 8168C/CP */ +#define RL_CPLUSCMD_DBG_SEL 0x0200 /* 8168C/CP */ +#define RL_CPLUSCMD_FORCE_TXFC 0x0400 /* 8168C/CP */ +#define RL_CPLUSCMD_FORCE_RXFC 0x0800 /* 8168C/CP */ +#define RL_CPLUSCMD_FORCE_HDPX 0x1000 /* 8168C/CP */ +#define RL_CPLUSCMD_NORMAL_MODE 0x2000 /* 8168C/CP */ +#define RL_CPLUSCMD_DBG_ENB 0x4000 /* 8168C/CP */ +#define RL_CPLUSCMD_BIST_ENB 0x8000 /* 8168C/CP */ + +/* C+ early transmit threshold */ +#define RL_EARLYTXTHRESH_CNT 0x003F /* byte count times 8 */ + +/* Timer interrupt register */ +#define RL_TIMERINT_8169_VAL 0x00001FFF +#define RL_TIMER_MIN 0 +#define RL_TIMER_MAX 65 /* 65.528us */ +#define RL_TIMER_DEFAULT RL_TIMER_MAX +#define RL_TIMER_PCIE_CLK 125 /* 125MHZ */ +#define RL_USECS(x) ((x) * RL_TIMER_PCIE_CLK) + +/* + * Gigabit PHY access register (8169 only) + */ +#define RL_PHYAR_PHYDATA 0x0000FFFF +#define RL_PHYAR_PHYREG 0x001F0000 +#define RL_PHYAR_BUSY 0x80000000 + +/* + * Gigabit media status (8169 only) + */ +#define RL_GMEDIASTAT_FDX 0x01 /* full duplex */ +#define RL_GMEDIASTAT_LINK 0x02 /* link up */ +#define RL_GMEDIASTAT_10MBPS 0x04 /* 10mps link */ +#define RL_GMEDIASTAT_100MBPS 0x08 /* 100mbps link */ +#define RL_GMEDIASTAT_1000MBPS 0x10 /* gigE link */ +#define RL_GMEDIASTAT_RXFLOW 0x20 /* RX flow control on */ +#define RL_GMEDIASTAT_TXFLOW 0x40 /* TX flow control on */ +#define RL_GMEDIASTAT_TBI 0x80 /* TBI enabled */ + +/* + * The RealTek doesn't use a fragment-based descriptor mechanism. + * Instead, there are only four register sets, each or which represents + * one 'descriptor.' Basically, each TX descriptor is just a contiguous + * packet buffer (32-bit aligned!) and we place the buffer addresses in + * the registers so the chip knows where they are. + * + * We can sort of kludge together the same kind of buffer management + * used in previous drivers, but we have to do buffer copies almost all + * the time, so it doesn't really buy us much. + * + * For reception, there's just one large buffer where the chip stores + * all received packets. + */ +#define RL_RX_BUF_SZ RL_RXBUF_64 +#define RL_RXBUFLEN (1 << ((RL_RX_BUF_SZ >> 11) + 13)) +#define RL_TX_LIST_CNT 4 +#define RL_MIN_FRAMELEN 60 +#define RL_TX_8139_BUF_ALIGN 4 +#define RL_RX_8139_BUF_ALIGN 8 +#define RL_RX_8139_BUF_RESERVE sizeof(int64_t) +#define RL_RX_8139_BUF_GUARD_SZ \ + (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN + RL_RX_8139_BUF_RESERVE) +#define RL_TXTHRESH(x) ((x) << 11) +#define RL_TX_THRESH_INIT 96 +#define RL_RX_FIFOTHRESH RL_RXFIFO_NOTHRESH +#define RL_RX_MAXDMA RL_RXDMA_UNLIMITED +#define RL_TX_MAXDMA RL_TXDMA_2048BYTES + +#define RL_RXCFG_CONFIG (RL_RX_FIFOTHRESH|RL_RX_MAXDMA|RL_RX_BUF_SZ) +#define RL_TXCFG_CONFIG (RL_TXCFG_IFG|RL_TX_MAXDMA) + +#define RL_ETHER_ALIGN 2 + +/* + * re(4) hardware ip4csum-tx could be mangled with 28 bytes or less IP packets. + */ +#define RL_IP4CSUMTX_MINLEN 28 +#define RL_IP4CSUMTX_PADLEN (ETHER_HDR_LEN + RL_IP4CSUMTX_MINLEN) + +struct rl_chain_data { + uint16_t cur_rx; + uint8_t *rl_rx_buf; + uint8_t *rl_rx_buf_ptr; + + struct mbuf *rl_tx_chain[RL_TX_LIST_CNT]; + bus_dmamap_t rl_tx_dmamap[RL_TX_LIST_CNT]; + bus_dma_tag_t rl_tx_tag; + bus_dma_tag_t rl_rx_tag; + bus_dmamap_t rl_rx_dmamap; + bus_addr_t rl_rx_buf_paddr; + uint8_t last_tx; + uint8_t cur_tx; +}; + +#define RL_INC(x) (x = (x + 1) % RL_TX_LIST_CNT) +#define RL_CUR_TXADDR(x) ((x->rl_cdata.cur_tx * 4) + RL_TXADDR0) +#define RL_CUR_TXSTAT(x) ((x->rl_cdata.cur_tx * 4) + RL_TXSTAT0) +#define RL_CUR_TXMBUF(x) (x->rl_cdata.rl_tx_chain[x->rl_cdata.cur_tx]) +#define RL_CUR_DMAMAP(x) (x->rl_cdata.rl_tx_dmamap[x->rl_cdata.cur_tx]) +#define RL_LAST_TXADDR(x) ((x->rl_cdata.last_tx * 4) + RL_TXADDR0) +#define RL_LAST_TXSTAT(x) ((x->rl_cdata.last_tx * 4) + RL_TXSTAT0) +#define RL_LAST_TXMBUF(x) (x->rl_cdata.rl_tx_chain[x->rl_cdata.last_tx]) +#define RL_LAST_DMAMAP(x) (x->rl_cdata.rl_tx_dmamap[x->rl_cdata.last_tx]) + +struct rl_type { + uint16_t rl_vid; + uint16_t rl_did; + int rl_basetype; + const char *rl_name; +}; + +struct rl_hwrev { + uint32_t rl_rev; + int rl_type; + const char *rl_desc; + int rl_max_mtu; +}; + +#define RL_8129 1 +#define RL_8139 2 +#define RL_8139CPLUS 3 +#define RL_8169 4 + +#define RL_ISCPLUS(x) ((x)->rl_type == RL_8139CPLUS || \ + (x)->rl_type == RL_8169) + +/* + * The 8139C+ and 8160 gigE chips support descriptor-based TX + * and RX. In fact, they even support TCP large send. Descriptors + * must be allocated in contiguous blocks that are aligned on a + * 256-byte boundary. The rings can hold a maximum of 64 descriptors. + */ + +/* + * RX/TX descriptor definition. When large send mode is enabled, the + * lower 11 bits of the TX rl_cmdstat word are used to hold the MSS, and + * the checksum offload bits are disabled. The structure layout is + * the same for RX and TX descriptors + */ +struct rl_desc { + uint32_t rl_cmdstat; + uint32_t rl_vlanctl; + uint32_t rl_bufaddr_lo; + uint32_t rl_bufaddr_hi; +}; + +#define RL_TDESC_CMD_FRAGLEN 0x0000FFFF +#define RL_TDESC_CMD_TCPCSUM 0x00010000 /* TCP checksum enable */ +#define RL_TDESC_CMD_UDPCSUM 0x00020000 /* UDP checksum enable */ +#define RL_TDESC_CMD_IPCSUM 0x00040000 /* IP header checksum enable */ +#define RL_TDESC_CMD_MSSVAL 0x07FF0000 /* Large send MSS value */ +#define RL_TDESC_CMD_MSSVAL_SHIFT 16 /* Large send MSS value shift */ +#define RL_TDESC_CMD_LGSEND 0x08000000 /* TCP large send enb */ +#define RL_TDESC_CMD_EOF 0x10000000 /* end of frame marker */ +#define RL_TDESC_CMD_SOF 0x20000000 /* start of frame marker */ +#define RL_TDESC_CMD_EOR 0x40000000 /* end of ring marker */ +#define RL_TDESC_CMD_OWN 0x80000000 /* chip owns descriptor */ + +#define RL_TDESC_VLANCTL_TAG 0x00020000 /* Insert VLAN tag */ +#define RL_TDESC_VLANCTL_DATA 0x0000FFFF /* TAG data */ +/* RTL8168C/RTL8168CP/RTL8111C/RTL8111CP */ +#define RL_TDESC_CMD_UDPCSUMV2 0x80000000 +#define RL_TDESC_CMD_TCPCSUMV2 0x40000000 +#define RL_TDESC_CMD_IPCSUMV2 0x20000000 +#define RL_TDESC_CMD_MSSVALV2 0x1FFC0000 +#define RL_TDESC_CMD_MSSVALV2_SHIFT 18 + +/* + * Error bits are valid only on the last descriptor of a frame + * (i.e. RL_TDESC_CMD_EOF == 1) + */ +#define RL_TDESC_STAT_COLCNT 0x000F0000 /* collision count */ +#define RL_TDESC_STAT_EXCESSCOL 0x00100000 /* excessive collisions */ +#define RL_TDESC_STAT_LINKFAIL 0x00200000 /* link faulure */ +#define RL_TDESC_STAT_OWINCOL 0x00400000 /* out-of-window collision */ +#define RL_TDESC_STAT_TXERRSUM 0x00800000 /* transmit error summary */ +#define RL_TDESC_STAT_UNDERRUN 0x02000000 /* TX underrun occured */ +#define RL_TDESC_STAT_OWN 0x80000000 + +/* + * RX descriptor cmd/vlan definitions + */ +#define RL_RDESC_CMD_EOR 0x40000000 +#define RL_RDESC_CMD_OWN 0x80000000 +#define RL_RDESC_CMD_BUFLEN 0x00001FFF + +#define RL_RDESC_STAT_OWN 0x80000000 +#define RL_RDESC_STAT_EOR 0x40000000 +#define RL_RDESC_STAT_SOF 0x20000000 +#define RL_RDESC_STAT_EOF 0x10000000 +#define RL_RDESC_STAT_FRALIGN 0x08000000 /* frame alignment error */ +#define RL_RDESC_STAT_MCAST 0x04000000 /* multicast pkt received */ +#define RL_RDESC_STAT_UCAST 0x02000000 /* unicast pkt received */ +#define RL_RDESC_STAT_BCAST 0x01000000 /* broadcast pkt received */ +#define RL_RDESC_STAT_BUFOFLOW 0x00800000 /* out of buffer space */ +#define RL_RDESC_STAT_FIFOOFLOW 0x00400000 /* FIFO overrun */ +#define RL_RDESC_STAT_GIANT 0x00200000 /* pkt > 4096 bytes */ +#define RL_RDESC_STAT_RXERRSUM 0x00100000 /* RX error summary */ +#define RL_RDESC_STAT_RUNT 0x00080000 /* runt packet received */ +#define RL_RDESC_STAT_CRCERR 0x00040000 /* CRC error */ +#define RL_RDESC_STAT_PROTOID 0x00030000 /* Protocol type */ +#define RL_RDESC_STAT_UDP 0x00020000 /* UDP, 8168C/CP, 8111C/CP */ +#define RL_RDESC_STAT_TCP 0x00010000 /* TCP, 8168C/CP, 8111C/CP */ +#define RL_RDESC_STAT_IPSUMBAD 0x00008000 /* IP header checksum bad */ +#define RL_RDESC_STAT_UDPSUMBAD 0x00004000 /* UDP checksum bad */ +#define RL_RDESC_STAT_TCPSUMBAD 0x00002000 /* TCP checksum bad */ +#define RL_RDESC_STAT_FRAGLEN 0x00001FFF /* RX'ed frame/frag len */ +#define RL_RDESC_STAT_GFRAGLEN 0x00003FFF /* RX'ed frame/frag len */ +#define RL_RDESC_STAT_ERRS (RL_RDESC_STAT_GIANT|RL_RDESC_STAT_RUNT| \ + RL_RDESC_STAT_CRCERR) + +#define RL_RDESC_VLANCTL_TAG 0x00010000 /* VLAN tag available + (rl_vlandata valid)*/ +#define RL_RDESC_VLANCTL_DATA 0x0000FFFF /* TAG data */ +/* RTL8168C/RTL8168CP/RTL8111C/RTL8111CP */ +#define RL_RDESC_IPV6 0x80000000 +#define RL_RDESC_IPV4 0x40000000 + +#define RL_PROTOID_NONIP 0x00000000 +#define RL_PROTOID_TCPIP 0x00010000 +#define RL_PROTOID_UDPIP 0x00020000 +#define RL_PROTOID_IP 0x00030000 +#define RL_TCPPKT(x) (((x) & RL_RDESC_STAT_PROTOID) == \ + RL_PROTOID_TCPIP) +#define RL_UDPPKT(x) (((x) & RL_RDESC_STAT_PROTOID) == \ + RL_PROTOID_UDPIP) + +/* + * Statistics counter structure (8139C+ and 8169 only) + */ +struct rl_stats { + uint64_t rl_tx_pkts; + uint64_t rl_rx_pkts; + uint64_t rl_tx_errs; + uint32_t rl_rx_errs; + uint16_t rl_missed_pkts; + uint16_t rl_rx_framealign_errs; + uint32_t rl_tx_onecoll; + uint32_t rl_tx_multicolls; + uint64_t rl_rx_ucasts; + uint64_t rl_rx_bcasts; + uint32_t rl_rx_mcasts; + uint16_t rl_tx_aborts; + uint16_t rl_rx_underruns; +}; + +/* + * Rx/Tx descriptor parameters (8139C+ and 8169 only) + * + * 8139C+ + * Number of descriptors supported : up to 64 + * Descriptor alignment : 256 bytes + * Tx buffer : At least 4 bytes in length. + * Rx buffer : At least 8 bytes in length and 8 bytes alignment required. + * + * 8169 + * Number of descriptors supported : up to 1024 + * Descriptor alignment : 256 bytes + * Tx buffer : At least 4 bytes in length. + * Rx buffer : At least 8 bytes in length and 8 bytes alignment required. + */ +#ifndef __NO_STRICT_ALIGNMENT +#define RE_FIXUP_RX 1 +#endif + +#define RL_8169_TX_DESC_CNT 256 +#define RL_8169_RX_DESC_CNT 256 +#define RL_8139_TX_DESC_CNT 64 +#define RL_8139_RX_DESC_CNT 64 +#define RL_TX_DESC_CNT RL_8169_TX_DESC_CNT +#define RL_RX_DESC_CNT RL_8169_RX_DESC_CNT +#define RL_RX_JUMBO_DESC_CNT RL_RX_DESC_CNT +#define RL_NTXSEGS 35 + +#define RL_RING_ALIGN 256 +#define RL_DUMP_ALIGN 64 +#define RL_IFQ_MAXLEN 512 +#define RL_TX_DESC_NXT(sc,x) ((x + 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1)) +#define RL_TX_DESC_PRV(sc,x) ((x - 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1)) +#define RL_RX_DESC_NXT(sc,x) ((x + 1) & ((sc)->rl_ldata.rl_rx_desc_cnt - 1)) +#define RL_OWN(x) (le32toh((x)->rl_cmdstat) & RL_RDESC_STAT_OWN) +#define RL_RXBYTES(x) (le32toh((x)->rl_cmdstat) & sc->rl_rxlenmask) +#define RL_PKTSZ(x) ((x)/* >> 3*/) +#ifdef RE_FIXUP_RX +#define RE_ETHER_ALIGN sizeof(uint64_t) +#define RE_RX_DESC_BUFLEN (MCLBYTES - RE_ETHER_ALIGN) +#else +#define RE_ETHER_ALIGN 0 +#define RE_RX_DESC_BUFLEN MCLBYTES +#endif + +#define RL_MSI_MESSAGES 1 + +#define RL_ADDR_LO(y) ((uint64_t) (y) & 0xFFFFFFFF) +#define RL_ADDR_HI(y) ((uint64_t) (y) >> 32) + +/* + * The number of bits reserved for MSS in RealTek controllers is + * 11bits. This limits the maximum interface MTU size in TSO case + * as upper stack should not generate TCP segments with MSS greater + * than the limit. + */ +#define RL_TSO_MTU (2047 - ETHER_HDR_LEN - ETHER_CRC_LEN) + +/* see comment in dev/re/if_re.c */ +#define RL_JUMBO_FRAMELEN 7440 +#define RL_JUMBO_MTU \ + (RL_JUMBO_FRAMELEN-ETHER_VLAN_ENCAP_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) +#define RL_JUMBO_MTU_6K \ + ((6 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define RL_JUMBO_MTU_9K \ + ((9 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define RL_MTU \ + (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) + +struct rl_txdesc { + struct mbuf *tx_m; + bus_dmamap_t tx_dmamap; +}; + +struct rl_rxdesc { + struct mbuf *rx_m; + bus_dmamap_t rx_dmamap; + bus_size_t rx_size; +}; + +struct rl_list_data { + struct rl_txdesc rl_tx_desc[RL_TX_DESC_CNT]; + struct rl_rxdesc rl_rx_desc[RL_RX_DESC_CNT]; + struct rl_rxdesc rl_jrx_desc[RL_RX_JUMBO_DESC_CNT]; + int rl_tx_desc_cnt; + int rl_rx_desc_cnt; + int rl_tx_prodidx; + int rl_rx_prodidx; + int rl_tx_considx; + int rl_tx_free; + bus_dma_tag_t rl_tx_mtag; /* mbuf TX mapping tag */ + bus_dma_tag_t rl_rx_mtag; /* mbuf RX mapping tag */ + bus_dma_tag_t rl_jrx_mtag; /* mbuf RX mapping tag */ + bus_dmamap_t rl_rx_sparemap; + bus_dmamap_t rl_jrx_sparemap; + bus_dma_tag_t rl_stag; /* stats mapping tag */ + bus_dmamap_t rl_smap; /* stats map */ + struct rl_stats *rl_stats; + bus_addr_t rl_stats_addr; + bus_dma_tag_t rl_rx_list_tag; + bus_dmamap_t rl_rx_list_map; + struct rl_desc *rl_rx_list; + bus_addr_t rl_rx_list_addr; + bus_dma_tag_t rl_tx_list_tag; + bus_dmamap_t rl_tx_list_map; + struct rl_desc *rl_tx_list; + bus_addr_t rl_tx_list_addr; +}; + +enum rl_twist { DONE, CHK_LINK, FIND_ROW, SET_PARAM, RECHK_LONG, RETUNE }; + +struct rl_softc { + struct ifnet *rl_ifp; /* interface info */ + bus_space_handle_t rl_bhandle; /* bus space handle */ + bus_space_tag_t rl_btag; /* bus space tag */ + device_t rl_dev; + struct resource *rl_res; + int rl_res_id; + int rl_res_type; + struct resource *rl_res_pba; + struct resource *rl_irq[RL_MSI_MESSAGES]; + void *rl_intrhand[RL_MSI_MESSAGES]; + device_t rl_miibus; + bus_dma_tag_t rl_parent_tag; + uint8_t rl_type; + const struct rl_hwrev *rl_hwrev; + uint32_t rl_macrev; + int rl_eecmd_read; + int rl_eewidth; + int rl_expcap; + int rl_txthresh; + bus_size_t rl_cfg0; + bus_size_t rl_cfg1; + bus_size_t rl_cfg2; + bus_size_t rl_cfg3; + bus_size_t rl_cfg4; + bus_size_t rl_cfg5; + struct rl_chain_data rl_cdata; + struct rl_list_data rl_ldata; + struct callout rl_stat_callout; + int rl_watchdog_timer; + struct mtx rl_mtx; + struct mbuf *rl_head; + struct mbuf *rl_tail; + uint32_t rl_rxlenmask; + int rl_testmode; + int rl_if_flags; + int rl_twister_enable; + enum rl_twist rl_twister; + int rl_twist_row; + int rl_twist_col; + int suspended; /* 0 = normal 1 = suspended */ +#ifdef DEVICE_POLLING + int rxcycles; +#endif + + struct task rl_inttask; + + int rl_txstart; + int rl_int_rx_act; + int rl_int_rx_mod; + uint32_t rl_flags; +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_AUTOPAD 0x00000002 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_PHYWAKE 0x00000008 +#define RL_FLAG_JUMBOV2 0x00000010 +#define RL_FLAG_PAR 0x00000020 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MACSTAT 0x00000080 +#define RL_FLAG_FASTETHER 0x00000100 +#define RL_FLAG_CMDSTOP 0x00000200 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Sun Dec 27 17:34:19 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93A3BA53621; Sun, 27 Dec 2015 17:34:19 +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 556FB178F; Sun, 27 Dec 2015 17:34:19 +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 tBRHYI1T031918; Sun, 27 Dec 2015 17:34:18 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRHYIrX031916; Sun, 27 Dec 2015 17:34:18 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271734.tBRHYIrX031916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 17:34: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: r292783 - in stable/10/sys/dev: re rl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 17:34:19 -0000 Author: marius Date: Sun Dec 27 17:34:18 2015 New Revision: 292783 URL: https://svnweb.freebsd.org/changeset/base/292783 Log: MFC: r287768, r290566, r290946 - Although it doesn't make a whole lot of sense to enable RX and TX before their initial configuration is done, it turns out that r281337 (MFCed to stable/10 in r285177) has the inverse effect on some older chips. Moreover, as with newer chips before, two chips seemingly identical according to their MAC revisions may behave differently in this regard, with most working but a few not, making changes extremely hard to test. Closer inspection of the corresponding Linux code suggests that RX and TX should only be enabled after their initial configuration with RTL8168G and later chips, i. e. RTL8106E{,US}, RTL8107E, as well as RTL8168{EP,G,GU,H}, so limit the new code path to these. [1] - Distinguish between RTL8168H and RTL8107E, with the latter being the 10/100-Mbit/s-only variant of the former. - For MAC variants that can only do Fast Ethernet at a maximum, ensure that we don't advertise Gigabit Ethernet speed. - In re_stop(), do the inverse of re_init_locked() and enable RXDV gate on RTL8168G and later chips again, matching what Linux does. - With the latter in place, it turns out that WOL previously only worked by accident with RTL8168G and later chips when the interface actually was brought up. This is due to the fact that with these MAC variants, RXDV gate needs be disabled for WOL to work. So in re_setwol() do just that when IFCAP_WOL is requested. - Add preliminary support for RTL8168H and RTL8107E, with the latter being the 10/100-Mbit/s-only variant of the former. Modified: stable/10/sys/dev/re/if_re.c stable/10/sys/dev/rl/if_rlreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/re/if_re.c ============================================================================== --- stable/10/sys/dev/re/if_re.c Sun Dec 27 17:33:59 2015 (r292782) +++ stable/10/sys/dev/re/if_re.c Sun Dec 27 17:34:18 2015 (r292783) @@ -237,6 +237,7 @@ static const struct rl_hwrev re_hwrevs[] { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K}, { RL_HWREV_8168G, RL_8169, "8168G/8111G", RL_JUMBO_MTU_9K}, { RL_HWREV_8168GU, RL_8169, "8168GU/8111GU", RL_JUMBO_MTU_9K}, + { RL_HWREV_8168H, RL_8169, "8168H/8111H", RL_JUMBO_MTU_9K}, { RL_HWREV_8411, RL_8169, "8411", RL_JUMBO_MTU_9K}, { RL_HWREV_8411B, RL_8169, "8411B", RL_JUMBO_MTU_9K}, { 0, 0, NULL, 0 } @@ -633,9 +634,8 @@ re_miibus_statchg(device_t dev) } } /* - * RealTek controllers does not provide any interface to - * Tx/Rx MACs for resolved speed, duplex and flow-control - * parameters. + * RealTek controllers do not provide any interface to the RX/TX + * MACs for resolved speed, duplex and flow-control parameters. */ } @@ -657,7 +657,7 @@ re_set_rxmode(struct rl_softc *sc) rxfilt = RL_RXCFG_CONFIG | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_BROAD; if ((sc->rl_flags & RL_FLAG_EARLYOFF) != 0) rxfilt |= RL_RXCFG_EARLYOFF; - else if ((sc->rl_flags & RL_FLAG_EARLYOFFV2) != 0) + else if ((sc->rl_flags & RL_FLAG_8168G_PLUS) != 0) rxfilt |= RL_RXCFG_EARLYOFFV2; if (ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) { @@ -1204,11 +1204,10 @@ re_attach(device_t dev) struct rl_softc *sc; struct ifnet *ifp; const struct rl_hwrev *hw_rev; + int capmask, error = 0, hwrev, i, msic, msixc, + phy, reg, rid; u_int32_t cap, ctl; - int hwrev; u_int16_t devid, re_did = 0; - int error = 0, i, phy, rid; - int msic, msixc, reg; uint8_t cfg; sc = device_get_softc(dev); @@ -1488,11 +1487,12 @@ re_attach(device_t dev) RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | RL_FLAG_CMDSTOP_WAIT_TXQ | RL_FLAG_WOL_MANLINK | - RL_FLAG_EARLYOFFV2 | RL_FLAG_RXDV_GATED; + RL_FLAG_8168G_PLUS; break; case RL_HWREV_8168GU: + case RL_HWREV_8168H: if (pci_get_device(dev) == RT_DEVICEID_8101E) { - /* RTL8106EUS */ + /* RTL8106E(US), RTL8107E */ sc->rl_flags |= RL_FLAG_FASTETHER; } else sc->rl_flags |= RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK; @@ -1500,7 +1500,7 @@ re_attach(device_t dev) sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_CMDSTOP_WAIT_TXQ | - RL_FLAG_EARLYOFFV2 | RL_FLAG_RXDV_GATED; + RL_FLAG_8168G_PLUS; break; case RL_HWREV_8169_8110SB: case RL_HWREV_8169_8110SBL: @@ -1650,8 +1650,11 @@ re_attach(device_t dev) phy = RE_PHYAD_INTERNAL; if (sc->rl_type == RL_8169) phy = 1; + capmask = BMSR_DEFCAPMASK; + if ((sc->rl_flags & RL_FLAG_FASTETHER) != 0) + capmask &= ~BMSR_EXTSTAT; error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd, - re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); + re_ifmedia_sts, capmask, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1691,13 +1694,13 @@ re_attach(device_t dev) #ifdef DEV_NETMAP re_netmap_attach(sc); #endif /* DEV_NETMAP */ + #ifdef RE_DIAG /* * Perform hardware diagnostic on the original RTL8169. * Some 32-bit cards were incorrectly wired and would * malfunction if plugged into a 64-bit slot. */ - if (hwrev == RL_HWREV_8169) { error = re_diag(sc); if (error) { @@ -1729,7 +1732,6 @@ re_attach(device_t dev) } fail: - if (error) re_detach(dev); @@ -2935,6 +2937,7 @@ re_start_locked(struct ifnet *ifp) return; } #endif /* DEV_NETMAP */ + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0) return; @@ -3190,9 +3193,18 @@ re_init_locked(struct rl_softc *sc) CSR_WRITE_4(sc, RL_TXLIST_ADDR_LO, RL_ADDR_LO(sc->rl_ldata.rl_tx_list_addr)); - if ((sc->rl_flags & RL_FLAG_RXDV_GATED) != 0) + if ((sc->rl_flags & RL_FLAG_8168G_PLUS) != 0) { + /* Disable RXDV gate. */ CSR_WRITE_4(sc, RL_MISC, CSR_READ_4(sc, RL_MISC) & ~0x00080000); + } + + /* + * Enable transmit and receive for pre-RTL8168G controllers. + * RX/TX MACs should be enabled before RX/TX configuration. + */ + if ((sc->rl_flags & RL_FLAG_8168G_PLUS) == 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_TX_ENB | RL_CMD_RX_ENB); /* * Set the initial TX configuration. @@ -3221,9 +3233,11 @@ re_init_locked(struct rl_softc *sc) } /* - * Enable transmit and receive. + * Enable transmit and receive for RTL8168G and later controllers. + * RX/TX MACs should be enabled after RX/TX configuration. */ - CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_TX_ENB | RL_CMD_RX_ENB); + if ((sc->rl_flags & RL_FLAG_8168G_PLUS) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_TX_ENB | RL_CMD_RX_ENB); #ifdef DEVICE_POLLING /* @@ -3579,6 +3593,12 @@ re_stop(struct rl_softc *sc) ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_MULTI | RL_RXCFG_RX_BROAD)); + if ((sc->rl_flags & RL_FLAG_8168G_PLUS) != 0) { + /* Enable RXDV gate. */ + CSR_WRITE_4(sc, RL_MISC, CSR_READ_4(sc, RL_MISC) | + 0x00080000); + } + if ((sc->rl_flags & RL_FLAG_WAIT_TXPOLL) != 0) { for (i = RL_TIMEOUT; i > 0; i--) { if ((CSR_READ_1(sc, sc->rl_txstart) & @@ -3830,6 +3850,11 @@ re_setwol(struct rl_softc *sc) CSR_READ_1(sc, RL_GPIO) & ~0x01); } if ((ifp->if_capenable & IFCAP_WOL) != 0) { + if ((sc->rl_flags & RL_FLAG_8168G_PLUS) != 0) { + /* Disable RXDV gate. */ + CSR_WRITE_4(sc, RL_MISC, CSR_READ_4(sc, RL_MISC) & + ~0x00080000); + } re_set_rxmode(sc); if ((sc->rl_flags & RL_FLAG_WOL_MANLINK) != 0) re_set_linkspeed(sc); @@ -3942,7 +3967,6 @@ re_add_sysctls(struct rl_softc *sc) sc->rl_int_rx_mod = RL_TIMER_DEFAULT; } } - } static int Modified: stable/10/sys/dev/rl/if_rlreg.h ============================================================================== --- stable/10/sys/dev/rl/if_rlreg.h Sun Dec 27 17:33:59 2015 (r292782) +++ stable/10/sys/dev/rl/if_rlreg.h Sun Dec 27 17:34:18 2015 (r292783) @@ -195,6 +195,7 @@ #define RL_HWREV_8168G 0x4C000000 #define RL_HWREV_8168EP 0x50000000 #define RL_HWREV_8168GU 0x50800000 +#define RL_HWREV_8168H 0x54000000 #define RL_HWREV_8411B 0x5C800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 @@ -930,8 +931,7 @@ struct rl_softc { #define RL_FLAG_CMDSTOP_WAIT_TXQ 0x00008000 #define RL_FLAG_WOL_MANLINK 0x00010000 #define RL_FLAG_EARLYOFF 0x00020000 -#define RL_FLAG_EARLYOFFV2 0x00040000 -#define RL_FLAG_RXDV_GATED 0x00080000 +#define RL_FLAG_8168G_PLUS 0x00040000 #define RL_FLAG_PCIE 0x40000000 #define RL_FLAG_LINK 0x80000000 }; From owner-svn-src-stable-10@freebsd.org Sun Dec 27 17:51:11 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F792A53AF5; Sun, 27 Dec 2015 17:51:11 +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 3A7E41FA5; Sun, 27 Dec 2015 17:51:11 +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 tBRHpAan036232; Sun, 27 Dec 2015 17:51:10 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRHpA2Q036231; Sun, 27 Dec 2015 17:51:10 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271751.tBRHpA2Q036231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 17:51: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: r292785 - stable/10/sys/sparc64/ebus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 17:51:11 -0000 Author: marius Date: Sun Dec 27 17:51:10 2015 New Revision: 292785 URL: https://svnweb.freebsd.org/changeset/base/292785 Log: MFC: r287767 - Sanity check that the parent ranges given in the "ranges" property of PCI-EBus-bridges actually match the BARs as specified in and required by [1, p. 113 f.]. Doing so earlier would have simplified diagnosing a bug in QEMU/OpenBIOS getting the mapping of child addresses wrong, which still needs to be fixed there. In theory, we could try to change the BARs accordingly if we hit this problem. However, at least with real machines changing the decoding likely won't work, especially if the PCI-EBus-bridge is beneath an APB one. So implementing such functionality generally is rather pointless. - Actually change the allocation type of EBus resources if they change from SYS_RES_MEMORY to SYS_RES_IOPORT when mapping them to PCI ranges in ebus_alloc_resource() and passing them up to bus_activate_resource(9). This may happen with the QEMU/OpenBIOS PCI-EBus-bridge but not real ones. Still, this is only cleans up the code and the result of resource allocation and activation is unchanged. - Change the remainder of printf(9) to device_printf(9) calls and canonicalize their wording. Peripheral Component Interconnect Input Output Controller, Part No.: 802-7837-01, Sun Microelectronics, March 1997 [1] Modified: stable/10/sys/sparc64/ebus/ebus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sparc64/ebus/ebus.c ============================================================================== --- stable/10/sys/sparc64/ebus/ebus.c Sun Dec 27 17:34:29 2015 (r292784) +++ stable/10/sys/sparc64/ebus/ebus.c Sun Dec 27 17:51:10 2015 (r292785) @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include #include - #include #include @@ -294,7 +293,7 @@ ebus_nexus_attach(device_t dev) sc->sc_nrange = OF_getprop_alloc(node, "ranges", sizeof(struct ebus_nexus_ranges), &sc->sc_range); if (sc->sc_nrange == -1) { - printf("%s: could not get ranges property\n", __func__); + device_printf(dev, "could not get ranges property\n"); return (ENXIO); } return (ebus_attach(dev, sc, node)); @@ -306,6 +305,7 @@ ebus_pci_attach(device_t dev) struct ebus_softc *sc; struct ebus_rinfo *eri; struct resource *res; + struct isa_ranges *range; phandle_t node; int i, rnum, rid; @@ -322,7 +322,7 @@ ebus_pci_attach(device_t dev) sc->sc_nrange = OF_getprop_alloc(node, "ranges", sizeof(struct isa_ranges), &sc->sc_range); if (sc->sc_nrange == -1) { - printf("%s: could not get ranges property\n", __func__); + device_printf(dev, "could not get ranges property\n"); return (ENXIO); } @@ -332,21 +332,34 @@ ebus_pci_attach(device_t dev) /* For every range, there must be a matching resource. */ for (rnum = 0; rnum < sc->sc_nrange; rnum++) { eri = &sc->sc_rinfo[rnum]; - eri->eri_rtype = ofw_isa_range_restype( - &((struct isa_ranges *)sc->sc_range)[rnum]); + range = &((struct isa_ranges *)sc->sc_range)[rnum]; + eri->eri_rtype = ofw_isa_range_restype(range); rid = PCIR_BAR(rnum); res = bus_alloc_resource_any(dev, eri->eri_rtype, &rid, RF_ACTIVE); if (res == NULL) { - printf("%s: failed to allocate range resource!\n", - __func__); + device_printf(dev, + "could not allocate range resource %d\n", rnum); + goto fail; + } + if (rman_get_start(res) != ISA_RANGE_PHYS(range)) { + device_printf(dev, + "mismatch in start of range %d (0x%lx/0x%lx)\n", + rnum, rman_get_start(res), ISA_RANGE_PHYS(range)); + goto fail; + } + if (rman_get_size(res) != range->size) { + device_printf(dev, + "mismatch in size of range %d (0x%lx/0x%x)\n", + rnum, rman_get_size(res), range->size); goto fail; } eri->eri_res = res; eri->eri_rman.rm_type = RMAN_ARRAY; eri->eri_rman.rm_descr = "EBus range"; if (rman_init_from_resource(&eri->eri_rman, res) != 0) { - printf("%s: failed to initialize rman!", __func__); + device_printf(dev, + "could not initialize rman for range %d", rnum); goto fail; } } @@ -452,7 +465,7 @@ ebus_alloc_resource(device_t bus, device * Map EBus ranges to PCI ranges. This may include * changing the allocation type. */ - (void)ofw_isa_range_map(sc->sc_range, sc->sc_nrange, + type = ofw_isa_range_map(sc->sc_range, sc->sc_nrange, &start, &end, &ridx); eri = &sc->sc_rinfo[ridx]; res = rman_reserve_resource(&eri->eri_rman, start, @@ -507,7 +520,7 @@ ebus_activate_resource(device_t bus, dev int i, rv; sc = device_get_softc(bus); - if ((sc->sc_flags & EBUS_PCI) != 0 && type == SYS_RES_MEMORY) { + if ((sc->sc_flags & EBUS_PCI) != 0 && type != SYS_RES_IRQ) { for (i = 0; i < sc->sc_nrange; i++) { eri = &sc->sc_rinfo[i]; if (rman_is_region_manager(res, &eri->eri_rman) != 0) { @@ -550,7 +563,7 @@ ebus_release_resource(device_t bus, devi passthrough = (device_get_parent(child) != bus); rl = BUS_GET_RESOURCE_LIST(bus, child); sc = device_get_softc(bus); - if ((sc->sc_flags & EBUS_PCI) != 0 && type == SYS_RES_MEMORY) { + if ((sc->sc_flags & EBUS_PCI) != 0 && type != SYS_RES_IRQ) { if ((rman_get_flags(res) & RF_ACTIVE) != 0 ){ rv = bus_deactivate_resource(child, type, rid, res); if (rv != 0) From owner-svn-src-stable-10@freebsd.org Sun Dec 27 17:53:40 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6C0AA53BAA; Sun, 27 Dec 2015 17:53:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B1E813CF; Sun, 27 Dec 2015 17:53:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRHrdMc038331; Sun, 27 Dec 2015 17:53:39 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRHrd9l038330; Sun, 27 Dec 2015 17:53:39 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512271753.tBRHrd9l038330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 27 Dec 2015 17:53: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: r292786 - stable/10/bin/sh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 17:53:40 -0000 Author: jilles Date: Sun Dec 27 17:53:39 2015 New Revision: 292786 URL: https://svnweb.freebsd.org/changeset/base/292786 Log: MFC r292517: sh/mknodes: Close files and check for errors when writing. This is a build tool only and does not affect run time. PR: 204951 Modified: stable/10/bin/sh/mknodes.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/mknodes.c ============================================================================== --- stable/10/bin/sh/mknodes.c Sun Dec 27 17:51:10 2015 (r292785) +++ stable/10/bin/sh/mknodes.c Sun Dec 27 17:53:39 2015 (r292786) @@ -89,7 +89,6 @@ static struct str *nodestr[MAXTYPES]; /* static int nstr; /* number of structures */ static struct str str[MAXTYPES]; /* the structures */ static struct str *curstr; /* current structure */ -static FILE *infp; static char line[1024]; static int linno; static char *linep; @@ -102,7 +101,7 @@ static void outfunc(FILE *, int); static void indent(int, FILE *); static int nextfield(char *); static void skipbl(void); -static int readline(void); +static int readline(FILE *); static void error(const char *, ...) __printf0like(1, 2) __dead2; static char *savestr(const char *); @@ -110,17 +109,19 @@ static char *savestr(const char *); int main(int argc, char *argv[]) { + FILE *infp; + if (argc != 3) error("usage: mknodes file"); - infp = stdin; if ((infp = fopen(argv[1], "r")) == NULL) error("Can't open %s: %s", argv[1], strerror(errno)); - while (readline()) { + while (readline(infp)) { if (line[0] == ' ' || line[0] == '\t') parsefield(); else if (line[0] != '\0') parsenode(); } + fclose(infp); output(argv[2]); exit(0); } @@ -253,6 +254,10 @@ output(char *file) fputs("union node *getfuncnode(struct funcdef *);\n", hfile); fputs("void reffunc(struct funcdef *);\n", hfile); fputs("void unreffunc(struct funcdef *);\n", hfile); + if (ferror(hfile)) + error("Can't write to nodes.h"); + if (fclose(hfile)) + error("Can't close nodes.h"); fputs(writer, cfile); while (fgets(line, sizeof line, patfile) != NULL) { @@ -266,6 +271,11 @@ output(char *file) else fputs(line, cfile); } + fclose(patfile); + if (ferror(cfile)) + error("Can't write to nodes.c"); + if (fclose(cfile)) + error("Can't close nodes.c"); } @@ -401,7 +411,7 @@ skipbl(void) static int -readline(void) +readline(FILE *infp) { char *p; From owner-svn-src-stable-10@freebsd.org Sun Dec 27 17:58:59 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D303A53CB5; Sun, 27 Dec 2015 17:58:59 +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 18CB7176B; Sun, 27 Dec 2015 17:58:59 +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 tBRHwwL5038758; Sun, 27 Dec 2015 17:58:58 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRHwwWN038757; Sun, 27 Dec 2015 17:58:58 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271758.tBRHwwWN038757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 17:58:58 +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: r292787 - stable/10/sys/sparc64/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 17:58:59 -0000 Author: marius Date: Sun Dec 27 17:58:58 2015 New Revision: 292787 URL: https://svnweb.freebsd.org/changeset/base/292787 Log: MFC: r287728 Merge r286374 from x86: Formally pair store_rel(&smp_started) with load_acq(&smp_started). Similarly to x86, this change is mostly a NOP due to the kernel being run in total store order. Modified: stable/10/sys/sparc64/include/smp.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sparc64/include/smp.h ============================================================================== --- stable/10/sys/sparc64/include/smp.h Sun Dec 27 17:53:39 2015 (r292786) +++ stable/10/sys/sparc64/include/smp.h Sun Dec 27 17:58:58 2015 (r292787) @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -143,7 +144,7 @@ ipi_all_but_self(u_int ipi) { cpuset_t cpus; - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return; cpus = all_cpus; sched_pin(); @@ -158,7 +159,8 @@ static __inline void ipi_selected(cpuset_t cpus, u_int ipi) { - if (__predict_false(smp_started == 0 || CPU_EMPTY(&cpus))) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0 || + CPU_EMPTY(&cpus))) return; mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); @@ -169,7 +171,7 @@ static __inline void ipi_cpu(int cpu, u_int ipi) { - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return; mtx_lock_spin(&ipi_mtx); cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); @@ -183,7 +185,7 @@ ipi_dcache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; @@ -200,7 +202,7 @@ ipi_icache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; @@ -217,7 +219,7 @@ ipi_rd(u_int cpu, void *func, u_long *va { struct ipi_rd_args *ira; - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return (NULL); sched_pin(); ira = &ipi_rd_args; @@ -234,7 +236,7 @@ ipi_tlb_context_demap(struct pmap *pm) struct ipi_tlb_args *ita; cpuset_t cpus; - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -259,7 +261,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o struct ipi_tlb_args *ita; cpuset_t cpus; - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -284,7 +286,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ struct ipi_tlb_args *ita; cpuset_t cpus; - if (__predict_false(smp_started == 0)) + if (__predict_false(atomic_load_acq_int(&smp_started) == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; From owner-svn-src-stable-10@freebsd.org Sun Dec 27 19:37:49 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2668A53B56; Sun, 27 Dec 2015 19:37:49 +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 7917D13A0; Sun, 27 Dec 2015 19:37:49 +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 tBRJbm8f067942; Sun, 27 Dec 2015 19:37:48 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRJblN0067934; Sun, 27 Dec 2015 19:37:47 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271937.tBRJblN0067934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 19:37: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: r292789 - in stable/10/sys: conf sparc64/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 19:37:50 -0000 Author: marius Date: Sun Dec 27 19:37:47 2015 New Revision: 292789 URL: https://svnweb.freebsd.org/changeset/base/292789 Log: MFC: r287726 - Factor out the common and generic parts of the sparc64 host-PCI-bridge drivers into the revived sys/sparc64/pci/ofw_pci.c, previously already serving a similar purpose. This has been done with sun4v in mind, which explains a) the otherwise not that obvious scheme employed and b) why reusing sys/powerpc/ofw/ofw_pci.c was even lesser an option. - Add a workaround for QEMU once again not emulating real machines, in this case by not providing the OFW_PCI_CS_MEM64 range. [1] Submitted by: jhb [1] Added: stable/10/sys/sparc64/pci/ofw_pci.c - copied, changed from r287726, head/sys/sparc64/pci/ofw_pci.c Modified: stable/10/sys/conf/files.sparc64 stable/10/sys/sparc64/pci/fire.c stable/10/sys/sparc64/pci/firereg.h stable/10/sys/sparc64/pci/firevar.h stable/10/sys/sparc64/pci/ofw_pci.h stable/10/sys/sparc64/pci/psycho.c stable/10/sys/sparc64/pci/psychoreg.h stable/10/sys/sparc64/pci/psychovar.h stable/10/sys/sparc64/pci/schizo.c stable/10/sys/sparc64/pci/schizoreg.h stable/10/sys/sparc64/pci/schizovar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files.sparc64 ============================================================================== --- stable/10/sys/conf/files.sparc64 Sun Dec 27 18:12:13 2015 (r292788) +++ stable/10/sys/conf/files.sparc64 Sun Dec 27 19:37:47 2015 (r292789) @@ -81,6 +81,7 @@ sparc64/isa/isa_dma.c optional isa sparc64/isa/ofw_isa.c optional ebus | isa sparc64/pci/apb.c optional pci sparc64/pci/fire.c optional pci +sparc64/pci/ofw_pci.c optional pci sparc64/pci/ofw_pcib.c optional pci sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci Modified: stable/10/sys/sparc64/pci/fire.c ============================================================================== --- stable/10/sys/sparc64/pci/fire.c Sun Dec 27 18:12:13 2015 (r292788) +++ stable/10/sys/sparc64/pci/fire.c Sun Dec 27 19:37:47 2015 (r292789) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -68,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -111,19 +109,14 @@ static driver_filter_t fire_xcb; /* * Methods */ -static bus_activate_resource_t fire_activate_resource; -static bus_adjust_resource_t fire_adjust_resource; static pcib_alloc_msi_t fire_alloc_msi; static pcib_alloc_msix_t fire_alloc_msix; static bus_alloc_resource_t fire_alloc_resource; static device_attach_t fire_attach; -static bus_get_dma_tag_t fire_get_dma_tag; -static ofw_bus_get_node_t fire_get_node; static pcib_map_msi_t fire_map_msi; static pcib_maxslots_t fire_maxslots; static device_probe_t fire_probe; static pcib_read_config_t fire_read_config; -static bus_read_ivar_t fire_read_ivar; static pcib_release_msi_t fire_release_msi; static pcib_release_msix_t fire_release_msix; static pcib_route_interrupt_t fire_route_interrupt; @@ -140,15 +133,15 @@ static device_method_t fire_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_read_ivar, fire_read_ivar), + DEVMETHOD(bus_read_ivar, ofw_pci_read_ivar), DEVMETHOD(bus_setup_intr, fire_setup_intr), DEVMETHOD(bus_teardown_intr, fire_teardown_intr), DEVMETHOD(bus_alloc_resource, fire_alloc_resource), - DEVMETHOD(bus_activate_resource, fire_activate_resource), + DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, fire_adjust_resource), + DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_get_dma_tag, fire_get_dma_tag), + DEVMETHOD(bus_get_dma_tag, ofw_pci_get_dma_tag), /* pcib interface */ DEVMETHOD(pcib_maxslots, fire_maxslots), @@ -162,7 +155,7 @@ static device_method_t fire_methods[] = DEVMETHOD(pcib_map_msi, fire_map_msi), /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, fire_get_node), + DEVMETHOD(ofw_bus_get_node, ofw_pci_get_node), DEVMETHOD_END }; @@ -296,7 +289,7 @@ fire_attach(device_t dev) struct ofw_pci_msi_eq_to_devino msi_eq_to_devino; struct fire_msiqarg *fmqa; struct timecounter *tc; - struct ofw_pci_ranges *range; + bus_dma_tag_t dmat; uint64_t ino_bitmap, val; phandle_t node; uint32_t prop, prop_array[2]; @@ -310,7 +303,6 @@ fire_attach(device_t dev) mode = desc->fd_mode; sc->sc_dev = dev; - sc->sc_node = node; sc->sc_mode = mode; sc->sc_flags = 0; @@ -715,81 +707,21 @@ fire_attach(device_t dev) sc->sc_is.is_bushandle = rman_get_bushandle(sc->sc_mem_res[FIRE_PCI]); sc->sc_is.is_iommu = FO_PCI_MMU; val = FIRE_PCI_READ_8(sc, FO_PCI_MMU + IMR_CTL); - iommu_init(device_get_nameunit(sc->sc_dev), &sc->sc_is, 7, -1, 0); + iommu_init(device_get_nameunit(dev), &sc->sc_is, 7, -1, 0); #ifdef FIRE_DEBUG device_printf(dev, "FO_PCI_MMU + IMR_CTL 0x%016llx -> 0x%016llx\n", (long long unsigned)val, (long long unsigned)sc->sc_is.is_cr); #endif - - /* Initialize memory and I/O rmans. */ - sc->sc_pci_io_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_io_rman.rm_descr = "Fire PCI I/O Ports"; - if (rman_init(&sc->sc_pci_io_rman) != 0 || - rman_manage_region(&sc->sc_pci_io_rman, 0, FO_IO_SIZE) != 0) - panic("%s: failed to set up I/O rman", __func__); - sc->sc_pci_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_mem_rman.rm_descr = "Fire PCI Memory"; - if (rman_init(&sc->sc_pci_mem_rman) != 0 || - rman_manage_region(&sc->sc_pci_mem_rman, 0, FO_MEM_SIZE) != 0) - panic("%s: failed to set up memory rman", __func__); - - i = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range); - /* - * Make sure that the expected ranges are present. The - * OFW_PCI_CS_MEM64 one is not currently used though. - */ - if (i != FIRE_NRANGE) - panic("%s: unsupported number of ranges", __func__); - /* - * Find the addresses of the various bus spaces. - * There should not be multiple ones of one kind. - * The physical start addresses of the ranges are the configuration, - * memory and I/O handles. - */ - for (i = 0; i < FIRE_NRANGE; i++) { - j = OFW_PCI_RANGE_CS(&range[i]); - if (sc->sc_pci_bh[j] != 0) - panic("%s: duplicate range for space %d", - __func__, j); - sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]); - } - free(range, M_OFWPROP); - - /* Allocate our tags. */ - sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, rman_get_bustag( - sc->sc_mem_res[FIRE_PCI]), PCI_IO_BUS_SPACE, NULL); - if (sc->sc_pci_iot == NULL) - panic("%s: could not allocate PCI I/O tag", __func__); - sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, rman_get_bustag( - sc->sc_mem_res[FIRE_PCI]), PCI_CONFIG_BUS_SPACE, NULL); - if (sc->sc_pci_cfgt == NULL) - panic("%s: could not allocate PCI configuration space tag", - __func__); + /* Create our DMA tag. */ if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0x100000000, sc->sc_is.is_pmaxaddr, ~0, NULL, NULL, sc->sc_is.is_pmaxaddr, - 0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_pci_dmat) != 0) + 0xff, 0xffffffff, 0, NULL, NULL, &dmat) != 0) panic("%s: could not create PCI DMA tag", __func__); - /* Customize the tag. */ - sc->sc_pci_dmat->dt_cookie = &sc->sc_is; - sc->sc_pci_dmat->dt_mt = &sc->sc_dma_methods; + dmat->dt_cookie = &sc->sc_is; + dmat->dt_mt = &sc->sc_dma_methods; - /* - * Get the bus range from the firmware. - * NB: Neither Fire nor Oberon support PCI bus reenumeration. - */ - i = OF_getprop(node, "bus-range", (void *)prop_array, - sizeof(prop_array)); - if (i == -1) - panic("%s: could not get bus-range", __func__); - if (i != sizeof(prop_array)) - panic("%s: broken bus-range (%d)", __func__, i); - sc->sc_pci_secbus = prop_array[0]; - sc->sc_pci_subbus = prop_array[1]; - if (bootverbose != 0) - device_printf(dev, "bus range %u to %u; PCI bus %d\n", - sc->sc_pci_secbus, sc->sc_pci_subbus, sc->sc_pci_secbus); - - ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(ofw_pci_intr_t)); + if (ofw_pci_attach_common(dev, dmat, FO_IO_SIZE, FO_MEM_SIZE) != 0) + panic("%s: ofw_pci_attach_common() failed", __func__); #define FIRE_SYSCTL_ADD_UINT(name, arg, desc) \ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), \ @@ -1392,136 +1324,44 @@ static uint32_t fire_read_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, int width) { - struct fire_softc *sc; - bus_space_handle_t bh; - u_long offset = 0; - uint32_t r, wrd; - int i; - uint16_t shrt; - uint8_t byte; - - sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCIE_REGMAX) - return (-1); - - offset = FO_CONF_OFF(bus, slot, func, reg); - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - switch (width) { - case 1: - i = bus_space_peek_1(sc->sc_pci_cfgt, bh, offset, &byte); - r = byte; - break; - case 2: - i = bus_space_peek_2(sc->sc_pci_cfgt, bh, offset, &shrt); - r = shrt; - break; - case 4: - i = bus_space_peek_4(sc->sc_pci_cfgt, bh, offset, &wrd); - r = wrd; - break; - default: - panic("%s: bad width", __func__); - /* NOTREACHED */ - } - if (i) { -#ifdef FIRE_DEBUG - printf("%s: read data error reading: %d.%d.%d: 0x%x\n", - __func__, bus, slot, func, reg); -#endif - r = -1; - } - return (r); + return (ofw_pci_read_config_common(dev, PCIE_REGMAX, FO_CONF_OFF(bus, + slot, func, reg), bus, slot, func, reg, width)); } static void fire_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width) { - struct fire_softc *sc; - bus_space_handle_t bh; - u_long offset = 0; - - sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCIE_REGMAX) - return; - offset = FO_CONF_OFF(bus, slot, func, reg); - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - switch (width) { - case 1: - bus_space_write_1(sc->sc_pci_cfgt, bh, offset, val); - break; - case 2: - bus_space_write_2(sc->sc_pci_cfgt, bh, offset, val); - break; - case 4: - bus_space_write_4(sc->sc_pci_cfgt, bh, offset, val); - break; - default: - panic("%s: bad width", __func__); - /* NOTREACHED */ - } + ofw_pci_write_config_common(dev, PCIE_REGMAX, FO_CONF_OFF(bus, slot, + func, reg), bus, slot, func, reg, val, width); } static int fire_route_interrupt(device_t bridge, device_t dev, int pin) { - struct fire_softc *sc; - struct ofw_pci_register reg; - ofw_pci_intr_t pintr, mintr; - - sc = device_get_softc(bridge); - pintr = pin; - if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, - ®, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), - NULL) != 0) - return (mintr); - - device_printf(bridge, "could not route pin %d for device %d.%d\n", - pin, pci_get_slot(dev), pci_get_function(dev)); - return (PCI_INVALID_IRQ); -} - -static int -fire_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - struct fire_softc *sc; + ofw_pci_intr_t mintr; - sc = device_get_softc(dev); - switch (which) { - case PCIB_IVAR_DOMAIN: - *result = device_get_unit(dev); - return (0); - case PCIB_IVAR_BUS: - *result = sc->sc_pci_secbus; - return (0); - } - return (ENOENT); + mintr = ofw_pci_route_interrupt_common(bridge, dev, pin); + if (!PCI_INTERRUPT_VALID(mintr)) + device_printf(bridge, + "could not route pin %d for device %d.%d\n", + pin, pci_get_slot(dev), pci_get_function(dev)); + return (mintr); } static void fire_dmamap_sync(bus_dma_tag_t dt __unused, bus_dmamap_t map, bus_dmasync_op_t op) { - static u_char buf[VIS_BLOCKSIZE] __aligned(VIS_BLOCKSIZE); - register_t reg, s; if ((map->dm_flags & DMF_LOADED) == 0) return; - if ((op & BUS_DMASYNC_POSTREAD) != 0) { - s = intr_disable(); - reg = rd(fprs); - wr(fprs, reg | FPRS_FEF, 0); - __asm __volatile("stda %%f0, [%0] %1" - : : "r" (buf), "n" (ASI_BLK_COMMIT_S)); - membar(Sync); - wr(fprs, reg, 0); - intr_restore(s); - } else if ((op & BUS_DMASYNC_PREWRITE) != 0) + if ((op & BUS_DMASYNC_POSTREAD) != 0) + ofw_pci_dmamap_sync_stst_order_common(); + else if ((op & BUS_DMASYNC_PREWRITE) != 0) membar(Sync); } @@ -2015,122 +1855,13 @@ fire_alloc_resource(device_t bus, device u_long start, u_long end, u_long count, u_int flags) { struct fire_softc *sc; - struct resource *rv; - struct rman *rm; - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - /* - * XXX: Don't accept blank ranges for now, only single - * interrupts. The other case should not happen with - * the MI PCI code... - * XXX: This may return a resource that is out of the - * range that was specified. Is this correct...? - */ - if (start != end) - panic("%s: XXX: interrupt range", __func__); - if (*rid == 0) - start = end = INTMAP_VEC(sc->sc_ign, end); - return (bus_generic_alloc_resource(bus, child, type, rid, - start, end, count, flags)); - case SYS_RES_MEMORY: - rm = &sc->sc_pci_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_pci_io_rman; - break; - default: - return (NULL); - } - - rv = rman_reserve_resource(rm, start, end, count, flags & ~RF_ACTIVE, - child); - if (rv == NULL) - return (NULL); - rman_set_rid(rv, *rid); - - if ((flags & RF_ACTIVE) != 0 && bus_activate_resource(child, type, - *rid, rv) != 0) { - rman_release_resource(rv); - return (NULL); + if (type == SYS_RES_IRQ && *rid == 0) { + sc = device_get_softc(bus); + start = end = INTMAP_VEC(sc->sc_ign, end); } - return (rv); -} - -static int -fire_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - struct fire_softc *sc; - struct bus_space_tag *tag; - - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_activate_resource(bus, child, type, rid, - r)); - case SYS_RES_MEMORY: - tag = sparc64_alloc_bus_tag(r, rman_get_bustag( - sc->sc_mem_res[FIRE_PCI]), PCI_MEMORY_BUS_SPACE, NULL); - if (tag == NULL) - return (ENOMEM); - rman_set_bustag(r, tag); - rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_MEM32] + - rman_get_start(r)); - break; - case SYS_RES_IOPORT: - rman_set_bustag(r, sc->sc_pci_iot); - rman_set_bushandle(r, sc->sc_pci_bh[OFW_PCI_CS_IO] + - rman_get_start(r)); - break; - } - return (rman_activate_resource(r)); -} - -static int -fire_adjust_resource(device_t bus, device_t child, int type, - struct resource *r, u_long start, u_long end) -{ - struct fire_softc *sc; - struct rman *rm; - - sc = device_get_softc(bus); - switch (type) { - case SYS_RES_IRQ: - return (bus_generic_adjust_resource(bus, child, type, r, - start, end)); - case SYS_RES_MEMORY: - rm = &sc->sc_pci_mem_rman; - break; - case SYS_RES_IOPORT: - rm = &sc->sc_pci_io_rman; - break; - default: - return (EINVAL); - } - if (rman_is_region_manager(r, rm) == 0) - return (EINVAL); - return (rman_adjust_resource(r, start, end)); -} - -static bus_dma_tag_t -fire_get_dma_tag(device_t bus, device_t child __unused) -{ - struct fire_softc *sc; - - sc = device_get_softc(bus); - return (sc->sc_pci_dmat); -} - -static phandle_t -fire_get_node(device_t bus, device_t child __unused) -{ - struct fire_softc *sc; - - sc = device_get_softc(bus); - /* We only have one child, the PCI bus, which needs our own node. */ - return (sc->sc_node); + return (ofw_pci_alloc_resource(bus, child, type, rid, start, end, + count, flags)); } static u_int Modified: stable/10/sys/sparc64/pci/firereg.h ============================================================================== --- stable/10/sys/sparc64/pci/firereg.h Sun Dec 27 18:12:13 2015 (r292788) +++ stable/10/sys/sparc64/pci/firereg.h Sun Dec 27 19:37:47 2015 (r292789) @@ -30,7 +30,6 @@ #define _SPARC64_PCI_FIREREG_H_ #define FIRE_NINTR 3 /* 2 OFW + 1 MSIq */ -#define FIRE_NRANGE 4 #define FIRE_NREG 2 #define FIRE_PCI 0 Modified: stable/10/sys/sparc64/pci/firevar.h ============================================================================== --- stable/10/sys/sparc64/pci/firevar.h Sun Dec 27 18:12:13 2015 (r292788) +++ stable/10/sys/sparc64/pci/firevar.h Sun Dec 27 19:37:47 2015 (r292789) @@ -32,6 +32,12 @@ #define _SPARC64_PCI_FIREVAR_H_ struct fire_softc { + /* + * This is here so that we can hook up the common bus interface + * methods in ofw_pci.c directly. + */ + struct ofw_pci_softc sc_ops; + struct iommu_state sc_is; struct bus_dma_methods sc_dma_methods; @@ -42,13 +48,6 @@ struct fire_softc { struct resource *sc_irq_res[FIRE_NINTR]; void *sc_ihand[FIRE_NINTR]; - struct rman sc_pci_mem_rman; - struct rman sc_pci_io_rman; - bus_space_handle_t sc_pci_bh[FIRE_NRANGE]; - bus_space_tag_t sc_pci_cfgt; - bus_space_tag_t sc_pci_iot; - bus_dma_tag_t sc_pci_dmat; - device_t sc_dev; uint64_t *sc_msiq; @@ -66,8 +65,6 @@ struct fire_softc { uint32_t sc_msiq_first; uint32_t sc_msiq_ino_first; - phandle_t sc_node; - u_int sc_mode; #define FIRE_MODE_FIRE 0 #define FIRE_MODE_OBERON 1 @@ -87,11 +84,6 @@ struct fire_softc { uint32_t sc_stats_tlu_oe_rx_err; uint32_t sc_stats_tlu_oe_tx_err; uint32_t sc_stats_ubc_dmardue; - - uint8_t sc_pci_secbus; - uint8_t sc_pci_subbus; - - struct ofw_bus_iinfo sc_pci_iinfo; }; #endif /* !_SPARC64_PCI_FIREVAR_H_ */ Copied and modified: stable/10/sys/sparc64/pci/ofw_pci.c (from r287726, head/sys/sparc64/pci/ofw_pci.c) ============================================================================== --- head/sys/sparc64/pci/ofw_pci.c Sat Sep 12 22:49:32 2015 (r287726, copy source) +++ stable/10/sys/sparc64/pci/ofw_pci.c Sun Dec 27 19:37:47 2015 (r292789) @@ -57,6 +57,9 @@ __FBSDID("$FreeBSD$"); #include +/* XXX */ +extern struct bus_space_tag nexus_bustag; + int ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat, u_long iosize, u_long memsize) @@ -125,12 +128,14 @@ ofw_pci_attach_common(device_t dev, bus_ } /* Allocate our tags. */ - sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, PCI_IO_BUS_SPACE); + sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, &nexus_bustag, + PCI_IO_BUS_SPACE, NULL); if (sc->sc_pci_iot == NULL) { device_printf(dev, "could not allocate PCI I/O tag\n"); return (ENXIO); } - sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, PCI_CONFIG_BUS_SPACE); + sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, &nexus_bustag, + PCI_CONFIG_BUS_SPACE, NULL); if (sc->sc_pci_cfgt == NULL) { device_printf(dev, "could not allocate PCI configuration space tag\n"); @@ -344,7 +349,8 @@ ofw_pci_activate_resource(device_t bus, return (bus_generic_activate_resource(bus, child, type, rid, r)); case SYS_RES_MEMORY: - tag = sparc64_alloc_bus_tag(r, PCI_MEMORY_BUS_SPACE); + tag = sparc64_alloc_bus_tag(r, &nexus_bustag, + PCI_MEMORY_BUS_SPACE, NULL); if (tag == NULL) return (ENOMEM); rman_set_bustag(r, tag); Modified: stable/10/sys/sparc64/pci/ofw_pci.h ============================================================================== --- stable/10/sys/sparc64/pci/ofw_pci.h Sun Dec 27 18:12:13 2015 (r292788) +++ stable/10/sys/sparc64/pci/ofw_pci.h Sun Dec 27 19:37:47 2015 (r292789) @@ -62,6 +62,8 @@ #ifndef _SPARC64_PCI_OFW_PCI_H_ #define _SPARC64_PCI_OFW_PCI_H_ +#include + #include #include "ofw_pci_if.h" @@ -73,6 +75,7 @@ typedef uint32_t ofw_pci_intr_t; #define OFW_PCI_CS_IO 0x01 #define OFW_PCI_CS_MEM32 0x02 #define OFW_PCI_CS_MEM64 0x03 +#define OFW_PCI_NUM_CS 4 /* OFW device types */ #define OFW_TYPE_PCI "pci" @@ -124,4 +127,44 @@ struct ofw_pci_ranges { /* default values */ #define OFW_PCI_LATENCY 64 +/* + * Common and generic parts of host-PCI-bridge support + */ + +struct ofw_pci_softc { + struct rman sc_pci_mem_rman; + struct rman sc_pci_io_rman; + + bus_space_handle_t sc_pci_bh[OFW_PCI_NUM_CS]; + bus_space_tag_t sc_pci_cfgt; + bus_space_tag_t sc_pci_iot; + bus_dma_tag_t sc_pci_dmat; + + struct ofw_bus_iinfo sc_pci_iinfo; + + phandle_t sc_node; + + uint8_t sc_pci_secbus; + uint8_t sc_pci_subbus; +}; + +int ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat, u_long iosize, + u_long memsize); +uint32_t ofw_pci_read_config_common(device_t dev, u_int regmax, u_long offset, + u_int bus, u_int slot, u_int func, u_int reg, int width); +void ofw_pci_write_config_common(device_t dev, u_int regmax, u_long offset, + u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width); +ofw_pci_intr_t ofw_pci_route_interrupt_common(device_t bridge, device_t dev, + int pin); + +void ofw_pci_dmamap_sync_stst_order_common(void); + +bus_activate_resource_t ofw_pci_activate_resource; +bus_adjust_resource_t ofw_pci_adjust_resource; +bus_alloc_resource_t ofw_pci_alloc_resource; +bus_get_dma_tag_t ofw_pci_get_dma_tag; +bus_read_ivar_t ofw_pci_read_ivar; + +ofw_bus_get_node_t ofw_pci_get_node; + #endif /* ! _SPARC64_PCI_OFW_PCI_H_ */ Modified: stable/10/sys/sparc64/pci/psycho.c ============================================================================== --- stable/10/sys/sparc64/pci/psycho.c Sun Dec 27 18:12:13 2015 (r292788) +++ stable/10/sys/sparc64/pci/psycho.c Sun Dec 27 19:37:47 2015 (r292789) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -110,17 +109,12 @@ static void psycho_iommu_init(struct psy */ static device_probe_t psycho_probe; static device_attach_t psycho_attach; -static bus_read_ivar_t psycho_read_ivar; static bus_setup_intr_t psycho_setup_intr; static bus_alloc_resource_t psycho_alloc_resource; -static bus_activate_resource_t psycho_activate_resource; -static bus_adjust_resource_t psycho_adjust_resource; -static bus_get_dma_tag_t psycho_get_dma_tag; static pcib_maxslots_t psycho_maxslots; static pcib_read_config_t psycho_read_config; static pcib_write_config_t psycho_write_config; static pcib_route_interrupt_t psycho_route_interrupt; -static ofw_bus_get_node_t psycho_get_node; static ofw_pci_setup_device_t psycho_setup_device; static device_method_t psycho_methods[] = { @@ -132,15 +126,15 @@ static device_method_t psycho_methods[] DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ - DEVMETHOD(bus_read_ivar, psycho_read_ivar), + DEVMETHOD(bus_read_ivar, ofw_pci_read_ivar), DEVMETHOD(bus_setup_intr, psycho_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, psycho_alloc_resource), - DEVMETHOD(bus_activate_resource, psycho_activate_resource), + DEVMETHOD(bus_activate_resource, ofw_pci_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_adjust_resource, psycho_adjust_resource), + DEVMETHOD(bus_adjust_resource, ofw_pci_adjust_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_get_dma_tag, psycho_get_dma_tag), + DEVMETHOD(bus_get_dma_tag, ofw_pci_get_dma_tag), /* pcib interface */ DEVMETHOD(pcib_maxslots, psycho_maxslots), @@ -149,7 +143,7 @@ static device_method_t psycho_methods[] DEVMETHOD(pcib_route_interrupt, psycho_route_interrupt), /* ofw_bus interface */ - DEVMETHOD(ofw_bus_get_node, psycho_get_node), + DEVMETHOD(ofw_bus_get_node, ofw_pci_get_node), /* ofw_pci interface */ DEVMETHOD(ofw_pci_setup_device, psycho_setup_device), @@ -288,12 +282,12 @@ psycho_attach(device_t dev) { struct psycho_icarg *pica; struct psycho_softc *asc, *sc, *osc; - struct ofw_pci_ranges *range; const struct psycho_desc *desc; bus_addr_t intrclr, intrmap; + bus_dma_tag_t dmat; uint64_t csr, dr; phandle_t node; - uint32_t dvmabase, prop, prop_array[2]; + uint32_t dvmabase, prop; u_int rerun, ver; int i, j; @@ -301,7 +295,6 @@ psycho_attach(device_t dev) sc = device_get_softc(dev); desc = psycho_get_desc(dev); - sc->sc_node = node; sc->sc_dev = dev; sc->sc_mode = desc->pd_mode; @@ -367,6 +360,7 @@ psycho_attach(device_t dev) panic("%s: mutex not initialized", __func__); sc->sc_mtx = osc->sc_mtx; } + SLIST_INSERT_HEAD(&psycho_softcs, sc, sc_link); csr = PSYCHO_READ8(sc, PSR_CS); ver = PSYCHO_GCSR_VERS(csr); @@ -435,43 +429,6 @@ psycho_attach(device_t dev) } else dvmabase = -1; - /* Initialize memory and I/O rmans. */ - sc->sc_pci_io_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_io_rman.rm_descr = "Psycho PCI I/O Ports"; - if (rman_init(&sc->sc_pci_io_rman) != 0 || - rman_manage_region(&sc->sc_pci_io_rman, 0, PSYCHO_IO_SIZE) != 0) - panic("%s: failed to set up I/O rman", __func__); - sc->sc_pci_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_pci_mem_rman.rm_descr = "Psycho PCI Memory"; - if (rman_init(&sc->sc_pci_mem_rman) != 0 || - rman_manage_region(&sc->sc_pci_mem_rman, 0, PSYCHO_MEM_SIZE) != 0) - panic("%s: failed to set up memory rman", __func__); - - i = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range); - /* - * Make sure that the expected ranges are present. The - * OFW_PCI_CS_MEM64 one is not currently used though. - */ - if (i != PSYCHO_NRANGE) - panic("%s: unsupported number of ranges", __func__); - /* - * Find the addresses of the various bus spaces. - * There should not be multiple ones of one kind. - * The physical start addresses of the ranges are the configuration, - * memory and I/O handles. - */ - for (i = 0; i < PSYCHO_NRANGE; i++) { - j = OFW_PCI_RANGE_CS(&range[i]); - if (sc->sc_pci_bh[j] != 0) - panic("%s: duplicate range for space %d", - __func__, j); - sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]); - } - free(range, M_OFWPROP); - - /* Register the softc, this is needed for paired Psychos. */ - SLIST_INSERT_HEAD(&psycho_softcs, sc, sc_link); - /* * If we're a Hummingbird/Sabre or the first of a pair of Psychos * to arrive here, do the interrupt setup and start up the IOMMU. @@ -572,39 +529,21 @@ psycho_attach(device_t dev) iommu_reset(sc->sc_is); } - /* Allocate our tags. */ - sc->sc_pci_iot = sparc64_alloc_bus_tag(NULL, rman_get_bustag( - sc->sc_mem_res), PCI_IO_BUS_SPACE, NULL); - if (sc->sc_pci_iot == NULL) - panic("%s: could not allocate PCI I/O tag", __func__); - sc->sc_pci_cfgt = sparc64_alloc_bus_tag(NULL, rman_get_bustag( - sc->sc_mem_res), PCI_CONFIG_BUS_SPACE, NULL); - if (sc->sc_pci_cfgt == NULL) - panic("%s: could not allocate PCI configuration space tag", - __func__); + /* Create our DMA tag. */ if (bus_dma_tag_create(bus_get_dma_tag(dev), 8, 0, sc->sc_is->is_pmaxaddr, ~0, NULL, NULL, sc->sc_is->is_pmaxaddr, - 0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_pci_dmat) != 0) + 0xff, 0xffffffff, 0, NULL, NULL, &dmat) != 0) panic("%s: could not create PCI DMA tag", __func__); - /* Customize the tag. */ - sc->sc_pci_dmat->dt_cookie = sc->sc_is; - sc->sc_pci_dmat->dt_mt = sc->sc_dma_methods; - - i = OF_getprop(node, "bus-range", (void *)prop_array, - sizeof(prop_array)); - if (i == -1) - panic("%s: could not get bus-range", __func__); - if (i != sizeof(prop_array)) - panic("%s: broken bus-range (%d)", __func__, i); - sc->sc_pci_secbus = prop_array[0]; - sc->sc_pci_subbus = prop_array[1]; - if (bootverbose) - device_printf(dev, "bus range %u to %u; PCI bus %d\n", - sc->sc_pci_secbus, sc->sc_pci_subbus, sc->sc_pci_secbus); + dmat->dt_cookie = sc->sc_is; + dmat->dt_mt = sc->sc_dma_methods; + + if (ofw_pci_attach_common(dev, dmat, PSYCHO_IO_SIZE, + PSYCHO_MEM_SIZE) != 0) + panic("%s: ofw_pci_attach_common() failed", __func__); /* Clear any pending PCI error bits. */ - PCIB_WRITE_CONFIG(dev, sc->sc_pci_secbus, PCS_DEVICE, PCS_FUNC, - PCIR_STATUS, PCIB_READ_CONFIG(dev, sc->sc_pci_secbus, + PCIB_WRITE_CONFIG(dev, sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, + PCIR_STATUS, PCIB_READ_CONFIG(dev, sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, PCIR_STATUS, 2), 2); PCICTL_WRITE8(sc, PCR_CS, PCICTL_READ8(sc, PCR_CS)); PCICTL_WRITE8(sc, PCR_AFS, PCICTL_READ8(sc, PCR_AFS)); @@ -667,20 +606,20 @@ psycho_attach(device_t dev) * Set the latency timer register as this isn't always done by the * firmware. */ - PCIB_WRITE_CONFIG(dev, sc->sc_pci_secbus, PCS_DEVICE, PCS_FUNC, + PCIB_WRITE_CONFIG(dev, sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, PCIR_LATTIMER, OFW_PCI_LATENCY, 1); for (i = PCIR_VENDOR; i < PCIR_STATUS; i += sizeof(uint16_t)) - le16enc(&sc->sc_pci_hpbcfg[i], bus_space_read_2( - sc->sc_pci_cfgt, sc->sc_pci_bh[OFW_PCI_CS_CONFIG], - PSYCHO_CONF_OFF(sc->sc_pci_secbus, PCS_DEVICE, + le16enc(&sc->sc_pci_hpbcfg[i], + bus_space_read_2(sc->sc_ops.sc_pci_cfgt, + sc->sc_ops.sc_pci_bh[OFW_PCI_CS_CONFIG], + PSYCHO_CONF_OFF(sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, i))); for (i = PCIR_REVID; i <= PCIR_BIST; i += sizeof(uint8_t)) - sc->sc_pci_hpbcfg[i] = bus_space_read_1(sc->sc_pci_cfgt, - sc->sc_pci_bh[OFW_PCI_CS_CONFIG], PSYCHO_CONF_OFF( - sc->sc_pci_secbus, PCS_DEVICE, PCS_FUNC, i)); + sc->sc_pci_hpbcfg[i] = bus_space_read_1(sc->sc_ops.sc_pci_cfgt, + sc->sc_ops.sc_pci_bh[OFW_PCI_CS_CONFIG], PSYCHO_CONF_OFF( + sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, i)); - ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(ofw_pci_intr_t)); /* * On E250 the interrupt map entry for the EBus bridge is wrong, * causing incorrect interrupts to be assigned to some devices on @@ -691,9 +630,9 @@ psycho_attach(device_t dev) * EBus devices will be used directly instead. */ if (strcmp(sparc64_model, "SUNW,Ultra-250") == 0 && - sc->sc_pci_iinfo.opi_imapmsk != NULL) - *(ofw_pci_intr_t *)(&sc->sc_pci_iinfo.opi_imapmsk[ - sc->sc_pci_iinfo.opi_addrc]) = INTMAP_INO_MASK; + sc->sc_ops.sc_pci_iinfo.opi_imapmsk != NULL) + *(ofw_pci_intr_t *)(&sc->sc_ops.sc_pci_iinfo.opi_imapmsk[ + sc->sc_ops.sc_pci_iinfo.opi_addrc]) = INTMAP_INO_MASK; device_add_child(dev, "pci", -1); return (bus_generic_attach(dev)); @@ -927,20 +866,8 @@ psycho_read_config(device_t dev, u_int b int width) { struct psycho_softc *sc; - bus_space_handle_t bh; - u_long offset = 0; - uint8_t byte; - uint16_t shrt; - uint32_t r, wrd; - int i; sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCI_REGMAX) - return (-1); - - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - /* * The Hummingbird and Sabre bridges are picky in that they * only allow their config space to be accessed using the @@ -956,9 +883,9 @@ psycho_read_config(device_t dev, u_int b * The Psycho bridges contain a dupe of their header at 0x80 * which we nullify that way also. */ - if (bus == sc->sc_pci_secbus && slot == PCS_DEVICE && + if (bus == sc->sc_ops.sc_pci_secbus && slot == PCS_DEVICE && func == PCS_FUNC) { - if (offset % width != 0) + if (reg % width != 0) return (-1); if (reg >= sizeof(sc->sc_pci_hpbcfg)) @@ -967,8 +894,9 @@ psycho_read_config(device_t dev, u_int b if ((reg < PCIR_STATUS && reg + width > PCIR_STATUS) || reg == PCIR_STATUS || reg == PCIR_STATUS + 1) le16enc(&sc->sc_pci_hpbcfg[PCIR_STATUS], - bus_space_read_2(sc->sc_pci_cfgt, bh, - PSYCHO_CONF_OFF(sc->sc_pci_secbus, + bus_space_read_2(sc->sc_ops.sc_pci_cfgt, + sc->sc_ops.sc_pci_bh[OFW_PCI_CS_CONFIG], + PSYCHO_CONF_OFF(sc->sc_ops.sc_pci_secbus, PCS_DEVICE, PCS_FUNC, PCIR_STATUS))); switch (width) { @@ -981,79 +909,29 @@ psycho_read_config(device_t dev, u_int b } } - offset = PSYCHO_CONF_OFF(bus, slot, func, reg); - switch (width) { - case 1: - i = bus_space_peek_1(sc->sc_pci_cfgt, bh, offset, &byte); - r = byte; - break; - case 2: - i = bus_space_peek_2(sc->sc_pci_cfgt, bh, offset, &shrt); - r = shrt; - break; - case 4: - i = bus_space_peek_4(sc->sc_pci_cfgt, bh, offset, &wrd); - r = wrd; - break; - default: - panic("%s: bad width", __func__); - /* NOTREACHED */ - } - - if (i) { -#ifdef PSYCHO_DEBUG - printf("%s: read data error reading: %d.%d.%d: 0x%x\n", - __func__, bus, slot, func, reg); -#endif - r = -1; - } - return (r); + return (ofw_pci_read_config_common(dev, PCI_REGMAX, + PSYCHO_CONF_OFF(bus, slot, func, reg), bus, slot, func, reg, + width)); } static void psycho_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, uint32_t val, int width) { - struct psycho_softc *sc; - bus_space_handle_t bh; - u_long offset = 0; - sc = device_get_softc(dev); - if (bus < sc->sc_pci_secbus || bus > sc->sc_pci_subbus || - slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCI_REGMAX) - return; - - offset = PSYCHO_CONF_OFF(bus, slot, func, reg); - bh = sc->sc_pci_bh[OFW_PCI_CS_CONFIG]; - switch (width) { - case 1: - bus_space_write_1(sc->sc_pci_cfgt, bh, offset, val); - break; - case 2: - bus_space_write_2(sc->sc_pci_cfgt, bh, offset, val); - break; - case 4: - bus_space_write_4(sc->sc_pci_cfgt, bh, offset, val); - break; - default: - panic("%s: bad width", __func__); - /* NOTREACHED */ - } + ofw_pci_write_config_common(dev, PCI_REGMAX, PSYCHO_CONF_OFF(bus, + slot, func, reg), bus, slot, func, reg, val, width); } static int psycho_route_interrupt(device_t bridge, device_t dev, int pin) { struct psycho_softc *sc; - struct ofw_pci_register reg; bus_addr_t intrmap; - ofw_pci_intr_t pintr, mintr; + ofw_pci_intr_t mintr; - sc = device_get_softc(bridge); - pintr = pin; - if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, - ®, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), - NULL)) + mintr = ofw_pci_route_interrupt_common(bridge, dev, pin); + if (PCI_INTERRUPT_VALID(mintr)) return (mintr); /* * If this is outside of the range for an intpin, it's likely a full @@ -1072,6 +950,7 @@ psycho_route_interrupt(device_t bridge, * for bus A are one-based, while those for bus B seemingly have an * offset of 2 (hence the factor of 3 below). */ + sc = device_get_softc(dev); intrmap = PSR_PCIA0_INT_MAP + 8 * (pci_get_slot(dev) - 1 + 3 * sc->sc_half); mintr = INTINO(PSYCHO_READ8(sc, intrmap)) + pin - 1; @@ -1081,23 +960,6 @@ psycho_route_interrupt(device_t bridge, return (mintr); } -static int -psycho_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) -{ - struct psycho_softc *sc; - - sc = device_get_softc(dev); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Sun Dec 27 19:47:57 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D055A53E62; Sun, 27 Dec 2015 19:47:57 +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 2B04D1EB3; Sun, 27 Dec 2015 19:47:57 +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 tBRJlutu071702; Sun, 27 Dec 2015 19:47:56 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRJlu1O071701; Sun, 27 Dec 2015 19:47:56 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512271947.tBRJlu1O071701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 19:47:56 +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: r292790 - stable/10/sys/dev/vt/colors X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 19:47:57 -0000 Author: marius Date: Sun Dec 27 19:47:56 2015 New Revision: 292790 URL: https://svnweb.freebsd.org/changeset/base/292790 Log: MFC: r285912 - Use __FBSDID(). - Const'ify cons_to_vga_colors. - Fix line wrapping. Modified: stable/10/sys/dev/vt/colors/vt_termcolors.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/colors/vt_termcolors.c ============================================================================== --- stable/10/sys/dev/vt/colors/vt_termcolors.c Sun Dec 27 19:37:47 2015 (r292789) +++ stable/10/sys/dev/vt/colors/vt_termcolors.c Sun Dec 27 19:47:56 2015 (r292790) @@ -25,15 +25,16 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include -static struct { +static const struct { unsigned char r; /* Red percentage value. */ unsigned char g; /* Green percentage value. */ unsigned char b; /* Blue percentage value. */ @@ -68,8 +69,8 @@ static const int cons_to_vga_colors[16] }; int -vt_generate_cons_palette(uint32_t *palette, int format, uint32_t rmax, int roffset, - uint32_t gmax, int goffset, uint32_t bmax, int boffset) +vt_generate_cons_palette(uint32_t *palette, int format, uint32_t rmax, + int roffset, uint32_t gmax, int goffset, uint32_t bmax, int boffset) { int i; From owner-svn-src-stable-10@freebsd.org Sun Dec 27 20:49:34 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A9ACA53034; Sun, 27 Dec 2015 20:49:34 +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 CB21D198E; Sun, 27 Dec 2015 20:49:33 +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 tBRKnWe6089483; Sun, 27 Dec 2015 20:49:32 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRKnW2b089482; Sun, 27 Dec 2015 20:49:32 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512272049.tBRKnW2b089482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 20:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292792 - stable/10/sys/dev/usb/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 20:49:34 -0000 Author: marius Date: Sun Dec 27 20:49:32 2015 New Revision: 292792 URL: https://svnweb.freebsd.org/changeset/base/292792 Log: MFC: r285909, r285913 (partial) - Probe UICLASS_CDC/UISUBCLASS_ABSTRACT_CONTROL_MODEL/0xff again. This variant of Microsoft RNDIS, i. e. their unofficial version of CDC ACM, has been disabled in r261544 (r262363 in stable/10) for resolving a conflict with umodem(4). Eventually, in r275790 (r276243 in stable/10) that problem was dealt with in the right way. However, r275790 failed to put probing of RNDIS devices in question back. - Initialize the device prior to querying it, as required by the RNDIS specification. Otherwise already determining the MAC address may fail rightfully. - On detach, halt the device again. - Use UCDC_SEND_ENCAPSULATED_{COMMAND,RESPONSE}. While these macros are resolving to the same values as UR_{CLEAR_FEATURE,GET_STATUS}, the former set is way more appropriate in this context. - Report unknown - rather: unimplemented - events unconditionally and not just in debug mode. This ensures that we'll get some hint of what is going wrong instead of the driver silently failing. - Deal with the Microsoft ActiveSync requirement of using an input buffer the size of the expected reply or larger - except for variably sized replies - when querying a device. - Fix some pointless NULL checks, style bugs etc. This changes allow urndis(4) to communicate with a Microsoft-certified USB RNDIS test token. Modified: stable/10/sys/dev/usb/net/if_urndis.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/net/if_urndis.c ============================================================================== --- stable/10/sys/dev/usb/net/if_urndis.c Sun Dec 27 19:48:02 2015 (r292791) +++ stable/10/sys/dev/usb/net/if_urndis.c Sun Dec 27 20:49:32 2015 (r292792) @@ -78,12 +78,20 @@ static uether_fn_t urndis_start; static uether_fn_t urndis_setmulti; static uether_fn_t urndis_setpromisc; -static uint32_t urndis_ctrl_query(struct urndis_softc *, uint32_t, const void **, uint16_t *); -static uint32_t urndis_ctrl_set(struct urndis_softc *, uint32_t, struct urndis_set_req *, uint16_t); -static uint32_t urndis_ctrl_handle_init(struct urndis_softc *, const struct urndis_comp_hdr *); -static uint32_t urndis_ctrl_handle_query(struct urndis_softc *, const struct urndis_comp_hdr *, const void **, uint16_t *); -static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *, const struct urndis_comp_hdr *); -static uint32_t urndis_ctrl_init(struct urndis_softc *); +static uint32_t urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, + struct urndis_query_req *msg, uint16_t len, + const void **rbuf, uint16_t *rbufsz); +static uint32_t urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, + struct urndis_set_req *msg, uint16_t len); +static uint32_t urndis_ctrl_handle_init(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr); +static uint32_t urndis_ctrl_handle_query(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr, const void **buf, + uint16_t *bufsz); +static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr); +static uint32_t urndis_ctrl_init(struct urndis_softc *sc); +static uint32_t urndis_ctrl_halt(struct urndis_softc *sc); #ifdef USB_DEBUG static int urndis_debug = 0; @@ -93,7 +101,6 @@ SYSCTL_INT(_hw_usb_urndis, OID_AUTO, deb #endif static const struct usb_config urndis_config[URNDIS_N_TRANSFER] = { - [URNDIS_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -154,7 +161,7 @@ static driver_t urndis_driver = { static devclass_t urndis_devclass; -DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, 0); +DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, NULL); MODULE_VERSION(urndis, 1); MODULE_DEPEND(urndis, uether, 1, 1, 1); MODULE_DEPEND(urndis, usb, 1, 1, 1); @@ -171,6 +178,9 @@ static const struct usb_ether_methods ur static const STRUCT_USB_HOST_ID urndis_host_devs[] = { /* Generic RNDIS class match */ + {USB_IFACE_CLASS(UICLASS_CDC), + USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL), + USB_IFACE_PROTOCOL(0xff)}, {USB_IFACE_CLASS(UICLASS_WIRELESS), USB_IFACE_SUBCLASS(UISUBCLASS_RF), USB_IFACE_PROTOCOL(UIPROTO_RNDIS)}, {USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(UISUBCLASS_SYNC), @@ -192,21 +202,27 @@ urndis_probe(device_t dev) static void urndis_attach_post(struct usb_ether *ue) { + /* no-op */ - return; } static int urndis_attach(device_t dev) { + static struct { + union { + struct urndis_query_req query; + struct urndis_set_req set; + } hdr; + union { + uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t filter; + } ibuf; + } msg; struct urndis_softc *sc = device_get_softc(dev); struct usb_ether *ue = &sc->sc_ue; struct usb_attach_arg *uaa = device_get_ivars(dev); struct usb_cdc_cm_descriptor *cmd; - struct { - struct urndis_set_req hdr; - uint32_t filter; - } msg_filter; const void *buf; uint16_t bufsz; uint8_t iface_index[2] = { uaa->info.bIfaceIndex + 1, uaa->info.bIfaceIndex }; @@ -228,9 +244,7 @@ urndis_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); /* scan the alternate settings looking for a valid one */ - for (i = 0; i != 32; i++) { - error = usbd_set_alt_interface_index(uaa->device, iface_index[0], i); @@ -244,16 +258,27 @@ urndis_attach(device_t dev) if (error == 0) break; } - if ((error != 0) || (i == 32)) { - device_printf(dev, "No valid alternate " - "setting found\n"); + device_printf(dev, "No valid alternate setting found\n"); goto detach; } + + /* Initialize device - must be done before even querying it */ URNDIS_LOCK(sc); - error = urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, &buf, &bufsz); + error = urndis_ctrl_init(sc); URNDIS_UNLOCK(sc); + if (error != (int)RNDIS_STATUS_SUCCESS) { + device_printf(dev, "Unable to initialize hardware\n"); + goto detach; + } + /* Determine MAC address */ + memset(msg.ibuf.eaddr, 0, sizeof(msg.ibuf.eaddr)); + URNDIS_LOCK(sc); + error = urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, + &msg.hdr.query, sizeof(msg.hdr.query) + sizeof(msg.ibuf.eaddr), + &buf, &bufsz); + URNDIS_UNLOCK(sc); if (error != (int)RNDIS_STATUS_SUCCESS) { device_printf(dev, "Unable to get hardware address\n"); goto detach; @@ -267,17 +292,16 @@ urndis_attach(device_t dev) /* Initialize packet filter */ sc->sc_filter = RNDIS_PACKET_TYPE_BROADCAST | RNDIS_PACKET_TYPE_ALL_MULTICAST; - msg_filter.filter = htole32(sc->sc_filter); - + msg.ibuf.filter = htole32(sc->sc_filter); URNDIS_LOCK(sc); error = urndis_ctrl_set(sc, OID_GEN_CURRENT_PACKET_FILTER, - &msg_filter.hdr, sizeof(msg_filter)); + &msg.hdr.set, sizeof(msg.hdr.set) + sizeof(msg.ibuf.filter)); URNDIS_UNLOCK(sc); - if (error != (int)RNDIS_STATUS_SUCCESS) { device_printf(dev, "Unable to set data filters\n"); goto detach; } + ue->ue_sc = sc; ue->ue_dev = dev; ue->ue_udev = uaa->device; @@ -298,7 +322,7 @@ urndis_attach(device_t dev) return (0); /* success */ detach: - urndis_detach(dev); + (void)urndis_detach(dev); return (ENXIO); /* failure */ } @@ -313,6 +337,10 @@ urndis_detach(device_t dev) uether_ifdetach(ue); + URNDIS_LOCK(sc); + (void)urndis_ctrl_halt(sc); + URNDIS_UNLOCK(sc); + mtx_destroy(&sc->sc_mtx); return (0); @@ -340,8 +368,6 @@ urndis_init(struct usb_ether *ue) ifp->if_drv_flags |= IFF_DRV_RUNNING; - urndis_ctrl_init(sc); - /* stall data write direction, which depends on USB mode */ usbd_xfer_set_stall(sc->sc_xfer[URNDIS_BULK_TX]); @@ -369,20 +395,21 @@ urndis_stop(struct usb_ether *ue) static void urndis_setmulti(struct usb_ether *ue) { + /* no-op */ - return; } static void urndis_setpromisc(struct usb_ether *ue) { + /* no-op */ - return; } static int urndis_suspend(device_t dev) { + device_printf(dev, "Suspending\n"); return (0); } @@ -390,6 +417,7 @@ urndis_suspend(device_t dev) static int urndis_resume(device_t dev) { + device_printf(dev, "Resuming\n"); return (0); } @@ -416,8 +444,8 @@ urndis_ctrl_send(struct urndis_softc *sc { usb_error_t err; - err = urndis_ctrl_msg(sc, UT_WRITE_CLASS_INTERFACE, UR_GET_STATUS, - sc->sc_ifaceno_ctl, 0, buf, len); + err = urndis_ctrl_msg(sc, UT_WRITE_CLASS_INTERFACE, + UCDC_SEND_ENCAPSULATED_COMMAND, sc->sc_ifaceno_ctl, 0, buf, len); DPRINTF("%s\n", usbd_errstr(err)); @@ -430,8 +458,9 @@ urndis_ctrl_recv(struct urndis_softc *sc struct urndis_comp_hdr *hdr; usb_error_t err; - err = urndis_ctrl_msg(sc, UT_READ_CLASS_INTERFACE, UR_CLEAR_FEATURE, - sc->sc_ifaceno_ctl, 0, sc->sc_response_buf, RNDIS_RESPONSE_LEN); + err = urndis_ctrl_msg(sc, UT_READ_CLASS_INTERFACE, + UCDC_GET_ENCAPSULATED_RESPONSE, sc->sc_ifaceno_ctl, 0, + sc->sc_response_buf, RNDIS_RESPONSE_LEN); if (err != USB_ERR_NORMAL_COMPLETION) return (NULL); @@ -480,7 +509,8 @@ urndis_ctrl_handle(struct urndis_softc * break; default: - DPRINTF("ctrl message error: unknown event 0x%x\n", + device_printf(sc->sc_ue.ue_dev, + "ctrl message error: unknown event 0x%x\n", le32toh(hdr->rm_type)); rval = RNDIS_STATUS_FAILURE; break; @@ -548,10 +578,8 @@ urndis_ctrl_handle_query(struct urndis_s le32toh(msg->rm_infobuflen), le32toh(msg->rm_infobufoffset)); - if (buf != NULL && bufsz != NULL) { - *buf = NULL; - *bufsz = 0; - } + *buf = NULL; + *bufsz = 0; if (le32toh(msg->rm_status) != RNDIS_STATUS_SUCCESS) { DPRINTF("query failed 0x%x\n", le32toh(msg->rm_status)); return (le32toh(msg->rm_status)); @@ -571,10 +599,10 @@ urndis_ctrl_handle_query(struct urndis_s le32toh(msg->rm_len)); return (RNDIS_STATUS_FAILURE); } - if (buf != NULL && bufsz != NULL) { - *buf = ((const uint8_t *)msg) + RNDIS_HEADER_OFFSET + le32toh(msg->rm_infobufoffset); - *bufsz = le32toh(msg->rm_infobuflen); - } + *buf = ((const uint8_t *)msg) + RNDIS_HEADER_OFFSET + + le32toh(msg->rm_infobufoffset); + *bufsz = le32toh(msg->rm_infobuflen); + return (le32toh(msg->rm_status)); } @@ -627,7 +655,7 @@ urndis_ctrl_init(struct urndis_softc *sc msg.rm_type = htole32(REMOTE_NDIS_INITIALIZE_MSG); msg.rm_len = htole32(sizeof(msg)); - msg.rm_rid = htole32(0); + msg.rm_rid = 0; msg.rm_ver_major = htole32(1); msg.rm_ver_minor = htole32(1); msg.rm_max_xfersz = htole32(RNDIS_RX_MAXLEN); @@ -656,7 +684,6 @@ urndis_ctrl_init(struct urndis_softc *sc return (rval); } -#if 0 static uint32_t urndis_ctrl_halt(struct urndis_softc *sc) { @@ -675,39 +702,48 @@ urndis_ctrl_halt(struct urndis_softc *sc rval = urndis_ctrl_send(sc, &msg, sizeof(msg)); if (rval != RNDIS_STATUS_SUCCESS) - printf("halt failed\n"); + DPRINTF("halt failed\n"); return (rval); } -#endif - +/* + * NB: Querying a device has the requirment of using an input buffer the size + * of the expected reply or larger, except for variably sized replies. + */ static uint32_t -urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, const void **rbuf, uint16_t *rbufsz) +urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, + struct urndis_query_req *msg, uint16_t len, const void **rbuf, + uint16_t *rbufsz) { - struct urndis_query_req msg; - uint32_t rval; struct urndis_comp_hdr *hdr; + uint32_t datalen, rval; - msg.rm_type = htole32(REMOTE_NDIS_QUERY_MSG); - msg.rm_len = htole32(sizeof(msg)); - msg.rm_rid = 0; /* XXX */ - msg.rm_oid = htole32(oid); - msg.rm_infobuflen = htole32(0); - msg.rm_infobufoffset = 0; - msg.rm_devicevchdl = 0; + msg->rm_type = htole32(REMOTE_NDIS_QUERY_MSG); + msg->rm_len = htole32(len); + msg->rm_rid = 0; /* XXX */ + msg->rm_oid = htole32(oid); + datalen = len - sizeof(*msg); + msg->rm_infobuflen = htole32(datalen); + if (datalen != 0) { + msg->rm_infobufoffset = htole32(sizeof(*msg) - + RNDIS_HEADER_OFFSET); + } else { + msg->rm_infobufoffset = 0; + } + msg->rm_devicevchdl = 0; DPRINTF("type %u len %u rid %u oid 0x%x " "infobuflen %u infobufoffset %u devicevchdl %u\n", - le32toh(msg.rm_type), - le32toh(msg.rm_len), - le32toh(msg.rm_rid), - le32toh(msg.rm_oid), - le32toh(msg.rm_infobuflen), - le32toh(msg.rm_infobufoffset), - le32toh(msg.rm_devicevchdl)); + le32toh(msg->rm_type), + le32toh(msg->rm_len), + le32toh(msg->rm_rid), + le32toh(msg->rm_oid), + le32toh(msg->rm_infobuflen), + le32toh(msg->rm_infobufoffset), + le32toh(msg->rm_devicevchdl)); - rval = urndis_ctrl_send(sc, &msg, sizeof(msg)); + rval = urndis_ctrl_send(sc, msg, len); if (rval != RNDIS_STATUS_SUCCESS) { DPRINTF("query failed\n"); @@ -723,19 +759,21 @@ urndis_ctrl_query(struct urndis_softc *s } static uint32_t -urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, struct urndis_set_req *msg, uint16_t len) +urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, + struct urndis_set_req *msg, uint16_t len) { struct urndis_comp_hdr *hdr; - uint32_t rval; - uint32_t datalen = len - sizeof(*msg); + uint32_t datalen, rval; msg->rm_type = htole32(REMOTE_NDIS_SET_MSG); msg->rm_len = htole32(len); msg->rm_rid = 0; /* XXX */ msg->rm_oid = htole32(oid); + datalen = len - sizeof(*msg); msg->rm_infobuflen = htole32(datalen); if (datalen != 0) { - msg->rm_infobufoffset = htole32(sizeof(*msg) - RNDIS_HEADER_OFFSET); + msg->rm_infobufoffset = htole32(sizeof(*msg) - + RNDIS_HEADER_OFFSET); } else { msg->rm_infobufoffset = 0; } @@ -782,13 +820,11 @@ urndis_bulk_read_callback(struct usb_xfe switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - usbd_xfer_status(xfer, &actlen, NULL, &aframes, NULL); DPRINTFN(1, "received %u bytes in %u frames\n", actlen, aframes); for (offset = 0; actlen >= (uint32_t)sizeof(msg);) { - /* copy out header */ usbd_copy_out(pc, offset, &msg, sizeof(msg)); @@ -930,7 +966,7 @@ tr_setup: usbd_xfer_set_frame_offset(xfer, x * RNDIS_TX_MAXLEN, x); - next_pkt: +next_pkt: IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) From owner-svn-src-stable-10@freebsd.org Sun Dec 27 20:52:33 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF998A531D4; Sun, 27 Dec 2015 20:52: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 7F8BC1E15; Sun, 27 Dec 2015 20:52:33 +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 tBRKqWch092246; Sun, 27 Dec 2015 20:52:32 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRKqW9U092244; Sun, 27 Dec 2015 20:52:32 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512272052.tBRKqW9U092244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 20:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292794 - stable/10/sys/dev/mpt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 20:52:33 -0000 Author: marius Date: Sun Dec 27 20:52:32 2015 New Revision: 292794 URL: https://svnweb.freebsd.org/changeset/base/292794 Log: MFC: r285840 - In mpt_send_handshake_cmd(), use bus_space_write_stream_4(9) for writing raw data to the doorbell offset in order to clarify the intent and for avoiding unnecessarily converting the endianess back and forth. Unfortunately, the same can't be done in mpt_recv_handshake_reply() as 16-bit data needs to be read using 32-bit bus accessors. - In mpt_recv_handshake_reply(), get rid of a redundant variable. Modified: stable/10/sys/dev/mpt/mpt.c stable/10/sys/dev/mpt/mpt.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mpt/mpt.c ============================================================================== --- stable/10/sys/dev/mpt/mpt.c Sun Dec 27 20:49:36 2015 (r292793) +++ stable/10/sys/dev/mpt/mpt.c Sun Dec 27 20:52:32 2015 (r292794) @@ -1423,7 +1423,7 @@ mpt_send_handshake_cmd(struct mpt_softc /* Send the command */ for (i = 0; i < len; i++) { - mpt_write(mpt, MPT_OFFSET_DOORBELL, htole32(*data32++)); + mpt_write_stream(mpt, MPT_OFFSET_DOORBELL, *data32++); if (mpt_wait_db_ack(mpt) != MPT_OK) { mpt_prt(mpt, "mpt_send_handshake_cmd: timeout @ index %d\n", i); @@ -1457,7 +1457,7 @@ mpt_recv_handshake_reply(struct mpt_soft *data16++ = le16toh(data & MPT_DB_DATA_MASK); mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0); - /* Get Second Word */ + /* Get second word */ if (mpt_wait_db_int(mpt) != MPT_OK) { mpt_prt(mpt, "mpt_recv_handshake_cmd timeout2\n"); return ETIMEDOUT; @@ -1481,18 +1481,13 @@ mpt_recv_handshake_reply(struct mpt_soft left = (hdr->MsgLength << 1) - 2; reply_left = reply_len - 2; while (left--) { - u_int16_t datum; - if (mpt_wait_db_int(mpt) != MPT_OK) { mpt_prt(mpt, "mpt_recv_handshake_cmd timeout3\n"); return ETIMEDOUT; } data = mpt_read(mpt, MPT_OFFSET_DOORBELL); - datum = le16toh(data & MPT_DB_DATA_MASK); - if (reply_left-- > 0) - *data16++ = datum; - + *data16++ = le16toh(data & MPT_DB_DATA_MASK); mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0); } Modified: stable/10/sys/dev/mpt/mpt.h ============================================================================== --- stable/10/sys/dev/mpt/mpt.h Sun Dec 27 20:49:36 2015 (r292793) +++ stable/10/sys/dev/mpt/mpt.h Sun Dec 27 20:52:32 2015 (r292794) @@ -329,7 +329,6 @@ typedef struct mpt_config_params { } cfgparms_t; /**************************** MPI Target State Info ***************************/ - typedef struct { uint32_t reply_desc; /* current reply descriptor */ uint32_t resid; /* current data residual */ @@ -784,6 +783,7 @@ mpt_assign_serno(struct mpt_softc *mpt, /******************************* Register Access ******************************/ static __inline void mpt_write(struct mpt_softc *, size_t, uint32_t); +static __inline void mpt_write_stream(struct mpt_softc *, size_t, uint32_t); static __inline uint32_t mpt_read(struct mpt_softc *, int); static __inline void mpt_pio_write(struct mpt_softc *, size_t, uint32_t); static __inline uint32_t mpt_pio_read(struct mpt_softc *, int); @@ -794,6 +794,12 @@ mpt_write(struct mpt_softc *mpt, size_t bus_space_write_4(mpt->pci_st, mpt->pci_sh, offset, val); } +static __inline void +mpt_write_stream(struct mpt_softc *mpt, size_t offset, uint32_t val) +{ + bus_space_write_stream_4(mpt->pci_st, mpt->pci_sh, offset, val); +} + static __inline uint32_t mpt_read(struct mpt_softc *mpt, int offset) { @@ -818,6 +824,7 @@ mpt_pio_read(struct mpt_softc *mpt, int KASSERT(mpt->pci_pio_reg != NULL, ("no PIO resource")); return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset)); } + /*********************** Reply Frame/Request Management ***********************/ /* Max MPT Reply we are willing to accept (must be power of 2) */ #define MPT_REPLY_SIZE 256 @@ -958,6 +965,7 @@ mpt_cdblen(uint8_t cdb0, int maxlen) return (16); } } + #ifdef INVARIANTS static __inline request_t * mpt_tag_2_req(struct mpt_softc *, uint32_t); static __inline request_t * @@ -1136,6 +1144,7 @@ mpt_write_cur_cfg_page(struct mpt_softc PageAddress, hdr, len, sleep_ok, timeout_ms)); } + /* mpt_debug.c functions */ void mpt_print_reply(void *vmsg); void mpt_print_db(uint32_t mb); @@ -1145,4 +1154,5 @@ void mpt_req_state(mpt_req_state_t state void mpt_print_config_request(void *vmsg); void mpt_print_request(void *vmsg); void mpt_dump_sgl(SGE_IO_UNION *se, int offset); + #endif /* _MPT_H_ */ From owner-svn-src-stable-10@freebsd.org Sun Dec 27 20:54:49 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B84FAA5326F; Sun, 27 Dec 2015 20:54:49 +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 79BEF1FD4; Sun, 27 Dec 2015 20:54:49 +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 tBRKsmhT092381; Sun, 27 Dec 2015 20:54:48 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRKsmwE092378; Sun, 27 Dec 2015 20:54:48 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512272054.tBRKsmwE092378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Dec 2015 20:54: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: r292795 - stable/10/tools/regression/lib/msun X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 20:54:49 -0000 Author: ngie Date: Sun Dec 27 20:54:48 2015 New Revision: 292795 URL: https://svnweb.freebsd.org/changeset/base/292795 Log: MFC r292491,r292493,r292496: r292491: Disable test-ctrig.t testcases which fail assertions on i386 [*] Also, don't compile the exp2l(3) testcases on platforms that don't support the libcall (technically only x86 right now). This makes this test buildable on arm*/mips*/powerpc* Tested on: stable/10 (amd64/i386), head (amd64/i386) PR: 205446 [*] X-MFC to: stable/10 Sponsored by: EMC / Isilon Storage Division r292493: Don't run test-fma on i386 It completely fails all assertions on i386 on both stable/9 and stable/10 PR: 205448 X-MFC to: stable/10 Sponsored by: EMC / Isilon Storage Division r292496: Skip the testcases on i386 (all the assertions fail) [*] Also, don't compile the ldexpl(3) testcases on platforms that don't support the libcall (technically only x86 right now). This makes this test buildable on arm*/mips*/powerpc* PR: 205449 [*] Tested on: stable/10 (amd64/i386), head (amd64/i386) Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tools/regression/lib/msun/test-exponential.c stable/10/tools/regression/lib/msun/test-invtrig.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/lib/msun/test-exponential.c ============================================================================== --- stable/10/tools/regression/lib/msun/test-exponential.c Sun Dec 27 20:52:32 2015 (r292794) +++ stable/10/tools/regression/lib/msun/test-exponential.c Sun Dec 27 20:54:48 2015 (r292795) @@ -66,13 +66,22 @@ __FBSDID("$FreeBSD$"); } while (0) /* Test all the functions that compute b^x. */ -#define testall0(x, result, exceptmask, excepts) do { \ +#define _testall0(x, result, exceptmask, excepts) do { \ test(exp, x, result, exceptmask, excepts); \ test(expf, x, result, exceptmask, excepts); \ test(exp2, x, result, exceptmask, excepts); \ test(exp2f, x, result, exceptmask, excepts); \ +} while (0) + +/* Skip over exp2l on platforms that don't support it. */ +#if LDBL_PREC == 53 +#define testall0 _testall0 +#else +#define testall0(x, result, exceptmask, excepts) do { \ + _testall0(x, result, exceptmask, excepts); \ test(exp2l, x, result, exceptmask, excepts); \ } while (0) +#endif /* Test all the functions that compute b^x - 1. */ #define testall1(x, result, exceptmask, excepts) do { \ @@ -102,12 +111,14 @@ run_generic_tests(void) testall0(-INFINITY, 0.0, ALL_STD_EXCEPT, 0); testall1(-INFINITY, -1.0, ALL_STD_EXCEPT, 0); +#if !defined(__i386__) /* exp(big) == Inf, overflow exception */ testall0(50000.0, INFINITY, ALL_STD_EXCEPT & ~FE_INEXACT, FE_OVERFLOW); testall1(50000.0, INFINITY, ALL_STD_EXCEPT & ~FE_INEXACT, FE_OVERFLOW); /* exp(small) == 0, underflow and inexact exceptions */ testall0(-50000.0, 0.0, ALL_STD_EXCEPT, FE_UNDERFLOW | FE_INEXACT); +#endif testall1(-50000.0, -1.0, ALL_STD_EXCEPT, FE_INEXACT); } Modified: stable/10/tools/regression/lib/msun/test-invtrig.c ============================================================================== --- stable/10/tools/regression/lib/msun/test-invtrig.c Sun Dec 27 20:52:32 2015 (r292794) +++ stable/10/tools/regression/lib/msun/test-invtrig.c Sun Dec 27 20:54:48 2015 (r292795) @@ -63,14 +63,23 @@ __FBSDID("$FreeBSD$"); #define test(func, x, result, excepts) \ test_tol(func, (x), (result), 0, (excepts)) -#define testall_tol(prefix, x, result, tol, excepts) do { \ +#define _testall_tol(prefix, x, result, tol, excepts) do { \ test_tol(prefix, (double)(x), (double)(result), \ (tol) * ldexp(1.0, 1 - DBL_MANT_DIG), (excepts)); \ test_tol(prefix##f, (float)(x), (float)(result), \ (tol) * ldexpf(1.0, 1 - FLT_MANT_DIG), (excepts)); \ +} while (0) + +#if LDBL_PREC == 53 +#define testall_tol _testall_tol +#else +#define testall_tol(prefix, x, result, tol, excepts) do { \ + _testall_tol(prefix, x, result, tol, excepts); \ test_tol(prefix##l, (x), (result), \ (tol) * ldexpl(1.0, 1 - LDBL_MANT_DIG), (excepts)); \ } while (0) +#endif + #define testall(prefix, x, result, excepts) \ testall_tol(prefix, (x), (result), 0, (excepts)) @@ -83,14 +92,23 @@ __FBSDID("$FreeBSD$"); #define test2(func, y, x, result, excepts) \ test2_tol(func, (y), (x), (result), 0, (excepts)) -#define testall2_tol(prefix, y, x, result, tol, excepts) do { \ +#define _testall2_tol(prefix, y, x, result, tol, excepts) do { \ test2_tol(prefix, (double)(y), (double)(x), (double)(result), \ (tol) * ldexp(1.0, 1 - DBL_MANT_DIG), (excepts)); \ test2_tol(prefix##f, (float)(y), (float)(x), (float)(result), \ (tol) * ldexpf(1.0, 1 - FLT_MANT_DIG), (excepts)); \ +} while (0) + +#if LDBL_PREC == 53 +#define testall2_tol _testall2_tol +#else +#define testall2_tol(prefix, y, x, result, tol, excepts) do { \ + _testall2_tol(prefix, y, x, result, tol, excepts); \ test2_tol(prefix##l, (y), (x), (result), \ (tol) * ldexpl(1.0, 1 - LDBL_MANT_DIG), (excepts)); \ } while (0) +#endif + #define testall2(prefix, y, x, result, excepts) \ testall2_tol(prefix, (y), (x), (result), 0, (excepts)) @@ -431,6 +449,11 @@ int main(int argc, char *argv[]) { +#if defined(__i386__) + printf("1..0 # SKIP fails all assertions on i386\n"); + return (0); +#endif + printf("1..7\n"); test_special(); From owner-svn-src-stable-10@freebsd.org Sun Dec 27 21:02:57 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF19CA535C4; Sun, 27 Dec 2015 21:02:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BE6F141E; Sun, 27 Dec 2015 21:02:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRL2uk0095393; Sun, 27 Dec 2015 21:02:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRL2uNR095392; Sun, 27 Dec 2015 21:02:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512272102.tBRL2uNR095392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Dec 2015 21:02:56 +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: r292796 - stable/10/sys/modules/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 21:02:57 -0000 Author: ngie Date: Sun Dec 27 21:02:56 2015 New Revision: 292796 URL: https://svnweb.freebsd.org/changeset/base/292796 Log: MFC r284969: r284969 (by lwhsu): - Fix `make depend` in sys/modules Differential Revision: https://reviews.freebsd.org/D2951 Approved by: delphij Modified: stable/10/sys/modules/hyperv/netvsc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/modules/hyperv/netvsc/Makefile ============================================================================== --- stable/10/sys/modules/hyperv/netvsc/Makefile Sun Dec 27 20:54:48 2015 (r292795) +++ stable/10/sys/modules/hyperv/netvsc/Makefile Sun Dec 27 21:02:56 2015 (r292796) @@ -6,7 +6,7 @@ KMOD= hv_netvsc SRCS= hv_net_vsc.c \ hv_netvsc_drv_freebsd.c \ hv_rndis_filter.c -SRCS+= bus_if.h device_if.h +SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/netvsc From owner-svn-src-stable-10@freebsd.org Sun Dec 27 21:03:40 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4809A5361A; Sun, 27 Dec 2015 21:03:40 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1B3C15CA; Sun, 27 Dec 2015 21:03:40 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRL3dre095479; Sun, 27 Dec 2015 21:03:39 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRL3d8E095478; Sun, 27 Dec 2015 21:03:39 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512272103.tBRL3d8E095478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Dec 2015 21:03: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: r292797 - stable/10/sys/dev/hyperv/vmbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 21:03:41 -0000 Author: ngie Date: Sun Dec 27 21:03:39 2015 New Revision: 292797 URL: https://svnweb.freebsd.org/changeset/base/292797 Log: MFC r292661: Remove redundant vmbus_select_outgoing_channel declaration already handled in include/hyperv.h This unbreaks the gcc 4.2.1 kernel build of hyperv Differential Revision: https://reviews.freebsd.org/D4684 Reviewed by: royger Sponsored by: EMC / Isilon Storage Division Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c ============================================================================== --- stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Sun Dec 27 21:02:56 2015 (r292796) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Sun Dec 27 21:03:39 2015 (r292797) @@ -53,8 +53,6 @@ static void vmbus_channel_on_gpadl_tornd static void vmbus_channel_on_offers_delivered(hv_vmbus_channel_msg_header* hdr); static void vmbus_channel_on_version_response(hv_vmbus_channel_msg_header* hdr); static void vmbus_channel_process_offer(void *context); -struct hv_vmbus_channel* - vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); /** * Channel message dispatch table From owner-svn-src-stable-10@freebsd.org Sun Dec 27 21:08:10 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA622A5375A; Sun, 27 Dec 2015 21:08:10 +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 945C31889; Sun, 27 Dec 2015 21:08:10 +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 tBRL898V095748; Sun, 27 Dec 2015 21:08:09 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRL89BV095747; Sun, 27 Dec 2015 21:08:09 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201512272108.tBRL89BV095747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Dec 2015 21:08: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: r292798 - stable/10/gnu/usr.bin X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 21:08:10 -0000 Author: marius Date: Sun Dec 27 21:08:09 2015 New Revision: 292798 URL: https://svnweb.freebsd.org/changeset/base/292798 Log: MFC: r285684 (partial) Record dependencies of gdb/gdbtui/kgdb on binutils/lib{bfd,iberty,opcodes}, fixing parallel builds. Modified: stable/10/gnu/usr.bin/Makefile Modified: stable/10/gnu/usr.bin/Makefile ============================================================================== --- stable/10/gnu/usr.bin/Makefile Sun Dec 27 21:03:39 2015 (r292797) +++ stable/10/gnu/usr.bin/Makefile Sun Dec 27 21:08:09 2015 (r292798) @@ -17,6 +17,8 @@ SUBDIR= ${_binutils} \ ${_tests} \ ${_texinfo} +SUBDIR_DEPEND_gdb= ${_binutils} + .if ${MK_CXX} != "no" _gperf= gperf .if ${MK_GROFF} != "no" From owner-svn-src-stable-10@freebsd.org Sun Dec 27 21:08:47 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D0F2A537C1; Sun, 27 Dec 2015 21:08: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 509E91A14; Sun, 27 Dec 2015 21:08: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 tBRL8kii095823; Sun, 27 Dec 2015 21:08:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRL8kpJ095822; Sun, 27 Dec 2015 21:08:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512272108.tBRL8kpJ095822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Dec 2015 21:08: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: r292799 - stable/10/tools/regression/lib/msun X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 21:08:47 -0000 Author: ngie Date: Sun Dec 27 21:08:46 2015 New Revision: 292799 URL: https://svnweb.freebsd.org/changeset/base/292799 Log: MFC r292492,r292495,r292647: r292492: - Use nitems instead of handrolling the macro - Use a separate variable for tracking the testcase count instead of hardcoding the offset for the testcases Sponsored by: EMC / Isilon Storage Division r292495: Initialize j so it doesn't print out a garbage index Use it consistently instead of i in the first loop Sponsored by: EMC / Isilon Storage Division r292647: Use j instead of a hardcoded index (9) and increment it after running the NaNs testcases Pointyhat to: ngie Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tools/regression/lib/msun/test-fma.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/lib/msun/test-fma.c ============================================================================== --- stable/10/tools/regression/lib/msun/test-fma.c Sun Dec 27 21:08:09 2015 (r292798) +++ stable/10/tools/regression/lib/msun/test-fma.c Sun Dec 27 21:08:46 2015 (r292799) @@ -31,6 +31,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -474,49 +475,58 @@ int main(int argc, char *argv[]) { int rmodes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO }; - int i; + int i, j; #if defined(__i386__) printf("1..0 # SKIP all testcases fail on i386\n"); exit(0); #endif + j = 1; + printf("1..19\n"); - for (i = 0; i < 4; i++) { + for (i = 0; i < nitems(rmodes); i++, j++) { + printf("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_zeroes(); - printf("ok %d - fma zeroes\n", i + 1); + printf("ok %d - fma zeroes\n", j); } - for (i = 0; i < 4; i++) { + for (i = 0; i < nitems(rmodes); i++, j++) { + printf("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_infinities(); - printf("ok %d - fma infinities\n", i + 5); + printf("ok %d - fma infinities\n", j); } fesetround(FE_TONEAREST); test_nans(); - printf("ok 9 - fma NaNs\n"); + printf("ok %d - fma NaNs\n", j); + j++; - for (i = 0; i < 4; i++) { + for (i = 0; i < nitems(rmodes); i++, j++) { + printf("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_small_z(); - printf("ok %d - fma small z\n", i + 10); + printf("ok %d - fma small z\n", j); } - for (i = 0; i < 4; i++) { + for (i = 0; i < nitems(rmodes); i++, j++) { + printf("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_big_z(); - printf("ok %d - fma big z\n", i + 14); + printf("ok %d - fma big z\n", j); } fesetround(FE_TONEAREST); test_accuracy(); - printf("ok 18 - fma accuracy\n"); + printf("ok %d - fma accuracy\n", j); + j++; test_double_rounding(); - printf("ok 19 - fma double rounding\n"); + printf("ok %d - fma double rounding\n", j); + j++; /* * TODO: From owner-svn-src-stable-10@freebsd.org Sun Dec 27 21:17:31 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBC73A53AE0; Sun, 27 Dec 2015 21:17:31 +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 8D5611F79; Sun, 27 Dec 2015 21:17:31 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBRLHUMa098907; Sun, 27 Dec 2015 21:17:30 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRLHUSG098906; Sun, 27 Dec 2015 21:17:30 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512272117.tBRLHUSG098906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Dec 2015 21:17: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: r292801 - stable/10/tools/regression/lib/msun X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 21:17:31 -0000 Author: ngie Date: Sun Dec 27 21:17:30 2015 New Revision: 292801 URL: https://svnweb.freebsd.org/changeset/base/292801 Log: MFC r292489: Disable test-ctrig.t testcases which fail assertions on i386 Tested on: stable/10 (amd64/i386), head (amd64/i386) PR: 205446 X-MFC to: stable/10 Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tools/regression/lib/msun/test-ctrig.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/lib/msun/test-ctrig.c ============================================================================== --- stable/10/tools/regression/lib/msun/test-ctrig.c Sun Dec 27 21:15:58 2015 (r292800) +++ stable/10/tools/regression/lib/msun/test-ctrig.c Sun Dec 27 21:17:30 2015 (r292801) @@ -427,6 +427,7 @@ test_large(void) test_odd_tol(ctanh, z, CMPLXL(1.0, 8.95257245135025991216632140458264468e-309L), DBL_ULP()); +#if !defined(__i386__) z = CMPLXL(30, 0x1p1023L); test_odd_tol(ctanh, z, CMPLXL(1.0, -1.62994325413993477997492170229268382e-26L), @@ -436,6 +437,7 @@ test_large(void) CMPLXL(0.878606311888306869546254022621986509L, -0.225462792499754505792678258169527424L), DBL_ULP()); +#endif z = CMPLXL(710.6, 0.78539816339744830961566084581987572L); test_odd_tol(csinh, z, From owner-svn-src-stable-10@freebsd.org Sun Dec 27 23:25:22 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 761A3A5282E; Sun, 27 Dec 2015 23:25:22 +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 48EED1A87; Sun, 27 Dec 2015 23:25:22 +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 tBRNPLPN041345; Sun, 27 Dec 2015 23:25:21 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBRNPLG3041344; Sun, 27 Dec 2015 23:25:21 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201512272325.tBRNPLG3041344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 27 Dec 2015 23:25: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: r292811 - stable/10/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Dec 2015 23:25:22 -0000 Author: cy Date: Sun Dec 27 23:25:21 2015 New Revision: 292811 URL: https://svnweb.freebsd.org/changeset/base/292811 Log: MFC r292518. Don't assume checksums will be calculated later when fastfoward is enabled (by default in r290383). PR: 72210 Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Sun Dec 27 23:04:12 2015 (r292810) +++ stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Sun Dec 27 23:25:21 2015 (r292811) @@ -5123,7 +5123,7 @@ ipf_nat_out(fin, nat, natadd, nflags) ipf_fix_outcksum(0, &fin->fin_ip->ip_sum, msumd, 0); } #if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \ - defined(linux) || defined(BRIDGE_IPF) + defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD__) else { /* * Strictly speaking, this isn't necessary on BSD @@ -5235,7 +5235,7 @@ ipf_nat_out(fin, nat, natadd, nflags) uh->uh_ulen += fin->fin_plen; uh->uh_ulen = htons(uh->uh_ulen); #if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \ - defined(linux) || defined(BRIDGE_IPF) + defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD) ipf_fix_outcksum(0, &ip->ip_sum, sumd, 0); #endif From owner-svn-src-stable-10@freebsd.org Mon Dec 28 00:05:32 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAC85A535CA; Mon, 28 Dec 2015 00:05: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 837781A76; Mon, 28 Dec 2015 00:05: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 tBS05V1S054422; Mon, 28 Dec 2015 00:05:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS05Vrg054418; Mon, 28 Dec 2015 00:05:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512280005.tBS05Vrg054418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 00:05: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: r292812 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 00:05:32 -0000 Author: ngie Date: Mon Dec 28 00:05:31 2015 New Revision: 292812 URL: https://svnweb.freebsd.org/changeset/base/292812 Log: MFC r292507,r292508: r292507: - Use LOCALBASE instead of KYUA_PREFIX for the --prefix to kyua(1) - Use LOCALBASE instead of hardcoding /usr/local for perl Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff) Reviewed by: emaste, Evan Cramer Sponsored by: EMC / Isilon Storage Division r292508: Document LOCALBASE in the bsd.test.mk section Differential Revision: https://reviews.freebsd.org/D4406 (part of a larger diff) Reviewed by: emaste, Evan Cramer Sponsored by: EMC / Isilon Storage Division Modified: stable/10/share/mk/bsd.README stable/10/share/mk/bsd.test.mk stable/10/share/mk/suite.test.mk stable/10/share/mk/tap.test.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.README ============================================================================== --- stable/10/share/mk/bsd.README Sun Dec 27 23:25:21 2015 (r292811) +++ stable/10/share/mk/bsd.README Mon Dec 28 00:05:31 2015 (r292812) @@ -442,6 +442,10 @@ KYUAFILE If 'auto' (the default), genera subdirectories providing helper programs or data files only). +LOCALBASE The --prefix for the kyua package. + + The value of LOCALBASE defaults to /usr/local . + ATF_TESTS_C The names of the ATF C test programs to build. ATF_TESTS_CXX The names of the ATF C++ test programs to build. Modified: stable/10/share/mk/bsd.test.mk ============================================================================== --- stable/10/share/mk/bsd.test.mk Sun Dec 27 23:25:21 2015 (r292811) +++ stable/10/share/mk/bsd.test.mk Mon Dec 28 00:05:31 2015 (r292812) @@ -10,6 +10,9 @@ ____: +# Third-party software (kyua, etc) prefix. +LOCALBASE?= /usr/local + # Tests install directory TESTSDIR?= ${TESTSBASE}/${RELDIR:H} Modified: stable/10/share/mk/suite.test.mk ============================================================================== --- stable/10/share/mk/suite.test.mk Sun Dec 27 23:25:21 2015 (r292811) +++ stable/10/share/mk/suite.test.mk Mon Dec 28 00:05:31 2015 (r292812) @@ -38,13 +38,6 @@ KYUAFILE?= auto # Makefile to rely on the KYUAFILE=auto behavior defined here. #TEST_METADATA.+= key="value" -# Path to the prefix of the installed Kyua CLI, if any. -# -# If kyua is installed from ports, we automatically define a realtest target -# below to run the tests using this tool. The tools are searched for in the -# hierarchy specified by this variable. -KYUA_PREFIX?= /usr/local - .if ${KYUAFILE:tl} != "no" FILES+= Kyuafile FILESDIR_Kyuafile= ${TESTSDIR} @@ -79,7 +72,7 @@ Kyuafile: Makefile @mv ${.TARGET}.tmp ${.TARGET} .endif -KYUA?= ${KYUA_PREFIX}/bin/kyua +KYUA= ${LOCALBASE}/bin/kyua .if exists(${KYUA}) # Definition of the "make test" target and supporting variables. # Modified: stable/10/share/mk/tap.test.mk ============================================================================== --- stable/10/share/mk/tap.test.mk Sun Dec 27 23:25:21 2015 (r292811) +++ stable/10/share/mk/tap.test.mk Mon Dec 28 00:05:31 2015 (r292812) @@ -26,7 +26,7 @@ TAP_TESTS_PERL?= TAP_TESTS_SH?= # Perl interpreter to use for test programs written in this language. -TAP_PERL_INTERPRETER?= /usr/local/bin/perl +TAP_PERL_INTERPRETER?= ${LOCALBASE}/bin/perl .if !empty(TAP_TESTS_C) PROGS+= ${TAP_TESTS_C} From owner-svn-src-stable-10@freebsd.org Mon Dec 28 02:43:15 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B2B4A4CA8A; Mon, 28 Dec 2015 02:43:15 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCAFA14EA; Mon, 28 Dec 2015 02:43:14 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS2hEZu008216; Mon, 28 Dec 2015 02:43:14 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS2hD7X008202; Mon, 28 Dec 2015 02:43:13 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201512280243.tBS2hD7X008202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Mon, 28 Dec 2015 02:43: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: r292823 - in stable/10/sys: conf netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 02:43:15 -0000 Author: pkelsey Date: Mon Dec 28 02:43:12 2015 New Revision: 292823 URL: https://svnweb.freebsd.org/changeset/base/292823 Log: MFC r292706: Implementation of server-side TCP Fast Open (TFO) [RFC7413]. TFO is disabled by default in the kernel build. See the top comment in sys/netinet/tcp_fastopen.c for implementation particulars. Differential Revision: https://reviews.freebsd.org/D4350 Sponsored by: Verisign, Inc. Added: stable/10/sys/netinet/tcp_fastopen.c - copied unchanged from r292706, head/sys/netinet/tcp_fastopen.c stable/10/sys/netinet/tcp_fastopen.h - copied unchanged from r292706, head/sys/netinet/tcp_fastopen.h Modified: stable/10/sys/conf/files stable/10/sys/conf/options stable/10/sys/netinet/tcp.h stable/10/sys/netinet/tcp_input.c stable/10/sys/netinet/tcp_output.c stable/10/sys/netinet/tcp_subr.c stable/10/sys/netinet/tcp_syncache.c stable/10/sys/netinet/tcp_syncache.h stable/10/sys/netinet/tcp_timer.c stable/10/sys/netinet/tcp_usrreq.c stable/10/sys/netinet/tcp_var.h Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Mon Dec 28 02:36:57 2015 (r292822) +++ stable/10/sys/conf/files Mon Dec 28 02:43:12 2015 (r292823) @@ -3503,6 +3503,7 @@ netinet/sctp_usrreq.c optional inet sct netinet/sctputil.c optional inet sctp | inet6 sctp netinet/siftr.c optional inet siftr alq | inet6 siftr alq netinet/tcp_debug.c optional tcpdebug +netinet/tcp_fastopen.c optional inet tcp_rfc7413 | inet6 tcp_rfc7413 netinet/tcp_hostcache.c optional inet | inet6 netinet/tcp_input.c optional inet | inet6 netinet/tcp_lro.c optional inet | inet6 Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Mon Dec 28 02:36:57 2015 (r292822) +++ stable/10/sys/conf/options Mon Dec 28 02:43:12 2015 (r292823) @@ -442,6 +442,8 @@ SLIP_IFF_OPTS opt_slip.h TCPDEBUG SIFTR TCP_OFFLOAD opt_inet.h # Enable code to dispatch TCP offloading +TCP_RFC7413 opt_inet.h +TCP_RFC7413_MAX_KEYS opt_inet.h TCP_SIGNATURE opt_inet.h VLAN_ARRAY opt_vlan.h XBONEHACK Modified: stable/10/sys/netinet/tcp.h ============================================================================== --- stable/10/sys/netinet/tcp.h Mon Dec 28 02:36:57 2015 (r292822) +++ stable/10/sys/netinet/tcp.h Mon Dec 28 02:43:12 2015 (r292823) @@ -97,6 +97,10 @@ struct tcphdr { #define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ #define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */ #define TCPOLEN_SIGNATURE 18 +#define TCPOPT_FAST_OPEN 34 +#define TCPOLEN_FAST_OPEN_EMPTY 2 +#define TCPOLEN_FAST_OPEN_MIN 6 +#define TCPOLEN_FAST_OPEN_MAX 18 /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ @@ -165,6 +169,7 @@ struct tcphdr { #define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */ #define TCP_KEEPINTVL 512 /* L,N interval between keepalives */ #define TCP_KEEPCNT 1024 /* L,N number of keepalives before close */ +#define TCP_FASTOPEN 1025 /* enable TFO / was created via TFO */ /* Start of reserved space for third-party user-settable options. */ #define TCP_VENDOR SO_VENDOR Copied: stable/10/sys/netinet/tcp_fastopen.c (from r292706, head/sys/netinet/tcp_fastopen.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/netinet/tcp_fastopen.c Mon Dec 28 02:43:12 2015 (r292823, copy of r292706, head/sys/netinet/tcp_fastopen.c) @@ -0,0 +1,442 @@ +/*- + * Copyright (c) 2015 Patrick Kelsey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This is a server-side implementation of TCP Fast Open (TFO) [RFC7413]. + * + * This implementation is currently considered to be experimental and is not + * included in kernel builds by default. To include this code, add the + * following line to your kernel config: + * + * options TCP_RFC7413 + * + * The generated TFO cookies are the 64-bit output of + * SipHash24(<16-byte-key>). Multiple concurrent valid keys are + * supported so that time-based rolling cookie invalidation policies can be + * implemented in the system. The default number of concurrent keys is 2. + * This can be adjusted in the kernel config as follows: + * + * options TCP_RFC7413_MAX_KEYS= + * + * + * The following TFO-specific sysctls are defined: + * + * net.inet.tcp.fastopen.acceptany (RW, default 0) + * When non-zero, all client-supplied TFO cookies will be considered to + * be valid. + * + * net.inet.tcp.fastopen.autokey (RW, default 120) + * When this and net.inet.tcp.fastopen.enabled are non-zero, a new key + * will be automatically generated after this many seconds. + * + * net.inet.tcp.fastopen.enabled (RW, default 0) + * When zero, no new TFO connections can be created. On the transition + * from enabled to disabled, all installed keys are removed. On the + * transition from disabled to enabled, if net.inet.tcp.fastopen.autokey + * is non-zero and there are no keys installed, a new key will be + * generated immediately. The transition from enabled to disabled does + * not affect any TFO connections in progress; it only prevents new ones + * from being made. + * + * net.inet.tcp.fastopen.keylen (RO) + * The key length in bytes. + * + * net.inet.tcp.fastopen.maxkeys (RO) + * The maximum number of keys supported. + * + * net.inet.tcp.fastopen.numkeys (RO) + * The current number of keys installed. + * + * net.inet.tcp.fastopen.setkey (WO) + * Install a new key by writing net.inet.tcp.fastopen.keylen bytes to this + * sysctl. + * + * + * In order for TFO connections to be created via a listen socket, that + * socket must have the TCP_FASTOPEN socket option set on it. This option + * can be set on the socket either before or after the listen() is invoked. + * Clearing this option on a listen socket after it has been set has no + * effect on existing TFO connections or TFO connections in progress; it + * only prevents new TFO connections from being made. + * + * For passively-created sockets, the TCP_FASTOPEN socket option can be + * queried to determine whether the connection was established using TFO. + * Note that connections that are established via a TFO SYN, but that fall + * back to using a non-TFO SYN|ACK will have the TCP_FASTOPEN socket option + * set. + * + * Per the RFC, this implementation limits the number of TFO connections + * that can be in the SYN_RECEIVED state on a per listen-socket basis. + * Whenever this limit is exceeded, requests for new TFO connections are + * serviced as non-TFO requests. Without such a limit, given a valid TFO + * cookie, an attacker could keep the listen queue in an overflow condition + * using a TFO SYN flood. This implementation sets the limit at half the + * configured listen backlog. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + + +#define TCP_FASTOPEN_KEY_LEN SIPHASH_KEY_LENGTH + +#if !defined(TCP_RFC7413_MAX_KEYS) || (TCP_RFC7413_MAX_KEYS < 1) +#define TCP_FASTOPEN_MAX_KEYS 2 +#else +#define TCP_FASTOPEN_MAX_KEYS TCP_RFC7413_MAX_KEYS +#endif + +struct tcp_fastopen_keylist { + unsigned int newest; + uint8_t key[TCP_FASTOPEN_MAX_KEYS][TCP_FASTOPEN_KEY_LEN]; +}; + +struct tcp_fastopen_callout { + struct callout c; + struct vnet *v; +}; + +SYSCTL_NODE(_net_inet_tcp, OID_AUTO, fastopen, CTLFLAG_RW, 0, "TCP Fast Open"); + +static VNET_DEFINE(int, tcp_fastopen_acceptany) = 0; +#define V_tcp_fastopen_acceptany VNET(tcp_fastopen_acceptany) +SYSCTL_INT(_net_inet_tcp_fastopen, OID_AUTO, acceptany, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_fastopen_acceptany), 0, + "Accept any non-empty cookie"); + +static VNET_DEFINE(unsigned int, tcp_fastopen_autokey) = 120; +#define V_tcp_fastopen_autokey VNET(tcp_fastopen_autokey) +static int sysctl_net_inet_tcp_fastopen_autokey(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_net_inet_tcp_fastopen, OID_AUTO, autokey, + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, NULL, 0, + &sysctl_net_inet_tcp_fastopen_autokey, "IU", + "Number of seconds between auto-generation of a new key; zero disables"); + +VNET_DEFINE(unsigned int, tcp_fastopen_enabled) = 0; +static int sysctl_net_inet_tcp_fastopen_enabled(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_net_inet_tcp_fastopen, OID_AUTO, enabled, + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW, NULL, 0, + &sysctl_net_inet_tcp_fastopen_enabled, "IU", + "Enable/disable TCP Fast Open processing"); + +SYSCTL_INT(_net_inet_tcp_fastopen, OID_AUTO, keylen, + CTLFLAG_RD, SYSCTL_NULL_INT_PTR, TCP_FASTOPEN_KEY_LEN, + "Key length in bytes"); + +SYSCTL_INT(_net_inet_tcp_fastopen, OID_AUTO, maxkeys, + CTLFLAG_RD, SYSCTL_NULL_INT_PTR, TCP_FASTOPEN_MAX_KEYS, + "Maximum number of keys supported"); + +static VNET_DEFINE(unsigned int, tcp_fastopen_numkeys) = 0; +#define V_tcp_fastopen_numkeys VNET(tcp_fastopen_numkeys) +SYSCTL_UINT(_net_inet_tcp_fastopen, OID_AUTO, numkeys, + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(tcp_fastopen_numkeys), 0, + "Number of keys installed"); + +static int sysctl_net_inet_tcp_fastopen_setkey(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_net_inet_tcp_fastopen, OID_AUTO, setkey, + CTLFLAG_VNET | CTLTYPE_OPAQUE | CTLFLAG_WR, NULL, 0, + &sysctl_net_inet_tcp_fastopen_setkey, "", + "Install a new key"); + +static VNET_DEFINE(struct rmlock, tcp_fastopen_keylock); +#define V_tcp_fastopen_keylock VNET(tcp_fastopen_keylock) + +#define TCP_FASTOPEN_KEYS_RLOCK(t) rm_rlock(&V_tcp_fastopen_keylock, (t)) +#define TCP_FASTOPEN_KEYS_RUNLOCK(t) rm_runlock(&V_tcp_fastopen_keylock, (t)) +#define TCP_FASTOPEN_KEYS_WLOCK() rm_wlock(&V_tcp_fastopen_keylock) +#define TCP_FASTOPEN_KEYS_WUNLOCK() rm_wunlock(&V_tcp_fastopen_keylock) + +static VNET_DEFINE(struct tcp_fastopen_keylist, tcp_fastopen_keys); +#define V_tcp_fastopen_keys VNET(tcp_fastopen_keys) + +static VNET_DEFINE(struct tcp_fastopen_callout, tcp_fastopen_autokey_ctx); +#define V_tcp_fastopen_autokey_ctx VNET(tcp_fastopen_autokey_ctx) + +static VNET_DEFINE(uma_zone_t, counter_zone); +#define V_counter_zone VNET(counter_zone) + +void +tcp_fastopen_init(void) +{ + V_counter_zone = uma_zcreate("tfo", sizeof(unsigned int), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + rm_init(&V_tcp_fastopen_keylock, "tfo_keylock"); + callout_init_rm(&V_tcp_fastopen_autokey_ctx.c, + &V_tcp_fastopen_keylock, 0); + V_tcp_fastopen_keys.newest = TCP_FASTOPEN_MAX_KEYS - 1; +} + +void +tcp_fastopen_destroy(void) +{ + callout_drain(&V_tcp_fastopen_autokey_ctx.c); + rm_destroy(&V_tcp_fastopen_keylock); + uma_zdestroy(V_counter_zone); +} + +unsigned int * +tcp_fastopen_alloc_counter(void) +{ + unsigned int *counter; + counter = uma_zalloc(V_counter_zone, M_NOWAIT); + if (counter) + *counter = 1; + return (counter); +} + +void +tcp_fastopen_decrement_counter(unsigned int *counter) +{ + if (*counter == 1) + uma_zfree(V_counter_zone, counter); + else + atomic_subtract_int(counter, 1); +} + +static void +tcp_fastopen_addkey_locked(uint8_t *key) +{ + + V_tcp_fastopen_keys.newest++; + if (V_tcp_fastopen_keys.newest == TCP_FASTOPEN_MAX_KEYS) + V_tcp_fastopen_keys.newest = 0; + memcpy(V_tcp_fastopen_keys.key[V_tcp_fastopen_keys.newest], key, + TCP_FASTOPEN_KEY_LEN); + if (V_tcp_fastopen_numkeys < TCP_FASTOPEN_MAX_KEYS) + V_tcp_fastopen_numkeys++; +} + +static void +tcp_fastopen_autokey_locked(void) +{ + uint8_t newkey[TCP_FASTOPEN_KEY_LEN]; + + arc4rand(newkey, TCP_FASTOPEN_KEY_LEN, 0); + tcp_fastopen_addkey_locked(newkey); +} + +static void +tcp_fastopen_autokey_callout(void *arg) +{ + struct tcp_fastopen_callout *ctx = arg; + + CURVNET_SET(ctx->v); + tcp_fastopen_autokey_locked(); + callout_reset(&ctx->c, V_tcp_fastopen_autokey * hz, + tcp_fastopen_autokey_callout, ctx); + CURVNET_RESTORE(); +} + + +static uint64_t +tcp_fastopen_make_cookie(uint8_t key[SIPHASH_KEY_LENGTH], struct in_conninfo *inc) +{ + SIPHASH_CTX ctx; + uint64_t siphash; + + SipHash24_Init(&ctx); + SipHash_SetKey(&ctx, key); + switch (inc->inc_flags & INC_ISIPV6) { +#ifdef INET + case 0: + SipHash_Update(&ctx, &inc->inc_faddr, sizeof(inc->inc_faddr)); + break; +#endif +#ifdef INET6 + case INC_ISIPV6: + SipHash_Update(&ctx, &inc->inc6_faddr, sizeof(inc->inc6_faddr)); + break; +#endif + } + SipHash_Final((u_int8_t *)&siphash, &ctx); + + return (siphash); +} + + +/* + * Return values: + * -1 the cookie is invalid and no valid cookie is available + * 0 the cookie is invalid and the latest cookie has been returned + * 1 the cookie is valid and the latest cookie has been returned + */ +int +tcp_fastopen_check_cookie(struct in_conninfo *inc, uint8_t *cookie, + unsigned int len, uint64_t *latest_cookie) +{ + struct rm_priotracker tracker; + unsigned int i, key_index; + uint64_t cur_cookie; + + if (V_tcp_fastopen_acceptany) { + *latest_cookie = 0; + return (1); + } + + if (len != TCP_FASTOPEN_COOKIE_LEN) { + if (V_tcp_fastopen_numkeys > 0) { + *latest_cookie = + tcp_fastopen_make_cookie( + V_tcp_fastopen_keys.key[V_tcp_fastopen_keys.newest], + inc); + return (0); + } + return (-1); + } + + /* + * Check against each available key, from newest to oldest. + */ + TCP_FASTOPEN_KEYS_RLOCK(&tracker); + key_index = V_tcp_fastopen_keys.newest; + for (i = 0; i < V_tcp_fastopen_numkeys; i++) { + cur_cookie = + tcp_fastopen_make_cookie(V_tcp_fastopen_keys.key[key_index], + inc); + if (i == 0) + *latest_cookie = cur_cookie; + if (memcmp(cookie, &cur_cookie, TCP_FASTOPEN_COOKIE_LEN) == 0) { + TCP_FASTOPEN_KEYS_RUNLOCK(&tracker); + return (1); + } + if (key_index == 0) + key_index = TCP_FASTOPEN_MAX_KEYS - 1; + else + key_index--; + } + TCP_FASTOPEN_KEYS_RUNLOCK(&tracker); + + return (0); +} + +static int +sysctl_net_inet_tcp_fastopen_autokey(SYSCTL_HANDLER_ARGS) +{ + int error; + unsigned int new; + + new = V_tcp_fastopen_autokey; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + if (new > (INT_MAX / hz)) + return (EINVAL); + + TCP_FASTOPEN_KEYS_WLOCK(); + if (V_tcp_fastopen_enabled) { + if (V_tcp_fastopen_autokey && !new) + callout_stop(&V_tcp_fastopen_autokey_ctx.c); + else if (new) + callout_reset(&V_tcp_fastopen_autokey_ctx.c, + new * hz, tcp_fastopen_autokey_callout, + &V_tcp_fastopen_autokey_ctx); + } + V_tcp_fastopen_autokey = new; + TCP_FASTOPEN_KEYS_WUNLOCK(); + } + + return (error); +} + +static int +sysctl_net_inet_tcp_fastopen_enabled(SYSCTL_HANDLER_ARGS) +{ + int error; + unsigned int new; + + new = V_tcp_fastopen_enabled; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + if (V_tcp_fastopen_enabled && !new) { + /* enabled -> disabled */ + TCP_FASTOPEN_KEYS_WLOCK(); + V_tcp_fastopen_numkeys = 0; + V_tcp_fastopen_keys.newest = TCP_FASTOPEN_MAX_KEYS - 1; + if (V_tcp_fastopen_autokey) + callout_stop(&V_tcp_fastopen_autokey_ctx.c); + V_tcp_fastopen_enabled = 0; + TCP_FASTOPEN_KEYS_WUNLOCK(); + } else if (!V_tcp_fastopen_enabled && new) { + /* disabled -> enabled */ + TCP_FASTOPEN_KEYS_WLOCK(); + if (V_tcp_fastopen_autokey && + (V_tcp_fastopen_numkeys == 0)) { + tcp_fastopen_autokey_locked(); + callout_reset(&V_tcp_fastopen_autokey_ctx.c, + V_tcp_fastopen_autokey * hz, + tcp_fastopen_autokey_callout, + &V_tcp_fastopen_autokey_ctx); + } + V_tcp_fastopen_enabled = 1; + TCP_FASTOPEN_KEYS_WUNLOCK(); + } + } + return (error); +} + +static int +sysctl_net_inet_tcp_fastopen_setkey(SYSCTL_HANDLER_ARGS) +{ + int error; + uint8_t newkey[TCP_FASTOPEN_KEY_LEN]; + + if (req->oldptr != NULL || req->oldlen != 0) + return (EINVAL); + if (req->newptr == NULL) + return (EPERM); + if (req->newlen != sizeof(newkey)) + return (EINVAL); + error = SYSCTL_IN(req, newkey, sizeof(newkey)); + if (error) + return (error); + + TCP_FASTOPEN_KEYS_WLOCK(); + tcp_fastopen_addkey_locked(newkey); + TCP_FASTOPEN_KEYS_WUNLOCK(); + + return (0); +} Copied: stable/10/sys/netinet/tcp_fastopen.h (from r292706, head/sys/netinet/tcp_fastopen.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/netinet/tcp_fastopen.h Mon Dec 28 02:43:12 2015 (r292823, copy of r292706, head/sys/netinet/tcp_fastopen.h) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2015 Patrick Kelsey + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _TCP_FASTOPEN_H_ +#define _TCP_FASTOPEN_H_ + +#ifdef _KERNEL + +#define TCP_FASTOPEN_COOKIE_LEN 8 /* tied to SipHash24 64-bit output */ + +VNET_DECLARE(unsigned int, tcp_fastopen_enabled); +#define V_tcp_fastopen_enabled VNET(tcp_fastopen_enabled) + +void tcp_fastopen_init(void); +void tcp_fastopen_destroy(void); +unsigned int *tcp_fastopen_alloc_counter(void); +void tcp_fastopen_decrement_counter(unsigned int *counter); +int tcp_fastopen_check_cookie(struct in_conninfo *inc, uint8_t *cookie, + unsigned int len, uint64_t *latest_cookie); +#endif /* _KERNEL */ + +#endif /* _TCP_FASTOPEN_H_ */ Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Mon Dec 28 02:36:57 2015 (r292822) +++ stable/10/sys/netinet/tcp_input.c Mon Dec 28 02:43:12 2015 (r292823) @@ -98,6 +98,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef TCP_RFC7413 +#include +#endif #include #include #include @@ -1072,6 +1075,9 @@ relocked: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } +#ifdef TCP_RFC7413 +new_tfo_socket: +#endif if (so == NULL) { /* * We completed the 3-way handshake @@ -1329,7 +1335,12 @@ relocked: (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif tcp_dooptions(&to, optp, optlen, TO_SYN); +#ifdef TCP_RFC7413 + if (syncache_add(&inc, &to, th, inp, &so, m, NULL, NULL)) + goto new_tfo_socket; +#else syncache_add(&inc, &to, th, inp, &so, m, NULL, NULL); +#endif /* * Entry added to syncache and mbuf consumed. * Everything already unlocked by syncache_add(). @@ -1439,6 +1450,7 @@ tcp_do_segment(struct mbuf *m, struct tc struct in_conninfo *inc; struct mbuf *mfree; struct tcpopt to; + int tfo_syn; #ifdef TCPDEBUG /* @@ -1878,6 +1890,28 @@ tcp_do_segment(struct mbuf *m, struct tc rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } +#ifdef TCP_RFC7413 + if (tp->t_flags & TF_FASTOPEN) { + /* + * When a TFO connection is in SYN_RECEIVED, the + * only valid packets are the initial SYN, a + * retransmit/copy of the initial SYN (possibly with + * a subset of the original data), a valid ACK, a + * FIN, or a RST. + */ + if ((thflags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK)) { + rstreason = BANDLIM_RST_OPENPORT; + goto dropwithreset; + } else if (thflags & TH_SYN) { + /* non-initial SYN is ignored */ + if ((tcp_timer_active(tp, TT_DELACK) || + tcp_timer_active(tp, TT_REXMT))) + goto drop; + } else if (!(thflags & (TH_ACK|TH_FIN|TH_RST))) { + goto drop; + } + } +#endif break; /* @@ -2318,9 +2352,16 @@ tcp_do_segment(struct mbuf *m, struct tc */ if ((thflags & TH_ACK) == 0) { if (tp->t_state == TCPS_SYN_RECEIVED || - (tp->t_flags & TF_NEEDSYN)) + (tp->t_flags & TF_NEEDSYN)) { +#ifdef TCP_RFC7413 + if (tp->t_state == TCPS_SYN_RECEIVED && + tp->t_flags & TF_FASTOPEN) { + tp->snd_wnd = tiwin; + cc_conn_init(tp); + } +#endif goto step6; - else if (tp->t_flags & TF_ACKNOW) + } else if (tp->t_flags & TF_ACKNOW) goto dropafterack; else goto drop; @@ -2359,7 +2400,27 @@ tcp_do_segment(struct mbuf *m, struct tc tcp_state_change(tp, TCPS_ESTABLISHED); TCP_PROBE5(accept__established, NULL, tp, mtod(m, const char *), tp, th); - cc_conn_init(tp); +#ifdef TCP_RFC7413 + if (tp->t_tfo_pending) { + tcp_fastopen_decrement_counter(tp->t_tfo_pending); + tp->t_tfo_pending = NULL; + + /* + * Account for the ACK of our SYN prior to + * regular ACK processing below. + */ + tp->snd_una++; + } + /* + * TFO connections call cc_conn_init() during SYN + * processing. Calling it again here for such + * connections is not harmless as it would undo the + * snd_cwnd reduction that occurs when a TFO SYN|ACK + * is retransmitted. + */ + if (!(tp->t_flags & TF_FASTOPEN)) +#endif + cc_conn_init(tp); tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp)); } /* @@ -2890,9 +2951,12 @@ dodata: /* XXX */ * case PRU_RCVD). If a FIN has already been received on this * connection then we just ignore the text. */ - if ((tlen || (thflags & TH_FIN)) && + tfo_syn = ((tp->t_state == TCPS_SYN_RECEIVED) && + (tp->t_flags & TF_FASTOPEN)); + if ((tlen || (thflags & TH_FIN) || tfo_syn) && TCPS_HAVERCVDFIN(tp->t_state) == 0) { tcp_seq save_start = th->th_seq; + m_adj(m, drop_hdrlen); /* delayed header drop */ /* * Insert segment which includes th into TCP reassembly queue @@ -2908,8 +2972,9 @@ dodata: /* XXX */ */ if (th->th_seq == tp->rcv_nxt && LIST_EMPTY(&tp->t_segq) && - TCPS_HAVEESTABLISHED(tp->t_state)) { - if (DELAY_ACK(tp, tlen)) + (TCPS_HAVEESTABLISHED(tp->t_state) || + tfo_syn)) { + if (DELAY_ACK(tp, tlen) || tfo_syn) tp->t_flags |= TF_DELACK; else tp->t_flags |= TF_ACKNOW; @@ -3262,6 +3327,21 @@ tcp_dooptions(struct tcpopt *to, u_char to->to_sacks = cp + 2; TCPSTAT_INC(tcps_sack_rcv_blocks); break; +#ifdef TCP_RFC7413 + case TCPOPT_FAST_OPEN: + if ((optlen != TCPOLEN_FAST_OPEN_EMPTY) && + (optlen < TCPOLEN_FAST_OPEN_MIN) && + (optlen > TCPOLEN_FAST_OPEN_MAX)) + continue; + if (!(flags & TO_SYN)) + continue; + if (!V_tcp_fastopen_enabled) + continue; + to->to_flags |= TOF_FASTOPEN; + to->to_tfo_len = optlen - 2; + to->to_tfo_cookie = to->to_tfo_len ? cp + 2 : NULL; + break; +#endif default: continue; } Modified: stable/10/sys/netinet/tcp_output.c ============================================================================== --- stable/10/sys/netinet/tcp_output.c Mon Dec 28 02:36:57 2015 (r292822) +++ stable/10/sys/netinet/tcp_output.c Mon Dec 28 02:43:12 2015 (r292823) @@ -69,6 +69,9 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#ifdef TCP_RFC7413 +#include +#endif #define TCPOUTFLAGS #include #include @@ -202,6 +205,17 @@ tcp_output(struct tcpcb *tp) return (tcp_offload_output(tp)); #endif +#ifdef TCP_RFC7413 + /* + * For TFO connections in SYN_RECEIVED, only allow the initial + * SYN|ACK and those sent by the retransmit timer. + */ + if ((tp->t_flags & TF_FASTOPEN) && + (tp->t_state == TCPS_SYN_RECEIVED) && + SEQ_GT(tp->snd_max, tp->snd_una) && /* inital SYN|ACK sent */ + (tp->snd_nxt != tp->snd_una)) /* not a retransmit */ + return (0); +#endif /* * Determine length of data that should be transmitted, * and flags that will be used. @@ -387,6 +401,15 @@ after_sack_rexmit: if ((flags & TH_SYN) && SEQ_GT(tp->snd_nxt, tp->snd_una)) { if (tp->t_state != TCPS_SYN_RECEIVED) flags &= ~TH_SYN; +#ifdef TCP_RFC7413 + /* + * When sending additional segments following a TFO SYN|ACK, + * do not include the SYN bit. + */ + if ((tp->t_flags & TF_FASTOPEN) && + (tp->t_state == TCPS_SYN_RECEIVED)) + flags &= ~TH_SYN; +#endif off--, len++; } @@ -400,6 +423,17 @@ after_sack_rexmit: flags &= ~TH_FIN; } +#ifdef TCP_RFC7413 + /* + * When retransmitting SYN|ACK on a passively-created TFO socket, + * don't include data, as the presence of data may have caused the + * original SYN|ACK to have been dropped by a middlebox. + */ + if ((tp->t_flags & TF_FASTOPEN) && + (((tp->t_state == TCPS_SYN_RECEIVED) && (tp->t_rxtshift > 0)) || + (flags & TH_RST))) + len = 0; +#endif if (len <= 0) { /* * If FIN has been sent but not acked, @@ -718,6 +752,22 @@ send: tp->snd_nxt = tp->iss; to.to_mss = tcp_mssopt(&tp->t_inpcb->inp_inc); to.to_flags |= TOF_MSS; +#ifdef TCP_RFC7413 + /* + * Only include the TFO option on the first + * transmission of the SYN|ACK on a + * passively-created TFO socket, as the presence of + * the TFO option may have caused the original + * SYN|ACK to have been dropped by a middlebox. + */ + if ((tp->t_flags & TF_FASTOPEN) && + (tp->t_state == TCPS_SYN_RECEIVED) && + (tp->t_rxtshift == 0)) { + to.to_tfo_len = TCP_FASTOPEN_COOKIE_LEN; + to.to_tfo_cookie = (u_char *)&tp->t_tfo_cookie; + to.to_flags |= TOF_FASTOPEN; + } +#endif } /* Window scaling. */ if ((flags & TH_SYN) && (tp->t_flags & TF_REQ_SCALE)) { @@ -997,7 +1047,7 @@ send: * give data to the user when a buffer fills or * a PUSH comes in.) */ - if (off + len == so->so_snd.sb_cc) + if ((off + len == so->so_snd.sb_cc) && !(flags & TH_SYN)) flags |= TH_PUSH; SOCKBUF_UNLOCK(&so->so_snd); } else { @@ -1694,6 +1744,25 @@ tcp_addoptions(struct tcpopt *to, u_char TCPSTAT_INC(tcps_sack_send_blocks); break; } +#ifdef TCP_RFC7413 + case TOF_FASTOPEN: + { + int total_len; + + /* XXX is there any point to aligning this option? */ + total_len = TCPOLEN_FAST_OPEN_EMPTY + to->to_tfo_len; + if (TCP_MAXOLEN - optlen < total_len) + continue; + *optp++ = TCPOPT_FAST_OPEN; + *optp++ = total_len; + if (to->to_tfo_len > 0) { + bcopy(to->to_tfo_cookie, optp, to->to_tfo_len); + optp += to->to_tfo_len; + } + optlen += total_len; + break; + } +#endif default: panic("%s: unknown TCP option type", __func__); break; Modified: stable/10/sys/netinet/tcp_subr.c ============================================================================== --- stable/10/sys/netinet/tcp_subr.c Mon Dec 28 02:36:57 2015 (r292822) +++ stable/10/sys/netinet/tcp_subr.c Mon Dec 28 02:43:12 2015 (r292823) @@ -83,6 +83,9 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef TCP_RFC7413 +#include +#endif #include #include #include @@ -427,6 +430,10 @@ tcp_init(void) SHUTDOWN_PRI_DEFAULT); EVENTHANDLER_REGISTER(maxsockets_change, tcp_zone_change, NULL, EVENTHANDLER_PRI_ANY); + +#ifdef TCP_RFC7413 + tcp_fastopen_init(); +#endif } #ifdef VIMAGE @@ -434,6 +441,9 @@ void tcp_destroy(void) { +#ifdef TCP_RFC7413 + tcp_fastopen_destroy(); +#endif tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); @@ -1102,6 +1112,17 @@ tcp_close(struct tcpcb *tp) if (tp->t_state == TCPS_LISTEN) tcp_offload_listen_stop(tp); #endif +#ifdef TCP_RFC7413 + /* + * This releases the TFO pending counter resource for TFO listen + * sockets as well as passively-created TFO sockets that transition + * from SYN_RECEIVED to CLOSED. + */ + if (tp->t_tfo_pending) { + tcp_fastopen_decrement_counter(tp->t_tfo_pending); + tp->t_tfo_pending = NULL; + } +#endif in_pcbdrop(inp); TCPSTAT_INC(tcps_closed); KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL")); Modified: stable/10/sys/netinet/tcp_syncache.c ============================================================================== --- stable/10/sys/netinet/tcp_syncache.c Mon Dec 28 02:36:57 2015 (r292822) +++ stable/10/sys/netinet/tcp_syncache.c Mon Dec 28 02:43:12 2015 (r292823) @@ -78,6 +78,9 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#ifdef TCP_RFC7413 +#include +#endif #include #include #include @@ -1089,6 +1092,39 @@ failed: return (0); } +#ifdef TCP_RFC7413 +static void +syncache_tfo_expand(struct syncache *sc, struct socket **lsop, struct mbuf *m, + uint64_t response_cookie) +{ + struct inpcb *inp; + struct tcpcb *tp; + unsigned int *pending_counter; + + /* + * Global TCP locks are held because we manipulate the PCB lists + * and create a new socket. + */ + INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + + pending_counter = intotcpcb(sotoinpcb(*lsop))->t_tfo_pending; + *lsop = syncache_socket(sc, *lsop, m); + if (*lsop == NULL) { + TCPSTAT_INC(tcps_sc_aborted); + atomic_subtract_int(pending_counter, 1); + } else { + inp = sotoinpcb(*lsop); + tp = intotcpcb(inp); + tp->t_flags |= TF_FASTOPEN; + tp->t_tfo_cookie = response_cookie; + tp->snd_max = tp->iss; + tp->snd_nxt = tp->iss; + tp->t_tfo_pending = pending_counter; + TCPSTAT_INC(tcps_sc_completed); + } +} +#endif /* TCP_RFC7413 */ + /* * Given a LISTEN socket and an inbound SYN request, add * this to the syn cache, and send back a segment: @@ -1101,8 +1137,15 @@ failed: * DoS attack, an attacker could send data which would eventually * consume all available buffer space if it were ACKed. By not ACKing * the data, we avoid this DoS scenario. + * + * The exception to the above is when a SYN with a valid TCP Fast Open (TFO) + * cookie is processed, V_tcp_fastopen_enabled set to true, and the + * TCP_FASTOPEN socket option is set. In this case, a new socket is created + * and returned via lsop, the mbuf is not freed so that tcp_input() can + * queue its data to the socket, and 1 is returned to indicate the + * TFO-socket-creation path was taken. */ -void +int syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct inpcb *inp, struct socket **lsop, struct mbuf *m, void *tod, void *todctx) @@ -1115,6 +1158,7 @@ syncache_add(struct in_conninfo *inc, st u_int ltflags; int win, sb_hiwat, ip_ttl, ip_tos; char *s; + int rv = 0; #ifdef INET6 int autoflowlabel = 0; #endif @@ -1123,6 +1167,11 @@ syncache_add(struct in_conninfo *inc, st #endif struct syncache scs; struct ucred *cred; +#ifdef TCP_RFC7413 + uint64_t tfo_response_cookie; + int tfo_cookie_valid = 0; + int tfo_response_cookie_valid = 0; +#endif INP_INFO_WLOCK_ASSERT(&V_tcbinfo); INP_WLOCK_ASSERT(inp); /* listen socket */ @@ -1148,6 +1197,29 @@ syncache_add(struct in_conninfo *inc, st sb_hiwat = so->so_rcv.sb_hiwat; ltflags = (tp->t_flags & (TF_NOOPT | TF_SIGNATURE)); +#ifdef TCP_RFC7413 + if (V_tcp_fastopen_enabled && (tp->t_flags & TF_FASTOPEN) && + (tp->t_tfo_pending != NULL) && (to->to_flags & TOF_FASTOPEN)) { + /* + * Limit the number of pending TFO connections to + * approximately half of the queue limit. This prevents TFO + * SYN floods from starving the service by filling the + * listen queue with bogus TFO connections. + */ + if (atomic_fetchadd_int(tp->t_tfo_pending, 1) <= + (so->so_qlimit / 2)) { + int result; + + result = tcp_fastopen_check_cookie(inc, + to->to_tfo_cookie, to->to_tfo_len, + &tfo_response_cookie); + tfo_cookie_valid = (result > 0); + tfo_response_cookie_valid = (result >= 0); + } else + atomic_subtract_int(tp->t_tfo_pending, 1); + } +#endif + /* By the time we drop the lock these should no longer be used. */ so = NULL; tp = NULL; @@ -1160,9 +1232,16 @@ syncache_add(struct in_conninfo *inc, st } else mac_syncache_create(maclabel, inp); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:15:38 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92100A4D5EC; Mon, 28 Dec 2015 03:15:38 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x22b.google.com (mail-ig0-x22b.google.com [IPv6:2607:f8b0:4001:c05::22b]) (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 654D019FD; Mon, 28 Dec 2015 03:15:38 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-ig0-x22b.google.com with SMTP id mv3so112151094igc.0; Sun, 27 Dec 2015 19:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fl0Dn2tTkO+afYQbJVRrUG873Kei29ATNmxPj9+STsA=; b=0TRMnAQFySNjtj4y6YE2UvvQKiRdc2javP3iDdh/BUMebvdAsZ1EaW+5yPwF2PDuiv dgCNyyOt1OVqGUoXzrKZpFt3DCU/CggXbR7KcyWaOgdbteHWHIf/R8akhDe6wKlZPpbb Fd4K/619aE0Vpytll1DUkx8qUulRU6/Xa+xWE1lyzzVByuR9JvQQ609uUf7449J20AkQ xjaEOb/wV9KlsWBGPyhI61jgEBc98tXqfHz6Vj/WaaIR4yQObYOsiNtTWg8ijuJUQiSl fV8kO4pgkCWQorOE72xBhOpoSyM9YnQX6Rhb72I6Irkqfiprp0R2pJRwlPvmEzQiLh8d pHng== MIME-Version: 1.0 X-Received: by 10.50.25.169 with SMTP id d9mr47281854igg.61.1451272537855; Sun, 27 Dec 2015 19:15:37 -0800 (PST) Received: by 10.36.121.202 with HTTP; Sun, 27 Dec 2015 19:15:37 -0800 (PST) In-Reply-To: <5680A574.9050002@freebsd.org> References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> Date: Sun, 27 Dec 2015 19:15:37 -0800 Message-ID: Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet From: Adrian Chadd To: Andrey Chernov Cc: Patrick Kelsey , "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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:15:38 -0000 On 27 December 2015 at 18:59, Andrey Chernov wrote: > On 28.12.2015 5:43, Patrick Kelsey wrote: >> Author: pkelsey >> Date: Mon Dec 28 02:43:12 2015 >> New Revision: 292823 >> URL: https://svnweb.freebsd.org/changeset/base/292823 >> >> Log: >> MFC r292706: >> >> Implementation of server-side TCP Fast Open (TFO) [RFC7413]. >> >> TFO is disabled by default in the kernel build. See the top comment >> in sys/netinet/tcp_fastopen.c for implementation particulars. > > Why it is disabled by default? Do we need some rc.conf knobs to not deal > directly with it, like tcp_extensions? OMG, why it is kernel config and > not boot-time sysctl? I don't need it in like, 90% of what I'm doing at the moment. I'm all for smaller builds and less code cross section to worry about. -a > -- > http://ache.vniz.net/ > From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:15:47 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE97EA4D62C; Mon, 28 Dec 2015 03:15:47 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: from mail-yk0-x230.google.com (mail-yk0-x230.google.com [IPv6:2607:f8b0:4002:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5BE81B35; Mon, 28 Dec 2015 03:15:47 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: by mail-yk0-x230.google.com with SMTP id x67so92139936ykd.2; Sun, 27 Dec 2015 19:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=+hAi1Pc+fR5n+2e/u+UgqH4ndvAoWIMwAN83HW7OgzU=; b=pwnFx5aHBeeurmRyajIcRJoKlKnQO8IO/n84Qhy0uppogt2rhLECtQ6ioZ5X2vaQ79 tHd6xecFWmMlihB7wENRut4mtTEJOx1pUIvSdjRCb0jtemvWrC3T++Z4COAI8MnFRGbs mtkQe2cATH3d+4Hi/MARUGjEAuIILX8yeRUByXv96jxt9iy5IlxOl97NWnVXQmURAPeB elhoWMqpopbw8owoQENayBxPYyG3i//GMhjITM13dQ1qxhPeQ2oNa17nQf74lfCVNXS4 be/RM0nz3MwMYgOkxTgqKx5OSKZmG8ykEkloqn1/iBQKqoq9yLfvGZD2cV/jCtN3uxPc 6XkA== MIME-Version: 1.0 X-Received: by 10.129.117.132 with SMTP id q126mr2206980ywc.184.1451272546949; Sun, 27 Dec 2015 19:15:46 -0800 (PST) Sender: pkelsey@gmail.com Received: by 10.13.211.65 with HTTP; Sun, 27 Dec 2015 19:15:46 -0800 (PST) In-Reply-To: <5680A574.9050002@freebsd.org> References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> Date: Sun, 27 Dec 2015 22:15:46 -0500 X-Google-Sender-Auth: J5rtvYA0-J9AysdF77aII9cfOZs Message-ID: Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet From: Patrick Kelsey To: Andrey Chernov 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-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:15:48 -0000 On Sun, Dec 27, 2015 at 9:59 PM, Andrey Chernov wrote: > On 28.12.2015 5:43, Patrick Kelsey wrote: > > Author: pkelsey > > Date: Mon Dec 28 02:43:12 2015 > > New Revision: 292823 > > URL: https://svnweb.freebsd.org/changeset/base/292823 > > > > Log: > > MFC r292706: > > > > Implementation of server-side TCP Fast Open (TFO) [RFC7413]. > > > > TFO is disabled by default in the kernel build. See the top comment > > in sys/netinet/tcp_fastopen.c for implementation particulars. > > Why it is disabled by default? Do we need some rc.conf knobs to not deal > directly with it, like tcp_extensions? OMG, why it is kernel config and > not boot-time sysctl? > This is explained in the top comment in sys/netinet/tcp_fastopen.c, but I will repeat it here and elaborate a little. It is disabled by default in the kernel build as a conservative measure until it is exercised more widely, given the modifications it introduces to the TCP state machine code, syncache code, etc. When you do enable it in the kernel build (and after some point in the future when it is enabled by default), there is still a sysctl that governs its availability in the system that must be enabled before it can be used. -Patrick From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:26:17 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FDBDA4DA3F for ; Mon, 28 Dec 2015 03:26:17 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) (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 2473B1F60 for ; Mon, 28 Dec 2015 03:26:16 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f46.google.com with SMTP id y184so192183813lfc.1 for ; Sun, 27 Dec 2015 19:26:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=AFSA7EmaPpr1+27fyUJB8IrUvyq7Iz8MaiR/MPuKq3A=; b=R398tt8s0jwrFAxDz5h3UAn9DnabXyNEdFo5LUJVxeW/IlLzmbat9ZYZBuHpZhMRa7 dbmaOLqA/E9QxVzyhrC8k9u7Wau2bQoHQEpiv98c4rKk6et2BkhdxWNhIhvewOaNw+94 M+NduZNWeVxnQ+lSUtVjCN8TKgso0NpKN0rn3Npt1KQJcmnop86ukBShWCdzcgNgiBEZ 4oo0Ei7yofJHAIKwt6qi5mv5jhcDiGyKfTzKAVelk+T5Oa09GBWHGJNgZ2Otbl2uXBhw zDKzgnQ3qnkwArU8Jehk++SrbAY9m9O90s/vGTdxCxQ9YZy89r07epoR2uFdQ8SHLSw0 iw2w== X-Gm-Message-State: ALoCoQmRFelLaPrVcyLz0L8114druI0DRvQa7T4foVejyg+69B6BSjpciiGyGVgs3ua6iO/OJ81Adk7EmbGlYaMdsxgD+7SuqQ== X-Received: by 10.25.213.134 with SMTP id m128mr14943186lfg.87.1451273174895; Sun, 27 Dec 2015 19:26:14 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id m21sm3432031lfe.29.2015.12.27.19.26.14 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 19:26:14 -0800 (PST) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet To: Patrick Kelsey References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Andrey Chernov Message-ID: <5680ABD5.7030206@freebsd.org> Date: Mon, 28 Dec 2015 06:26:13 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:26:17 -0000 On 28.12.2015 6:15, Patrick Kelsey wrote: > This is explained in the top comment in sys/netinet/tcp_fastopen.c, but > I will repeat it here and elaborate a little. It is disabled by default > in the kernel build as a conservative measure until it is exercised more > widely, given the modifications it introduces to the TCP state machine > code, syncache code, etc. When you do enable it in the kernel build > (and after some point in the future when it is enabled by default), > there is still a sysctl that governs its availability in the system that > must be enabled before it can be used. > > -Patrick Thanx, if I understand it correctly, is not ready for real use yet but just for experiments. See my other comment about TCP_RFC7413_MAX_KEYS -- http://ache.vniz.net/ From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:26:17 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F15B3A4DA42; Mon, 28 Dec 2015 03:26:17 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0CBF1F67; Mon, 28 Dec 2015 03:26:17 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS3QG7I022033; Mon, 28 Dec 2015 03:26:16 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS3QGms022032; Mon, 28 Dec 2015 03:26:16 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201512280326.tBS3QGms022032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Mon, 28 Dec 2015 03:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292824 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:26:18 -0000 Author: ume Date: Mon Dec 28 03:26:16 2015 New Revision: 292824 URL: https://svnweb.freebsd.org/changeset/base/292824 Log: MFC r292539: If we end up following a CNAME chain that does not find any data return that instead of internal error. PR: 156684 Modified: stable/10/lib/libc/net/getaddrinfo.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/getaddrinfo.c ============================================================================== --- stable/10/lib/libc/net/getaddrinfo.c Mon Dec 28 02:43:12 2015 (r292823) +++ stable/10/lib/libc/net/getaddrinfo.c Mon Dec 28 03:26:16 2015 (r292824) @@ -2166,7 +2166,11 @@ getanswer(const querybuf *answer, int an return sentinel.ai_next; } - RES_SET_H_ERRNO(res, NO_RECOVERY); + /* + * We could have walked a CNAME chain, but the ultimate target + * may not have what we looked for. + */ + RES_SET_H_ERRNO(res, ntohs(hp->ancount) > 0 ? NO_DATA : NO_RECOVERY); return NULL; } @@ -2343,6 +2347,7 @@ _dns_getaddrinfo(void *rv, void *cb_data if (sentinel.ai_next == NULL) switch (res->res_h_errno) { case HOST_NOT_FOUND: + case NO_DATA: return NS_NOTFOUND; case TRY_AGAIN: return NS_TRYAGAIN; From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:36:46 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FE31A4DF55; Mon, 28 Dec 2015 03:36:46 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: from mail-qg0-x235.google.com (mail-qg0-x235.google.com [IPv6:2607:f8b0:400d:c04::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 013011807; Mon, 28 Dec 2015 03:36:46 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: by mail-qg0-x235.google.com with SMTP id e32so48859709qgf.3; Sun, 27 Dec 2015 19:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=yd+PvmQ1RImY4hKImjC0X/LWJWJOx8a6utP0PjdQzhk=; b=nMv08CWXqztApw86NXOVLyJMkDYfE0MxA/pek/Y7/0PjugcR+WhM7vV8ViD9yqTYFf CcaVdRNEB47Q0MkBq4BEFPohiu+1T/aHidJqemmJTtvjDnin8S2WsZf++m40Ez4N41uX 7DNP6Yp5yGkSLmfIhZa558xGY63kUwB9E1SbLzZmSK24ZqEw9W4H/gxKgtEvoL3XsfZD qs90UNegr/RauNA9IBOyZ+4kPJ0xxX4yBgcR0P3lZJG5poDTTOSdsrcKln81ib2elqLn ynEcA8VPYWGkU7jFK2wSgYBYnPTWJMsr4+ElpGDA6/txZT2s4SOzmrHqUbk7SqiShSSl F3eQ== X-Received: by 10.141.28.149 with SMTP id f143mr71321414qhe.66.1451273804830; Sun, 27 Dec 2015 19:36:44 -0800 (PST) Received: from [172.16.0.133] (c-174-59-104-177.hsd1.pa.comcast.net. [174.59.104.177]) by smtp.gmail.com with ESMTPSA id p17sm26430122qhb.34.2015.12.27.19.36.44 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Dec 2015 19:36:44 -0800 (PST) Sender: Patrick Kelsey Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet From: Patrick Kelsey X-Mailer: iPhone Mail (13C75) In-Reply-To: <5680A991.5040301@freebsd.org> Date: Sun, 27 Dec 2015 22:36:43 -0500 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0087B045-F70E-4CF5-A1B7-5B421926BB5A@freebsd.org> References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> <5680A991.5040301@freebsd.org> To: Andrey Chernov X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:36:46 -0000 > On Dec 27, 2015, at 10:16 PM, Andrey Chernov wrote: >=20 >> On 28.12.2015 5:59, Andrey Chernov wrote: >>> On 28.12.2015 5:43, Patrick Kelsey wrote: >>> Author: pkelsey >>> Date: Mon Dec 28 02:43:12 2015 >>> New Revision: 292823 >>> URL: https://svnweb.freebsd.org/changeset/base/292823 >>>=20 >>> Log: >>> MFC r292706: >>>=20 >>> Implementation of server-side TCP Fast Open (TFO) [RFC7413]. >>>=20 >>> TFO is disabled by default in the kernel build. See the top comment >>> in sys/netinet/tcp_fastopen.c for implementation particulars. >>=20 >> Why it is disabled by default? Do we need some rc.conf knobs to not deal >> directly with it, like tcp_extensions? OMG, why it is kernel config and >> not boot-time sysctl? >=20 > BTW, TCP_RFC7413_MAX_KEYS currently unused and I have no clues what it > supposed to be. I can't find it in the phabric patch at all. >=20 Look at line 127 in tcp_fastopen.c. Also, read the top comment in tcp_fasto= pen.c. Phabricator is buggy and unreliable, and using it as a primary reference to t= he code will let you down as it has let me down, repeatedly. For example, i= t will not show you the contents of entirely new files unless you manually u= pload them - I believe this what is currently affecting your viewpoint. -Patrick= From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:37:14 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C14C9A4DFCD; Mon, 28 Dec 2015 03:37:14 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F5C8199E; Mon, 28 Dec 2015 03:37:14 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS3bDcP025470; Mon, 28 Dec 2015 03:37:13 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS3bDEV025468; Mon, 28 Dec 2015 03:37:13 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201512280337.tBS3bDEV025468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Mon, 28 Dec 2015 03:37: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: r292826 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:37:14 -0000 Author: ume Date: Mon Dec 28 03:37:13 2015 New Revision: 292826 URL: https://svnweb.freebsd.org/changeset/base/292826 Log: MFC r292445, r292554: Use _map_v4v6_address(). Modified: stable/10/lib/libc/net/getaddrinfo.c stable/10/lib/libc/net/name6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/getaddrinfo.c ============================================================================== --- stable/10/lib/libc/net/getaddrinfo.c Mon Dec 28 03:27:51 2015 (r292825) +++ stable/10/lib/libc/net/getaddrinfo.c Mon Dec 28 03:37:13 2015 (r292826) @@ -778,10 +778,9 @@ match_addrselectpolicy(struct sockaddr * memset(&key, 0, sizeof(key)); key.sin6_family = AF_INET6; key.sin6_len = sizeof(key); - key.sin6_addr.s6_addr[10] = 0xff; - key.sin6_addr.s6_addr[11] = 0xff; - memcpy(&key.sin6_addr.s6_addr[12], - &((struct sockaddr_in *)addr)->sin_addr, 4); + _map_v4v6_address( + (char *)&((struct sockaddr_in *)addr)->sin_addr, + (char *)&key.sin6_addr); break; default: return(NULL); Modified: stable/10/lib/libc/net/name6.c ============================================================================== --- stable/10/lib/libc/net/name6.c Mon Dec 28 03:27:51 2015 (r292825) +++ stable/10/lib/libc/net/name6.c Mon Dec 28 03:37:13 2015 (r292826) @@ -795,10 +795,9 @@ match_addrselectpolicy(struct sockaddr * memset(&key, 0, sizeof(key)); key.sin6_family = AF_INET6; key.sin6_len = sizeof(key); - key.sin6_addr.s6_addr[10] = 0xff; - key.sin6_addr.s6_addr[11] = 0xff; - memcpy(&key.sin6_addr.s6_addr[12], - &((struct sockaddr_in *)addr)->sin_addr, 4); + _map_v4v6_address( + (char *)&((struct sockaddr_in *)addr)->sin_addr, + (char *)&key.sin6_addr); break; default: return(NULL); From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:45:08 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A30DA5229A for ; Mon, 28 Dec 2015 03:45:08 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) (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 02BD51E99 for ; Mon, 28 Dec 2015 03:45:07 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lb0-f180.google.com with SMTP id sv6so79335760lbb.0 for ; Sun, 27 Dec 2015 19:45:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=fvb8vcSHtdCggwOgOQODgtq5JOVm5ivKjpuOO0ErXEI=; b=C0Bjk2jsSKB3su20CjNoRtpnVtpmnUcjuRhPoT2eyEjZ5g1vFVsHsTCI/K7HMEHZuM 6xBgMiYNtY668njC8FWFdMUuDXiT3fKb3NtgjhN1TiPMmOVWi2fQiHLcxC1Mp9b68YuR tnCdYOGvJ0OgznXy9V9Dk67y+AMcf659YrkFi7mgHUGxk5AHVgEsNBFKVgGYUkqFdvJ5 CSztoH/GnTYIWfWMcH7l2p2Ol3ag38fMIoMk0M+oXzWaxwR2rhpJ8HJj3SiH6c3ds2SF /lxC0tZkbfZYPxUWRamloc5x3L4O/LIV2C9WRsonwtIzyQ5PBCcCPppU07pa5/zkJUam qiVA== X-Gm-Message-State: ALoCoQkrICgRyR2AKORCG/HEGjK2jev0KIlixfNDINSCElefbb9C3/jx878RcBzhu+MTUBeIpxT1JcL70z9ZP9lPD/urBs6BHQ== X-Received: by 10.112.140.166 with SMTP id rh6mr18488828lbb.77.1451274306047; Sun, 27 Dec 2015 19:45:06 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id q8sm10112173lbr.1.2015.12.27.19.45.05 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 19:45:05 -0800 (PST) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet To: Patrick Kelsey References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> <5680A991.5040301@freebsd.org> <0087B045-F70E-4CF5-A1B7-5B421926BB5A@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Andrey Chernov Message-ID: <5680B040.40106@freebsd.org> Date: Mon, 28 Dec 2015 06:45:04 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <0087B045-F70E-4CF5-A1B7-5B421926BB5A@freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:45:08 -0000 On 28.12.2015 6:36, Patrick Kelsey wrote: > > >> On Dec 27, 2015, at 10:16 PM, Andrey Chernov wrote: >> >>> On 28.12.2015 5:59, Andrey Chernov wrote: >>>> On 28.12.2015 5:43, Patrick Kelsey wrote: >>>> Author: pkelsey >>>> Date: Mon Dec 28 02:43:12 2015 >>>> New Revision: 292823 >>>> URL: https://svnweb.freebsd.org/changeset/base/292823 >>>> >>>> Log: >>>> MFC r292706: >>>> >>>> Implementation of server-side TCP Fast Open (TFO) [RFC7413]. >>>> >>>> TFO is disabled by default in the kernel build. See the top comment >>>> in sys/netinet/tcp_fastopen.c for implementation particulars. >>> >>> Why it is disabled by default? Do we need some rc.conf knobs to not deal >>> directly with it, like tcp_extensions? OMG, why it is kernel config and >>> not boot-time sysctl? >> >> BTW, TCP_RFC7413_MAX_KEYS currently unused and I have no clues what it >> supposed to be. I can't find it in the phabric patch at all. >> > > Look at line 127 in tcp_fastopen.c. Also, read the top comment in tcp_fastopen.c. > > Phabricator is buggy and unreliable, and using it as a primary reference to the code will let you down as it has let me down, repeatedly. For example, it will not show you the contents of entirely new files unless you manually upload them - I believe this what is currently affecting your viewpoint. Ok, thanx, I see now, sorry phabricator confuses me at this point. Someone should fix it to avoid such things. -- http://ache.vniz.net/ From owner-svn-src-stable-10@freebsd.org Mon Dec 28 03:45:42 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 204B6A5230C; Mon, 28 Dec 2015 03:45:42 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: from mail-qk0-x22e.google.com (mail-qk0-x22e.google.com [IPv6:2607:f8b0:400d:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D53871EF9; Mon, 28 Dec 2015 03:45:41 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: by mail-qk0-x22e.google.com with SMTP id k189so192234934qkc.0; Sun, 27 Dec 2015 19:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zxS82ymUfGhvlvOOtC7lW326GKP8kddpBsx/TDsLCUE=; b=y1Zp+ZpZpJSFRHH6J2rgJKdE35xioLABNJrha5veUoajNJHsx6imKlw/psGMabNDIm FIt00l19tBEZVvZ+IBX7ev+2EWPKuFfWujtY6IDzP/RgxmqrGKSG1Oorl0EMiHtN7a4f HUeCWn4J+MmeAMUVk1zHqSdHp7+nkSoNvl8d4TeS7PhcUrl8D2mMEr2tThIw3owjaT4s 7jDEUULJDN8Io8U/gBokmSr0VfXr+oKvCEnJKryC3F3DDhv3Rt7ijHOlxAcjvBm1aL7N IPCZKiAsdDxEja9bgMiOM9agmJuutMxDwuYAubKL7lg0l5VCzX0OM+MzSNMiyttWx/zk /k+Q== X-Received: by 10.55.73.74 with SMTP id w71mr68909099qka.60.1451274340888; Sun, 27 Dec 2015 19:45:40 -0800 (PST) Received: from [172.16.0.133] (c-174-59-104-177.hsd1.pa.comcast.net. [174.59.104.177]) by smtp.gmail.com with ESMTPSA id x76sm26462315qhb.48.2015.12.27.19.45.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Dec 2015 19:45:40 -0800 (PST) Sender: Patrick Kelsey Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet From: Patrick Kelsey X-Mailer: iPhone Mail (13C75) In-Reply-To: <5680ABD5.7030206@freebsd.org> Date: Sun, 27 Dec 2015 22:45:39 -0500 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> <5680ABD5.7030206@freebsd.org> To: Andrey Chernov X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 03:45:42 -0000 > On Dec 27, 2015, at 10:26 PM, Andrey Chernov wrote: >=20 >> On 28.12.2015 6:15, Patrick Kelsey wrote: >> This is explained in the top comment in sys/netinet/tcp_fastopen.c, but >> I will repeat it here and elaborate a little. It is disabled by default >> in the kernel build as a conservative measure until it is exercised more >> widely, given the modifications it introduces to the TCP state machine >> code, syncache code, etc. When you do enable it in the kernel build >> (and after some point in the future when it is enabled by default), >> there is still a sysctl that governs its availability in the system that >> must be enabled before it can be used. >>=20 >> -Patrick >=20 > Thanx, if I understand it correctly, is not ready for real use yet but > just for experiments. See my other comment about TCP_RFC7413_MAX_KEYS >=20 It is a serious implementation that is believed to be complete, however I d= o not see much evidence that TFO is currently widely deployed and used*, and= I consider the changes I made to the rest of the TCP stack, which is widely= deployed and used, to be intrusive enough to warrant being conservative in p= utting these changes into the default kernel build at this point. I responded to your other message regarding TCP_RFC7413_MAX_KEYS. -Patrick *For example, the current Linux TFO client appears to be surprisingly weak i= n that it does not ACK data in a TFO SYN|ACK, forcing a retransmit of fast T= FO server responses, which kind of defeats the purpose.= From owner-svn-src-stable-10@freebsd.org Mon Dec 28 04:00:36 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B13DFA5263D for ; Mon, 28 Dec 2015 04:00:36 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) (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 3E5DD14D9 for ; Mon, 28 Dec 2015 04:00:35 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f44.google.com with SMTP id z124so187762018lfa.3 for ; Sun, 27 Dec 2015 20:00:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=Q9qQN8oVe5w6bqtFvfo44IbjG5C1UyHL3oqdOKvAI1k=; b=dmeaPFrVg4k+OzeMDnaYkQfOGuPlpfUqBstDp+AHtmYWUPEbVOdOWnE4vuGKvVS3su 2EhuG9+5vVYqrWHJRFeuoqfJ/lsEIkRMf68HTUgsqoMa0Z4mHctVJzZA9888Hd6BWYAq EZV1Ran/ZAA1GOY7umcX92DL7X5ZSKrbEScJhFWCPW3wbrwQHsaAqP7SljqdYSg2E6qK 5fXSQ7u2ceAjqSDWFLZAkUSbnftiHoaHIbKx54AGlXFb0kk13TQ0kEZxkznWYWhbtvld Ygns3JaBkcQn9GxKZMGqD99B7B88h4LVZkhmh32FR0WTymQ6B8FDgC0ZjG6DW1Nw1rXf 6cbA== X-Gm-Message-State: ALoCoQkxsQIm0CDr+knSTw1vV3IKaklWg+A0KY9BltoUGVPPmdiI2ye6dRE/2fgCqFtIYtj4drVx0To8rvPDpEQP9lJTp6V2OA== X-Received: by 10.25.31.210 with SMTP id f201mr18416954lff.6.1451271541880; Sun, 27 Dec 2015 18:59:01 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id eb3sm4526157lbc.31.2015.12.27.18.59.00 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 18:59:01 -0800 (PST) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet To: Patrick Kelsey , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201512280243.tBS2hD7X008202@repo.freebsd.org> From: Andrey Chernov X-Enigmail-Draft-Status: N1110 Message-ID: <5680A574.9050002@freebsd.org> Date: Mon, 28 Dec 2015 05:59:00 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <201512280243.tBS2hD7X008202@repo.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 04:00:36 -0000 On 28.12.2015 5:43, Patrick Kelsey wrote: > Author: pkelsey > Date: Mon Dec 28 02:43:12 2015 > New Revision: 292823 > URL: https://svnweb.freebsd.org/changeset/base/292823 > > Log: > MFC r292706: > > Implementation of server-side TCP Fast Open (TFO) [RFC7413]. > > TFO is disabled by default in the kernel build. See the top comment > in sys/netinet/tcp_fastopen.c for implementation particulars. Why it is disabled by default? Do we need some rc.conf knobs to not deal directly with it, like tcp_extensions? OMG, why it is kernel config and not boot-time sysctl? -- http://ache.vniz.net/ From owner-svn-src-stable-10@freebsd.org Mon Dec 28 04:06:27 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F38D0A52828 for ; Mon, 28 Dec 2015 04:06:26 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) (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 827F217F8 for ; Mon, 28 Dec 2015 04:06:26 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f52.google.com with SMTP id z124so187803481lfa.3 for ; Sun, 27 Dec 2015 20:06:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=IVRgJsuxwARE5nwvIahxEhYUS9OVkWyoLPNMPwHT/Eo=; b=OM/9Lm5/xFKNJNfvzfdFRdAUuUH8G0yy6igozXR6OOD+s3ku1t6yayXqePyHTH3r7z 8Sb6SendC+BPqVGKBUVj75d6EJiQVi15q8l9ApM18TguB4QnTVq5OM7GvGVfHIIoCiiL tIU+w5Wu0DxLXOTKvkwtvZpGVfJis5SwTI45EPx0mmlQCQz8hWsbX6ZnGennWI7BuIjL wZsrsq1YfhaYGUOxAi/mFif9dz4sQWweaEFvoWR1M3/gVDH5/jNZmNq5sKHsQtAOm/zd auSkIheX/O9fhAXmRGYl0Buw9iZ5IqI2T+iZrvq7buTGaIzyZMe9QwccZxorCnRXwwLA HWGw== X-Gm-Message-State: ALoCoQmI+7CcOkHdHFHnNklz7RwQDCeILlmGBJ+8nt1mKIB3U1ensMRsgiTgsd5F1g0E0TcJEvN98ZAMZRd0aGvZyY5pNbqpXg== X-Received: by 10.25.165.133 with SMTP id o127mr9385380lfe.105.1451275584489; Sun, 27 Dec 2015 20:06:24 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id p138sm6847431lfb.22.2015.12.27.20.06.23 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 20:06:23 -0800 (PST) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet To: Patrick Kelsey References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> <5680ABD5.7030206@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Andrey Chernov X-Enigmail-Draft-Status: N1110 Message-ID: <5680B53F.9040903@freebsd.org> Date: Mon, 28 Dec 2015 07:06:23 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 04:06:27 -0000 On 28.12.2015 6:45, Patrick Kelsey wrote: >> On Dec 27, 2015, at 10:26 PM, Andrey Chernov wrote: >> >>> On 28.12.2015 6:15, Patrick Kelsey wrote: >>> This is explained in the top comment in sys/netinet/tcp_fastopen.c, but >>> I will repeat it here and elaborate a little. It is disabled by default >>> in the kernel build as a conservative measure until it is exercised more >>> widely, given the modifications it introduces to the TCP state machine >>> code, syncache code, etc. When you do enable it in the kernel build >>> (and after some point in the future when it is enabled by default), >>> there is still a sysctl that governs its availability in the system that >>> must be enabled before it can be used. >>> >>> -Patrick >> >> Thanx, if I understand it correctly, is not ready for real use yet but >> just for experiments. See my other comment about TCP_RFC7413_MAX_KEYS >> > > It is a serious implementation that is believed to be complete, however I do not see much evidence that TFO is currently widely deployed and used*, and I consider the changes I made to the rest of the TCP stack, which is widely deployed and used, to be intrusive enough to warrant being conservative in putting these changes into the default kernel build at this point. > > *For example, the current Linux TFO client appears to be surprisingly > weak in that it does not ACK data in a TFO SYN|ACK, forcing a > retransmit of fast TFO server responses, which kind of defeats the > purpose. RFC7413 sounds very promising. Should we wait until Linux fix its bug you mention or just go further having TFO at least for FreeBSD machines on some internal net? If the second case is preferred by others, IMHO it will be better to control it via sysctl compiled in by default, controlled by rc.conf on the upper level. I don't see too much code added to make sufficient size bloat. -- http://ache.vniz.net/ From owner-svn-src-stable-10@freebsd.org Mon Dec 28 04:53:21 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE36BA535D5 for ; Mon, 28 Dec 2015 04:53:21 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) (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 42E3618A2 for ; Mon, 28 Dec 2015 04:53:20 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lb0-f178.google.com with SMTP id pv2so101233945lbb.1 for ; Sun, 27 Dec 2015 20:53:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=slGayxW7ePcWouy8BuWtfDTD1B6iyU2CUoU0Aj7crss=; b=mP7G4FWhIaFCoGC2rtdUyA9UkObpMiYhJmRfdhLLvLBZpCVtwxEK35XS9VM3Sb7Wuh jMGjr3nr7XwPeHqUD2+47hyUDCc0qYEKplSJg/ccVH7uvoK/VAmpjr8LiXayQaUmqFLV awtBlBRAswjfeU6rV4XhpuWjAPSTX7fl3zg+tnpb0731C6WziCpccErxusjOjw4pIE86 drxyAkswt7ATQ0EOmKCgS+ns8guY+IGU2XXyvJwPR1ao+E44UQPqsT1zlbFOF/64fq9o RPjbPuxdMpUWLGtZpgJ0YDHtYaFYlVO0HBJ5ck7UyZu/V3bWkUE4/s4ftigz366jQKeP P4Jg== X-Gm-Message-State: ALoCoQnh2TJxiidlHsA8YsuOOUwN2SMDWG3FXsF5qp65Gu0fnF2VM2cLOYQyiYVFluVYwOqGIWw3iXFPx4s1R2xXNPr+P05k/w== X-Received: by 10.112.42.67 with SMTP id m3mr18922317lbl.2.1451272594809; Sun, 27 Dec 2015 19:16:34 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id l128sm10001984lfd.10.2015.12.27.19.16.34 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 27 Dec 2015 19:16:34 -0800 (PST) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet To: Patrick Kelsey , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> From: Andrey Chernov Message-ID: <5680A991.5040301@freebsd.org> Date: Mon, 28 Dec 2015 06:16:33 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5680A574.9050002@freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 04:53:21 -0000 On 28.12.2015 5:59, Andrey Chernov wrote: > On 28.12.2015 5:43, Patrick Kelsey wrote: >> Author: pkelsey >> Date: Mon Dec 28 02:43:12 2015 >> New Revision: 292823 >> URL: https://svnweb.freebsd.org/changeset/base/292823 >> >> Log: >> MFC r292706: >> >> Implementation of server-side TCP Fast Open (TFO) [RFC7413]. >> >> TFO is disabled by default in the kernel build. See the top comment >> in sys/netinet/tcp_fastopen.c for implementation particulars. > > Why it is disabled by default? Do we need some rc.conf knobs to not deal > directly with it, like tcp_extensions? OMG, why it is kernel config and > not boot-time sysctl? > BTW, TCP_RFC7413_MAX_KEYS currently unused and I have no clues what it supposed to be. I can't find it in the phabric patch at all. -- http://ache.vniz.net/ From owner-svn-src-stable-10@freebsd.org Mon Dec 28 06:07:01 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E613A52A03; Mon, 28 Dec 2015 06:07:01 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: from mail-qg0-x22c.google.com (mail-qg0-x22c.google.com [IPv6:2607:f8b0:400d:c04::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 3037F1CEA; Mon, 28 Dec 2015 06:07:01 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: by mail-qg0-x22c.google.com with SMTP id o11so141736601qge.2; Sun, 27 Dec 2015 22:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oTRTSvqBcb39oL5q1JLnps574eIdZXB7NMV481Q0Mao=; b=Ujmp7qMSEjxvL5iJgtLlkQMqwheIe0E26VpqN08if0tyCswZELCR5zla6ZENPq9RYI cU3fGOAYzYENMI6v96XUUsTNWTvLAJK3/W0pnD6yIaB87JO86lHNQRpcI7AQZ0ZEebQM YtwvJTS9aPS5zQYGh9ZNA3t2teurdjLDFfHldmTGovki4/GBr53l9WfKsCDc3msQHSGU AKUK44sxZstLVfdekXH9OAUhaJPGGB5xhcP+6YolfENxyHZe6mIHM0ASScs/5d/TMQ1M edb5c/B7S/KJEkw/U4vX/1aT0mUtIi4+iQRzOQBf+Usz/GJw5hFMkF7qJGNj/RFtxXMl p0eQ== X-Received: by 10.140.17.213 with SMTP id 79mr68887794qgd.49.1451282820279; Sun, 27 Dec 2015 22:07:00 -0800 (PST) Received: from [172.16.0.133] (c-174-59-104-177.hsd1.pa.comcast.net. [174.59.104.177]) by smtp.gmail.com with ESMTPSA id d6sm26912182qkb.13.2015.12.27.22.06.59 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Dec 2015 22:06:59 -0800 (PST) Sender: Patrick Kelsey Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r292823 - in stable/10/sys: conf netinet From: Patrick Kelsey X-Mailer: iPhone Mail (13C75) In-Reply-To: <5680B53F.9040903@freebsd.org> Date: Mon, 28 Dec 2015 01:06:59 -0500 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0E5C9BC6-F52E-45F6-A3F7-CCED1BD0F8C7@freebsd.org> References: <201512280243.tBS2hD7X008202@repo.freebsd.org> <5680A574.9050002@freebsd.org> <5680ABD5.7030206@freebsd.org> <5680B53F.9040903@freebsd.org> To: Andrey Chernov X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 06:07:01 -0000 > On Dec 27, 2015, at 11:06 PM, Andrey Chernov wrote: >=20 > On 28.12.2015 6:45, Patrick Kelsey wrote: >>> On Dec 27, 2015, at 10:26 PM, Andrey Chernov wrote: >>>=20 >>>> On 28.12.2015 6:15, Patrick Kelsey wrote: >>>> This is explained in the top comment in sys/netinet/tcp_fastopen.c, but= >>>> I will repeat it here and elaborate a little. It is disabled by defaul= t >>>> in the kernel build as a conservative measure until it is exercised mor= e >>>> widely, given the modifications it introduces to the TCP state machine >>>> code, syncache code, etc. When you do enable it in the kernel build >>>> (and after some point in the future when it is enabled by default), >>>> there is still a sysctl that governs its availability in the system tha= t >>>> must be enabled before it can be used. >>>>=20 >>>> -Patrick >>>=20 >>> Thanx, if I understand it correctly, is not ready for real use yet but >>> just for experiments. See my other comment about TCP_RFC7413_MAX_KEYS >>=20 >> It is a serious implementation that is believed to be complete, however I= do not see much evidence that TFO is currently widely deployed and used*, a= nd I consider the changes I made to the rest of the TCP stack, which is wide= ly deployed and used, to be intrusive enough to warrant being conservative i= n putting these changes into the default kernel build at this point. >>=20 >> *For example, the current Linux TFO client appears to be surprisingly >> weak in that it does not ACK data in a TFO SYN|ACK, forcing a >> retransmit of fast TFO server responses, which kind of defeats the >> purpose. >=20 > RFC7413 sounds very promising. Should we wait until Linux fix its bug > you mention or just go further having TFO at least for FreeBSD machines > on some internal net? If the second case is preferred by others, IMHO it > will be better to control it via sysctl compiled in by default, > controlled by rc.conf on the upper level. I don't see too much code > added to make sufficient size bloat. >=20 I don't think it is a matter of waiting for a Linux bug to be fixed - I only= cited this particular bug as something that has colored my thinking as to h= ow much close attention is being paid to TFO at the present time. The Mac O= S X client works better, so it is not really a question of quality clients e= xisting. I have just chosen to be conservative in the initial release of th= is functionality based on my impression that the current audience for it is n= ot very big and my desire for my implementation to see wider testing first. = I do expect the audience for TFO to grow over time and for this implementat= ion to receive wider testing. One thing to consider about RFC7413 that is not always apparent when first l= ooking at it is that it is not a general-purpose speedup that can be applied= transparently for any/all applications. One of the things that can happen w= hen using TFO that cannot happen when using the regular TCP three-way handsh= ake is that packet duplication in the network can result in application-leve= l request duplication. Because of this, TFO is only really suitable for app= lications that have some built-in mitigation for this or otherwise do not ha= ve to care about it. This is discussed in the RFC. Also, in my opinion, when using TFO, one has to accept certain ideas present= ed in the RFC about the relative importance or attractiveness to attackers o= f certain attack vectors that are introduced by TFO, or establish that your p= articular application can otherwise mitigate or tolerate them. Again, this i= s not a general purpose, set-it-and-forget-it kind of TCP performance improv= ement. -Patrick From owner-svn-src-stable-10@freebsd.org Mon Dec 28 09:03:30 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73A6DA53765; Mon, 28 Dec 2015 09:03:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B5FB1E6E; Mon, 28 Dec 2015 09:03:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBS93TQt025010; Mon, 28 Dec 2015 09:03:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBS93TDU025009; Mon, 28 Dec 2015 09:03:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512280903.tBS93TDU025009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 28 Dec 2015 09:03:29 +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: r292830 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 09:03:30 -0000 Author: kib Date: Mon Dec 28 09:03:29 2015 New Revision: 292830 URL: https://svnweb.freebsd.org/changeset/base/292830 Log: MFC r292541: Recheck curthread->td_su after the VFS_SYNC() call. Modified: stable/10/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_softdep.c Mon Dec 28 08:53:31 2015 (r292829) +++ stable/10/sys/ufs/ffs/ffs_softdep.c Mon Dec 28 09:03:29 2015 (r292830) @@ -13300,43 +13300,43 @@ softdep_ast_cleanup_proc(void) bool req; td = curthread; - mp = td->td_su; - if (mp == NULL) - return; - td->td_su = NULL; - error = vfs_busy(mp, MBF_NOWAIT); - vfs_rel(mp); - if (error != 0) - return; - if (ffs_own_mount(mp) && MOUNTEDSOFTDEP(mp)) { - ump = VFSTOUFS(mp); - for (;;) { - req = false; - ACQUIRE_LOCK(ump); - if (softdep_excess_items(ump, D_INODEDEP)) { - req = true; - request_cleanup(mp, FLUSH_INODES); - } - if (softdep_excess_items(ump, D_DIRREM)) { - req = true; - request_cleanup(mp, FLUSH_BLOCKS); - } - FREE_LOCK(ump); - if (softdep_excess_items(ump, D_NEWBLK) || - softdep_excess_items(ump, D_ALLOCDIRECT) || - softdep_excess_items(ump, D_ALLOCINDIR)) { - error = vn_start_write(NULL, &mp, V_WAIT); - if (error == 0) { + while ((mp = td->td_su) != NULL) { + td->td_su = NULL; + error = vfs_busy(mp, MBF_NOWAIT); + vfs_rel(mp); + if (error != 0) + return; + if (ffs_own_mount(mp) && MOUNTEDSOFTDEP(mp)) { + ump = VFSTOUFS(mp); + for (;;) { + req = false; + ACQUIRE_LOCK(ump); + if (softdep_excess_items(ump, D_INODEDEP)) { req = true; - VFS_SYNC(mp, MNT_WAIT); - vn_finished_write(mp); + request_cleanup(mp, FLUSH_INODES); } + if (softdep_excess_items(ump, D_DIRREM)) { + req = true; + request_cleanup(mp, FLUSH_BLOCKS); + } + FREE_LOCK(ump); + if (softdep_excess_items(ump, D_NEWBLK) || + softdep_excess_items(ump, D_ALLOCDIRECT) || + softdep_excess_items(ump, D_ALLOCINDIR)) { + error = vn_start_write(NULL, &mp, + V_WAIT); + if (error == 0) { + req = true; + VFS_SYNC(mp, MNT_WAIT); + vn_finished_write(mp); + } + } + if ((td->td_pflags & TDP_KTHREAD) != 0 || !req) + break; } - if ((td->td_pflags & TDP_KTHREAD) != 0 || !req) - break; } + vfs_unbusy(mp); } - vfs_unbusy(mp); } /* From owner-svn-src-stable-10@freebsd.org Mon Dec 28 17:50:33 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5359EA548D1; Mon, 28 Dec 2015 17:50:33 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 136E81F4E; Mon, 28 Dec 2015 17:50:33 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSHoWo6085467; Mon, 28 Dec 2015 17:50:32 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSHoW3g085465; Mon, 28 Dec 2015 17:50:32 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201512281750.tBSHoW3g085465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 28 Dec 2015 17:50:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292833 - stable/10/usr.sbin/sysrc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 17:50:33 -0000 Author: dteske Date: Mon Dec 28 17:50:31 2015 New Revision: 292833 URL: https://svnweb.freebsd.org/changeset/base/292833 Log: MFC r290337: Add sysrc(8) support for "rc.conf.d" Differential Revision: https://reviews.freebsd.org/D3551 Reviewed by: allanjude Relnotes: yes Modified: stable/10/usr.sbin/sysrc/sysrc stable/10/usr.sbin/sysrc/sysrc.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/sysrc/sysrc ============================================================================== --- stable/10/usr.sbin/sysrc/sysrc Mon Dec 28 17:27:20 2015 (r292832) +++ stable/10/usr.sbin/sysrc/sysrc Mon Dec 28 17:50:31 2015 (r292833) @@ -40,18 +40,23 @@ BSDCFG_SHARE="/usr/share/bsdconfig" # # Version information # -SYSRC_VERSION="6.5 Sep-1,2015" +SYSRC_VERSION="7.0 Sep-13,2015" # # Options # CHECK_ONLY= +DEFAULT= DELETE= DESCRIBE= +EXISTING_ONLY= IGNORE_UNKNOWNS= JAIL= +LIST_SERVICE_CONFS= +LIST_CONFS= QUIET= ROOTDIR= +SERVICE= SHOW_ALL= SHOW_EQUALS= SHOW_FILE= @@ -80,7 +85,8 @@ die() # usage() { - f_err "Usage: %s [OPTIONS] name[[+|-]=value] ...\n" "$pgm" + f_err "Usage: %s [OPTIONS] %s\n" "$pgm" \ + "{name[[+|-]=value] ... | -a | -A | -l | -L [name ...]}" f_err "Try \`%s --help' for more information.\n" "$pgm" die } @@ -95,6 +101,8 @@ help() local envfmt="\t%-17s%s\n" f_err "Usage: %s [OPTIONS] name[[+|-]=value] ...\n" "$pgm" + f_err "Usage: %s [OPTIONS] -a | -A\n" "$pgm" + f_err "Usage: %s [OPTIONS] -l | -L [name ...]\n" "$pgm" f_err "OPTIONS:\n" f_err "$optfmt" "-a" \ @@ -113,6 +121,8 @@ help() "Print query results as \`var=value' (useful for producing" f_err "$optfmt" "" \ "output to be fed back in). Ignored if \`-n' is specified." + f_err "$optfmt" "-E" \ + "Existing files only with \`-[lL]' or when changing a setting." f_err "$optfmt" "-f file" \ "Operate on the specified file(s) instead of rc_conf_files." f_err "$optfmt" "" \ @@ -129,12 +139,20 @@ help() "The jid or name of the jail to operate within (overrides" f_err "$optfmt" "" \ "\`-R dir'; requires jexec(8))." + f_err "$optfmt" "-l" \ + "List configuration files used at startup on stdout and exit." + f_err "$optfmt" "-L" \ + "List all configuration files including rc.conf.d entries." f_err "$optfmt" "-n" \ "Show only variable values, not their names." f_err "$optfmt" "-N" \ "Show only variable names, not their values." f_err "$optfmt" "-q" \ "Quiet. Disable verbose and hide certain errors." + f_err "$optfmt" "-s name" \ + "Process additional \`rc.conf.d' entries for service name." + f_err "$optfmt" "" \ + "Ignored if \`-f file' is given." f_err "$optfmt" "-R dir" \ "Operate within the root directory \`dir' rather than \`/'." f_err "$optfmt" "-v" \ @@ -245,27 +263,33 @@ unset arg # # Process command-line flags # -while getopts aAcdDef:Fhij:nNqR:vxX flag; do +while getopts aAcdDeEf:Fhij:lLnNqR:s:vxX flag; do case "$flag" in a) SHOW_ALL=${SHOW_ALL:-1} ;; A) SHOW_ALL=2 ;; c) CHECK_ONLY=1 ;; d) DESCRIBE=1 ;; - D) RC_CONFS= ;; + D) DEFAULT=1 RC_CONFS= ;; e) SHOW_EQUALS=1 ;; - f) RC_CONFS="$RC_CONFS${RC_CONFS:+ }$OPTARG" ;; + E) EXISTING_ONLY=1 ;; + f) DEFAULT= RC_CONFS="$RC_CONFS${RC_CONFS:+ }$OPTARG" ;; F) SHOW_FILE=1 ;; h) usage ;; # NOTREACHED i) IGNORE_UNKNOWNS=1 ;; j) [ "$OPTARG" ] || die "%s: Missing or null argument to \`-j' flag" "$pgm" JAIL="$OPTARG" ;; + l) LIST_CONFS=1 ;; + L) LIST_SERVICE_CONFS=1 ;; n) SHOW_NAME= ;; N) SHOW_VALUE= ;; q) QUIET=1 VERBOSE= ;; R) [ "$OPTARG" ] || die "%s: Missing or null argument to \`-R' flag" "$pgm" ROOTDIR="$OPTARG" ;; + s) [ "$OPTARG" ] || + die "%s: Missing or null argument to \`-s' flag" "$pgm" + SERVICE="$OPTARG" ;; v) VERBOSE=1 QUIET= ;; x) DELETE=${DELETE:-1} ;; X) DELETE=2 ;; @@ -275,6 +299,129 @@ done shift $(( $OPTIND - 1 )) # +# Process `-L' flag +# +if [ "$LIST_SERVICE_CONFS" ]; then + list= + + # + # List rc_conf_files if no service names given + # + files= + [ $# -eq 0 ] && files=$( f_sysrc_get rc_conf_files ) + for file in $files; do + if [ "$EXISTING_ONLY" ]; then + [ -e "$file" -a ! -d "$file" ] || continue + fi + case "$list" in + "$file"|*" $file"|"$file "*|*" $file "*) continue ;; + esac + list="$list $file" + done + list="${list# }" + if [ $# -eq 0 ]; then + if [ "$VERBOSE" ]; then + echo rc_conf_files: $list + elif [ "$SHOW_EQUALS" ]; then + echo "rc_conf_files=\"$list\"" + fi + fi + + # + # List rc.conf.d entries + # + retval=$SUCCESS + for service in ${*:-$( service -l )}; do + slist= + f_sysrc_service_configs $service files || retval=$? continue + for file in $files; do + if [ "$EXISTING_ONLY" ]; then + [ -e "$file" -a ! -d "$file" ] || continue + fi + if [ ! "$VERBOSE" -a ! "$SHOW_EQUALS" ]; then + case "$list" in + "$file"|*" $file"|"$file "*|*" $file "*) + continue ;; + esac + fi + slist="$slist $file" + done + slist="${slist# }" + if [ $# -gt 0 ]; then + [ "$slist" ] || retval=$? + fi + if [ "$VERBOSE" ]; then + [ "$slist" ] && echo "$service: $slist" + continue + elif [ "$SHOW_EQUALS" ]; then + [ "$slist" ] && echo "$service=\"$slist\"" + continue + fi + list="$list${slist:+ }$slist" + done + if [ ! "$VERBOSE" -a ! "$SHOW_EQUALS" ]; then + if [ $# -eq 0 -o ! "$QUIET" ]; then + list="${list# }" + [ "$list" ] && echo $list + fi + fi + + exit $retval +fi + +# +# Process `-s name' argument +# +if [ "$SERVICE" -a ! "${RC_CONFS+set}" ]; then + if f_sysrc_service_configs "$SERVICE" RC_CONFS; then + rc_conf_files=$( f_sysrc_get rc_conf_files ) + RC_CONFS="$rc_conf_files${RC_CONFS:+ }$RC_CONFS" + unset rc_conf_files + else + unset RC_CONFS + fi +fi + +# +# Process `-E' option flag +# +if [ "$EXISTING_ONLY" ]; then + # + # To get f_sysrc_*() to ignore missing rc_conf_files, we have to use + # RC_CONFS to override the unpreened value. If RC_CONFS already has a + # value (`-D', `-f file', `-s name', or inherited from parent), use it. + # Otherwise, include filtered contents of rc_conf_files. + # + RC_CONFS=$( + if [ "${RC_CONFS+set}" ]; then + set -- $RC_CONFS + else + set -- $( f_sysrc_get rc_conf_files ) + fi + while [ $# -gt 0 ]; do + [ -f "$1" ] && echo -n " $1" + shift + done + ) + RC_CONFS="${RC_CONFS# }" +fi + +# +# Process `-l' option flag +# +if [ "$LIST_CONFS" ]; then + [ $# -eq 0 ] || usage + if [ "$DEFAULT" ]; then + echo "$RC_DEFAULTS" + elif [ "${RC_CONFS+set}" ]; then + echo "$RC_CONFS" + else + f_sysrc_get rc_conf_files + fi + exit $SUCCESS +fi + +# # [More] Sanity checks (e.g., "sysrc --") # [ $# -eq 0 -a ! "$SHOW_ALL" ] && usage # NOTREACHED @@ -344,6 +491,10 @@ if [ "$JAIL" -o "$ROOTDIR" ]; then $( [ "$SHOW_ALL" = "1" ] && echo \ -a ) $( [ "$SHOW_ALL" = "2" ] && echo \ -A ) ${CHECK_ONLY:+-c} + ${DEFAULT:+-D} + ${EXISTING_ONLY:+-E} + ${LIST_CONFS:+-l} + ${LIST_SERVICE_CONFS:+-L} ${DESCRIBE:+-d} ${SHOW_EQUALS:+-e} ${IGNORE_UNKNOWNS:+-i} @@ -351,6 +502,11 @@ if [ "$JAIL" -o "$ROOTDIR" ]; then $( [ "$SHOW_VALUE" ] || echo \ -N ) $( [ "$SHOW_FILE" ] && echo \ -F ) " + if [ "$SERVICE" ]; then + escape "$SERVICE" _SERVICE + args="$args -s '$_SERVICE'" + unset _SERVICE + fi if [ "${RC_CONFS+set}" ]; then escape "$RC_CONFS" _RC_CONFS args="$args -f '$_RC_CONFS'" @@ -454,9 +610,10 @@ if [ "$SHOW_ALL" ]; then # IFS="$IFS|" EXCEPT="IFS|EXCEPT|PATH|RC_DEFAULTS|OPTIND|DESCRIBE|SEP" - EXCEPT="$EXCEPT|DELETE|SHOW_ALL|SHOW_EQUALS|SHOW_NAME" - EXCEPT="$EXCEPT|SHOW_VALUE|SHOW_FILE|VERBOSE|RC_CONFS" - EXCEPT="$EXCEPT|pgm|SUCCESS|FAILURE|CHECK_ONLY" + EXCEPT="$EXCEPT|DELETE|SHOW_ALL|SHOW_EQUALS|SHOW_NAME|DEFAULT" + EXCEPT="$EXCEPT|SHOW_VALUE|SHOW_FILE|VERBOSE|RC_CONFS|SERVICE" + EXCEPT="$EXCEPT|pgm|SUCCESS|FAILURE|CHECK_ONLY|EXISTING_ONLY" + EXCEPT="$EXCEPT|LIST_CONFS|LIST_SERVICE_CONFS" EXCEPT="$EXCEPT|f_sysrc_desc_awk|f_sysrc_delete_awk" # @@ -479,7 +636,13 @@ if [ "$SHOW_ALL" ]; then # explicit value, modifying the default behavior of # source_rc_confs(). # - [ "${RC_CONFS+set}" ] && rc_conf_files="$RC_CONFS" + if [ "${RC_CONFS+set}" ]; then + [ "$SHOW_ALL" = "1" -a "$SERVICE" -a \ + ! "$DEFAULT" ] || rc_conf_files= + rc_conf_files="$rc_conf_files $RC_CONFS" + rc_conf_files="${rc_conf_files# }" + rc_conf_files="${rc_conf_files% }" + fi source_rc_confs Modified: stable/10/usr.sbin/sysrc/sysrc.8 ============================================================================== --- stable/10/usr.sbin/sysrc/sysrc.8 Mon Dec 28 17:27:20 2015 (r292832) +++ stable/10/usr.sbin/sysrc/sysrc.8 Mon Dec 28 17:50:31 2015 (r292833) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 2, 2015 +.Dd September 12, 2015 .Dt SYSRC 8 .Os .Sh NAME @@ -32,16 +32,27 @@ .Nd safely edit system rc files .Sh SYNOPSIS .Nm -.Op Fl cdDeFhinNqvx +.Op Fl cdDeEFhinNqvx +.Op Fl s Ar name .Op Fl f Ar file .Op Fl j Ar jail | Fl R Ar dir .Ar name Ns Op Ns Oo +|- Oc Ns = Ns Ar value .Ar ... .Nm -.Op Fl cdDeFhinNqvx +.Op Fl cdDeEFhinNqvx +.Op Fl s Ar name .Op Fl f Ar file .Op Fl j Ar jail | Fl R Ar dir .Fl a | A +.Nm +.Op Fl E +.Op Fl s Ar name +.Op Fl f Ar file +.Fl l +.Nm +.Op Fl eEqv +.Fl L +.Op Ar name ... .Sh DESCRIPTION The .Nm @@ -81,6 +92,13 @@ Ignored if either or .Ql Fl F is specified. +.It Fl E +When given +.Sq Fl l +or +.Sq Fl L +to list configuration files, only list those that exist. +When changing a setting, prefer to modify existing files. .It Fl f Ar file Operate on the specified file(s) instead of the files obtained by reading the .Sq rc_conf_files @@ -105,6 +123,17 @@ or name of the .Ar jail to operate within .Pq overrides So Fl R Ar dir Sc ; requires Xr jexec 8 . +.It Fl l +List configuration files used at startup on stdout and exit. +.It Fl L +List all configuration files including rc.conf.d entries on stdout and exit. +Can be combined with +.Sq Fl v +or +.Sq Fl e +to show service names. +.Nm +exits with success if all named services are installed, failure otherwise. .It Fl n Show only variable values, not their names. .It Fl N @@ -112,11 +141,40 @@ Show only variable names, not their valu .It Fl q Quiet. Disable verbose and hide certain errors. +When combined with +.Sq Fl L +and one or more +.Li Ar name +arguments, provide only exit status and no output. .It Fl R Ar dir Operate within the root directory .Sq Ar dir rather than .Sq / . +.It Fl s Ar name +If an +.Li rc.d +script of +.Ar name +exists +.Po +in +.Dq /etc/rc.d +or +.Li local_startup +directories +.Pc , +process its +.Dq rc.conf.d +entries as potential overrides to +.Sq rc_conf_files . +See +.Xr rc.subr 8 +for additional information on +.Dq rc.conf.d . +Can be combined with +.Sq Fl l +to list configuration files used by service at startup. .It Fl v Verbose. Print the pathname of the specific @@ -336,6 +394,10 @@ and .It Pa /etc/defaults/rc.conf .It Pa /etc/rc.conf .It Pa /etc/rc.conf.local +.It Pa /etc/rc.conf.d/name +.It Pa /etc/rc.conf.d/name/* +.It Pa /usr/local/etc/rc.conf.d/name +.It Pa /usr/local/etc/rc.conf.d/name/* .El .Sh EXAMPLES Below are some simple examples of how @@ -397,6 +459,7 @@ cloned_interfaces+"alternate" .Sh SEE ALSO .Xr jls 1 , .Xr rc.conf 5 , +.Xr rc.subr 8 , .Xr jail 8 , .Xr jexec 8 , .Xr rc 8 , From owner-svn-src-stable-10@freebsd.org Mon Dec 28 21:35:07 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3FBCA53174; Mon, 28 Dec 2015 21:35:07 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A40DA1BFE; Mon, 28 Dec 2015 21:35:07 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBSLZ6ZQ053521; Mon, 28 Dec 2015 21:35:06 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSLZ6cC053520; Mon, 28 Dec 2015 21:35:06 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512282135.tBSLZ6cC053520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Mon, 28 Dec 2015 21:35:06 +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: r292841 - stable/10/etc/defaults X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 21:35:07 -0000 Author: jilles Date: Mon Dec 28 21:35:06 2015 New Revision: 292841 URL: https://svnweb.freebsd.org/changeset/base/292841 Log: MFC r290515: periodic: Fix backwards compatibility for daily_status_security_* vars. Most daily_status_security_* variables in periodic.conf were changed to security_status_* in SVN r254974. The compatibility code for the old names did not work. PR: 204331 Submitted by: martin at lispworks.com Modified: stable/10/etc/defaults/periodic.conf Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/defaults/periodic.conf ============================================================================== --- stable/10/etc/defaults/periodic.conf Mon Dec 28 20:24:08 2015 (r292840) +++ stable/10/etc/defaults/periodic.conf Mon Dec 28 21:35:06 2015 (r292841) @@ -319,8 +319,8 @@ if [ -z "${source_periodic_confs_defined "use \$$var instead." >&2 case "$value" in [Yy][Ee][Ss]) - $var=YES - $periodvar=daily + eval $var=YES + eval $periodvar=daily ;; *) eval $var=\"$value\" From owner-svn-src-stable-10@freebsd.org Mon Dec 28 23:05:14 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0F88A54F6E; Mon, 28 Dec 2015 23:05:14 +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 7AAD61239; Mon, 28 Dec 2015 23:05:14 +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 tBSN5DV2080138; Mon, 28 Dec 2015 23:05:13 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSN5DIW080134; Mon, 28 Dec 2015 23:05:13 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512282305.tBSN5DIW080134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 23:05: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: r292844 - in stable/10: etc/mtree lib/libc/tests lib/libc/tests/nss lib/libc/tests/resolv X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 23:05:14 -0000 Author: ngie Date: Mon Dec 28 23:05:13 2015 New Revision: 292844 URL: https://svnweb.freebsd.org/changeset/base/292844 Log: MFC r292317,r292318,r292323,r292324,r292665: r292317: Integrate tools/regression/lib/libc/resolv into the FreeBSD test suite as lib/libc/tests/resolv Convert the testcases to ATF Sponsored by: EMC / Isilon Storage Division r292318: Add Makefile accidentally missed in r292317 Sponsored by: EMC / Isilon Storage Division r292323: Integrate tools/regression/lib/libc/nss into the FreeBSD test suite as lib/libc/tests/nss - Convert the testcases to ATF - Do some style(9) cleanups: -- Sort headers -- Apply indentation fixes -- Remove superfluous parentheses - Explicitly print out debug printfs for use with `kyua {debug,report}`; for items that were overly noisy, they've been put behind #ifdef DEBUG conditionals - Fix some format strings Sponsored by: EMC / Isilon Storage Division r292324: Iterate down lib/libc/tests/nss... Sponsored by: EMC / Isilon Storage Division r292665: Increase the timeout for resolv_test from the default (300 seconds) to 450 seconds This is required on slower network connections, and on older releases (stable/10 seems to be slower as far as name resolution goes.. not sure why yet). Remove an outdated comment in the Makefile from when I was working on this code over a year ago on github Sponsored by: EMC / Isilon Storage Division Added: stable/10/lib/libc/tests/nss/ - copied from r292323, head/lib/libc/tests/nss/ stable/10/lib/libc/tests/resolv/ - copied from r292317, head/lib/libc/tests/resolv/ stable/10/lib/libc/tests/resolv/Makefile - copied, changed from r292318, head/lib/libc/tests/resolv/Makefile Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/lib/libc/tests/Makefile stable/10/lib/libc/tests/resolv/resolv_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Mon Dec 28 22:52:36 2015 (r292843) +++ stable/10/etc/mtree/BSD.tests.dist Mon Dec 28 23:05:13 2015 (r292844) @@ -109,10 +109,14 @@ .. .. .. + nss + .. regex data .. .. + resolv + .. rpc .. ssp Modified: stable/10/lib/libc/tests/Makefile ============================================================================== --- stable/10/lib/libc/tests/Makefile Mon Dec 28 22:52:36 2015 (r292843) +++ stable/10/lib/libc/tests/Makefile Mon Dec 28 23:05:13 2015 (r292844) @@ -12,7 +12,9 @@ TESTS_SUBDIRS+= gen TESTS_SUBDIRS+= hash TESTS_SUBDIRS+= inet TESTS_SUBDIRS+= net +TESTS_SUBDIRS+= nss TESTS_SUBDIRS+= regex +TESTS_SUBDIRS+= resolv TESTS_SUBDIRS+= rpc TESTS_SUBDIRS+= stdio TESTS_SUBDIRS+= stdlib Copied and modified: stable/10/lib/libc/tests/resolv/Makefile (from r292318, head/lib/libc/tests/resolv/Makefile) ============================================================================== --- head/lib/libc/tests/resolv/Makefile Wed Dec 16 05:19:07 2015 (r292318, copy source) +++ stable/10/lib/libc/tests/resolv/Makefile Mon Dec 28 23:05:13 2015 (r292844) @@ -6,10 +6,10 @@ BINDIR= ${TESTSDIR} FILES+= mach ATF_TESTS_C+= resolv_test -#TEST_METADATA.resolv_test= timeout="1800" # Note: this test relies on being dynamically linked. You will get a # spurious PASS for a statically linked test. -LIBADD.resolv_test+= pthread +DPADD.resolv_test+= ${LIBPTHREAD} +LDADD.resolv_test+= -lpthread .include Modified: stable/10/lib/libc/tests/resolv/resolv_test.c ============================================================================== --- head/lib/libc/tests/resolv/resolv_test.c Wed Dec 16 05:11:57 2015 (r292317) +++ stable/10/lib/libc/tests/resolv/resolv_test.c Mon Dec 28 23:05:13 2015 (r292844) @@ -289,21 +289,31 @@ do { \ ATF_REQUIRE(run_tests(_hostlist_file, method) == 0); \ } while(0) -ATF_TC_WITHOUT_HEAD(getaddrinfo_test); +ATF_TC(getaddrinfo_test); +ATF_TC_HEAD(getaddrinfo_test, tc) { + atf_tc_set_md_var(tc, "timeout", "450"); +} ATF_TC_BODY(getaddrinfo_test, tc) { RUN_TESTS(tc, METHOD_GETADDRINFO); } -ATF_TC_WITHOUT_HEAD(gethostby_test); +ATF_TC(gethostby_test); +ATF_TC_HEAD(gethostby_test, tc) { + atf_tc_set_md_var(tc, "timeout", "450"); +} ATF_TC_BODY(gethostby_test, tc) { RUN_TESTS(tc, METHOD_GETHOSTBY); } -ATF_TC_WITHOUT_HEAD(getipnodeby_test); +ATF_TC(getipnodeby_test); +ATF_TC_HEAD(getipnodeby_test, tc) { + + atf_tc_set_md_var(tc, "timeout", "450"); +} ATF_TC_BODY(getipnodeby_test, tc) { From owner-svn-src-stable-10@freebsd.org Mon Dec 28 23:32:29 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14980A547A5; Mon, 28 Dec 2015 23:32:29 +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 C860F15B2; Mon, 28 Dec 2015 23:32:28 +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 tBSNWRJL089335; Mon, 28 Dec 2015 23:32:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBSNWRTq089332; Mon, 28 Dec 2015 23:32:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512282332.tBSNWRTq089332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Dec 2015 23:32:27 +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: r292845 - stable/10/tools/regression/mac/mac_portacl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2015 23:32:29 -0000 Author: ngie Date: Mon Dec 28 23:32:27 2015 New Revision: 292845 URL: https://svnweb.freebsd.org/changeset/base/292845 Log: MFC r292569: Make the mac_portacl testcases work / more robust - A trap(1) call has been added to the test scripts to better ensure that the tests do a better job at trying to restore the test host state at the end of the tests (if the test was interrupted before it would leave the system in an odd state, potentially making the test results for subsequent runs non-deterministic). - Add root user checks - Fix nc(1) usage: -- -o is deprecated -- Using `-w 10` will make the call timeout after 10 seconds so it doesn't block indefinitely - Use local variables - Be more terse in the error messages - Parameterize out "127.0.0.1" Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tools/regression/mac/mac_portacl/misc.sh stable/10/tools/regression/mac/mac_portacl/nobody.t stable/10/tools/regression/mac/mac_portacl/root.t Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/mac/mac_portacl/misc.sh ============================================================================== --- stable/10/tools/regression/mac/mac_portacl/misc.sh Mon Dec 28 23:05:13 2015 (r292844) +++ stable/10/tools/regression/mac/mac_portacl/misc.sh Mon Dec 28 23:32:27 2015 (r292845) @@ -6,10 +6,18 @@ if [ $? -ne 0 ]; then echo "1..0 # SKIP MAC_PORTACL is unavailable." exit 0 fi +if [ $(id -u) -ne 0 ]; then + echo "1..0 # SKIP testcases must be run as root" + exit 0 +fi ntest=1 check_bind() { + local host idtype name proto port udpflag + + host="127.0.0.1" + idtype=${1} name=${2} proto=${3} @@ -17,10 +25,10 @@ check_bind() { [ "${proto}" = "udp" ] && udpflag="-u" - out=`( + out=$( case "${idtype}" in uid|gid) - ( echo -n | su -m ${name} -c "nc ${udpflag} -o -l 127.0.0.1 $port" 2>&1 ) & + ( echo -n | su -m ${name} -c "nc ${udpflag} -l -w 10 $host $port" 2>&1 ) & ;; jail) kill $$ @@ -29,9 +37,9 @@ check_bind() { kill $$ esac sleep 0.3 - echo | nc ${udpflag} -o 127.0.0.1 $port >/dev/null 2>&1 + echo | nc ${udpflag} -w 10 $host $port >/dev/null 2>&1 wait - )` + ) case "${out}" in "nc: Permission denied"*|"nc: Operation not permitted"*) echo fl @@ -46,6 +54,8 @@ check_bind() { } bind_test() { + local expect_without_rule expect_with_rule idtype name proto port + expect_without_rule=${1} expect_with_rule=${2} idtype=${3} @@ -54,40 +64,40 @@ bind_test() { port=${6} sysctl security.mac.portacl.rules= >/dev/null - out=`check_bind ${idtype} ${name} ${proto} ${port}` + out=$(check_bind ${idtype} ${name} ${proto} ${port}) if [ "${out}" = "${expect_without_rule}" ]; then echo "ok ${ntest}" elif [ "${out}" = "ok" -o "${out}" = "fl" ]; then - echo "not ok ${ntest}" + echo "not ok ${ntest} # '${out}' != '${expect_without_rule}'" else - echo "not ok ${ntest} # ${out}" + echo "not ok ${ntest} # unexpected output: '${out}'" fi - ntest=$((ntest+1)) + : $(( ntest += 1 )) if [ "${idtype}" = "uid" ]; then - idstr=`id -u ${name}` + idstr=$(id -u ${name}) elif [ "${idtype}" = "gid" ]; then - idstr=`id -g ${name}` + idstr=$(id -g ${name}) else idstr=${name} fi sysctl security.mac.portacl.rules=${idtype}:${idstr}:${proto}:${port} >/dev/null - out=`check_bind ${idtype} ${name} ${proto} ${port}` + out=$(check_bind ${idtype} ${name} ${proto} ${port}) if [ "${out}" = "${expect_with_rule}" ]; then echo "ok ${ntest}" elif [ "${out}" = "ok" -o "${out}" = "fl" ]; then - echo "not ok ${ntest}" + echo "not ok ${ntest} # '${out}' != '${expect_with_rule}'" else - echo "not ok ${ntest} # ${out}" + echo "not ok ${ntest} # unexpected output: '${out}'" fi - ntest=$((ntest+1)) + : $(( ntest += 1 )) sysctl security.mac.portacl.rules= >/dev/null } -reserved_high=`sysctl -n net.inet.ip.portrange.reservedhigh` -suser_exempt=`sysctl -n security.mac.portacl.suser_exempt` -port_high=`sysctl -n security.mac.portacl.port_high` +reserved_high=$(sysctl -n net.inet.ip.portrange.reservedhigh) +suser_exempt=$(sysctl -n security.mac.portacl.suser_exempt) +port_high=$(sysctl -n security.mac.portacl.port_high) restore_settings() { sysctl -n net.inet.ip.portrange.reservedhigh=${reserved_high} >/dev/null Modified: stable/10/tools/regression/mac/mac_portacl/nobody.t ============================================================================== --- stable/10/tools/regression/mac/mac_portacl/nobody.t Mon Dec 28 23:05:13 2015 (r292844) +++ stable/10/tools/regression/mac/mac_portacl/nobody.t Mon Dec 28 23:32:27 2015 (r292845) @@ -10,6 +10,8 @@ echo "1..64" # behaviour. # mac_portacl has no impact on ports <= net.inet.ip.portrange.reservedhigh. +trap restore_settings EXIT INT TERM + sysctl security.mac.portacl.suser_exempt=1 >/dev/null sysctl net.inet.ip.portrange.reservedhigh=78 >/dev/null @@ -63,5 +65,3 @@ bind_test fl ok gid nobody tcp 77 bind_test ok ok gid nobody tcp 7777 bind_test fl ok gid nobody udp 77 bind_test ok ok gid nobody udp 7777 - -restore_settings Modified: stable/10/tools/regression/mac/mac_portacl/root.t ============================================================================== --- stable/10/tools/regression/mac/mac_portacl/root.t Mon Dec 28 23:05:13 2015 (r292844) +++ stable/10/tools/regression/mac/mac_portacl/root.t Mon Dec 28 23:32:27 2015 (r292845) @@ -8,6 +8,8 @@ echo "1..48" # Verify if security.mac.portacl.suser_exempt=1 really exempts super-user. +trap restore_settings EXIT INT TERM + sysctl security.mac.portacl.suser_exempt=1 >/dev/null bind_test ok ok uid root tcp 77 @@ -47,5 +49,3 @@ bind_test fl ok gid root tcp 77 bind_test fl ok gid root tcp 7777 bind_test fl ok gid root udp 77 bind_test fl ok gid root udp 7777 - -restore_settings From owner-svn-src-stable-10@freebsd.org Tue Dec 29 00:42:36 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54A2CA4B166; Tue, 29 Dec 2015 00:42:36 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25EEF1BE4; Tue, 29 Dec 2015 00:42:36 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBT0gZIE010205; Tue, 29 Dec 2015 00:42:35 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT0gZKd010204; Tue, 29 Dec 2015 00:42:35 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201512290042.tBT0gZKd010204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Tue, 29 Dec 2015 00:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292850 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 00:42:36 -0000 Author: ume Date: Tue Dec 29 00:42:35 2015 New Revision: 292850 URL: https://svnweb.freebsd.org/changeset/base/292850 Log: MFC r292550, r292595: Simplify _map_v4v6_address(). We don't need to use a temporary buffer, here. Modified: stable/10/lib/libc/net/map_v4v6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/map_v4v6.c ============================================================================== --- stable/10/lib/libc/net/map_v4v6.c Tue Dec 29 00:08:32 2015 (r292849) +++ stable/10/lib/libc/net/map_v4v6.c Tue Dec 29 00:42:35 2015 (r292850) @@ -77,19 +77,11 @@ typedef union { void _map_v4v6_address(const char *src, char *dst) { - u_char *p = (u_char *)dst; - char tmp[NS_INADDRSZ]; - int i; - - /* Stash a temporary copy so our caller can update in place. */ - memcpy(tmp, src, NS_INADDRSZ); + /* Our caller may update in place. */ + memmove(&dst[12], src, NS_INADDRSZ); /* Mark this ipv6 addr as a mapped ipv4. */ - for (i = 0; i < 10; i++) - *p++ = 0x00; - *p++ = 0xff; - *p++ = 0xff; - /* Retrieve the saved copy and we're done. */ - memcpy((void*)p, tmp, NS_INADDRSZ); + memset(&dst[10], 0xff, 2); + memset(&dst[0], 0, 10); } void From owner-svn-src-stable-10@freebsd.org Tue Dec 29 01:05:49 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B498CA4B885; Tue, 29 Dec 2015 01:05:49 +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 6B8261733; Tue, 29 Dec 2015 01:05:49 +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 tBT15mKx016397; Tue, 29 Dec 2015 01:05:48 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT15mPk016395; Tue, 29 Dec 2015 01:05:48 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512290105.tBT15mPk016395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 29 Dec 2015 01:05: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: r292852 - in stable/10/contrib/netbsd-tests/lib/libc: gen ssp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 01:05:49 -0000 Author: ngie Date: Tue Dec 29 01:05:48 2015 New Revision: 292852 URL: https://svnweb.freebsd.org/changeset/base/292852 Log: MFC r292578: Don't dump core files with lib/libc/ssp/ssp_test and lib/libc/gen/assert_test The default `sysctl kern.corefile` value is compatible with `kyua test` (FreeBSD will dump to the current directory). If it's set to an absolute path however, `kyua test` will not be able to clean up the corefiles after the fact The corefiles have little value when testing the behavior of feature behavior, so just disable corefile generation Obtained from: Isilon OneFS (^/onefs/head@r511419) Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_assert.c stable/10/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_assert.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/gen/t_assert.c Tue Dec 29 00:43:46 2015 (r292851) +++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_assert.c Tue Dec 29 01:05:48 2015 (r292852) @@ -40,6 +40,23 @@ __RCSID("$NetBSD: t_assert.c,v 1.2 2011/ #include #include +#ifdef __FreeBSD__ +#include +#include +#include + +static void +disable_corefile(void) +{ + struct rlimit limits; + + limits.rlim_cur = 0; + limits.rlim_max = 0; + + ATF_REQUIRE(setrlimit(RLIMIT_CORE, &limits) == 0); +} +#endif + static void handler(int); static void @@ -65,6 +82,9 @@ ATF_TC_BODY(assert_false, tc) if (pid == 0) { +#ifdef __FreeBSD__ + disable_corefile(); +#endif (void)closefrom(0); (void)memset(&sa, 0, sizeof(struct sigaction)); @@ -102,6 +122,9 @@ ATF_TC_BODY(assert_true, tc) if (pid == 0) { +#ifdef __FreeBSD__ + disable_corefile(); +#endif (void)closefrom(0); (void)memset(&sa, 0, sizeof(struct sigaction)); Modified: stable/10/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh Tue Dec 29 00:43:46 2015 (r292851) +++ stable/10/contrib/netbsd-tests/lib/libc/ssp/t_ssp.sh Tue Dec 29 01:05:48 2015 (r292852) @@ -35,6 +35,7 @@ h_fail() { echo "Executing command [ $2$1 ]" # Begin FreeBSD + ulimit -c 0 if true; then eval $2 atf_check -s signal -o ignore -e ignore $1 else From owner-svn-src-stable-10@freebsd.org Tue Dec 29 01:07:01 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD915A4B91B; Tue, 29 Dec 2015 01:07: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 95DA618B0; Tue, 29 Dec 2015 01:07: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 tBT170Ph016502; Tue, 29 Dec 2015 01:07:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT170pi016500; Tue, 29 Dec 2015 01:07:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512290107.tBT170pi016500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 29 Dec 2015 01:07: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: r292853 - stable/10/contrib/netbsd-tests/usr.bin/grep X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 01:07:02 -0000 Author: ngie Date: Tue Dec 29 01:07:00 2015 New Revision: 292853 URL: https://svnweb.freebsd.org/changeset/base/292853 Log: MFC r292581: Use stable output to a test file instead of depending on the OS name being grep'able in /bin/sh This fixes the situation where the OS has been rebranded to something other than `FreeBSD` Obtained from: Isilon OneFS (^/onefs/head@r511419) Reviewed by: cem, Daniel O'Connor Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/netbsd-tests/usr.bin/grep/d_binary.out stable/10/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/usr.bin/grep/d_binary.out ============================================================================== --- stable/10/contrib/netbsd-tests/usr.bin/grep/d_binary.out Tue Dec 29 01:05:48 2015 (r292852) +++ stable/10/contrib/netbsd-tests/usr.bin/grep/d_binary.out Tue Dec 29 01:07:00 2015 (r292853) @@ -1 +1 @@ -Binary file /bin/sh matches +Binary file test.file matches Modified: stable/10/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/10/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue Dec 29 01:05:48 2015 (r292852) +++ stable/10/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue Dec 29 01:07:00 2015 (r292853) @@ -43,7 +43,20 @@ binary_head() } binary_body() { + # Begin FreeBSD + # + # Generate stable output instead of depending on uname to match the + # branded OS name of /bin/sh + if true; then + dd if=/dev/zero count=1 of=test.file + echo -n "foobar" >> test.file + atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep foobar test.file + else + # End FreeBSD atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep $(uname) /bin/sh + # Begin FreeBSD + fi + # End FreeBSD } atf_test_case recurse From owner-svn-src-stable-10@freebsd.org Tue Dec 29 01:08:09 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ADFEA4B999; Tue, 29 Dec 2015 01:08:09 +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 08FBE1A6A; Tue, 29 Dec 2015 01:08: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 tBT188k7016601; Tue, 29 Dec 2015 01:08:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT188n0016600; Tue, 29 Dec 2015 01:08:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512290108.tBT188n0016600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 29 Dec 2015 01:08: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: r292854 - stable/10/tests/sys/file X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 01:08:09 -0000 Author: ngie Date: Tue Dec 29 01:08:07 2015 New Revision: 292854 URL: https://svnweb.freebsd.org/changeset/base/292854 Log: MFC r292582: Dump out the output from flock_helper on failure so failures with the test app can be debugged Obtained from: Isilon OneFS (^/onefs/head@r511419) Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tests/sys/file/flock_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/file/flock_test.sh ============================================================================== --- stable/10/tests/sys/file/flock_test.sh Tue Dec 29 01:07:00 2015 (r292853) +++ stable/10/tests/sys/file/flock_test.sh Tue Dec 29 01:08:07 2015 (r292854) @@ -48,10 +48,11 @@ for n in `seq 1 $last_testcase`; do todomsg=" # TODO: racy testcase (doesn't handle EINTR properly)" fi - $(dirname $0)/flock_helper . $n | grep -q SUCCEED - if [ $? -eq 0 ]; then + output=$($(dirname $0)/flock_helper . $n) + if echo "$output" | grep -q SUCCEED; then echo "ok $n$todomsg" else echo "not ok $n$todomsg" + echo "$output" >&2 fi done From owner-svn-src-stable-10@freebsd.org Tue Dec 29 01:08:59 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 743ECA4BA10; Tue, 29 Dec 2015 01:08: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 43FC91BEA; Tue, 29 Dec 2015 01:08: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 tBT18wXq016690; Tue, 29 Dec 2015 01:08:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBT18w7i016689; Tue, 29 Dec 2015 01:08:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512290108.tBT18w7i016689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 29 Dec 2015 01:08:58 +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: r292855 - stable/10/usr.sbin/uhsoctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 01:08:59 -0000 Author: ngie Date: Tue Dec 29 01:08:58 2015 New Revision: 292855 URL: https://svnweb.freebsd.org/changeset/base/292855 Log: MFC r292585: Prevent use-after-free with ctx->ns in set_nameservers(..), which could occur if the memory wasn't allocated again later on Reported by: Coverity Submitted by: Miles Ohlrich Sponsored by: EMC / Isilon Storage Division Modified: stable/10/usr.sbin/uhsoctl/uhsoctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/uhsoctl/uhsoctl.c ============================================================================== --- stable/10/usr.sbin/uhsoctl/uhsoctl.c Tue Dec 29 01:08:07 2015 (r292854) +++ stable/10/usr.sbin/uhsoctl/uhsoctl.c Tue Dec 29 01:08:58 2015 (r292855) @@ -453,6 +453,7 @@ set_nameservers(struct ctx *ctx, const c free(ctx->ns[i]); } free(ctx->ns); + ctx->ns = NULL; } fd = open(respath, O_RDWR | O_CREAT | O_NOFOLLOW, 0666); From owner-svn-src-stable-10@freebsd.org Tue Dec 29 16:09:16 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3DB9A547CB; Tue, 29 Dec 2015 16:09:16 +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 842EF1D55; Tue, 29 Dec 2015 16:09:16 +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 tBTG9Fqh086790; Tue, 29 Dec 2015 16:09:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTG9Fke086789; Tue, 29 Dec 2015 16:09:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512291609.tBTG9Fke086789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Dec 2015 16:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292874 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 16:09:16 -0000 Author: kib Date: Tue Dec 29 16:09:15 2015 New Revision: 292874 URL: https://svnweb.freebsd.org/changeset/base/292874 Log: MFC r292620: Show the actual error code when interpreter cannot be loaded. Modified: stable/10/sys/kern/imgact_elf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/imgact_elf.c ============================================================================== --- stable/10/sys/kern/imgact_elf.c Tue Dec 29 15:54:34 2015 (r292873) +++ stable/10/sys/kern/imgact_elf.c Tue Dec 29 16:09:15 2015 (r292874) @@ -993,7 +993,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i } vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); if (error != 0) { - uprintf("ELF interpreter %s not found\n", interp); + uprintf("ELF interpreter %s not found, error %d\n", + interp, error); goto ret; } } else From owner-svn-src-stable-10@freebsd.org Tue Dec 29 16:11:45 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38C74A54B08; Tue, 29 Dec 2015 16:11:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3D0F1574; Tue, 29 Dec 2015 16:11:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBTGBidE087660; Tue, 29 Dec 2015 16:11:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTGBisg087659; Tue, 29 Dec 2015 16:11:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201512291611.tBTGBisg087659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Dec 2015 16:11:44 +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: r292875 - stable/10/sys/fs/devfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 16:11:45 -0000 Author: kib Date: Tue Dec 29 16:11:43 2015 New Revision: 292875 URL: https://svnweb.freebsd.org/changeset/base/292875 Log: MFC r292621: Keep devfs mount locked for the whole duration of the devfs_setattr(), and ensure that our dirent is instantiated. Modified: stable/10/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/10/sys/fs/devfs/devfs_vnops.c Tue Dec 29 16:09:15 2015 (r292874) +++ stable/10/sys/fs/devfs/devfs_vnops.c Tue Dec 29 16:11:43 2015 (r292875) @@ -1533,11 +1533,15 @@ devfs_setattr(struct vop_setattr_args *a return (EINVAL); } + error = devfs_populate_vp(vp); + if (error != 0) + return (error); + de = vp->v_data; if (vp->v_type == VDIR) de = de->de_dir; - error = c = 0; + c = 0; if (vap->va_uid == (uid_t)VNOVAL) uid = de->de_uid; else @@ -1550,8 +1554,8 @@ devfs_setattr(struct vop_setattr_args *a if ((ap->a_cred->cr_uid != de->de_uid) || uid != de->de_uid || (gid != de->de_gid && !groupmember(gid, ap->a_cred))) { error = priv_check(td, PRIV_VFS_CHOWN); - if (error) - return (error); + if (error != 0) + goto ret; } de->de_uid = uid; de->de_gid = gid; @@ -1561,8 +1565,8 @@ devfs_setattr(struct vop_setattr_args *a if (vap->va_mode != (mode_t)VNOVAL) { if (ap->a_cred->cr_uid != de->de_uid) { error = priv_check(td, PRIV_VFS_ADMIN); - if (error) - return (error); + if (error != 0) + goto ret; } de->de_mode = vap->va_mode; c = 1; @@ -1571,7 +1575,7 @@ devfs_setattr(struct vop_setattr_args *a if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) { error = vn_utimes_perm(vp, vap, ap->a_cred, td); if (error != 0) - return (error); + goto ret; if (vap->va_atime.tv_sec != VNOVAL) { if (vp->v_type == VCHR) vp->v_rdev->si_atime = vap->va_atime; @@ -1593,7 +1597,10 @@ devfs_setattr(struct vop_setattr_args *a else vfs_timestamp(&de->de_mtime); } - return (0); + +ret: + sx_xunlock(&VFSTODEVFS(vp->v_mount)->dm_lock); + return (error); } #ifdef MAC From owner-svn-src-stable-10@freebsd.org Tue Dec 29 18:22:07 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAEC7A548B6; Tue, 29 Dec 2015 18:22:07 +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 A255C12B6; Tue, 29 Dec 2015 18:22:07 +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 tBTIM6XJ030396; Tue, 29 Dec 2015 18:22:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTIM6dx030394; Tue, 29 Dec 2015 18:22:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512291822.tBTIM6dx030394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 29 Dec 2015 18:22:06 +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: r292879 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 18:22:08 -0000 Author: ngie Date: Tue Dec 29 18:22:06 2015 New Revision: 292879 URL: https://svnweb.freebsd.org/changeset/base/292879 Log: MFC r265842,r266120,r266121,r266959,r267148,r269985,r281789,r282261,r285064: r265842 (by eadler): arcconfig: add one Add a .arcconfig to allow arc to work in its usual way. r266120 (by bapt): Add project name to the arc config it is still required when arcanist is used with SVN r266121 (by bapt): Add the missing coma r266959 (by eadler): arc: add linting for python files r267148 (by bapt): Prevent arc commands from overwriting history r269985 (by gjb): Update the URL to the phabricator instance. Sponsored by: The FreeBSD Foundation r281789 (by eadler): phabricator related changes: - don't lint either contrib or crypto: these are both externally written directories - add additional linters for spelling (check common typos like teh -> the) - chmod linter checks for executible bit on bad files - merge-conflict checks for merge conflict tokens then may have been resolved incorrectly - filename checks for back characters in filenames - json for json syntax correctness - remove history.immutable: it is meaningless on subversion, and causes workflow problems when trying to use git. It it set to 'true' by default with hg r282261 (by eadler): Phabricator: enable "history.immutable": With certain arc workflows leaving history.immutable as false results in using the upstream template instead of our usual commit template. Since the git workflow issues alluded to in my prior commit message can be worked around, set history.immutable once again. r285064 (by mat): Add repository.callsign, to help arcanist figure out what repo it's doing things on when not using Subversion. With hat: phabric-admin@ Sponsored by: Absolight Added: stable/10/.arcconfig - copied, changed from r265842, head/.arcconfig stable/10/.arclint - copied, changed from r266959, head/.arclint Modified: Directory Properties: stable/10/ (props changed) Copied and modified: stable/10/.arcconfig (from r265842, head/.arcconfig) ============================================================================== --- head/.arcconfig Sat May 10 16:59:15 2014 (r265842, copy source) +++ stable/10/.arcconfig Tue Dec 29 18:22:06 2015 (r292879) @@ -1,3 +1,6 @@ { - "phabricator.uri" : "https://phabric.freebsd.org/" + "project.name": "S", + "repository.callsign" : "S", + "phabricator.uri" : "https://reviews.freebsd.org/", + "history.immutable" : true } Copied and modified: stable/10/.arclint (from r266959, head/.arclint) ============================================================================== --- head/.arclint Mon Jun 2 00:21:42 2014 (r266959, copy source) +++ stable/10/.arclint Tue Dec 29 18:22:06 2015 (r292879) @@ -1,9 +1,25 @@ { + "exclude": "(contrib|crypto)", "linters": { "python": { "type": "pep8", - "exclude": "(contrib)", "include": "(\\.py$)" + }, + "spelling": { + "type": "spelling" + }, + "chmod": { + "type": "chmod" + }, + "merge-conflict": { + "type": "merge-conflict" + }, + "filename": { + "type": "filename" + }, + "json": { + "type": "json", + "include": "(\\.arclint|\\.json$)" } } } From owner-svn-src-stable-10@freebsd.org Tue Dec 29 20:36:12 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43A19A54B9D; Tue, 29 Dec 2015 20:36:12 +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 152D310D6; Tue, 29 Dec 2015 20:36:12 +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 tBTKaBEJ069362; Tue, 29 Dec 2015 20:36:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBTKaBPp069361; Tue, 29 Dec 2015 20:36:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201512292036.tBTKaBPp069361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 29 Dec 2015 20:36:11 +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: r292885 - stable/10/usr.sbin/crunch/crunchide X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2015 20:36:12 -0000 Author: emaste Date: Tue Dec 29 20:36:11 2015 New Revision: 292885 URL: https://svnweb.freebsd.org/changeset/base/292885 Log: crunchide: Restore IA-64 support accidentally lost in r292421 mismerge Reported by: ngie Modified: stable/10/usr.sbin/crunch/crunchide/exec_elf32.c Modified: stable/10/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- stable/10/usr.sbin/crunch/crunchide/exec_elf32.c Tue Dec 29 20:17:40 2015 (r292884) +++ stable/10/usr.sbin/crunch/crunchide/exec_elf32.c Tue Dec 29 20:36:11 2015 (r292885) @@ -183,6 +183,7 @@ ELFNAMEEND(check)(int fd, const char *fn #endif case EM_AARCH64: break; case EM_ARM: break; + case EM_IA_64: break; case EM_MIPS: break; case /* EM_MIPS_RS3_LE */ EM_MIPS_RS4_BE: break; case EM_PPC: break; From owner-svn-src-stable-10@freebsd.org Wed Dec 30 00:04:34 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9373A5572C; Wed, 30 Dec 2015 00:04:34 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E4D01F25; Wed, 30 Dec 2015 00:04:34 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU04XDX037383; Wed, 30 Dec 2015 00:04:33 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU04X1t037377; Wed, 30 Dec 2015 00:04:33 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201512300004.tBU04X1t037377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 30 Dec 2015 00:04: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: r292895 - in stable/10/sys: fs/nfs fs/nfsclient kern ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 00:04:35 -0000 Author: mckusick Date: Wed Dec 30 00:04:33 2015 New Revision: 292895 URL: https://svnweb.freebsd.org/changeset/base/292895 Log: MFC of 291244, 291380, 291459, 291460, 291671, and 291743: This MFC includes changes to better manage the vnode freelist and to streamline the allocation and freeing of vnodes. Note that to maintain the KPI the VI_AGE flag is left defined in sys/vnode.h though its use is dropped as described in 291380. To maintain KBI the vfs.vlru_alloc_cache_src sysctl variable remains though it no longer has any effect as described in 291244. MFC of 291244: Move the comment about resident pages preventing vnode from leaving active list, into the header comment for vdrop(), which is the function that decides whether to leave the vnode on the list. Note that dirty page write-out in vinactive() is asynchronous. Discussed with: alc Sponsored by: The FreeBSD Foundation MFC of 291380: Remove VI_AGE vnode iflag, it is unused. Noted by: bde Sponsored by: The FreeBSD Foundation MFC of 291459: For performance reasons, it is useful to have a single string used as the name of a filesystem when setting it as the first parameter to the getnewvnode() function. Most filesystems call getnewvnode from just one place so can use a literal string as the first parameter. However, NFS calls getnewvnode from two places, so we create a global constant string that can be used by the two instances. This change also collapses two instances of getnewvnode() in the UFS filesystem to a single call. Reviewed by: kib Tested by: Peter Holm MFC of 291460: As the kernel allocates and frees vnodes, it fully initializes them on every allocation and fully releases them on every free. These are not trivial costs: it starts by zeroing a large structure then initializes a mutex, a lock manager lock, an rw lock, four lists, and six pointers. And looking at vfs.vnodes_created, these operations are being done millions of times an hour on a busy machine. As a performance optimization, this code update uses the uma_init and uma_fini routines to do these initializations and cleanups only as the vnodes enter and leave the vnode_zone. With this change the initializations are only done kern.maxvnodes times at system startup and then only rarely again. The frees are done only if the vnode_zone shrinks which never happens in practice. For those curious about the avoided work, look at the vnode_init() and vnode_fini() functions in kern/vfs_subr.c to see the code that has been removed from the main vnode allocation/free path. Reviewed by: kib Tested by: Peter Holm MFC of 291671: We need to zero out the union of pointers in a freed vnode structure. Fix from: Mateusz Guzik Tested by: Jason Unovitch MFC of 291743: We need to zero out the clustering variables in a freed vnode structure. For completeness add a VNASSERT that there are no threads waiting on a range lock (this was previously checked on every vnode free). Reported by; Rick Macklem Fix from: Mateusz Guzik Modified: stable/10/sys/fs/nfs/nfsport.h stable/10/sys/fs/nfsclient/nfs_clnode.c stable/10/sys/fs/nfsclient/nfs_clport.c stable/10/sys/kern/vfs_subr.c stable/10/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfsport.h ============================================================================== --- stable/10/sys/fs/nfs/nfsport.h Tue Dec 29 23:25:26 2015 (r292894) +++ stable/10/sys/fs/nfs/nfsport.h Wed Dec 30 00:04:33 2015 (r292895) @@ -981,6 +981,13 @@ struct nfsreq { #define NFSVNO_DELEGOK(v) (1) #endif +/* + * Name used by getnewvnode() to describe filesystem, "newnfs". + * For perfomance reasons it is useful to have the same string + * used in both places that call getnewvnode(). + */ +extern const char nfs_vnode_tag[]; + #endif /* _KERNEL */ #endif /* _NFS_NFSPORT_H */ Modified: stable/10/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clnode.c Tue Dec 29 23:25:26 2015 (r292894) +++ stable/10/sys/fs/nfsclient/nfs_clnode.c Wed Dec 30 00:04:33 2015 (r292895) @@ -66,6 +66,8 @@ MALLOC_DECLARE(M_NEWNFSREQ); uma_zone_t newnfsnode_zone; +const char nfs_vnode_tag[] = "newnfs"; + static void nfs_freesillyrename(void *arg, __unused int pending); void @@ -124,7 +126,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f } np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO); - error = getnewvnode("newnfs", mntp, &newnfs_vnodeops, &nvp); + error = getnewvnode(nfs_vnode_tag, mntp, &newnfs_vnodeops, &nvp); if (error) { uma_zfree(newnfsnode_zone, np); return (error); @@ -332,4 +334,3 @@ ncl_invalcaches(struct vnode *vp) KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); mtx_unlock(&np->n_mtx); } - Modified: stable/10/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clport.c Tue Dec 29 23:25:26 2015 (r292894) +++ stable/10/sys/fs/nfsclient/nfs_clport.c Wed Dec 30 00:04:33 2015 (r292895) @@ -199,7 +199,7 @@ nfscl_nget(struct mount *mntp, struct vn } np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO); - error = getnewvnode("newnfs", mntp, &newnfs_vnodeops, &nvp); + error = getnewvnode(nfs_vnode_tag, mntp, &newnfs_vnodeops, &nvp); if (error) { uma_zfree(newnfsnode_zone, np); FREE((caddr_t)nfhp, M_NFSFH); Modified: stable/10/sys/kern/vfs_subr.c ============================================================================== --- stable/10/sys/kern/vfs_subr.c Tue Dec 29 23:25:26 2015 (r292894) +++ stable/10/sys/kern/vfs_subr.c Wed Dec 30 00:04:33 2015 (r292895) @@ -145,24 +145,51 @@ int vttoif_tab[10] = { static TAILQ_HEAD(freelst, vnode) vnode_free_list; /* - * Free vnode target. Free vnodes may simply be files which have been stat'd - * but not read. This is somewhat common, and a small cache of such files - * should be kept to avoid recreation costs. + * "Free" vnode target. Free vnodes are rarely completely free, but are + * just ones that are cheap to recycle. Usually they are for files which + * have been stat'd but not read; these usually have inode and namecache + * data attached to them. This target is the preferred minimum size of a + * sub-cache consisting mostly of such files. The system balances the size + * of this sub-cache with its complement to try to prevent either from + * thrashing while the other is relatively inactive. The targets express + * a preference for the best balance. + * + * "Above" this target there are 2 further targets (watermarks) related + * to recyling of free vnodes. In the best-operating case, the cache is + * exactly full, the free list has size between vlowat and vhiwat above the + * free target, and recycling from it and normal use maintains this state. + * Sometimes the free list is below vlowat or even empty, but this state + * is even better for immediate use provided the cache is not full. + * Otherwise, vnlru_proc() runs to reclaim enough vnodes (usually non-free + * ones) to reach one of these states. The watermarks are currently hard- + * coded as 4% and 9% of the available space higher. These and the default + * of 25% for wantfreevnodes are too large if the memory size is large. + * E.g., 9% of 75% of MAXVNODES is more than 566000 vnodes to reclaim + * whenever vnlru_proc() becomes active. */ static u_long wantfreevnodes; -SYSCTL_ULONG(_vfs, OID_AUTO, wantfreevnodes, CTLFLAG_RW, &wantfreevnodes, 0, ""); -/* Number of vnodes in the free list. */ +SYSCTL_ULONG(_vfs, OID_AUTO, wantfreevnodes, CTLFLAG_RW, + &wantfreevnodes, 0, "Target for minimum number of \"free\" vnodes"); static u_long freevnodes; -SYSCTL_ULONG(_vfs, OID_AUTO, freevnodes, CTLFLAG_RD, &freevnodes, 0, - "Number of vnodes in the free list"); +SYSCTL_ULONG(_vfs, OID_AUTO, freevnodes, CTLFLAG_RD, + &freevnodes, 0, "Number of \"free\" vnodes"); +/* + * The vfs.vlru_allow_cache_src sysctl variable is no longer used but + * the sysctl remains to provide ABI compatibility. The new code frees + * namecache sources as the last chance to satisfy the highest watermark, + * instead of selecting the source vnodes randomly. This provides good + * enough behaviour to keep vn_fullpath() working in most situations. + * The filesystem layout with deep trees, where the depricated knob was + * required, is thus handled automatically. + */ static int vlru_allow_cache_src; SYSCTL_INT(_vfs, OID_AUTO, vlru_allow_cache_src, CTLFLAG_RW, - &vlru_allow_cache_src, 0, "Allow vlru to reclaim source vnode"); + &vlru_allow_cache_src, 0, "Placeholder for API compatibility (unused)"); static u_long recycles_count; SYSCTL_ULONG(_vfs, OID_AUTO, recycles, CTLFLAG_RD, &recycles_count, 0, - "Number of vnodes recycled to avoid exceding kern.maxvnodes"); + "Number of vnodes recycled to meet vnode cache targets"); /* * Various variables used for debugging the new implementation of @@ -272,14 +299,13 @@ static int syncer_worklist_len; static enum { SYNCER_RUNNING, SYNCER_SHUTTING_DOWN, SYNCER_FINAL_DELAY } syncer_state; -/* - * Number of vnodes we want to exist at any one time. This is mostly used - * to size hash tables in vnode-related code. It is normally not used in - * getnewvnode(), as wantfreevnodes is normally nonzero.) - * - * XXX desiredvnodes is historical cruft and should not exist. - */ +/* Target for maximum number of vnodes. */ int desiredvnodes; +static int gapvnodes; /* gap between wanted and desired */ +static int vhiwat; /* enough extras after expansion */ +static int vlowat; /* minimal extras before expansion */ +static int vstir; /* nonzero to stir non-free vnodes */ +static volatile int vsmalltrigger = 8; /* pref to keep if > this many pages */ static int sysctl_update_desiredvnodes(SYSCTL_HANDLER_ARGS) @@ -290,6 +316,8 @@ sysctl_update_desiredvnodes(SYSCTL_HANDL if ((error = sysctl_handle_int(oidp, arg1, arg2, req)) != 0) return (error); if (old_desiredvnodes != desiredvnodes) { + wantfreevnodes = desiredvnodes / 4; + /* XXX locking seems to be incomplete. */ vfs_hash_changesize(desiredvnodes); cache_changesize(desiredvnodes); } @@ -298,9 +326,9 @@ sysctl_update_desiredvnodes(SYSCTL_HANDL SYSCTL_PROC(_kern, KERN_MAXVNODES, maxvnodes, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, &desiredvnodes, 0, - sysctl_update_desiredvnodes, "I", "Maximum number of vnodes"); + sysctl_update_desiredvnodes, "I", "Target for maximum number of vnodes"); SYSCTL_ULONG(_kern, OID_AUTO, minvnodes, CTLFLAG_RW, - &wantfreevnodes, 0, "Minimum number of vnodes (legacy)"); + &wantfreevnodes, 0, "Old name for vfs.wantfreevnodes (legacy)"); static int vnlru_nowhere; SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW, &vnlru_nowhere, 0, "Number of times the vnlru process ran without success"); @@ -331,11 +359,71 @@ PCTRIE_DEFINE(BUF, buf, b_lblkno, buf_tr * * Reevaluate the following cap on the number of vnodes after the physical * memory size exceeds 512GB. In the limit, as the physical memory size - * grows, the ratio of physical pages to vnodes approaches sixteen to one. + * grows, the ratio of the memory size in KB to to vnodes approaches 64:1. */ #ifndef MAXVNODES_MAX -#define MAXVNODES_MAX (512 * (1024 * 1024 * 1024 / (int)PAGE_SIZE / 16)) +#define MAXVNODES_MAX (512 * 1024 * 1024 / 64) /* 8M */ #endif + +/* + * Initialize a vnode as it first enters the zone. + */ +static int +vnode_init(void *mem, int size, int flags) +{ + struct vnode *vp; + struct bufobj *bo; + + vp = mem; + bzero(vp, size); + /* + * Setup locks. + */ + vp->v_vnlock = &vp->v_lock; + mtx_init(&vp->v_interlock, "vnode interlock", NULL, MTX_DEF); + /* + * By default, don't allow shared locks unless filesystems opt-in. + */ + lockinit(vp->v_vnlock, PVFS, "vnode", VLKTIMEOUT, + LK_NOSHARE | LK_IS_VNODE); + /* + * Initialize bufobj. + */ + bo = &vp->v_bufobj; + bo->__bo_vnode = vp; + rw_init(BO_LOCKPTR(bo), "bufobj interlock"); + bo->bo_private = vp; + TAILQ_INIT(&bo->bo_clean.bv_hd); + TAILQ_INIT(&bo->bo_dirty.bv_hd); + /* + * Initialize namecache. + */ + LIST_INIT(&vp->v_cache_src); + TAILQ_INIT(&vp->v_cache_dst); + /* + * Initialize rangelocks. + */ + rangelock_init(&vp->v_rl); + return (0); +} + +/* + * Free a vnode when it is cleared from the zone. + */ +static void +vnode_fini(void *mem, int size) +{ + struct vnode *vp; + struct bufobj *bo; + + vp = mem; + rangelock_destroy(&vp->v_rl); + lockdestroy(vp->v_vnlock); + mtx_destroy(&vp->v_interlock); + bo = &vp->v_bufobj; + rw_destroy(BO_LOCKPTR(bo)); +} + static void vntblinit(void *dummy __unused) { @@ -345,15 +433,16 @@ vntblinit(void *dummy __unused) /* * Desiredvnodes is a function of the physical memory size and the * kernel's heap size. Generally speaking, it scales with the - * physical memory size. The ratio of desiredvnodes to physical pages - * is one to four until desiredvnodes exceeds 98,304. Thereafter, the - * marginal ratio of desiredvnodes to physical pages is one to - * sixteen. However, desiredvnodes is limited by the kernel's heap + * physical memory size. The ratio of desiredvnodes to the physical + * memory size is 1:16 until desiredvnodes exceeds 98,304. + * Thereafter, the + * marginal ratio of desiredvnodes to the physical memory size is + * 1:64. However, desiredvnodes is limited by the kernel's heap * size. The memory required by desiredvnodes vnodes and vm objects - * may not exceed one seventh of the kernel's heap size. + * must not exceed 1/7th of the kernel's heap size. */ - physvnodes = maxproc + cnt.v_page_count / 16 + 3 * min(98304 * 4, - cnt.v_page_count) / 16; + physvnodes = maxproc + pgtok(cnt.v_page_count) / 64 + + 3 * min(98304 * 16, pgtok(cnt.v_page_count)) / 64; virtvnodes = vm_kmem_size / (7 * (sizeof(struct vm_object) + sizeof(struct vnode))); desiredvnodes = min(physvnodes, virtvnodes); @@ -368,7 +457,7 @@ vntblinit(void *dummy __unused) TAILQ_INIT(&vnode_free_list); mtx_init(&vnode_free_list_mtx, "vnode_free_list", NULL, MTX_DEF); vnode_zone = uma_zcreate("VNODE", sizeof (struct vnode), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, 0); + vnode_init, vnode_fini, UMA_ALIGN_PTR, 0); vnodepoll_zone = uma_zcreate("VNODEPOLL", sizeof (struct vpollinfo), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); /* @@ -742,35 +831,41 @@ vattr_null(struct vattr *vap) * you set kern.maxvnodes to. Do not set kern.maxvnodes too low. */ static int -vlrureclaim(struct mount *mp) +vlrureclaim(struct mount *mp, int reclaim_nc_src, int trigger) { struct vnode *vp; - int done; - int trigger; - int usevnodes; - int count; + int count, done, target; - /* - * Calculate the trigger point, don't allow user - * screwups to blow us up. This prevents us from - * recycling vnodes with lots of resident pages. We - * aren't trying to free memory, we are trying to - * free vnodes. - */ - usevnodes = desiredvnodes; - if (usevnodes <= 0) - usevnodes = 1; - trigger = cnt.v_page_count * 2 / usevnodes; done = 0; vn_start_write(NULL, &mp, V_WAIT); MNT_ILOCK(mp); - count = mp->mnt_nvnodelistsize / 10 + 1; - while (count != 0) { + count = mp->mnt_nvnodelistsize; + target = count * (int64_t)gapvnodes / imax(desiredvnodes, 1); + target = target / 10 + 1; + while (count != 0 && done < target) { vp = TAILQ_FIRST(&mp->mnt_nvnodelist); while (vp != NULL && vp->v_type == VMARKER) vp = TAILQ_NEXT(vp, v_nmntvnodes); if (vp == NULL) break; + /* + * XXX LRU is completely broken for non-free vnodes. First + * by calling here in mountpoint order, then by moving + * unselected vnodes to the end here, and most grossly by + * removing the vlruvp() function that was supposed to + * maintain the order. (This function was born broken + * since syncer problems prevented it doing anything.) The + * order is closer to LRC (C = Created). + * + * LRU reclaiming of vnodes seems to have last worked in + * FreeBSD-3 where LRU wasn't mentioned under any spelling. + * Then there was no hold count, and inactive vnodes were + * simply put on the free list in LRU order. The separate + * lists also break LRU. We prefer to reclaim from the + * free list for technical reasons. This tends to thrash + * the free list to keep very unrecently used held vnodes. + * The problem is mitigated by keeping the free list large. + */ TAILQ_REMOVE(&mp->mnt_nvnodelist, vp, v_nmntvnodes); TAILQ_INSERT_TAIL(&mp->mnt_nvnodelist, vp, v_nmntvnodes); --count; @@ -779,10 +874,12 @@ vlrureclaim(struct mount *mp) /* * If it's been deconstructed already, it's still * referenced, or it exceeds the trigger, skip it. + * Also skip free vnodes. We are trying to make space + * to expand the free list, not reduce it. */ if (vp->v_usecount || - (!vlru_allow_cache_src && - !LIST_EMPTY(&(vp)->v_cache_src)) || + (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src)) || + ((vp->v_iflag & VI_FREE) != 0) || (vp->v_iflag & VI_DOOMED) != 0 || (vp->v_object != NULL && vp->v_object->resident_page_count > trigger)) { VI_UNLOCK(vp); @@ -808,8 +905,8 @@ vlrureclaim(struct mount *mp) * vnode lock before our VOP_LOCK() call fails. */ if (vp->v_usecount || - (!vlru_allow_cache_src && - !LIST_EMPTY(&(vp)->v_cache_src)) || + (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src)) || + (vp->v_iflag & VI_FREE) != 0 || (vp->v_object != NULL && vp->v_object->resident_page_count > trigger)) { VOP_UNLOCK(vp, LK_INTERLOCK); @@ -842,7 +939,7 @@ relock_mnt: } /* - * Attempt to keep the free list at wantfreevnodes length. + * Attempt to reduce the free list by the requested amount. */ static void vnlru_free(int count) @@ -899,6 +996,24 @@ vnlru_free(int count) mtx_lock(&vnode_free_list_mtx); } } + +/* XXX some names and initialization are bad for limits and watermarks. */ +static int +vspace(void) +{ + int space; + + gapvnodes = imax(desiredvnodes - wantfreevnodes, 100); + vhiwat = gapvnodes / 11; /* 9% -- just under the 10% in vlrureclaim() */ + vlowat = vhiwat / 2; + if (numvnodes > desiredvnodes) + return (0); + space = desiredvnodes - numvnodes; + if (freevnodes > wantfreevnodes) + space += freevnodes - wantfreevnodes; + return (space); +} + /* * Attempt to recycle vnodes in a context that is always safe to block. * Calling vlrurecycle() from the bowels of filesystem code has some @@ -911,18 +1026,36 @@ static void vnlru_proc(void) { struct mount *mp, *nmp; - int done; - struct proc *p = vnlruproc; + unsigned long ofreevnodes, onumvnodes; + int done, force, reclaim_nc_src, trigger, usevnodes; - EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, p, + EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc, SHUTDOWN_PRI_FIRST); + force = 0; for (;;) { - kproc_suspend_check(p); + kproc_suspend_check(vnlruproc); mtx_lock(&vnode_free_list_mtx); - if (freevnodes > wantfreevnodes) - vnlru_free(freevnodes - wantfreevnodes); - if (numvnodes <= desiredvnodes * 9 / 10) { + /* + * If numvnodes is too large (due to desiredvnodes being + * adjusted using its sysctl, or emergency growth), first + * try to reduce it by discarding from the free list. + */ + if (numvnodes > desiredvnodes && freevnodes > 0) + vnlru_free(ulmin(numvnodes - desiredvnodes, + freevnodes)); + /* + * Sleep if the vnode cache is in a good state. This is + * when it is not over-full and has space for about a 4% + * or 9% expansion (by growing its size or inexcessively + * reducing its free list). Otherwise, try to reclaim + * space for a 10% expansion. + */ + if (vstir && force == 0) { + force = 1; + vstir = 0; + } + if (vspace() >= vlowat && force == 0) { vnlruproc_sig = 0; wakeup(&vnlruproc_sig); msleep(vnlruproc, &vnode_free_list_mtx, @@ -931,30 +1064,66 @@ vnlru_proc(void) } mtx_unlock(&vnode_free_list_mtx); done = 0; + ofreevnodes = freevnodes; + onumvnodes = numvnodes; + /* + * Calculate parameters for recycling. These are the same + * throughout the loop to give some semblance of fairness. + * The trigger point is to avoid recycling vnodes with lots + * of resident pages. We aren't trying to free memory; we + * are trying to recycle or at least free vnodes. + */ + if (numvnodes <= desiredvnodes) + usevnodes = numvnodes - freevnodes; + else + usevnodes = numvnodes; + if (usevnodes <= 0) + usevnodes = 1; + /* + * The trigger value is is chosen to give a conservatively + * large value to ensure that it alone doesn't prevent + * making progress. The value can easily be so large that + * it is effectively infinite in some congested and + * misconfigured cases, and this is necessary. Normally + * it is about 8 to 100 (pages), which is quite large. + */ + trigger = cnt.v_page_count * 2 / usevnodes; + if (force < 2) + trigger = vsmalltrigger; + reclaim_nc_src = force >= 3; mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { nmp = TAILQ_NEXT(mp, mnt_list); continue; } - done += vlrureclaim(mp); + done += vlrureclaim(mp, reclaim_nc_src, trigger); mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); vfs_unbusy(mp); } mtx_unlock(&mountlist_mtx); + if (onumvnodes > desiredvnodes && numvnodes <= desiredvnodes) + uma_reclaim(); if (done == 0) { -#if 0 - /* These messages are temporary debugging aids */ - if (vnlru_nowhere < 5) - printf("vnlru process getting nowhere..\n"); - else if (vnlru_nowhere == 5) - printf("vnlru process messages stopped.\n"); -#endif + if (force == 0 || force == 1) { + force = 2; + continue; + } + if (force == 2) { + force = 3; + continue; + } + force = 0; vnlru_nowhere++; tsleep(vnlruproc, PPAUSE, "vlrup", hz * 3); } else kern_yield(PRI_USER); + /* + * After becoming active to expand above low water, keep + * active until above high water. + */ + force = vspace() < vhiwat; } } @@ -1028,22 +1197,31 @@ vtryrecycle(struct vnode *vp) return (0); } +static void +vcheckspace(void) +{ + + if (vspace() < vlowat && vnlruproc_sig == 0) { + vnlruproc_sig = 1; + wakeup(vnlruproc); + } +} + /* - * Wait for available vnodes. + * Wait if necessary for space for a new vnode. */ static int getnewvnode_wait(int suspended) { mtx_assert(&vnode_free_list_mtx, MA_OWNED); - if (numvnodes > desiredvnodes) { + if (numvnodes >= desiredvnodes) { if (suspended) { /* - * File system is beeing suspended, we cannot risk a - * deadlock here, so allocate new vnode anyway. + * The file system is being suspended. We cannot + * risk a deadlock here, so allow allocation of + * another vnode even if this would give too many. */ - if (freevnodes > wantfreevnodes) - vnlru_free(freevnodes - wantfreevnodes); return (0); } if (vnlruproc_sig == 0) { @@ -1053,18 +1231,34 @@ getnewvnode_wait(int suspended) msleep(&vnlruproc_sig, &vnode_free_list_mtx, PVFS, "vlruwk", hz); } - return (numvnodes > desiredvnodes ? ENFILE : 0); + /* Post-adjust like the pre-adjust in getnewvnode(). */ + if (numvnodes + 1 > desiredvnodes && freevnodes > 1) + vnlru_free(1); + return (numvnodes >= desiredvnodes ? ENFILE : 0); } +/* + * This hack is fragile, and probably not needed any more now that the + * watermark handling works. + */ void getnewvnode_reserve(u_int count) { struct thread *td; + /* Pre-adjust like the pre-adjust in getnewvnode(), with any count. */ + /* XXX no longer so quick, but this part is not racy. */ + mtx_lock(&vnode_free_list_mtx); + if (numvnodes + count > desiredvnodes && freevnodes > wantfreevnodes) + vnlru_free(ulmin(numvnodes + count - desiredvnodes, + freevnodes - wantfreevnodes)); + mtx_unlock(&vnode_free_list_mtx); + td = curthread; /* First try to be quick and racy. */ if (atomic_fetchadd_long(&numvnodes, count) + count <= desiredvnodes) { td->td_vp_reserv += count; + vcheckspace(); /* XXX no longer so quick, but more racy */ return; } else atomic_subtract_long(&numvnodes, count); @@ -1077,9 +1271,18 @@ getnewvnode_reserve(u_int count) atomic_add_long(&numvnodes, 1); } } + vcheckspace(); mtx_unlock(&vnode_free_list_mtx); } +/* + * This hack is fragile, especially if desiredvnodes or wantvnodes are + * misconfgured or changed significantly. Reducing desiredvnodes below + * the reserved amount should cause bizarre behaviour like reducing it + * below the number of active vnodes -- the system will try to reduce + * numvnodes to match, but should fail, so the subtraction below should + * not overflow. + */ void getnewvnode_drop_reserve(void) { @@ -1098,8 +1301,9 @@ getnewvnode(const char *tag, struct moun struct vnode **vpp) { struct vnode *vp; - struct bufobj *bo; struct thread *td; + struct lock_object *lo; + static int cyclecount; int error; CTR3(KTR_VFS, "%s: mp %p with tag %s", __func__, mp, tag); @@ -1110,57 +1314,77 @@ getnewvnode(const char *tag, struct moun goto alloc; } mtx_lock(&vnode_free_list_mtx); - /* - * Lend our context to reclaim vnodes if they've exceeded the max. - */ - if (freevnodes > wantfreevnodes) + if (numvnodes < desiredvnodes) + cyclecount = 0; + else if (cyclecount++ >= freevnodes) { + cyclecount = 0; + vstir = 1; + } + /* + * Grow the vnode cache if it will not be above its target max + * after growing. Otherwise, if the free list is nonempty, try + * to reclaim 1 item from it before growing the cache (possibly + * above its target max if the reclamation failed or is delayed). + * Otherwise, wait for some space. In all cases, schedule + * vnlru_proc() if we are getting short of space. The watermarks + * should be chosen so that we never wait or even reclaim from + * the free list to below its target minimum. + */ + if (numvnodes + 1 <= desiredvnodes) + ; + else if (freevnodes > 0) vnlru_free(1); - error = getnewvnode_wait(mp != NULL && (mp->mnt_kern_flag & - MNTK_SUSPEND)); + else { + error = getnewvnode_wait(mp != NULL && (mp->mnt_kern_flag & + MNTK_SUSPEND)); #if 0 /* XXX Not all VFS_VGET/ffs_vget callers check returns. */ - if (error != 0) { - mtx_unlock(&vnode_free_list_mtx); - return (error); - } + if (error != 0) { + mtx_unlock(&vnode_free_list_mtx); + return (error); + } #endif + } + vcheckspace(); atomic_add_long(&numvnodes, 1); mtx_unlock(&vnode_free_list_mtx); alloc: atomic_add_long(&vnodes_created, 1); - vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK|M_ZERO); - /* - * Setup locks. - */ - vp->v_vnlock = &vp->v_lock; - mtx_init(&vp->v_interlock, "vnode interlock", NULL, MTX_DEF); - /* - * By default, don't allow shared locks unless filesystems - * opt-in. - */ - lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE | LK_IS_VNODE); + vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK); /* - * Initialize bufobj. + * Locks are given the generic name "vnode" when created. + * Follow the historic practice of using the filesystem + * name when they allocated, e.g., "zfs", "ufs", "nfs, etc. + * + * Locks live in a witness group keyed on their name. Thus, + * when a lock is renamed, it must also move from the witness + * group of its old name to the witness group of its new name. + * + * The change only needs to be made when the vnode moves + * from one filesystem type to another. We ensure that each + * filesystem use a single static name pointer for its tag so + * that we can compare pointers rather than doing a strcmp(). */ - bo = &vp->v_bufobj; - bo->__bo_vnode = vp; - rw_init(BO_LOCKPTR(bo), "bufobj interlock"); - bo->bo_ops = &buf_ops_bio; - bo->bo_private = vp; - TAILQ_INIT(&bo->bo_clean.bv_hd); - TAILQ_INIT(&bo->bo_dirty.bv_hd); + lo = &vp->v_vnlock->lock_object; + if (lo->lo_name != tag) { + lo->lo_name = tag; + WITNESS_DESTROY(lo); + WITNESS_INIT(lo, tag); + } /* - * Initialize namecache. + * By default, don't allow shared locks unless filesystems opt-in. */ - LIST_INIT(&vp->v_cache_src); - TAILQ_INIT(&vp->v_cache_dst); + vp->v_vnlock->lock_object.lo_flags |= LK_NOSHARE; /* * Finalize various vnode identity bits. */ + KASSERT(vp->v_object == NULL, ("stale v_object %p", vp)); + KASSERT(vp->v_lockf == NULL, ("stale v_lockf %p", vp)); + KASSERT(vp->v_pollinfo == NULL, ("stale v_pollinfo %p", vp)); vp->v_type = VNON; vp->v_tag = tag; vp->v_op = vops; v_incr_usecount(vp); - vp->v_data = NULL; + vp->v_bufobj.bo_ops = &buf_ops_bio; #ifdef MAC mac_vnode_init(vp); if (mp != NULL && (mp->mnt_flag & MNT_MULTILABEL) == 0) @@ -1169,11 +1393,10 @@ alloc: printf("NULL mp in getnewvnode()\n"); #endif if (mp != NULL) { - bo->bo_bsize = mp->mnt_stat.f_iosize; + vp->v_bufobj.bo_bsize = mp->mnt_stat.f_iosize; if ((mp->mnt_kern_flag & MNTK_NOKNOTE) != 0) vp->v_vflag |= VV_NOKNOTE; } - rangelock_init(&vp->v_rl); /* * For the filesystems which do not use vfs_hash_insert(), @@ -2399,7 +2622,7 @@ vholdl(struct vnode *vp) mtx_lock(&vnode_free_list_mtx); TAILQ_REMOVE(&vnode_free_list, vp, v_actfreelist); freevnodes--; - vp->v_iflag &= ~(VI_FREE|VI_AGE); + vp->v_iflag &= ~VI_FREE; KASSERT((vp->v_iflag & VI_ACTIVE) == 0, ("Activating already active vnode")); vp->v_iflag |= VI_ACTIVE; @@ -2467,15 +2690,9 @@ vdropl(struct vnode *vp) v_actfreelist); mp->mnt_activevnodelistsize--; } - if (vp->v_iflag & VI_AGE) { - TAILQ_INSERT_HEAD(&vnode_free_list, vp, - v_actfreelist); - } else { - TAILQ_INSERT_TAIL(&vnode_free_list, vp, - v_actfreelist); - } + TAILQ_INSERT_TAIL(&vnode_free_list, vp, + v_actfreelist); freevnodes++; - vp->v_iflag &= ~VI_AGE; vp->v_iflag |= VI_FREE; mtx_unlock(&vnode_free_list_mtx); } else { @@ -2486,6 +2703,12 @@ vdropl(struct vnode *vp) } /* * The vnode has been marked for destruction, so free it. + * + * The vnode will be returned to the zone where it will + * normally remain until it is needed for another vnode. We + * need to cleanup (or verify that the cleanup has already + * been done) any residual data left from its current use + * so as not to contaminate the freshly allocated vnode. */ CTR2(KTR_VFS, "%s: destroying the vnode %p", __func__, vp); atomic_subtract_long(&numvnodes, 1); @@ -2506,20 +2729,25 @@ vdropl(struct vnode *vp) VNASSERT(TAILQ_EMPTY(&vp->v_cache_dst), vp, ("vp has namecache dst")); VNASSERT(LIST_EMPTY(&vp->v_cache_src), vp, ("vp has namecache src")); VNASSERT(vp->v_cache_dd == NULL, vp, ("vp has namecache for ..")); + VNASSERT(TAILQ_EMPTY(&vp->v_rl.rl_waiters), vp, + ("Dangling rangelock waiters")); VI_UNLOCK(vp); #ifdef MAC mac_vnode_destroy(vp); #endif - if (vp->v_pollinfo != NULL) + if (vp->v_pollinfo != NULL) { destroy_vpollinfo(vp->v_pollinfo); + vp->v_pollinfo = NULL; + } #ifdef INVARIANTS /* XXX Elsewhere we detect an already freed vnode via NULL v_op. */ vp->v_op = NULL; #endif - rangelock_destroy(&vp->v_rl); - lockdestroy(vp->v_vnlock); - mtx_destroy(&vp->v_interlock); - rw_destroy(BO_LOCKPTR(bo)); + bzero(&vp->v_un, sizeof(vp->v_un)); + vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0; + vp->v_iflag = 0; + vp->v_vflag = 0; + bo->bo_flag = 0; uma_zfree(vnode_zone, vp); } @@ -2884,6 +3112,7 @@ vgonel(struct vnode *vp) * Clear the advisory locks and wake up waiting threads. */ (void)VOP_ADVLOCKPURGE(vp); + vp->v_lockf = NULL; /* * Delete from old mount point vnode list. */ @@ -2986,8 +3215,6 @@ vn_printf(struct vnode *vp, const char * } if (vp->v_iflag & VI_MOUNT) strlcat(buf, "|VI_MOUNT", sizeof(buf)); - if (vp->v_iflag & VI_AGE) - strlcat(buf, "|VI_AGE", sizeof(buf)); if (vp->v_iflag & VI_DOOMED) strlcat(buf, "|VI_DOOMED", sizeof(buf)); if (vp->v_iflag & VI_FREE) @@ -2998,7 +3225,7 @@ vn_printf(struct vnode *vp, const char * strlcat(buf, "|VI_DOINGINACT", sizeof(buf)); if (vp->v_iflag & VI_OWEINACT) strlcat(buf, "|VI_OWEINACT", sizeof(buf)); - flags = vp->v_iflag & ~(VI_MOUNT | VI_AGE | VI_DOOMED | VI_FREE | + flags = vp->v_iflag & ~(VI_MOUNT | VI_DOOMED | VI_FREE | VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags); Modified: stable/10/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_vfsops.c Tue Dec 29 23:25:26 2015 (r292894) +++ stable/10/sys/ufs/ffs/ffs_vfsops.c Wed Dec 30 00:04:33 2015 (r292895) @@ -1670,10 +1670,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags ip = uma_zalloc(uma_inode, M_WAITOK | M_ZERO); /* Allocate a new vnode/inode. */ - if (fs->fs_magic == FS_UFS1_MAGIC) - error = getnewvnode("ufs", mp, &ffs_vnodeops1, &vp); - else - error = getnewvnode("ufs", mp, &ffs_vnodeops2, &vp); + error = getnewvnode("ufs", mp, fs->fs_magic == FS_UFS1_MAGIC ? + &ffs_vnodeops1 : &ffs_vnodeops2, &vp); if (error) { *vpp = NULL; uma_zfree(uma_inode, ip); From owner-svn-src-stable-10@freebsd.org Wed Dec 30 01:02:23 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C60BEA55C80; Wed, 30 Dec 2015 01:02:23 +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 8E62D1F07; Wed, 30 Dec 2015 01:02:23 +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 tBU12Mj3055787; Wed, 30 Dec 2015 01:02:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU12M1f055786; Wed, 30 Dec 2015 01:02:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201512300102.tBU12M1f055786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 Dec 2015 01:02:22 +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: r292898 - stable/10/gnu/usr.bin/binutils/ld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 01:02:23 -0000 Author: emaste Date: Wed Dec 30 01:02:22 2015 New Revision: 292898 URL: https://svnweb.freebsd.org/changeset/base/292898 Log: MFC r292658: Install ld also as ld.bfd, for use with cc -fuse-ld=bfd Modified: stable/10/gnu/usr.bin/binutils/ld/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/gnu/usr.bin/binutils/ld/Makefile ============================================================================== --- stable/10/gnu/usr.bin/binutils/ld/Makefile Wed Dec 30 00:17:37 2015 (r292897) +++ stable/10/gnu/usr.bin/binutils/ld/Makefile Wed Dec 30 01:02:22 2015 (r292898) @@ -52,6 +52,7 @@ CLEANFILES+= ldemul-list.h stringify.sed FILES= ${LDSCRIPTS:S|^|ldscripts/|} FILESDIR= ${SCRIPTDIR} +LINKS= ${BINDIR}/ld ${BINDIR}/ld.bfd HOST= ${TARGET_TUPLE} LIBSEARCHPATH= \"=/lib\":\"=/usr/lib\" From owner-svn-src-stable-10@freebsd.org Wed Dec 30 08:15:45 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 698E1A55B36; Wed, 30 Dec 2015 08:15:45 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8FD119C; Wed, 30 Dec 2015 08:15:45 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBU8Fifq082370; Wed, 30 Dec 2015 08:15:44 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU8Fins082368; Wed, 30 Dec 2015 08:15:44 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201512300815.tBU8Fins082368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Wed, 30 Dec 2015 08:15:44 +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: r292906 - in stable/10/sys/dev: virtio/balloon xen/balloon X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 08:15:45 -0000 Author: royger Date: Wed Dec 30 08:15:43 2015 New Revision: 292906 URL: https://svnweb.freebsd.org/changeset/base/292906 Log: MFC r267858: xen/virtio: fix balloon drivers to not mark pages as WIRED In the Xen case make sure pages are zeroed before giving them back to the hypervisor, or else we might be leaking data. Also remove the balloon_{append/retrieve} and link pages directly into the ballooned_pages queue using the plinks.q field in the page struct. Sponsored by: Citrix Systems R&D Requested by: bapt Modified: stable/10/sys/dev/virtio/balloon/virtio_balloon.c stable/10/sys/dev/xen/balloon/balloon.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/balloon/virtio_balloon.c ============================================================================== --- stable/10/sys/dev/virtio/balloon/virtio_balloon.c Wed Dec 30 08:02:11 2015 (r292905) +++ stable/10/sys/dev/virtio/balloon/virtio_balloon.c Wed Dec 30 08:15:43 2015 (r292906) @@ -438,8 +438,7 @@ vtballoon_alloc_page(struct vtballoon_so { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED | - VM_ALLOC_NOOBJ); + m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); if (m != NULL) sc->vtballoon_current_npages++; @@ -450,7 +449,6 @@ static void vtballoon_free_page(struct vtballoon_softc *sc, vm_page_t m) { - vm_page_unwire(m, 0); vm_page_free(m); sc->vtballoon_current_npages--; } Modified: stable/10/sys/dev/xen/balloon/balloon.c ============================================================================== --- stable/10/sys/dev/xen/balloon/balloon.c Wed Dec 30 08:02:11 2015 (r292905) +++ stable/10/sys/dev/xen/balloon/balloon.c Wed Dec 30 08:15:43 2015 (r292906) @@ -94,13 +94,8 @@ SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, SYSCTL_ULONG(_dev_xen_balloon, OID_AUTO, high_mem, CTLFLAG_RD, &bs.balloon_high, 0, "High-mem balloon"); -struct balloon_entry { - vm_page_t page; - STAILQ_ENTRY(balloon_entry) list; -}; - /* List of ballooned pages, threaded through the mem_map array. */ -static STAILQ_HEAD(,balloon_entry) ballooned_pages; +static TAILQ_HEAD(,vm_page) ballooned_pages; /* Main work function, always executed in process context. */ static void balloon_process(void *unused); @@ -110,47 +105,6 @@ static void balloon_process(void *unused #define WPRINTK(fmt, args...) \ printk(KERN_WARNING "xen_mem: " fmt, ##args) -/* balloon_append: add the given page to the balloon. */ -static int -balloon_append(vm_page_t page) -{ - struct balloon_entry *entry; - - mtx_assert(&balloon_mutex, MA_OWNED); - - entry = malloc(sizeof(struct balloon_entry), M_BALLOON, M_NOWAIT); - if (!entry) - return (ENOMEM); - entry->page = page; - STAILQ_INSERT_HEAD(&ballooned_pages, entry, list); - bs.balloon_low++; - - return (0); -} - -/* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ -static vm_page_t -balloon_retrieve(void) -{ - vm_page_t page; - struct balloon_entry *entry; - - mtx_assert(&balloon_mutex, MA_OWNED); - - if (STAILQ_EMPTY(&ballooned_pages)) - return (NULL); - - entry = STAILQ_FIRST(&ballooned_pages); - STAILQ_REMOVE_HEAD(&ballooned_pages, list); - - page = entry->page; - free(entry, M_BALLOON); - - bs.balloon_low--; - - return (page); -} - static unsigned long current_target(void) { @@ -203,7 +157,6 @@ static int increase_reservation(unsigned long nr_pages) { unsigned long pfn, i; - struct balloon_entry *entry; vm_page_t page; long rc; struct xen_memory_reservation reservation = { @@ -217,10 +170,9 @@ increase_reservation(unsigned long nr_pa if (nr_pages > nitems(frame_list)) nr_pages = nitems(frame_list); - for (entry = STAILQ_FIRST(&ballooned_pages), i = 0; - i < nr_pages; i++, entry = STAILQ_NEXT(entry, list)) { - KASSERT(entry, ("ballooned_pages list corrupt")); - page = entry->page; + for (page = TAILQ_FIRST(&ballooned_pages), i = 0; + i < nr_pages; i++, page = TAILQ_NEXT(page, plinks.q)) { + KASSERT(page != NULL, ("ballooned_pages list corrupt")); frame_list[i] = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); } @@ -245,8 +197,10 @@ increase_reservation(unsigned long nr_pa } for (i = 0; i < nr_pages; i++) { - page = balloon_retrieve(); - KASSERT(page, ("balloon_retrieve failed")); + page = TAILQ_FIRST(&ballooned_pages); + KASSERT(page != NULL, ("Unable to get ballooned page")); + TAILQ_REMOVE(&ballooned_pages, page, plinks.q); + bs.balloon_low--; pfn = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); KASSERT((xen_feature(XENFEAT_auto_translated_physmap) || @@ -255,7 +209,6 @@ increase_reservation(unsigned long nr_pa set_phys_to_machine(pfn, frame_list[i]); - vm_page_unwire(page, 0); vm_page_free(page); } @@ -286,24 +239,29 @@ decrease_reservation(unsigned long nr_pa for (i = 0; i < nr_pages; i++) { if ((page = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { + VM_ALLOC_ZERO)) == NULL) { nr_pages = i; need_sleep = 1; break; } + if ((page->flags & PG_ZERO) == 0) { + /* + * Zero the page, or else we might be leaking + * important data to other domains on the same + * host. Xen doesn't scrub ballooned out memory + * pages, the guest is in charge of making + * sure that no information is leaked. + */ + pmap_zero_page(page); + } + pfn = (VM_PAGE_TO_PHYS(page) >> PAGE_SHIFT); frame_list[i] = PFNTOMFN(pfn); set_phys_to_machine(pfn, INVALID_P2M_ENTRY); - if (balloon_append(page) != 0) { - vm_page_unwire(page, 0); - vm_page_free(page); - - nr_pages = i; - need_sleep = 1; - break; - } + TAILQ_INSERT_HEAD(&ballooned_pages, page, plinks.q); + bs.balloon_low++; } set_xen_guest_handle(reservation.extent_start, frame_list); @@ -438,7 +396,8 @@ balloon_init(void *arg) /* Initialise the balloon with excess memory space. */ for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) { page = PHYS_TO_VM_PAGE(pfn << PAGE_SHIFT); - balloon_append(page); + TAILQ_INSERT_HEAD(&ballooned_pages, page, plinks.q); + bs.balloon_low++; } #undef max_pfn #endif From owner-svn-src-stable-10@freebsd.org Wed Dec 30 08:52:05 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3220A5594E; Wed, 30 Dec 2015 08:52:05 +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 6DBC612A5; Wed, 30 Dec 2015 08:52:05 +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 tBU8q4bZ095375; Wed, 30 Dec 2015 08:52:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU8q4Y5095369; Wed, 30 Dec 2015 08:52:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512300852.tBU8q4Y5095369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 30 Dec 2015 08:52: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: r292907 - in stable/10/sys: dev/pci ofed/include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 08:52:05 -0000 Author: ngie Date: Wed Dec 30 08:52:03 2015 New Revision: 292907 URL: https://svnweb.freebsd.org/changeset/base/292907 Log: MFC r270212,r270332: This helps reduce the diff in pci(4) between head and stable/10 to help pave the way for bringing in IOV/nv(9) more cleanly Differential Revision: https://reviews.freebsd.org/D4728 Relnotes: yes Reviewed by: hselasky (ofed piece), royger (overall change) Sponsored by: EMC / Isilon Storage Division r270212 (by royger): pci: make MSI(-X) enable and disable methods of the PCI bus Make the functions pci_disable_msi, pci_enable_msi and pci_enable_msix methods of the newbus PCI bus. This code should not include any functional change. Sponsored by: Citrix Systems R&D Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D354 dev/pci/pci.c: - Convert the mentioned functions to newbus methods. - Fix the callers of the converted functions. sys/dev/pci/pci_private.h: dev/pci/pci_if.m: - Declare the new methods. dev/pci/pcivar.h: - Add helpers to call the newbus methods. ofed/include/linux/pci.h: - Add define to prevent the ofed version of pci_enable_msix from clashing with the FreeBSD native version. r270332 (by royger): pci: add a new pci_child_added newbus method. This is needed so when running under Xen the calls to pci_child_added can be intercepted and a custom Xen method can be used to register those devices with Xen. This should not include any functional change, since the Xen implementation will be added in a following patch and the native implementation is a noop. Sponsored by: Citrix Systems R&D Reviewed by: jhb dev/pci/pci.c: dev/pci/pci_if.m: dev/pci/pci_private.h: dev/pci/pcivar.h: - Add the pci_child_added newbus method. Modified: stable/10/sys/dev/pci/pci.c stable/10/sys/dev/pci/pci_if.m stable/10/sys/dev/pci/pci_private.h stable/10/sys/dev/pci/pcivar.h stable/10/sys/ofed/include/linux/pci.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/pci/pci.c ============================================================================== --- stable/10/sys/dev/pci/pci.c Wed Dec 30 08:15:43 2015 (r292906) +++ stable/10/sys/dev/pci/pci.c Wed Dec 30 08:52:03 2015 (r292907) @@ -110,11 +110,6 @@ static int pci_write_vpd_reg(device_t p int reg, uint32_t data); #endif static void pci_read_vpd(device_t pcib, pcicfgregs *cfg); -static void pci_disable_msi(device_t dev); -static void pci_enable_msi(device_t dev, uint64_t address, - uint16_t data); -static void pci_enable_msix(device_t dev, u_int index, - uint64_t address, uint32_t data); static void pci_mask_msix(device_t dev, u_int index); static void pci_unmask_msix(device_t dev, u_int index); static int pci_msi_blacklisted(void); @@ -180,11 +175,15 @@ static device_method_t pci_methods[] = { DEVMETHOD(pci_find_htcap, pci_find_htcap_method), DEVMETHOD(pci_alloc_msi, pci_alloc_msi_method), DEVMETHOD(pci_alloc_msix, pci_alloc_msix_method), + DEVMETHOD(pci_enable_msi, pci_enable_msi_method), + DEVMETHOD(pci_enable_msix, pci_enable_msix_method), + DEVMETHOD(pci_disable_msi, pci_disable_msi_method), DEVMETHOD(pci_remap_msix, pci_remap_msix_method), DEVMETHOD(pci_release_msi, pci_release_msi_method), DEVMETHOD(pci_msi_count, pci_msi_count_method), DEVMETHOD(pci_msix_count, pci_msix_count_method), DEVMETHOD(pci_get_rid, pci_get_rid_method), + DEVMETHOD(pci_child_added, pci_child_added_method), DEVMETHOD_END }; @@ -1374,9 +1373,10 @@ pci_find_extcap_method(device_t dev, dev * Support for MSI-X message interrupts. */ void -pci_enable_msix(device_t dev, u_int index, uint64_t address, uint32_t data) +pci_enable_msix_method(device_t dev, device_t child, u_int index, + uint64_t address, uint32_t data) { - struct pci_devinfo *dinfo = device_get_ivars(dev); + struct pci_devinfo *dinfo = device_get_ivars(child); struct pcicfg_msix *msix = &dinfo->cfg.msix; uint32_t offset; @@ -1387,7 +1387,7 @@ pci_enable_msix(device_t dev, u_int inde bus_write_4(msix->msix_table_res, offset + 8, data); /* Enable MSI -> HT mapping. */ - pci_ht_map_msi(dev, address); + pci_ht_map_msi(child, address); } void @@ -1956,45 +1956,46 @@ pcie_adjust_config(device_t dev, int reg * Support for MSI message signalled interrupts. */ void -pci_enable_msi(device_t dev, uint64_t address, uint16_t data) +pci_enable_msi_method(device_t dev, device_t child, uint64_t address, + uint16_t data) { - struct pci_devinfo *dinfo = device_get_ivars(dev); + struct pci_devinfo *dinfo = device_get_ivars(child); struct pcicfg_msi *msi = &dinfo->cfg.msi; /* Write data and address values. */ - pci_write_config(dev, msi->msi_location + PCIR_MSI_ADDR, + pci_write_config(child, msi->msi_location + PCIR_MSI_ADDR, address & 0xffffffff, 4); if (msi->msi_ctrl & PCIM_MSICTRL_64BIT) { - pci_write_config(dev, msi->msi_location + PCIR_MSI_ADDR_HIGH, + pci_write_config(child, msi->msi_location + PCIR_MSI_ADDR_HIGH, address >> 32, 4); - pci_write_config(dev, msi->msi_location + PCIR_MSI_DATA_64BIT, + pci_write_config(child, msi->msi_location + PCIR_MSI_DATA_64BIT, data, 2); } else - pci_write_config(dev, msi->msi_location + PCIR_MSI_DATA, data, + pci_write_config(child, msi->msi_location + PCIR_MSI_DATA, data, 2); /* Enable MSI in the control register. */ msi->msi_ctrl |= PCIM_MSICTRL_MSI_ENABLE; - pci_write_config(dev, msi->msi_location + PCIR_MSI_CTRL, msi->msi_ctrl, - 2); + pci_write_config(child, msi->msi_location + PCIR_MSI_CTRL, + msi->msi_ctrl, 2); /* Enable MSI -> HT mapping. */ - pci_ht_map_msi(dev, address); + pci_ht_map_msi(child, address); } void -pci_disable_msi(device_t dev) +pci_disable_msi_method(device_t dev, device_t child) { - struct pci_devinfo *dinfo = device_get_ivars(dev); + struct pci_devinfo *dinfo = device_get_ivars(child); struct pcicfg_msi *msi = &dinfo->cfg.msi; /* Disable MSI -> HT mapping. */ - pci_ht_map_msi(dev, 0); + pci_ht_map_msi(child, 0); /* Disable MSI in the control register. */ msi->msi_ctrl &= ~PCIM_MSICTRL_MSI_ENABLE; - pci_write_config(dev, msi->msi_location + PCIR_MSI_CTRL, msi->msi_ctrl, - 2); + pci_write_config(child, msi->msi_location + PCIR_MSI_CTRL, + msi->msi_ctrl, 2); } /* @@ -3604,6 +3605,13 @@ pci_add_child(device_t bus, struct pci_d pci_cfg_restore(dinfo->cfg.dev, dinfo); pci_print_verbose(dinfo); pci_add_resources(bus, dinfo->cfg.dev, 0, 0); + pci_child_added(dinfo->cfg.dev); +} + +void +pci_child_added_method(device_t dev, device_t child) +{ + } static int Modified: stable/10/sys/dev/pci/pci_if.m ============================================================================== --- stable/10/sys/dev/pci/pci_if.m Wed Dec 30 08:15:43 2015 (r292906) +++ stable/10/sys/dev/pci/pci_if.m Wed Dec 30 08:52:03 2015 (r292907) @@ -138,6 +138,26 @@ METHOD int alloc_msix { int *count; }; +METHOD void enable_msi { + device_t dev; + device_t child; + uint64_t address; + uint16_t data; +}; + +METHOD void enable_msix { + device_t dev; + device_t child; + u_int index; + uint64_t address; + uint32_t data; +}; + +METHOD void disable_msi { + device_t dev; + device_t child; +}; + METHOD int remap_msix { device_t dev; device_t child; @@ -165,3 +185,7 @@ METHOD uint16_t get_rid { device_t child; }; +METHOD void child_added { + device_t dev; + device_t child; +}; Modified: stable/10/sys/dev/pci/pci_private.h ============================================================================== --- stable/10/sys/dev/pci/pci_private.h Wed Dec 30 08:15:43 2015 (r292906) +++ stable/10/sys/dev/pci/pci_private.h Wed Dec 30 08:52:03 2015 (r292907) @@ -90,6 +90,11 @@ int pci_find_htcap_method(device_t dev, int capability, int *capreg); int pci_alloc_msi_method(device_t dev, device_t child, int *count); int pci_alloc_msix_method(device_t dev, device_t child, int *count); +void pci_enable_msi_method(device_t dev, device_t child, + uint64_t address, uint16_t data); +void pci_enable_msix_method(device_t dev, device_t child, + u_int index, uint64_t address, uint32_t data); +void pci_disable_msi_method(device_t dev, device_t child); int pci_remap_msix_method(device_t dev, device_t child, int count, const u_int *vectors); int pci_release_msi_method(device_t dev, device_t child); @@ -120,6 +125,7 @@ int pci_assign_interrupt_method(device_ int pci_resume(device_t dev); int pci_suspend(device_t dev); bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev); +void pci_child_added_method(device_t dev, device_t child); /** Restore the config register state. The state must be previously * saved with pci_cfg_save. However, the pci bus driver takes care of Modified: stable/10/sys/dev/pci/pcivar.h ============================================================================== --- stable/10/sys/dev/pci/pcivar.h Wed Dec 30 08:15:43 2015 (r292906) +++ stable/10/sys/dev/pci/pcivar.h Wed Dec 30 08:52:03 2015 (r292907) @@ -458,6 +458,24 @@ pci_alloc_msix(device_t dev, int *count) return (PCI_ALLOC_MSIX(device_get_parent(dev), dev, count)); } +static __inline void +pci_enable_msi(device_t dev, uint64_t address, uint16_t data) +{ + PCI_ENABLE_MSI(device_get_parent(dev), dev, address, data); +} + +static __inline void +pci_enable_msix(device_t dev, u_int index, uint64_t address, uint32_t data) +{ + PCI_ENABLE_MSIX(device_get_parent(dev), dev, index, address, data); +} + +static __inline void +pci_disable_msi(device_t dev) +{ + PCI_DISABLE_MSI(device_get_parent(dev), dev); +} + static __inline int pci_remap_msix(device_t dev, int count, const u_int *vectors) { @@ -488,6 +506,13 @@ pci_get_rid(device_t dev) return (PCI_GET_RID(device_get_parent(dev), dev)); } +static __inline void +pci_child_added(device_t dev) +{ + + return (PCI_CHILD_ADDED(device_get_parent(dev), dev)); +} + device_t pci_find_bsf(uint8_t, uint8_t, uint8_t); device_t pci_find_dbsf(uint32_t, uint8_t, uint8_t, uint8_t); device_t pci_find_device(uint16_t, uint16_t); Modified: stable/10/sys/ofed/include/linux/pci.h ============================================================================== --- stable/10/sys/ofed/include/linux/pci.h Wed Dec 30 08:15:43 2015 (r292906) +++ stable/10/sys/ofed/include/linux/pci.h Wed Dec 30 08:52:03 2015 (r292907) @@ -566,7 +566,11 @@ struct msix_entry { /* * Enable msix, positive errors indicate actual number of available * vectors. Negative errors are failures. + * + * NB: define added to prevent this definition of pci_enable_msix from + * clashing with the native FreeBSD version. */ +#define pci_enable_msix linux_pci_enable_msix static inline int pci_enable_msix(struct pci_dev *pdev, struct msix_entry *entries, int nreq) { From owner-svn-src-stable-10@freebsd.org Wed Dec 30 08:53:13 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F3BFA55AA1; Wed, 30 Dec 2015 08:53:13 +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 41AB71488; Wed, 30 Dec 2015 08:53:13 +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 tBU8rCg5095455; Wed, 30 Dec 2015 08:53:12 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBU8rCww095454; Wed, 30 Dec 2015 08:53:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512300853.tBU8rCww095454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 30 Dec 2015 08:53:12 +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: r292908 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 08:53:13 -0000 Author: ngie Date: Wed Dec 30 08:53:12 2015 New Revision: 292908 URL: https://svnweb.freebsd.org/changeset/base/292908 Log: Bump __FreeBSD_version per pci(4) changes made in r292907 Sponsored by: EMC / Isilon Storage Division Modified: stable/10/sys/sys/param.h Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Wed Dec 30 08:52:03 2015 (r292907) +++ stable/10/sys/sys/param.h Wed Dec 30 08:53:12 2015 (r292908) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1002504 /* Master, propagated to newvers */ +#define __FreeBSD_version 1002505 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:47:35 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5ACC3A5527F; Wed, 30 Dec 2015 11:47:35 +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 10BF91A01; Wed, 30 Dec 2015 11:47:34 +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 tBUBlYbx047981; Wed, 30 Dec 2015 11:47:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBlYR4047980; Wed, 30 Dec 2015 11:47:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301147.tBUBlYR4047980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:47: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: r292916 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:47:35 -0000 Author: mav Date: Wed Dec 30 11:47:33 2015 New Revision: 292916 URL: https://svnweb.freebsd.org/changeset/base/292916 Log: MFC r292610: Fix speed setting by NVRAM for 24xx and above chips. 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 Dec 30 11:46:15 2015 (r292915) +++ stable/10/sys/dev/isp/isp.c Wed Dec 30 11:47:33 2015 (r292916) @@ -2142,19 +2142,41 @@ isp_fibre_init_2400(ispsoftc_t *isp) if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) == 0) { icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24; } - icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_AUTO; if (isp->isp_confopts & ISP_CFG_1GB) { + icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_1GB; } else if (isp->isp_confopts & ISP_CFG_2GB) { + icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_2GB; } else if (isp->isp_confopts & ISP_CFG_4GB) { + icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_4GB; } else if (isp->isp_confopts & ISP_CFG_8GB) { + icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_8GB; } else if (isp->isp_confopts & ISP_CFG_16GB) { + icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_16GB; } else { - icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_AUTO; + switch (icbp->icb_fwoptions3 & ICB2400_OPT3_RATE_MASK) { + case ICB2400_OPT3_RATE_4GB: + case ICB2400_OPT3_RATE_8GB: + case ICB2400_OPT3_RATE_16GB: + case ICB2400_OPT3_RATE_AUTO: + break; + case ICB2400_OPT3_RATE_2GB: + if (isp->isp_type <= ISP_HA_FC_2500) + break; + /*FALLTHROUGH*/ + case ICB2400_OPT3_RATE_1GB: + if (isp->isp_type <= ISP_HA_FC_2400) + break; + /*FALLTHROUGH*/ + default: + icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_MASK; + icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_AUTO; + break; + } } icbp->icb_logintime = ICB_LOGIN_TOV; @@ -7632,6 +7654,7 @@ isp_setdfltfcparm(ispsoftc_t *isp, int c fcp->isp_fwoptions |= ICB2400_OPT1_FULL_DUPLEX; } fcp->isp_fwoptions |= ICB2400_OPT1_BOTH_WWNS; + fcp->isp_zfwoptions |= ICB2400_OPT3_RATE_AUTO; } else { fcp->isp_fwoptions |= ICBOPT_FAIRNESS; fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE; @@ -7644,6 +7667,7 @@ isp_setdfltfcparm(ispsoftc_t *isp, int c * extended options from NVRAM */ fcp->isp_fwoptions &= ~ICBOPT_EXTENDED; + fcp->isp_zfwoptions |= ICBZOPT_RATE_AUTO; } From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:48:19 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35A1EA55351; Wed, 30 Dec 2015 11:48:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 085811C06; Wed, 30 Dec 2015 11:48:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUBmI5u048118; Wed, 30 Dec 2015 11:48:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBmHIp048114; Wed, 30 Dec 2015 11:48:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301148.tBUBmHIp048114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:48: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: r292918 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:48:19 -0000 Author: mav Date: Wed Dec 30 11:48:17 2015 New Revision: 292918 URL: https://svnweb.freebsd.org/changeset/base/292918 Log: MFC r292690: Some polishing for command timeouts handling. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/ispmbox.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Wed Dec 30 11:48:06 2015 (r292917) +++ stable/10/sys/dev/isp/isp.c Wed Dec 30 11:48:17 2015 (r292918) @@ -2446,7 +2446,8 @@ isp_plogx(ispsoftc_t *isp, int chan, uin scp = fcp->isp_scratch; isp_put_plogx(isp, plp, (isp_plogx_t *) scp); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 500000); + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, + MBCMD_DEFAULT_TIMEOUT + ICB_LOGIN_TOV * 1000000); mbs.param[1] = QENTRY_LEN; mbs.param[2] = DMA_WD1(fcp->isp_scdma); mbs.param[3] = DMA_WD0(fcp->isp_scdma); @@ -3390,7 +3391,7 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, pt->ctp_nphdl = fcp->isp_sns_hdl; pt->ctp_cmd_cnt = 1; pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan); - pt->ctp_time = 30; + pt->ctp_time = 10; pt->ctp_rsp_cnt = 1; pt->ctp_rsp_bcnt = GIDLEN; pt->ctp_cmd_bcnt = sizeof (*ct) + sizeof (uint32_t); @@ -3426,7 +3427,8 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, sizeof (*ct) + sizeof (uint32_t), &scp[XTXOFF]); } ISP_MEMZERO(&scp[ZTXOFF], QENTRY_LEN); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 500000); + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, + MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000); mbs.param[1] = QENTRY_LEN; mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF); mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF); @@ -3861,7 +3863,7 @@ isp_register_fc4_type_24xx(ispsoftc_t *i pt->ctp_nphdl = fcp->isp_sns_hdl; pt->ctp_cmd_cnt = 1; pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan); - pt->ctp_time = 1; + pt->ctp_time = 4; pt->ctp_rsp_cnt = 1; pt->ctp_rsp_bcnt = sizeof (ct_hdr_t); pt->ctp_cmd_bcnt = sizeof (rft_id_t); @@ -3900,7 +3902,8 @@ isp_register_fc4_type_24xx(ispsoftc_t *i ISP_MEMZERO(&scp[ZTXOFF], sizeof (ct_hdr_t)); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 1000000); + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, + MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000); mbs.param[1] = QENTRY_LEN; mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF); mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF); @@ -3972,7 +3975,7 @@ isp_register_fc4_features_24xx(ispsoftc_ pt->ctp_nphdl = fcp->isp_sns_hdl; pt->ctp_cmd_cnt = 1; pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan); - pt->ctp_time = 1; + pt->ctp_time = 4; pt->ctp_rsp_cnt = 1; pt->ctp_rsp_bcnt = sizeof (ct_hdr_t); pt->ctp_cmd_bcnt = sizeof (rff_id_t); @@ -4016,7 +4019,8 @@ isp_register_fc4_features_24xx(ispsoftc_ ISP_MEMZERO(&scp[ZTXOFF], sizeof (ct_hdr_t)); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 1000000); + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, + MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000); mbs.param[1] = QENTRY_LEN; mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF); mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF); @@ -4403,10 +4407,7 @@ isp_start(XS_T *xs) } ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen); - *tptr = XS_TIME(xs) / 1000; - if (*tptr == 0 && XS_TIME(xs)) { - *tptr = 1; - } + *tptr = (XS_TIME(xs) + 999) / 1000; if (IS_24XX(isp) && *tptr > 0x1999) { *tptr = 0x1999; } @@ -4512,13 +4513,14 @@ isp_control(ispsoftc_t *isp, ispctl_t ct tmf->tmf_header.rqs_entry_count = 1; tmf->tmf_nphdl = lp->handle; tmf->tmf_delay = 2; - tmf->tmf_timeout = 2; + tmf->tmf_timeout = 4; tmf->tmf_flags = ISP24XX_TMF_TARGET_RESET; tmf->tmf_tidlo = lp->portid; tmf->tmf_tidhi = lp->portid >> 16; tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan); isp_prt(isp, ISP_LOGALL, "Chan %d Reset N-Port Handle 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 5000000); + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, + MBCMD_DEFAULT_TIMEOUT + tmf->tmf_timeout * 1000000); mbs.param[1] = QENTRY_LEN; mbs.param[2] = DMA_WD1(fcp->isp_scdma); mbs.param[3] = DMA_WD0(fcp->isp_scdma); @@ -6901,7 +6903,7 @@ static const uint32_t mbpfc[] = { ISP_FC_OPMAP(0x01, 0x07), /* 0x1f: MBOX_GET_FIRMWARE_STATUS */ ISP_FC_OPMAP_HALF(0x2, 0x01, 0x7e, 0xcf), /* 0x20: MBOX_GET_LOOP_ID */ ISP_FC_OPMAP(0x00, 0x00), /* 0x21: */ - ISP_FC_OPMAP(0x01, 0x07), /* 0x22: MBOX_GET_RETRY_COUNT */ + ISP_FC_OPMAP(0x03, 0x4b), /* 0x22: MBOX_GET_TIMEOUT_PARAMS */ ISP_FC_OPMAP(0x00, 0x00), /* 0x23: */ ISP_FC_OPMAP(0x00, 0x00), /* 0x24: */ ISP_FC_OPMAP(0x00, 0x00), /* 0x25: */ @@ -6917,7 +6919,7 @@ static const uint32_t mbpfc[] = { ISP_FC_OPMAP(0x00, 0x00), /* 0x2f: */ ISP_FC_OPMAP(0x00, 0x00), /* 0x30: */ ISP_FC_OPMAP(0x00, 0x00), /* 0x31: */ - ISP_FC_OPMAP(0x07, 0x07), /* 0x32: MBOX_SET_RETRY_COUNT */ + ISP_FC_OPMAP(0x4b, 0x4b), /* 0x32: MBOX_SET_TIMEOUT_PARAMS */ ISP_FC_OPMAP(0x00, 0x00), /* 0x33: */ ISP_FC_OPMAP(0x00, 0x00), /* 0x34: */ ISP_FC_OPMAP(0x00, 0x00), /* 0x35: */ Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Wed Dec 30 11:48:06 2015 (r292917) +++ stable/10/sys/dev/isp/isp_freebsd.c Wed Dec 30 11:48:17 2015 (r292918) @@ -632,7 +632,7 @@ ispioctl(struct cdev *dev, u_long c, cad tmf->tmf_header.rqs_entry_count = 1; tmf->tmf_nphdl = lp->handle; tmf->tmf_delay = 2; - tmf->tmf_timeout = 2; + tmf->tmf_timeout = 4; tmf->tmf_tidlo = lp->portid; tmf->tmf_tidhi = lp->portid >> 16; tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan); @@ -668,7 +668,8 @@ ispioctl(struct cdev *dev, u_long c, cad ISP_UNLOCK(isp); break; } - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 5000000); + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, + MBCMD_DEFAULT_TIMEOUT + tmf->tmf_timeout * 1000000); mbs.param[1] = QENTRY_LEN; mbs.param[2] = DMA_WD1(fcp->isp_scdma); mbs.param[3] = DMA_WD0(fcp->isp_scdma); @@ -1403,7 +1404,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u cto->ct_iid_hi = atp->portid >> 16; cto->ct_oxid = atp->oxid; cto->ct_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(ccb)); - cto->ct_timeout = 120; + cto->ct_timeout = (XS_TIME(ccb) + 999) / 1000; cto->ct_flags = atp->tattr << CT7_TASK_ATTR_SHIFT; /* @@ -1555,7 +1556,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u cto->ct_lun = ccb->ccb_h.target_lun; } } - cto->ct_timeout = 10; + cto->ct_timeout = (XS_TIME(ccb) + 999) / 1000; cto->ct_rxid = cso->tag_id; /* Modified: stable/10/sys/dev/isp/ispmbox.h ============================================================================== --- stable/10/sys/dev/isp/ispmbox.h Wed Dec 30 11:48:06 2015 (r292917) +++ stable/10/sys/dev/isp/ispmbox.h Wed Dec 30 11:48:17 2015 (r292918) @@ -1086,7 +1086,7 @@ typedef struct { #define ICB_DFLT_RDELAY 5 #define ICB_DFLT_RCOUNT 3 -#define ICB_LOGIN_TOV 30 +#define ICB_LOGIN_TOV 10 #define ICB_LUN_ENABLE_TOV 15 From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:49:06 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFC51A553E5; Wed, 30 Dec 2015 11:49: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 AE48D1E8F; Wed, 30 Dec 2015 11:49: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 tBUBn405048201; Wed, 30 Dec 2015 11:49:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBn4I7048198; Wed, 30 Dec 2015 11:49:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301149.tBUBn4I7048198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:49: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: r292919 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:49:06 -0000 Author: mav Date: Wed Dec 30 11:49:04 2015 New Revision: 292919 URL: https://svnweb.freebsd.org/changeset/base/292919 Log: MFC r292715: Clear virtual port's port database when disabling it. Previously it was done only on full chip reinit, that caused old ports resurrect in case of virtual port reenabling. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_library.c stable/10/sys/dev/isp/isp_library.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Wed Dec 30 11:48:17 2015 (r292918) +++ stable/10/sys/dev/isp/isp.c Wed Dec 30 11:49:04 2015 (r292919) @@ -2344,6 +2344,159 @@ isp_fibre_init_2400(ispsoftc_t *isp) isp->isp_state = ISP_RUNSTATE; } +static int +isp_fc_enable_vp(ispsoftc_t *isp, int chan) +{ + fcparam *fcp = FCPARAM(isp, chan); + mbreg_t mbs; + vp_modify_t *vp; + uint8_t qe[QENTRY_LEN], *scp; + + ISP_MEMZERO(qe, QENTRY_LEN); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + return (EBUSY); + } + scp = fcp->isp_scratch; + + /* Build a VP MODIFY command in memory */ + vp = (vp_modify_t *) qe; + vp->vp_mod_hdr.rqs_entry_type = RQSTYPE_VP_MODIFY; + vp->vp_mod_hdr.rqs_entry_count = 1; + vp->vp_mod_cnt = 1; + vp->vp_mod_idx0 = chan; + vp->vp_mod_cmd = VP_MODIFY_ENA; + vp->vp_mod_ports[0].options = ICB2400_VPOPT_ENABLED | + ICB2400_VPOPT_ENA_SNSLOGIN; + if (fcp->role & ISP_ROLE_INITIATOR) { + vp->vp_mod_ports[0].options |= ICB2400_VPOPT_INI_ENABLE; + } + if ((fcp->role & ISP_ROLE_TARGET) == 0) { + vp->vp_mod_ports[0].options |= ICB2400_VPOPT_TGT_DISABLE; + } + if (fcp->isp_loopid < LOCAL_LOOP_LIM) { + 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); + isp_put_vp_modify(isp, vp, (vp_modify_t *) scp); + + /* Build a EXEC IOCB A64 command that points to the VP MODIFY command */ + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0); + mbs.param[1] = QENTRY_LEN; + 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, 2 * QENTRY_LEN, chan); + isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); + if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + FC_SCRATCH_RELEASE(isp, chan); + return (EIO); + } + MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); + isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp); + + FC_SCRATCH_RELEASE(isp, chan); + + if (vp->vp_mod_status != VP_STS_OK) { + isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status); + return (EIO); + } + return (0); +} + +static int +isp_fc_disable_vp(ispsoftc_t *isp, int chan) +{ + fcparam *fcp = FCPARAM(isp, chan); + mbreg_t mbs; + vp_ctrl_info_t *vp; + uint8_t qe[QENTRY_LEN], *scp; + + ISP_MEMZERO(qe, QENTRY_LEN); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + return (EBUSY); + } + scp = fcp->isp_scratch; + + /* Build a VP CTRL command in memory */ + vp = (vp_ctrl_info_t *) qe; + vp->vp_ctrl_hdr.rqs_entry_type = RQSTYPE_VP_CTRL; + vp->vp_ctrl_hdr.rqs_entry_count = 1; + if (ISP_CAP_VP0(isp)) { + vp->vp_ctrl_status = 1; + } else { + vp->vp_ctrl_status = 0; + chan--; /* VP0 can not be controlled in this case. */ + } + vp->vp_ctrl_command = VP_CTRL_CMD_DISABLE_VP_LOGO_ALL; + vp->vp_ctrl_vp_count = 1; + vp->vp_ctrl_idmap[chan / 16] |= (1 << chan % 16); + isp_put_vp_ctrl_info(isp, vp, (vp_ctrl_info_t *) scp); + + /* Build a EXEC IOCB A64 command that points to the VP CTRL command */ + MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0); + mbs.param[1] = QENTRY_LEN; + 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, 2 * QENTRY_LEN, chan); + isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); + if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + FC_SCRATCH_RELEASE(isp, chan); + return (EIO); + } + MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); + isp_get_vp_ctrl_info(isp, (vp_ctrl_info_t *)&scp[QENTRY_LEN], vp); + + FC_SCRATCH_RELEASE(isp, chan); + + if (vp->vp_ctrl_status != 0) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_CTRL of Chan %d failed with status %d %d", + __func__, chan, vp->vp_ctrl_status, vp->vp_ctrl_index_fail); + return (EIO); + } + return (0); +} + +static int +isp_fc_change_role(ispsoftc_t *isp, int chan, int new_role) +{ + fcparam *fcp = FCPARAM(isp, chan); + int i, was, res = 0; + + if (chan >= isp->isp_nchan) { + isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan); + return (ENXIO); + } + if (fcp->role == new_role) + return (0); + for (was = 0, i = 0; i < isp->isp_nchan; i++) { + if (FCPARAM(isp, i)->role != ISP_ROLE_NONE) + was++; + } + if (was == 0 || (was == 1 && fcp->role != ISP_ROLE_NONE)) { + fcp->role = new_role; + return (isp_reinit(isp, 0)); + } + if (fcp->role != ISP_ROLE_NONE) { + res = isp_fc_disable_vp(isp, chan); + isp_clear_portdb(isp, chan); + } + fcp->role = new_role; + if (fcp->role != ISP_ROLE_NONE) + res = isp_fc_enable_vp(isp, chan); + return (res); +} + static void isp_clear_portdb(ispsoftc_t *isp, int chan) { Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Wed Dec 30 11:48:17 2015 (r292918) +++ stable/10/sys/dev/isp/isp_library.c Wed Dec 30 11:49:04 2015 (r292919) @@ -573,168 +573,6 @@ isp_fc_toponame(fcparam *fcp) } } -static int -isp_fc_enable_vp(ispsoftc_t *isp, int chan) -{ - fcparam *fcp = FCPARAM(isp, chan); - mbreg_t mbs; - vp_modify_t *vp; - uint8_t qe[QENTRY_LEN], *scp; - - ISP_MEMZERO(qe, QENTRY_LEN); - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - return (EBUSY); - } - scp = fcp->isp_scratch; - - /* - * Build a VP MODIFY command in memory - */ - vp = (vp_modify_t *) qe; - vp->vp_mod_hdr.rqs_entry_type = RQSTYPE_VP_MODIFY; - vp->vp_mod_hdr.rqs_entry_count = 1; - vp->vp_mod_cnt = 1; - vp->vp_mod_idx0 = chan; - vp->vp_mod_cmd = VP_MODIFY_ENA; - vp->vp_mod_ports[0].options = ICB2400_VPOPT_ENABLED | - ICB2400_VPOPT_ENA_SNSLOGIN; - if (fcp->role & ISP_ROLE_INITIATOR) { - vp->vp_mod_ports[0].options |= ICB2400_VPOPT_INI_ENABLE; - } - if ((fcp->role & ISP_ROLE_TARGET) == 0) { - vp->vp_mod_ports[0].options |= ICB2400_VPOPT_TGT_DISABLE; - } - if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - 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); - isp_put_vp_modify(isp, vp, (vp_modify_t *) scp); - - /* - * Build a EXEC IOCB A64 command that points to the VP MODIFY command - */ - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0); - mbs.param[1] = QENTRY_LEN; - 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, 2 * QENTRY_LEN, chan); - isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - FC_SCRATCH_RELEASE(isp, chan); - return (EIO); - } - MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); - isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp); - - FC_SCRATCH_RELEASE(isp, chan); - - if (vp->vp_mod_status != VP_STS_OK) { - isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status); - return (EIO); - } - return (0); -} - -static int -isp_fc_disable_vp(ispsoftc_t *isp, int chan) -{ - fcparam *fcp = FCPARAM(isp, chan); - mbreg_t mbs; - vp_ctrl_info_t *vp; - uint8_t qe[QENTRY_LEN], *scp; - - ISP_MEMZERO(qe, QENTRY_LEN); - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - return (EBUSY); - } - scp = fcp->isp_scratch; - - /* - * Build a VP CTRL command in memory - */ - vp = (vp_ctrl_info_t *) qe; - vp->vp_ctrl_hdr.rqs_entry_type = RQSTYPE_VP_CTRL; - vp->vp_ctrl_hdr.rqs_entry_count = 1; - if (ISP_CAP_VP0(isp)) { - vp->vp_ctrl_status = 1; - } else { - vp->vp_ctrl_status = 0; - chan--; /* VP0 can not be controlled in this case. */ - } - vp->vp_ctrl_command = VP_CTRL_CMD_DISABLE_VP_LOGO_ALL; - vp->vp_ctrl_vp_count = 1; - vp->vp_ctrl_idmap[chan / 16] |= (1 << chan % 16); - isp_put_vp_ctrl_info(isp, vp, (vp_ctrl_info_t *) scp); - - /* - * Build a EXEC IOCB A64 command that points to the VP CTRL command - */ - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0); - mbs.param[1] = QENTRY_LEN; - 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, 2 * QENTRY_LEN, chan); - isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - FC_SCRATCH_RELEASE(isp, chan); - return (EIO); - } - MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); - isp_get_vp_ctrl_info(isp, (vp_ctrl_info_t *)&scp[QENTRY_LEN], vp); - - FC_SCRATCH_RELEASE(isp, chan); - - if (vp->vp_ctrl_status != 0) { - isp_prt(isp, ISP_LOGERR, - "%s: VP_CTRL of Chan %d failed with status %d %d", - __func__, chan, vp->vp_ctrl_status, vp->vp_ctrl_index_fail); - return (EIO); - } - return (0); -} - -/* - * Change Roles - */ -int -isp_fc_change_role(ispsoftc_t *isp, int chan, int new_role) -{ - fcparam *fcp = FCPARAM(isp, chan); - int i, was, res = 0; - - if (chan >= isp->isp_nchan) { - isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan); - return (ENXIO); - } - if (fcp->role == new_role) - return (0); - for (was = 0, i = 0; i < isp->isp_nchan; i++) { - if (FCPARAM(isp, i)->role != ISP_ROLE_NONE) - was++; - } - if (was == 0 || (was == 1 && fcp->role != ISP_ROLE_NONE)) { - fcp->role = new_role; - return (isp_reinit(isp, 0)); - } - if (fcp->role != ISP_ROLE_NONE) - res = isp_fc_disable_vp(isp, chan); - fcp->role = new_role; - if (fcp->role != ISP_ROLE_NONE) - res = isp_fc_enable_vp(isp, chan); - return (res); -} - void isp_clear_commands(ispsoftc_t *isp) { Modified: stable/10/sys/dev/isp/isp_library.h ============================================================================== --- stable/10/sys/dev/isp/isp_library.h Wed Dec 30 11:48:17 2015 (r292918) +++ stable/10/sys/dev/isp/isp_library.h Wed Dec 30 11:49:04 2015 (r292919) @@ -72,9 +72,6 @@ const char *isp_fc_fw_statename(int); const char *isp_fc_loop_statename(int); const char *isp_fc_toponame(fcparam *); -int isp_fc_change_role(ispsoftc_t *, int, int); - - /* * Cleanup */ From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:49:50 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 874D3A55476; Wed, 30 Dec 2015 11:49:50 +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 4AE831FE6; Wed, 30 Dec 2015 11:49:50 +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 tBUBnnqw048345; Wed, 30 Dec 2015 11:49:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBnmDc048338; Wed, 30 Dec 2015 11:49:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301149.tBUBnmDc048338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:49: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: r292921 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:49:50 -0000 Author: mav Date: Wed Dec 30 11:49:48 2015 New Revision: 292921 URL: https://svnweb.freebsd.org/changeset/base/292921 Log: MFC r292725: Unify handles allocation for initiator and target IOCBs. I am not sure why this was split long ago, but I see no reason for it. At this point this unification just slightly reduces memory usage, but as next step I plan to reuse shared handle space for other IOCB types. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_library.c stable/10/sys/dev/isp/isp_library.h stable/10/sys/dev/isp/isp_pci.c stable/10/sys/dev/isp/isp_target.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Wed Dec 30 11:49:41 2015 (r292920) +++ stable/10/sys/dev/isp/isp.c Wed Dec 30 11:49:48 2015 (r292921) @@ -4269,7 +4269,7 @@ int isp_start(XS_T *xs) { ispsoftc_t *isp; - uint32_t handle, cdblen; + uint32_t cdblen; uint8_t local[QENTRY_LEN]; ispreq_t *reqp; void *cdbp, *qep; @@ -4565,13 +4565,13 @@ isp_start(XS_T *xs) *tptr = 0x1999; } - if (isp_allocate_xs(isp, xs, &handle)) { + /* Whew. Thankfully the same for type 7 requests */ + reqp->req_handle = isp_allocate_handle(isp, xs, ISP_HANDLE_INITIATOR); + if (reqp->req_handle == 0) { isp_prt(isp, ISP_LOG_WARN1, "out of xflist pointers"); XS_SETERR(xs, HBA_BOTCH); return (CMD_EAGAIN); } - /* Whew. Thankfully the same for type 7 requests */ - reqp->req_handle = handle; /* * Set up DMA and/or do any platform dependent swizzling of the request entry @@ -4581,7 +4581,7 @@ isp_start(XS_T *xs) */ dmaresult = ISP_DMASETUP(isp, xs, reqp); if (dmaresult != CMD_QUEUED) { - isp_destroy_handle(isp, handle); + isp_destroy_handle(isp, reqp->req_handle); /* * dmasetup sets actual error in packet, and * return what we were given to return. @@ -5310,12 +5310,6 @@ again: } } - if (!ISP_VALID_HANDLE(isp, sp->req_handle)) { - isp_prt(isp, ISP_LOGERR, "bad request handle 0x%x (iocb type 0x%x)", sp->req_handle, etype); - ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - continue; - } xs = isp_find_xs(isp, sp->req_handle); if (xs == NULL) { uint8_t ts = completion_status & 0xff; Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Wed Dec 30 11:49:41 2015 (r292920) +++ stable/10/sys/dev/isp/isp_freebsd.c Wed Dec 30 11:49:48 2015 (r292921) @@ -1694,7 +1694,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); break; } - if (isp_allocate_xs_tgt(isp, ccb, &handle)) { + handle = isp_allocate_handle(isp, ccb, ISP_HANDLE_TARGET); + if (handle == 0) { ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "No XFLIST pointers for %s\n", __func__); TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); isp_free_pcmd(isp, ccb); @@ -1723,7 +1724,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u dmaresult = ISP_DMASETUP(isp, cso, (ispreq_t *) local); if (dmaresult != CMD_QUEUED) { - isp_destroy_tgt_handle(isp, handle); + isp_destroy_handle(isp, handle); isp_free_pcmd(isp, ccb); if (dmaresult == CMD_EAGAIN) { TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); @@ -2380,12 +2381,12 @@ isp_handle_platform_ctio(ispsoftc_t *isp uint32_t handle, moved_data = 0, data_requested; handle = ((ct2_entry_t *)arg)->ct_syshandle; - ccb = isp_find_xs_tgt(isp, handle); + ccb = isp_find_xs(isp, handle); if (ccb == NULL) { isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, arg); return; } - isp_destroy_tgt_handle(isp, handle); + isp_destroy_handle(isp, handle); data_requested = PISP_PCMD(ccb)->datalen; isp_free_pcmd(isp, ccb); if (isp->isp_nactive) { @@ -3321,7 +3322,7 @@ isp_loop_dead(ispsoftc_t *isp, int chan) for (i = 0; i < isp->isp_maxcmds; i++) { struct ccb_scsiio *xs; - if (!ISP_VALID_HANDLE(isp, isp->isp_xflist[i].handle)) { + if (ISP_H2HT(isp->isp_xflist[i].handle) != ISP_HANDLE_INITIATOR) { continue; } if ((xs = isp->isp_xflist[i].cmd) == NULL) { Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Wed Dec 30 11:49:41 2015 (r292920) +++ stable/10/sys/dev/isp/isp_library.c Wed Dec 30 11:49:48 2015 (r292921) @@ -247,28 +247,26 @@ copy_and_sync: return (CMD_QUEUED); } -int -isp_allocate_xs(ispsoftc_t *isp, XS_T *xs, uint32_t *handlep) +uint32_t +isp_allocate_handle(ispsoftc_t *isp, void *xs, int type) { isp_hdl_t *hdp; hdp = isp->isp_xffree; - if (hdp == NULL) { - return (-1); - } + if (hdp == NULL) + return (ISP_HANDLE_FREE); isp->isp_xffree = hdp->cmd; hdp->cmd = xs; hdp->handle = (hdp - isp->isp_xflist); - hdp->handle |= (ISP_HANDLE_INITIATOR << ISP_HANDLE_USAGE_SHIFT); + hdp->handle |= (type << ISP_HANDLE_USAGE_SHIFT); hdp->handle |= (isp->isp_seqno++ << ISP_HANDLE_SEQ_SHIFT); - *handlep = hdp->handle; - return (0); + return (hdp->handle); } -XS_T * +void * isp_find_xs(ispsoftc_t *isp, uint32_t handle) { - if (!ISP_VALID_INI_HANDLE(isp, handle)) { + if (!ISP_VALID_HANDLE(isp, handle)) { isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); return (NULL); } @@ -276,7 +274,7 @@ isp_find_xs(ispsoftc_t *isp, uint32_t ha } uint32_t -isp_find_handle(ispsoftc_t *isp, XS_T *xs) +isp_find_handle(ispsoftc_t *isp, void *xs) { uint32_t i, foundhdl = ISP_HANDLE_FREE; @@ -292,21 +290,10 @@ isp_find_handle(ispsoftc_t *isp, XS_T *x return (foundhdl); } -uint32_t -isp_handle_index(ispsoftc_t *isp, uint32_t handle) -{ - if (!ISP_VALID_HANDLE(isp, handle)) { - isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); - return (ISP_BAD_HANDLE_INDEX); - } else { - return (handle & ISP_HANDLE_CMD_MASK); - } -} - void isp_destroy_handle(ispsoftc_t *isp, uint32_t handle) { - if (!ISP_VALID_INI_HANDLE(isp, handle)) { + if (!ISP_VALID_HANDLE(isp, handle)) { isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); } else { isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)].handle = ISP_HANDLE_FREE; @@ -583,46 +570,41 @@ isp_clear_commands(ispsoftc_t *isp) #endif for (tmp = 0; isp->isp_xflist && tmp < isp->isp_maxcmds; tmp++) { - XS_T *xs; hdp = &isp->isp_xflist[tmp]; - if (hdp->handle == ISP_HANDLE_FREE) { - continue; - } - xs = hdp->cmd; - if (XS_XFRLEN(xs)) { - ISP_DMAFREE(isp, xs, hdp->handle); - XS_SET_RESID(xs, XS_XFRLEN(xs)); - } else { - XS_SET_RESID(xs, 0); - } - hdp->handle = 0; - hdp->cmd = NULL; - XS_SETERR(xs, HBA_BUSRESET); - isp_done(xs); - } + if (ISP_H2HT(hdp->handle) == ISP_HANDLE_INITIATOR) { + XS_T *xs = hdp->cmd; + if (XS_XFRLEN(xs)) { + ISP_DMAFREE(isp, xs, hdp->handle); + XS_SET_RESID(xs, XS_XFRLEN(xs)); + } else { + XS_SET_RESID(xs, 0); + } + hdp->handle = 0; + hdp->cmd = NULL; + XS_SETERR(xs, HBA_BUSRESET); + isp_done(xs); #ifdef ISP_TARGET_MODE - for (tmp = 0; isp->isp_tgtlist && tmp < isp->isp_maxcmds; tmp++) { - uint8_t local[QENTRY_LEN]; - hdp = &isp->isp_tgtlist[tmp]; - if (hdp->handle == ISP_HANDLE_FREE) { - continue; - } - ISP_DMAFREE(isp, hdp->cmd, hdp->handle); - ISP_MEMZERO(local, QENTRY_LEN); - if (IS_24XX(isp)) { - ct7_entry_t *ctio = (ct7_entry_t *) local; - ctio->ct_syshandle = hdp->handle; - ctio->ct_nphdl = CT_HBA_RESET; - ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO7; - } else { - ct2_entry_t *ctio = (ct2_entry_t *) local; - ctio->ct_syshandle = hdp->handle; - ctio->ct_status = CT_HBA_RESET; - ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2; + } else if (ISP_H2HT(hdp->handle) == ISP_HANDLE_TARGET) { + uint8_t local[QENTRY_LEN]; + ISP_DMAFREE(isp, hdp->cmd, hdp->handle); + ISP_MEMZERO(local, QENTRY_LEN); + if (IS_24XX(isp)) { + ct7_entry_t *ctio = (ct7_entry_t *) local; + ctio->ct_syshandle = hdp->handle; + ctio->ct_nphdl = CT_HBA_RESET; + ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO7; + } else { + ct2_entry_t *ctio = (ct2_entry_t *) local; + ctio->ct_syshandle = hdp->handle; + ctio->ct_status = CT_HBA_RESET; + ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2; + } + isp_async(isp, ISPASYNC_TARGET_ACTION, local); +#endif } - isp_async(isp, ISPASYNC_TARGET_ACTION, local); } +#ifdef ISP_TARGET_MODE for (tmp = 0; tmp < isp->isp_nchan; tmp++) { ISP_MEMZERO(¬ify, sizeof (isp_notify_t)); notify.nt_ncode = NT_HBA_RESET; @@ -2223,69 +2205,6 @@ isp_send_tgt_cmd(ispsoftc_t *isp, void * return (CMD_QUEUED); } -int -isp_allocate_xs_tgt(ispsoftc_t *isp, void *xs, uint32_t *handlep) -{ - isp_hdl_t *hdp; - - hdp = isp->isp_tgtfree; - if (hdp == NULL) { - return (-1); - } - isp->isp_tgtfree = hdp->cmd; - hdp->cmd = xs; - hdp->handle = (hdp - isp->isp_tgtlist); - hdp->handle |= (ISP_HANDLE_TARGET << ISP_HANDLE_USAGE_SHIFT); - /* - * Target handles for SCSI cards are only 16 bits, so - * sequence number protection will be ommitted. - */ - if (IS_FC(isp)) { - hdp->handle |= (isp->isp_seqno++ << ISP_HANDLE_SEQ_SHIFT); - } - *handlep = hdp->handle; - return (0); -} - -void * -isp_find_xs_tgt(ispsoftc_t *isp, uint32_t handle) -{ - if (!ISP_VALID_TGT_HANDLE(isp, handle)) { - isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); - return (NULL); - } - return (isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)].cmd); -} - -uint32_t -isp_find_tgt_handle(ispsoftc_t *isp, void *xs) -{ - uint32_t i, foundhdl = ISP_HANDLE_FREE; - - if (xs != NULL) { - for (i = 0; i < isp->isp_maxcmds; i++) { - if (isp->isp_tgtlist[i].cmd != xs) { - continue; - } - foundhdl = isp->isp_tgtlist[i].handle; - break; - } - } - return (foundhdl); -} - -void -isp_destroy_tgt_handle(ispsoftc_t *isp, uint32_t handle) -{ - if (!ISP_VALID_TGT_HANDLE(isp, handle)) { - isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); - } else { - isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)].handle = ISP_HANDLE_FREE; - isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)].cmd = isp->isp_tgtfree; - isp->isp_tgtfree = &isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)]; - } -} - #endif /* Modified: stable/10/sys/dev/isp/isp_library.h ============================================================================== --- stable/10/sys/dev/isp/isp_library.h Wed Dec 30 11:49:41 2015 (r292920) +++ stable/10/sys/dev/isp/isp_library.h Wed Dec 30 11:49:48 2015 (r292921) @@ -43,10 +43,9 @@ int isp_send_cmd(ispsoftc_t *, void *, v * * These handles are associate with a command. */ -int isp_allocate_xs(ispsoftc_t *, XS_T *, uint32_t *); -XS_T * isp_find_xs(ispsoftc_t *, uint32_t); -uint32_t isp_find_handle(ispsoftc_t *, XS_T *); -uint32_t isp_handle_index(ispsoftc_t *, uint32_t); +uint32_t isp_allocate_handle(ispsoftc_t *, void *, int); +void *isp_find_xs(ispsoftc_t *, uint32_t); +uint32_t isp_find_handle(ispsoftc_t *, void *); void isp_destroy_handle(ispsoftc_t *, uint32_t); /* @@ -162,11 +161,6 @@ void isp_put_fcp_rsp_iu(ispsoftc_t *isp, #endif int isp_send_tgt_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t, void *, uint32_t); - -int isp_allocate_xs_tgt(ispsoftc_t *, void *, uint32_t *); -void *isp_find_xs_tgt(ispsoftc_t *, uint32_t); -uint32_t isp_find_tgt_handle(ispsoftc_t *, void *); -void isp_destroy_tgt_handle(ispsoftc_t *, uint32_t); #endif int isp_find_pdb_empty(ispsoftc_t *, int, fcportdb_t **); int isp_find_pdb_by_wwpn(ispsoftc_t *, int, uint64_t, fcportdb_t **); Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Wed Dec 30 11:49:41 2015 (r292920) +++ stable/10/sys/dev/isp/isp_pci.c Wed Dec 30 11:49:48 2015 (r292921) @@ -1684,21 +1684,6 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1]; } isp->isp_xffree = isp->isp_xflist; -#ifdef ISP_TARGET_MODE - len = sizeof (isp_hdl_t) * isp->isp_maxcmds; - isp->isp_tgtlist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); - if (isp->isp_tgtlist == NULL) { - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - isp_prt(isp, ISP_LOGERR, "cannot alloc tgtlist array"); - return (1); - } - for (len = 0; len < isp->isp_maxcmds - 1; len++) { - isp->isp_tgtlist[len].cmd = &isp->isp_tgtlist[len+1]; - } - isp->isp_tgtfree = isp->isp_tgtlist; -#endif /* * Allocate and map the request and result queues (and ATIO queue @@ -1725,9 +1710,6 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); free(isp->isp_xflist, M_DEVBUF); -#ifdef ISP_TARGET_MODE - free(isp->isp_tgtlist, M_DEVBUF); -#endif ISP_LOCK(isp); return (1); } @@ -1737,9 +1719,6 @@ isp_pci_mbxdma(ispsoftc_t *isp) bus_dma_tag_destroy(isp->isp_osinfo.cdmat); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); free(isp->isp_xflist, M_DEVBUF); -#ifdef ISP_TARGET_MODE - free(isp->isp_tgtlist, M_DEVBUF); -#endif ISP_LOCK(isp); return (1); } @@ -1828,9 +1807,6 @@ bad: bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); bus_dma_tag_destroy(isp->isp_osinfo.cdmat); free(isp->isp_xflist, M_DEVBUF); -#ifdef ISP_TARGET_MODE - free(isp->isp_tgtlist, M_DEVBUF); -#endif free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); isp->isp_rquest = NULL; ISP_LOCK(isp); Modified: stable/10/sys/dev/isp/isp_target.c ============================================================================== --- stable/10/sys/dev/isp/isp_target.c Wed Dec 30 11:49:41 2015 (r292920) +++ stable/10/sys/dev/isp/isp_target.c Wed Dec 30 11:49:48 2015 (r292921) @@ -1094,7 +1094,7 @@ isp_handle_ctio2(ispsoftc_t *isp, ct2_en char *fmsg = NULL; if (ct->ct_syshandle) { - xs = isp_find_xs_tgt(isp, ct->ct_syshandle); + xs = isp_find_xs(isp, ct->ct_syshandle); if (xs == NULL) { pl = ISP_LOGALL; } @@ -1249,7 +1249,7 @@ isp_handle_ctio7(ispsoftc_t *isp, ct7_en char *fmsg = NULL; if (ct->ct_syshandle) { - xs = isp_find_xs_tgt(isp, ct->ct_syshandle); + xs = isp_find_xs(isp, ct->ct_syshandle); if (xs == NULL) { pl = ISP_LOGALL; } Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Wed Dec 30 11:49:41 2015 (r292920) +++ stable/10/sys/dev/isp/ispvar.h Wed Dec 30 11:49:48 2015 (r292921) @@ -318,18 +318,11 @@ typedef struct { #define ISP_HANDLE_SEQ_MASK 0xffff0000 #define ISP_HANDLE_SEQ_SHIFT 16 #define ISP_H2SEQ(hdl) ((hdl & ISP_HANDLE_SEQ_MASK) >> ISP_HANDLE_SEQ_SHIFT) -#define ISP_VALID_INI_HANDLE(c, hdl) \ - (ISP_H2HT(hdl) == ISP_HANDLE_INITIATOR && (hdl & ISP_HANDLE_CMD_MASK) < (c)->isp_maxcmds && \ - ISP_H2SEQ(hdl) == ISP_H2SEQ((c)->isp_xflist[hdl & ISP_HANDLE_CMD_MASK].handle)) -#ifdef ISP_TARGET_MODE -#define ISP_VALID_TGT_HANDLE(c, hdl) \ - (ISP_H2HT(hdl) == ISP_HANDLE_TARGET && (hdl & ISP_HANDLE_CMD_MASK) < (c)->isp_maxcmds && \ - ISP_H2SEQ(hdl) == ISP_H2SEQ((c)->isp_tgtlist[hdl & ISP_HANDLE_CMD_MASK].handle)) #define ISP_VALID_HANDLE(c, hdl) \ - (ISP_VALID_INI_HANDLE((c), hdl) || ISP_VALID_TGT_HANDLE((c), hdl)) -#else -#define ISP_VALID_HANDLE ISP_VALID_INI_HANDLE -#endif + ((ISP_H2HT(hdl) == ISP_HANDLE_INITIATOR || \ + ISP_H2HT(hdl) == ISP_HANDLE_TARGET) && \ + ((hdl) & ISP_HANDLE_CMD_MASK) < (c)->isp_maxcmds && \ + (hdl) == ((c)->isp_xflist[(hdl) & ISP_HANDLE_CMD_MASK].handle)) #define ISP_BAD_HANDLE_INDEX 0xffffffff @@ -598,14 +591,6 @@ struct ispsoftc { isp_hdl_t *isp_xflist; isp_hdl_t *isp_xffree; -#ifdef ISP_TARGET_MODE - /* - * Active target commands are stored here, indexed by handle functions. - */ - isp_hdl_t *isp_tgtlist; - isp_hdl_t *isp_tgtfree; -#endif - /* * request/result queue pointers and DMA handles for them. */ From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:50:54 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53EB3A55683; Wed, 30 Dec 2015 11:50:54 +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 2B4C41380; Wed, 30 Dec 2015 11:50:54 +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 tBUBorJ1048569; Wed, 30 Dec 2015 11:50:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBorka048566; Wed, 30 Dec 2015 11:50:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301150.tBUBorka048566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:50:53 +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: r292922 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:50:54 -0000 Author: mav Date: Wed Dec 30 11:50:52 2015 New Revision: 292922 URL: https://svnweb.freebsd.org/changeset/base/292922 Log: MFC r292739: Make virtual ports control asynchronous. Before this change virtual ports control IOCBs were executed synchronously via Execute IOCB mailbox command. It required exclusive use of scratch space of driver and mailbox registers of the hardware. Because of that shared resources use this code could not really sleep, having to spin for completion, blocking any other operation. This change introduces new asynchronous design, sending the IOCBs directly on request queue and gracefully waiting for their return on response queue. Returned IOCBs are identified with unified handle space from r292725. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_library.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Wed Dec 30 11:49:48 2015 (r292921) +++ stable/10/sys/dev/isp/isp.c Wed Dec 30 11:50:52 2015 (r292922) @@ -2348,64 +2348,64 @@ static int isp_fc_enable_vp(ispsoftc_t *isp, int chan) { fcparam *fcp = FCPARAM(isp, chan); - mbreg_t mbs; - vp_modify_t *vp; - uint8_t qe[QENTRY_LEN], *scp; - - ISP_MEMZERO(qe, QENTRY_LEN); - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - return (EBUSY); - } - scp = fcp->isp_scratch; + vp_modify_t vp; + void *reqp; + uint8_t resp[QENTRY_LEN]; /* Build a VP MODIFY command in memory */ - vp = (vp_modify_t *) qe; - vp->vp_mod_hdr.rqs_entry_type = RQSTYPE_VP_MODIFY; - vp->vp_mod_hdr.rqs_entry_count = 1; - vp->vp_mod_cnt = 1; - vp->vp_mod_idx0 = chan; - vp->vp_mod_cmd = VP_MODIFY_ENA; - vp->vp_mod_ports[0].options = ICB2400_VPOPT_ENABLED | + ISP_MEMZERO(&vp, sizeof(vp)); + vp.vp_mod_hdr.rqs_entry_type = RQSTYPE_VP_MODIFY; + vp.vp_mod_hdr.rqs_entry_count = 1; + vp.vp_mod_cnt = 1; + vp.vp_mod_idx0 = chan; + vp.vp_mod_cmd = VP_MODIFY_ENA; + vp.vp_mod_ports[0].options = ICB2400_VPOPT_ENABLED | ICB2400_VPOPT_ENA_SNSLOGIN; - if (fcp->role & ISP_ROLE_INITIATOR) { - vp->vp_mod_ports[0].options |= ICB2400_VPOPT_INI_ENABLE; - } - if ((fcp->role & ISP_ROLE_TARGET) == 0) { - vp->vp_mod_ports[0].options |= ICB2400_VPOPT_TGT_DISABLE; - } + if (fcp->role & ISP_ROLE_INITIATOR) + vp.vp_mod_ports[0].options |= ICB2400_VPOPT_INI_ENABLE; + if ((fcp->role & ISP_ROLE_TARGET) == 0) + vp.vp_mod_ports[0].options |= ICB2400_VPOPT_TGT_DISABLE; if (fcp->isp_loopid < LOCAL_LOOP_LIM) { - vp->vp_mod_ports[0].loopid = fcp->isp_loopid; + 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; + vp.vp_mod_ports[0].options |= ICB2400_VPOPT_HARD_ADDRESS; else - vp->vp_mod_ports[0].options |= - ICB2400_VPOPT_PREV_ADDRESS; + 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); - isp_put_vp_modify(isp, vp, (vp_modify_t *) scp); + 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); - /* Build a EXEC IOCB A64 command that points to the VP MODIFY command */ - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0); - mbs.param[1] = QENTRY_LEN; - 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, 2 * QENTRY_LEN, chan); - isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - FC_SCRATCH_RELEASE(isp, chan); + /* Prepare space for response in memory */ + memset(resp, 0xff, sizeof(resp)); + vp.vp_mod_hdl = isp_allocate_handle(isp, resp, ISP_HANDLE_CTRL); + if (vp.vp_mod_hdl == 0) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_MODIFY of Chan %d out of handles", __func__, chan); return (EIO); } - MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); - isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp); - FC_SCRATCH_RELEASE(isp, chan); + /* Send request and wait for response. */ + reqp = isp_getrqentry(isp); + if (reqp == NULL) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_MODIFY of Chan %d out of rqent", __func__, chan); + isp_destroy_handle(isp, vp.vp_mod_hdl); + return (EIO); + } + isp_put_vp_modify(isp, &vp, (vp_modify_t *)reqp); + ISP_SYNC_REQUEST(isp); + if (msleep(resp, &isp->isp_lock, 0, "VP_MODIFY", 5*hz) == EWOULDBLOCK) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_MODIFY of Chan %d timed out", __func__, chan); + isp_destroy_handle(isp, vp.vp_mod_hdl); + return (EIO); + } + isp_get_vp_modify(isp, (vp_modify_t *)resp, &vp); - if (vp->vp_mod_status != VP_STS_OK) { - isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status); + if (vp.vp_mod_hdr.rqs_flags != 0 || vp.vp_mod_status != VP_STS_OK) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_MODIFY of Chan %d failed with flags %x status %d", + __func__, chan, vp.vp_mod_hdr.rqs_flags, vp.vp_mod_status); return (EIO); } return (0); @@ -2414,54 +2414,56 @@ isp_fc_enable_vp(ispsoftc_t *isp, int ch static int isp_fc_disable_vp(ispsoftc_t *isp, int chan) { - fcparam *fcp = FCPARAM(isp, chan); - mbreg_t mbs; - vp_ctrl_info_t *vp; - uint8_t qe[QENTRY_LEN], *scp; - - ISP_MEMZERO(qe, QENTRY_LEN); - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - return (EBUSY); - } - scp = fcp->isp_scratch; + vp_ctrl_info_t vp; + void *reqp; + uint8_t resp[QENTRY_LEN]; /* Build a VP CTRL command in memory */ - vp = (vp_ctrl_info_t *) qe; - vp->vp_ctrl_hdr.rqs_entry_type = RQSTYPE_VP_CTRL; - vp->vp_ctrl_hdr.rqs_entry_count = 1; + ISP_MEMZERO(&vp, sizeof(vp)); + vp.vp_ctrl_hdr.rqs_entry_type = RQSTYPE_VP_CTRL; + vp.vp_ctrl_hdr.rqs_entry_count = 1; if (ISP_CAP_VP0(isp)) { - vp->vp_ctrl_status = 1; + vp.vp_ctrl_status = 1; } else { - vp->vp_ctrl_status = 0; + vp.vp_ctrl_status = 0; chan--; /* VP0 can not be controlled in this case. */ } - vp->vp_ctrl_command = VP_CTRL_CMD_DISABLE_VP_LOGO_ALL; - vp->vp_ctrl_vp_count = 1; - vp->vp_ctrl_idmap[chan / 16] |= (1 << chan % 16); - isp_put_vp_ctrl_info(isp, vp, (vp_ctrl_info_t *) scp); - - /* Build a EXEC IOCB A64 command that points to the VP CTRL command */ - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0); - mbs.param[1] = QENTRY_LEN; - 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, 2 * QENTRY_LEN, chan); - isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - FC_SCRATCH_RELEASE(isp, chan); + vp.vp_ctrl_command = VP_CTRL_CMD_DISABLE_VP_LOGO_ALL; + vp.vp_ctrl_vp_count = 1; + vp.vp_ctrl_idmap[chan / 16] |= (1 << chan % 16); + + /* Prepare space for response in memory */ + memset(resp, 0xff, sizeof(resp)); + vp.vp_ctrl_handle = isp_allocate_handle(isp, resp, ISP_HANDLE_CTRL); + if (vp.vp_ctrl_handle == 0) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_CTRL of Chan %d out of handles", __func__, chan); return (EIO); } - MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); - isp_get_vp_ctrl_info(isp, (vp_ctrl_info_t *)&scp[QENTRY_LEN], vp); - FC_SCRATCH_RELEASE(isp, chan); + /* Send request and wait for response. */ + reqp = isp_getrqentry(isp); + if (reqp == NULL) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_CTRL of Chan %d out of rqent", __func__, chan); + isp_destroy_handle(isp, vp.vp_ctrl_handle); + return (EIO); + } + isp_put_vp_ctrl_info(isp, &vp, (vp_ctrl_info_t *)reqp); + ISP_SYNC_REQUEST(isp); + if (msleep(resp, &isp->isp_lock, 0, "VP_CTRL", 5*hz) == EWOULDBLOCK) { + isp_prt(isp, ISP_LOGERR, + "%s: VP_CTRL of Chan %d timed out", __func__, chan); + isp_destroy_handle(isp, vp.vp_ctrl_handle); + return (EIO); + } + isp_get_vp_ctrl_info(isp, (vp_ctrl_info_t *)resp, &vp); - if (vp->vp_ctrl_status != 0) { + if (vp.vp_ctrl_hdr.rqs_flags != 0 || vp.vp_ctrl_status != 0) { isp_prt(isp, ISP_LOGERR, - "%s: VP_CTRL of Chan %d failed with status %d %d", - __func__, chan, vp->vp_ctrl_status, vp->vp_ctrl_index_fail); + "%s: VP_CTRL of Chan %d failed with flags %x status %d %d", + __func__, chan, vp.vp_ctrl_hdr.rqs_flags, + vp.vp_ctrl_status, vp.vp_ctrl_index_fail); return (EIO); } return (0); @@ -6123,6 +6125,8 @@ isp_handle_other_response(ispsoftc_t *is { isp_ridacq_t rid; int chan, c; + uint32_t hdl; + void *ptr; switch (type) { case RQSTYPE_STATUS_CONT: @@ -6164,6 +6168,16 @@ isp_handle_other_response(ispsoftc_t *is } } return (1); + case RQSTYPE_VP_MODIFY: + case RQSTYPE_VP_CTRL: + ISP_IOXGET_32(isp, (uint32_t *)(hp + 1), hdl); + ptr = isp_find_xs(isp, hdl); + if (ptr != NULL) { + isp_destroy_handle(isp, hdl); + memcpy(ptr, hp, QENTRY_LEN); + wakeup(ptr); + } + return (1); case RQSTYPE_ATIO: case RQSTYPE_CTIO: case RQSTYPE_ENABLE_LUN: Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Wed Dec 30 11:49:48 2015 (r292921) +++ stable/10/sys/dev/isp/isp_library.c Wed Dec 30 11:50:52 2015 (r292922) @@ -572,7 +572,8 @@ isp_clear_commands(ispsoftc_t *isp) for (tmp = 0; isp->isp_xflist && tmp < isp->isp_maxcmds; tmp++) { hdp = &isp->isp_xflist[tmp]; - if (ISP_H2HT(hdp->handle) == ISP_HANDLE_INITIATOR) { + switch (ISP_H2HT(hdp->handle)) { + case ISP_HANDLE_INITIATOR: { XS_T *xs = hdp->cmd; if (XS_XFRLEN(xs)) { ISP_DMAFREE(isp, xs, hdp->handle); @@ -580,12 +581,13 @@ isp_clear_commands(ispsoftc_t *isp) } else { XS_SET_RESID(xs, 0); } - hdp->handle = 0; - hdp->cmd = NULL; + isp_destroy_handle(isp, hdp->handle); XS_SETERR(xs, HBA_BUSRESET); isp_done(xs); + break; + } #ifdef ISP_TARGET_MODE - } else if (ISP_H2HT(hdp->handle) == ISP_HANDLE_TARGET) { + case ISP_HANDLE_TARGET: { uint8_t local[QENTRY_LEN]; ISP_DMAFREE(isp, hdp->cmd, hdp->handle); ISP_MEMZERO(local, QENTRY_LEN); @@ -601,7 +603,13 @@ isp_clear_commands(ispsoftc_t *isp) ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2; } isp_async(isp, ISPASYNC_TARGET_ACTION, local); + break; + } #endif + case ISP_HANDLE_CTRL: + wakeup(hdp->cmd); + isp_destroy_handle(isp, hdp->handle); + break; } } #ifdef ISP_TARGET_MODE Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Wed Dec 30 11:49:48 2015 (r292921) +++ stable/10/sys/dev/isp/ispvar.h Wed Dec 30 11:50:52 2015 (r292922) @@ -315,12 +315,14 @@ typedef struct { # define ISP_HANDLE_NONE 0 # define ISP_HANDLE_INITIATOR 1 # define ISP_HANDLE_TARGET 2 +# define ISP_HANDLE_CTRL 3 #define ISP_HANDLE_SEQ_MASK 0xffff0000 #define ISP_HANDLE_SEQ_SHIFT 16 #define ISP_H2SEQ(hdl) ((hdl & ISP_HANDLE_SEQ_MASK) >> ISP_HANDLE_SEQ_SHIFT) #define ISP_VALID_HANDLE(c, hdl) \ ((ISP_H2HT(hdl) == ISP_HANDLE_INITIATOR || \ - ISP_H2HT(hdl) == ISP_HANDLE_TARGET) && \ + ISP_H2HT(hdl) == ISP_HANDLE_TARGET || \ + ISP_H2HT(hdl) == ISP_HANDLE_CTRL) && \ ((hdl) & ISP_HANDLE_CMD_MASK) < (c)->isp_maxcmds && \ (hdl) == ((c)->isp_xflist[(hdl) & ISP_HANDLE_CMD_MASK].handle)) #define ISP_BAD_HANDLE_INDEX 0xffffffff From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:51:36 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCD25A55720; Wed, 30 Dec 2015 11:51:36 +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 89B8A189A; Wed, 30 Dec 2015 11:51:36 +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 tBUBpZ5F048708; Wed, 30 Dec 2015 11:51:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBpZ7G048707; Wed, 30 Dec 2015 11:51:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301151.tBUBpZ7G048707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:51:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292924 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:51:36 -0000 Author: mav Date: Wed Dec 30 11:51:35 2015 New Revision: 292924 URL: https://svnweb.freebsd.org/changeset/base/292924 Log: MFC r292741: Make port logins asynchronous, following r292739 logic. This is even more important since it involves more network operations and more prone to delays and timeouts. 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 Dec 30 11:51:13 2015 (r292923) +++ stable/10/sys/dev/isp/isp.c Wed Dec 30 11:51:35 2015 (r292924) @@ -108,7 +108,7 @@ static void isp_fibre_init(ispsoftc_t *) static void isp_fibre_init_2400(ispsoftc_t *); static void isp_clear_portdb(ispsoftc_t *, int); static void isp_mark_portdb(ispsoftc_t *, int); -static int isp_plogx(ispsoftc_t *, int, uint16_t, uint32_t, int, int); +static int isp_plogx(ispsoftc_t *, int, uint16_t, uint32_t, int); static int isp_port_login(ispsoftc_t *, uint16_t, uint32_t); static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t); static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *, int); @@ -2550,13 +2550,11 @@ isp_mark_portdb(ispsoftc_t *isp, int cha * or via FABRIC LOGIN/FABRIC LOGOUT for other cards. */ static int -isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags, int gs) +isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags) { - mbreg_t mbs; - uint8_t q[QENTRY_LEN]; - isp_plogx_t *plp; - fcparam *fcp; - uint8_t *scp; + isp_plogx_t pl; + void *reqp; + uint8_t resp[QENTRY_LEN]; uint32_t sst, parm1; int rval, lev; const char *msg; @@ -2576,64 +2574,58 @@ isp_plogx(ispsoftc_t *isp, int chan, uin } } - ISP_MEMZERO(q, QENTRY_LEN); - plp = (isp_plogx_t *) q; - plp->plogx_header.rqs_entry_count = 1; - plp->plogx_header.rqs_entry_type = RQSTYPE_LOGIN; - plp->plogx_handle = 0xffffffff; - plp->plogx_nphdl = handle; - plp->plogx_vphdl = chan; - plp->plogx_portlo = portid; - plp->plogx_rspsz_porthi = (portid >> 16) & 0xff; - plp->plogx_flags = flags; + ISP_MEMZERO(&pl, sizeof(pl)); + pl.plogx_header.rqs_entry_count = 1; + pl.plogx_header.rqs_entry_type = RQSTYPE_LOGIN; + pl.plogx_nphdl = handle; + pl.plogx_vphdl = chan; + pl.plogx_portlo = portid; + pl.plogx_rspsz_porthi = (portid >> 16) & 0xff; + pl.plogx_flags = flags; - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "IOCB LOGX", QENTRY_LEN, plp); - } - - if (gs == 0) { - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } + /* Prepare space for response in memory */ + memset(resp, 0xff, sizeof(resp)); + pl.plogx_handle = isp_allocate_handle(isp, resp, ISP_HANDLE_CTRL); + if (pl.plogx_handle == 0) { + isp_prt(isp, ISP_LOGERR, + "%s: PLOGX of Chan %d out of handles", __func__, chan); + return (-1); } - fcp = FCPARAM(isp, chan); - scp = fcp->isp_scratch; - isp_put_plogx(isp, plp, (isp_plogx_t *) scp); - MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, - MBCMD_DEFAULT_TIMEOUT + ICB_LOGIN_TOV * 1000000); - mbs.param[1] = QENTRY_LEN; - 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, QENTRY_LEN, chan); - isp_mboxcmd(isp, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - rval = mbs.param[0]; - goto out; + /* Send request and wait for response. */ + reqp = isp_getrqentry(isp); + if (reqp == NULL) { + isp_prt(isp, ISP_LOGERR, + "%s: PLOGX of Chan %d out of rqent", __func__, chan); + isp_destroy_handle(isp, pl.plogx_handle); + return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); - scp += QENTRY_LEN; - isp_get_plogx(isp, (isp_plogx_t *) scp, plp); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "IOCB LOGX response", QENTRY_LEN, plp); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "IOCB LOGX", QENTRY_LEN, &pl); + isp_put_plogx(isp, &pl, (isp_plogx_t *)reqp); + ISP_SYNC_REQUEST(isp); + if (msleep(resp, &isp->isp_lock, 0, "PLOGX", 3 * ICB_LOGIN_TOV * hz) + == EWOULDBLOCK) { + isp_prt(isp, ISP_LOGERR, + "%s: PLOGX of Chan %d timed out", __func__, chan); + isp_destroy_handle(isp, pl.plogx_handle); + return (-1); } + isp_get_plogx(isp, (isp_plogx_t *)resp, &pl); + if (isp->isp_dblev & ISP_LOGDEBUG1) + isp_print_bytes(isp, "IOCB LOGX response", QENTRY_LEN, &pl); - if (plp->plogx_status == PLOGX_STATUS_OK) { - rval = 0; - goto out; - } else if (plp->plogx_status != PLOGX_STATUS_IOCBERR) { + if (pl.plogx_status == PLOGX_STATUS_OK) { + return (0); + } else if (pl.plogx_status != PLOGX_STATUS_IOCBERR) { isp_prt(isp, ISP_LOGWARN, "status 0x%x on port login IOCB channel %d", - plp->plogx_status, chan); - rval = -1; - goto out; + pl.plogx_status, chan); + return (-1); } - sst = plp->plogx_ioparm[0].lo16 | (plp->plogx_ioparm[0].hi16 << 16); - parm1 = plp->plogx_ioparm[1].lo16 | (plp->plogx_ioparm[1].hi16 << 16); + sst = pl.plogx_ioparm[0].lo16 | (pl.plogx_ioparm[0].hi16 << 16); + parm1 = pl.plogx_ioparm[1].lo16 | (pl.plogx_ioparm[1].hi16 << 16); rval = -1; lev = ISP_LOGERR; @@ -2694,17 +2686,13 @@ isp_plogx(ispsoftc_t *isp, int chan, uin msg = "no FLOGI_ACC"; break; default: - ISP_SNPRINTF(buf, sizeof (buf), "status %x from %x", plp->plogx_status, flags); + ISP_SNPRINTF(buf, sizeof (buf), "status %x from %x", pl.plogx_status, flags); msg = buf; break; } if (msg) { isp_prt(isp, ISP_LOGERR, "Chan %d PLOGX PortID 0x%06x to N-Port handle 0x%x: %s", chan, portid, handle, msg); } -out: - if (gs == 0) { - FC_SCRATCH_RELEASE(isp, chan); - } return (rval); } @@ -3196,7 +3184,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) lp->portid, PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT | - PLOGX_FLG_FREE_NPHDL, 0); + PLOGX_FLG_FREE_NPHDL); } /* * Note that we might come out of this with our state @@ -3883,7 +3871,7 @@ isp_login_device(ispsoftc_t *isp, int ch /* * Now try and log into the device */ - r = isp_plogx(isp, chan, handle, portid, PLOGX_FLG_CMD_PLOGI, 1); + r = isp_plogx(isp, chan, handle, portid, PLOGX_FLG_CMD_PLOGI); if (r == 0) { break; } else if ((r & 0xffff) == MBOX_PORT_ID_USED) { @@ -3892,12 +3880,12 @@ isp_login_device(ispsoftc_t *isp, int ch * handle. We need to break that association. We used to try and just substitute the handle, but then * failed to get any data via isp_getpdb (below). */ - if (isp_plogx(isp, chan, r >> 16, portid, PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT | PLOGX_FLG_FREE_NPHDL, 1)) { + if (isp_plogx(isp, chan, r >> 16, portid, PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT | PLOGX_FLG_FREE_NPHDL)) { isp_prt(isp, ISP_LOGERR, "baw... logout of %x failed", r >> 16); } if (FCPARAM(isp, chan)->isp_loopstate != LOOP_SCANNING_FABRIC) return (-1); - r = isp_plogx(isp, chan, handle, portid, PLOGX_FLG_CMD_PLOGI, 1); + r = isp_plogx(isp, chan, handle, portid, PLOGX_FLG_CMD_PLOGI); if (r != 0) i = lim; break; @@ -4937,11 +4925,11 @@ isp_control(ispsoftc_t *isp, ispctl_t ct va_end(ap); if ((p->flags & PLOGX_FLG_CMD_MASK) != PLOGX_FLG_CMD_PLOGI || (p->handle != NIL_HANDLE)) { - return (isp_plogx(isp, p->channel, p->handle, p->portid, p->flags, 0)); + return (isp_plogx(isp, p->channel, p->handle, p->portid, p->flags)); } do { isp_next_handle(isp, &p->handle); - r = isp_plogx(isp, p->channel, p->handle, p->portid, p->flags, 0); + r = isp_plogx(isp, p->channel, p->handle, p->portid, p->flags); if ((r & 0xffff) == MBOX_PORT_ID_USED) { p->handle = r >> 16; r = 0; @@ -6170,6 +6158,7 @@ isp_handle_other_response(ispsoftc_t *is return (1); case RQSTYPE_VP_MODIFY: case RQSTYPE_VP_CTRL: + case RQSTYPE_LOGIN: ISP_IOXGET_32(isp, (uint32_t *)(hp + 1), hdl); ptr = isp_find_xs(isp, hdl); if (ptr != NULL) { From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:53:23 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60B24A55870; Wed, 30 Dec 2015 11:53: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 019011ECB; Wed, 30 Dec 2015 11:53:22 +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 tBUBrMSR051472; Wed, 30 Dec 2015 11:53:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBrLY4051470; Wed, 30 Dec 2015 11:53:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301153.tBUBrLY4051470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:53: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: r292927 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:53:23 -0000 Author: mav Date: Wed Dec 30 11:53:21 2015 New Revision: 292927 URL: https://svnweb.freebsd.org/changeset/base/292927 Log: MFC r292745: Use single DMA tag for scratch areas of all virtual ports. Modified: stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/isp_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Wed Dec 30 11:53:15 2015 (r292926) +++ stable/10/sys/dev/isp/isp_freebsd.h Wed Dec 30 11:53:21 2015 (r292927) @@ -225,8 +225,7 @@ struct isp_fc { struct cam_path *path; struct ispsoftc *isp; struct proc *kproc; - bus_dma_tag_t tdmat; - bus_dmamap_t tdmap; + bus_dmamap_t scmap; uint64_t def_wwpn; uint64_t def_wwnn; time_t loop_down_time; @@ -285,13 +284,14 @@ struct isposinfo { const struct firmware * fw; /* - * DMA related sdtuff + * DMA related stuff */ struct resource * regs; struct resource * regs2; bus_dma_tag_t dmat; bus_dma_tag_t cdmat; bus_dmamap_t cdmap; + bus_dma_tag_t scdmat; /* * Command and transaction related related stuff @@ -409,7 +409,7 @@ switch (type) { \ case SYNC_SFORDEV: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ - bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + bus_dmamap_sync(isp->isp_osinfo.scdmat, fc->scmap, \ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ break; \ } \ @@ -421,7 +421,7 @@ case SYNC_REQUEST: \ case SYNC_SFORCPU: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ - bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + bus_dmamap_sync(isp->isp_osinfo.scdmat, fc->scmap, \ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ break; \ } \ @@ -443,7 +443,7 @@ switch (type) { \ case SYNC_SFORDEV: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ - bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + bus_dmamap_sync(isp->isp_osinfo.scdmat, fc->scmap, \ BUS_DMASYNC_PREWRITE); \ break; \ } \ @@ -454,7 +454,7 @@ case SYNC_REQUEST: \ case SYNC_SFORCPU: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ - bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + bus_dmamap_sync(isp->isp_osinfo.scdmat, fc->scmap, \ BUS_DMASYNC_POSTWRITE); \ break; \ } \ Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Wed Dec 30 11:53:15 2015 (r292926) +++ stable/10/sys/dev/isp/isp_pci.c Wed Dec 30 11:53:21 2015 (r292927) @@ -1604,11 +1604,8 @@ imc1(void *arg, bus_dma_segment_t *segs, imushp->error = error; return; } - if (nseg != 1) { - imushp->error = EINVAL; - return; - } - isp_prt(imushp->isp, ISP_LOGDEBUG0, "scdma @ 0x%jx/0x%jx", (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); + isp_prt(imushp->isp, ISP_LOGDEBUG0, "scdma @ 0x%jx/0x%jx", + (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); FCPARAM(imushp->isp, imushp->chan)->isp_scdma = segs->ds_addr; FCPARAM(imushp->isp, imushp->chan)->isp_scratch = imushp->vbase; } @@ -1735,23 +1732,27 @@ isp_pci_mbxdma(ispsoftc_t *isp) } if (IS_FC(isp)) { + if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + ISP_FC_SCRLEN, 1, ISP_FC_SCRLEN, 0, &isp->isp_osinfo.scdmat)) { + goto bad; + } for (cmap = 0; cmap < isp->isp_nchan; cmap++) { struct isp_fc *fc = ISP_FC_PC(isp, cmap); - if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, ISP_FC_SCRLEN, 1, slim, 0, &fc->tdmat)) { - goto bad; - } - if (bus_dmamem_alloc(fc->tdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &fc->tdmap) != 0) { - bus_dma_tag_destroy(fc->tdmat); + if (bus_dmamem_alloc(isp->isp_osinfo.scdmat, + (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, + &fc->scmap) != 0) { goto bad; } im.isp = isp; im.chan = cmap; im.vbase = base; im.error = 0; - bus_dmamap_load(fc->tdmat, fc->tdmap, base, ISP_FC_SCRLEN, imc1, &im, 0); + bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, + base, ISP_FC_SCRLEN, imc1, &im, 0); if (im.error) { - bus_dmamem_free(fc->tdmat, base, fc->tdmap); - bus_dma_tag_destroy(fc->tdmat); + bus_dmamem_free(isp->isp_osinfo.scdmat, + base, fc->scmap); goto bad; } if (!IS_2100(isp)) { @@ -1794,15 +1795,18 @@ isp_pci_mbxdma(ispsoftc_t *isp) return (0); bad: - while (--cmap >= 0) { - struct isp_fc *fc = ISP_FC_PC(isp, cmap); - bus_dmamem_free(fc->tdmat, base, fc->tdmap); - bus_dma_tag_destroy(fc->tdmat); - while (fc->nexus_free_list) { - struct isp_nexus *n = fc->nexus_free_list; - fc->nexus_free_list = n->next; - free(n, M_DEVBUF); + if (IS_FC(isp)) { + while (--cmap >= 0) { + struct isp_fc *fc = ISP_FC_PC(isp, cmap); + bus_dmamap_unload(isp->isp_osinfo.scdmat, fc->scmap); + bus_dmamem_free(isp->isp_osinfo.scdmat, base, fc->scmap); + while (fc->nexus_free_list) { + struct isp_nexus *n = fc->nexus_free_list; + fc->nexus_free_list = n->next; + free(n, M_DEVBUF); + } } + bus_dma_tag_destroy(isp->isp_osinfo.scdmat); } bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); bus_dma_tag_destroy(isp->isp_osinfo.cdmat); From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:54:38 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69DC2A559BB; Wed, 30 Dec 2015 11:54: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 39150123F; Wed, 30 Dec 2015 11:54: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 tBUBsbtD051635; Wed, 30 Dec 2015 11:54:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBsbOA051632; Wed, 30 Dec 2015 11:54:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301154.tBUBsbOA051632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:54:37 +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: r292929 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:54:38 -0000 Author: mav Date: Wed Dec 30 11:54:37 2015 New Revision: 292929 URL: https://svnweb.freebsd.org/changeset/base/292929 Log: MFC r292764: Split DMA buffers for request, response and ATIO queues. Modified: stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/isp_pci.c stable/10/sys/dev/isp/isp_sbus.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Wed Dec 30 11:54:09 2015 (r292928) +++ stable/10/sys/dev/isp/isp_freebsd.h Wed Dec 30 11:54:37 2015 (r292929) @@ -289,9 +289,13 @@ struct isposinfo { struct resource * regs; struct resource * regs2; bus_dma_tag_t dmat; - bus_dma_tag_t cdmat; - bus_dmamap_t cdmap; + bus_dma_tag_t reqdmat; + bus_dma_tag_t respdmat; + bus_dma_tag_t atiodmat; bus_dma_tag_t scdmat; + bus_dmamap_t reqmap; + bus_dmamap_t respmap; + bus_dmamap_t atiomap; /* * Command and transaction related related stuff @@ -406,6 +410,14 @@ struct isposinfo { #define MEMORYBARRIER(isp, type, offset, size, chan) \ switch (type) { \ +case SYNC_REQUEST: \ + bus_dmamap_sync(isp->isp_osinfo.reqdmat, \ + isp->isp_osinfo.reqmap, BUS_DMASYNC_PREWRITE); \ + break; \ +case SYNC_RESULT: \ + bus_dmamap_sync(isp->isp_osinfo.respdmat, \ + isp->isp_osinfo.respmap, BUS_DMASYNC_POSTREAD); \ + break; \ case SYNC_SFORDEV: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -413,11 +425,6 @@ case SYNC_SFORDEV: \ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ break; \ } \ -case SYNC_REQUEST: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, \ - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ - break; \ case SYNC_SFORCPU: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -425,21 +432,24 @@ case SYNC_SFORCPU: \ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ break; \ } \ -case SYNC_RESULT: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, \ - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ - break; \ case SYNC_REG: \ bus_barrier(isp->isp_osinfo.regs, offset, size, \ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); \ break; \ +case SYNC_ATIOQ: \ + bus_dmamap_sync(isp->isp_osinfo.atiodmat, \ + isp->isp_osinfo.atiomap, BUS_DMASYNC_POSTREAD); \ + break; \ default: \ break; \ } #define MEMORYBARRIERW(isp, type, offset, size, chan) \ switch (type) { \ +case SYNC_REQUEST: \ + bus_dmamap_sync(isp->isp_osinfo.reqdmat, \ + isp->isp_osinfo.reqmap, BUS_DMASYNC_PREWRITE); \ + break; \ case SYNC_SFORDEV: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -447,10 +457,6 @@ case SYNC_SFORDEV: \ BUS_DMASYNC_PREWRITE); \ break; \ } \ -case SYNC_REQUEST: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, BUS_DMASYNC_PREWRITE); \ - break; \ case SYNC_SFORCPU: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ @@ -458,10 +464,6 @@ case SYNC_SFORCPU: \ BUS_DMASYNC_POSTWRITE); \ break; \ } \ -case SYNC_RESULT: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, BUS_DMASYNC_POSTWRITE); \ - break; \ case SYNC_REG: \ bus_barrier(isp->isp_osinfo.regs, offset, size, \ BUS_SPACE_BARRIER_WRITE); \ Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Wed Dec 30 11:54:09 2015 (r292928) +++ stable/10/sys/dev/isp/isp_pci.c Wed Dec 30 11:54:37 2015 (r292929) @@ -1539,75 +1539,17 @@ isp_pci_wr_reg_2600(ispsoftc_t *isp, int struct imush { - ispsoftc_t *isp; - caddr_t vbase; - int chan; + bus_addr_t maddr; int error; }; -static void imc(void *, bus_dma_segment_t *, int, int); -static void imc1(void *, bus_dma_segment_t *, int, int); - static void imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) { struct imush *imushp = (struct imush *) arg; - isp_ecmd_t *ecmd; - - if (error) { - imushp->error = error; - return; - } - if (nseg != 1) { - imushp->error = EINVAL; - return; - } - isp_prt(imushp->isp, ISP_LOGDEBUG0, "request/result area @ 0x%jx/0x%jx", (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); - - imushp->isp->isp_rquest = imushp->vbase; - imushp->isp->isp_rquest_dma = segs->ds_addr; - segs->ds_addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); - imushp->vbase += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); - - imushp->isp->isp_result_dma = segs->ds_addr; - imushp->isp->isp_result = imushp->vbase; - segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); - imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); - - if (imushp->isp->isp_type >= ISP_HA_FC_2200) { - imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr; - imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase; - imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free; - for (ecmd = imushp->isp->isp_osinfo.ecmd_free; ecmd < &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) { - if (ecmd == &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) { - ecmd->next = NULL; - } else { - ecmd->next = ecmd + 1; - } - } - } -#ifdef ISP_TARGET_MODE - segs->ds_addr += (N_XCMDS * XCMD_SIZE); - imushp->vbase += (N_XCMDS * XCMD_SIZE); - if (IS_24XX(imushp->isp)) { - imushp->isp->isp_atioq_dma = segs->ds_addr; - imushp->isp->isp_atioq = imushp->vbase; - } -#endif -} -static void -imc1(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct imush *imushp = (struct imush *) arg; - if (error) { - imushp->error = error; - return; - } - isp_prt(imushp->isp, ISP_LOGDEBUG0, "scdma @ 0x%jx/0x%jx", - (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); - FCPARAM(imushp->isp, imushp->chan)->isp_scdma = segs->ds_addr; - FCPARAM(imushp->isp, imushp->chan)->isp_scratch = imushp->vbase; + if (!(imushp->error = error)) + imushp->maddr = segs[0].ds_addr; } static int @@ -1620,6 +1562,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) bus_addr_t llim; /* low limit of unavailable dma */ bus_addr_t hlim; /* high limit of unavailable dma */ struct imush im; + isp_ecmd_t *ecmd; /* * Already been here? If so, leave... @@ -1683,53 +1626,106 @@ isp_pci_mbxdma(ispsoftc_t *isp) isp->isp_xffree = isp->isp_xflist; /* - * Allocate and map the request and result queues (and ATIO queue - * if we're a 2400 supporting target mode), and a region for - * external dma addressable command/status structures (23XX and - * later). + * Allocate and map the request queue and a region for external + * DMA addressable command/status structures (22XX and later). */ len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); -#ifdef ISP_TARGET_MODE - if (IS_24XX(isp)) { - len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp->isp_type >= ISP_HA_FC_2200) + len += (N_XCMDS * XCMD_SIZE); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.reqdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); + goto bad1; + } + if (bus_dmamem_alloc(isp->isp_osinfo.reqdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.reqmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate request DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + goto bad1; } -#endif + isp->isp_rquest = base; + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); + goto bad1; + } + isp_prt(isp, ISP_LOGDEBUG0, "request area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_rquest_dma = im.maddr; + base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); + im.maddr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); if (isp->isp_type >= ISP_HA_FC_2200) { - len += (N_XCMDS * XCMD_SIZE); + isp->isp_osinfo.ecmd_dma = im.maddr; + isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)base; + isp->isp_osinfo.ecmd_base = isp->isp_osinfo.ecmd_free; + for (ecmd = isp->isp_osinfo.ecmd_free; + ecmd < &isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) { + if (ecmd == &isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) + ecmd->next = NULL; + else + ecmd->next = ecmd + 1; + } } /* - * Create a tag for the control spaces. We don't always need this - * to be 32 bits, but we do this for simplicity and speed's sake. + * Allocate and map the result queue. */ - if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, 1, slim, 0, &isp->isp_osinfo.cdmat)) { - isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); + len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.respdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); + goto bad1; + } + if (bus_dmamem_alloc(isp->isp_osinfo.respdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.respmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate response DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + goto bad1; } - - if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &isp->isp_osinfo.cdmap) != 0) { - isp_prt(isp, ISP_LOGERR, "cannot allocate %d bytes of CCB memory", len); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); - } - - im.isp = isp; - im.chan = 0; - im.vbase = base; + isp->isp_result = base; im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); + goto bad1; + } + isp_prt(isp, ISP_LOGDEBUG0, "response area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_result_dma = im.maddr; - bus_dmamap_load(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap, base, len, imc, &im, 0); - if (im.error) { - isp_prt(isp, ISP_LOGERR, "error %d loading dma map for control areas", im.error); - goto bad; +#ifdef ISP_TARGET_MODE + /* + * Allocate and map ATIO queue on 24xx with target mode. + */ + if (IS_24XX(isp)) { + len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.atiodmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create ATIO DMA tag"); + goto bad1; + } + if (bus_dmamem_alloc(isp->isp_osinfo.atiodmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.atiomap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate ATIO DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); + goto bad1; + } + isp->isp_atioq = base; + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.atiodmat, isp->isp_osinfo.atiomap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading ATIO DMA map %d", im.error); + goto bad; + } + isp_prt(isp, ISP_LOGDEBUG0, "ATIO area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_atioq_dma = im.maddr; } +#endif if (IS_FC(isp)) { if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, @@ -1740,21 +1736,17 @@ isp_pci_mbxdma(ispsoftc_t *isp) for (cmap = 0; cmap < isp->isp_nchan; cmap++) { struct isp_fc *fc = ISP_FC_PC(isp, cmap); if (bus_dmamem_alloc(isp->isp_osinfo.scdmat, - (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &fc->scmap) != 0) { + (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0) goto bad; - } - im.isp = isp; - im.chan = cmap; - im.vbase = base; + FCPARAM(isp, cmap)->isp_scratch = base; im.error = 0; - bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, - base, ISP_FC_SCRLEN, imc1, &im, 0); - if (im.error) { + if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, + base, ISP_FC_SCRLEN, imc, &im, 0) || im.error) { bus_dmamem_free(isp->isp_osinfo.scdmat, base, fc->scmap); goto bad; } + FCPARAM(isp, cmap)->isp_scdma = im.maddr; if (!IS_2100(isp)) { for (i = 0; i < INITIAL_NEXUS_COUNT; i++) { struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -1808,8 +1800,38 @@ bad: } bus_dma_tag_destroy(isp->isp_osinfo.scdmat); } - bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); +bad1: + if (isp->isp_rquest_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.reqdmat, + isp->isp_osinfo.reqmap); + } + if (isp->isp_rquest != NULL) { + bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, + isp->isp_osinfo.reqmap); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + } + if (isp->isp_result_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.respdmat, + isp->isp_osinfo.respmap); + } + if (isp->isp_result != NULL) { + bus_dmamem_free(isp->isp_osinfo.respdmat, isp->isp_result, + isp->isp_osinfo.respmap); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + } +#ifdef ISP_TARGET_MODE + if (IS_24XX(isp)) { + if (isp->isp_atioq_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.atiodmat, + isp->isp_osinfo.atiomap); + } + if (isp->isp_atioq != NULL) { + bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_atioq, + isp->isp_osinfo.atiomap); + bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); + } + } +#endif free(isp->isp_xflist, M_DEVBUF); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); isp->isp_rquest = NULL; Modified: stable/10/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/10/sys/dev/isp/isp_sbus.c Wed Dec 30 11:54:09 2015 (r292928) +++ stable/10/sys/dev/isp/isp_sbus.c Wed Dec 30 11:54:37 2015 (r292929) @@ -413,7 +413,7 @@ isp_sbus_wr_reg(ispsoftc_t *isp, int reg } struct imush { - ispsoftc_t *isp; + bus_addr_t maddr; int error; }; @@ -423,16 +423,9 @@ static void imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) { struct imush *imushp = (struct imush *) arg; - if (error) { - imushp->error = error; - } else { - ispsoftc_t *isp =imushp->isp; - bus_addr_t addr = segs->ds_addr; - isp->isp_rquest_dma = addr; - addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - isp->isp_result_dma = addr; - } + if (!(imushp->error = error)) + imushp->maddr = segs[0].ds_addr; } static int @@ -479,40 +472,62 @@ isp_sbus_mbxdma(ispsoftc_t *isp) BUS_SPACE_MAXADDR_32BIT, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, ISP_NSEG_MAX, BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.dmat)) { isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return(1); + goto bad; } /* - * Allocate and map the request, result queues, plus FC scratch area. + * Allocate and map the request queue. */ len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); - - if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, - BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR_32BIT, NULL, NULL, len, 1, - BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.cdmat)) { - isp_prt(isp, ISP_LOGERR, - "cannot create a dma tag for control spaces"); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, BUS_SPACE_MAXADDR_24BIT+1, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.reqdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); + goto bad; + } + if (bus_dmamem_alloc(isp->isp_osinfo.reqdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.reqmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate request DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + goto bad; + } + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); + goto bad; } + isp_prt(isp, ISP_LOGDEBUG0, "request area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_rquest = base; + isp->isp_rquest_dma = im.maddr; - if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &isp->isp_osinfo.cdmap) != 0) { - isp_prt(isp, ISP_LOGERR, - "cannot allocate %d bytes of CCB memory", len); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - free(isp->isp_xflist, M_DEVBUF); - ISP_LOCK(isp); - return (1); + /* + * Allocate and map the result queue. + */ + len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, BUS_SPACE_MAXADDR_24BIT+1, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + len, 1, len, 0, &isp->isp_osinfo.respdmat)) { + isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); + goto bad; + } + if (bus_dmamem_alloc(isp->isp_osinfo.respdmat, (void **)&base, + BUS_DMA_COHERENT, &isp->isp_osinfo.respmap) != 0) { + isp_prt(isp, ISP_LOGERR, "cannot allocate response DMA memory"); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + goto bad; } + im.error = 0; + if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, + base, len, imc, &im, 0) || im.error) { + isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); + goto bad; + } + isp_prt(isp, ISP_LOGDEBUG0, "response area @ 0x%jx/0x%jx", + (uintmax_t)im.maddr, (uintmax_t)len); + isp->isp_result = base; + isp->isp_result_dma = im.maddr; for (i = 0; i < isp->isp_maxcmds; i++) { struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; @@ -534,25 +549,28 @@ isp_sbus_mbxdma(ispsoftc_t *isp) } } isp->isp_osinfo.pcmd_free = &isp->isp_osinfo.pcmd_pool[0]; - - im.isp = isp; - im.error = 0; - bus_dmamap_load(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap, base, len, imc, &im, 0); - if (im.error) { - isp_prt(isp, ISP_LOGERR, - "error %d loading dma map for control areas", im.error); - goto bad; - } - - isp->isp_rquest = base; - base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); - isp->isp_result = base; ISP_LOCK(isp); return (0); bad: - bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); + if (isp->isp_rquest_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.reqdmat, + isp->isp_osinfo.reqmap); + } + if (isp->isp_rquest != NULL) { + bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, + isp->isp_osinfo.reqmap); + bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); + } + if (isp->isp_result_dma != 0) { + bus_dmamap_unload(isp->isp_osinfo.respdmat, + isp->isp_osinfo.respmap); + } + if (isp->isp_result != NULL) { + bus_dmamem_free(isp->isp_osinfo.respdmat, isp->isp_result, + isp->isp_osinfo.respmap); + bus_dma_tag_destroy(isp->isp_osinfo.respdmat); + } free(isp->isp_xflist, M_DEVBUF); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); isp->isp_rquest = NULL; From owner-svn-src-stable-10@freebsd.org Wed Dec 30 11:55:20 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD5F2A55A60; Wed, 30 Dec 2015 11:55: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 98DDD153A; Wed, 30 Dec 2015 11:55: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 tBUBtJ1h051796; Wed, 30 Dec 2015 11:55:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUBtJTQ051794; Wed, 30 Dec 2015 11:55:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201512301155.tBUBtJTQ051794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Dec 2015 11:55: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: r292931 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 11:55:21 -0000 Author: mav Date: Wed Dec 30 11:55:19 2015 New Revision: 292931 URL: https://svnweb.freebsd.org/changeset/base/292931 Log: MFC r292765: Allocate separate scratch space for scanner purposes. This space does not require DMA syncing. It reduces lock scope of the DMA scratch space. It allows whole DMA scratch space to be used to I/O, so now we can fetch up to ~1000 ports from SNS. Due to the last fact, increase maximal number of ports from 256 to 1024. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Wed Dec 30 11:54:46 2015 (r292930) +++ stable/10/sys/dev/isp/isp.c Wed Dec 30 11:55:19 2015 (r292931) @@ -111,9 +111,9 @@ static void isp_mark_portdb(ispsoftc_t * static int isp_plogx(ispsoftc_t *, int, uint16_t, uint32_t, int); static int isp_port_login(ispsoftc_t *, uint16_t, uint32_t); static int isp_port_logout(ispsoftc_t *, uint16_t, uint32_t); -static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *, int); -static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int, int); -static void isp_dump_chip_portdb(ispsoftc_t *, int, int); +static int isp_getpdb(ispsoftc_t *, int, uint16_t, isp_pdb_t *); +static int isp_gethandles(ispsoftc_t *, int, uint16_t *, int *, int); +static void isp_dump_chip_portdb(ispsoftc_t *, int); static uint64_t isp_get_wwn(ispsoftc_t *, int, int, int); static int isp_fclink_test(ispsoftc_t *, int, int); static int isp_pdb_sync(ispsoftc_t *, int); @@ -2762,7 +2762,7 @@ isp_port_logout(ispsoftc_t *isp, uint16_ } static int -isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb, int dolock) +isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb) { fcparam *fcp = FCPARAM(isp, chan); mbreg_t mbs; @@ -2786,18 +2786,14 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui mbs.param[3] = DMA_WD0(fcp->isp_scdma); mbs.param[6] = DMA_WD3(fcp->isp_scdma); mbs.param[7] = DMA_WD2(fcp->isp_scdma); - if (dolock) { - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); } MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un), chan); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0] | (mbs.param[1] << 16)); } if (IS_24XX(isp)) { @@ -2813,9 +2809,7 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui un.bill.pdb_curstate); if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) { mbs.param[0] = MBOX_NOT_LOGGED_IN; - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0]); } } else { @@ -2828,15 +2822,12 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui isp_prt(isp, ISP_LOGDEBUG1, "Chan %d handle 0x%x Port 0x%06x", chan, id, pdb->portid); } - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (0); } static int -isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, - int dolock, int loop) +isp_gethandles(ispsoftc_t *isp, int chan, uint16_t *handles, int *num, int loop) { fcparam *fcp = FCPARAM(isp, chan); mbreg_t mbs; @@ -2862,18 +2853,14 @@ isp_gethandles(ispsoftc_t *isp, int chan mbs.param[3] = DMA_WD3(fcp->isp_scdma); mbs.param[6] = DMA_WD2(fcp->isp_scdma); } - if (dolock) { - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); - return (-1); - } + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); } MEMORYBARRIER(isp, SYNC_SFORDEV, 0, ISP_FC_SCRLEN, chan); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - if (dolock) { - FC_SCRATCH_RELEASE(isp, chan); - } + FC_SCRATCH_RELEASE(isp, chan); return (mbs.param[0] | (mbs.param[1] << 16)); } elp1 = fcp->isp_scratch; @@ -2901,13 +2888,12 @@ isp_gethandles(ispsoftc_t *isp, int chan handles[j++] = h; } *num = j; - if (dolock) - FC_SCRATCH_RELEASE(isp, chan); + FC_SCRATCH_RELEASE(isp, chan); return (0); } static void -isp_dump_chip_portdb(ispsoftc_t *isp, int chan, int dolock) +isp_dump_chip_portdb(ispsoftc_t *isp, int chan) { isp_pdb_t pdb; uint16_t lim, nphdl; @@ -2919,7 +2905,7 @@ isp_dump_chip_portdb(ispsoftc_t *isp, in lim = NPH_MAX; } for (nphdl = 0; nphdl != lim; nphdl++) { - if (isp_getpdb(isp, chan, nphdl, &pdb, dolock)) { + if (isp_getpdb(isp, chan, nphdl, &pdb)) { continue; } isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGINFO, "Chan %d Handle 0x%04x " @@ -3069,7 +3055,7 @@ isp_fclink_test(ispsoftc_t *isp, int cha if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) { nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID; - r = isp_getpdb(isp, chan, nphdl, &pdb, 1); + r = isp_getpdb(isp, chan, nphdl, &pdb); if (r != 0 || pdb.portid == 0) { if (IS_2100(isp)) { fcp->isp_topo = TOPO_NL_PORT; @@ -3311,7 +3297,7 @@ isp_fix_portids(ispsoftc_t *isp, int cha if (VALID_PORT(lp->portid)) continue; - r = isp_getpdb(isp, chan, lp->handle, &pdb, 1); + r = isp_getpdb(isp, chan, lp->handle, &pdb); if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) return; if (r != 0) { @@ -3340,7 +3326,7 @@ isp_scan_loop(ispsoftc_t *isp, int chan) fcparam *fcp = FCPARAM(isp, chan); int idx, lim, r; isp_pdb_t pdb; - uint16_t handles[LOCAL_LOOP_LIM]; + uint16_t *handles; uint16_t handle; if (fcp->isp_loopstate < LOOP_LTEST_DONE) @@ -3362,8 +3348,9 @@ isp_scan_loop(ispsoftc_t *isp, int chan) return (0); } - lim = LOCAL_LOOP_LIM; - r = isp_gethandles(isp, chan, handles, &lim, 1, 1); + handles = (uint16_t *)fcp->isp_scanscratch; + lim = ISP_FC_SCRLEN / 2; + r = isp_gethandles(isp, chan, handles, &lim, 1); if (r != 0) { isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Getting list of handles failed with %x", chan, r); @@ -3413,7 +3400,7 @@ abort: /* * Get the port database entity for this index. */ - r = isp_getpdb(isp, chan, handle, &pdb, 1); + r = isp_getpdb(isp, chan, handle, &pdb); if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) goto abort; if (r != 0) { @@ -3442,20 +3429,10 @@ abort: * * For the 24XX card, we have to use CT-Pass through run via the Execute IOCB * mailbox command. - * - * The net result is to leave the list of Port IDs setting untranslated in - * offset IGPOFF of the FC scratch area, whereupon we'll canonicalize it to - * host order at OGPOFF. */ - -/* - * Take half of our scratch area to store Port IDs - */ -#define GIDLEN (ISP_FC_SCRLEN >> 1) +#define GIDLEN (ISP_FC_SCRLEN - (3 * QENTRY_LEN)) #define NGENT ((GIDLEN - 16) >> 2) -#define IGPOFF (0) -#define OGPOFF (ISP_FC_SCRLEN >> 1) #define XTXOFF (ISP_FC_SCRLEN - (3 * QENTRY_LEN)) /* CT request */ #define CTXOFF (ISP_FC_SCRLEN - (2 * QENTRY_LEN)) /* Request IOCB */ #define ZTXOFF (ISP_FC_SCRLEN - (1 * QENTRY_LEN)) /* Response IOCB */ @@ -3472,21 +3449,25 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan uint8_t *scp = fcp->isp_scratch; mbreg_t mbs; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d scanning fabric (GID_FT) via SNS", chan); + 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); + } ISP_MEMZERO(rq, SNS_GID_FT_REQ_SIZE); rq->snscb_rblen = GIDLEN >> 1; - rq->snscb_addr[RQRSP_ADDR0015] = DMA_WD0(fcp->isp_scdma + IGPOFF); - rq->snscb_addr[RQRSP_ADDR1631] = DMA_WD1(fcp->isp_scdma + IGPOFF); - rq->snscb_addr[RQRSP_ADDR3247] = DMA_WD2(fcp->isp_scdma + IGPOFF); - rq->snscb_addr[RQRSP_ADDR4863] = DMA_WD3(fcp->isp_scdma + IGPOFF); + 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[CTXOFF]); - MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE, chan); + MEMORYBARRIER(isp, SYNC_SFORDEV, CTXOFF, SNS_GID_FT_REQ_SIZE, chan); MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 10000000); mbs.param[0] = MBOX_SEND_SNS; @@ -3503,6 +3484,12 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan return (-1); } } + MEMORYBARRIER(isp, SYNC_SFORCPU, 0, GIDLEN, 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); return (0); } @@ -3521,7 +3508,11 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, uint32_t *rp; uint8_t *scp = fcp->isp_scratch; - isp_prt(isp, ISP_LOGDEBUG0, "Chan %d scanning fabric (GID_FT) via CT", chan); + isp_prt(isp, ISP_LOGDEBUG0, "Chan %d requesting GID_FT via CT", chan); + if (FC_SCRATCH_ACQUIRE(isp, chan)) { + isp_prt(isp, ISP_LOGERR, sacq); + return (-1); + } /* * Build a Passthrough IOCB in memory. @@ -3541,8 +3532,8 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_count = sizeof (*ct) + sizeof (uint32_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma+IGPOFF); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma+IGPOFF); + pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); + pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); pt->ctp_dataseg[1].ds_count = GIDLEN; if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "ct IOCB", QENTRY_LEN, pt); @@ -3582,7 +3573,7 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan); + MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan); pt = &un.plocal; isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt); if (isp->isp_dblev & ISP_LOGDEBUG1) { @@ -3591,14 +3582,15 @@ isp_gid_ft_ct_passthru(ispsoftc_t *isp, if (pt->ctp_status && pt->ctp_status != RQCS_DATA_UNDERRUN) { isp_prt(isp, ISP_LOGWARN, - "Chan %d ISP GID FT CT Passthrough returned 0x%x", + "Chan %d GID_FT CT Passthrough returned 0x%x", chan, pt->ctp_status); return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan); - if (isp->isp_dblev & ISP_LOGDEBUG1) { - isp_print_bytes(isp, "CT response", GIDLEN, &scp[IGPOFF]); - } + 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); return (0); } @@ -3611,7 +3603,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha uint16_t nphdl; isp_pdb_t pdb; int portidx, portlim, r; - sns_gid_ft_rsp_t *rs0, *rs1; + sns_gid_ft_rsp_t *rs; if (fcp->isp_loopstate < LOOP_LSCAN_DONE) return (-1); @@ -3627,13 +3619,6 @@ isp_scan_fabric(ispsoftc_t *isp, int cha return (0); } - if (FC_SCRATCH_ACQUIRE(isp, chan)) { - isp_prt(isp, ISP_LOGERR, sacq); -fail: - isp_prt(isp, ISP_LOG_SANCFG, - "Chan %d FC fabric scan done (bad)", chan); - return (-1); - } if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) { abort: FC_SCRATCH_RELEASE(isp, chan); @@ -3646,14 +3631,16 @@ abort: * Make sure we still are logged into the fabric controller. */ nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID; - r = isp_getpdb(isp, chan, nphdl, &pdb, 0); + r = isp_getpdb(isp, chan, nphdl, &pdb); if ((r & 0xffff) == MBOX_NOT_LOGGED_IN) { - isp_dump_chip_portdb(isp, chan, 0); + isp_dump_chip_portdb(isp, chan); } if (r) { fcp->isp_loopstate = LOOP_LTEST_DONE; - FC_SCRATCH_RELEASE(isp, chan); - goto fail; +fail: + isp_prt(isp, ISP_LOG_SANCFG, + "Chan %d FC fabric scan done (bad)", chan); + return (-1); } /* Get list of port IDs from SNS. */ @@ -3665,42 +3652,36 @@ abort: goto abort; if (r > 0) { fcp->isp_loopstate = LOOP_FSCAN_DONE; - FC_SCRATCH_RELEASE(isp, chan); return (-1); } else if (r < 0) { fcp->isp_loopstate = LOOP_LTEST_DONE; /* try again */ - FC_SCRATCH_RELEASE(isp, chan); return (-1); } - MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan); - rs0 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+IGPOFF); - rs1 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+OGPOFF); - isp_get_gid_ft_response(isp, rs0, rs1, NGENT); + rs = (sns_gid_ft_rsp_t *) fcp->isp_scanscratch; if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; - if (rs1->snscb_cthdr.ct_cmd_resp != LS_ACC) { + if (rs->snscb_cthdr.ct_cmd_resp != LS_ACC) { int level; - if (rs1->snscb_cthdr.ct_reason == 9 && rs1->snscb_cthdr.ct_explanation == 7) { + if (rs->snscb_cthdr.ct_reason == 9 && rs->snscb_cthdr.ct_explanation == 7) { level = ISP_LOG_SANCFG; } else { level = ISP_LOGWARN; } isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_FT" " (Reason=0x%x Expl=0x%x)", chan, - rs1->snscb_cthdr.ct_reason, - rs1->snscb_cthdr.ct_explanation); - FC_SCRATCH_RELEASE(isp, chan); + rs->snscb_cthdr.ct_reason, + rs->snscb_cthdr.ct_explanation); fcp->isp_loopstate = LOOP_FSCAN_DONE; return (-1); } /* Check our buffer was big enough to get the full list. */ for (portidx = 0; portidx < NGENT-1; portidx++) { - if (rs1->snscb_ports[portidx].control & 0x80) + if (rs->snscb_ports[portidx].control & 0x80) break; } - if ((rs1->snscb_ports[portidx].control & 0x80) == 0) { + if ((rs->snscb_ports[portidx].control & 0x80) == 0) { isp_prt(isp, ISP_LOGWARN, "fabric too big for scratch area: increase ISP_FC_SCRLEN"); } @@ -3713,24 +3694,24 @@ abort: int npidx; portid = - ((rs1->snscb_ports[portidx].portid[0]) << 16) | - ((rs1->snscb_ports[portidx].portid[1]) << 8) | - ((rs1->snscb_ports[portidx].portid[2])); + ((rs->snscb_ports[portidx].portid[0]) << 16) | + ((rs->snscb_ports[portidx].portid[1]) << 8) | + ((rs->snscb_ports[portidx].portid[2])); for (npidx = portidx + 1; npidx < portlim; npidx++) { uint32_t new_portid = - ((rs1->snscb_ports[npidx].portid[0]) << 16) | - ((rs1->snscb_ports[npidx].portid[1]) << 8) | - ((rs1->snscb_ports[npidx].portid[2])); + ((rs->snscb_ports[npidx].portid[0]) << 16) | + ((rs->snscb_ports[npidx].portid[1]) << 8) | + ((rs->snscb_ports[npidx].portid[2])); if (new_portid == portid) { break; } } if (npidx < portlim) { - rs1->snscb_ports[npidx].portid[0] = 0; - rs1->snscb_ports[npidx].portid[1] = 0; - rs1->snscb_ports[npidx].portid[2] = 0; + rs->snscb_ports[npidx].portid[0] = 0; + rs->snscb_ports[npidx].portid[1] = 0; + rs->snscb_ports[npidx].portid[2] = 0; isp_prt(isp, ISP_LOG_SANCFG, "Chan %d removing duplicate PortID 0x%06x entry from list", chan, portid); } } @@ -3751,9 +3732,9 @@ abort: */ isp_mark_portdb(isp, chan); for (portidx = 0; portidx < portlim; portidx++) { - portid = ((rs1->snscb_ports[portidx].portid[0]) << 16) | - ((rs1->snscb_ports[portidx].portid[1]) << 8) | - ((rs1->snscb_ports[portidx].portid[2])); + portid = ((rs->snscb_ports[portidx].portid[0]) << 16) | + ((rs->snscb_ports[portidx].portid[1]) << 8) | + ((rs->snscb_ports[portidx].portid[2])); isp_prt(isp, ISP_LOG_SANCFG, "Chan %d Checking fabric port 0x%06x", chan, portid); if (portid == 0) { @@ -3775,7 +3756,6 @@ abort: "Chan %d Port 0x%06x@0x%04x [%d] is not probational (0x%x)", chan, lp->portid, lp->handle, FC_PORTDB_TGT(isp, chan, lp), lp->state); - FC_SCRATCH_RELEASE(isp, chan); isp_dump_portdb(isp, chan); goto fail; } @@ -3795,7 +3775,7 @@ abort: * database entry for somebody further along to * decide what to do (policy choice). */ - r = isp_getpdb(isp, chan, lp->handle, &pdb, 0); + r = isp_getpdb(isp, chan, lp->handle, &pdb); if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; if (r != 0) { @@ -3829,7 +3809,6 @@ relogin: if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) goto abort; - FC_SCRATCH_RELEASE(isp, chan); fcp->isp_loopstate = LOOP_FSCAN_DONE; isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC fabric scan done", chan); return (0); @@ -3856,7 +3835,7 @@ isp_login_device(ispsoftc_t *isp, int ch return (-1); /* Check if this handle is free. */ - r = isp_getpdb(isp, chan, handle, p, 0); + r = isp_getpdb(isp, chan, handle, p); if (r == 0) { if (p->portid != portid) { /* This handle is busy, try next one. */ @@ -3909,7 +3888,7 @@ isp_login_device(ispsoftc_t *isp, int ch * so we can crosscheck that it is still what we think it * is and that we also have the role it plays */ - r = isp_getpdb(isp, chan, handle, p, 0); + r = isp_getpdb(isp, chan, handle, p); if (r != 0) { isp_prt(isp, ISP_LOGERR, "Chan %d new device 0x%06x@0x%x disappeared", chan, portid, handle); return (-1); @@ -4013,8 +3992,8 @@ isp_register_fc4_type_24xx(ispsoftc_t *i pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_count = sizeof (rft_id_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma+IGPOFF); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma+IGPOFF); + pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); + pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); pt->ctp_dataseg[1].ds_count = sizeof (ct_hdr_t); isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); if (isp->isp_dblev & ISP_LOGDEBUG1) { @@ -4072,7 +4051,7 @@ isp_register_fc4_type_24xx(ispsoftc_t *i return (1); } - isp_get_ct_hdr(isp, (ct_hdr_t *) &scp[IGPOFF], ct); + isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); FC_SCRATCH_RELEASE(isp, chan); if (ct->ct_cmd_resp == LS_RJT) { @@ -4125,8 +4104,8 @@ isp_register_fc4_features_24xx(ispsoftc_ pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF); pt->ctp_dataseg[0].ds_count = sizeof (rff_id_t); - pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma+IGPOFF); - pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma+IGPOFF); + pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma); + pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma); pt->ctp_dataseg[1].ds_count = sizeof (ct_hdr_t); isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); if (isp->isp_dblev & ISP_LOGDEBUG1) { @@ -4189,7 +4168,7 @@ isp_register_fc4_features_24xx(ispsoftc_ return (1); } - isp_get_ct_hdr(isp, (ct_hdr_t *) &scp[IGPOFF], ct); + isp_get_ct_hdr(isp, (ct_hdr_t *) scp, ct); FC_SCRATCH_RELEASE(isp, chan); if (ct->ct_cmd_resp == LS_RJT) { @@ -4877,7 +4856,7 @@ isp_control(ispsoftc_t *isp, ispctl_t ct tgt = va_arg(ap, int); pdb = va_arg(ap, isp_pdb_t *); va_end(ap); - return (isp_getpdb(isp, chan, tgt, pdb, 1)); + return (isp_getpdb(isp, chan, tgt, pdb)); } break; Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Wed Dec 30 11:54:46 2015 (r292930) +++ stable/10/sys/dev/isp/ispvar.h Wed Dec 30 11:55:19 2015 (r292931) @@ -77,7 +77,7 @@ struct ispmdvec { */ #define MAX_TARGETS 16 #ifndef MAX_FC_TARG -#define MAX_FC_TARG 256 +#define MAX_FC_TARG 1024 #endif #define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS) #define ISP_MAX_LUNS(isp) (isp)->isp_maxluns @@ -472,6 +472,8 @@ typedef struct { */ void * isp_scratch; XS_DMA_ADDR_T isp_scdma; + + uint8_t isp_scanscratch[ISP_FC_SCRLEN]; } fcparam; #define FW_CONFIG_WAIT 0 From owner-svn-src-stable-10@freebsd.org Wed Dec 30 13:12:56 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A4FCA5514F; Wed, 30 Dec 2015 13:12:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22168161D; Wed, 30 Dec 2015 13:12:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUDCthH077635; Wed, 30 Dec 2015 13:12:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUDCsgZ077631; Wed, 30 Dec 2015 13:12:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201512301312.tBUDCsgZ077631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 30 Dec 2015 13:12: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: r292940 - in stable/10: . release share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 13:12:56 -0000 Author: gjb Date: Wed Dec 30 13:12:54 2015 New Revision: 292940 URL: https://svnweb.freebsd.org/changeset/base/292940 Log: MFC r278449, r278926: r278449: Enable multi-threaded xz(1) compression for release install media. r278926 (rpaulo): Use xz(1) via pipe when compressing the release distribution tarballs. Tested on: stable/10@r292855 Sponsored by: The FreeBSD Foundation Modified: stable/10/Makefile.inc1 stable/10/release/Makefile stable/10/release/Makefile.vm stable/10/share/mk/bsd.own.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Wed Dec 30 12:51:43 2015 (r292939) +++ stable/10/Makefile.inc1 Wed Dec 30 13:12:54 2015 (r292940) @@ -913,13 +913,13 @@ packageworld: .for dist in base ${EXTRA_DISTRIBUTIONS} .if defined(NO_ROOT) ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ - --exclude usr/lib/debug \ - @${DESTDIR}/${DISTDIR}/${dist}.meta + tar cvf - --exclude usr/lib/debug \ + @${DESTDIR}/${DISTDIR}/${dist}.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz .else ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ - --exclude usr/lib/debug . + tar cvf - --exclude usr/lib/debug . | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.txz .endif .endfor @@ -927,12 +927,12 @@ packageworld: . for dist in base ${EXTRA_DISTRIBUTIONS} . if defined(NO_ROOT) ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \ - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta + tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}.debug.txz . else ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \ - usr/lib/debug + tar cvLf - usr/lib/debug | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/${dist}-debug.txz . endif . endfor .endif @@ -1141,19 +1141,21 @@ distributekernel distributekernel.debug: packagekernel: .if defined(NO_ROOT) cd ${DESTDIR}/${DISTDIR}/kernel; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \ - @${DESTDIR}/${DISTDIR}/kernel.meta + tar cvf - @${DESTDIR}/${DISTDIR}/kernel.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \ - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta + tar cvf - @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .endfor .else cd ${DESTDIR}/${DISTDIR}/kernel; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . + tar cvf - . | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.txz .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . + tar cvf - . | \ + ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .endfor .endif Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Wed Dec 30 12:51:43 2015 (r292939) +++ stable/10/release/Makefile Wed Dec 30 13:12:54 2015 (r292940) @@ -40,7 +40,6 @@ WORLDDIR?= ${.CURDIR}/.. PORTSDIR?= /usr/ports DOCDIR?= /usr/doc RELNOTES_LANG?= en_US.ISO8859-1 -XZCMD?= /usr/bin/xz .if !defined(TARGET) || empty(TARGET) TARGET= ${MACHINE} @@ -161,16 +160,18 @@ kernel.txz: src.txz: mkdir -p ${DISTDIR}/usr ln -fs ${WORLDDIR} ${DISTDIR}/usr/src - cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ - --exclude .git --exclude @ --exclude usr/src/release/dist usr/src + cd ${DISTDIR} && tar cLvf - --exclude .svn --exclude .zfs \ + --exclude .git --exclude @ --exclude usr/src/release/dist usr/src | \ + ${XZ_CMD} > ${.OBJDIR}/src.txz ports.txz: mkdir -p ${DISTDIR}/usr ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports - cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ + cd ${DISTDIR} && tar cLvf - \ --exclude .git --exclude .svn \ --exclude usr/ports/distfiles --exclude usr/ports/packages \ - --exclude 'usr/ports/INDEX*' --exclude work usr/ports + --exclude 'usr/ports/INDEX*' --exclude work usr/ports | \ + ${XZ_CMD} > ${.OBJDIR}/ports.txz reldoc: cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ @@ -333,7 +334,7 @@ release-install: .for I in ${IMAGES} cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} . if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) - ${XZCMD} -k ${DESTDIR}/${OSRELEASE}-${I} + ${XZ_CMD} -k ${DESTDIR}/${OSRELEASE}-${I} . endif .endfor cd ${DESTDIR} && sha512 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA512 Modified: stable/10/release/Makefile.vm ============================================================================== --- stable/10/release/Makefile.vm Wed Dec 30 12:51:43 2015 (r292939) +++ stable/10/release/Makefile.vm Wed Dec 30 13:12:54 2015 (r292940) @@ -137,7 +137,7 @@ vm-install: . if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES) . for FORMAT in ${VMFORMATS} # Don't keep the originals. There is a copy in ${.OBJDIR} if needed. - ${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} + ${XZ_CMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} . endfor . endif cd ${DESTDIR}/vmimages && sha512 ${OSRELEASE}* > \ Modified: stable/10/share/mk/bsd.own.mk ============================================================================== --- stable/10/share/mk/bsd.own.mk Wed Dec 30 12:51:43 2015 (r292939) +++ stable/10/share/mk/bsd.own.mk Wed Dec 30 13:12:54 2015 (r292940) @@ -213,6 +213,15 @@ STRIP?= -s COMPRESS_CMD?= gzip -cn COMPRESS_EXT?= .gz +# Set XZ_THREADS to 1 to disable multi-threading. +XZ_THREADS?= 0 + +.if !empty(XZ_THREADS) +XZ_CMD?= xz -T ${XZ_THREADS} +.else +XZ_CMD?= xz +.endif + .if !defined(_WITHOUT_SRCCONF) # # Define MK_* variables (which are either "yes" or "no") for users From owner-svn-src-stable-10@freebsd.org Wed Dec 30 23:25:46 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0D77A563DE; Wed, 30 Dec 2015 23:25:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66DAB1437; Wed, 30 Dec 2015 23:25:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUNPjta059002; Wed, 30 Dec 2015 23:25:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUNPjwU058999; Wed, 30 Dec 2015 23:25:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201512302325.tBUNPjwU058999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 30 Dec 2015 23:25:45 +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: r292965 - stable/10/usr.sbin/pw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 23:25:46 -0000 Author: bapt Date: Wed Dec 30 23:25:45 2015 New Revision: 292965 URL: https://svnweb.freebsd.org/changeset/base/292965 Log: MFC: r292846, r292847, r292849 Restore dryrun support for pw groupmod Remove useless assignement of linelen Simplify code for parsing extra groups Modified: stable/10/usr.sbin/pw/pw_conf.c stable/10/usr.sbin/pw/pw_group.c stable/10/usr.sbin/pw/pw_vpw.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_conf.c ============================================================================== --- stable/10/usr.sbin/pw/pw_conf.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_conf.c Wed Dec 30 23:25:45 2015 (r292965) @@ -313,7 +313,7 @@ read_userconfig(char const * file) ? NULL : newstr(q); break; case _UC_EXTRAGROUPS: - for (i = 0; q != NULL; q = strtok(NULL, toks)) { + while ((q = strtok(NULL, toks)) != NULL) { if (config.groups == NULL) config.groups = sl_init(); sl_add(config.groups, newstr(q)); Modified: stable/10/usr.sbin/pw/pw_group.c ============================================================================== --- stable/10/usr.sbin/pw/pw_group.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_group.c Wed Dec 30 23:25:45 2015 (r292965) @@ -664,6 +664,11 @@ pw_group_mod(int argc, char **argv, char grp_add_members(&grp, newmembers); } + if (dryrun) { + print_group(grp, pretty); + return (EXIT_SUCCESS); + } + if ((rc = chggrent(name, grp)) != 0) { if (rc == -1) errx(EX_IOERR, "group '%s' not available (NIS?)", Modified: stable/10/usr.sbin/pw/pw_vpw.c ============================================================================== --- stable/10/usr.sbin/pw/pw_vpw.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_vpw.c Wed Dec 30 23:25:45 2015 (r292965) @@ -70,7 +70,6 @@ vnextpwent(char const *nam, uid_t uid, i pw = NULL; line = NULL; linecap = 0; - linelen = 0; if (pwd_fp != NULL || (pwd_fp = fopen(getpwpath(_MASTERPASSWD), "r")) != NULL) { while ((linelen = getline(&line, &linecap, pwd_fp)) > 0) { @@ -153,7 +152,6 @@ vnextgrent(char const *nam, gid_t gid, i gr = NULL; line = NULL; linecap = 0; - linelen = 0; if (grp_fp != NULL || (grp_fp = fopen(getgrpath(_GROUP), "r")) != NULL) { while ((linelen = getline(&line, &linecap, grp_fp)) > 0) { From owner-svn-src-stable-10@freebsd.org Thu Dec 31 01:24:17 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD962A56B68; Thu, 31 Dec 2015 01:24:17 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E12D1185; Thu, 31 Dec 2015 01:24:17 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV1OGFn095314; Thu, 31 Dec 2015 01:24:16 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV1OGSw095313; Thu, 31 Dec 2015 01:24:16 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201512310124.tBV1OGSw095313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 31 Dec 2015 01:24:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292967 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 01:24:18 -0000 Author: jamie Date: Thu Dec 31 01:24:16 2015 New Revision: 292967 URL: https://svnweb.freebsd.org/changeset/base/292967 Log: MFC r292759: Let old-style (shell-based) jail configuration handle jail names that contain characters not allowed in a shell variable (such as "-"). These will be replaced by an underscore in jail config variables, e.g. for jail "foo-bar" you would set "jail_foo_bar_hostname". This is separate from the current code that changes the jail names if they contain "." or "/". It also doesn't apply to jails defined in a jail.conf file. PR: 191181 Modified: stable/10/etc/rc.d/jail Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/jail ============================================================================== --- stable/10/etc/rc.d/jail Wed Dec 30 23:27:24 2015 (r292966) +++ stable/10/etc/rc.d/jail Thu Dec 31 01:24:16 2015 (r292967) @@ -28,16 +28,16 @@ extra_commands="config console status" need_dad_wait= -# extract_var jail name param num defval -# Extract value from ${jail_$jail_$name} or ${jail_$name} and +# extract_var jv name param num defval +# Extract value from ${jail_$jv_$name} or ${jail_$name} and # set it to $param. If not defined, $defval is used. -# When $num is [0-9]*, ${jail_$jail_$name$num} are looked up and +# When $num is [0-9]*, ${jail_$jv_$name$num} are looked up and # $param is set by using +=. # When $num is YN or NY, the value is interpret as boolean. extract_var() { - local i _j _name _param _num _def _name1 _name2 - _j=$1 + local i _jv _name _param _num _def _name1 _name2 + _jv=$1 _name=$2 _param=$3 _num=$4 @@ -45,7 +45,7 @@ extract_var() case $_num in YN) - _name1=jail_${_j}_${_name} + _name1=jail_${_jv}_${_name} _name2=jail_${_name} eval $_name1=\"\${$_name1:-\${$_name2:-$_def}}\" if checkyesno $_name1; then @@ -55,7 +55,7 @@ extract_var() fi ;; NY) - _name1=jail_${_j}_${_name} + _name1=jail_${_jv}_${_name} _name2=jail_${_name} eval $_name1=\"\${$_name1:-\${$_name2:-$_def}}\" if checkyesno $_name1; then @@ -67,7 +67,7 @@ extract_var() [0-9]*) i=$_num while : ; do - _name1=jail_${_j}_${_name}${i} + _name1=jail_${_jv}_${_name}${i} _name2=jail_${_name}${i} eval _tmpargs=\"\${$_name1:-\${$_name2:-$_def}}\" if [ -n "$_tmpargs" ]; then @@ -79,7 +79,7 @@ extract_var() done ;; *) - _name1=jail_${_j}_${_name} + _name1=jail_${_jv}_${_name} _name2=jail_${_name} eval _tmpargs=\"\${$_name1:-\${$_name2:-$_def}}\" if [ -n "$_tmpargs" ]; then @@ -89,22 +89,23 @@ extract_var() esac } -# parse_options _j +# parse_options _j _jv # Parse options and create a temporary configuration file if necessary. # parse_options() { - local _j _p + local _j _jv _p _j=$1 + _jv=$2 _confwarn=0 if [ -z "$_j" ]; then warn "parse_options: you must specify a jail" return fi - eval _jconf=\"\${jail_${_j}_conf:-/etc/jail.${_j}.conf}\" - eval _rootdir=\"\$jail_${_j}_rootdir\" - eval _hostname=\"\$jail_${_j}_hostname\" + eval _jconf=\"\${jail_${_jv}_conf:-/etc/jail.${_j}.conf}\" + eval _rootdir=\"\$jail_${_jv}_rootdir\" + eval _hostname=\"\$jail_${_jv}_hostname\" if [ -z "$_rootdir" -o \ -z "$_hostname" ]; then if [ -r "$_jconf" ]; then @@ -120,7 +121,7 @@ parse_options() fi return 1 fi - eval _ip=\"\$jail_${_j}_ip\" + eval _ip=\"\$jail_${_jv}_ip\" if [ -z "$_ip" ] && ! check_kern_features vimage; then warn "no ipaddress specified and no vimage support. " \ "Jail $_j was ignored." @@ -138,10 +139,10 @@ parse_options() fi /usr/bin/install -m 0644 -o root -g wheel /dev/null $_conf || return 1 - eval : \${jail_${_j}_flags:=${jail_flags}} - eval _exec=\"\$jail_${_j}_exec\" - eval _exec_start=\"\$jail_${_j}_exec_start\" - eval _exec_stop=\"\$jail_${_j}_exec_stop\" + eval : \${jail_${_jv}_flags:=${jail_flags}} + eval _exec=\"\$jail_${_jv}_exec\" + eval _exec_start=\"\$jail_${_jv}_exec_start\" + eval _exec_stop=\"\$jail_${_jv}_exec_stop\" if [ -n "${_exec}" ]; then # simple/backward-compatible execution _exec_start="${_exec}" @@ -155,20 +156,20 @@ parse_options() fi fi fi - eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\" - eval _parameters=\"\${jail_${_j}_parameters:-${jail_parameters}}\" - eval _fstab=\"\${jail_${_j}_fstab:-${jail_fstab:-/etc/fstab.$_j}}\" + eval _interface=\"\${jail_${_jv}_interface:-${jail_interface}}\" + eval _parameters=\"\${jail_${_jv}_parameters:-${jail_parameters}}\" + eval _fstab=\"\${jail_${_jv}_fstab:-${jail_fstab:-/etc/fstab.$_j}}\" ( date +"# Generated by rc.d/jail at %Y-%m-%d %H:%M:%S" echo "$_j {" - extract_var $_j hostname host.hostname - "" - extract_var $_j rootdir path - "" + extract_var $_jv hostname host.hostname - "" + extract_var $_jv rootdir path - "" if [ -n "$_ip" ]; then - extract_var $_j interface interface - "" + extract_var $_jv interface interface - "" jail_handle_ips_option $_ip $_interface alias=0 while : ; do - eval _x=\"\$jail_${_j}_ip_multi${alias}\" + eval _x=\"\$jail_${_jv}_ip_multi${alias}\" [ -z "$_x" ] && break jail_handle_ips_option $_x $_interface @@ -184,37 +185,37 @@ parse_options() ;; esac # These are applicable only to non-vimage jails. - extract_var $_j fib exec.fib - "" - extract_var $_j socket_unixiproute_only \ + extract_var $_jv fib exec.fib - "" + extract_var $_jv socket_unixiproute_only \ allow.raw_sockets NY YES else echo " vnet;" - extract_var $_j vnet_interface vnet.interface - "" + extract_var $_jv vnet_interface vnet.interface - "" fi echo " exec.clean;" echo " exec.system_user = \"root\";" echo " exec.jail_user = \"root\";" - extract_var $_j exec_prestart exec.prestart 0 "" - extract_var $_j exec_poststart exec.poststart 0 "" - extract_var $_j exec_prestop exec.prestop 0 "" - extract_var $_j exec_poststop exec.poststop 0 "" + extract_var $_jv exec_prestart exec.prestart 0 "" + extract_var $_jv exec_poststart exec.poststart 0 "" + extract_var $_jv exec_prestop exec.prestop 0 "" + extract_var $_jv exec_poststop exec.poststop 0 "" echo " exec.start += \"$_exec_start\";" - extract_var $_j exec_afterstart exec.start 1 "" + extract_var $_jv exec_afterstart exec.start 1 "" echo " exec.stop = \"$_exec_stop\";" - extract_var $_j consolelog exec.consolelog - \ + extract_var $_jv consolelog exec.consolelog - \ /var/log/jail_${_j}_console.log if [ -r $_fstab ]; then echo " mount.fstab = \"$_fstab\";" fi - eval : \${jail_${_j}_devfs_enable:=${jail_devfs_enable:-NO}} - if checkyesno jail_${_j}_devfs_enable; then + eval : \${jail_${_jv}_devfs_enable:=${jail_devfs_enable:-NO}} + if checkyesno jail_${_jv}_devfs_enable; then echo " mount.devfs;" - eval _ruleset=\${jail_${_j}_devfs_ruleset:-${jail_devfs_ruleset}} + eval _ruleset=\${jail_${_jv}_devfs_ruleset:-${jail_devfs_ruleset}} case $_ruleset in "") ;; [0-9]*) echo " devfs_ruleset = \"$_ruleset\";" ;; @@ -227,22 +228,22 @@ parse_options() *) warn "devfs_ruleset must be an integer." ;; esac fi - eval : \${jail_${_j}_fdescfs_enable:=${jail_fdescfs_enable:-NO}} - if checkyesno jail_${_j}_fdescfs_enable; then + eval : \${jail_${_jv}_fdescfs_enable:=${jail_fdescfs_enable:-NO}} + if checkyesno jail_${_jv}_fdescfs_enable; then echo " mount.fdescfs;" fi - eval : \${jail_${_j}_procfs_enable:=${jail_procfs_enable:-NO}} - if checkyesno jail_${_j}_procfs_enable; then + eval : \${jail_${_jv}_procfs_enable:=${jail_procfs_enable:-NO}} + if checkyesno jail_${_jv}_procfs_enable; then echo " mount.procfs;" fi - eval : \${jail_${_j}_mount_enable:=${jail_mount_enable:-NO}} - if checkyesno jail_${_j}_mount_enable; then + eval : \${jail_${_jv}_mount_enable:=${jail_mount_enable:-NO}} + if checkyesno jail_${_jv}_mount_enable; then echo " allow.mount;" >> $_conf fi - extract_var $_j set_hostname_allow allow.set_hostname YN NO - extract_var $_j sysvipc_allow allow.sysvipc YN NO + extract_var $_jv set_hostname_allow allow.set_hostname YN NO + extract_var $_jv sysvipc_allow allow.sysvipc YN NO for _p in $_parameters; do echo " ${_p%\;};" done @@ -380,14 +381,15 @@ jail_handle_ips_option() jail_config() { - local _j + local _j _jv case $1 in _ALL) return ;; esac for _j in $@; do _j=$(echo $_j | tr /. _) - if parse_options $_j; then + _jv=$(echo -n $_j | tr -c '[:alnum:]' _) + if parse_options $_j $_jv; then echo "$_j: parameters are in $_conf." fi done @@ -395,7 +397,7 @@ jail_config() jail_console() { - local _j _cmd + local _j _jv _cmd # One argument that is not _ALL. case $#:$1 in @@ -403,9 +405,10 @@ jail_console() 1:*) ;; esac _j=$(echo $1 | tr /. _) + _jv=$(echo -n $1 | tr -c '[:alnum:]' _) shift case $# in - 0) eval _cmd=\${jail_${_j}_consolecmd:-$jail_consolecmd} ;; + 0) eval _cmd=\${jail_${_jv}_consolecmd:-$jail_consolecmd} ;; *) _cmd=$@ ;; esac $jail_jexec $_j $_cmd @@ -419,7 +422,7 @@ jail_status() jail_start() { - local _j _jid _jl _id _name + local _j _jv _jid _jl _id _name if [ $# = 0 ]; then return @@ -452,11 +455,12 @@ jail_start() _jl= for _j in $@; do _j=$(echo $_j | tr /. _) - parse_options $_j || continue + _jv=$(echo -n $_j | tr -c '[:alnum:]' _) + parse_options $_j $_jv || continue _jl="$_jl $_j" - eval rc_flags=\${jail_${_j}_flags:-$jail_flags} - eval command=\${jail_${_j}_program:-$jail_program} + eval rc_flags=\${jail_${_jv}_flags:-$jail_flags} + eval command=\${jail_${_jv}_program:-$jail_program} command_args="-i -f $_conf -c $_j" $command $rc_flags $command_args \ >/dev/null 2>&1 /dev/null 2>&1; then continue fi - eval command=\${jail_${_j}_program:-$jail_program} + eval command=\${jail_${_jv}_program:-$jail_program} echo -n " ${_hostname:-${_j}}" _tmp=`mktemp -t jail` || exit 3 $command -q -f $_conf -r $_j >> $_tmp 2>&1 From owner-svn-src-stable-10@freebsd.org Thu Dec 31 01:26:44 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9757BA56C3B; Thu, 31 Dec 2015 01:26:44 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67DF8134A; Thu, 31 Dec 2015 01:26:44 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV1QhSG095463; Thu, 31 Dec 2015 01:26:43 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV1Qhhg095462; Thu, 31 Dec 2015 01:26:43 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201512310126.tBV1Qhhg095462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 31 Dec 2015 01:26: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: r292968 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 01:26:44 -0000 Author: jamie Date: Thu Dec 31 01:26:43 2015 New Revision: 292968 URL: https://svnweb.freebsd.org/changeset/base/292968 Log: MFC r287220: Fix a conversion error in rc.d/jail Modified: stable/10/etc/rc.d/jail Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/jail ============================================================================== --- stable/10/etc/rc.d/jail Thu Dec 31 01:24:16 2015 (r292967) +++ stable/10/etc/rc.d/jail Thu Dec 31 01:26:43 2015 (r292968) @@ -239,7 +239,7 @@ parse_options() eval : \${jail_${_jv}_mount_enable:=${jail_mount_enable:-NO}} if checkyesno jail_${_jv}_mount_enable; then - echo " allow.mount;" >> $_conf + echo " allow.mount;" fi extract_var $_jv set_hostname_allow allow.set_hostname YN NO From owner-svn-src-stable-10@freebsd.org Thu Dec 31 03:28:16 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7463A56C66; Thu, 31 Dec 2015 03:28:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8414217D1; Thu, 31 Dec 2015 03:28:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBV3SFkE031719; Thu, 31 Dec 2015 03:28:15 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV3SFq7031711; Thu, 31 Dec 2015 03:28:15 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512310328.tBV3SFq7031711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 31 Dec 2015 03:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292973 - in stable/10: cddl/lib/libnvpair contrib/mdocml etc/mtree lib lib/libnv share/mk sys/cddl/contrib/opensolaris/common/nvpair sys/conf sys/kern sys/modules/zfs sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 03:28:16 -0000 Author: ngie Date: Thu Dec 31 03:28:14 2015 New Revision: 292973 URL: https://svnweb.freebsd.org/changeset/base/292973 Log: MFC nv(3) and part of nv(9) to stable/10 This includes the following revisions from head: r258065,r258594,r259430,r260222,r261407,r261408,r263479,r264021,r266351, r269603,r271026,r271027,r271028,r271241,r271578,r271579,r271847,r272102, r272843,r273752,r277920,r277921,r277925,r277926,r277927,r279421,r279422, r279423,r279424,r279425,r279426,r279427,r279428,r279429,r279430,r279431, r279432,r279434,r279435,r279436,r279438,r279439,r279440,r279760,r282122, r282254,r282257,r282304,r282312,r285339,r288340 This change reverts stable/10@r282122 and stable/10@r288340, and re-MFCs the series again (r282122, r285339, and r288340). More changes are pending to nv(9)/pci(4) after further review/work. Please see the Phabricator review for more details (both https://reviews.freebsd.org/D4232 and https://reviews.freebsd.org/D4249 ). - Tested with: -- Booting VMware Fusion 8.1.0 running on a Haswell Apple Macbook Pro -- Booting a Haswell machine with zfs and running some stress workloads with VirtualBox guests -- make tinderbox -- kyua test -k /usr/tests/lib/libnv Differential Revision: https://reviews.freebsd.org/D4249 (part of a larger diff) Relnotes: yes Reviewed by: oshogbo (implicit), sbruno (implicit) Submitted by: Kevin Bowling Sponsored by: EMC / Isilon Storage Division Added: stable/10/lib/libnv/ - copied from r292857, user/ngie/stable-10-libnv/lib/libnv/ stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c stable/10/sys/kern/subr_dnvlist.c - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/kern/subr_dnvlist.c stable/10/sys/kern/subr_nvlist.c - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/kern/subr_nvlist.c stable/10/sys/kern/subr_nvpair.c - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/kern/subr_nvpair.c stable/10/sys/sys/dnv.h - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/sys/dnv.h stable/10/sys/sys/nv.h - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/sys/nv.h stable/10/sys/sys/nv_impl.h - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/sys/nv_impl.h stable/10/sys/sys/nvlist_impl.h - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/sys/nvlist_impl.h stable/10/sys/sys/nvpair_impl.h - copied unchanged from r292857, user/ngie/stable-10-libnv/sys/sys/nvpair_impl.h Deleted: stable/10/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c stable/10/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c stable/10/sys/cddl/contrib/opensolaris/common/nvpair/nvpair_alloc_fixed.c Modified: stable/10/cddl/lib/libnvpair/Makefile stable/10/contrib/mdocml/lib.in stable/10/etc/mtree/BSD.tests.dist stable/10/lib/Makefile stable/10/share/mk/bsd.libnames.mk stable/10/sys/conf/files stable/10/sys/modules/zfs/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/lib/libnvpair/Makefile ============================================================================== --- stable/10/cddl/lib/libnvpair/Makefile Thu Dec 31 02:01:20 2015 (r292972) +++ stable/10/cddl/lib/libnvpair/Makefile Thu Dec 31 03:28:14 2015 (r292973) @@ -7,10 +7,10 @@ LIB= nvpair SRCS= libnvpair.c \ nvpair_alloc_system.c \ - nvpair_alloc_fixed.c \ - nvpair.c \ nvpair_json.c \ - fnvpair.c + opensolaris_fnvpair.c \ + opensolaris_nvpair.c \ + opensolaris_nvpair_alloc_fixed.c WARNS?= 0 CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include Modified: stable/10/contrib/mdocml/lib.in ============================================================================== --- stable/10/contrib/mdocml/lib.in Thu Dec 31 02:01:20 2015 (r292972) +++ stable/10/contrib/mdocml/lib.in Thu Dec 31 03:28:14 2015 (r292973) @@ -67,6 +67,7 @@ LINE("libmemstat", "Kernel Memory Alloca LINE("libmenu", "Curses Menu Library (libmenu, \\-lmenu)") LINE("libnetgraph", "Netgraph User Library (libnetgraph, \\-lnetgraph)") LINE("libnetpgp", "Netpgp signing, verification, encryption and decryption (libnetpgp, \\-lnetpgp)") +LINE("libnv", "Name/value pairs library (libnv, \\-lnv)") LINE("libossaudio", "OSS Audio Emulation Library (libossaudio, \\-lossaudio)") LINE("libpam", "Pluggable Authentication Module Library (libpam, \\-lpam)") LINE("libpcap", "Packet Capture Library (libpcap, \\-lpcap)") Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Thu Dec 31 02:01:20 2015 (r292972) +++ stable/10/etc/mtree/BSD.tests.dist Thu Dec 31 03:28:14 2015 (r292973) @@ -144,6 +144,8 @@ .. libmp .. + libnv + .. librt .. libthr @@ -208,7 +210,6 @@ execve .. pipe - .. .. kqueue .. Modified: stable/10/lib/Makefile ============================================================================== --- stable/10/lib/Makefile Thu Dec 31 02:01:20 2015 (r292972) +++ stable/10/lib/Makefile Thu Dec 31 03:28:14 2015 (r292973) @@ -70,6 +70,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ libnetbsd \ ${_libnetgraph} \ ${_libngatm} \ + libnv \ libopie \ libpam \ libpcap \ Modified: stable/10/share/mk/bsd.libnames.mk ============================================================================== --- stable/10/share/mk/bsd.libnames.mk Thu Dec 31 02:01:20 2015 (r292972) +++ stable/10/share/mk/bsd.libnames.mk Thu Dec 31 03:28:14 2015 (r292973) @@ -100,6 +100,7 @@ LIBNCURSES?= ${DESTDIR}${LIBDIR}/libncur LIBNCURSESW?= ${DESTDIR}${LIBDIR}/libncursesw.a LIBNETGRAPH?= ${DESTDIR}${LIBDIR}/libnetgraph.a LIBNGATM?= ${DESTDIR}${LIBDIR}/libngatm.a +LIBNV?= ${DESTDIR}${LIBDIR}/libnv.a LIBNVPAIR?= ${DESTDIR}${LIBDIR}/libnvpair.a LIBOPIE?= ${DESTDIR}${LIBDIR}/libopie.a Copied: stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c (from r292857, user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c Thu Dec 31 03:28:14 2015 (r292973, copy of r292857, user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c) @@ -0,0 +1,512 @@ + +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +#include +#ifndef _KERNEL +#include +#else +#include +#include +#include +#include +#endif + +/* + * "Force" nvlist wrapper. + * + * These functions wrap the nvlist_* functions with assertions that assume + * the operation is successful. This allows the caller's code to be much + * more readable, especially for the fnvlist_lookup_* and fnvpair_value_* + * functions, which can return the requested value (rather than filling in + * a pointer). + * + * These functions use NV_UNIQUE_NAME, encoding NV_ENCODE_NATIVE, and allocate + * with KM_SLEEP. + * + * More wrappers should be added as needed -- for example + * nvlist_lookup_*_array and nvpair_value_*_array. + */ + +nvlist_t * +fnvlist_alloc(void) +{ + nvlist_t *nvl; + VERIFY0(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP)); + return (nvl); +} + +void +fnvlist_free(nvlist_t *nvl) +{ + nvlist_free(nvl); +} + +size_t +fnvlist_size(nvlist_t *nvl) +{ + size_t size; + VERIFY0(nvlist_size(nvl, &size, NV_ENCODE_NATIVE)); + return (size); +} + +/* + * Returns allocated buffer of size *sizep. Caller must free the buffer with + * fnvlist_pack_free(). + */ +char * +fnvlist_pack(nvlist_t *nvl, size_t *sizep) +{ + char *packed = 0; + VERIFY3U(nvlist_pack(nvl, &packed, sizep, NV_ENCODE_NATIVE, + KM_SLEEP), ==, 0); + return (packed); +} + +/*ARGSUSED*/ +void +fnvlist_pack_free(char *pack, size_t size) +{ +#ifdef _KERNEL + kmem_free(pack, size); +#else + free(pack); +#endif +} + +nvlist_t * +fnvlist_unpack(char *buf, size_t buflen) +{ + nvlist_t *rv; + VERIFY0(nvlist_unpack(buf, buflen, &rv, KM_SLEEP)); + return (rv); +} + +nvlist_t * +fnvlist_dup(nvlist_t *nvl) +{ + nvlist_t *rv; + VERIFY0(nvlist_dup(nvl, &rv, KM_SLEEP)); + return (rv); +} + +void +fnvlist_merge(nvlist_t *dst, nvlist_t *src) +{ + VERIFY0(nvlist_merge(dst, src, KM_SLEEP)); +} + +size_t +fnvlist_num_pairs(nvlist_t *nvl) +{ + size_t count = 0; + nvpair_t *pair; + + for (pair = nvlist_next_nvpair(nvl, 0); pair != NULL; + pair = nvlist_next_nvpair(nvl, pair)) + count++; + return (count); +} + +void +fnvlist_add_boolean(nvlist_t *nvl, const char *name) +{ + VERIFY0(nvlist_add_boolean(nvl, name)); +} + +void +fnvlist_add_boolean_value(nvlist_t *nvl, const char *name, boolean_t val) +{ + VERIFY0(nvlist_add_boolean_value(nvl, name, val)); +} + +void +fnvlist_add_byte(nvlist_t *nvl, const char *name, uchar_t val) +{ + VERIFY0(nvlist_add_byte(nvl, name, val)); +} + +void +fnvlist_add_int8(nvlist_t *nvl, const char *name, int8_t val) +{ + VERIFY0(nvlist_add_int8(nvl, name, val)); +} + +void +fnvlist_add_uint8(nvlist_t *nvl, const char *name, uint8_t val) +{ + VERIFY0(nvlist_add_uint8(nvl, name, val)); +} + +void +fnvlist_add_int16(nvlist_t *nvl, const char *name, int16_t val) +{ + VERIFY0(nvlist_add_int16(nvl, name, val)); +} + +void +fnvlist_add_uint16(nvlist_t *nvl, const char *name, uint16_t val) +{ + VERIFY0(nvlist_add_uint16(nvl, name, val)); +} + +void +fnvlist_add_int32(nvlist_t *nvl, const char *name, int32_t val) +{ + VERIFY0(nvlist_add_int32(nvl, name, val)); +} + +void +fnvlist_add_uint32(nvlist_t *nvl, const char *name, uint32_t val) +{ + VERIFY0(nvlist_add_uint32(nvl, name, val)); +} + +void +fnvlist_add_int64(nvlist_t *nvl, const char *name, int64_t val) +{ + VERIFY0(nvlist_add_int64(nvl, name, val)); +} + +void +fnvlist_add_uint64(nvlist_t *nvl, const char *name, uint64_t val) +{ + VERIFY0(nvlist_add_uint64(nvl, name, val)); +} + +void +fnvlist_add_string(nvlist_t *nvl, const char *name, const char *val) +{ + VERIFY0(nvlist_add_string(nvl, name, val)); +} + +void +fnvlist_add_nvlist(nvlist_t *nvl, const char *name, nvlist_t *val) +{ + VERIFY0(nvlist_add_nvlist(nvl, name, val)); +} + +void +fnvlist_add_nvpair(nvlist_t *nvl, nvpair_t *pair) +{ + VERIFY0(nvlist_add_nvpair(nvl, pair)); +} + +void +fnvlist_add_boolean_array(nvlist_t *nvl, const char *name, + boolean_t *val, uint_t n) +{ + VERIFY0(nvlist_add_boolean_array(nvl, name, val, n)); +} + +void +fnvlist_add_byte_array(nvlist_t *nvl, const char *name, uchar_t *val, uint_t n) +{ + VERIFY0(nvlist_add_byte_array(nvl, name, val, n)); +} + +void +fnvlist_add_int8_array(nvlist_t *nvl, const char *name, int8_t *val, uint_t n) +{ + VERIFY0(nvlist_add_int8_array(nvl, name, val, n)); +} + +void +fnvlist_add_uint8_array(nvlist_t *nvl, const char *name, uint8_t *val, uint_t n) +{ + VERIFY0(nvlist_add_uint8_array(nvl, name, val, n)); +} + +void +fnvlist_add_int16_array(nvlist_t *nvl, const char *name, int16_t *val, uint_t n) +{ + VERIFY0(nvlist_add_int16_array(nvl, name, val, n)); +} + +void +fnvlist_add_uint16_array(nvlist_t *nvl, const char *name, + uint16_t *val, uint_t n) +{ + VERIFY0(nvlist_add_uint16_array(nvl, name, val, n)); +} + +void +fnvlist_add_int32_array(nvlist_t *nvl, const char *name, int32_t *val, uint_t n) +{ + VERIFY0(nvlist_add_int32_array(nvl, name, val, n)); +} + +void +fnvlist_add_uint32_array(nvlist_t *nvl, const char *name, + uint32_t *val, uint_t n) +{ + VERIFY0(nvlist_add_uint32_array(nvl, name, val, n)); +} + +void +fnvlist_add_int64_array(nvlist_t *nvl, const char *name, int64_t *val, uint_t n) +{ + VERIFY0(nvlist_add_int64_array(nvl, name, val, n)); +} + +void +fnvlist_add_uint64_array(nvlist_t *nvl, const char *name, + uint64_t *val, uint_t n) +{ + VERIFY0(nvlist_add_uint64_array(nvl, name, val, n)); +} + +void +fnvlist_add_string_array(nvlist_t *nvl, const char *name, + char * const *val, uint_t n) +{ + VERIFY0(nvlist_add_string_array(nvl, name, val, n)); +} + +void +fnvlist_add_nvlist_array(nvlist_t *nvl, const char *name, + nvlist_t **val, uint_t n) +{ + VERIFY0(nvlist_add_nvlist_array(nvl, name, val, n)); +} + +void +fnvlist_remove(nvlist_t *nvl, const char *name) +{ + VERIFY0(nvlist_remove_all(nvl, name)); +} + +void +fnvlist_remove_nvpair(nvlist_t *nvl, nvpair_t *pair) +{ + VERIFY0(nvlist_remove_nvpair(nvl, pair)); +} + +nvpair_t * +fnvlist_lookup_nvpair(nvlist_t *nvl, const char *name) +{ + nvpair_t *rv; + VERIFY0(nvlist_lookup_nvpair(nvl, name, &rv)); + return (rv); +} + +/* returns B_TRUE if the entry exists */ +boolean_t +fnvlist_lookup_boolean(nvlist_t *nvl, const char *name) +{ + return (nvlist_lookup_boolean(nvl, name) == 0); +} + +boolean_t +fnvlist_lookup_boolean_value(nvlist_t *nvl, const char *name) +{ + boolean_t rv; + VERIFY0(nvlist_lookup_boolean_value(nvl, name, &rv)); + return (rv); +} + +uchar_t +fnvlist_lookup_byte(nvlist_t *nvl, const char *name) +{ + uchar_t rv; + VERIFY0(nvlist_lookup_byte(nvl, name, &rv)); + return (rv); +} + +int8_t +fnvlist_lookup_int8(nvlist_t *nvl, const char *name) +{ + int8_t rv; + VERIFY0(nvlist_lookup_int8(nvl, name, &rv)); + return (rv); +} + +int16_t +fnvlist_lookup_int16(nvlist_t *nvl, const char *name) +{ + int16_t rv; + VERIFY0(nvlist_lookup_int16(nvl, name, &rv)); + return (rv); +} + +int32_t +fnvlist_lookup_int32(nvlist_t *nvl, const char *name) +{ + int32_t rv; + VERIFY0(nvlist_lookup_int32(nvl, name, &rv)); + return (rv); +} + +int64_t +fnvlist_lookup_int64(nvlist_t *nvl, const char *name) +{ + int64_t rv; + VERIFY0(nvlist_lookup_int64(nvl, name, &rv)); + return (rv); +} + +uint8_t +fnvlist_lookup_uint8_t(nvlist_t *nvl, const char *name) +{ + uint8_t rv; + VERIFY0(nvlist_lookup_uint8(nvl, name, &rv)); + return (rv); +} + +uint16_t +fnvlist_lookup_uint16(nvlist_t *nvl, const char *name) +{ + uint16_t rv; + VERIFY0(nvlist_lookup_uint16(nvl, name, &rv)); + return (rv); +} + +uint32_t +fnvlist_lookup_uint32(nvlist_t *nvl, const char *name) +{ + uint32_t rv; + VERIFY0(nvlist_lookup_uint32(nvl, name, &rv)); + return (rv); +} + +uint64_t +fnvlist_lookup_uint64(nvlist_t *nvl, const char *name) +{ + uint64_t rv; + VERIFY0(nvlist_lookup_uint64(nvl, name, &rv)); + return (rv); +} + +char * +fnvlist_lookup_string(nvlist_t *nvl, const char *name) +{ + char *rv; + VERIFY0(nvlist_lookup_string(nvl, name, &rv)); + return (rv); +} + +nvlist_t * +fnvlist_lookup_nvlist(nvlist_t *nvl, const char *name) +{ + nvlist_t *rv; + VERIFY0(nvlist_lookup_nvlist(nvl, name, &rv)); + return (rv); +} + +boolean_t +fnvpair_value_boolean_value(nvpair_t *nvp) +{ + boolean_t rv; + VERIFY0(nvpair_value_boolean_value(nvp, &rv)); + return (rv); +} + +uchar_t +fnvpair_value_byte(nvpair_t *nvp) +{ + uchar_t rv; + VERIFY0(nvpair_value_byte(nvp, &rv)); + return (rv); +} + +int8_t +fnvpair_value_int8(nvpair_t *nvp) +{ + int8_t rv; + VERIFY0(nvpair_value_int8(nvp, &rv)); + return (rv); +} + +int16_t +fnvpair_value_int16(nvpair_t *nvp) +{ + int16_t rv; + VERIFY0(nvpair_value_int16(nvp, &rv)); + return (rv); +} + +int32_t +fnvpair_value_int32(nvpair_t *nvp) +{ + int32_t rv; + VERIFY0(nvpair_value_int32(nvp, &rv)); + return (rv); +} + +int64_t +fnvpair_value_int64(nvpair_t *nvp) +{ + int64_t rv; + VERIFY0(nvpair_value_int64(nvp, &rv)); + return (rv); +} + +uint8_t +fnvpair_value_uint8_t(nvpair_t *nvp) +{ + uint8_t rv; + VERIFY0(nvpair_value_uint8(nvp, &rv)); + return (rv); +} + +uint16_t +fnvpair_value_uint16(nvpair_t *nvp) +{ + uint16_t rv; + VERIFY0(nvpair_value_uint16(nvp, &rv)); + return (rv); +} + +uint32_t +fnvpair_value_uint32(nvpair_t *nvp) +{ + uint32_t rv; + VERIFY0(nvpair_value_uint32(nvp, &rv)); + return (rv); +} + +uint64_t +fnvpair_value_uint64(nvpair_t *nvp) +{ + uint64_t rv; + VERIFY0(nvpair_value_uint64(nvp, &rv)); + return (rv); +} + +char * +fnvpair_value_string(nvpair_t *nvp) +{ + char *rv; + VERIFY0(nvpair_value_string(nvp, &rv)); + return (rv); +} + +nvlist_t * +fnvpair_value_nvlist(nvpair_t *nvp) +{ + nvlist_t *rv; + VERIFY0(nvpair_value_nvlist(nvp, &rv)); + return (rv); +} Copied: stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c (from r292857, user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Thu Dec 31 03:28:14 2015 (r292973, copy of r292857, user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c) @@ -0,0 +1,3306 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + */ + +#include +#include +#include +#include +#include + +#if defined(_KERNEL) && !defined(_BOOT) +#include +#include +#else +#include +#include +#include +#include +#endif + +#ifndef offsetof +#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) +#endif +#define skip_whitespace(p) while ((*(p) == ' ') || (*(p) == '\t')) p++ + +#if defined(__FreeBSD__) && !defined(_KERNEL) +/* + * libnvpair is the lowest commen denominator for ZFS related libraries, + * defining aok here makes it usable by all ZFS related libraries + */ +int aok; +#endif + +/* + * nvpair.c - Provides kernel & userland interfaces for manipulating + * name-value pairs. + * + * Overview Diagram + * + * +--------------+ + * | nvlist_t | + * |--------------| + * | nvl_version | + * | nvl_nvflag | + * | nvl_priv -+-+ + * | nvl_flag | | + * | nvl_pad | | + * +--------------+ | + * V + * +--------------+ last i_nvp in list + * | nvpriv_t | +---------------------> + * |--------------| | + * +--+- nvp_list | | +------------+ + * | | nvp_last -+--+ + nv_alloc_t | + * | | nvp_curr | |------------| + * | | nvp_nva -+----> | nva_ops | + * | | nvp_stat | | nva_arg | + * | +--------------+ +------------+ + * | + * +-------+ + * V + * +---------------------+ +-------------------+ + * | i_nvp_t | +-->| i_nvp_t | +--> + * |---------------------| | |-------------------| | + * | nvi_next -+--+ | nvi_next -+--+ + * | nvi_prev (NULL) | <----+ nvi_prev | + * | . . . . . . . . . . | | . . . . . . . . . | + * | nvp (nvpair_t) | | nvp (nvpair_t) | + * | - nvp_size | | - nvp_size | + * | - nvp_name_sz | | - nvp_name_sz | + * | - nvp_value_elem | | - nvp_value_elem | + * | - nvp_type | | - nvp_type | + * | - data ... | | - data ... | + * +---------------------+ +-------------------+ + * + * + * + * +---------------------+ +---------------------+ + * | i_nvp_t | +--> +-->| i_nvp_t (last) | + * |---------------------| | | |---------------------| + * | nvi_next -+--+ ... --+ | nvi_next (NULL) | + * <-+- nvi_prev |<-- ... <----+ nvi_prev | + * | . . . . . . . . . | | . . . . . . . . . | + * | nvp (nvpair_t) | | nvp (nvpair_t) | + * | - nvp_size | | - nvp_size | + * | - nvp_name_sz | | - nvp_name_sz | + * | - nvp_value_elem | | - nvp_value_elem | + * | - DATA_TYPE_NVLIST | | - nvp_type | + * | - data (embedded) | | - data ... | + * | nvlist name | +---------------------+ + * | +--------------+ | + * | | nvlist_t | | + * | |--------------| | + * | | nvl_version | | + * | | nvl_nvflag | | + * | | nvl_priv --+---+----> + * | | nvl_flag | | + * | | nvl_pad | | + * | +--------------+ | + * +---------------------+ + * + * + * N.B. nvpair_t may be aligned on 4 byte boundary, so +4 will + * allow value to be aligned on 8 byte boundary + * + * name_len is the length of the name string including the null terminator + * so it must be >= 1 + */ +#define NVP_SIZE_CALC(name_len, data_len) \ + (NV_ALIGN((sizeof (nvpair_t)) + name_len) + NV_ALIGN(data_len)) + +static int i_get_value_size(data_type_t type, const void *data, uint_t nelem); +static int nvlist_add_common(nvlist_t *nvl, const char *name, data_type_t type, + uint_t nelem, const void *data); + +#define NV_STAT_EMBEDDED 0x1 +#define EMBEDDED_NVL(nvp) ((nvlist_t *)(void *)NVP_VALUE(nvp)) +#define EMBEDDED_NVL_ARRAY(nvp) ((nvlist_t **)(void *)NVP_VALUE(nvp)) + +#define NVP_VALOFF(nvp) (NV_ALIGN(sizeof (nvpair_t) + (nvp)->nvp_name_sz)) +#define NVPAIR2I_NVP(nvp) \ + ((i_nvp_t *)((size_t)(nvp) - offsetof(i_nvp_t, nvi_nvp))) + + +int +nv_alloc_init(nv_alloc_t *nva, const nv_alloc_ops_t *nvo, /* args */ ...) +{ + va_list valist; + int err = 0; + + nva->nva_ops = nvo; + nva->nva_arg = NULL; + + va_start(valist, nvo); + if (nva->nva_ops->nv_ao_init != NULL) + err = nva->nva_ops->nv_ao_init(nva, valist); + va_end(valist); + + return (err); +} + +void +nv_alloc_reset(nv_alloc_t *nva) +{ + if (nva->nva_ops->nv_ao_reset != NULL) + nva->nva_ops->nv_ao_reset(nva); +} + +void +nv_alloc_fini(nv_alloc_t *nva) +{ + if (nva->nva_ops->nv_ao_fini != NULL) + nva->nva_ops->nv_ao_fini(nva); +} + +nv_alloc_t * +nvlist_lookup_nv_alloc(nvlist_t *nvl) +{ + nvpriv_t *priv; + + if (nvl == NULL || + (priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv) == NULL) + return (NULL); + + return (priv->nvp_nva); +} + +static void * +nv_mem_zalloc(nvpriv_t *nvp, size_t size) +{ + nv_alloc_t *nva = nvp->nvp_nva; + void *buf; + + if ((buf = nva->nva_ops->nv_ao_alloc(nva, size)) != NULL) + bzero(buf, size); + + return (buf); +} + +static void +nv_mem_free(nvpriv_t *nvp, void *buf, size_t size) +{ + nv_alloc_t *nva = nvp->nvp_nva; + + nva->nva_ops->nv_ao_free(nva, buf, size); +} + +static void +nv_priv_init(nvpriv_t *priv, nv_alloc_t *nva, uint32_t stat) +{ + bzero(priv, sizeof (nvpriv_t)); + + priv->nvp_nva = nva; + priv->nvp_stat = stat; +} + +static nvpriv_t * +nv_priv_alloc(nv_alloc_t *nva) +{ + nvpriv_t *priv; + + /* + * nv_mem_alloc() cannot called here because it needs the priv + * argument. + */ + if ((priv = nva->nva_ops->nv_ao_alloc(nva, sizeof (nvpriv_t))) == NULL) + return (NULL); + + nv_priv_init(priv, nva, 0); + + return (priv); +} + +/* + * Embedded lists need their own nvpriv_t's. We create a new + * nvpriv_t using the parameters and allocator from the parent + * list's nvpriv_t. + */ +static nvpriv_t * +nv_priv_alloc_embedded(nvpriv_t *priv) +{ + nvpriv_t *emb_priv; + + if ((emb_priv = nv_mem_zalloc(priv, sizeof (nvpriv_t))) == NULL) + return (NULL); + + nv_priv_init(emb_priv, priv->nvp_nva, NV_STAT_EMBEDDED); + + return (emb_priv); +} + +static void +nvlist_init(nvlist_t *nvl, uint32_t nvflag, nvpriv_t *priv) +{ + nvl->nvl_version = NV_VERSION; + nvl->nvl_nvflag = nvflag & (NV_UNIQUE_NAME|NV_UNIQUE_NAME_TYPE); + nvl->nvl_priv = (uint64_t)(uintptr_t)priv; + nvl->nvl_flag = 0; + nvl->nvl_pad = 0; +} + +uint_t +nvlist_nvflag(nvlist_t *nvl) +{ + return (nvl->nvl_nvflag); +} + +/* + * nvlist_alloc - Allocate nvlist. + */ +/*ARGSUSED1*/ +int +nvlist_alloc(nvlist_t **nvlp, uint_t nvflag, int kmflag) +{ +#if defined(_KERNEL) && !defined(_BOOT) + return (nvlist_xalloc(nvlp, nvflag, + (kmflag == KM_SLEEP ? nv_alloc_sleep : nv_alloc_nosleep))); +#else + return (nvlist_xalloc(nvlp, nvflag, nv_alloc_nosleep)); +#endif +} + +int +nvlist_xalloc(nvlist_t **nvlp, uint_t nvflag, nv_alloc_t *nva) +{ + nvpriv_t *priv; + + if (nvlp == NULL || nva == NULL) + return (EINVAL); + + if ((priv = nv_priv_alloc(nva)) == NULL) + return (ENOMEM); + + if ((*nvlp = nv_mem_zalloc(priv, + NV_ALIGN(sizeof (nvlist_t)))) == NULL) { + nv_mem_free(priv, priv, sizeof (nvpriv_t)); + return (ENOMEM); + } + + nvlist_init(*nvlp, nvflag, priv); + + return (0); +} + +/* + * nvp_buf_alloc - Allocate i_nvp_t for storing a new nv pair. + */ +static nvpair_t * +nvp_buf_alloc(nvlist_t *nvl, size_t len) +{ + nvpriv_t *priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv; + i_nvp_t *buf; + nvpair_t *nvp; + size_t nvsize; + + /* + * Allocate the buffer + */ + nvsize = len + offsetof(i_nvp_t, nvi_nvp); + + if ((buf = nv_mem_zalloc(priv, nvsize)) == NULL) + return (NULL); + + nvp = &buf->nvi_nvp; + nvp->nvp_size = len; + + return (nvp); +} + +/* + * nvp_buf_free - de-Allocate an i_nvp_t. + */ +static void +nvp_buf_free(nvlist_t *nvl, nvpair_t *nvp) +{ + nvpriv_t *priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv; + size_t nvsize = nvp->nvp_size + offsetof(i_nvp_t, nvi_nvp); + + nv_mem_free(priv, NVPAIR2I_NVP(nvp), nvsize); +} + +/* + * nvp_buf_link - link a new nv pair into the nvlist. + */ +static void +nvp_buf_link(nvlist_t *nvl, nvpair_t *nvp) +{ + nvpriv_t *priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv; + i_nvp_t *curr = NVPAIR2I_NVP(nvp); + + /* Put element at end of nvlist */ + if (priv->nvp_list == NULL) { + priv->nvp_list = priv->nvp_last = curr; + } else { + curr->nvi_prev = priv->nvp_last; + priv->nvp_last->nvi_next = curr; + priv->nvp_last = curr; + } +} + +/* + * nvp_buf_unlink - unlink an removed nvpair out of the nvlist. + */ +static void +nvp_buf_unlink(nvlist_t *nvl, nvpair_t *nvp) +{ + nvpriv_t *priv = (nvpriv_t *)(uintptr_t)nvl->nvl_priv; + i_nvp_t *curr = NVPAIR2I_NVP(nvp); + + /* + * protect nvlist_next_nvpair() against walking on freed memory. + */ + if (priv->nvp_curr == curr) + priv->nvp_curr = curr->nvi_next; + + if (curr == priv->nvp_list) + priv->nvp_list = curr->nvi_next; + else + curr->nvi_prev->nvi_next = curr->nvi_next; + + if (curr == priv->nvp_last) + priv->nvp_last = curr->nvi_prev; + else + curr->nvi_next->nvi_prev = curr->nvi_prev; +} + +/* + * take a nvpair type and number of elements and make sure the are valid + */ +static int +i_validate_type_nelem(data_type_t type, uint_t nelem) +{ + switch (type) { + case DATA_TYPE_BOOLEAN: + if (nelem != 0) + return (EINVAL); + break; + case DATA_TYPE_BOOLEAN_VALUE: + case DATA_TYPE_BYTE: + case DATA_TYPE_INT8: + case DATA_TYPE_UINT8: + case DATA_TYPE_INT16: + case DATA_TYPE_UINT16: + case DATA_TYPE_INT32: + case DATA_TYPE_UINT32: + case DATA_TYPE_INT64: + case DATA_TYPE_UINT64: + case DATA_TYPE_STRING: + case DATA_TYPE_HRTIME: + case DATA_TYPE_NVLIST: +#if !defined(_KERNEL) + case DATA_TYPE_DOUBLE: +#endif + if (nelem != 1) + return (EINVAL); + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Thu Dec 31 03:55:03 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C98BA576BD; Thu, 31 Dec 2015 03:55:03 +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 69DDD18F0; Thu, 31 Dec 2015 03:55:03 +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 tBV3t25K040657; Thu, 31 Dec 2015 03:55:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV3t2VG040656; Thu, 31 Dec 2015 03:55:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512310355.tBV3t2VG040656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 31 Dec 2015 03:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292975 - stable/10/sys/dev/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 03:55:03 -0000 Author: ngie Date: Thu Dec 31 03:55:02 2015 New Revision: 292975 URL: https://svnweb.freebsd.org/changeset/base/292975 Log: MFC r278860: r278860 (by jmg): remove NULL check as M_WAITOK will not return NULL Reviewed by: jhb Sponsored by: FreeBSD Foundation Modified: stable/10/sys/dev/pci/pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/pci/pci.c ============================================================================== --- stable/10/sys/dev/pci/pci.c Thu Dec 31 03:32:43 2015 (r292974) +++ stable/10/sys/dev/pci/pci.c Thu Dec 31 03:55:02 2015 (r292975) @@ -615,8 +615,6 @@ pci_read_device(device_t pcib, int d, in if (REG(PCIR_DEVVENDOR, 4) != 0xfffffffful) { devlist_entry = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); - if (devlist_entry == NULL) - return (NULL); cfg = &devlist_entry->cfg; From owner-svn-src-stable-10@freebsd.org Thu Dec 31 06:01:08 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 701B2A56D36; Thu, 31 Dec 2015 06:01:08 +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 3BD161A69; Thu, 31 Dec 2015 06:01:08 +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 tBV617ci078030; Thu, 31 Dec 2015 06:01:07 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBV6173E078029; Thu, 31 Dec 2015 06:01:07 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201512310601.tBV6173E078029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 31 Dec 2015 06:01: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: r292979 - stable/10/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 06:01:08 -0000 Author: cy Date: Thu Dec 31 06:01:07 2015 New Revision: 292979 URL: https://svnweb.freebsd.org/changeset/base/292979 Log: MFC r292813. Correct __FreeBSD__ check. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Thu Dec 31 05:03:27 2015 (r292978) +++ stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Thu Dec 31 06:01:07 2015 (r292979) @@ -5235,7 +5235,7 @@ ipf_nat_out(fin, nat, natadd, nflags) uh->uh_ulen += fin->fin_plen; uh->uh_ulen = htons(uh->uh_ulen); #if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \ - defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD) + defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD__) ipf_fix_outcksum(0, &ip->ip_sum, sumd, 0); #endif From owner-svn-src-stable-10@freebsd.org Thu Dec 31 11:23:40 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA5E6A57766; Thu, 31 Dec 2015 11:23:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D5C51A1C; Thu, 31 Dec 2015 11:23:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVBNdan076049; Thu, 31 Dec 2015 11:23:39 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVBNdoL076047; Thu, 31 Dec 2015 11:23:39 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201512311123.tBVBNdoL076047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 31 Dec 2015 11:23: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: r292984 - in stable/10: . sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 11:23:40 -0000 Author: bz Date: Thu Dec 31 11:23:39 2015 New Revision: 292984 URL: https://svnweb.freebsd.org/changeset/base/292984 Log: MFC r292983: Bump copyright year. Happy New Year 2016! Modified: stable/10/COPYRIGHT stable/10/sys/sys/copyright.h Directory Properties: stable/10/ (props changed) Modified: stable/10/COPYRIGHT ============================================================================== --- stable/10/COPYRIGHT Thu Dec 31 11:21:45 2015 (r292983) +++ stable/10/COPYRIGHT Thu Dec 31 11:23:39 2015 (r292984) @@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (c) 1992-2015 The FreeBSD Project. All rights reserved. +Copyright (c) 1992-2016 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 Modified: stable/10/sys/sys/copyright.h ============================================================================== --- stable/10/sys/sys/copyright.h Thu Dec 31 11:21:45 2015 (r292983) +++ stable/10/sys/sys/copyright.h Thu Dec 31 11:23:39 2015 (r292984) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 1992-2015 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2016 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 @@ -30,7 +30,7 @@ /* FreeBSD */ #define COPYRIGHT_FreeBSD \ - "Copyright (c) 1992-2015 The FreeBSD Project.\n" + "Copyright (c) 1992-2016 The FreeBSD Project.\n" /* Foundation */ #define TRADEMARK_Foundation \ From owner-svn-src-stable-10@freebsd.org Thu Dec 31 16:58:13 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98C91A56BB4; Thu, 31 Dec 2015 16:58:13 +0000 (UTC) (envelope-from john@baldwin.cx) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71A0712D5; Thu, 31 Dec 2015 16:58:13 +0000 (UTC) (envelope-from john@baldwin.cx) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2831CB946; Thu, 31 Dec 2015 11:58:11 -0500 (EST) From: John Baldwin To: Garrett Cooper 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: r292975 - stable/10/sys/dev/pci Date: Thu, 31 Dec 2015 08:42:51 -0800 Message-ID: <2893860.oDiG4KQizb@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201512310355.tBV3t2VG040656@repo.freebsd.org> References: <201512310355.tBV3t2VG040656@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 31 Dec 2015 11:58:11 -0500 (EST) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 16:58:13 -0000 On Thursday, December 31, 2015 03:55:02 AM Garrett Cooper wrote: > Author: ngie > Date: Thu Dec 31 03:55:02 2015 > New Revision: 292975 > URL: https://svnweb.freebsd.org/changeset/base/292975 > > Log: > MFC r278860: > r278860 (by jmg): > > remove NULL check as M_WAITOK will not return NULL > > Reviewed by: jhb > Sponsored by: FreeBSD Foundation Including the metadata from the HEAD commit in the MFC can be misleading, and I think it is best ommitted. For example, I did not review this MFC (and reviewing MFC's in their own right matters since they may require additional work than commits to HEAD due to ABI concerns), nor did the Foundation sponsor the MFC. Rather, I think MFCs should only specify metadata related to the actual merge itself. -- John Baldwin From owner-svn-src-stable-10@freebsd.org Thu Dec 31 19:32:48 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5260BA570BA; Thu, 31 Dec 2015 19:32:48 +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 1ED09159A; Thu, 31 Dec 2015 19:32:48 +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 tBVJWlDT022541; Thu, 31 Dec 2015 19:32:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVJWl0i022540; Thu, 31 Dec 2015 19:32:47 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512311932.tBVJWl0i022540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 31 Dec 2015 19:32: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: r292998 - stable/10/contrib/bsnmp/snmpd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 19:32:48 -0000 Author: ngie Date: Thu Dec 31 19:32:46 2015 New Revision: 292998 URL: https://svnweb.freebsd.org/changeset/base/292998 Log: MFC r292710: Remove unused function `act_getkernstring` This fixes a clang -Wunused warning Differential Revision: https://reviews.freebsd.org/D4697 Reported by: Jenkins Reviewed by: araujo, bapt Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/bsnmp/snmpd/action.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bsnmp/snmpd/action.c ============================================================================== --- stable/10/contrib/bsnmp/snmpd/action.c Thu Dec 31 19:25:35 2015 (r292997) +++ stable/10/contrib/bsnmp/snmpd/action.c Thu Dec 31 19:32:46 2015 (r292998) @@ -60,29 +60,6 @@ static const struct asn_oid #endif /* - * Get a string value from the KERN sysctl subtree. - */ -static char * -act_getkernstring(int id) -{ - int mib[2]; - size_t len; - char *string; - - mib[0] = CTL_KERN; - mib[1] = id; - if (sysctl(mib, 2, NULL, &len, NULL, 0) != 0) - return (NULL); - if ((string = malloc(len)) == NULL) - return (NULL); - if (sysctl(mib, 2, string, &len, NULL, 0) != 0) { - free(string); - return (NULL); - } - return (string); -} - -/* * Get an integer value from the KERN sysctl subtree. */ static char * From owner-svn-src-stable-10@freebsd.org Thu Dec 31 20:25:28 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B464A56336; Thu, 31 Dec 2015 20:25:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D46D712A4; Thu, 31 Dec 2015 20:25:27 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBVKPQoX037488; Thu, 31 Dec 2015 20:25:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBVKPQoK037487; Thu, 31 Dec 2015 20:25:26 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201512312025.tBVKPQoK037487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 31 Dec 2015 20:25: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: r293003 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 20:25:28 -0000 Author: ngie Date: Thu Dec 31 20:25:26 2015 New Revision: 293003 URL: https://svnweb.freebsd.org/changeset/base/293003 Log: MFC r292640,r292641: r292640: Clean up trailing whitespace; no functional change Sponsored by: EMC / Isilon Storage Division r292641: Fix r292640 vim overzealously removed some trailing `+' and I didn't check the diff Pointyhat to: ngie Sponsored by: EMC / Isilon Storage Division Modified: stable/10/sys/kern/link_elf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/link_elf.c ============================================================================== --- stable/10/sys/kern/link_elf.c Thu Dec 31 20:15:57 2015 (r293002) +++ stable/10/sys/kern/link_elf.c Thu Dec 31 20:25:26 2015 (r293003) @@ -575,7 +575,7 @@ parse_dynamic(elf_file_t ef) static int parse_dpcpu(elf_file_t ef) -{ +{ int count; int error; @@ -606,7 +606,7 @@ parse_dpcpu(elf_file_t ef) #ifdef VIMAGE static int parse_vnet(elf_file_t ef) -{ +{ int count; int error; @@ -872,7 +872,7 @@ link_elf_load_file(linker_class_t cls, c */ base_offset = trunc_page(segs[0]->p_offset); base_vaddr = trunc_page(segs[0]->p_vaddr); - base_vlimit = round_page(segs[nsegs - 1]->p_vaddr + + base_vlimit = round_page(segs[nsegs - 1]->p_vaddr + segs[nsegs - 1]->p_memsz); mapsize = base_vlimit - base_vaddr; @@ -1416,7 +1416,7 @@ link_elf_each_function_name(linker_file_ elf_file_t ef = (elf_file_t)file; const Elf_Sym *symp; int i, error; - + /* Exhaustive search */ for (i = 0, symp = ef->ddbsymtab; i < ef->ddbsymcnt; i++, symp++) { if (symp->st_value != 0 && @@ -1602,7 +1602,7 @@ link_elf_symtab_get(linker_file_t lf, co return (ef->ddbsymcnt); } - + static long link_elf_strtab_get(linker_file_t lf, caddr_t *strtab) { From owner-svn-src-stable-10@freebsd.org Thu Dec 31 20:38:54 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23362A5679C; Thu, 31 Dec 2015 20:38:54 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x236.google.com (mail-pf0-x236.google.com [IPv6:2607:f8b0:400e:c00::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 EF3691A1C; Thu, 31 Dec 2015 20:38:53 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x236.google.com with SMTP id 65so115375688pff.3; Thu, 31 Dec 2015 12:38:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=n9QVxbl6YeVq3HSaUZaaQTJK0cGIk0LIEnOOEEY1c3A=; b=sg5QJmmRe89BKMygu3RFlTtsCJCRB185g/4asqLLnBO1HAveIHWtPVzId7MOBA9G63 nY5Wj5HaotU1jNSwZRJK/1nz2PA0m1ebDhzSE9yqnoq/IcImWtNy60lgMDyhWX0a9FY7 CIe7jOvHC19sGKJb8woUyyYxBslVnwyYJbboQR3/vj+ODzUIDVfLsyZilIzfz3tcWVkM veoLQFeRLix4kU0Y0aunxur34M9UNmVsNITeC/782FESwNnsb6PImxEq8QG9HbfztDpp qHZGN51qpMicG9xTiNelMHQWrvXYGpdJ6XtSqCBxnX5YtJcT9TZePRbQpP443vzPIq9T WTWg== X-Received: by 10.98.14.69 with SMTP id w66mr73202279pfi.67.1451594333616; Thu, 31 Dec 2015 12:38:53 -0800 (PST) Received: from ?IPv6:2601:601:800:126d:9910:6b8e:28b:6700? ([2601:601:800:126d:9910:6b8e:28b:6700]) by smtp.gmail.com with ESMTPSA id u26sm47895540pfa.86.2015.12.31.12.38.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 Dec 2015 12:38:52 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r292975 - stable/10/sys/dev/pci From: NGie Cooper In-Reply-To: <2893860.oDiG4KQizb@ralph.baldwin.cx> Date: Thu, 31 Dec 2015 12:38:50 -0800 Cc: Garrett Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <633EF3EE-0899-45A1-B12C-CC2290A1FA29@gmail.com> References: <201512310355.tBV3t2VG040656@repo.freebsd.org> <2893860.oDiG4KQizb@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Dec 2015 20:38:54 -0000 > On Dec 31, 2015, at 08:42, John Baldwin wrote: >=20 > On Thursday, December 31, 2015 03:55:02 AM Garrett Cooper wrote: >> Author: ngie >> Date: Thu Dec 31 03:55:02 2015 >> New Revision: 292975 >> URL: https://svnweb.freebsd.org/changeset/base/292975 >>=20 >> Log: >> MFC r278860: >> r278860 (by jmg): >>=20 >> remove NULL check as M_WAITOK will not return NULL >>=20 >> Reviewed by: jhb >> Sponsored by: FreeBSD Foundation >=20 > Including the metadata from the HEAD commit in the MFC can be = misleading, and > I think it is best ommitted. For example, I did not review this MFC = (and > reviewing MFC's in their own right matters since they may require = additional > work than commits to HEAD due to ABI concerns), nor did the Foundation = sponsor > the MFC. Rather, I think MFCs should only specify metadata related to = the > actual merge itself. Agreed. I=E2=80=99ve changed my mfc_log script to skip over some more = unnecessary svn log metadata: = https://github.com/yaneurabeya/scratch/commit/4f897efb96f96f951ff3909857f6= 7e63b24b733a . Thanks :)! -NGie= From owner-svn-src-stable-10@freebsd.org Fri Jan 1 00:35:08 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3113FA57F5F; Fri, 1 Jan 2016 00:35:08 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8E031B14; Fri, 1 Jan 2016 00:35:07 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u010Z6Pm012120; Fri, 1 Jan 2016 00:35:06 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u010Z6vA012118; Fri, 1 Jan 2016 00:35:06 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201601010035.u010Z6vA012118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Fri, 1 Jan 2016 00:35:06 +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: r293023 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2016 00:35:08 -0000 Author: ume Date: Fri Jan 1 00:35:06 2016 New Revision: 293023 URL: https://svnweb.freebsd.org/changeset/base/293023 Log: MFC r292719: Remove _gethostbynisname() and _gethostbynisaddr(). These functions used to be called from getipnodebyname(). Modified: stable/10/lib/libc/net/gethostbynis.c stable/10/lib/libc/net/netdb_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/gethostbynis.c ============================================================================== --- stable/10/lib/libc/net/gethostbynis.c Fri Jan 1 00:21:07 2016 (r293022) +++ stable/10/lib/libc/net/gethostbynis.c Fri Jan 1 00:35:06 2016 (r293023) @@ -198,61 +198,6 @@ _gethostbynisaddr_r(const void *addr, so } #endif /* YP */ -/* XXX _gethostbynisname/_gethostbynisaddr only used by getipnodeby*() */ -struct hostent * -_gethostbynisname(const char *name, int af) -{ -#ifdef YP - struct hostent *he; - struct hostent_data *hed; - u_long oresopt; - int error; - res_state statp; - - statp = __res_state(); - if ((he = __hostent_init()) == NULL || - (hed = __hostent_data_init()) == NULL) { - RES_SET_H_ERRNO(statp, NETDB_INTERNAL); - return (NULL); - } - - oresopt = statp->options; - statp->options &= ~RES_USE_INET6; - error = _gethostbynisname_r(name, af, he, hed); - statp->options = oresopt; - return (error == 0) ? he : NULL; -#else - return (NULL); -#endif -} - -struct hostent * -_gethostbynisaddr(const void *addr, socklen_t len, int af) -{ -#ifdef YP - struct hostent *he; - struct hostent_data *hed; - u_long oresopt; - int error; - res_state statp; - - statp = __res_state(); - if ((he = __hostent_init()) == NULL || - (hed = __hostent_data_init()) == NULL) { - RES_SET_H_ERRNO(statp, NETDB_INTERNAL); - return (NULL); - } - - oresopt = statp->options; - statp->options &= ~RES_USE_INET6; - error = _gethostbynisaddr_r(addr, len, af, he, hed); - statp->options = oresopt; - return (error == 0) ? he : NULL; -#else - return (NULL); -#endif -} - int _nis_gethostbyname(void *rval, void *cb_data, va_list ap) { Modified: stable/10/lib/libc/net/netdb_private.h ============================================================================== --- stable/10/lib/libc/net/netdb_private.h Fri Jan 1 00:21:07 2016 (r293022) +++ stable/10/lib/libc/net/netdb_private.h Fri Jan 1 00:35:06 2016 (r293023) @@ -133,8 +133,6 @@ void _endhostdnsent(void); void _endhosthtent(struct hostent_data *); void _endnetdnsent(void); void _endnethtent(struct netent_data *); -struct hostent *_gethostbynisaddr(const void *, socklen_t, int); -struct hostent *_gethostbynisname(const char *, int); void _map_v4v6_address(const char *, char *); void _map_v4v6_hostent(struct hostent *, char **, char *); void _sethostdnsent(int); From owner-svn-src-stable-10@freebsd.org Fri Jan 1 00:37:00 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55AC3A5805E; Fri, 1 Jan 2016 00:37: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 25DD41F77; Fri, 1 Jan 2016 00:37:00 +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 u010ax4N012294; Fri, 1 Jan 2016 00:36:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u010ax6x012293; Fri, 1 Jan 2016 00:36:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201601010036.u010ax6x012293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 1 Jan 2016 00:36:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293025 - stable/10/usr.sbin/makefs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2016 00:37:00 -0000 Author: ngie Date: Fri Jan 1 00:36:59 2016 New Revision: 293025 URL: https://svnweb.freebsd.org/changeset/base/293025 Log: MFC r292884: Fix getopt(3) argument after r290180; I forgot to change -r to -R by accident Pointyhat to: ngie Modified: stable/10/usr.sbin/makefs/makefs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/makefs/makefs.c ============================================================================== --- stable/10/usr.sbin/makefs/makefs.c Fri Jan 1 00:36:20 2016 (r293024) +++ stable/10/usr.sbin/makefs/makefs.c Fri Jan 1 00:36:59 2016 (r293025) @@ -113,7 +113,7 @@ main(int argc, char *argv[]) start_time.tv_sec = start.tv_sec; start_time.tv_nsec = start.tv_usec * 1000; - while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pr:s:S:t:xZ")) != -1) { + while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pR:s:S:t:xZ")) != -1) { switch (ch) { case 'B': From owner-svn-src-stable-10@freebsd.org Fri Jan 1 03:57:44 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A0AAA58147 for ; Fri, 1 Jan 2016 03:57:44 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D97C1468 for ; Fri, 1 Jan 2016 03:57:43 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x22c.google.com with SMTP id f206so128155669wmf.0 for ; Thu, 31 Dec 2015 19:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=MHldRlDll4QTsWIOGP/GsqYes6n11/HNCb9UoBLUwWk=; b=JreS9IFE0kDHGQPGrSyhN28yUHoGfjaVskM84aKbs/EBVFOF28vXlth+n4LmSK8781 qRoPT5KFWiko0r2IQEc9tZfIpTO3D5/y7fMYHgUt3yJTM0ut4ZnotABguTWvYnxp/F+8 l0yzhVuz9ZUVzJFNYO/7minA47hNtkvt3QH8nAqXBlHxepbLZQmcJkEiaPTkfTnsrpnM qfecHEeshx8kMW4X4L8L+y+mVDY2MGVtWJkCRtGN+l00MH29kgTs24beGuM3+oObLCae qPcQ05WL8hXKnHzS25HY+/1D1gMddlwKeazBDd6eL/Vd7vfIzVVE+4iN0+/wo/YZ0ZSA Q6ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=MHldRlDll4QTsWIOGP/GsqYes6n11/HNCb9UoBLUwWk=; b=byc7gT9VBpRxlUsbshAAGiiSX0jxavX2WTP4qo9EcMEFDAvVmjSHOKx4XhGEmx4J9f tDS9wjAbhcvs1FdB4/9DgNi4e5hdSCHKYZw4DClCzb0WbkQQkGyn/LLIDEJsKSZOG+Jv nnpnXOKfx9TkZi7u5gmyS6P4eetrHuH+P8cqbePBg4pB492w7jY0VZQEOO3NrLRJJNAd 5+M6IF0vtjs1xQr/nIipJdujSrL/syMXzsmtq+lhQtJXRdtkVcSRoEf6hQt9kHJJ1KY5 SFjb03JErUGqzXSf3WH2R6NpJzkZPRC/qJNqrfzZ9OGCNJV0yVKSxLrfqMIEFnxbmtL/ 1jVQ== X-Gm-Message-State: ALoCoQmn1Hkfq9NIwQHBiEtTh2HwimARzU7olA2QtzRXKrAzVPb6uRCCjIsEYe+YW5r8seGoRWHXbxnfTP73rEubn3sBWy+S63b3Hyax9aal/VJaBoDVfUA= MIME-Version: 1.0 X-Received: by 10.28.228.87 with SMTP id b84mr32100062wmh.81.1451620660873; Thu, 31 Dec 2015 19:57:40 -0800 (PST) Received: by 10.194.85.167 with HTTP; Thu, 31 Dec 2015 19:57:40 -0800 (PST) In-Reply-To: <633EF3EE-0899-45A1-B12C-CC2290A1FA29@gmail.com> References: <201512310355.tBV3t2VG040656@repo.freebsd.org> <2893860.oDiG4KQizb@ralph.baldwin.cx> <633EF3EE-0899-45A1-B12C-CC2290A1FA29@gmail.com> Date: Fri, 1 Jan 2016 04:57:40 +0100 Message-ID: Subject: Re: svn commit: r292975 - stable/10/sys/dev/pci From: Oliver Pinter To: NGie Cooper Cc: John Baldwin , "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-10@freebsd.org" , Garrett Cooper Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2016 03:57:44 -0000 On Thursday, December 31, 2015, NGie Cooper wrote: > > > On Dec 31, 2015, at 08:42, John Baldwin = > > wrote: > > > > On Thursday, December 31, 2015 03:55:02 AM Garrett Cooper wrote: > >> Author: ngie > >> Date: Thu Dec 31 03:55:02 2015 > >> New Revision: 292975 > >> URL: https://svnweb.freebsd.org/changeset/base/292975 > >> > >> Log: > >> MFC r278860: > >> r278860 (by jmg): > >> > >> remove NULL check as M_WAITOK will not return NULL > >> > >> Reviewed by: jhb > >> Sponsored by: FreeBSD Foundation > > > > Including the metadata from the HEAD commit in the MFC can be > misleading, and > > I think it is best ommitted. For example, I did not review this MFC (a= nd > > reviewing MFC's in their own right matters since they may require > additional > > work than commits to HEAD due to ABI concerns), nor did the Foundation > sponsor > > the MFC. Rather, I think MFCs should only specify metadata related to > the > > actual merge itself. > > Agreed. I=E2=80=99ve changed my mfc_log script to skip over some more unn= ecessary > svn log metadata: > https://github.com/yaneurabeya/scratch/commit/4f897efb96f96f951ff3909857f= 67e63b24b733a > . > Thanks :)! > -NGie It would be nice to commit this script under tools directory. > _______________________________________________ > svn-src-stable-10@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 > To unsubscribe, send any mail to " > svn-src-stable-10-unsubscribe@freebsd.org "