From owner-svn-src-stable-11@freebsd.org Sun Dec 18 00:39:05 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAFE6C71817; Sun, 18 Dec 2016 00:39:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A53E1BE0; Sun, 18 Dec 2016 00:39:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI0d43o067975; Sun, 18 Dec 2016 00:39:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI0d4Gr067974; Sun, 18 Dec 2016 00:39:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612180039.uBI0d4Gr067974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 18 Dec 2016 00:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310195 - stable/11/sys/x86/acpica X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 00:39:05 -0000 Author: kib Date: Sun Dec 18 00:39:04 2016 New Revision: 310195 URL: https://svnweb.freebsd.org/changeset/base/310195 Log: MFC r309854: Prefix hex memory addresses with 0x in diagnostic messages from the SRAT parser. Modified: stable/11/sys/x86/acpica/srat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/acpica/srat.c ============================================================================== --- stable/11/sys/x86/acpica/srat.c Sat Dec 17 22:34:19 2016 (r310194) +++ stable/11/sys/x86/acpica/srat.c Sun Dec 18 00:39:04 2016 (r310195) @@ -228,7 +228,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e mem = (ACPI_SRAT_MEM_AFFINITY *)entry; if (bootverbose) printf( - "SRAT: Found memory domain %d addr %jx len %jx: %s\n", + "SRAT: Found memory domain %d addr 0x%jx len 0x%jx: %s\n", mem->ProximityDomain, (uintmax_t)mem->BaseAddress, (uintmax_t)mem->Length, (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? @@ -237,7 +237,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e break; if (!overlaps_phys_avail(mem->BaseAddress, mem->BaseAddress + mem->Length)) { - printf("SRAT: Ignoring memory at addr %jx\n", + printf("SRAT: Ignoring memory at addr 0x%jx\n", (uintmax_t)mem->BaseAddress); break; } @@ -334,7 +334,7 @@ check_phys_avail(void) address = mem_info[i].end + 1; } } - printf("SRAT: No memory region found for %jx - %jx\n", + printf("SRAT: No memory region found for 0x%jx - 0x%jx\n", (uintmax_t)phys_avail[j], (uintmax_t)phys_avail[j + 1]); return (ENXIO); } From owner-svn-src-stable-11@freebsd.org Sun Dec 18 11:54:11 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8933EC86332; Sun, 18 Dec 2016 11:54:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5858332A; Sun, 18 Dec 2016 11:54:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIBsAS1045809; Sun, 18 Dec 2016 11:54:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIBsAh2045808; Sun, 18 Dec 2016 11:54:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181154.uBIBsAh2045808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 11:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310207 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 11:54:11 -0000 Author: tuexen Date: Sun Dec 18 11:54:10 2016 New Revision: 310207 URL: https://svnweb.freebsd.org/changeset/base/310207 Log: MFC r305810: Ensure that the IPPROTO_TCP level socket options * TCP_KEEPINIT * TCP_KEEPINTVL * TCP_KEEPIDLE * TCP_KEEPCNT always always report the values currently used when getsockopt() is used. This wasn't the case when the sysctl-inherited default values where used. Ensure that the IPPROTO_TCP level socket option TCP_INFO has the TCPI_OPT_ECN flag set in the tcpi_options field when ECN support has been negotiated successfully. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/11/sys/netinet/tcp_usrreq.c Sun Dec 18 11:15:31 2016 (r310206) +++ stable/11/sys/netinet/tcp_usrreq.c Sun Dec 18 11:54:10 2016 (r310207) @@ -1346,6 +1346,8 @@ tcp_fill_info(struct tcpcb *tp, struct t ti->tcpi_snd_wscale = tp->snd_scale; ti->tcpi_rcv_wscale = tp->rcv_scale; } + if (tp->t_flags & TF_ECN_PERMIT) + ti->tcpi_options |= TCPI_OPT_ECN; ti->tcpi_rto = tp->t_rxtcur * tick; ti->tcpi_last_data_recv = (long)(ticks - (int)tp->t_rcvtime) * tick; @@ -1815,16 +1817,16 @@ unlock_and_done: case TCP_KEEPCNT: switch (sopt->sopt_name) { case TCP_KEEPIDLE: - ui = tp->t_keepidle / hz; + ui = TP_KEEPIDLE(tp) / hz; break; case TCP_KEEPINTVL: - ui = tp->t_keepintvl / hz; + ui = TP_KEEPINTVL(tp) / hz; break; case TCP_KEEPINIT: - ui = tp->t_keepinit / hz; + ui = TP_KEEPINIT(tp) / hz; break; case TCP_KEEPCNT: - ui = tp->t_keepcnt; + ui = TP_KEEPCNT(tp); break; } INP_WUNLOCK(inp); From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:12:51 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08249C710D9; Sun, 18 Dec 2016 12:12:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6F501098; Sun, 18 Dec 2016 12:12:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICCoi8053867; Sun, 18 Dec 2016 12:12:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICCnmg053863; Sun, 18 Dec 2016 12:12:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181212.uBICCnmg053863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310208 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:12:51 -0000 Author: tuexen Date: Sun Dec 18 12:12:49 2016 New Revision: 310208 URL: https://svnweb.freebsd.org/changeset/base/310208 Log: MFC r307726: Make ICMPv6 hard error handling for TCP consistent with the ICMPv4 handling. Ensure that: * Protocol unreachable errors are handled by indicating ECONNREFUSED to the TCP user for both IPv4 and IPv6. These were ignored for IPv6. * Communication prohibited errors are handled by indicating ECONNREFUSED to the TCP user for both IPv4 and IPv6. These were ignored for IPv6. * Hop Limited exceeded errors are handled by indicating EHOSTUNREACH to the TCP user for both IPv4 and IPv6. For IPv6 the TCP connected was dropped but errno wasn't set. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/ip_icmp.c stable/11/sys/netinet/tcp_subr.c stable/11/sys/netinet6/icmp6.c stable/11/sys/netinet6/ip6_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/ip_icmp.c ============================================================================== --- stable/11/sys/netinet/ip_icmp.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet/ip_icmp.c Sun Dec 18 12:12:49 2016 (r310208) @@ -457,6 +457,8 @@ icmp_input(struct mbuf **mp, int *offp, * Treat subcodes 2,3 as immediate RST */ case ICMP_UNREACH_PROTOCOL: + code = PRC_UNREACH_PROTOCOL; + break; case ICMP_UNREACH_PORT: code = PRC_UNREACH_PORT; break; Modified: stable/11/sys/netinet/tcp_subr.c ============================================================================== --- stable/11/sys/netinet/tcp_subr.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet/tcp_subr.c Sun Dec 18 12:12:49 2016 (r310208) @@ -1949,7 +1949,8 @@ tcp_ctlinput(int cmd, struct sockaddr *s if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc_notify; else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || - cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && ip) + cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || + cmd == PRC_TIMXCEED_INTRANS) && ip) notify = tcp_drop_syn_sent; /* @@ -2081,8 +2082,8 @@ tcp6_ctlinput(int cmd, struct sockaddr * if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc_notify; else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || - cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && - ip6 != NULL) + cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || + cmd == PRC_TIMXCEED_INTRANS) && ip6 != NULL) notify = tcp_drop_syn_sent; /* Modified: stable/11/sys/netinet6/icmp6.c ============================================================================== --- stable/11/sys/netinet6/icmp6.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet6/icmp6.c Sun Dec 18 12:12:49 2016 (r310208) @@ -490,7 +490,7 @@ icmp6_input(struct mbuf **mp, int *offp, break; case ICMP6_DST_UNREACH_ADMIN: icmp6_ifstat_inc(ifp, ifs6_in_adminprohib); - code = PRC_UNREACH_PROTOCOL; /* is this a good code? */ + code = PRC_UNREACH_ADMIN_PROHIB; break; case ICMP6_DST_UNREACH_BEYONDSCOPE: /* I mean "source address was incorrect." */ Modified: stable/11/sys/netinet6/ip6_input.c ============================================================================== --- stable/11/sys/netinet6/ip6_input.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet6/ip6_input.c Sun Dec 18 12:12:49 2016 (r310208) @@ -1772,6 +1772,6 @@ u_char inet6ctlerrmap[PRC_NCMDS] = { 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, EMSGSIZE, EHOSTUNREACH, 0, 0, - 0, 0, 0, 0, - ENOPROTOOPT + 0, 0, EHOSTUNREACH, 0, + ENOPROTOOPT, ECONNREFUSED }; From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:15:12 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 343E1C711F4; Sun, 18 Dec 2016 12:15:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 036A61335; Sun, 18 Dec 2016 12:15:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICFBtn054126; Sun, 18 Dec 2016 12:15:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICFBmc054125; Sun, 18 Dec 2016 12:15:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181215.uBICFBmc054125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310209 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:15:12 -0000 Author: tuexen Date: Sun Dec 18 12:15:10 2016 New Revision: 310209 URL: https://svnweb.freebsd.org/changeset/base/310209 Log: MFC r307727, r307746: Document the TCP sysctl variables insecure_rst and insecure_syn. Sponsored by: Netflix, Inc. Modified: stable/11/share/man/man4/tcp.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/tcp.4 ============================================================================== --- stable/11/share/man/man4/tcp.4 Sun Dec 18 12:12:49 2016 (r310208) +++ stable/11/share/man/man4/tcp.4 Sun Dec 18 12:15:10 2016 (r310209) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 28, 2016 +.Dd October 21, 2016 .Dt TCP 4 .Os .Sh NAME @@ -586,6 +586,12 @@ downshift. List of available TCP function blocks (TCP stacks). .It Va functions_default The default TCP function block (TCP stack). +.It Va insecure_rst +Use criteria defined in RFC793 instead of RFC5961 for accepting RST segments. +Default is false. +.It Va insecure_syn +Use criteria defined in RFC793 instead of RFC5961 for accepting SYN segments. +Default is false. .El .Sh ERRORS A socket operation may fail with one of the following errors returned: From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:16:48 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72E57C7127B; Sun, 18 Dec 2016 12:16:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 420DB150C; Sun, 18 Dec 2016 12:16:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICGlxQ054234; Sun, 18 Dec 2016 12:16:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICGlHq054233; Sun, 18 Dec 2016 12:16:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181216.uBICGlHq054233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310210 - stable/11/usr.sbin/bhyvectl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:16:48 -0000 Author: tuexen Date: Sun Dec 18 12:16:47 2016 New Revision: 310210 URL: https://svnweb.freebsd.org/changeset/base/310210 Log: MFC r308616: Fix typo. Sponsored by: Netflix, Inc. Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.8 ============================================================================== --- stable/11/usr.sbin/bhyvectl/bhyvectl.8 Sun Dec 18 12:15:10 2016 (r310209) +++ stable/11/usr.sbin/bhyvectl/bhyvectl.8 Sun Dec 18 12:16:47 2016 (r310210) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2016 +.Dd November 13, 2016 .Dt BHYVECTL 8 .Os .Sh NAME @@ -64,7 +64,7 @@ Operate on the virtual machine Create the specified VM. .It Fl -destroy Destroy the specified VM. -.It Fl -get-state +.It Fl -get-stats Retrieve statistics for the specified VM. .It Fl -inject-nmi Inject a non-maskable interrupt (NMI) into the VM. From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:20:23 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A25F8C71803; Sun, 18 Dec 2016 12:20:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D56A1886; Sun, 18 Dec 2016 12:20:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICKMIW054423; Sun, 18 Dec 2016 12:20:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICKMC0054421; Sun, 18 Dec 2016 12:20:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181220.uBICKMC0054421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310211 - in stable/11/sys/netinet: . tcp_stacks X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:20:23 -0000 Author: tuexen Date: Sun Dec 18 12:20:22 2016 New Revision: 310211 URL: https://svnweb.freebsd.org/changeset/base/310211 Log: MFC r308745: Notify the user via setting errno when a TCP RST segment is received either in the CLOSING or LAST-ACK state. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_input.c stable/11/sys/netinet/tcp_stacks/fastpath.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:16:47 2016 (r310210) +++ stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:20:22 2016 (r310211) @@ -2185,6 +2185,8 @@ tcp_do_segment(struct mbuf *m, struct tc case TCPS_FIN_WAIT_1: case TCPS_FIN_WAIT_2: case TCPS_CLOSE_WAIT: + case TCPS_CLOSING: + case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: tcp_state_change(tp, TCPS_CLOSED); Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:16:47 2016 (r310210) +++ stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:20:22 2016 (r310211) @@ -734,6 +734,8 @@ tcp_do_slowpath(struct mbuf *m, struct t case TCPS_FIN_WAIT_1: case TCPS_FIN_WAIT_2: case TCPS_CLOSE_WAIT: + case TCPS_CLOSING: + case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: tcp_state_change(tp, TCPS_CLOSED); From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:23:50 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74173C71C04; Sun, 18 Dec 2016 12:23:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B7041D2E; Sun, 18 Dec 2016 12:23:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICNnlB058092; Sun, 18 Dec 2016 12:23:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICNn7s058088; Sun, 18 Dec 2016 12:23:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181223.uBICNn7s058088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310212 - in stable/11/sys/netinet: . tcp_stacks X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:23:50 -0000 Author: tuexen Date: Sun Dec 18 12:23:48 2016 New Revision: 310212 URL: https://svnweb.freebsd.org/changeset/base/310212 Log: MFC r308832: Ensure that TCP state changes to state-closing are reported via dtrace. This does not cover state changes from TIME-WAIT. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_input.c stable/11/sys/netinet/tcp_stacks/fastpath.c stable/11/sys/netinet/tcp_subr.c stable/11/sys/netinet/tcp_timewait.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:23:48 2016 (r310212) @@ -2189,7 +2189,6 @@ tcp_do_segment(struct mbuf *m, struct tc case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: - tcp_state_change(tp, TCPS_CLOSED); /* FALLTHROUGH */ default: tp = tcp_close(tp); Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:23:48 2016 (r310212) @@ -738,7 +738,6 @@ tcp_do_slowpath(struct mbuf *m, struct t case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: - tcp_state_change(tp, TCPS_CLOSED); /* FALLTHROUGH */ default: tp = tcp_close(tp); Modified: stable/11/sys/netinet/tcp_subr.c ============================================================================== --- stable/11/sys/netinet/tcp_subr.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_subr.c Sun Dec 18 12:23:48 2016 (r310212) @@ -1483,6 +1483,7 @@ tcp_discardcb(struct tcpcb *tp) inp->inp_ppcb = NULL; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on tcpcb, let's free it. */ + TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp); refcount_release(&tp->t_fb->tfb_refcnt); @@ -1512,6 +1513,7 @@ tcp_timer_discard(void *ptp) tp->t_timers->tt_draincnt--; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on this tcpcb, let's free it. */ + TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp); refcount_release(&tp->t_fb->tfb_refcnt); @@ -1558,7 +1560,8 @@ tcp_close(struct tcpcb *tp) #endif in_pcbdrop(inp); TCPSTAT_INC(tcps_closed); - TCPSTATES_DEC(tp->t_state); + if (tp->t_state != TCPS_CLOSED) + tcp_state_change(tp, TCPS_CLOSED); KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL")); so = inp->inp_socket; soisdisconnected(so); Modified: stable/11/sys/netinet/tcp_timewait.c ============================================================================== --- stable/11/sys/netinet/tcp_timewait.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_timewait.c Sun Dec 18 12:23:48 2016 (r310212) @@ -340,6 +340,7 @@ tcp_twstart(struct tcpcb *tp) tcp_twrespond(tw, TH_ACK); inp->inp_ppcb = tw; inp->inp_flags |= INP_TIMEWAIT; + TCPSTATES_INC(TCPS_TIME_WAIT); tcp_tw_2msl_reset(tw, 0); /* From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:27:36 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7268C71D48; Sun, 18 Dec 2016 12:27:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 866E51EF0; Sun, 18 Dec 2016 12:27:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICRZOY058273; Sun, 18 Dec 2016 12:27:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICRZQJ058272; Sun, 18 Dec 2016 12:27:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181227.uBICRZQJ058272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310213 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:27:36 -0000 Author: tuexen Date: Sun Dec 18 12:27:35 2016 New Revision: 310213 URL: https://svnweb.freebsd.org/changeset/base/310213 Log: MFC r309397: Fix the handling of TCP FIN-segments in the CLOSED state When a TCP segment with the FIN bit set was received in the CLOSED state, a TCP RST-ACK-segment is sent. When computing SEG.ACK for this, the FIN counts as one byte. This accounting was missing and is fixed by this patch. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:23:48 2016 (r310212) +++ stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:27:35 2016 (r310213) @@ -3316,6 +3316,8 @@ tcp_dropwithreset(struct mbuf *m, struct } else { if (th->th_flags & TH_SYN) tlen++; + if (th->th_flags & TH_FIN) + tlen++; tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen, (tcp_seq)0, TH_RST|TH_ACK); } From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:45:38 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EC27C85291; Sun, 18 Dec 2016 12:45:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37C55B26; Sun, 18 Dec 2016 12:45:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICjbbn066389; Sun, 18 Dec 2016 12:45:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICjbcg066388; Sun, 18 Dec 2016 12:45:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181245.uBICjbcg066388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310214 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:45:38 -0000 Author: tuexen Date: Sun Dec 18 12:45:37 2016 New Revision: 310214 URL: https://svnweb.freebsd.org/changeset/base/310214 Log: MFC r306082: Fix the handling of unordered fragmented user messages using DATA chunks. There were two bugs: * There was an accounting bug resulting in reporting a too small a_rwnd. * There are a bug when abandoning messages in the reassembly queue. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 12:27:35 2016 (r310213) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 12:45:37 2016 (r310214) @@ -809,6 +809,8 @@ restart: tchk = TAILQ_FIRST(&control->reasm); if (tchk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { TAILQ_REMOVE(&control->reasm, tchk, sctp_next); + asoc->size_on_reasm_queue -= tchk->send_size; + sctp_ucount_decr(asoc->cnt_on_reasm_queue); nc->first_frag_seen = 1; nc->fsn_included = tchk->rec.data.fsn_num; nc->data = tchk->data; @@ -5322,6 +5324,9 @@ sctp_flush_reassm_for_str_seq(struct sct /* Not found */ return; } + if (old && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) { + return; + } TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { /* Purge hanging chunks */ if (old && (ordered == 0)) { From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:49:26 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AE0EC853AD; Sun, 18 Dec 2016 12:49:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D97DACBB; Sun, 18 Dec 2016 12:49:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICnPYv066556; Sun, 18 Dec 2016 12:49:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICnPNB066555; Sun, 18 Dec 2016 12:49:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181249.uBICnPNB066555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310215 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:49:26 -0000 Author: tuexen Date: Sun Dec 18 12:49:24 2016 New Revision: 310215 URL: https://svnweb.freebsd.org/changeset/base/310215 Log: MFC r307216: Whitespace changes. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:45:37 2016 (r310214) +++ stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:49:24 2016 (r310215) @@ -77,7 +77,6 @@ SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 } return (IN6_ARE_ADDR_EQUAL(&tmp_a.sin6_addr, &tmp_b.sin6_addr)); } - #endif void @@ -837,14 +836,11 @@ static int sctp_does_stcb_own_this_addr(struct sctp_tcb *stcb, struct sockaddr *to) { int loopback_scope; - #if defined(INET) int ipv4_local_scope, ipv4_addr_legal; - #endif #if defined(INET6) int local_scope, site_scope, ipv6_addr_legal; - #endif struct sctp_vrf *vrf; struct sctp_ifn *sctp_ifn; @@ -1216,10 +1212,8 @@ sctp_tcb_special_locate(struct sctp_inpc if (netp != NULL) { *netp = net; } - /* - * Update the endpoint - * pointer - */ + /* Update the endpoint + * pointer */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1240,10 +1234,8 @@ sctp_tcb_special_locate(struct sctp_inpc if (netp != NULL) { *netp = net; } - /* - * Update the endpoint - * pointer - */ + /* Update the endpoint + * pointer */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1622,15 +1614,12 @@ sctp_endpoint_probe(struct sockaddr *nam { struct sctp_inpcb *inp; struct sctp_laddr *laddr; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sockaddr_in6 *intf_addr6; - #endif int fnd; @@ -1673,10 +1662,8 @@ sctp_endpoint_probe(struct sockaddr *nam case AF_INET: if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && SCTP_IPV6_V6ONLY(inp)) { - /* - * IPv4 on a IPv6 socket with ONLY - * IPv6 set - */ + /* IPv4 on a IPv6 socket with ONLY + * IPv6 set */ SCTP_INP_RUNLOCK(inp); continue; } @@ -1689,10 +1676,8 @@ sctp_endpoint_probe(struct sockaddr *nam #endif #ifdef INET6 case AF_INET6: - /* - * A V6 address and the endpoint is NOT - * bound V6 - */ + /* A V6 address and the endpoint is NOT + * bound V6 */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) { SCTP_INP_RUNLOCK(inp); continue; @@ -1926,14 +1911,11 @@ sctp_pcb_findep(struct sockaddr *nam, in struct sctppcbhead *head; int lport; unsigned int i; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif switch (nam->sa_family) { @@ -2057,21 +2039,16 @@ sctp_findassociation_special_addr(struct struct sockaddr *dst) { struct sctp_paramhdr *phdr, parm_buf; - #if defined(INET) || defined(INET6) struct sctp_tcb *stcb; uint16_t ptype; - #endif uint16_t plen; - #ifdef INET struct sockaddr_in sin4; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif #ifdef INET @@ -2198,10 +2175,8 @@ sctp_findassoc_by_vtag(struct sockaddr * continue; } if (remote_tag) { - /* - * If we have both vtags that's all we match - * on - */ + /* If we have both vtags that's all we match + * on */ if (stcb->asoc.peer_vtag == remote_tag) { /* * If both tags match we consider it @@ -2319,14 +2294,11 @@ sctp_findassociation_ep_asconf(struct mb struct sctp_paramhdr parm_buf, *phdr; int ptype; int zero_address = 0; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif memset(&remote_store, 0, sizeof(remote_store)); @@ -2897,10 +2869,8 @@ sctp_inpcb_bind(struct socket *so, struc #ifdef INET6 case AF_INET6: { - /* - * Only for pure IPv6 Address. (No IPv4 - * Mapped!) - */ + /* Only for pure IPv6 Address. (No IPv4 + * Mapped!) */ struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)addr; @@ -2977,10 +2947,8 @@ sctp_inpcb_bind(struct socket *so, struc /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* - * Ok, must be one-2-one and - * allowing port re-use - */ + /* Ok, must be one-2-one and + * allowing port re-use */ port_reuse_active = 1; goto continue_anyway; } @@ -3003,10 +2971,8 @@ sctp_inpcb_bind(struct socket *so, struc /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* - * Ok, must be one-2-one and - * allowing port re-use - */ + /* Ok, must be one-2-one and + * allowing port re-use */ port_reuse_active = 1; goto continue_anyway; } @@ -3146,11 +3112,11 @@ continue_anyway: * bind specific, make sure flags is off and add a new * address structure to the sctp_addr_list inside the ep * structure. - * - * We will need to allocate one and insert it at the head. The - * socketopt call can just insert new addresses in there as - * well. It will also have to do the embed scope kame hack - * too (before adding). + * + * We will need to allocate one and insert it at the head. + * The socketopt call can just insert new addresses in there + * as well. It will also have to do the embed scope kame + * hack too (before adding). */ struct sctp_ifa *ifa; union sctp_sockstore store; @@ -3268,11 +3234,11 @@ sctp_iterator_inp_being_freed(struct sct * from happening. But of course the iterator has a * reference on the stcb and inp. We can mark it and it will * stop. - * - * If its a single iterator situation, we set the end iterator - * flag. Otherwise we set the iterator to go to the next - * inp. - * + * + * If its a single iterator situation, we set the end + * iterator flag. Otherwise we set the iterator to go to the + * next inp. + * */ if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { sctp_it_ctl.iterator_flags |= SCTP_ITERATOR_STOP_CUR_IT; @@ -3305,10 +3271,8 @@ sctp_iterator_inp_being_freed(struct sct SCTP_INP_INCR_REF(it->inp); } } - /* - * When its put in the refcnt is incremented so decr - * it - */ + /* When its put in the refcnt is incremented so decr + * it */ SCTP_INP_DECR_REF(inp); } } @@ -3991,10 +3955,8 @@ sctp_add_remote_addr(struct sctp_tcb *st rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, net->ro.ro_rt); if (rmtu == 0) { - /* - * Start things off to match mtu of - * interface please. - */ + /* Start things off to match mtu of + * interface please. */ SCTP_SET_MTU_OF_ROUTE(&net->ro._l_addr.sa, net->ro.ro_rt, net->mtu); } else { @@ -5484,10 +5446,8 @@ sctp_del_local_addr_ep(struct sctp_inpcb if (stcb->asoc.last_used_address == laddr) /* delete this address */ stcb->asoc.last_used_address = NULL; - /* - * Now spin through all the nets and purge any ref - * to laddr - */ + /* Now spin through all the nets and purge any ref + * to laddr */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { if (net->ro._s_addr == laddr->ifa) { /* Yep, purge src address selected */ @@ -5755,7 +5715,6 @@ sctp_startup_mcore_threads(void) } } - #endif void @@ -6097,14 +6056,11 @@ sctp_load_addresses_from_init(struct sct uint8_t peer_supports_nrsack; uint8_t peer_supports_pktdrop; uint8_t peer_supports_idata; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif /* First get the destination address setup too. */ @@ -6267,10 +6223,8 @@ sctp_load_addresses_from_init(struct sct struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* - * in setup state we - * abort this guy - */ + /* in setup state we + * abort this guy */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -6312,10 +6266,8 @@ sctp_load_addresses_from_init(struct sct goto next_param; } if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* - * Link local make no sense without - * scope - */ + /* Link local make no sense without + * scope */ goto next_param; } sa = (struct sockaddr *)&sin6; @@ -6366,10 +6318,8 @@ sctp_load_addresses_from_init(struct sct struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* - * in setup state we - * abort this guy - */ + /* in setup state we + * abort this guy */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -6409,10 +6359,8 @@ sctp_load_addresses_from_init(struct sct struct sctp_asconf_addr_param lstore, *fee; int lptype; struct sockaddr *lsa = NULL; - #ifdef INET struct sctp_asconf_addrv4_param *fii; - #endif if (stcb->asoc.asconf_supported == 0) { From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:52:54 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B063C85573; Sun, 18 Dec 2016 12:52:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8ABD10AF; Sun, 18 Dec 2016 12:52:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICqrQR070208; Sun, 18 Dec 2016 12:52:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICqrLm070207; Sun, 18 Dec 2016 12:52:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181252.uBICqrLm070207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310216 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:52:54 -0000 Author: tuexen Date: Sun Dec 18 12:52:52 2016 New Revision: 310216 URL: https://svnweb.freebsd.org/changeset/base/310216 Log: MFC r307217: Mark the socket as un-writable when it is 1-to-1 and the SCTP association is freed. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:49:24 2016 (r310215) +++ stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:52:52 2016 (r310216) @@ -4870,6 +4870,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, SS_ISCONNECTED); } socantrcvmore_locked(so); + socantsendmore(so); sctp_sowwakeup(inp, so); sctp_sorwakeup(inp, so); SCTP_SOWAKEUP(so); From owner-svn-src-stable-11@freebsd.org Sun Dec 18 12:56:15 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6405DC85664; Sun, 18 Dec 2016 12:56:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31F33136D; Sun, 18 Dec 2016 12:56:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICuEMX070396; Sun, 18 Dec 2016 12:56:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICuEja070394; Sun, 18 Dec 2016 12:56:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181256.uBICuEja070394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310217 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:56:15 -0000 Author: tuexen Date: Sun Dec 18 12:56:14 2016 New Revision: 310217 URL: https://svnweb.freebsd.org/changeset/base/310217 Log: MFC r307779: No functional changes, mostly getting the whitespace changes resulting from an updated formatting tool chain. Modified: stable/11/sys/netinet/sctp_bsd_addr.c stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/11/sys/netinet/sctp_bsd_addr.c Sun Dec 18 12:52:52 2016 (r310216) +++ stable/11/sys/netinet/sctp_bsd_addr.c Sun Dec 18 12:56:14 2016 (r310217) @@ -140,7 +140,6 @@ sctp_gather_internal_ifa_flags(struct sc ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; } } - #endif /* INET6 */ @@ -201,10 +200,8 @@ sctp_init_ifns_for_vrf(int vrfid) struct ifaddr *ifa; struct sctp_ifa *sctp_ifa; uint32_t ifa_flags; - #ifdef INET6 struct in6_ifaddr *ifa6; - #endif IFNET_RLOCK(); Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sun Dec 18 12:52:52 2016 (r310216) +++ stable/11/sys/netinet/sctp_output.c Sun Dec 18 12:56:14 2016 (r310217) @@ -1943,7 +1943,6 @@ sctp_add_addr_to_mbuf(struct mbuf *m, st struct sctp_paramhdr *parmh; struct mbuf *mret; uint16_t plen; - #endif switch (ifa->address.sa.sa_family) { @@ -2139,10 +2138,8 @@ skip_count: cnt++; total_count++; if (cnt >= 2) { - /* - * two from each - * address - */ + /* two from each + * address */ break; } if (total_count > SCTP_ADDRESS_LIMIT) { @@ -2784,7 +2781,6 @@ sctp_select_nth_preferred_addr_from_ifn_ { struct sctp_ifa *ifa, *sifa; int num_eligible_addr = 0; - #ifdef INET6 struct sockaddr_in6 sin6, lsa6; @@ -2829,10 +2825,8 @@ sctp_select_nth_preferred_addr_from_ifn_ if (fam == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&sifa->address.sin6.sin6_addr) && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* - * link-local <-> link-local must belong to the same - * scope. - */ + /* link-local <-> link-local must belong to the same + * scope. */ memcpy(&lsa6, &sifa->address.sin6, sizeof(struct sockaddr_in6)); (void)sa6_recoverscope(&lsa6); if (sin6.sin6_scope_id != lsa6.sin6_scope_id) { @@ -2966,10 +2960,8 @@ sctp_choose_boundall(struct sctp_inpcb * struct sctp_ifa *sctp_ifa, *sifa; uint32_t ifn_index; struct sctp_vrf *vrf; - #ifdef INET int retried = 0; - #endif /*- @@ -3315,14 +3307,11 @@ sctp_source_address_selection(struct sct struct sctp_ifa *answer; uint8_t dest_is_priv, dest_is_loop; sa_family_t fam; - #ifdef INET struct sockaddr_in *to = (struct sockaddr_in *)&ro->ro_dst; - #endif #ifdef INET6 struct sockaddr_in6 *to6 = (struct sockaddr_in6 *)&ro->ro_dst; - #endif /** @@ -3570,14 +3559,11 @@ sctp_process_cmsgs_for_init(struct sctp_ struct cmsghdr cmh; int tlen, at; struct sctp_initmsg initmsg; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif tlen = SCTP_BUF_LEN(control); @@ -3618,10 +3604,8 @@ sctp_process_cmsgs_for_init(struct sctp_ if (stcb->asoc.streamoutcnt < stcb->asoc.pre_open_streams) { struct sctp_stream_out *tmp_str; unsigned int i; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif /* Default is NOT correct */ @@ -3744,14 +3728,11 @@ sctp_findassociation_cmsgs(struct sctp_i int tlen, at; struct sctp_tcb *stcb; struct sockaddr *addr; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif tlen = SCTP_BUF_LEN(control); @@ -3970,7 +3951,6 @@ sctp_handle_no_route(struct sctp_tcb *st } } } - #endif static int @@ -4016,22 +3996,17 @@ sctp_lowlevel_chunk_output(struct sctp_i struct sctphdr *sctphdr; int packet_length; int ret; - #if defined(INET) || defined(INET6) uint32_t vrf_id; - #endif #if defined(INET) || defined(INET6) struct mbuf *o_pak; sctp_route_t *ro = NULL; struct udphdr *udp = NULL; - #endif uint8_t tos_value; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so = NULL; - #endif if ((net) && (net->dest_state & SCTP_ADDR_OUT_OF_SCOPE)) { @@ -4289,10 +4264,8 @@ sctp_lowlevel_chunk_output(struct sctp_i /* free tempy routes */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ + /* PMTU check versus smallest asoc MTU goes + * here */ if ((ro->ro_rt != NULL) && (net->ro._s_addr)) { uint32_t mtu; @@ -4567,10 +4540,8 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT3, (struct sockaddr *)sin6); if (net) { sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; - /* - * preserve the port and scope for link - * local send - */ + /* preserve the port and scope for link + * local send */ prev_scope = sin6->sin6_scope_id; prev_port = sin6->sin6_port; } @@ -4636,10 +4607,8 @@ sctp_lowlevel_chunk_output(struct sctp_i /* Now if we had a temp route free it */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ + /* PMTU check versus smallest asoc MTU goes + * here */ if (ro->ro_rt == NULL) { /* Route was freed */ if (net->ro._s_addr && @@ -4969,11 +4938,11 @@ sctp_arethere_unrecognized_parameters(st * being equal to the beginning of the params i.e. (iphlen + * sizeof(struct sctp_init_msg) parse through the parameters to the * end of the mbuf verifying that all parameters are known. - * + * * For unknown parameters build and return a mbuf with * UNRECOGNIZED_PARAMETER errors. If the flags indicate to stop * processing this chunk stop, and set *abort_processing to 1. - * + * * By having param_offset be pre-set to where parameters begin it is * hoped that this routine may be reused in the future by new * features. @@ -5260,7 +5229,6 @@ invalid_size: *abort_processing = 1; if ((op_err == NULL) && phdr) { int l_len; - #ifdef INET6 l_len = SCTP_MIN_OVERHEAD; #else @@ -5318,14 +5286,11 @@ sctp_are_there_new_addresses(struct sctp uint8_t fnd; struct sctp_nets *net; int check_src; - #ifdef INET struct sockaddr_in sin4, *sa4; - #endif #ifdef INET6 struct sockaddr_in6 sin6, *sa6; - #endif #ifdef INET @@ -5509,18 +5474,15 @@ sctp_send_initiate_ack(struct sctp_inpcb struct sctp_paramhdr *ph; union sctp_sockstore *over_addr; struct sctp_scoping scp; - #ifdef INET struct sockaddr_in *dst4 = (struct sockaddr_in *)dst; struct sockaddr_in *src4 = (struct sockaddr_in *)src; struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *dst6 = (struct sockaddr_in6 *)dst; struct sockaddr_in6 *src6 = (struct sockaddr_in6 *)src; struct sockaddr_in6 *sin6; - #endif struct sockaddr *to; struct sctp_state_cookie stc; @@ -5544,10 +5506,10 @@ sctp_send_initiate_ack(struct sctp_inpcb /* * new addresses, out of here in non-cookie-wait * states - * - * Send an ABORT, without the new address error cause. - * This looks no different than if no listener was - * present. + * + * Send an ABORT, without the new address error + * cause. This looks no different than if no + * listener was present. */ op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); @@ -5560,9 +5522,9 @@ sctp_send_initiate_ack(struct sctp_inpcb /* * change of remote encapsulation port, out of here * in non-cookie-wait states - * - * Send an ABORT, without an specific error cause. This - * looks no different than if no listener was + * + * Send an ABORT, without an specific error cause. + * This looks no different than if no listener was * present. */ op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -5716,10 +5678,8 @@ do_a_abort: * show up in our scoped count. */ cnt_inits_to = 1; - /* - * pull out the scope_id from - * incoming pkt - */ + /* pull out the scope_id from + * incoming pkt */ } else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr) || IN6_IS_ADDR_SITELOCAL(&dst6->sin6_addr)) { /* @@ -5744,7 +5704,6 @@ do_a_abort: #ifdef INET6 struct sctp_nets *lnet; - #endif stc.loopback_scope = asoc->scope.loopback_scope; @@ -6206,9 +6165,9 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* if chunk was present */ - } /* if of sufficient priority */ - } /* if chunk has enabled */ + } /* if chunk was present */ + } /* if of sufficient priority */ + } /* if chunk has enabled */ } /* tailqforeach */ TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { @@ -6229,11 +6188,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* end if chk->data */ - } /* end if right class */ - } /* end if chk pr-sctp */ + } /* end if chk->data */ + } /* end if right class */ + } /* end if chk pr-sctp */ } /* tailqforeachsafe (chk) */ - } /* if enabled in asoc */ + } /* if enabled in asoc */ } int @@ -6476,10 +6435,8 @@ error_out: /* get the prepend space */ SCTP_BUF_RESV_UF(outchain, (SCTP_FIRST_MBUF_RESV + 4)); } else { - /* - * We really should not get a NULL - * in endofchain - */ + /* We really should not get a NULL + * in endofchain */ /* find end */ m = outchain; while (m) { @@ -6491,10 +6448,8 @@ error_out: } /* sanity */ if (*endofchain == NULL) { - /* - * huh, TSNH XXX maybe we - * should panic - */ + /* huh, TSNH XXX maybe we + * should panic */ sctp_m_freem(outchain); goto new_mbuf; } @@ -6693,17 +6648,13 @@ sctp_sendall_iterator(struct sctp_inpcb if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { goto abort_anyway; } - /* - * there is nothing queued to send, so I'm - * done... - */ + /* there is nothing queued to send, so I'm + * done... */ if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { - /* - * only send SHUTDOWN the first time - * through - */ + /* only send SHUTDOWN the first time + * through */ if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } @@ -7334,10 +7285,8 @@ re_look: SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; if (sp->msg_is_complete) { - /* - * the sender finished the - * msg - */ + /* the sender finished the + * msg */ goto re_look; } } @@ -7955,9 +7904,9 @@ nothing_to_send: * (when CMT is off) then it calls * sctp_fill_outqueue for the net. This gets data on * the send queue for that network. - * - * In sctp_fill_outqueue TSN's are assigned and data is - * copied out of the stream buffers. Note mostly + * + * In sctp_fill_outqueue TSN's are assigned and data + * is copied out of the stream buffers. Note mostly * copy by reference (we hope). */ net->window_probe = 0; @@ -8226,10 +8175,8 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* - * error, we could not - * output - */ + /* error, we could not + * output */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8302,16 +8249,12 @@ again_one_more_time: * to where the sack is going.. */ if (chk->whoTo == net) { - /* - * Don't transmit it to where its - * going (current net) - */ + /* Don't transmit it to where its + * going (current net) */ continue; } else if (sack_goes_to == net) { - /* - * But do transmit it to this - * address - */ + /* But do transmit it to this + * address */ goto skip_net_check; } } @@ -8504,10 +8447,8 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* - * error, we could not - * output - */ + /* error, we could not + * output */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8704,17 +8645,13 @@ again_one_more_time: override_ok = 0; SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } else if (override_ok) { - /* - * use this data's - * keyid - */ + /* use this data's + * keyid */ auth_keyid = chk->auth_keyid; override_ok = 0; } else if (auth_keyid != chk->auth_keyid) { - /* - * different keyid, - * so done bundling - */ + /* different keyid, + * so done bundling */ break; } } @@ -8793,8 +8730,7 @@ again_one_more_time: break; } } /* for (chunk gather loop for this net) */ - } /* if asoc.state OPEN */ -no_data_fill: +} /* if asoc.state OPEN */ no_data_fill: /* Is there something to send for this destination? */ if (outchain) { /* We may need to start a control timer or two */ @@ -9734,10 +9670,8 @@ one_chunk_around: auth_keyid = fwd->auth_keyid; override_ok = 0; } else if (fwd->auth_keyid != auth_keyid) { - /* - * different keyid, - * so done bundling - */ + /* different keyid, + * so done bundling */ break; } } @@ -10113,11 +10047,9 @@ do_it_again: if (asoc->max_burst > 0) { if (SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst)) { if ((net->flight_size + (asoc->max_burst * net->mtu)) < net->cwnd) { - /* - * JRS - Use the congestion + /* JRS - Use the congestion * control given in the - * congestion control module - */ + * congestion control module */ asoc->cc_functions.sctp_cwnd_update_after_output(stcb, net, asoc->max_burst); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLE) { sctp_log_maxburst(stcb, net, 0, asoc->max_burst, SCTP_MAX_BURST_APPLIED); @@ -10127,10 +10059,8 @@ do_it_again: net->fast_retran_ip = 0; } else { if (net->flight_size == 0) { - /* - * Should be decaying the - * cwnd here - */ + /* Should be decaying the + * cwnd here */ ; } } @@ -11017,23 +10947,18 @@ sctp_send_resp_msg(struct sockaddr *src, struct mbuf *mout; struct sctphdr *shout; struct sctp_chunkhdr *ch; - #if defined(INET) || defined(INET6) struct udphdr *udp; int ret; - #endif int len, cause_len, padding_len; - #ifdef INET struct sockaddr_in *src_sin, *dst_sin; struct ip *ip; - #endif #ifdef INET6 struct sockaddr_in6 *src_sin6, *dst_sin6; struct ip6_hdr *ip6; - #endif /* Compute the length of the cause and add final padding. */ @@ -11622,10 +11547,8 @@ sctp_send_cwr(struct sctp_tcb *stcb, str asoc = &stcb->asoc; TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) { - /* - * found a previous CWR queued to same destination - * update it if needed - */ + /* found a previous CWR queued to same destination + * update it if needed */ uint32_t ctsn; cwr = mtod(chk->data, struct sctp_cwr_chunk *); @@ -12169,10 +12092,8 @@ sctp_send_str_reset_req(struct sctp_tcb struct sctp_stream_out *oldstream; struct sctp_stream_queue_pending *sp, *nsp; int i; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif oldstream = stcb->asoc.strmout; @@ -12204,10 +12125,8 @@ sctp_send_str_reset_req(struct sctp_tcb stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ - /* - * This should be a SS_COPY operation FIX ME STREAM - * SCHEDULER EXPERT - */ + /* This should be a SS_COPY operation FIX ME STREAM + * SCHEDULER EXPERT */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { @@ -12451,10 +12370,8 @@ sctp_sosend(struct socket *so, int error, use_sndinfo = 0; struct sctp_sndrcvinfo sndrcvninfo; struct sockaddr *addr_to_use; - #if defined(INET) && defined(INET6) struct sockaddr_in sin; - #endif if (control) { @@ -12739,10 +12656,8 @@ sctp_lower_sosend(struct socket *so, } if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* - * Set the connected flag so we can queue - * data - */ + /* Set the connected flag so we can queue + * data */ soisconnecting(so); } hold_tcblock = 1; @@ -12752,10 +12667,8 @@ sctp_lower_sosend(struct socket *so, } else { SCTP_PRINTF("Huh-3? create lock should have been on??\n"); } - /* - * Turn on queue only flag to prevent data from - * being sent - */ + /* Turn on queue only flag to prevent data from + * being sent */ queue_only = 1; asoc = &stcb->asoc; SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); @@ -13248,10 +13161,8 @@ skip_preblock: } /* PR-SCTP? */ if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { - /* - * This is ugly but we must assure locking - * order - */ + /* This is ugly but we must assure locking + * order */ if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); hold_tcblock = 1; @@ -13528,10 +13439,8 @@ dataless_eof: msg); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_LOCKED); - /* - * now relock the stcb so everything - * is sane - */ + /* now relock the stcb so everything + * is sane */ hold_tcblock = 0; stcb = NULL; goto out; @@ -13605,10 +13514,8 @@ skip_out_eof: if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) { /* we can attempt to send too. */ if (hold_tcblock == 0) { - /* - * If there is activity recv'ing sacks no need to - * send - */ + /* If there is activity recv'ing sacks no need to + * send */ if (SCTP_TCB_TRYLOCK(stcb)) { sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED); hold_tcblock = 1; @@ -13774,8 +13681,8 @@ sctp_v6src_match_nexthop(struct sockaddr SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)&gw6); SCTPDBG(SCTP_DEBUG_OUTPUT2, "installed router is "); SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, ro->ro_rt->rt_gateway); - if (sctp_cmpaddr((struct sockaddr *)&gw6, - ro->ro_rt->rt_gateway)) { + if (sctp_cmpaddr((struct sockaddr *)&gw6, ro->ro_rt->rt_gateway)) { + ND6_RUNLOCK(); SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is installed\n"); return (1); } @@ -13783,7 +13690,6 @@ sctp_v6src_match_nexthop(struct sockaddr SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is not installed\n"); return (0); } - #endif int From owner-svn-src-stable-11@freebsd.org Sun Dec 18 13:00:13 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 212C7C8576D; Sun, 18 Dec 2016 13:00:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD0D115EE; Sun, 18 Dec 2016 13:00:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBID0CCF070624; Sun, 18 Dec 2016 13:00:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBID0BjG070614; Sun, 18 Dec 2016 13:00:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181300.uBID0BjG070614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:00:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310218 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:00:13 -0000 Author: tuexen Date: Sun Dec 18 13:00:11 2016 New Revision: 310218 URL: https://svnweb.freebsd.org/changeset/base/310218 Log: MFC r309607: Whitespace changes. The tools using to generate the sources has been updated and produces different whitespaces. Commit this seperately to avoid intermixing these with real code changes. Modified: stable/11/sys/netinet/sctp_asconf.c stable/11/sys/netinet/sctp_asconf.h stable/11/sys/netinet/sctp_bsd_addr.h stable/11/sys/netinet/sctp_cc_functions.c stable/11/sys/netinet/sctp_crc32.c stable/11/sys/netinet/sctp_crc32.h stable/11/sys/netinet/sctp_header.h stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_os_bsd.h stable/11/sys/netinet/sctp_pcb.h stable/11/sys/netinet/sctp_peeloff.h stable/11/sys/netinet/sctp_ss_functions.c stable/11/sys/netinet/sctp_structs.h stable/11/sys/netinet/sctp_sysctl.c stable/11/sys/netinet/sctp_timer.c stable/11/sys/netinet/sctp_uio.h stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctp_var.h stable/11/sys/netinet/sctputil.c stable/11/sys/netinet/sctputil.h stable/11/sys/netinet6/sctp6_usrreq.c stable/11/sys/netinet6/sctp6_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_asconf.c ============================================================================== --- stable/11/sys/netinet/sctp_asconf.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_asconf.c Sun Dec 18 13:00:11 2016 (r310218) @@ -151,24 +151,19 @@ sctp_process_asconf_add_ip(struct sockad union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; int bad_address = 0; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -306,24 +301,19 @@ sctp_process_asconf_delete_ip(struct soc union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; int result; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -441,23 +431,18 @@ sctp_process_asconf_set_primary(struct s union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -1785,7 +1770,7 @@ sctp_handle_asconf_ack(struct mbuf *m, i * if there are any "sent" params still on the queue, these are * implicitly "success", or "failed" (if we got an error back) ... * so process these appropriately - * + * * we assume that the correlation_id's are monotonically increasing * beginning from 1 and that we don't have *that* many outstanding * at any given time @@ -1861,7 +1846,6 @@ sctp_is_scopeid_in_nets(struct sctp_tcb /* didn't find one */ return (0); } - #endif /* @@ -2435,10 +2419,8 @@ sctp_is_addr_pending(struct sctp_tcb *st } } - /* - * we want to find the sequences which consist of ADD -> DEL -> ADD - * or DEL -> ADD - */ + /* we want to find the sequences which consist of ADD -> DEL -> ADD + * or DEL -> ADD */ if (add_cnt > del_cnt || (add_cnt == del_cnt && last_param_type == SCTP_ADD_IP_ADDRESS)) { return (1); @@ -2490,10 +2472,8 @@ sctp_find_valid_localaddr(struct sctp_tc if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* - * found a valid local v4 address to - * use - */ + /* found a valid local v4 address to + * use */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2510,10 +2490,8 @@ sctp_find_valid_localaddr(struct sctp_tc } sin6 = &sctp_ifa->address.sin6; if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - /* - * we skip unspecifed - * addresses - */ + /* we skip unspecifed + * addresses */ continue; } if (prison_check_ip6(stcb->sctp_ep->ip_inp.inp.inp_cred, @@ -2530,10 +2508,8 @@ sctp_find_valid_localaddr(struct sctp_tc if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* - * found a valid local v6 address to - * use - */ + /* found a valid local v6 address to + * use */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2781,14 +2757,11 @@ sctp_process_initack_addresses(struct sc uint16_t plen, ptype; struct sctp_ifa *sctp_ifa; union sctp_sockstore store; - #ifdef INET6 struct sctp_ipv6addr_param addr6_store; - #endif #ifdef INET struct sctp_ipv4addr_param addr4_store; - #endif SCTPDBG(SCTP_DEBUG_ASCONF2, "processing init-ack addresses\n"); @@ -2915,19 +2888,16 @@ sctp_addr_in_initack(struct mbuf *m, uin { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *a4p; struct sctp_ipv6addr_param addr4_store; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *a6p; struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6_tmp; - #endif switch (sa->sa_family) { @@ -3079,14 +3049,11 @@ sctp_check_address_list_all(struct sctp_ struct sctp_ifn *sctp_ifn; struct sctp_ifa *sctp_ifa; uint32_t vrf_id; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif if (stcb) { @@ -3301,14 +3268,11 @@ sctp_asconf_send_nat_state_update(struct struct sctp_asconf_addr *aa; struct sctp_ifa *sctp_ifap; struct sctp_asconf_tag_param *vtag; - #ifdef INET struct sockaddr_in *to; - #endif #ifdef INET6 struct sockaddr_in6 *to6; - #endif if (net == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "sctp_asconf_send_nat_state_update: Missing net\n"); Modified: stable/11/sys/netinet/sctp_asconf.h ============================================================================== --- stable/11/sys/netinet/sctp_asconf.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_asconf.h Sun Dec 18 13:00:11 2016 (r310218) @@ -90,7 +90,6 @@ sctp_asconf_send_nat_state_update(struct extern int sctp_is_addr_pending(struct sctp_tcb *, struct sctp_ifa *); - #endif /* _KERNEL */ #endif /* !_NETINET_SCTP_ASCONF_H_ */ Modified: stable/11/sys/netinet/sctp_bsd_addr.h ============================================================================== --- stable/11/sys/netinet/sctp_bsd_addr.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_bsd_addr.h Sun Dec 18 13:00:11 2016 (r310218) @@ -48,7 +48,6 @@ void sctp_startup_iterator(void); #ifdef INET6 void sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa); - #endif #ifdef SCTP_PACKET_LOGGING Modified: stable/11/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 13:00:11 2016 (r310218) @@ -160,17 +160,13 @@ sctp_cwnd_update_after_fr(struct sctp_tc uint32_t srtt; srtt = net->lastsa; - /* - * lastsa>>3; we don't need - * to devide ... - */ + /* lastsa>>3; we don't need + * to devide ... */ if (srtt == 0) { srtt = 1; } - /* - * Short Version => Equal to - * Contel Version MBe - */ + /* Short Version => Equal to + * Contel Version MBe */ net->ssthresh = (uint32_t) (((uint64_t) 4 * (uint64_t) net->mtu * (uint64_t) net->cwnd) / @@ -405,10 +401,8 @@ cc_bw_decrease(struct sctp_tcb *stcb, st net->flight_size, probepoint); if (net->cc_mod.rtcc.ret_from_eq) { - /* - * Switch over to CA if we are less - * aggressive - */ + /* Switch over to CA if we are less + * aggressive */ net->ssthresh = net->cwnd - 1; net->partial_bytes_acked = 0; } @@ -784,9 +778,9 @@ sctp_cwnd_update_after_sack_common(struc /* * At this point our bw_bytes has been updated by * incoming sack information. - * + * * But our bw may not yet be set. - * + * */ if ((net->cc_mod.rtcc.new_tot_time / 1000) > 0) { nbw = net->cc_mod.rtcc.bw_bytes / (net->cc_mod.rtcc.new_tot_time / 1000); @@ -851,10 +845,8 @@ sctp_cwnd_update_after_sack_common(struc } break; case SCTP_CMT_RPV2: - /* - * lastsa>>3; we don't need - * to divide ... - */ + /* lastsa>>3; we don't need + * to divide ... */ srtt = net->lastsa; if (srtt == 0) { srtt = 1; @@ -938,10 +930,8 @@ sctp_cwnd_update_after_sack_common(struc } break; case SCTP_CMT_RPV2: - /* - * lastsa>>3; we don't need - * to divide ... - */ + /* lastsa>>3; we don't need + * to divide ... */ srtt = net->lastsa; if (srtt == 0) { srtt = 1; @@ -1108,10 +1098,8 @@ sctp_cwnd_update_after_ecn_echo_common(s sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); } } else { - /* - * Further tuning down required over the drastic - * original cut - */ + /* Further tuning down required over the drastic + * original cut */ net->ssthresh -= (net->mtu * num_pkt_lost); net->cwnd -= (net->mtu * num_pkt_lost); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { @@ -1125,10 +1113,8 @@ sctp_cwnd_update_after_ecn_echo_common(s net->ssthresh = net->cwnd / 2; if (net->ssthresh < net->mtu) { net->ssthresh = net->mtu; - /* - * here back off the timer as well, to slow - * us down - */ + /* here back off the timer as well, to slow + * us down */ net->RTO <<= 1; } net->cwnd = net->ssthresh; @@ -1375,10 +1361,8 @@ sctp_cwnd_new_rtcc_transmission_begins(s cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); if (cwnd_in_mtu == 0) { - /* - * Using 0 means that the value of RFC 4960 - * is used. - */ + /* Using 0 means that the value of RFC 4960 + * is used. */ cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); } else { /* @@ -1390,10 +1374,8 @@ sctp_cwnd_new_rtcc_transmission_begins(s cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; } if (net->cwnd > cwnd) { - /* - * Only set if we are not a timeout (i.e. - * down to 1 mtu) - */ + /* Only set if we are not a timeout (i.e. + * down to 1 mtu) */ net->cwnd = cwnd; } } @@ -2023,10 +2005,8 @@ htcp_param_update(struct sctp_nets *net) htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); htcp_alpha_update(&net->cc_mod.htcp_ca); - /* - * add slowly fading memory for maxRTT to accommodate routing - * changes etc - */ + /* add slowly fading memory for maxRTT to accommodate routing + * changes etc */ if (minRTT > 0 && maxRTT > minRTT) net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100; } @@ -2109,7 +2089,6 @@ htcp_min_cwnd(struct sctp_tcb *stcb, str { return (net->ssthresh); } - #endif static void Modified: stable/11/sys/netinet/sctp_crc32.c ============================================================================== --- stable/11/sys/netinet/sctp_crc32.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_crc32.c Sun Dec 18 13:00:11 2016 (r310218) @@ -113,7 +113,6 @@ sctp_calculate_cksum(struct mbuf *m, uin base = sctp_finalize_crc32c(base); return (base); } - #endif /* !defined(SCTP_WITH_NO_CSUM) */ Modified: stable/11/sys/netinet/sctp_crc32.h ============================================================================== --- stable/11/sys/netinet/sctp_crc32.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_crc32.h Sun Dec 18 13:00:11 2016 (r310218) @@ -39,9 +39,7 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) #if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); - #endif void sctp_delayed_cksum(struct mbuf *, uint32_t offset); - #endif /* _KERNEL */ #endif /* __crc32c_h__ */ Modified: stable/11/sys/netinet/sctp_header.h ============================================================================== --- stable/11/sys/netinet/sctp_header.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_header.h Sun Dec 18 13:00:11 2016 (r310218) @@ -182,7 +182,6 @@ struct sctp_init { uint32_t initial_tsn; /* I-TSN */ /* optional param's follow */ } SCTP_PACKED; - #define SCTP_IDENTIFICATION_SIZE 16 #define SCTP_ADDRESS_SIZE 4 #define SCTP_RESERVE_SPACE 6 Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:00:11 2016 (r310218) @@ -341,10 +341,8 @@ sctp_place_control_in_stream(struct sctp q = &strm->uno_inqueue; if (asoc->idata_supported == 0) { if (!TAILQ_EMPTY(q)) { - /* - * Only one stream can be here in old style - * -- abort - */ + /* Only one stream can be here in old style + * -- abort */ return (-1); } TAILQ_INSERT_TAIL(q, control, next_instrm); @@ -487,13 +485,13 @@ sctp_queue_data_to_stream(struct sctp_tc * has wrapped but not in the stream. Is this worth worrying about * or should we just change our queue sort at the bottom to be by * TSN. - * - * Could it also be legal for a peer to send ssn 1 with TSN 2 and ssn 2 - * with TSN 1? If the peer is doing some sort of funky TSN/SSN + * + * Could it also be legal for a peer to send ssn 1 with TSN 2 and + * ssn 2 with TSN 1? If the peer is doing some sort of funky TSN/SSN * assignment this could happen... and I don't see how this would be * a violation. So for now I am undecided an will leave the sort by * SSN alone. Maybe a hybred approach is the answer - * + * */ struct sctp_queued_to_read *at; int queue_needed; @@ -828,10 +826,8 @@ restart: TAILQ_INSERT_TAIL(&nc->reasm, tchk, sctp_next); tchk = TAILQ_FIRST(&control->reasm); } - /* - * Now lets add it to the queue - * after removing control - */ + /* Now lets add it to the queue + * after removing control */ TAILQ_INSERT_TAIL(&strm->uno_inqueue, nc, next_instrm); nc->on_strm_q = SCTP_ON_UNORDERED; if (control->on_strm_q) { @@ -855,10 +851,8 @@ restart: } sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); if ((nc->first_frag_seen) && !TAILQ_EMPTY(&nc->reasm)) { - /* - * Switch to the new guy and - * continue - */ + /* Switch to the new guy and + * continue */ control = nc; goto restart; } else { @@ -918,10 +912,8 @@ sctp_inject_old_unordered_data(struct sc uint32_t tmp; if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->fsn_included)) { - /* - * Easy way the start of a new guy beyond - * the lowest - */ + /* Easy way the start of a new guy beyond + * the lowest */ goto place_chunk; } if ((chk->rec.data.fsn_num == control->fsn_included) || @@ -931,10 +923,10 @@ sctp_inject_old_unordered_data(struct sc * started the pd-api on the higher TSN * (since the equals part is a TSN failure * it must be that). - * - * We are completly hosed in that case since I - * have no way to recover. This really will - * only happen if we can get more TSN's + * + * We are completly hosed in that case since + * I have no way to recover. This really + * will only happen if we can get more TSN's * higher before the pd-api-point. */ sctp_abort_in_reasm(stcb, control, chk, @@ -1136,10 +1128,8 @@ done_un: } } if (strm->pd_api_started) { - /* - * Can't add more must have gotten an un-ordered above being - * partially delivered. - */ + /* Can't add more must have gotten an un-ordered above being + * partially delivered. */ return (0); } deliver_more: @@ -1171,21 +1161,15 @@ deliver_more: ret++; } if (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - /* - * A singleton now slipping through - mark - * it non-revokable too - */ + /* A singleton now slipping through - mark + * it non-revokable too */ sctp_mark_non_revokable(asoc, control->sinfo_tsn); } else if (control->end_added == 0) { - /* - * Check if we can defer adding until its - * all there - */ + /* Check if we can defer adding until its + * all there */ if ((control->length < pd_point) || (strm->pd_api_started)) { - /* - * Don't need it or cannot add more - * (one being delivered that way) - */ + /* Don't need it or cannot add more + * (one being delivered that way) */ goto out; } } @@ -1387,10 +1371,8 @@ sctp_queue_data_for_reasm(struct sctp_tc * we know the first FSN (which is the TSN). */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { - /* - * We have already delivered up to - * this so its a dup - */ + /* We have already delivered up to + * this so its a dup */ sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_9); @@ -1417,10 +1399,8 @@ sctp_queue_data_for_reasm(struct sctp_tc */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { - /* - * We have already delivered up to - * this so its a dup - */ + /* We have already delivered up to + * this so its a dup */ SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is already seen in included_fsn: %u -- abort\n", chk->rec.data.fsn_num, control->fsn_included); @@ -1430,10 +1410,8 @@ sctp_queue_data_for_reasm(struct sctp_tc return; } } - /* - * validate not beyond top FSN if we have seen last - * one - */ + /* validate not beyond top FSN if we have seen last + * one */ if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is beyond or at top_fsn: %u -- abort\n", @@ -1467,10 +1445,8 @@ sctp_queue_data_for_reasm(struct sctp_tc inserted = 1; break; } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) { - /* - * Gak, He sent me a duplicate str seq - * number - */ + /* Gak, He sent me a duplicate str seq + * number */ /* * foo bar, I guess I will just free this * new guy, should we abort too? FIX ME @@ -1778,19 +1754,15 @@ sctp_process_a_data_chunk(struct sctp_tc return (0); } if (ordered && ((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED)) { - /* - * We can't have a switched order with an - * unordered chunk - */ + /* We can't have a switched order with an + * unordered chunk */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; } if (!ordered && (((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED) == 0)) { - /* - * We can't have a switched unordered with a - * ordered chunk - */ + /* We can't have a switched unordered with a + * ordered chunk */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; @@ -2086,7 +2058,7 @@ sctp_process_a_data_chunk(struct sctp_tc * if it is not being reset.. that way we would not create a * HOLB when amongst streams being reset and those not being * reset. - * + * */ if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && SCTP_TSN_GT(tsn, liste->tsn)) { @@ -2284,10 +2256,10 @@ sctp_slide_mapping_arrays(struct sctp_tc /* * Now we also need to check the mapping array in a couple of ways. * 1) Did we move the cum-ack point? - * - * When you first glance at this you might think that all entries that - * make up the position of the cum-ack would be in the nr-mapping - * array only.. i.e. things up to the cum-ack are always + * + * When you first glance at this you might think that all entries + * that make up the position of the cum-ack would be in the + * nr-mapping array only.. i.e. things up to the cum-ack are always * deliverable. Thats true with one exception, when its a fragmented * message we may not deliver the data until some threshold (or all * of it) is in place. So we must OR the nr_mapping_array and @@ -2346,10 +2318,8 @@ sctp_slide_mapping_arrays(struct sctp_tc /* The complete array was completed by a single FR */ /* highest becomes the cum-ack */ int clr; - #ifdef INVARIANTS unsigned int i; - #endif /* clear the array */ @@ -2497,8 +2467,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i (stcb->asoc.numduptsns) || /* we have dup's */ (is_a_gap) || /* is still a gap */ (stcb->asoc.delayed_ack == 0) || /* Delayed sack disabled */ - (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ - ) { + (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ ) { if ((stcb->asoc.sctp_cmt_on_off > 0) && (SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) && @@ -2510,9 +2479,9 @@ sctp_sack_check(struct sctp_tcb *stcb, i /* * CMT DAC algorithm: With CMT, delay acks * even in the face of - * - * reordering. Therefore, if acks that do not - * have to be sent because of the above + * + * reordering. Therefore, if acks that do + * not have to be sent because of the above * reasons, will be delayed. That is, acks * that would have been sent due to gap * reports will be delayed with DAC. Start @@ -2719,7 +2688,7 @@ sctp_process_data(struct mbuf **mm, int * Now, what do we do with KNOWN * chunks that are NOT in the right * place? - * + * * For now, I do nothing but ignore * them. We may later want to add * sysctl stuff to switch out and do @@ -2761,8 +2730,7 @@ sctp_process_data(struct mbuf **mm, int /* discard the rest of this packet */ stop_proc = 1; } /* else skip this bad chunk and - * continue... */ - break; + * continue... */ break; } /* switch of chunk type */ } *offset += SCTP_SIZE32(chk_length); @@ -3019,10 +2987,8 @@ sctp_process_segment_range(struct sctp_t } tp1->sent = SCTP_DATAGRAM_NR_ACKED; if (tp1->data) { - /* - * sa_ignore - * NO_NULL_CHK - */ + /* sa_ignore + * NO_NULL_CHK */ sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); sctp_m_freem(tp1->data); tp1->data = NULL; @@ -3031,8 +2997,7 @@ sctp_process_segment_range(struct sctp_t } } break; - } /* if (tp1->TSN_seq == theTSN) */ - if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, theTSN)) { + } /* if (tp1->TSN_seq == theTSN) */ if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, theTSN)) { break; } tp1 = TAILQ_NEXT(tp1, sctp_next); @@ -3483,10 +3448,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t if ((stcb->asoc.prsctp_supported) && (PR_SCTP_RTX_ENABLED(tp1->flags))) { - /* - * Has it been retransmitted tv_sec times? - - * we store the retran count there. - */ + /* Has it been retransmitted tv_sec times? - + * we store the retran count there. */ if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) { /* Yes, so drop it */ if (tp1->data != NULL) { @@ -3498,10 +3461,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t continue; } } - /* - * SCTP_PRINTF("OK, we are now ready to FR this - * guy\n"); - */ + /* SCTP_PRINTF("OK, we are now ready to FR this + * guy\n"); */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(tp1->rec.data.TSN_seq, tp1->snd_count, 0, SCTP_FR_MARKED); @@ -3521,18 +3482,14 @@ sctp_strike_gap_ack_chunks(struct sctp_t alt = tp1->whoTo; /* sa_ignore NO_NULL_CHK */ if (asoc->sctp_cmt_pf > 0) { - /* - * JRS 5/18/07 - If CMT PF is on, + /* JRS 5/18/07 - If CMT PF is on, * use the PF version of - * find_alt_net() - */ + * find_alt_net() */ alt = sctp_find_alternate_net(stcb, alt, 2); } else { - /* - * JRS 5/18/07 - If only CMT is on, + /* JRS 5/18/07 - If only CMT is on, * use the CMT version of - * find_alt_net() - */ + * find_alt_net() */ /* sa_ignore NO_NULL_CHK */ alt = sctp_find_alternate_net(stcb, alt, 1); } @@ -3713,10 +3670,8 @@ sctp_fs_audit(struct sctp_association *a struct sctp_tmit_chunk *chk; int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; int ret; - #ifndef INVARIANTS int entry_flight, entry_cnt; - #endif ret = 0; @@ -3933,8 +3888,7 @@ sctp_express_handle_sack(struct sctp_tcb tp1->whoTo->RTO = /* * sa_ignore - * NO_NULL_CH - * K + * NO_NULL_CHK */ sctp_calculate_rto(stcb, asoc, tp1->whoTo, @@ -4066,10 +4020,8 @@ sctp_express_handle_sack(struct sctp_tcb } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* - * release the alternate, - * primary is good - */ + /* release the alternate, + * primary is good */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -4152,10 +4104,8 @@ again: } } else { if (net->window_probe) { - /* - * In window probes we must assure a timer - * is still running there - */ + /* In window probes we must assure a timer + * is still running there */ net->window_probe = 0; if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, @@ -4775,7 +4725,7 @@ hopeless_peer: } /* * Check for revoked fragments: - * + * * if Previous sack - Had no frags then we can't have any revoked if * Previous sack - Had frag's then - If we now have frags aka * num_seg > 0 call sctp_check_for_revoked() to tell if peer revoked @@ -4840,10 +4790,8 @@ hopeless_peer: } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* - * release the alternate, - * primary is good - */ + /* release the alternate, + * primary is good */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -5054,10 +5002,8 @@ again: } } else { if (net->window_probe) { - /* - * In window probes we must assure a timer - * is still running there - */ + /* In window probes we must assure a timer + * is still running there */ if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); @@ -5213,10 +5159,8 @@ sctp_kick_prsctp_reorder_queue(struct sc } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* - * Make it so this is next to - * deliver, we restore later - */ + /* Make it so this is next to + * deliver, we restore later */ strmin->last_sequence_delivered = ctl->sinfo_ssn - 1; need_reasm_check = 1; break; @@ -5280,10 +5224,8 @@ sctp_kick_prsctp_reorder_queue(struct sc } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* - * Make it so this is next to - * deliver - */ + /* Make it so this is next to + * deliver */ strmin->last_sequence_delivered = ctl->sinfo_ssn - 1; need_reasm_check = 1; break; @@ -5392,11 +5334,11 @@ sctp_handle_forward_tsn(struct sctp_tcb /* * here we will perform all the data receiver side steps for * processing FwdTSN, as required in by pr-sctp draft: - * + * * Assume we get FwdTSN(x): - * - * 1) update local cumTSN to x 2) try to further advance cumTSN to x + - * others we have 3) examine and update re-ordering queue on + * + * 1) update local cumTSN to x 2) try to further advance cumTSN to x + * + others we have 3) examine and update re-ordering queue on * pr-in-streams 4) clean up re-assembly queue 5) Send a sack to * report where we are. */ Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_input.c Sun Dec 18 13:00:11 2016 (r310218) @@ -161,10 +161,8 @@ sctp_handle_init(struct mbuf *m, int iph *abort_no_unlock = 1; goto outnow; } - /* - * We are only accepting if we have a socket with positive - * so_qlimit. - */ + /* We are only accepting if we have a socket with positive + * so_qlimit. */ if ((stcb == NULL) && ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || @@ -709,10 +707,8 @@ sctp_handle_nat_colliding_state(struct s LIST_REMOVE(stcb, sctp_asocs); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* - * put it in the bucket in the vtag hash of assoc's for the - * system - */ + /* put it in the bucket in the vtag hash of assoc's for the + * system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -730,10 +726,8 @@ sctp_handle_nat_colliding_state(struct s sctp_toss_old_cookies(stcb, &stcb->asoc); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* - * put it in the bucket in the vtag hash of assoc's for the - * system - */ + /* put it in the bucket in the vtag hash of assoc's for the + * system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -764,7 +758,6 @@ sctp_handle_abort(struct sctp_abort_chun { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif uint16_t len; uint16_t error; @@ -866,10 +859,8 @@ sctp_handle_shutdown(struct sctp_shutdow struct sctp_association *asoc; int some_on_streamwheel; int old_state; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif SCTPDBG(SCTP_DEBUG_INPUT2, @@ -946,10 +937,8 @@ sctp_handle_shutdown(struct sctp_shutdow (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT)) { SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_RECEIVED); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - /* - * notify upper layer that peer has initiated a - * shutdown - */ + /* notify upper layer that peer has initiated a + * shutdown */ sctp_ulp_notify(SCTP_NOTIFY_PEER_SHUTDOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); /* reset time */ @@ -999,7 +988,6 @@ sctp_handle_shutdown_ack(struct sctp_shu struct sctp_nets *net) { struct sctp_association *asoc; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -1169,10 +1157,8 @@ sctp_handle_error(struct sctp_chunkhdr * uint16_t error_len; struct sctp_association *asoc; int adjust; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif /* parse through all of the errors and process */ @@ -1492,10 +1478,8 @@ sctp_process_cookie_existing(struct mbuf int retval; int spec_flag = 0; uint32_t how_indx; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif net = *netp; @@ -1619,7 +1603,6 @@ sctp_process_cookie_existing(struct mbuf ) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif /* * Here is where collision would go if we @@ -1820,7 +1803,6 @@ sctp_process_cookie_existing(struct mbuf (inp->sctp_socket->so_qlimit == 0)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Dec 18 13:04:31 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35778C8596D; Sun, 18 Dec 2016 13:04:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1B901A2C; Sun, 18 Dec 2016 13:04:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBID4Uig074287; Sun, 18 Dec 2016 13:04:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBID4TXK074282; Sun, 18 Dec 2016 13:04:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181304.uBID4TXK074282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310219 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:04:31 -0000 Author: tuexen Date: Sun Dec 18 13:04:29 2016 New Revision: 310219 URL: https://svnweb.freebsd.org/changeset/base/310219 Log: MFC r309682: Cleanup the names of SSN, SID, TSN, FSN, PPID and MID. This made a couple of bugs visible in handling SSN wrap-arounds when using DATA chunks. Now bulk transfer seems to work fine... This fixes the issue reported in https://github.com/sctplab/usrsctp/issues/111 Modified: stable/11/sys/netinet/sctp_cc_functions.c stable/11/sys/netinet/sctp_constants.h stable/11/sys/netinet/sctp_header.h stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctp_indata.h stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_pcb.c stable/11/sys/netinet/sctp_ss_functions.c stable/11/sys/netinet/sctp_structs.h stable/11/sys/netinet/sctp_timer.c stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctp_var.h stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 13:04:29 2016 (r310219) @@ -205,7 +205,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc /* Mark end of the window */ asoc->fast_recovery_tsn = asoc->sending_seq - 1; } else { - asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; } /* @@ -218,7 +218,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc /* Mark end of the window */ net->fast_recovery_tsn = asoc->sending_seq - 1; } else { - net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + net->fast_recovery_tsn = lchk->rec.data.tsn - 1; } sctp_timer_stop(SCTP_TIMER_TYPE_SEND, @@ -1698,7 +1698,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp /* Mark end of the window */ asoc->fast_recovery_tsn = asoc->sending_seq - 1; } else { - asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; } /* @@ -1711,7 +1711,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp /* Mark end of the window */ net->fast_recovery_tsn = asoc->sending_seq - 1; } else { - net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + net->fast_recovery_tsn = lchk->rec.data.tsn - 1; } sctp_timer_stop(SCTP_TIMER_TYPE_SEND, @@ -2228,7 +2228,7 @@ sctp_htcp_cwnd_update_after_fr(struct sc /* Mark end of the window */ asoc->fast_recovery_tsn = asoc->sending_seq - 1; } else { - asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; } /* @@ -2241,7 +2241,7 @@ sctp_htcp_cwnd_update_after_fr(struct sc /* Mark end of the window */ net->fast_recovery_tsn = asoc->sending_seq - 1; } else { - net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + net->fast_recovery_tsn = lchk->rec.data.tsn - 1; } sctp_timer_stop(SCTP_TIMER_TYPE_SEND, Modified: stable/11/sys/netinet/sctp_constants.h ============================================================================== --- stable/11/sys/netinet/sctp_constants.h Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_constants.h Sun Dec 18 13:04:29 2016 (r310219) @@ -898,8 +898,9 @@ __FBSDID("$FreeBSD$"); #define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b) #define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) #define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) -#define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GT(a, b)) -#define SCTP_MSGID_GE(o, a, b) ((o == 1) ? SCTP_UINT16_GE((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GE(a, b)) +#define SCTP_MID_GT(i, a, b) (((i) == 1) ? SCTP_UINT32_GT(a, b) : SCTP_UINT16_GT((uint16_t)a, (uint16_t)b)) +#define SCTP_MID_GE(i, a, b) (((i) == 1) ? SCTP_UINT32_GE(a, b) : SCTP_UINT16_GE((uint16_t)a, (uint16_t)b)) +#define SCTP_MID_EQ(i, a, b) (((i) == 1) ? a == b : (uint16_t)a == (uint16_t)b) /* Mapping array manipulation routines */ #define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) Modified: stable/11/sys/netinet/sctp_header.h ============================================================================== --- stable/11/sys/netinet/sctp_header.h Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_header.h Sun Dec 18 13:04:29 2016 (r310219) @@ -141,9 +141,9 @@ struct sctp_supported_chunk_types_param */ struct sctp_data { uint32_t tsn; - uint16_t stream_id; - uint16_t stream_sequence; - uint32_t protocol_id; + uint16_t sid; + uint16_t ssn; + uint32_t ppid; /* user data follows */ } SCTP_PACKED; @@ -154,11 +154,11 @@ struct sctp_data_chunk { struct sctp_idata { uint32_t tsn; - uint16_t stream_id; + uint16_t sid; uint16_t reserved; /* Where does the SSN go? */ - uint32_t msg_id; + uint32_t mid; union { - uint32_t protocol_id; + uint32_t ppid; uint32_t fsn; /* Fragment Sequence Number */ } ppid_fsn; /* user data follows */ @@ -390,14 +390,14 @@ struct sctp_forward_tsn_chunk { } SCTP_PACKED; struct sctp_strseq { - uint16_t stream; - uint16_t sequence; + uint16_t sid; + uint16_t ssn; } SCTP_PACKED; struct sctp_strseq_mid { - uint16_t stream; + uint16_t sid; uint16_t flags; - uint32_t msg_id; + uint32_t mid; }; struct sctp_forward_tsn_msg { Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:04:29 2016 (r310219) @@ -130,8 +130,8 @@ struct sctp_queued_to_read * sctp_build_readq_entry(struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t tsn, uint32_t ppid, - uint32_t context, uint16_t stream_no, - uint32_t stream_seq, uint8_t flags, + uint32_t context, uint16_t sid, + uint32_t mid, uint8_t flags, struct mbuf *dm) { struct sctp_queued_to_read *read_queue_e = NULL; @@ -141,14 +141,14 @@ sctp_build_readq_entry(struct sctp_tcb * goto failed_build; } memset(read_queue_e, 0, sizeof(struct sctp_queued_to_read)); - read_queue_e->sinfo_stream = stream_no; - read_queue_e->sinfo_ssn = stream_seq; + read_queue_e->sinfo_stream = sid; read_queue_e->sinfo_flags = (flags << 8); read_queue_e->sinfo_ppid = ppid; read_queue_e->sinfo_context = context; read_queue_e->sinfo_tsn = tsn; read_queue_e->sinfo_cumtsn = tsn; read_queue_e->sinfo_assoc_id = sctp_get_associd(stcb); + read_queue_e->mid = mid; read_queue_e->top_fsn = read_queue_e->fsn_included = 0xffffffff; TAILQ_INIT(&read_queue_e->reasm); read_queue_e->whoFrom = net; @@ -366,7 +366,7 @@ sctp_place_control_in_stream(struct sctp return (0); } else { TAILQ_FOREACH(at, q, next_instrm) { - if (SCTP_TSN_GT(at->msg_id, control->msg_id)) { + if (SCTP_MID_GT(asoc->idata_supported, at->mid, control->mid)) { /* * one in queue is bigger than the new one, * insert before this one @@ -378,7 +378,7 @@ sctp_place_control_in_stream(struct sctp control->on_strm_q = SCTP_ON_ORDERED; } break; - } else if (at->msg_id == control->msg_id) { + } else if (SCTP_MID_EQ(asoc->idata_supported, at->mid, control->mid)) { /* * Gak, He sent me a duplicate msg id * number?? return -1 to abort. @@ -423,18 +423,18 @@ sctp_abort_in_reasm(struct sctp_tcb *stc "Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", opspot, control->fsn_included, - chk->rec.data.TSN_seq, - chk->rec.data.stream_number, - chk->rec.data.fsn_num, chk->rec.data.stream_seq); + chk->rec.data.tsn, + chk->rec.data.sid, + chk->rec.data.fsn, chk->rec.data.mid); } else { snprintf(msg, sizeof(msg), "Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", opspot, control->fsn_included, - chk->rec.data.TSN_seq, - chk->rec.data.stream_number, - chk->rec.data.fsn_num, - (uint16_t) chk->rec.data.stream_seq); + chk->rec.data.tsn, + chk->rec.data.sid, + chk->rec.data.fsn, + (uint16_t) chk->rec.data.mid); } oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_m_freem(chk->data); @@ -502,19 +502,27 @@ sctp_queue_data_to_stream(struct sctp_tc if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); } - if (SCTP_MSGID_GT((!asoc->idata_supported), strm->last_sequence_delivered, control->sinfo_ssn)) { + if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ: %u delivered: %u from peer, Abort association\n", - control->sinfo_ssn, strm->last_sequence_delivered); + control->mid, strm->last_mid_delivered); protocol_error: /* * throw it in the stream so it gets cleaned up in * association destruction */ TAILQ_INSERT_HEAD(&strm->inqueue, control, next_instrm); - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", - strm->last_sequence_delivered, control->sinfo_tsn, - control->sinfo_stream, control->sinfo_ssn); + if (asoc->idata_supported) { + snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", + strm->last_mid_delivered, control->sinfo_tsn, + control->sinfo_stream, control->mid); + } else { + snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", + (uint16_t) strm->last_mid_delivered, + control->sinfo_tsn, + control->sinfo_stream, + (uint16_t) control->mid); + } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -528,8 +536,8 @@ protocol_error: queue_needed = 1; asoc->size_on_all_streams += control->length; sctp_ucount_incr(asoc->cnt_on_all_streams); - nxt_todel = strm->last_sequence_delivered + 1; - if (nxt_todel == control->sinfo_ssn) { + nxt_todel = strm->last_mid_delivered + 1; + if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -552,7 +560,7 @@ protocol_error: queue_needed = 0; asoc->size_on_all_streams -= control->length; sctp_ucount_decr(asoc->cnt_on_all_streams); - strm->last_sequence_delivered++; + strm->last_mid_delivered++; sctp_mark_non_revokable(asoc, control->sinfo_tsn); sctp_add_to_readq(stcb->sctp_ep, stcb, control, @@ -560,8 +568,8 @@ protocol_error: SCTP_READ_LOCK_NOT_HELD, SCTP_SO_LOCKED); TAILQ_FOREACH_SAFE(control, &strm->inqueue, next_instrm, at) { /* all delivered */ - nxt_todel = strm->last_sequence_delivered + 1; - if ((nxt_todel == control->sinfo_ssn) && + nxt_todel = strm->last_mid_delivered + 1; + if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid) && (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG)) { asoc->size_on_all_streams -= control->length; sctp_ucount_decr(asoc->cnt_on_all_streams); @@ -574,7 +582,7 @@ protocol_error: #endif } control->on_strm_q = 0; - strm->last_sequence_delivered++; + strm->last_mid_delivered++; /* * We ignore the return of deliver_data here * since we always can hold the chunk on the @@ -592,7 +600,7 @@ protocol_error: SCTP_READ_LOCK_NOT_HELD, SCTP_SO_LOCKED); continue; - } else if (nxt_todel == control->sinfo_ssn) { + } else if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { *need_reasm = 1; } break; @@ -608,8 +616,8 @@ protocol_error: */ if (sctp_place_control_in_stream(strm, asoc, control)) { snprintf(msg, sizeof(msg), - "Queue to str msg_id: %u duplicate", - control->msg_id); + "Queue to str MID: %u duplicate", + control->mid); sctp_clean_up_control(stcb, control); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; @@ -720,10 +728,10 @@ sctp_build_readq_entry_from_ctl(struct s { memset(nc, 0, sizeof(struct sctp_queued_to_read)); nc->sinfo_stream = control->sinfo_stream; - nc->sinfo_ssn = control->sinfo_ssn; + nc->mid = control->mid; TAILQ_INIT(&nc->reasm); nc->top_fsn = control->top_fsn; - nc->msg_id = control->msg_id; + nc->mid = control->mid; nc->sinfo_flags = control->sinfo_flags; nc->sinfo_ppid = control->sinfo_ppid; nc->sinfo_context = control->sinfo_context; @@ -762,11 +770,11 @@ sctp_handle_old_unordered_data(struct sc { /* * Special handling for the old un-ordered data chunk. All the - * chunks/TSN's go to msg_id 0. So we have to do the old style - * watching to see if we have it all. If you return one, no other - * control entries on the un-ordered queue will be looked at. In - * theory there should be no others entries in reality, unless the - * guy is sending both unordered NDATA and unordered DATA... + * chunks/TSN's go to mid 0. So we have to do the old style watching + * to see if we have it all. If you return one, no other control + * entries on the un-ordered queue will be looked at. In theory + * there should be no others entries in reality, unless the guy is + * sending both unordered NDATA and unordered DATA... */ struct sctp_tmit_chunk *chk, *lchk, *tchk; uint32_t fsn; @@ -783,7 +791,7 @@ restart: fsn = control->fsn_included + 1; /* Now what can we add? */ TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, lchk) { - if (chk->rec.data.fsn_num == fsn) { + if (chk->rec.data.fsn == fsn) { /* Ok lets add it */ sctp_alloc_a_readq(stcb, nc); if (nc == NULL) { @@ -810,11 +818,11 @@ restart: asoc->size_on_reasm_queue -= tchk->send_size; sctp_ucount_decr(asoc->cnt_on_reasm_queue); nc->first_frag_seen = 1; - nc->fsn_included = tchk->rec.data.fsn_num; + nc->fsn_included = tchk->rec.data.fsn; nc->data = tchk->data; - nc->sinfo_ppid = tchk->rec.data.payloadtype; - nc->sinfo_tsn = tchk->rec.data.TSN_seq; - sctp_mark_non_revokable(asoc, tchk->rec.data.TSN_seq); + nc->sinfo_ppid = tchk->rec.data.ppid; + nc->sinfo_tsn = tchk->rec.data.tsn; + sctp_mark_non_revokable(asoc, tchk->rec.data.tsn); tchk->data = NULL; sctp_free_a_chunk(stcb, tchk, SCTP_SO_NOT_LOCKED); sctp_setup_tail_pointer(nc); @@ -900,7 +908,7 @@ sctp_inject_old_unordered_data(struct sc /* Its the very first one. */ SCTPDBG(SCTP_DEBUG_XXX, "chunk is a first fsn: %u becomes fsn_included\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); if (control->first_frag_seen) { /* * In old un-ordered we can reassembly on one @@ -911,12 +919,12 @@ sctp_inject_old_unordered_data(struct sc struct mbuf *tdata; uint32_t tmp; - if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->fsn_included)) { + if (SCTP_TSN_GT(chk->rec.data.fsn, control->fsn_included)) { /* Easy way the start of a new guy beyond * the lowest */ goto place_chunk; } - if ((chk->rec.data.fsn_num == control->fsn_included) || + if ((chk->rec.data.fsn == control->fsn_included) || (control->pdapi_started)) { /* * Ok this should not happen, if it does we @@ -950,25 +958,25 @@ sctp_inject_old_unordered_data(struct sc sctp_setup_tail_pointer(control); /* Fix the FSN included */ tmp = control->fsn_included; - control->fsn_included = chk->rec.data.fsn_num; - chk->rec.data.fsn_num = tmp; + control->fsn_included = chk->rec.data.fsn; + chk->rec.data.fsn = tmp; /* Fix the TSN included */ tmp = control->sinfo_tsn; - control->sinfo_tsn = chk->rec.data.TSN_seq; - chk->rec.data.TSN_seq = tmp; + control->sinfo_tsn = chk->rec.data.tsn; + chk->rec.data.tsn = tmp; /* Fix the PPID included */ tmp = control->sinfo_ppid; - control->sinfo_ppid = chk->rec.data.payloadtype; - chk->rec.data.payloadtype = tmp; + control->sinfo_ppid = chk->rec.data.ppid; + chk->rec.data.ppid = tmp; /* Fix tail pointer */ goto place_chunk; } control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = chk->rec.data.fsn_num; - control->sinfo_tsn = chk->rec.data.TSN_seq; - control->sinfo_ppid = chk->rec.data.payloadtype; + control->top_fsn = control->fsn_included = chk->rec.data.fsn; + control->sinfo_tsn = chk->rec.data.tsn; + control->sinfo_ppid = chk->rec.data.ppid; control->data = chk->data; - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); + sctp_mark_non_revokable(asoc, chk->rec.data.tsn); chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); sctp_setup_tail_pointer(control); @@ -977,7 +985,7 @@ sctp_inject_old_unordered_data(struct sc place_chunk: inserted = 0; TAILQ_FOREACH(at, &control->reasm, sctp_next) { - if (SCTP_TSN_GT(at->rec.data.fsn_num, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) { /* * This one in queue is bigger than the new one, * insert the new one before at. @@ -987,7 +995,7 @@ place_chunk: inserted = 1; TAILQ_INSERT_BEFORE(at, chk, sctp_next); break; - } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) { + } else if (at->rec.data.fsn == chk->rec.data.fsn) { /* * They sent a duplicate fsn number. This really * should not happen since the FSN is a TSN and it @@ -1003,7 +1011,7 @@ place_chunk: /* Its at the end */ asoc->size_on_reasm_queue += chk->send_size; sctp_ucount_incr(asoc->cnt_on_reasm_queue); - control->top_fsn = chk->rec.data.fsn_num; + control->top_fsn = chk->rec.data.fsn; TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next); } } @@ -1044,7 +1052,7 @@ sctp_deliver_reasm_check(struct sctp_tcb } while (control) { SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u -uo\n", - control, control->end_added, control->sinfo_ssn, control->top_fsn, control->fsn_included); + control, control->end_added, control->mid, control->top_fsn, control->fsn_included); nctl = TAILQ_NEXT(control, next_instrm); if (control->end_added) { /* We just put the last bit on */ @@ -1089,7 +1097,7 @@ done_un: if (control == NULL) { return (ret); } - if (strm->last_sequence_delivered == control->sinfo_ssn) { + if (SCTP_MID_EQ(asoc->idata_supported, strm->last_mid_delivered, control->mid)) { /* * Ok the guy at the top was being partially delivered * completed, so we remove it. Note the pd_api flag was @@ -1099,9 +1107,9 @@ done_un: nctl = TAILQ_NEXT(control, next_instrm); SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (lastdel: %u)- o\n", - control, control->end_added, control->sinfo_ssn, + control, control->end_added, control->mid, control->top_fsn, control->fsn_included, - strm->last_sequence_delivered); + strm->last_mid_delivered); if (control->end_added) { if (control->on_strm_q) { #ifdef INVARIANTS @@ -1133,14 +1141,14 @@ done_un: return (0); } deliver_more: - next_to_del = strm->last_sequence_delivered + 1; + next_to_del = strm->last_mid_delivered + 1; if (control) { SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (nxtdel: %u)- o\n", - control, control->end_added, control->sinfo_ssn, control->top_fsn, control->fsn_included, + control, control->end_added, control->mid, control->top_fsn, control->fsn_included, next_to_del); nctl = TAILQ_NEXT(control, next_instrm); - if ((control->sinfo_ssn == next_to_del) && + if (SCTP_MID_EQ(asoc->idata_supported, control->mid, next_to_del) && (control->first_frag_seen)) { int done; @@ -1180,7 +1188,7 @@ deliver_more: &stcb->sctp_socket->so_rcv, control->end_added, inp_read_lock_held, SCTP_SO_NOT_LOCKED); } - strm->last_sequence_delivered = next_to_del; + strm->last_mid_delivered = next_to_del; if (done) { control = nctl; goto deliver_more; @@ -1221,10 +1229,10 @@ sctp_add_chk_to_control(struct sctp_queu } else { sctp_add_to_tail_pointer(control, chk->data); } - control->fsn_included = chk->rec.data.fsn_num; + control->fsn_included = chk->rec.data.fsn; asoc->size_on_reasm_queue -= chk->send_size; sctp_ucount_decr(asoc->cnt_on_reasm_queue); - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); + sctp_mark_non_revokable(asoc, chk->rec.data.tsn); chk->data = NULL; if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { control->first_frag_seen = 1; @@ -1325,7 +1333,7 @@ sctp_queue_data_for_reasm(struct sctp_tc /* Its the very first one. */ SCTPDBG(SCTP_DEBUG_XXX, "chunk is a first fsn: %u becomes fsn_included\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); if (control->first_frag_seen) { /* * Error on senders part, they either sent us two @@ -1339,9 +1347,9 @@ sctp_queue_data_for_reasm(struct sctp_tc return; } control->first_frag_seen = 1; - control->fsn_included = chk->rec.data.fsn_num; + control->fsn_included = chk->rec.data.fsn; control->data = chk->data; - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); + sctp_mark_non_revokable(asoc, chk->rec.data.tsn); chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); sctp_setup_tail_pointer(control); @@ -1351,16 +1359,16 @@ sctp_queue_data_for_reasm(struct sctp_tc if (control->last_frag_seen == 0) { /* Still willing to raise highest FSN seen */ - if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) { + if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "We have a new top_fsn: %u\n", - chk->rec.data.fsn_num); - control->top_fsn = chk->rec.data.fsn_num; + chk->rec.data.fsn); + control->top_fsn = chk->rec.data.fsn; } if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { SCTPDBG(SCTP_DEBUG_XXX, "The last fsn is now in place fsn: %u\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); control->last_frag_seen = 1; } if (asoc->idata_supported || control->first_frag_seen) { @@ -1370,7 +1378,7 @@ sctp_queue_data_for_reasm(struct sctp_tc * DATA we have to receive the first before * we know the first FSN (which is the TSN). */ - if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { /* We have already delivered up to * this so its a dup */ sctp_abort_in_reasm(stcb, control, chk, @@ -1384,7 +1392,7 @@ sctp_queue_data_for_reasm(struct sctp_tc /* Second last? huh? */ SCTPDBG(SCTP_DEBUG_XXX, "Duplicate last fsn: %u (top: %u) -- abort\n", - chk->rec.data.fsn_num, control->top_fsn); + chk->rec.data.fsn, control->top_fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_10); @@ -1398,12 +1406,12 @@ sctp_queue_data_for_reasm(struct sctp_tc * we know the first FSN (which is the TSN). */ - if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { /* We have already delivered up to * this so its a dup */ SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is already seen in included_fsn: %u -- abort\n", - chk->rec.data.fsn_num, control->fsn_included); + chk->rec.data.fsn, control->fsn_included); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_11); @@ -1412,10 +1420,10 @@ sctp_queue_data_for_reasm(struct sctp_tc } /* validate not beyond top FSN if we have seen last * one */ - if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) { + if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is beyond or at top_fsn: %u -- abort\n", - chk->rec.data.fsn_num, + chk->rec.data.fsn, control->top_fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, @@ -1429,22 +1437,22 @@ sctp_queue_data_for_reasm(struct sctp_tc */ SCTPDBG(SCTP_DEBUG_XXX, "chunk is a not first fsn: %u needs to be inserted\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); TAILQ_FOREACH(at, &control->reasm, sctp_next) { - if (SCTP_TSN_GT(at->rec.data.fsn_num, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) { /* * This one in queue is bigger than the new * one, insert the new one before at. */ SCTPDBG(SCTP_DEBUG_XXX, "Insert it before fsn: %u\n", - at->rec.data.fsn_num); + at->rec.data.fsn); asoc->size_on_reasm_queue += chk->send_size; sctp_ucount_incr(asoc->cnt_on_reasm_queue); TAILQ_INSERT_BEFORE(at, chk, sctp_next); inserted = 1; break; - } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) { + } else if (at->rec.data.fsn == chk->rec.data.fsn) { /* Gak, He sent me a duplicate str seq * number */ /* @@ -1457,7 +1465,7 @@ sctp_queue_data_for_reasm(struct sctp_tc */ SCTPDBG(SCTP_DEBUG_XXX, "Duplicate to fsn: %u -- abort\n", - at->rec.data.fsn_num); + at->rec.data.fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_13); @@ -1467,7 +1475,7 @@ sctp_queue_data_for_reasm(struct sctp_tc if (inserted == 0) { /* Goes on the end */ SCTPDBG(SCTP_DEBUG_XXX, "Inserting at tail of list fsn: %u\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); asoc->size_on_reasm_queue += chk->send_size; sctp_ucount_incr(asoc->cnt_on_reasm_queue); TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next); @@ -1485,12 +1493,12 @@ sctp_queue_data_for_reasm(struct sctp_tc if (control->first_frag_seen) { next_fsn = control->fsn_included + 1; TAILQ_FOREACH_SAFE(at, &control->reasm, sctp_next, nat) { - if (at->rec.data.fsn_num == next_fsn) { + if (at->rec.data.fsn == next_fsn) { /* We can add this one now to the control */ SCTPDBG(SCTP_DEBUG_XXX, "Adding more to control: %p at: %p fsn: %u next_fsn: %u included: %u\n", control, at, - at->rec.data.fsn_num, + at->rec.data.fsn, next_fsn, control->fsn_included); TAILQ_REMOVE(&control->reasm, at, sctp_next); sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD); @@ -1524,25 +1532,25 @@ sctp_queue_data_for_reasm(struct sctp_tc } static struct sctp_queued_to_read * -sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t msg_id, int ordered, int old) +sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t mid, int ordered, int idata_supported) { struct sctp_queued_to_read *control; if (ordered) { TAILQ_FOREACH(control, &strm->inqueue, next_instrm) { - if (control->msg_id == msg_id) { + if (SCTP_MID_EQ(idata_supported, control->mid, mid)) { break; } } } else { - if (old) { - control = TAILQ_FIRST(&strm->uno_inqueue); - return (control); - } - TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { - if (control->msg_id == msg_id) { - break; + if (idata_supported) { + TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { + if (SCTP_MID_EQ(idata_supported, control->mid, mid)) { + break; + } } + } else { + control = TAILQ_FIRST(&strm->uno_inqueue); } } return (control); @@ -1559,22 +1567,21 @@ sctp_process_a_data_chunk(struct sctp_tc struct sctp_data_chunk *ch; struct sctp_idata_chunk *nch, chunk_buf; struct sctp_tmit_chunk *chk; - uint32_t tsn, fsn, gap, msg_id; + uint32_t tsn, fsn, gap, mid; struct mbuf *dmbuf; int the_len; int need_reasm_check = 0; - uint16_t strmno; + uint16_t sid; struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; struct sctp_queued_to_read *control = NULL; - uint32_t protocol_id; + uint32_t ppid; uint8_t chunk_flags; struct sctp_stream_reset_list *liste; struct sctp_stream_in *strm; int ordered; size_t clen; int created_control = 0; - uint8_t old_data; chk = NULL; if (chtype == SCTP_IDATA) { @@ -1583,23 +1590,21 @@ sctp_process_a_data_chunk(struct sctp_tc ch = (struct sctp_data_chunk *)nch; clen = sizeof(struct sctp_idata_chunk); tsn = ntohl(ch->dp.tsn); - msg_id = ntohl(nch->dp.msg_id); - protocol_id = nch->dp.ppid_fsn.protocol_id; + mid = ntohl(nch->dp.mid); + ppid = nch->dp.ppid_fsn.ppid; if (ch->ch.chunk_flags & SCTP_DATA_FIRST_FRAG) fsn = 0; else fsn = ntohl(nch->dp.ppid_fsn.fsn); - old_data = 0; } else { ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf); tsn = ntohl(ch->dp.tsn); - protocol_id = ch->dp.protocol_id; + ppid = ch->dp.ppid; clen = sizeof(struct sctp_data_chunk); fsn = tsn; - msg_id = (uint32_t) (ntohs(ch->dp.stream_sequence)); + mid = (uint32_t) (ntohs(ch->dp.ssn)); nch = NULL; - old_data = 1; } chunk_flags = ch->ch.chunk_flags; if ((size_t)chk_length == clen) { @@ -1685,9 +1690,9 @@ sctp_process_a_data_chunk(struct sctp_tc */ /* Is the stream valid? */ - strmno = ntohs(ch->dp.stream_id); + sid = ntohs(ch->dp.sid); - if (strmno >= asoc->streamincnt) { + if (sid >= asoc->streamincnt) { struct sctp_error_invalid_stream *cause; op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_error_invalid_stream), @@ -1704,7 +1709,7 @@ sctp_process_a_data_chunk(struct sctp_tc SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_invalid_stream); cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM); cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream)); - cause->stream_id = ch->dp.stream_id; + cause->stream_id = ch->dp.sid; cause->reserved = htons(0); sctp_queue_op_err(stcb, op_err); } @@ -1720,7 +1725,7 @@ sctp_process_a_data_chunk(struct sctp_tc } return (0); } - strm = &asoc->strmin[strmno]; + strm = &asoc->strmin[sid]; /* * If its a fragmented message, lets see if we can find the control * on the reassembly queues. @@ -1734,18 +1739,18 @@ sctp_process_a_data_chunk(struct sctp_tc * wrap around. Ignore is for now. */ snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", - msg_id, chunk_flags); + mid, chunk_flags); goto err_out; } - control = sctp_find_reasm_entry(strm, msg_id, ordered, old_data); + control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", chunk_flags, control); if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { /* See if we can find the re-assembly entity */ if (control != NULL) { /* We found something, does it belong? */ - if (ordered && (msg_id != control->sinfo_ssn)) { - snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", msg_id); + if (ordered && (mid != control->mid)) { + snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid); err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15; @@ -1775,10 +1780,10 @@ sctp_process_a_data_chunk(struct sctp_tc * ordered) or in the same Stream for unordered. */ if (control != NULL) { - if (ordered || (old_data == 0)) { - SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on msg_id: %u\n", - chunk_flags, msg_id); - snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", msg_id); + if (ordered || asoc->idata_supported) { + SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n", + chunk_flags, mid); + snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); goto err_out; } else { if ((tsn == control->fsn_included + 1) && @@ -1855,8 +1860,8 @@ sctp_process_a_data_chunk(struct sctp_tc asoc->tsn_in_wrapped = 1; } asoc->in_tsnlog[asoc->tsn_in_at].tsn = tsn; - asoc->in_tsnlog[asoc->tsn_in_at].strm = strmno; - asoc->in_tsnlog[asoc->tsn_in_at].seq = msg_id; + asoc->in_tsnlog[asoc->tsn_in_at].strm = sid; + asoc->in_tsnlog[asoc->tsn_in_at].seq = mid; asoc->in_tsnlog[asoc->tsn_in_at].sz = chk_length; asoc->in_tsnlog[asoc->tsn_in_at].flgs = chunk_flags; asoc->in_tsnlog[asoc->tsn_in_at].stcb = (void *)stcb; @@ -1874,14 +1879,24 @@ sctp_process_a_data_chunk(struct sctp_tc if ((chunk_flags & SCTP_DATA_FIRST_FRAG) && (TAILQ_EMPTY(&asoc->resetHead)) && (chunk_flags & SCTP_DATA_UNORDERED) == 0 && - SCTP_MSGID_GE(old_data, asoc->strmin[strmno].last_sequence_delivered, msg_id)) { + SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "EVIL/Broken-Dup S-SEQ: %u delivered: %u from peer, Abort!\n", - msg_id, asoc->strmin[strmno].last_sequence_delivered); + mid, asoc->strmin[sid].last_mid_delivered); - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", - asoc->strmin[strmno].last_sequence_delivered, - tsn, strmno, msg_id); + if (asoc->idata_supported) { + snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", + asoc->strmin[sid].last_mid_delivered, + tsn, + sid, + mid); + } else { + snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", + (uint16_t) asoc->strmin[sid].last_mid_delivered, + tsn, + sid, + (uint16_t) mid); + } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -1954,10 +1969,10 @@ sctp_process_a_data_chunk(struct sctp_tc if (control == NULL) { sctp_alloc_a_readq(stcb, control); sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn, - protocol_id, - strmno, msg_id, + ppid, + sid, chunk_flags, - NULL, fsn, msg_id); + NULL, fsn, mid); if (control == NULL) { SCTP_STAT_INCR(sctps_nomem); return (0); @@ -1970,13 +1985,13 @@ sctp_process_a_data_chunk(struct sctp_tc } created_control = 1; } - SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d msgid: %u control: %p\n", - chunk_flags, ordered, msg_id, control); + SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d MID: %u control: %p\n", + chunk_flags, ordered, mid, control); if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && TAILQ_EMPTY(&asoc->resetHead) && ((ordered == 0) || - ((uint16_t) (asoc->strmin[strmno].last_sequence_delivered + 1) == msg_id && - TAILQ_EMPTY(&asoc->strmin[strmno].inqueue)))) { + (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) && + TAILQ_EMPTY(&asoc->strmin[sid].inqueue)))) { /* Candidate for express delivery */ /* * Its not fragmented, No PD-API is up, Nothing in the @@ -1989,8 +2004,8 @@ sctp_process_a_data_chunk(struct sctp_tc if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { asoc->highest_tsn_inside_nr_map = tsn; } - SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read (msg_id: %u)\n", - control, msg_id); + SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read (MID: %u)\n", + control, mid); sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, @@ -1998,11 +2013,11 @@ sctp_process_a_data_chunk(struct sctp_tc if ((chunk_flags & SCTP_DATA_UNORDERED) == 0) { /* for ordered, bump what we delivered */ - strm->last_sequence_delivered++; + strm->last_mid_delivered++; } SCTP_STAT_INCR(sctps_recvexpress); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { - sctp_log_strm_del_alt(stcb, tsn, msg_id, strmno, + sctp_log_strm_del_alt(stcb, tsn, mid, sid, SCTP_STR_LOG_FROM_EXPRS_DEL); } control = NULL; @@ -2020,21 +2035,21 @@ sctp_process_a_data_chunk(struct sctp_tc } return (0); } - chk->rec.data.TSN_seq = tsn; + chk->rec.data.tsn = tsn; chk->no_fr_allowed = 0; - chk->rec.data.fsn_num = fsn; - chk->rec.data.stream_seq = msg_id; - chk->rec.data.stream_number = strmno; - chk->rec.data.payloadtype = protocol_id; + chk->rec.data.fsn = fsn; + chk->rec.data.mid = mid; + chk->rec.data.sid = sid; + chk->rec.data.ppid = ppid; chk->rec.data.context = stcb->asoc.context; chk->rec.data.doing_fast_retransmit = 0; chk->rec.data.rcv_flags = chunk_flags; chk->asoc = asoc; chk->send_size = the_len; chk->whoTo = net; - SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read (msg_id: %u)\n", + SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read (MID: %u)\n", chk, - control, msg_id); + control, mid); atomic_add_int(&net->ref_count, 1); chk->data = dmbuf; } @@ -2097,8 +2112,8 @@ sctp_process_a_data_chunk(struct sctp_tc } if (chunk_flags & SCTP_DATA_UNORDERED) { /* queue directly into socket buffer */ - SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p msg_id: %u\n", - control, msg_id); + SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p MID: %u\n", + control, mid); sctp_mark_non_revokable(asoc, control->sinfo_tsn); sctp_add_to_readq(stcb->sctp_ep, stcb, control, @@ -2106,8 +2121,8 @@ sctp_process_a_data_chunk(struct sctp_tc SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); } else { - SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering msg_id: %u\n", control, - msg_id); + SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering MID: %u\n", control, + mid); sctp_queue_data_to_stream(stcb, strm, asoc, control, abort_flag, &need_reasm_check); if (*abort_flag) { if (last_chunk) { @@ -2121,8 +2136,8 @@ sctp_process_a_data_chunk(struct sctp_tc /* If we reach here its a reassembly */ need_reasm_check = 1; SCTPDBG(SCTP_DEBUG_XXX, - "Queue data to stream for reasm control: %p msg_id: %u\n", - control, msg_id); + "Queue data to stream for reasm control: %p MID: %u\n", + control, mid); sctp_queue_data_for_reasm(stcb, asoc, strm, control, chk, created_control, abort_flag, tsn); if (*abort_flag) { /* @@ -2151,7 +2166,7 @@ finish_express_del: SCTP_STAT_INCR(sctps_recvdata); /* Set it present please */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { - sctp_log_strm_del_alt(stcb, tsn, msg_id, strmno, SCTP_STR_LOG_FROM_MARK_TSN); + sctp_log_strm_del_alt(stcb, tsn, mid, sid, SCTP_STR_LOG_FROM_MARK_TSN); } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, @@ -2813,16 +2828,16 @@ sctp_process_segment_range(struct sctp_t if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (tp1->whoTo->find_pseudo_cumack == 1) && (tp1->snd_count == 1)) { - tp1->whoTo->pseudo_cumack = tp1->rec.data.TSN_seq; + tp1->whoTo->pseudo_cumack = tp1->rec.data.tsn; tp1->whoTo->find_pseudo_cumack = 0; } if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (tp1->whoTo->find_rtx_pseudo_cumack == 1) && (tp1->snd_count > 1)) { - tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.TSN_seq; + tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.tsn; tp1->whoTo->find_rtx_pseudo_cumack = 0; } - if (tp1->rec.data.TSN_seq == theTSN) { + if (tp1->rec.data.tsn == theTSN) { if (tp1->sent != SCTP_DATAGRAM_UNSENT) { /*- * must be held until @@ -2836,9 +2851,9 @@ sctp_process_segment_range(struct sctp_t * via previous Gap Ack Blocks... * i.e. ACKED or RESEND. */ - if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, + if (SCTP_TSN_GT(tp1->rec.data.tsn, *biggest_newly_acked_tsn)) { - *biggest_newly_acked_tsn = tp1->rec.data.TSN_seq; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sun Dec 18 13:05:44 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F91BC85A29; Sun, 18 Dec 2016 13:05:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2C471BD0; Sun, 18 Dec 2016 13:05:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBID5hXg074383; Sun, 18 Dec 2016 13:05:43 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBID5hAu074382; Sun, 18 Dec 2016 13:05:43 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181305.uBID5hAu074382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310220 - stable/11/lib/libc/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:05:44 -0000 Author: tuexen Date: Sun Dec 18 13:05:42 2016 New Revision: 310220 URL: https://svnweb.freebsd.org/changeset/base/310220 Log: MFC r309683: Fix a bug in sctp_sendmsgx(), where the sid provided by the user was hot honored. Modified: stable/11/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/11/lib/libc/net/sctp_sys_calls.c Sun Dec 18 13:04:29 2016 (r310219) +++ stable/11/lib/libc/net/sctp_sys_calls.c Sun Dec 18 13:05:42 2016 (r310220) @@ -797,7 +797,7 @@ sctp_sendmsgx(int sd, memset((void *)&sinfo, 0, sizeof(struct sctp_sndrcvinfo)); sinfo.sinfo_ppid = ppid; sinfo.sinfo_flags = flags; - sinfo.sinfo_ssn = stream_no; + sinfo.sinfo_stream = stream_no; sinfo.sinfo_timetolive = timetolive; sinfo.sinfo_context = context; return (sctp_sendx(sd, msg, len, addrs, addrcnt, &sinfo, 0)); From owner-svn-src-stable-11@freebsd.org Sun Dec 18 13:10:08 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7001C85AD6; Sun, 18 Dec 2016 13:10:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F4DF1D71; Sun, 18 Dec 2016 13:10:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDA7VA074596; Sun, 18 Dec 2016 13:10:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDA73g074595; Sun, 18 Dec 2016 13:10:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181310.uBIDA73g074595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310221 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:10:08 -0000 Author: tuexen Date: Sun Dec 18 13:10:07 2016 New Revision: 310221 URL: https://svnweb.freebsd.org/changeset/base/310221 Log: MFC r309685: Silence a warning produced by newer versions of gcc. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:05:42 2016 (r310220) +++ stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:10:07 2016 (r310221) @@ -10350,8 +10350,10 @@ sctp_fill_in_rest: */ if (asoc->idata_supported) { strseq_m = (struct sctp_strseq_mid *)fwdtsn; + strseq = NULL; } else { strseq = (struct sctp_strseq *)fwdtsn; + strseq_m = NULL; } /*- * Now populate the strseq list. This is done blindly From owner-svn-src-stable-11@freebsd.org Sun Dec 18 13:13:11 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CE5EC85D38; Sun, 18 Dec 2016 13:13:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 078621C9; Sun, 18 Dec 2016 13:13:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDDAg4078349; Sun, 18 Dec 2016 13:13:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDDAZk078348; Sun, 18 Dec 2016 13:13:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181313.uBIDDAZk078348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310222 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:13:11 -0000 Author: tuexen Date: Sun Dec 18 13:13:09 2016 New Revision: 310222 URL: https://svnweb.freebsd.org/changeset/base/310222 Log: MFC r309743: Don't send multiple SHUTDOWN chunks in a single packet. Thanks to Felix Weinrank for making me aware of this issue. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:10:07 2016 (r310221) +++ stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:13:09 2016 (r310222) @@ -9164,40 +9164,61 @@ sctp_send_shutdown(struct sctp_tcb *stcb struct sctp_shutdown_chunk *shutdown_cp; struct sctp_tmit_chunk *chk; - m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); - if (m_shutdown == NULL) { - /* no mbuf's */ - return; + TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { + if (chk->rec.chunk_id.id == SCTP_SHUTDOWN) { + /* We already have a SHUTDOWN queued. Reuse it. */ + if (chk->whoTo) { + sctp_free_remote_addr(chk->whoTo); + chk->whoTo = NULL; + } + break; + } } - SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); - sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { - /* no memory */ - sctp_m_freem(m_shutdown); - return; - } - chk->copy_by_ref = 0; - chk->rec.chunk_id.id = SCTP_SHUTDOWN; - chk->rec.chunk_id.can_take_data = 1; - chk->flags = 0; - chk->send_size = sizeof(struct sctp_shutdown_chunk); - chk->sent = SCTP_DATAGRAM_UNSENT; - chk->snd_count = 0; - chk->flags = 0; - chk->asoc = &stcb->asoc; - chk->data = m_shutdown; - chk->whoTo = net; - if (chk->whoTo) { - atomic_add_int(&chk->whoTo->ref_count, 1); + m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); + if (m_shutdown == NULL) { + /* no mbuf's */ + return; + } + SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); + sctp_alloc_a_chunk(stcb, chk); + if (chk == NULL) { + /* no memory */ + sctp_m_freem(m_shutdown); + return; + } + chk->copy_by_ref = 0; + chk->rec.chunk_id.id = SCTP_SHUTDOWN; + chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; + chk->send_size = sizeof(struct sctp_shutdown_chunk); + chk->sent = SCTP_DATAGRAM_UNSENT; + chk->snd_count = 0; + chk->flags = 0; + chk->asoc = &stcb->asoc; + chk->data = m_shutdown; + chk->whoTo = net; + if (chk->whoTo) { + atomic_add_int(&chk->whoTo->ref_count, 1); + } + shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); + shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; + shutdown_cp->ch.chunk_flags = 0; + shutdown_cp->ch.chunk_length = htons(chk->send_size); + shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); + SCTP_BUF_LEN(m_shutdown) = chk->send_size; + TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); + chk->asoc->ctrl_queue_cnt++; + } else { + TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, sctp_next); + chk->whoTo = net; + if (chk->whoTo) { + atomic_add_int(&chk->whoTo->ref_count, 1); + } + shutdown_cp = mtod(chk->data, struct sctp_shutdown_chunk *); + shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); + TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); } - shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); - shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; - shutdown_cp->ch.chunk_flags = 0; - shutdown_cp->ch.chunk_length = htons(chk->send_size); - shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); - SCTP_BUF_LEN(m_shutdown) = chk->send_size; - TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); - chk->asoc->ctrl_queue_cnt++; return; } From owner-svn-src-stable-11@freebsd.org Sun Dec 18 13:45:06 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F4216C86C4A; Sun, 18 Dec 2016 13:45:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C350112EC; Sun, 18 Dec 2016 13:45:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDj4Et090747; Sun, 18 Dec 2016 13:45:04 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDj4nx090746; Sun, 18 Dec 2016 13:45:04 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181345.uBIDj4nx090746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310223 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:45:06 -0000 Author: tuexen Date: Sun Dec 18 13:45:04 2016 New Revision: 310223 URL: https://svnweb.freebsd.org/changeset/base/310223 Log: MFC r309744: Don't bundle a SACK chunk with a SHUTDOWN chunk if it is not required. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:13:09 2016 (r310222) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:45:04 2016 (r310223) @@ -2437,13 +2437,17 @@ sctp_sack_check(struct sctp_tcb *stcb, i { struct sctp_association *asoc; uint32_t highest_tsn; + int is_a_gap; + sctp_slide_mapping_arrays(stcb); asoc = &stcb->asoc; if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) { highest_tsn = asoc->highest_tsn_inside_nr_map; } else { highest_tsn = asoc->highest_tsn_inside_map; } + /* Is there a gap now? */ + is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); /* * Now we need to see if we need to queue a sack or just start the @@ -2462,13 +2466,10 @@ sctp_sack_check(struct sctp_tcb *stcb, i } sctp_send_shutdown(stcb, ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination)); - sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); + if (is_a_gap) { + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); + } } else { - int is_a_gap; - - /* is there a gap now ? */ - is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); - /* * CMT DAC algorithm: increase number of packets received * since last ack From owner-svn-src-stable-11@freebsd.org Sun Dec 18 13:48:29 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDA99C86DBF; Sun, 18 Dec 2016 13:48:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC6DE163C; Sun, 18 Dec 2016 13:48:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDmSeD090996; Sun, 18 Dec 2016 13:48:28 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDmSha090994; Sun, 18 Dec 2016 13:48:28 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181348.uBIDmSha090994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310224 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:48:30 -0000 Author: tuexen Date: Sun Dec 18 13:48:28 2016 New Revision: 310224 URL: https://svnweb.freebsd.org/changeset/base/310224 Log: MFC r309851: Ensure that the reported ppid and tsn are taken from the first fragment. This fixes a bug where the wrong ppid was reported, if * I-DATA was used on the first fragement was not received first * DATA was used and different ppids where used. Thanks to Julian Cordes for making me aware of the issue. Modified: stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:45:04 2016 (r310223) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:48:28 2016 (r310224) @@ -333,10 +333,10 @@ sctp_place_control_in_stream(struct sctp { struct sctp_queued_to_read *at; struct sctp_readhead *q; - uint8_t bits, unordered; + uint8_t flags, unordered; - bits = (control->sinfo_flags >> 8); - unordered = bits & SCTP_DATA_UNORDERED; + flags = (control->sinfo_flags >> 8); + unordered = flags & SCTP_DATA_UNORDERED; if (unordered) { q = &strm->uno_inqueue; if (asoc->idata_supported == 0) { @@ -352,8 +352,10 @@ sctp_place_control_in_stream(struct sctp } else { q = &strm->inqueue; } - if ((bits & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - control->end_added = control->last_frag_seen = control->first_frag_seen = 1; + if ((flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + control->end_added = 1; + control->first_frag_seen = 1; + control->last_frag_seen = 1; } if (TAILQ_EMPTY(q)) { /* Empty queue */ @@ -394,8 +396,7 @@ sctp_place_control_in_stream(struct sctp sctp_log_strm_del(control, at, SCTP_STR_LOG_FROM_INSERT_TL); } - TAILQ_INSERT_AFTER(q, - at, control, next_instrm); + TAILQ_INSERT_AFTER(q, at, control, next_instrm); if (unordered) { control->on_strm_q = SCTP_ON_UNORDERED; } else { @@ -972,7 +973,8 @@ sctp_inject_old_unordered_data(struct sc goto place_chunk; } control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = chk->rec.data.fsn; + control->fsn_included = chk->rec.data.fsn; + control->top_fsn = chk->rec.data.fsn; control->sinfo_tsn = chk->rec.data.tsn; control->sinfo_ppid = chk->rec.data.ppid; control->data = chk->data; @@ -1236,6 +1238,8 @@ sctp_add_chk_to_control(struct sctp_queu chk->data = NULL; if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { control->first_frag_seen = 1; + control->sinfo_tsn = chk->rec.data.tsn; + control->sinfo_ppid = chk->rec.data.ppid; } if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { /* Its complete */ @@ -1347,6 +1351,8 @@ sctp_queue_data_for_reasm(struct sctp_tc return; } control->first_frag_seen = 1; + control->sinfo_ppid = chk->rec.data.ppid; + control->sinfo_tsn = chk->rec.data.tsn; control->fsn_included = chk->rec.data.fsn; control->data = chk->data; sctp_mark_non_revokable(asoc, chk->rec.data.tsn); @@ -1560,12 +1566,10 @@ static int sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, struct mbuf **m, int offset, int chk_length, struct sctp_nets *net, uint32_t * high_tsn, int *abort_flag, - int *break_flag, int last_chunk, uint8_t chtype) + int *break_flag, int last_chunk, uint8_t chk_type) { /* Process a data chunk */ /* struct sctp_tmit_chunk *chk; */ - struct sctp_data_chunk *ch; - struct sctp_idata_chunk *nch, chunk_buf; struct sctp_tmit_chunk *chk; uint32_t tsn, fsn, gap, mid; struct mbuf *dmbuf; @@ -1576,58 +1580,64 @@ sctp_process_a_data_chunk(struct sctp_tc char msg[SCTP_DIAG_INFO_LEN]; struct sctp_queued_to_read *control = NULL; uint32_t ppid; - uint8_t chunk_flags; + uint8_t chk_flags; struct sctp_stream_reset_list *liste; struct sctp_stream_in *strm; int ordered; size_t clen; int created_control = 0; - chk = NULL; - if (chtype == SCTP_IDATA) { - nch = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, + if (chk_type == SCTP_IDATA) { + struct sctp_idata_chunk *chunk, chunk_buf; + + chunk = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, sizeof(struct sctp_idata_chunk), (uint8_t *) & chunk_buf); - ch = (struct sctp_data_chunk *)nch; + chk_flags = chunk->ch.chunk_flags; clen = sizeof(struct sctp_idata_chunk); - tsn = ntohl(ch->dp.tsn); - mid = ntohl(nch->dp.mid); - ppid = nch->dp.ppid_fsn.ppid; - if (ch->ch.chunk_flags & SCTP_DATA_FIRST_FRAG) + tsn = ntohl(chunk->dp.tsn); + sid = ntohs(chunk->dp.sid); + mid = ntohl(chunk->dp.mid); + if (chk_flags & SCTP_DATA_FIRST_FRAG) { fsn = 0; - else - fsn = ntohl(nch->dp.ppid_fsn.fsn); + ppid = chunk->dp.ppid_fsn.ppid; + } else { + fsn = ntohl(chunk->dp.ppid_fsn.fsn); + ppid = 0xffffffff; /* Use as an invalid value. */ + } } else { - ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, + struct sctp_data_chunk *chunk, chunk_buf; + + chunk = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf); - tsn = ntohl(ch->dp.tsn); - ppid = ch->dp.ppid; + chk_flags = chunk->ch.chunk_flags; clen = sizeof(struct sctp_data_chunk); + tsn = ntohl(chunk->dp.tsn); + sid = ntohs(chunk->dp.sid); + mid = (uint32_t) (ntohs(chunk->dp.ssn)); fsn = tsn; - mid = (uint32_t) (ntohs(ch->dp.ssn)); - nch = NULL; + ppid = chunk->dp.ppid; } - chunk_flags = ch->ch.chunk_flags; if ((size_t)chk_length == clen) { /* * Need to send an abort since we had a empty data chunk. */ - op_err = sctp_generate_no_user_data_cause(ch->dp.tsn); + op_err = sctp_generate_no_user_data_cause(tsn); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } - if ((chunk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { + if ((chk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { asoc->send_sack = 1; } - ordered = ((chunk_flags & SCTP_DATA_UNORDERED) == 0); + ordered = ((chk_flags & SCTP_DATA_UNORDERED) == 0); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS); } if (stcb == NULL) { return (0); } - SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, ch->ch.chunk_type, tsn); + SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, chk_type, tsn); if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { /* It is a duplicate */ SCTP_STAT_INCR(sctps_recvdupdata); @@ -1690,8 +1700,6 @@ sctp_process_a_data_chunk(struct sctp_tc */ /* Is the stream valid? */ - sid = ntohs(ch->dp.sid); - if (sid >= asoc->streamincnt) { struct sctp_error_invalid_stream *cause; @@ -1709,7 +1717,7 @@ sctp_process_a_data_chunk(struct sctp_tc SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_invalid_stream); cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM); cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream)); - cause->stream_id = ch->dp.sid; + cause->stream_id = htons(sid); cause->reserved = htons(0); sctp_queue_op_err(stcb, op_err); } @@ -1730,8 +1738,8 @@ sctp_process_a_data_chunk(struct sctp_tc * If its a fragmented message, lets see if we can find the control * on the reassembly queues. */ - if ((chtype == SCTP_IDATA) && - ((chunk_flags & SCTP_DATA_FIRST_FRAG) == 0) && + if ((chk_type == SCTP_IDATA) && + ((chk_flags & SCTP_DATA_FIRST_FRAG) == 0) && (fsn == 0)) { /* * The first *must* be fsn 0, and other (middle/end) pieces @@ -1739,13 +1747,13 @@ sctp_process_a_data_chunk(struct sctp_tc * wrap around. Ignore is for now. */ snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", - mid, chunk_flags); + mid, chk_flags); goto err_out; } control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", - chunk_flags, control); - if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { + chk_flags, control); + if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { /* See if we can find the re-assembly entity */ if (control != NULL) { /* We found something, does it belong? */ @@ -1782,7 +1790,7 @@ sctp_process_a_data_chunk(struct sctp_tc if (control != NULL) { if (ordered || asoc->idata_supported) { SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n", - chunk_flags, mid); + chk_flags, mid); snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); goto err_out; } else { @@ -1828,7 +1836,7 @@ sctp_process_a_data_chunk(struct sctp_tc #endif } /* now is it in the mapping array of what we have accepted? */ - if (nch == NULL) { + if (chk_type == SCTP_DATA) { if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map) && SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { /* Nope not in the valid range dump it */ @@ -1876,9 +1884,9 @@ sctp_process_a_data_chunk(struct sctp_tc * way our stream sequence numbers could have wrapped. We of course * only validate the FIRST fragment so the bit must be set. */ - if ((chunk_flags & SCTP_DATA_FIRST_FRAG) && + if ((chk_flags & SCTP_DATA_FIRST_FRAG) && (TAILQ_EMPTY(&asoc->resetHead)) && - (chunk_flags & SCTP_DATA_UNORDERED) == 0 && + (chk_flags & SCTP_DATA_UNORDERED) == 0 && SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "EVIL/Broken-Dup S-SEQ: %u delivered: %u from peer, Abort!\n", @@ -1903,17 +1911,13 @@ sctp_process_a_data_chunk(struct sctp_tc *abort_flag = 1; return (0); } - /************************************ - * From here down we may find ch-> invalid - * so its a good idea NOT to use it. - *************************************/ - if (nch) { + if (chk_type == SCTP_IDATA) { the_len = (chk_length - sizeof(struct sctp_idata_chunk)); } else { the_len = (chk_length - sizeof(struct sctp_data_chunk)); } if (last_chunk == 0) { - if (nch) { + if (chk_type == SCTP_IDATA) { dmbuf = SCTP_M_COPYM(*m, (offset + sizeof(struct sctp_idata_chunk)), the_len, M_NOWAIT); @@ -1933,7 +1937,7 @@ sctp_process_a_data_chunk(struct sctp_tc dmbuf = *m; /* lop off the top part */ - if (nch) { + if (chk_type == SCTP_IDATA) { m_adj(dmbuf, (offset + sizeof(struct sctp_idata_chunk))); } else { m_adj(dmbuf, (offset + sizeof(struct sctp_data_chunk))); @@ -1962,7 +1966,7 @@ sctp_process_a_data_chunk(struct sctp_tc return (0); } /* - * Now no matter what we need a control, get one if we don't have + * Now no matter what, we need a control, get one if we don't have * one (we may have gotten it above when we found the message was * fragmented */ @@ -1971,23 +1975,26 @@ sctp_process_a_data_chunk(struct sctp_tc sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn, ppid, sid, - chunk_flags, + chk_flags, NULL, fsn, mid); if (control == NULL) { SCTP_STAT_INCR(sctps_nomem); return (0); } - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { control->data = dmbuf; control->tail_mbuf = NULL; - control->end_added = control->last_frag_seen = control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = fsn; + control->end_added = 1; + control->last_frag_seen = 1; + control->first_frag_seen = 1; + control->fsn_included = fsn; + control->top_fsn = fsn; } created_control = 1; } SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d MID: %u control: %p\n", - chunk_flags, ordered, mid, control); - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && + chk_flags, ordered, mid, control); + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && TAILQ_EMPTY(&asoc->resetHead) && ((ordered == 0) || (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) && @@ -2011,7 +2018,7 @@ sctp_process_a_data_chunk(struct sctp_tc control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); - if ((chunk_flags & SCTP_DATA_UNORDERED) == 0) { + if ((chk_flags & SCTP_DATA_UNORDERED) == 0) { /* for ordered, bump what we delivered */ strm->last_mid_delivered++; } @@ -2024,7 +2031,7 @@ sctp_process_a_data_chunk(struct sctp_tc goto finish_express_del; } /* Now will we need a chunk too? */ - if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { /* No memory so we drop the chunk */ @@ -2043,7 +2050,7 @@ sctp_process_a_data_chunk(struct sctp_tc chk->rec.data.ppid = ppid; chk->rec.data.context = stcb->asoc.context; chk->rec.data.doing_fast_retransmit = 0; - chk->rec.data.rcv_flags = chunk_flags; + chk->rec.data.rcv_flags = chk_flags; chk->asoc = asoc; chk->send_size = the_len; chk->whoTo = net; @@ -2066,7 +2073,7 @@ sctp_process_a_data_chunk(struct sctp_tc } } /* Now is it complete (i.e. not fragmented)? */ - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { /* * Special check for when streams are resetting. We could be * more smart about this and check the actual stream to see @@ -2110,7 +2117,7 @@ sctp_process_a_data_chunk(struct sctp_tc } goto finish_express_del; } - if (chunk_flags & SCTP_DATA_UNORDERED) { + if (chk_flags & SCTP_DATA_UNORDERED) { /* queue directly into socket buffer */ SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p MID: %u\n", control, mid); Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sun Dec 18 13:45:04 2016 (r310223) +++ stable/11/sys/netinet/sctputil.c Sun Dec 18 13:48:28 2016 (r310224) @@ -4639,7 +4639,7 @@ sctp_generate_no_user_data_cause(uint32_ no_user_data_cause = mtod(m, struct sctp_error_no_user_data *); no_user_data_cause->cause.code = htons(SCTP_CAUSE_NO_USER_DATA); no_user_data_cause->cause.length = htons(len); - no_user_data_cause->tsn = tsn; /* tsn is passed in as NBO */ + no_user_data_cause->tsn = htonl(tsn); } return (m); } From owner-svn-src-stable-11@freebsd.org Sun Dec 18 14:31:12 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E73F5C871A5; Sun, 18 Dec 2016 14:31:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A11DE1929; Sun, 18 Dec 2016 14:31:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIEVBO2007835; Sun, 18 Dec 2016 14:31:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIEVBnx007834; Sun, 18 Dec 2016 14:31:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612181431.uBIEVBnx007834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 18 Dec 2016 14:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310228 - in stable: 10/sys/dev/xen/blkfront 11/sys/dev/xen/blkfront 9/sys/dev/xen/blkfront X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 14:31:13 -0000 Author: dim Date: Sun Dec 18 14:31:11 2016 New Revision: 310228 URL: https://svnweb.freebsd.org/changeset/base/310228 Log: MFC r310013 (by cperciva): Check that blkfront devices have a non-zero number of sectors and a non-zero sector size. Such a device would be a virtual disk of zero bytes; clearly not useful, and not something we should try to attach. As a fortuitous side effect, checking that these values are non-zero here results in them not *becoming* zero later on the function. This odd behaviour began with r309124 (clang 3.9.0) but is challenging to debug; making any changes to this function whatsoever seems to affect the llvm optimizer behaviour enough to make the unexpected zeroing of the sector_size variable cease. PR: 215209 Security: The potential for variables to unexpectedly become zero has worrying consequences for security in general, but not so much in this particular context. MFC r310086: In xbd_connect(), use correct scanf conversion specifiers for the feature_barrier and feature_flush variables. Otherwise, adjacent variables on the stack, such as sector_size, may be overwritten, with disastrous results. Note that I did not see a good reason to revert the addition of zero checks introduced in r310013. Better safe than sorry. PR: 215209 Tested by: royger Modified: stable/11/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/xen/blkfront/blkfront.c stable/9/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/10/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/11/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/11/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:10:24 2016 (r310227) +++ stable/11/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:31:11 2016 (r310228) @@ -1245,19 +1245,27 @@ xbd_connect(struct xbd_softc *sc) xenbus_get_otherend_path(dev)); return; } + if ((sectors == 0) || (sector_size == 0)) { + xenbus_dev_fatal(dev, 0, + "invalid parameters from %s:" + " sectors = %lu, sector_size = %lu", + xenbus_get_otherend_path(dev), + sectors, sector_size); + return; + } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), "physical-sector-size", "%lu", &phys_sector_size, NULL); if (err || phys_sector_size <= sector_size) phys_sector_size = 0; err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "feature-barrier", "%lu", &feature_barrier, + "feature-barrier", "%d", &feature_barrier, NULL); if (err == 0 && feature_barrier != 0) sc->xbd_flags |= XBDF_BARRIER; err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "feature-flush-cache", "%lu", &feature_flush, + "feature-flush-cache", "%d", &feature_flush, NULL); if (err == 0 && feature_flush != 0) sc->xbd_flags |= XBDF_FLUSH; From owner-svn-src-stable-11@freebsd.org Sun Dec 18 15:10:09 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8BB1C87E99; Sun, 18 Dec 2016 15:10:09 +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 A1F27171D; Sun, 18 Dec 2016 15:10:09 +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 uBIFA8H1024036; Sun, 18 Dec 2016 15:10:08 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIFA8HA024035; Sun, 18 Dec 2016 15:10:08 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201612181510.uBIFA8HA024035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 18 Dec 2016 15:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310231 - stable/11/tests/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 15:10:10 -0000 Author: jilles Date: Sun Dec 18 15:10:08 2016 New Revision: 310231 URL: https://svnweb.freebsd.org/changeset/base/310231 Log: MFC r309836: Add some tests for reaper functionality (in procctl()). Added: stable/11/tests/sys/kern/reaper.c - copied unchanged from r309836, head/tests/sys/kern/reaper.c Modified: stable/11/tests/sys/kern/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/Makefile ============================================================================== --- stable/11/tests/sys/kern/Makefile Sun Dec 18 15:02:50 2016 (r310230) +++ stable/11/tests/sys/kern/Makefile Sun Dec 18 15:10:08 2016 (r310231) @@ -8,6 +8,7 @@ TESTSDIR= ${TESTSBASE}/sys/kern ATF_TESTS_C+= kern_copyin ATF_TESTS_C+= kern_descrip_test ATF_TESTS_C+= ptrace_test +ATF_TESTS_C+= reaper PLAIN_TESTS_C+= subr_unit_test ATF_TESTS_C+= unix_seqpacket_test ATF_TESTS_C+= unix_passfd_test Copied: stable/11/tests/sys/kern/reaper.c (from r309836, head/tests/sys/kern/reaper.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/kern/reaper.c Sun Dec 18 15:10:08 2016 (r310231, copy of r309836, head/tests/sys/kern/reaper.c) @@ -0,0 +1,494 @@ +/*- + * Copyright (c) 2016 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include + +ATF_TC_WITHOUT_HEAD(reaper_wait_child_first); +ATF_TC_BODY(reaper_wait_child_first, tc) +{ + pid_t parent, child, grandchild, pid; + int status, r; + int pip[2]; + + /* Be paranoid. */ + pid = waitpid(-1, NULL, WNOHANG); + ATF_REQUIRE(pid == -1 && errno == ECHILD); + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pip[1]) != 0) + _exit(100); + grandchild = fork(); + if (grandchild == -1) + _exit(101); + else if (grandchild == 0) { + if (read(pip[0], &(uint8_t){ 0 }, 1) != 0) + _exit(102); + if (getppid() != parent) + _exit(103); + _exit(2); + } else + _exit(3); + } + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(3, r); + + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0 && pid != child); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(2, r); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); +} + +ATF_TC_WITHOUT_HEAD(reaper_wait_grandchild_first); +ATF_TC_BODY(reaper_wait_grandchild_first, tc) +{ + pid_t parent, child, grandchild, pid; + int status, r; + + /* Be paranoid. */ + pid = waitpid(-1, NULL, WNOHANG); + ATF_REQUIRE(pid == -1 && errno == ECHILD); + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + grandchild = fork(); + if (grandchild == -1) + _exit(101); + else if (grandchild == 0) + _exit(2); + else { + if (waitid(P_PID, grandchild, NULL, + WNOWAIT | WEXITED) != 0) + _exit(102); + _exit(3); + } + } + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(3, r); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0 && pid != child); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(2, r); +} + +ATF_TC_WITHOUT_HEAD(reaper_status); +ATF_TC_BODY(reaper_status, tc) +{ + struct procctl_reaper_status st; + ssize_t sr; + pid_t parent, child, pid; + int r, status; + int pip[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_STATUS, &st); + ATF_REQUIRE_EQ(0, r); + ATF_CHECK_EQ(0, st.rs_flags & REAPER_STATUS_OWNED); + ATF_CHECK(st.rs_children > 0); + ATF_CHECK(st.rs_descendants > 0); + ATF_CHECK(st.rs_descendants >= st.rs_children); + ATF_CHECK(st.rs_reaper != parent); + ATF_CHECK(st.rs_reaper > 0); + + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = procctl(P_PID, parent, PROC_REAP_STATUS, &st); + ATF_REQUIRE_EQ(0, r); + ATF_CHECK_EQ(REAPER_STATUS_OWNED, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(0, st.rs_children); + ATF_CHECK_EQ(0, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(-1, st.rs_pid); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pip[0]) != 0) + _exit(100); + if (procctl(P_PID, parent, PROC_REAP_STATUS, &st) != 0) + _exit(101); + if (write(pip[1], &st, sizeof(st)) != (ssize_t)sizeof(st)) + _exit(102); + if (procctl(P_PID, getpid(), PROC_REAP_STATUS, &st) != 0) + _exit(103); + if (write(pip[1], &st, sizeof(st)) != (ssize_t)sizeof(st)) + _exit(104); + _exit(0); + } + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + sr = read(pip[0], &st, sizeof(st)); + ATF_REQUIRE_EQ((ssize_t)sizeof(st), sr); + ATF_CHECK_EQ(REAPER_STATUS_OWNED, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(1, st.rs_children); + ATF_CHECK_EQ(1, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(child, st.rs_pid); + sr = read(pip[0], &st, sizeof(st)); + ATF_REQUIRE_EQ((ssize_t)sizeof(st), sr); + ATF_CHECK_EQ(0, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(1, st.rs_children); + ATF_CHECK_EQ(1, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(child, st.rs_pid); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + ATF_CHECK_EQ(0, status); + + r = procctl(P_PID, parent, PROC_REAP_STATUS, &st); + ATF_REQUIRE_EQ(0, r); + ATF_CHECK_EQ(REAPER_STATUS_OWNED, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(0, st.rs_children); + ATF_CHECK_EQ(0, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(-1, st.rs_pid); +} + +ATF_TC_WITHOUT_HEAD(reaper_getpids); +ATF_TC_BODY(reaper_getpids, tc) +{ + struct procctl_reaper_pidinfo info[10]; + ssize_t sr; + pid_t parent, child, grandchild, pid; + int r, status, childidx; + int pipa[2], pipb[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(0, info[0].pi_flags & REAPER_PIDINFO_VALID); + + r = pipe(pipa); + ATF_REQUIRE_EQ(0, r); + r = pipe(pipb); + ATF_REQUIRE_EQ(0, r); + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pipa[1]) != 0) + _exit(100); + if (close(pipb[0]) != 0) + _exit(100); + if (read(pipa[0], &(uint8_t){ 0 }, 1) != 1) + _exit(101); + grandchild = fork(); + if (grandchild == -1) + _exit(102); + if (grandchild == 0) { + if (write(pipb[1], &(uint8_t){ 0 }, 1) != 1) + _exit(103); + if (read(pipa[0], &(uint8_t){ 0 }, 1) != 1) + _exit(104); + _exit(0); + } + for (;;) + pause(); + } + r = close(pipa[0]); + ATF_REQUIRE_EQ(0, r); + r = close(pipb[1]); + ATF_REQUIRE_EQ(0, r); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID | REAPER_PIDINFO_CHILD, + info[0].pi_flags & (REAPER_PIDINFO_VALID | REAPER_PIDINFO_CHILD)); + ATF_CHECK_EQ(child, info[0].pi_pid); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(0, info[1].pi_flags & REAPER_PIDINFO_VALID); + + sr = write(pipa[1], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + sr = read(pipb[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[0].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[1].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(0, info[2].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(child, info[1].pi_subtree); + childidx = info[1].pi_pid == child ? 1 : 0; + ATF_CHECK_EQ(REAPER_PIDINFO_CHILD, + info[childidx].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK_EQ(0, info[childidx ^ 1].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK(info[childidx].pi_pid == child); + grandchild = info[childidx ^ 1].pi_pid; + ATF_CHECK(grandchild > 0); + ATF_CHECK(grandchild != child); + ATF_CHECK(grandchild != parent); + + r = kill(child, SIGTERM); + ATF_REQUIRE_EQ(0, r); + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[0].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(0, info[1].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(REAPER_PIDINFO_CHILD, + info[0].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK_EQ(grandchild, info[0].pi_pid); + + sr = write(pipa[1], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[0].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(0, info[1].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(REAPER_PIDINFO_CHILD, + info[0].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK_EQ(grandchild, info[0].pi_pid); + + pid = waitpid(grandchild, &status, 0); + ATF_REQUIRE_EQ(grandchild, pid); + ATF_CHECK_EQ(0, status); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(0, info[0].pi_flags & REAPER_PIDINFO_VALID); + + r = close(pipa[1]); + ATF_REQUIRE_EQ(0, r); + r = close(pipb[0]); + ATF_REQUIRE_EQ(0, r); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_badsig); +ATF_TC_BODY(reaper_kill_badsig, tc) +{ + struct procctl_reaper_kill params; + pid_t parent; + int r; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + params.rk_sig = -1; + params.rk_flags = 0; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK(r == -1 && errno == EINVAL); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_sigzero); +ATF_TC_BODY(reaper_kill_sigzero, tc) +{ + struct procctl_reaper_kill params; + pid_t parent; + int r; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + params.rk_sig = 0; + params.rk_flags = 0; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK(r == -1 && errno == EINVAL); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_empty); +ATF_TC_BODY(reaper_kill_empty, tc) +{ + struct procctl_reaper_kill params; + pid_t parent; + int r; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + params.rk_sig = SIGTERM; + params.rk_flags = 0; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK(r == -1 && errno == ESRCH); + ATF_CHECK_EQ(0, params.rk_killed); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_normal); +ATF_TC_BODY(reaper_kill_normal, tc) +{ + struct procctl_reaper_kill params; + ssize_t sr; + pid_t parent, child, grandchild, pid; + int r, status; + int pip[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild = fork(); + if (grandchild == -1) + _exit(101); + if (grandchild == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + params.rk_sig = SIGTERM; + params.rk_flags = 0; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(2, params.rk_killed); + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, reaper_wait_child_first); + ATF_TP_ADD_TC(tp, reaper_wait_grandchild_first); + ATF_TP_ADD_TC(tp, reaper_status); + ATF_TP_ADD_TC(tp, reaper_getpids); + ATF_TP_ADD_TC(tp, reaper_kill_badsig); + ATF_TP_ADD_TC(tp, reaper_kill_sigzero); + ATF_TP_ADD_TC(tp, reaper_kill_empty); + ATF_TP_ADD_TC(tp, reaper_kill_normal); + return (atf_no_error()); +} From owner-svn-src-stable-11@freebsd.org Sun Dec 18 17:10:52 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D560DC874AB; Sun, 18 Dec 2016 17:10:52 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A671010D5; Sun, 18 Dec 2016 17:10:52 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id uBIHAjQj054061; Sun, 18 Dec 2016 09:10:45 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id uBIHAjR2054060; Sun, 18 Dec 2016 09:10:45 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201612181710.uBIHAjR2054060@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r310217 - stable/11/sys/netinet In-Reply-To: <201612181256.uBICuEja070394@repo.freebsd.org> To: Michael Tuexen Date: Sun, 18 Dec 2016 09:10:45 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 17:10:52 -0000 > Author: tuexen > Date: Sun Dec 18 12:56:14 2016 > New Revision: 310217 > URL: https://svnweb.freebsd.org/changeset/base/310217 ... > > Log: > MFC r307779: > > No functional changes, mostly getting the whitespace changes resulting > from an updated formatting tool chain. I think there might be an issue with this tool, it is reformatting KNF multiline comment format to the wrong format, unless KNF has been changed at some recent point. ... > - /* > - * two from each > - * address > - */ ... > + /* two from each > + * address */ > - /* > - * link-local <-> link-local must belong to the same > - * scope. > - */ > + /* link-local <-> link-local must belong to the same > + * scope. */ > - /* > - * PMTU check versus smallest asoc MTU goes > - * here > - */ > + /* PMTU check versus smallest asoc MTU goes > + * here */ etc... -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Sun Dec 18 18:00:12 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A78E6C85A6C; Sun, 18 Dec 2016 18:00:12 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E3B2111E; Sun, 18 Dec 2016 18:00:12 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [192.168.1.102] (p508F1073.dip0.t-ipconnect.de [80.143.16.115]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 9317D721E282E; Sun, 18 Dec 2016 19:00:07 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: svn commit: r310217 - stable/11/sys/netinet From: Michael Tuexen In-Reply-To: <201612181710.uBIHAjR2054060@pdx.rh.CN85.dnsmgr.net> Date: Sun, 18 Dec 2016 19:00:05 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6FD04AC1-6BEC-4B6D-8F64-CC3D8C11902D@freebsd.org> References: <201612181710.uBIHAjR2054060@pdx.rh.CN85.dnsmgr.net> To: "Rodney W. Grimes" X-Mailer: Apple Mail (2.3259) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 18:00:12 -0000 > On 18 Dec 2016, at 18:10, Rodney W. Grimes = wrote: >=20 >> Author: tuexen >> Date: Sun Dec 18 12:56:14 2016 >> New Revision: 310217 >> URL: https://svnweb.freebsd.org/changeset/base/310217 > ... >>=20 >> Log: >> MFC r307779: >>=20 >> No functional changes, mostly getting the whitespace changes = resulting >> from an updated formatting tool chain. >=20 > I think there might be an issue with this tool, it is reformatting KNF = multiline > comment format to the wrong format, unless KNF has been changed at = some recent > point. Possibly it is related to change/bug in indent, which seems to be fixed in a later version of indent. pstef@ contacted me and is looking into = it. Using the current version, I get back the old behaviour. Once pstef@ has confirmed that the current version is fine, I regenerate the SCTP sources and commit the result... Best regards Michael >=20 > ... >> - /* >> - * two from each >> - * address >> - */ > ... >> + /* two from each >> + * address */ >> - /* >> - * link-local <-> link-local must belong to the = same >> - * scope. >> - */ >> + /* link-local <-> link-local must belong to the = same >> + * scope. */ >=20 >=20 >> - /* >> - * PMTU check versus smallest asoc MTU = goes >> - * here >> - */ >> + /* PMTU check versus smallest asoc MTU = goes >> + * here */ >=20 > etc... >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org From owner-svn-src-stable-11@freebsd.org Sun Dec 18 20:40:23 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 556BEC87682; Sun, 18 Dec 2016 20:40:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24EC01599; Sun, 18 Dec 2016 20:40:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIKeMfP062804; Sun, 18 Dec 2016 20:40:22 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIKeMCq062803; Sun, 18 Dec 2016 20:40:22 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612182040.uBIKeMCq062803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 18 Dec 2016 20:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310233 - stable/11/etc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 20:40:23 -0000 Author: avos Date: Sun Dec 18 20:40:22 2016 New Revision: 310233 URL: https://svnweb.freebsd.org/changeset/base/310233 Log: MFC r309534: Do not try to recreate wlan(4) interface if it already exists. This should fix error messages caused by devd(8) during startup: Starting Network: lo0 wlan0. ... Starting devd. ifconfig: SIOCS80211: Device busy wpa_supplicant already running? (pid=323). Modified: stable/11/etc/pccard_ether Modified: stable/11/etc/pccard_ether ============================================================================== --- stable/11/etc/pccard_ether Sun Dec 18 15:21:38 2016 (r310232) +++ stable/11/etc/pccard_ether Sun Dec 18 20:40:22 2016 (r310233) @@ -120,6 +120,9 @@ pccard_ether_restart() pccard_ether_startchildren() { for child in `get_if_var $ifn wlans_IF`; do + if ifexists $child; then + continue + fi /etc/rc.d/netif quietstart $child done } From owner-svn-src-stable-11@freebsd.org Sun Dec 18 20:59:25 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FFFEC87BAD; Sun, 18 Dec 2016 20:59:25 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F337161A; Sun, 18 Dec 2016 20:59:25 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIKxO6J070928; Sun, 18 Dec 2016 20:59:24 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIKxOWW070927; Sun, 18 Dec 2016 20:59:24 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612182059.uBIKxOWW070927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 18 Dec 2016 20:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310235 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 20:59:25 -0000 Author: avos Date: Sun Dec 18 20:59:24 2016 New Revision: 310235 URL: https://svnweb.freebsd.org/changeset/base/310235 Log: MFC r310089: ifconfig: do not truncate SSID in verbose mode. Fix 32-character SSID abbreviation for 'ifconfig -v wlan0 scan' command. PR: 215301 Submitted by: Modified: stable/11/sbin/ifconfig/ifieee80211.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/11/sbin/ifconfig/ifieee80211.c Sun Dec 18 20:56:14 2016 (r310234) +++ stable/11/sbin/ifconfig/ifieee80211.c Sun Dec 18 20:59:24 2016 (r310235) @@ -3311,7 +3311,7 @@ list_scan(int s) getchaninfo(s); - ssidmax = verbose ? IEEE80211_NWID_LEN - 1 : 14; + ssidmax = verbose ? IEEE80211_NWID_LEN : 14; printf("%-*.*s %-17.17s %4s %4s %-7s %3s %4s\n" , ssidmax, ssidmax, "SSID/MESH ID" , "BSSID" From owner-svn-src-stable-11@freebsd.org Mon Dec 19 00:26:26 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2306C72660; Mon, 19 Dec 2016 00:26:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 816EA1BDA; Mon, 19 Dec 2016 00:26:26 +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 uBJ0QPW9056096; Mon, 19 Dec 2016 00:26:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ0QPt2056095; Mon, 19 Dec 2016 00:26:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612190026.uBJ0QPt2056095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Dec 2016 00:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310237 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 00:26:26 -0000 Author: kib Date: Mon Dec 19 00:26:25 2016 New Revision: 310237 URL: https://svnweb.freebsd.org/changeset/base/310237 Log: MFC r310155: Fix typo. Modified: stable/11/libexec/rtld-elf/rtld.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/rtld.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld.c Sun Dec 18 22:24:04 2016 (r310236) +++ stable/11/libexec/rtld-elf/rtld.c Mon Dec 19 00:26:25 2016 (r310237) @@ -2494,7 +2494,7 @@ objlist_call_init(Objlist *list, RtldLoc continue; /* * Race: other thread might try to use this object before current - * one completes the initilization. Not much can be done here + * one completes the initialization. Not much can be done here * without better locking. */ elm->obj->init_done = true; From owner-svn-src-stable-11@freebsd.org Mon Dec 19 07:46:21 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7676C87388; Mon, 19 Dec 2016 07:46:21 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B67D2784; Mon, 19 Dec 2016 07:46:21 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ7kKuk037722; Mon, 19 Dec 2016 07:46:20 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ7kKoL037721; Mon, 19 Dec 2016 07:46:20 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201612190746.uBJ7kKoL037721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 19 Dec 2016 07:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310240 - stable/11/usr.sbin/portsnap/portsnap X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 07:46:22 -0000 Author: cperciva Date: Mon Dec 19 07:46:20 2016 New Revision: 310240 URL: https://svnweb.freebsd.org/changeset/base/310240 Log: MFC r310179: Avoid division by zero in the rare case that portsnap needs to fetch zero patches. (This avoids two "dc: divide by zero" warnings.) Modified: stable/11/usr.sbin/portsnap/portsnap/portsnap.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- stable/11/usr.sbin/portsnap/portsnap/portsnap.sh Mon Dec 19 07:40:45 2016 (r310239) +++ stable/11/usr.sbin/portsnap/portsnap/portsnap.sh Mon Dec 19 07:46:20 2016 (r310240) @@ -619,8 +619,10 @@ fetch_progress() { pct_fmt() { - printf " \r" - printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc` + if [ $TOTAL -gt 0 ]; then + printf " \r" + printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc` + fi } fetch_progress_percent() { From owner-svn-src-stable-11@freebsd.org Mon Dec 19 07:48:06 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30AAAC87478; Mon, 19 Dec 2016 07:48:06 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBD90B02; Mon, 19 Dec 2016 07:48:05 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ7m5NW037831; Mon, 19 Dec 2016 07:48:05 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ7m5kD037830; Mon, 19 Dec 2016 07:48:05 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201612190748.uBJ7m5kD037830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 19 Dec 2016 07:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310241 - stable/11/sys/fs/nfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 07:48:06 -0000 Author: cperciva Date: Mon Dec 19 07:48:04 2016 New Revision: 310241 URL: https://svnweb.freebsd.org/changeset/base/310241 Log: MFC r308708: Reduce verbosity of warnings about truncating NFS fileids to 32-bit inode numbers. Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Dec 19 07:46:20 2016 (r310240) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Dec 19 07:48:04 2016 (r310241) @@ -827,6 +827,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd struct dqblk dqb; uid_t savuid; #endif + static struct timeval last64fileid; + static size_t count64fileid; + static struct timeval last64mountfileid; + static size_t count64mountfileid; + static struct timeval warninterval = { 60, 0 }; + if (compare) { retnotsup = 0; error = nfsrv_getattrbits(nd, &attrbits, NULL, &retnotsup); @@ -1202,8 +1208,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd *retcmpp = NFSERR_NOTSAME; } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 fileid > 32bits\n"); + if (*tl++) { + count64fileid++; + if (ratecheck(&last64fileid, &warninterval)) { + printf("NFSv4 fileid > 32bits (%zu occurrences)\n", + count64fileid); + count64fileid = 0; + } + } nap->na_fileid = thyp; } attrsum += NFSX_HYPER; @@ -1740,8 +1752,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd } } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 mounted on fileid > 32bits\n"); + if (*tl++) { + count64mountfileid++; + if (ratecheck(&last64mountfileid, &warninterval)) { + printf("NFSv4 mounted on fileid > 32bits (%zu occurrences)\n", + count64mountfileid); + count64mountfileid = 0; + } + } nap->na_mntonfileno = thyp; } attrsum += NFSX_HYPER; From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:32:31 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EC9BC86475; Mon, 19 Dec 2016 09:32:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9EB4F03; Mon, 19 Dec 2016 09:32:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9WUj0082276; Mon, 19 Dec 2016 09:32:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9WTWp082274; Mon, 19 Dec 2016 09:32:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190932.uBJ9WTWp082274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310243 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:32:31 -0000 Author: hselasky Date: Mon Dec 19 09:32:29 2016 New Revision: 310243 URL: https://svnweb.freebsd.org/changeset/base/310243 Log: MFC r309406: Remove useless NULL checks. NULL is not returned when allocating memory passing the M_WAITOK flag. Submitted by: trasz @ Differential Revision: https://reviews.freebsd.org/D5772 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:28:12 2016 (r310242) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:32:29 2016 (r310243) @@ -854,8 +854,6 @@ mlx5e_create_main_flow_table(struct mlx5 u8 *dmac; g = malloc(9 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO); - if (g == NULL) - return (-ENOMEM); g[0].log_sz = 2; g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; @@ -939,8 +937,6 @@ mlx5e_create_vlan_flow_table(struct mlx5 struct mlx5_flow_table_group *g; g = malloc(2 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO); - if (g == NULL) - return (-ENOMEM); g[0].log_sz = 12; g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 19 09:28:12 2016 (r310242) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 19 09:32:29 2016 (r310243) @@ -656,10 +656,6 @@ mlx5e_create_rq(struct mlx5e_channel *c, goto err_rq_wq_destroy; rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); - if (rq->mbuf == NULL) { - err = -ENOMEM; - goto err_lro_init; - } for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN; @@ -686,7 +682,6 @@ mlx5e_create_rq(struct mlx5e_channel *c, err_rq_mbuf_free: free(rq->mbuf, M_MLX5EN); -err_lro_init: tcp_lro_free(&rq->lro); err_rq_wq_destroy: mlx5_wq_destroy(&rq->wq_ctrl); @@ -897,8 +892,6 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq) int x; sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); - if (sq->mbuf == NULL) - return (-ENOMEM); /* Create DMA descriptor MAPs */ for (x = 0; x != wq_sz; x++) { @@ -1486,9 +1479,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr int err; c = malloc(sizeof(*c), M_MLX5EN, M_WAITOK | M_ZERO); - if (c == NULL) - return (-ENOMEM); - c->priv = priv; c->ix = ix; c->cpu = 0; @@ -1699,8 +1689,6 @@ mlx5e_open_channels(struct mlx5e_priv *p priv->channel = malloc(priv->params.num_channels * sizeof(struct mlx5e_channel *), M_MLX5EN, M_WAITOK | M_ZERO); - if (priv->channel == NULL) - return (-ENOMEM); mlx5e_build_channel_param(priv, &cparam); for (i = 0; i < priv->params.num_channels; i++) { @@ -2879,10 +2867,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *m return (NULL); } priv = malloc(sizeof(*priv), M_MLX5EN, M_WAITOK | M_ZERO); - if (priv == NULL) { - mlx5_core_err(mdev, "malloc() failed\n"); - return (NULL); - } mlx5e_priv_mtx_init(priv); ifp = priv->ifp = if_alloc(IFT_ETHER); From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:40:30 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79B18C86660; Mon, 19 Dec 2016 09:40:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FDDF1440; Mon, 19 Dec 2016 09:40:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9eTnX082699; Mon, 19 Dec 2016 09:40:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9eThw082697; Mon, 19 Dec 2016 09:40:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190940.uBJ9eThw082697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310245 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:40:30 -0000 Author: hselasky Date: Mon Dec 19 09:40:29 2016 New Revision: 310245 URL: https://svnweb.freebsd.org/changeset/base/310245 Log: MFC r309734: Avoid malloc() warnings when using the LinuxKPI by zero-checking the allocation flags. Obtained from: kmacy @ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h Mon Dec 19 09:38:34 2016 (r310244) +++ stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h Mon Dec 19 09:40:29 2016 (r310245) @@ -64,7 +64,7 @@ #define GFP_IOFS M_NOWAIT #define GFP_NOIO M_NOWAIT #define GFP_DMA32 0 -#define GFP_TEMPORARY 0 +#define GFP_TEMPORARY M_NOWAIT static inline void * page_address(struct page *page) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:38:34 2016 (r310244) +++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:40:29 2016 (r310245) @@ -43,7 +43,7 @@ MALLOC_DECLARE(M_KMALLOC); #define kmalloc(size, flags) malloc((size), M_KMALLOC, (flags)) #define kvmalloc(size) kmalloc((size), 0) -#define kzalloc(size, flags) kmalloc((size), (flags) | M_ZERO) +#define kzalloc(size, flags) kmalloc((size), M_ZERO | ((flags) ? (flags) : M_NOWAIT)) #define kzalloc_node(size, flags, node) kzalloc(size, flags) #define kfree(ptr) free(__DECONST(void *, (ptr)), M_KMALLOC) #define kfree_const(ptr) kfree(ptr) From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:41:51 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14BB2C868E2; Mon, 19 Dec 2016 09:41:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D360D197E; Mon, 19 Dec 2016 09:41:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9fopj086270; Mon, 19 Dec 2016 09:41:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9fn5i086268; Mon, 19 Dec 2016 09:41:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190941.uBJ9fn5i086268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310246 - in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:41:51 -0000 Author: hselasky Date: Mon Dec 19 09:41:49 2016 New Revision: 310246 URL: https://svnweb.freebsd.org/changeset/base/310246 Log: MFC r309733: MSIX can support more than 256 IRQs. Make sure the invalid IRQ number set in the LinuxKPI is big enough. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Dec 19 09:40:29 2016 (r310245) +++ stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Dec 19 09:41:49 2016 (r310246) @@ -70,6 +70,7 @@ struct device { uint64_t *dma_mask; void *driver_data; unsigned int irq; +#define LINUX_IRQ_INVALID 65535 unsigned int msix; unsigned int msix_max; const struct attribute_group **groups; Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:40:29 2016 (r310245) +++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:41:49 2016 (r310246) @@ -144,7 +144,7 @@ linux_pci_attach(device_t dev) if (rle) pdev->dev.irq = rle->start; else - pdev->dev.irq = 255; + pdev->dev.irq = LINUX_IRQ_INVALID; pdev->irq = pdev->dev.irq; DROP_GIANT(); spin_lock(&pci_lock); From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:42:44 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC314C869A9; Mon, 19 Dec 2016 09:42:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE2C61C58; Mon, 19 Dec 2016 09:42:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9ghCM086358; Mon, 19 Dec 2016 09:42:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9ghji086357; Mon, 19 Dec 2016 09:42:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190942.uBJ9ghji086357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310247 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:42:45 -0000 Author: hselasky Date: Mon Dec 19 09:42:43 2016 New Revision: 310247 URL: https://svnweb.freebsd.org/changeset/base/310247 Log: MFC r309731: Prefix the Linux KPI's kmem_xxx() functions with linux_ to avoid conflict with the opensolaris kernel module. This patch solves a problem where the kernel linker will incorrectly resolve opensolaris kmem_xxx() functions as linuxkpi ones, which leads to a panic when these functions are used. Submitted by: gallatin @ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:41:49 2016 (r310246) +++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:42:43 2016 (r310247) @@ -55,7 +55,18 @@ MALLOC_DECLARE(M_KMALLOC); #define vmalloc(size) kmalloc(size, GFP_KERNEL) #define vmalloc_node(size, node) kmalloc(size, GFP_KERNEL) -struct kmem_cache { + +/* + * Prefix some functions with linux_ to avoid namespace conflict + * with the OpenSolaris code in the kernel. + */ +#define kmem_cache linux_kmem_cache +#define kmem_cache_create(...) linux_kmem_cache_create(__VA_ARGS__) +#define kmem_cache_alloc(...) linux_kmem_cache_alloc(__VA_ARGS__) +#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) +#define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__) + +struct linux_kmem_cache { uma_zone_t cache_zone; void (*cache_ctor)(void *); }; @@ -63,7 +74,7 @@ struct kmem_cache { #define SLAB_HWCACHE_ALIGN 0x0001 static inline int -kmem_ctor(void *mem, int size, void *arg, int flags) +linux_kmem_ctor(void *mem, int size, void *arg, int flags) { void (*ctor)(void *); @@ -74,7 +85,7 @@ kmem_ctor(void *mem, int size, void *arg } static inline struct kmem_cache * -kmem_cache_create(char *name, size_t size, size_t align, u_long flags, +linux_kmem_cache_create(char *name, size_t size, size_t align, u_long flags, void (*ctor)(void *)) { struct kmem_cache *c; @@ -84,7 +95,7 @@ kmem_cache_create(char *name, size_t siz align--; if (flags & SLAB_HWCACHE_ALIGN) align = UMA_ALIGN_CACHE; - c->cache_zone = uma_zcreate(name, size, ctor ? kmem_ctor : NULL, + c->cache_zone = uma_zcreate(name, size, ctor ? linux_kmem_ctor : NULL, NULL, NULL, NULL, align, 0); c->cache_ctor = ctor; @@ -92,19 +103,19 @@ kmem_cache_create(char *name, size_t siz } static inline void * -kmem_cache_alloc(struct kmem_cache *c, int flags) +linux_kmem_cache_alloc(struct kmem_cache *c, int flags) { return uma_zalloc_arg(c->cache_zone, c->cache_ctor, flags); } static inline void -kmem_cache_free(struct kmem_cache *c, void *m) +linux_kmem_cache_free(struct kmem_cache *c, void *m) { uma_zfree(c->cache_zone, m); } static inline void -kmem_cache_destroy(struct kmem_cache *c) +linux_kmem_cache_destroy(struct kmem_cache *c) { uma_zdestroy(c->cache_zone); free(c, M_KMALLOC); From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:44:15 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97F2FC86A48; Mon, 19 Dec 2016 09:44:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F91E1E64; Mon, 19 Dec 2016 09:44:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9iEU2086483; Mon, 19 Dec 2016 09:44:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9iE4m086482; Mon, 19 Dec 2016 09:44:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190944.uBJ9iE4m086482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310248 - stable/11/sys/netgraph X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:44:15 -0000 Author: hselasky Date: Mon Dec 19 09:44:14 2016 New Revision: 310248 URL: https://svnweb.freebsd.org/changeset/base/310248 Log: MFC r309404: Fix return value from ng_uncallout(). callout_stop() recently started returning -1 when the callout is already stopped, which is not handled by the netgraph code. Properly filter the return value. Netgraph callers only want to know if the callout was cancelled and not draining or already stopped. Discussed with: julian, glebius Modified: stable/11/sys/netgraph/ng_base.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netgraph/ng_base.c ============================================================================== --- stable/11/sys/netgraph/ng_base.c Mon Dec 19 09:42:43 2016 (r310247) +++ stable/11/sys/netgraph/ng_base.c Mon Dec 19 09:44:14 2016 (r310248) @@ -3825,7 +3825,11 @@ ng_uncallout(struct callout *c, node_p n } c->c_arg = NULL; - return (rval); + /* + * Callers only want to know if the callout was cancelled and + * not draining or stopped. + */ + return (rval > 0); } /* From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:47:36 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0231BC86B9D; Mon, 19 Dec 2016 09:47:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8C196DC; Mon, 19 Dec 2016 09:47:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9lYCf086812; Mon, 19 Dec 2016 09:47:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9lYBj086809; Mon, 19 Dec 2016 09:47:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190947.uBJ9lYBj086809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310250 - in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:47:36 -0000 Author: hselasky Date: Mon Dec 19 09:47:34 2016 New Revision: 310250 URL: https://svnweb.freebsd.org/changeset/base/310250 Log: MFC r309732: Prefix some _pci_xxx() functions in the Linux KPI with linux_ and make sure the IRQ number used by these functions is unsigned. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h stable/11/sys/compat/linuxkpi/common/include/linux/pci.h stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Mon Dec 19 09:45:23 2016 (r310249) +++ stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Mon Dec 19 09:47:34 2016 (r310250) @@ -50,11 +50,11 @@ struct irq_ent { void *arg; irqreturn_t (*handler)(int, void *); void *tag; - int irq; + unsigned int irq; }; static inline int -linux_irq_rid(struct device *dev, int irq) +linux_irq_rid(struct device *dev, unsigned int irq) { if (irq == dev->irq) return (0); @@ -64,7 +64,7 @@ linux_irq_rid(struct device *dev, int ir extern void linux_irq_handler(void *); static inline struct irq_ent * -linux_irq_ent(struct device *dev, int irq) +linux_irq_ent(struct device *dev, unsigned int irq) { struct irq_ent *irqe; @@ -85,7 +85,7 @@ request_irq(unsigned int irq, irq_handle int error; int rid; - dev = _pci_find_irq_dev(irq); + dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return -ENXIO; rid = linux_irq_rid(dev, irq); @@ -117,7 +117,7 @@ bind_irq_to_cpu(unsigned int irq, int cp struct irq_ent *irqe; struct device *dev; - dev = _pci_find_irq_dev(irq); + dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return (-ENOENT); @@ -135,7 +135,7 @@ free_irq(unsigned int irq, void *device) struct device *dev; int rid; - dev = _pci_find_irq_dev(irq); + dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return; rid = linux_irq_rid(dev, irq); Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:45:23 2016 (r310249) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:47:34 2016 (r310250) @@ -171,7 +171,7 @@ struct pci_dev { }; static inline struct resource_list_entry * -_pci_get_rle(struct pci_dev *pdev, int type, int rid) +linux_pci_get_rle(struct pci_dev *pdev, int type, int rid) { struct pci_devinfo *dinfo; struct resource_list *rl; @@ -182,18 +182,18 @@ _pci_get_rle(struct pci_dev *pdev, int t } static inline struct resource_list_entry * -_pci_get_bar(struct pci_dev *pdev, int bar) +linux_pci_get_bar(struct pci_dev *pdev, int bar) { struct resource_list_entry *rle; bar = PCIR_BAR(bar); - if ((rle = _pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL) - rle = _pci_get_rle(pdev, SYS_RES_IOPORT, bar); + if ((rle = linux_pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL) + rle = linux_pci_get_rle(pdev, SYS_RES_IOPORT, bar); return (rle); } static inline struct device * -_pci_find_irq_dev(unsigned int irq) +linux_pci_find_irq_dev(unsigned int irq) { struct pci_dev *pdev; @@ -215,7 +215,7 @@ pci_resource_start(struct pci_dev *pdev, { struct resource_list_entry *rle; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return (0); return rle->start; } @@ -225,7 +225,7 @@ pci_resource_len(struct pci_dev *pdev, i { struct resource_list_entry *rle; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return (0); return rle->count; } @@ -331,7 +331,7 @@ pci_release_region(struct pci_dev *pdev, { struct resource_list_entry *rle; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return; bus_release_resource(pdev->dev.bsddev, rle->type, rle->rid, rle->res); } @@ -477,7 +477,7 @@ pci_enable_msix(struct pci_dev *pdev, st pci_release_msi(pdev->dev.bsddev); return avail; } - rle = _pci_get_rle(pdev, SYS_RES_IRQ, 1); + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1); pdev->dev.msix = rle->start; pdev->dev.msix_max = rle->start + avail; for (i = 0; i < nreq; i++) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:45:23 2016 (r310249) +++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:47:34 2016 (r310250) @@ -140,8 +140,8 @@ linux_pci_attach(device_t dev) kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); kobject_add(&pdev->dev.kobj, &linux_root_device.kobj, kobject_name(&pdev->dev.kobj)); - rle = _pci_get_rle(pdev, SYS_RES_IRQ, 0); - if (rle) + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 0); + if (rle != NULL) pdev->dev.irq = rle->start; else pdev->dev.irq = LINUX_IRQ_INVALID; From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:48:30 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBFF8C86C4E; Mon, 19 Dec 2016 09:48:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AABE8984; Mon, 19 Dec 2016 09:48:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9mTuR086900; Mon, 19 Dec 2016 09:48:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9mTVN086899; Mon, 19 Dec 2016 09:48:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190948.uBJ9mTVN086899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310251 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:48:31 -0000 Author: hselasky Date: Mon Dec 19 09:48:29 2016 New Revision: 310251 URL: https://svnweb.freebsd.org/changeset/base/310251 Log: MFC r309736: Prefer function macros over regular macros in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:47:34 2016 (r310250) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:48:29 2016 (r310251) @@ -537,9 +537,9 @@ static inline void pci_disable_sriov(str #define PCI_DMA_NONE 3 #define pci_pool dma_pool -#define pci_pool_destroy dma_pool_destroy -#define pci_pool_alloc dma_pool_alloc -#define pci_pool_free dma_pool_free +#define pci_pool_destroy(...) dma_pool_destroy(__VA_ARGS__) +#define pci_pool_alloc(...) dma_pool_alloc(__VA_ARGS__) +#define pci_pool_free(...) dma_pool_free(__VA_ARGS__) #define pci_pool_create(_name, _pdev, _size, _align, _alloc) \ dma_pool_create(_name, &(_pdev)->dev, _size, _align, _alloc) #define pci_free_consistent(_hwdev, _size, _vaddr, _dma_handle) \ From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:49:18 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38D7BC86CEF; Mon, 19 Dec 2016 09:49:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDDA0AF2; Mon, 19 Dec 2016 09:49:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9nHEF086985; Mon, 19 Dec 2016 09:49:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9nHZA086984; Mon, 19 Dec 2016 09:49:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190949.uBJ9nHZA086984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310252 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:49:18 -0000 Author: hselasky Date: Mon Dec 19 09:49:16 2016 New Revision: 310252 URL: https://svnweb.freebsd.org/changeset/base/310252 Log: MFC r309737: Add more LinuxKPI PCI definitions. Obtained from: kmacy @ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:48:29 2016 (r310251) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:49:16 2016 (r310252) @@ -64,8 +64,18 @@ struct pci_device_id { #define MODULE_DEVICE_TABLE(bus, table) #define PCI_ANY_ID (-1) +#define PCI_VENDOR_ID_APPLE 0x106b +#define PCI_VENDOR_ID_ASUSTEK 0x1043 +#define PCI_VENDOR_ID_ATI 0x1002 +#define PCI_VENDOR_ID_DELL 0x1028 +#define PCI_VENDOR_ID_HP 0x103c +#define PCI_VENDOR_ID_IBM 0x1014 +#define PCI_VENDOR_ID_INTEL 0x8086 #define PCI_VENDOR_ID_MELLANOX 0x15b3 +#define PCI_VENDOR_ID_SERVERWORKS 0x1166 +#define PCI_VENDOR_ID_SONY 0x104d #define PCI_VENDOR_ID_TOPSPIN 0x1867 +#define PCI_VENDOR_ID_VIA 0x1106 #define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 #define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 #define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 @@ -121,6 +131,10 @@ struct pci_device_id { #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */ +#define PCI_EXP_LNKCTL_HAWD PCIEM_LINK_CTL_HAWD +#define PCI_EXP_LNKCAP_CLKPM 0x00040000 +#define PCI_EXP_DEVSTA_TRPND 0x0020 + #define IORESOURCE_MEM (1 << SYS_RES_MEMORY) #define IORESOURCE_IO (1 << SYS_RES_IOPORT) #define IORESOURCE_IRQ (1 << SYS_RES_IRQ) @@ -133,9 +147,19 @@ enum pci_bus_speed { }; enum pcie_link_width { - PCIE_LNK_WIDTH_UNKNOWN = -1, + PCIE_LNK_WIDTH_UNKNOWN = 0xFF, }; +typedef int pci_power_t; + +#define PCI_D0 PCI_POWERSTATE_D0 +#define PCI_D1 PCI_POWERSTATE_D1 +#define PCI_D2 PCI_POWERSTATE_D2 +#define PCI_D3hot PCI_POWERSTATE_D3 +#define PCI_D3cold 4 + +#define PCI_POWER_ERROR PCI_POWERSTATE_UNKNOWN + struct pci_dev; struct pci_driver { @@ -303,6 +327,14 @@ pci_set_master(struct pci_dev *pdev) } static inline int +pci_set_power_state(struct pci_dev *pdev, int state) +{ + + pci_set_powerstate(pdev->dev.bsddev, state); + return (0); +} + +static inline int pci_clear_master(struct pci_dev *pdev) { @@ -368,9 +400,23 @@ pci_disable_msix(struct pci_dev *pdev) pci_release_msi(pdev->dev.bsddev); } +static inline bus_addr_t +pci_bus_address(struct pci_dev *pdev, int bar) +{ + + return (pci_resource_start(pdev, bar)); +} + #define PCI_CAP_ID_EXP PCIY_EXPRESS #define PCI_CAP_ID_PCIX PCIY_PCIX +#define PCI_CAP_ID_AGP PCIY_AGP +#define PCI_CAP_ID_PM PCIY_PMG +#define PCI_EXP_DEVCTL PCIER_DEVICE_CTL +#define PCI_EXP_DEVCTL_PAYLOAD PCIEM_CTL_MAX_PAYLOAD +#define PCI_EXP_DEVCTL_READRQ PCIEM_CTL_MAX_READ_REQUEST +#define PCI_EXP_LNKCTL PCIER_LINK_CTL +#define PCI_EXP_LNKSTA PCIER_LINK_STA static inline int pci_find_capability(struct pci_dev *pdev, int capid) @@ -410,7 +456,7 @@ pci_read_config_dword(struct pci_dev *pd *val = (u32)pci_read_config(pdev->dev.bsddev, where, 4); return (0); -} +} static inline int pci_write_config_byte(struct pci_dev *pdev, int where, u8 val) @@ -430,7 +476,7 @@ pci_write_config_word(struct pci_dev *pd static inline int pci_write_config_dword(struct pci_dev *pdev, int where, u32 val) -{ +{ pci_write_config(pdev->dev.bsddev, where, val, 4); return (0); @@ -708,7 +754,8 @@ static bool pcie_capability_reg_implemen } } -static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst) +static inline int +pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst) { if (pos & 3) return -EINVAL; @@ -719,7 +766,20 @@ static inline int pcie_capability_read_d return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst); } -static inline int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) +static inline int +pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *dst) +{ + if (pos & 3) + return -EINVAL; + + if (!pcie_capability_reg_implemented(dev, pos)) + return -EINVAL; + + return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst); +} + +static inline int +pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) { if (pos & 1) return -EINVAL; From owner-svn-src-stable-11@freebsd.org Mon Dec 19 09:51:18 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBE41C87231; Mon, 19 Dec 2016 09:51:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6743FF9; Mon, 19 Dec 2016 09:51:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9pHwv088101; Mon, 19 Dec 2016 09:51:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9pHU4088100; Mon, 19 Dec 2016 09:51:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190951.uBJ9pHU4088100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310253 - stable/11/sys/dev/acpica X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:51:19 -0000 Author: hselasky Date: Mon Dec 19 09:51:17 2016 New Revision: 310253 URL: https://svnweb.freebsd.org/changeset/base/310253 Log: MFC r309400: Fix for endless recursion in the ACPI GPE handler during boot. When handling a GPE ACPI interrupt object the EcSpaceHandler() function can be called which checks the EC_EVENT_SCI bit and then recurse on the EcGpeQueryHandler() function. If there are multiple GPE events pending the EC_EVENT_SCI bit will be set at the next call to EcSpaceHandler() causing it to recurse again via the EcGpeQueryHandler() function. This leads to a slow never ending recursion during boot which prevents proper system startup, because the EC_EVENT_SCI bit never gets cleared in this scenario. The behaviour is reproducible with the ALASKA AMI in combination with a newer Skylake based mainboard in the following way: Enter BIOS and adjust the clock one hour forward. Save and exit the BIOS. System fails to boot due to the above mentioned bug in EcGpeQueryHandler() which was observed recursing multiple times. This patch adds a simple recursion guard to the EcGpeQueryHandler() function and also also adds logic to detect if new GPE events occurred during the execution of EcGpeQueryHandler() and then loop on this function instead of recursing. Reviewed by: jhb Modified: stable/11/sys/dev/acpica/acpi_ec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:49:16 2016 (r310252) +++ stable/11/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:51:17 2016 (r310253) @@ -613,16 +613,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, } static void -EcGpeQueryHandler(void *Context) +EcGpeQueryHandlerSub(struct acpi_ec_softc *sc) { - struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); /* Serialize user access with EcSpaceHandler(). */ Status = EcLock(sc); @@ -647,7 +645,6 @@ EcGpeQueryHandler(void *Context) EC_EVENT_INPUT_BUFFER_EMPTY))) break; } - sc->ec_sci_pend = FALSE; if (ACPI_FAILURE(Status)) { EcUnlock(sc); device_printf(sc->ec_dev, "GPE query failed: %s\n", @@ -678,6 +675,29 @@ EcGpeQueryHandler(void *Context) } } +static void +EcGpeQueryHandler(void *Context) +{ + struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; + int pending; + + KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); + + do { + /* Read the current pending count */ + pending = atomic_load_acq_int(&sc->ec_sci_pend); + + /* Call GPE handler function */ + EcGpeQueryHandlerSub(sc); + + /* + * Try to reset the pending count to zero. If this fails we + * know another GPE event has occurred while handling the + * current GPE event and need to loop. + */ + } while (!atomic_cmpset_int(&sc->ec_sci_pend, pending, 0)); +} + /* * The GPE handler is called when IBE/OBF or SCI events occur. We are * called from an unknown lock context. @@ -706,13 +726,14 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT * It will run the query and _Qxx method later, under the lock. */ EcStatus = EC_GET_CSR(sc); - if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) { + if ((EcStatus & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec gpe queueing query handler"); Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context); - if (ACPI_SUCCESS(Status)) - sc->ec_sci_pend = TRUE; - else + if (ACPI_FAILURE(Status)) { printf("EcGpeHandler: queuing GPE query handler failed\n"); + atomic_store_rel_int(&sc->ec_sci_pend, 0); + } } return (ACPI_REENABLE_GPE); } @@ -759,7 +780,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY * we call it directly here since our thread taskq is not active yet. */ if (cold || rebooting || sc->ec_suspending) { - if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { + if ((EC_GET_CSR(sc) & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec running gpe handler directly"); EcGpeQueryHandler(sc); } From owner-svn-src-stable-11@freebsd.org Mon Dec 19 12:20:59 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7265C86664; Mon, 19 Dec 2016 12:20:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A90F51599; Mon, 19 Dec 2016 12:20:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCKwWS050326; Mon, 19 Dec 2016 12:20:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCKwO6050325; Mon, 19 Dec 2016 12:20:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191220.uBJCKwO6050325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310260 - stable/11/share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:21:00 -0000 Author: trasz Date: Mon Dec 19 12:20:58 2016 New Revision: 310260 URL: https://svnweb.freebsd.org/changeset/base/310260 Log: MFC r308637: Fix function prototypes in usbdi(9) man page, and tweak it a little. Modified: stable/11/share/man/man9/usbdi.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/usbdi.9 ============================================================================== --- stable/11/share/man/man9/usbdi.9 Mon Dec 19 11:44:41 2016 (r310259) +++ stable/11/share/man/man9/usbdi.9 Mon Dec 19 12:20:58 2016 (r310260) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 24, 2009 +.Dd November 14, 2016 .Dt USBDI 9 .Os .Sh NAME @@ -84,60 +84,40 @@ .In dev/usb/usb.h .In dev/usb/usbdi.h .In dev/usb/usbdi_util.h -.Sh DESCRIPTION -The Universal Serial Bus (USB) driver programming interface provides -USB peripheral drivers with a host controller independent API for -controlling and communicating with USB peripherals. -The -.Nm usb -module supports both USB Host and USB Device side mode. -. -.Sh USB KERNEL PROGRAMMING -Here is a list of commonly used functions: -.Pp -. .Ft "usb_error_t" .Fo "usbd_transfer_setup" -.Fa "udev" -.Fa "ifaces" -.Fa "pxfer" -.Fa "setup_start" -.Fa "n_setup" -.Fa "priv_sc" -.Fa "priv_mtx" +.Fa "struct usb_device *udev" +.Fa "const uint8_t *ifaces" +.Fa "struct usb_xfer **pxfer" +.Fa "const struct usb_config *setup_start" +.Fa "uint16_t n_setup" +.Fa "void *priv_sc" +.Fa "struct mtx *priv_mtx" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_unsetup" -.Fa "pxfer" -.Fa "n_setup" +.Fa "struct usb_xfer **pxfer" +.Fa "uint16_t n_setup" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_start" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_stop" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_drain" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -. -. +.Sh DESCRIPTION +The Universal Serial Bus (USB) driver programming interface provides +USB peripheral drivers with a host controller independent API for +controlling and communicating with USB peripherals. +The +.Nm usb +module supports both USB Host and USB Device side mode. .Sh USB TRANSFER MANAGEMENT FUNCTIONS The USB standard defines four types of USB transfers. . @@ -552,7 +532,7 @@ for the 8-bytes of SETUP header. These 8-bytes are not counted by the "xfer->max_data_length" variable. . -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It ext_buffer @@ -561,7 +541,7 @@ allocated. . Instead the USB client must supply a data buffer. . -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It manual_status @@ -579,7 +559,7 @@ This flag can be changed during operatio . .It no_pipe_ok Setting this flag causes the USB_ERR_NO_PIPE error to be ignored. -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It stall_pipe From owner-svn-src-stable-11@freebsd.org Mon Dec 19 12:22:33 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94B22C86874; Mon, 19 Dec 2016 12:22:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D172193A; Mon, 19 Dec 2016 12:22:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCMW8W054110; Mon, 19 Dec 2016 12:22:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCMW9g054109; Mon, 19 Dec 2016 12:22:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191222.uBJCMW9g054109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310261 - stable/11/sys/fs/autofs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:22:33 -0000 Author: trasz Date: Mon Dec 19 12:22:32 2016 New Revision: 310261 URL: https://svnweb.freebsd.org/changeset/base/310261 Log: MFC r308611: Remove spurious space. Modified: stable/11/sys/fs/autofs/autofs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/autofs/autofs.c ============================================================================== --- stable/11/sys/fs/autofs/autofs.c Mon Dec 19 12:20:58 2016 (r310260) +++ stable/11/sys/fs/autofs/autofs.c Mon Dec 19 12:22:32 2016 (r310261) @@ -61,7 +61,7 @@ */ #include - __FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD$"); #include #include From owner-svn-src-stable-11@freebsd.org Mon Dec 19 12:25:32 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E38FC86917; Mon, 19 Dec 2016 12:25:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E13DF1AE3; Mon, 19 Dec 2016 12:25:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCPVOO054263; Mon, 19 Dec 2016 12:25:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCPV3M054262; Mon, 19 Dec 2016 12:25:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191225.uBJCPV3M054262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310262 - stable/11/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:25:32 -0000 Author: trasz Date: Mon Dec 19 12:25:30 2016 New Revision: 310262 URL: https://svnweb.freebsd.org/changeset/base/310262 Log: MFC r308386: Document that getfsstat(2) called with MNT_NOWAIT skips file systems that are in the process of being unmounted. Modified: stable/11/lib/libc/sys/getfsstat.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/getfsstat.2 ============================================================================== --- stable/11/lib/libc/sys/getfsstat.2 Mon Dec 19 12:22:32 2016 (r310261) +++ stable/11/lib/libc/sys/getfsstat.2 Mon Dec 19 12:25:30 2016 (r310262) @@ -28,7 +28,7 @@ .\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95 .\" $FreeBSD$ .\" -.Dd November 20, 2003 +.Dd November 6, 2016 .Dt GETFSSTAT 2 .Os .Sh NAME @@ -88,6 +88,8 @@ Thus, some of the information will be ou .Fn getfsstat will not block waiting for information from a file system that is unable to respond. +It will also skip any file system that is in the process of being +unmounted, even if the unmount would eventually fail. .Sh RETURN VALUES Upon successful completion, the number of .Fa statfs From owner-svn-src-stable-11@freebsd.org Mon Dec 19 12:27:02 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1EB3C869B6; Mon, 19 Dec 2016 12:27:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90EDD1C66; Mon, 19 Dec 2016 12:27:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCR1SM054372; Mon, 19 Dec 2016 12:27:01 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCR13v054371; Mon, 19 Dec 2016 12:27:01 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191227.uBJCR13v054371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:27:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310263 - stable/11/usr.sbin/iostat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:27:02 -0000 Author: trasz Date: Mon Dec 19 12:27:01 2016 New Revision: 310263 URL: https://svnweb.freebsd.org/changeset/base/310263 Log: MFC r306095: Make the "r/s" and "w/s" fields in "iostat -x" a little bit wider; five chars is way too narrow for todays disks. Modified: stable/11/usr.sbin/iostat/iostat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/iostat/iostat.c ============================================================================== --- stable/11/usr.sbin/iostat/iostat.c Mon Dec 19 12:25:30 2016 (r310262) +++ stable/11/usr.sbin/iostat/iostat.c Mon Dec 19 12:27:01 2016 (r310263) @@ -807,7 +807,7 @@ devstats(int perf_select, long double et printf(" cpu "); printf("\n"); if (Iflag == 0) { - printf("device r/s w/s kr/s kw/s " + printf("device r/s w/s kr/s kw/s " " ms/r ms/w ms/o ms/t qlen %%b "); } else { printf("device r/i w/i kr/i" @@ -884,7 +884,7 @@ devstats(int perf_select, long double et mb_per_second_write > ((long double).0005)/1024 || busy_pct > 0.5) { if (Iflag == 0) - printf("%-8.8s %5d %5d %8.1Lf " + printf("%-8.8s %7d %7d %8.1Lf " "%8.1Lf %5d %5d %5d %5d " "%4" PRIu64 " %3.0Lf ", devicename, From owner-svn-src-stable-11@freebsd.org Mon Dec 19 17:02:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3225C88584; Mon, 19 Dec 2016 17:02:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 981431348; Mon, 19 Dec 2016 17:02:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJH2tv0073763; Mon, 19 Dec 2016 17:02:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJH2tLM073762; Mon, 19 Dec 2016 17:02:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191702.uBJH2tLM073762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 17:02:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310276 - stable/11/lib/libusb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:02:57 -0000 Author: trasz Date: Mon Dec 19 17:02:55 2016 New Revision: 310276 URL: https://svnweb.freebsd.org/changeset/base/310276 Log: MFC r307774: Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not "product vendor". This is consistent with how it's generally done. The ordering is visible eg in usbconfig(8) output. Modified: stable/11/lib/libusb/libusb20_ugen20.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libusb/libusb20_ugen20.c ============================================================================== --- stable/11/lib/libusb/libusb20_ugen20.c Mon Dec 19 15:49:59 2016 (r310275) +++ stable/11/lib/libusb/libusb20_ugen20.c Mon Dec 19 17:02:55 2016 (r310276) @@ -214,8 +214,8 @@ ugen20_enumerate(struct libusb20_device snprintf(pdev->usb_desc, sizeof(pdev->usb_desc), USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number, - pdev->device_address, devinfo.udi_product, - devinfo.udi_vendor, pdev->bus_number); + pdev->device_address, devinfo.udi_vendor, + devinfo.udi_product, pdev->bus_number); error = 0; done: From owner-svn-src-stable-11@freebsd.org Mon Dec 19 17:05:26 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A9CAC886F2; Mon, 19 Dec 2016 17:05:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE11F17A7; Mon, 19 Dec 2016 17:05:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJH5PoM073899; Mon, 19 Dec 2016 17:05:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJH5Pm6073898; Mon, 19 Dec 2016 17:05:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191705.uBJH5Pm6073898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 17:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310277 - stable/11/sys/dev/usb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:05:26 -0000 Author: trasz Date: Mon Dec 19 17:05:24 2016 New Revision: 310277 URL: https://svnweb.freebsd.org/changeset/base/310277 Log: MFC r307902: Make the USB attach strings in dmesg include product name. Modified: stable/11/sys/dev/usb/usb_device.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/usb_device.c ============================================================================== --- stable/11/sys/dev/usb/usb_device.c Mon Dec 19 17:02:55 2016 (r310276) +++ stable/11/sys/dev/usb/usb_device.c Mon Dec 19 17:05:24 2016 (r310277) @@ -1938,8 +1938,8 @@ config_done: udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name); /* Announce device */ - printf("%s: <%s> at %s\n", udev->ugen_name, - usb_get_manufacturer(udev), + printf("%s: <%s %s> at %s\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), device_get_nameunit(udev->bus->bdev)); #endif @@ -2148,8 +2148,9 @@ usb_free_device(struct usb_device *udev, #if USB_HAVE_UGEN if (!rebooting) { - printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, - usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); + printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), + device_get_nameunit(bus->bdev)); } /* Destroy UGEN symlink, if any */ From owner-svn-src-stable-11@freebsd.org Mon Dec 19 19:37:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AA9EC87415; Mon, 19 Dec 2016 19:37:56 +0000 (UTC) (envelope-from lifanov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19BB01503; Mon, 19 Dec 2016 19:37:56 +0000 (UTC) (envelope-from lifanov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJJbt76036100; Mon, 19 Dec 2016 19:37:55 GMT (envelope-from lifanov@FreeBSD.org) Received: (from lifanov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJJbtMt036099; Mon, 19 Dec 2016 19:37:55 GMT (envelope-from lifanov@FreeBSD.org) Message-Id: <201612191937.uBJJbtMt036099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lifanov set sender to lifanov@FreeBSD.org using -f From: Nikolai Lifanov Date: Mon, 19 Dec 2016 19:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310287 - stable/11 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:37:56 -0000 Author: lifanov (ports committer) Date: Mon Dec 19 19:37:55 2016 New Revision: 310287 URL: https://svnweb.freebsd.org/changeset/base/310287 Log: MFC r310160 retain cc.4.gz man page for Chelsio T6 NICs This man page was removed in r225583 when cc.4 was renamed to mod_cc.4 With reintroduction of cc.4 "make installworld; make delete-old" was no longer convergent. Reviewed by: matthew Approved by: jhb (implicit), matthew (mentor) Differential Revision: https://reviews.freebsd.org/D8828 Modified: stable/11/ObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Mon Dec 19 19:21:28 2016 (r310286) +++ stable/11/ObsoleteFiles.inc Mon Dec 19 19:37:55 2016 (r310287) @@ -2777,7 +2777,6 @@ OLD_FILES+=usr/lib32/libftpio_p.a OLD_FILES+=usr/include/ftpio.h OLD_FILES+=usr/share/man/man3/ftpio.3.gz # 20110915: rename congestion control manpages -OLD_FILES+=usr/share/man/man4/cc.4.gz OLD_FILES+=usr/share/man/man9/cc.9.gz # 20110831: atomic page flags operations OLD_FILES+=usr/share/man/man9/vm_page_flag.9.gz From owner-svn-src-stable-11@freebsd.org Mon Dec 19 22:15:30 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD9DBC88237; Mon, 19 Dec 2016 22:15:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97A8E13C1; Mon, 19 Dec 2016 22:15:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJMFTvq001085; Mon, 19 Dec 2016 22:15:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJMFTbY001084; Mon, 19 Dec 2016 22:15:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201612192215.uBJMFTbY001084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 19 Dec 2016 22:15:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310301 - stable/11/sys/fs/nfsserver X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 22:15:30 -0000 Author: rmacklem Date: Mon Dec 19 22:15:29 2016 New Revision: 310301 URL: https://svnweb.freebsd.org/changeset/base/310301 Log: MFC: r309566 Fix the NFSv4.1 server for Open reclaim after a reboot. The NFSv4.1 server failed to update the nfs-stablerestart file for a client when the client was issued its first Open. As such, recovery of Opens after a server reboot failed with NFSERR_NOGRACE. This patch fixes this. It also changes the code so that it malloc()'s the 1024 byte array instead of allocating it on the kernel stack for both NFSv4.0 and NFSv4.1. Note that this bug only affected NFSv4.1 and only when clients attempted to reclaim Opens after a server reboot. Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Mon Dec 19 21:51:13 2016 (r310300) +++ stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Mon Dec 19 22:15:29 2016 (r310301) @@ -2501,6 +2501,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd struct nfsclient *clp; int error = 0, haslock = 0, ret, delegate = 1, writedeleg = 1; int readonly = 0, cbret = 1, getfhret = 0; + int gotstate = 0, len = 0; + u_char *clidp = NULL; if ((new_stp->ls_flags & NFSLCK_SHAREBITS) == NFSLCK_READACCESS) readonly = 1; @@ -2519,6 +2521,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd goto out; } + clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK); tryagain: MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile), M_NFSDLOCKFILE, M_WAITOK); @@ -3181,6 +3184,16 @@ tryagain: nfsrv_openpluslock++; nfsrv_delegatecnt++; } + /* + * Since NFSv4.1 never does an OpenConfirm, the first + * open state will be acquired here. + */ + if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) { + clp->lc_flags |= LCL_STAMPEDSTABLE; + len = clp->lc_idlen; + NFSBCOPY(clp->lc_id, clidp, len); + gotstate = 1; + } } else { *rflagsp |= NFSV4OPEN_RESULTCONFIRM; new_stp->ls_flags = NFSLCK_NEEDSCONFIRM; @@ -3217,7 +3230,17 @@ tryagain: if (new_deleg) FREE((caddr_t)new_deleg, M_NFSDSTATE); + /* + * If the NFSv4.1 client just acquired its first open, write a timestamp + * to the stable storage file. + */ + if (gotstate != 0) { + nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p); + nfsrv_backupstable(); + } + out: + free(clidp, M_TEMP); NFSEXITCODE2(error, nd); return (error); } @@ -3234,7 +3257,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss struct nfslockfile *lfp; u_int32_t bits; int error = 0, gotstate = 0, len = 0; - u_char client[NFSV4_OPAQUELIMIT]; + u_char *clidp = NULL; /* * Check for restart conditions (client and server). @@ -3244,6 +3267,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss if (error) goto out; + clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK); NFSLOCKSTATE(); /* * Get the open structure via clientid and stateid. @@ -3322,7 +3346,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) { clp->lc_flags |= LCL_STAMPEDSTABLE; len = clp->lc_idlen; - NFSBCOPY(clp->lc_id, client, len); + NFSBCOPY(clp->lc_id, clidp, len); gotstate = 1; } NFSUNLOCKSTATE(); @@ -3369,11 +3393,12 @@ nfsrv_openupdate(vnode_t vp, struct nfss * to the stable storage file. */ if (gotstate != 0) { - nfsrv_writestable(client, len, NFSNST_NEWSTATE, p); + nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p); nfsrv_backupstable(); } out: + free(clidp, M_TEMP); NFSEXITCODE2(error, nd); return (error); } From owner-svn-src-stable-11@freebsd.org Tue Dec 20 07:42:16 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2191C89AD2; Tue, 20 Dec 2016 07:42:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C14A8122D; Tue, 20 Dec 2016 07:42:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK7gFgT039480; Tue, 20 Dec 2016 07:42:15 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK7gF64039478; Tue, 20 Dec 2016 07:42:15 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201612200742.uBK7gF64039478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 20 Dec 2016 07:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310319 - stable/11/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 07:42:17 -0000 Author: ed Date: Tue Dec 20 07:42:15 2016 New Revision: 310319 URL: https://svnweb.freebsd.org/changeset/base/310319 Log: MFC r309650: Properly sign extend the result of jrand48() and mrand48(). These functions are supposed to return a value between [-2^31, 2^31). This doesn't seem to work on 64-bit systems, where we return a value between [0, 3^32). Patch up the function to use proper casts to int32_t. While there, fix some other style bugs. Modified: stable/11/lib/libc/gen/jrand48.c stable/11/lib/libc/gen/mrand48.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/jrand48.c ============================================================================== --- stable/11/lib/libc/gen/jrand48.c Tue Dec 20 07:34:44 2016 (r310318) +++ stable/11/lib/libc/gen/jrand48.c Tue Dec 20 07:42:15 2016 (r310319) @@ -14,11 +14,14 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" long jrand48(unsigned short xseed[3]) { + _dorand48(xseed); - return ((long) xseed[2] << 16) + (long) xseed[1]; + return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1])); } Modified: stable/11/lib/libc/gen/mrand48.c ============================================================================== --- stable/11/lib/libc/gen/mrand48.c Tue Dec 20 07:34:44 2016 (r310318) +++ stable/11/lib/libc/gen/mrand48.c Tue Dec 20 07:42:15 2016 (r310319) @@ -14,6 +14,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" extern unsigned short _rand48_seed[3]; @@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3]; long mrand48(void) { + _dorand48(_rand48_seed); - return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1]; + return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) | + (uint32_t)_rand48_seed[1])); } From owner-svn-src-stable-11@freebsd.org Tue Dec 20 16:37:47 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58517C89A00; Tue, 20 Dec 2016 16:37:47 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DC36981; Tue, 20 Dec 2016 16:37:46 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKGbkxH054342; Tue, 20 Dec 2016 16:37:46 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKGbjaB054339; Tue, 20 Dec 2016 16:37:46 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201612201637.uBKGbjaB054339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Tue, 20 Dec 2016 16:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310328 - in stable/11/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 16:37:47 -0000 Author: gnn Date: Tue Dec 20 16:37:45 2016 New Revision: 310328 URL: https://svnweb.freebsd.org/changeset/base/310328 Log: MFC: 309069 Add tunable to disable destructive dtrace Submitted by: Joerg Pernfuss Reviewed by: rstone, markj Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c stable/11/sys/cddl/dev/dtrace/dtrace_load.c stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 15:45:53 2016 (r310327) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 16:37:45 2016 (r310328) @@ -157,6 +157,10 @@ * /etc/system. */ int dtrace_destructive_disallow = 0; +#ifndef illumos +/* Positive logic version of dtrace_destructive_disallow for loader tunable */ +int dtrace_allow_destructive = 1; +#endif dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); size_t dtrace_difo_maxsize = (256 * 1024); dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024); Modified: stable/11/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 20 15:45:53 2016 (r310327) +++ stable/11/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 20 16:37:45 2016 (r310328) @@ -52,6 +52,17 @@ dtrace_load(void *dummy) int i; #endif +#ifndef illumos + /* + * DTrace uses negative logic for the destructive mode switch, so it + * is required to translate from the sysctl which uses positive logic. + */ + if (dtrace_allow_destructive) + dtrace_destructive_disallow = 0; + else + dtrace_destructive_disallow = 1; +#endif + /* Hook into the trap handler. */ dtrace_trap_func = dtrace_trap; Modified: stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Dec 20 15:45:53 2016 (r310327) +++ stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Dec 20 16:37:45 2016 (r310328) @@ -92,3 +92,6 @@ SYSCTL_QUAD(_kern_dtrace, OID_AUTO, dof_ SYSCTL_QUAD(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, &dtrace_helper_actions_max, 0, "maximum number of allowed helper actions"); + +SYSCTL_INT(_security_bsd, OID_AUTO, allow_destructive_dtrace, CTLFLAG_RDTUN, + &dtrace_allow_destructive, 1, "Allow destructive mode DTrace scripts"); From owner-svn-src-stable-11@freebsd.org Tue Dec 20 19:30:22 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDF90C892FF; Tue, 20 Dec 2016 19:30:22 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85F71FB1; Tue, 20 Dec 2016 19:30:22 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKJULEH026351; Tue, 20 Dec 2016 19:30:21 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKJULsD026350; Tue, 20 Dec 2016 19:30:21 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201612201930.uBKJULsD026350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Tue, 20 Dec 2016 19:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310335 - stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 19:30:22 -0000 Author: gnn Date: Tue Dec 20 19:30:21 2016 New Revision: 310335 URL: https://svnweb.freebsd.org/changeset/base/310335 Log: MFC: 309669 Fix a kernel panic in DTrace's rw_iswriter subroutine. On FreeBSD the sense of rw_write_held() and rw_iswriter() were reversed, probably due to a cut and paste error. Using rw_iswriter() would cause the kernel to panic. Reviewed by: markj Sponsored by: DARPA, AFRL Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 18:47:02 2016 (r310334) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 19:30:21 2016 (r310335) @@ -4274,8 +4274,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, break; } l.lx = dtrace_loadptr(tupregs[0].dttk_value); - LOCK_CLASS(l.li)->lc_owner(l.li, &lowner); - regs[rd] = (lowner == curthread); + regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) && + lowner != NULL; break; case DIF_SUBR_RW_ISWRITER: @@ -4286,8 +4286,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, break; } l.lx = dtrace_loadptr(tupregs[0].dttk_value); - regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) && - lowner != NULL; + LOCK_CLASS(l.li)->lc_owner(l.li, &lowner); + regs[rd] = (lowner == curthread); break; #endif /* illumos */ From owner-svn-src-stable-11@freebsd.org Wed Dec 21 09:15:27 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BBBFC8A6A5; Wed, 21 Dec 2016 09:15:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF1A71AF9; Wed, 21 Dec 2016 09:15:26 +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 uBL9FQ88061724; Wed, 21 Dec 2016 09:15:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9FQkR061723; Wed, 21 Dec 2016 09:15:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612210915.uBL9FQkR061723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 09:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310357 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:15:27 -0000 Author: kib Date: Wed Dec 21 09:15:25 2016 New Revision: 310357 URL: https://svnweb.freebsd.org/changeset/base/310357 Log: MFC r310097: Remove locking around accounting initialization of the default object. Modified: stable/11/sys/vm/default_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/default_pager.c ============================================================================== --- stable/11/sys/vm/default_pager.c Wed Dec 21 09:05:30 2016 (r310356) +++ stable/11/sys/vm/default_pager.c Wed Dec 21 09:15:25 2016 (r310357) @@ -91,10 +91,8 @@ default_pager_alloc(void *handle, vm_oof object = vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(round_page(offset + size))); if (cred != NULL) { - VM_OBJECT_WLOCK(object); object->cred = cred; object->charge = size; - VM_OBJECT_WUNLOCK(object); } return (object); } From owner-svn-src-stable-11@freebsd.org Wed Dec 21 09:18:54 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6892EC8A72E; Wed, 21 Dec 2016 09:18:54 +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 2D0641CA1; Wed, 21 Dec 2016 09:18:54 +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 uBL9Ir8Y061890; Wed, 21 Dec 2016 09:18:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9IrCm061889; Wed, 21 Dec 2016 09:18:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612210918.uBL9IrCm061889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 09:18:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310358 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:18:54 -0000 Author: kib Date: Wed Dec 21 09:18:53 2016 New Revision: 310358 URL: https://svnweb.freebsd.org/changeset/base/310358 Log: MFC r310098: Provide introductory description of the default pager. Modified: stable/11/sys/vm/default_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/default_pager.c ============================================================================== --- stable/11/sys/vm/default_pager.c Wed Dec 21 09:15:25 2016 (r310357) +++ stable/11/sys/vm/default_pager.c Wed Dec 21 09:18:53 2016 (r310358) @@ -63,6 +63,16 @@ static boolean_t default_pager_haspage(v int *); /* * pagerops for OBJT_DEFAULT - "default pager". + * + * This pager handles anonymous (no handle) swap-backed memory, just + * like the swap pager. It allows several optimizations based on the + * fact that no pages of a default object can be swapped out. The + * most important optimization is in vm_fault(), where the pager is + * never asked for a non-resident page. Instead, a freshly allocated + * zeroed page is used. + * + * On the first request to page out a page from a default object, the + * object is converted to swap pager type. */ struct pagerops defaultpagerops = { .pgo_alloc = default_pager_alloc, From owner-svn-src-stable-11@freebsd.org Wed Dec 21 09:22:07 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52A1BC8A938; Wed, 21 Dec 2016 09:22:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21F1110F1; Wed, 21 Dec 2016 09:22:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL9M6vC065683; Wed, 21 Dec 2016 09:22:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9M6BB065682; Wed, 21 Dec 2016 09:22:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612210922.uBL9M6BB065682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 09:22:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310359 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:22:07 -0000 Author: kib Date: Wed Dec 21 09:22:06 2016 New Revision: 310359 URL: https://svnweb.freebsd.org/changeset/base/310359 Log: MFC r310205: Fix typo. Remove spurious blank line. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Wed Dec 21 09:18:53 2016 (r310358) +++ stable/11/sys/amd64/amd64/trap.c Wed Dec 21 09:22:06 2016 (r310359) @@ -914,7 +914,7 @@ amd64_syscall(struct thread *td, int tra } KASSERT(PCB_USER_FPU(td->td_pcb), - ("System call %s returing with kernel FPU ctx leaked", + ("System call %s returning with kernel FPU ctx leaked", syscallname(td->td_proc, sa.code))); KASSERT(td->td_pcb->pcb_save == get_pcb_user_save_td(td), ("System call %s returning with mangled pcb_save", @@ -923,7 +923,6 @@ amd64_syscall(struct thread *td, int tra ("System call %s returning with leaked invl_gen %lu", syscallname(td->td_proc, sa.code), td->td_md.md_invl_gen.gen)); - syscallret(td, error, &sa); /* From owner-svn-src-stable-11@freebsd.org Wed Dec 21 15:38:29 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46A26C8A2E2; Wed, 21 Dec 2016 15:38:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15CF1127E; Wed, 21 Dec 2016 15:38:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLFcSJF020405; Wed, 21 Dec 2016 15:38:28 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLFcSNc020404; Wed, 21 Dec 2016 15:38:28 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612211538.uBLFcSNc020404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 21 Dec 2016 15:38:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310368 - stable/11/contrib/binutils/bfd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 15:38:29 -0000 Author: pfg Date: Wed Dec 21 15:38:28 2016 New Revision: 310368 URL: https://svnweb.freebsd.org/changeset/base/310368 Log: MFC r310132: libbfd: make sure variables are initialized before using them. Initialize l_sec_contents to make sure that free(l_sec_contents) is called on valid pointers. Obtained from: OpenBSD (partial CVS rev 1.18) Modified: stable/11/contrib/binutils/bfd/elflink.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/11/contrib/binutils/bfd/elflink.c Wed Dec 21 15:26:59 2016 (r310367) +++ stable/11/contrib/binutils/bfd/elflink.c Wed Dec 21 15:38:28 2016 (r310368) @@ -11487,7 +11487,7 @@ _bfd_elf_section_already_linked (bfd *ab abfd, sec); else if (sec->size != 0) { - bfd_byte *sec_contents, *l_sec_contents; + bfd_byte *sec_contents, *l_sec_contents = NULL; if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents)) (*_bfd_error_handler) From owner-svn-src-stable-11@freebsd.org Wed Dec 21 18:42:07 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E574C8AE9B; Wed, 21 Dec 2016 18:42:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CABD17AB; Wed, 21 Dec 2016 18:42:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLIg6C1096870; Wed, 21 Dec 2016 18:42:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLIg5Me096244; Wed, 21 Dec 2016 18:42:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612211842.uBLIg5Me096244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Dec 2016 18:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310372 - in stable/11: lib/libmd sys/crypto/sha2 sys/crypto/skein sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 18:42:07 -0000 Author: emaste Date: Wed Dec 21 18:42:04 2016 New Revision: 310372 URL: https://svnweb.freebsd.org/changeset/base/310372 Log: MFC r307521: libmd: introduce functions that operate on fd instead of filename Modified: stable/11/lib/libmd/md4.h stable/11/lib/libmd/md5.h stable/11/lib/libmd/mdXhl.c stable/11/lib/libmd/ripemd.h stable/11/lib/libmd/sha.h stable/11/sys/crypto/sha2/sha256.h stable/11/sys/crypto/sha2/sha384.h stable/11/sys/crypto/sha2/sha512.h stable/11/sys/crypto/sha2/sha512t.h stable/11/sys/crypto/skein/skein_freebsd.h stable/11/sys/crypto/skein/skein_port.h stable/11/sys/sys/md5.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libmd/md4.h ============================================================================== --- stable/11/lib/libmd/md4.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/md4.h Wed Dec 21 18:42:04 2016 (r310372) @@ -53,6 +53,12 @@ __BEGIN_DECLS #ifndef MD4End #define MD4End _libmd_MD4End #endif +#ifndef MD4Fd +#define MD4Fd _libmd_MD4Fd +#endif +#ifndef MD4FdChunk +#define MD4FdChunk _libmd_MD4FdChunk +#endif #ifndef MD4File #define MD4File _libmd_MD4File #endif @@ -68,6 +74,8 @@ void MD4Update(MD4_CTX *, const void * void MD4Pad(MD4_CTX *); void MD4Final(unsigned char [16], MD4_CTX *); char * MD4End(MD4_CTX *, char *); +char * MD4Fd(int, char *); +char * MD4FdChunk(int, char *, off_t, off_t); char * MD4File(const char *, char *); char * MD4FileChunk(const char *, char *, off_t, off_t); char * MD4Data(const void *, unsigned int, char *); Modified: stable/11/lib/libmd/md5.h ============================================================================== --- stable/11/lib/libmd/md5.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/md5.h Wed Dec 21 18:42:04 2016 (r310372) @@ -25,6 +25,12 @@ #ifndef MD5End #define MD5End _libmd_MD5End #endif +#ifndef MD5Fd +#define MD5Fd _libmd_MD5Fd +#endif +#ifndef MD5FdChunk +#define MD5FdChunk _libmd_MD5FdChunk +#endif #ifndef MD5File #define MD5File _libmd_MD5File #endif Modified: stable/11/lib/libmd/mdXhl.c ============================================================================== --- stable/11/lib/libmd/mdXhl.c Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/mdXhl.c Wed Dec 21 18:42:04 2016 (r310372) @@ -42,18 +42,18 @@ MDXEnd(MDX_CTX *ctx, char *buf) } char * -MDXFile(const char *filename, char *buf) +MDXFd(int fd, char *buf) { - return (MDXFileChunk(filename, buf, 0, 0)); + return MDXFdChunk(fd, buf, 0, 0); } char * -MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +MDXFdChunk(int fd, char *buf, off_t ofs, off_t len) { unsigned char buffer[16*1024]; MDX_CTX ctx; struct stat stbuf; - int fd, readrv, e; + int readrv, e; off_t remain; if (len < 0) { @@ -62,9 +62,6 @@ MDXFileChunk(const char *filename, char } MDXInit(&ctx); - fd = open(filename, O_RDONLY); - if (fd < 0) - return NULL; if (ofs != 0) { errno = 0; if (lseek(fd, ofs, SEEK_SET) != ofs || @@ -86,15 +83,34 @@ MDXFileChunk(const char *filename, char remain -= readrv; } error: - e = errno; - close(fd); - errno = e; if (readrv < 0) return NULL; return (MDXEnd(&ctx, buf)); } char * +MDXFile(const char *filename, char *buf) +{ + return (MDXFileChunk(filename, buf, 0, 0)); +} + +char * +MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +{ + char *ret; + int e, fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) + return NULL; + ret = MDXFdChunk(fd, buf, ofs, len); + e = errno; + close (fd); + errno = e; + return ret; +} + +char * MDXData (const void *data, unsigned int len, char *buf) { MDX_CTX ctx; Modified: stable/11/lib/libmd/ripemd.h ============================================================================== --- stable/11/lib/libmd/ripemd.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/ripemd.h Wed Dec 21 18:42:04 2016 (r310372) @@ -96,6 +96,12 @@ __BEGIN_DECLS #ifndef RIPEMD160_End #define RIPEMD160_End _libmd_RIPEMD160_End #endif +#ifndef RIPEMD160_Fd +#define RIPEMD160_Fd _libmd_RIPEMD160_Fd +#endif +#ifndef RIPEMD160_FdChunk +#define RIPEMD160_FdChunk _libmd_RIPEMD160_FdChunk +#endif #ifndef RIPEMD160_File #define RIPEMD160_File _libmd_RIPEMD160_File #endif @@ -121,6 +127,8 @@ void RIPEMD160_Update(RIPEMD160_CTX *c, size_t len); void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); char *RIPEMD160_End(RIPEMD160_CTX *, char *); +char *RIPEMD160_Fd(int, char *); +char *RIPEMD160_FdChunk(int, char *, off_t, off_t); char *RIPEMD160_File(const char *, char *); char *RIPEMD160_FileChunk(const char *, char *, off_t, off_t); char *RIPEMD160_Data(const void *, unsigned int, char *); Modified: stable/11/lib/libmd/sha.h ============================================================================== --- stable/11/lib/libmd/sha.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/sha.h Wed Dec 21 18:42:04 2016 (r310372) @@ -94,6 +94,12 @@ __BEGIN_DECLS #ifndef SHA_End #define SHA_End _libmd_SHA_End #endif +#ifndef SHA_Fd +#define SHA_Fd _libmd_SHA_Fd +#endif +#ifndef SHA_FdChunk +#define SHA_FdChunk _libmd_SHA_FdChunk +#endif #ifndef SHA_File #define SHA_File _libmd_SHA_File #endif @@ -126,6 +132,12 @@ __BEGIN_DECLS #ifndef SHA1_End #define SHA1_End _libmd_SHA1_End #endif +#ifndef SHA1_Fd +#define SHA1_Fd _libmd_SHA1_Fd +#endif +#ifndef SHA1_FdChunk +#define SHA1_FdChunk _libmd_SHA1_FdChunk +#endif #ifndef SHA1_File #define SHA1_File _libmd_SHA1_File #endif @@ -150,6 +162,8 @@ void SHA_Init(SHA_CTX *c); void SHA_Update(SHA_CTX *c, const void *data, size_t len); void SHA_Final(unsigned char *md, SHA_CTX *c); char *SHA_End(SHA_CTX *, char *); +char *SHA_Fd(int, char *); +char *SHA_FdChunk(int, char *, off_t, off_t); char *SHA_File(const char *, char *); char *SHA_FileChunk(const char *, char *, off_t, off_t); char *SHA_Data(const void *, unsigned int, char *); @@ -158,6 +172,8 @@ void SHA1_Init(SHA_CTX *c); void SHA1_Update(SHA_CTX *c, const void *data, size_t len); void SHA1_Final(unsigned char *md, SHA_CTX *c); char *SHA1_End(SHA_CTX *, char *); +char *SHA1_Fd(int, char *); +char *SHA1_FdChunk(int, char *, off_t, off_t); char *SHA1_File(const char *, char *); char *SHA1_FileChunk(const char *, char *, off_t, off_t); char *SHA1_Data(const void *, unsigned int, char *); Modified: stable/11/sys/crypto/sha2/sha256.h ============================================================================== --- stable/11/sys/crypto/sha2/sha256.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha256.h Wed Dec 21 18:42:04 2016 (r310372) @@ -59,6 +59,12 @@ __BEGIN_DECLS #ifndef SHA256_End #define SHA256_End _libmd_SHA256_End #endif +#ifndef SHA256_Fd +#define SHA256_Fd _libmd_SHA256_Fd +#endif +#ifndef SHA256_FdChunk +#define SHA256_FdChunk _libmd_SHA256_FdChunk +#endif #ifndef SHA256_File #define SHA256_File _libmd_SHA256_File #endif @@ -83,6 +89,8 @@ void SHA256_Final(unsigned char [__min_s #ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); +char *SHA256_Fd(int, char *); +char *SHA256_FdChunk(int, char *, off_t, off_t); char *SHA256_File(const char *, char *); char *SHA256_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/sha2/sha384.h ============================================================================== --- stable/11/sys/crypto/sha2/sha384.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha384.h Wed Dec 21 18:42:04 2016 (r310372) @@ -58,6 +58,12 @@ __BEGIN_DECLS #ifndef SHA384_End #define SHA384_End _libmd_SHA384_End #endif +#ifndef SHA384_Fd +#define SHA384_Fd _libmd_SHA384_Fd +#endif +#ifndef SHA384_FdChunk +#define SHA384_FdChunk _libmd_SHA384_FdChunk +#endif #ifndef SHA384_File #define SHA384_File _libmd_SHA384_File #endif @@ -79,6 +85,8 @@ void SHA384_Final(unsigned char [__min_s #ifndef _KERNEL char *SHA384_End(SHA384_CTX *, char *); char *SHA384_Data(const void *, unsigned int, char *); +char *SHA384_Fd(int, char *); +char *SHA384_FdChunk(int, char *, off_t, off_t); char *SHA384_File(const char *, char *); char *SHA384_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/sha2/sha512.h ============================================================================== --- stable/11/sys/crypto/sha2/sha512.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha512.h Wed Dec 21 18:42:04 2016 (r310372) @@ -58,6 +58,12 @@ __BEGIN_DECLS #ifndef SHA512_End #define SHA512_End _libmd_SHA512_End #endif +#ifndef SHA512_Fd +#define SHA512_Fd _libmd_SHA512_Fd +#endif +#ifndef SHA512_FdChunk +#define SHA512_FdChunk _libmd_SHA512_FdChunk +#endif #ifndef SHA512_File #define SHA512_File _libmd_SHA512_File #endif @@ -82,6 +88,8 @@ void SHA512_Final(unsigned char [__min_s #ifndef _KERNEL char *SHA512_End(SHA512_CTX *, char *); char *SHA512_Data(const void *, unsigned int, char *); +char *SHA512_Fd(int, char *); +char *SHA512_FdChunk(int, char *, off_t, off_t); char *SHA512_File(const char *, char *); char *SHA512_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/sha2/sha512t.h ============================================================================== --- stable/11/sys/crypto/sha2/sha512t.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha512t.h Wed Dec 21 18:42:04 2016 (r310372) @@ -55,6 +55,12 @@ __BEGIN_DECLS #ifndef SHA512_224_End #define SHA512_224_End _libmd_SHA512_224_End #endif +#ifndef SHA512_224_Fd +#define SHA512_224_Fd _libmd_SHA512_224_Fd +#endif +#ifndef SHA512_224_FdChunk +#define SHA512_224_FdChunk _libmd_SHA512_224_FdChunk +#endif #ifndef SHA512_224_File #define SHA512_224_File _libmd_SHA512_224_File #endif @@ -84,6 +90,12 @@ __BEGIN_DECLS #ifndef SHA512_256_End #define SHA512_256_End _libmd_SHA512_256_End #endif +#ifndef SHA512_256_Fd +#define SHA512_256_Fd _libmd_SHA512_256_Fd +#endif +#ifndef SHA512_256_FdChunk +#define SHA512_256_FdChunk _libmd_SHA512_256_FdChunk +#endif #ifndef SHA512_256_File #define SHA512_256_File _libmd_SHA512_256_File #endif @@ -108,6 +120,8 @@ void SHA512_224_Final(unsigned char [__m #ifndef _KERNEL char *SHA512_224_End(SHA512_CTX *, char *); char *SHA512_224_Data(const void *, unsigned int, char *); +char *SHA512_224_Fd(int, char *); +char *SHA512_224_FdChunk(int, char *, off_t, off_t); char *SHA512_224_File(const char *, char *); char *SHA512_224_FileChunk(const char *, char *, off_t, off_t); #endif @@ -118,6 +132,8 @@ void SHA512_256_Final(unsigned char [__m #ifndef _KERNEL char *SHA512_256_End(SHA512_CTX *, char *); char *SHA512_256_Data(const void *, unsigned int, char *); +char *SHA512_256_Fd(int, char *); +char *SHA512_256_FdChunk(int, char *, off_t, off_t); char *SHA512_256_File(const char *, char *); char *SHA512_256_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/skein/skein_freebsd.h ============================================================================== --- stable/11/sys/crypto/skein/skein_freebsd.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/skein/skein_freebsd.h Wed Dec 21 18:42:04 2016 (r310372) @@ -71,6 +71,12 @@ char *SKEIN1024_End(SKEIN1024_CTX *, c char *SKEIN256_Data(const void *, unsigned int, char *); char *SKEIN512_Data(const void *, unsigned int, char *); char *SKEIN1024_Data(const void *, unsigned int, char *); +char *SKEIN256_Fd(int, char *); +char *SKEIN512_Fd(int, char *); +char *SKEIN1024_Fd(int, char *); +char *SKEIN256_FdChunk(int, char *, off_t, off_t); +char *SKEIN512_FdChunk(int, char *, off_t, off_t); +char *SKEIN1024_FdChunk(int, char *, off_t, off_t); char *SKEIN256_File(const char *, char *); char *SKEIN512_File(const char *, char *); char *SKEIN1024_File(const char *, char *); Modified: stable/11/sys/crypto/skein/skein_port.h ============================================================================== --- stable/11/sys/crypto/skein/skein_port.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/skein/skein_port.h Wed Dec 21 18:42:04 2016 (r310372) @@ -137,6 +137,16 @@ void Skein_Get64_LSB_First(u64b_t *ds #define SKEIN512_End _libmd_SKEIN512_End #define SKEIN1024_End _libmd_SKEIN1024_End #endif +#ifndef SKEIN256_Fd +#define SKEIN256_Fd _libmd_SKEIN256_Fd +#define SKEIN512_Fd _libmd_SKEIN512_Fd +#define SKEIN1024_Fd _libmd_SKEIN1024_Fd +#endif +#ifndef SKEIN256_FdChunk +#define SKEIN256_FdChunk _libmd_SKEIN256_FdChunk +#define SKEIN512_FdChunk _libmd_SKEIN512_FdChunk +#define SKEIN1024_FdChunk _libmd_SKEIN1024_FdChunk +#endif #ifndef SKEIN256_File #define SKEIN256_File _libmd_SKEIN256_File #define SKEIN512_File _libmd_SKEIN512_File Modified: stable/11/sys/sys/md5.h ============================================================================== --- stable/11/sys/sys/md5.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/sys/md5.h Wed Dec 21 18:42:04 2016 (r310372) @@ -47,6 +47,8 @@ void MD5Update (MD5_CTX *, const void void MD5Final (unsigned char[__min_size(MD5_DIGEST_LENGTH)], MD5_CTX *); #ifndef _KERNEL char * MD5End(MD5_CTX *, char *); +char * MD5Fd(int, char *); +char * MD5FdChunk(int, char *, off_t, off_t); char * MD5File(const char *, char *); char * MD5FileChunk(const char *, char *, off_t, off_t); char * MD5Data(const void *, unsigned int, char *); From owner-svn-src-stable-11@freebsd.org Wed Dec 21 22:04:46 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C081C8A3A1; Wed, 21 Dec 2016 22:04:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B2531D8F; Wed, 21 Dec 2016 22:04:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLM4jWD080770; Wed, 21 Dec 2016 22:04:45 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLM4jnG080768; Wed, 21 Dec 2016 22:04:45 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201612212204.uBLM4jnG080768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Dec 2016 22:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310374 - stable/11/sbin/mount X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:04:46 -0000 Author: brooks Date: Wed Dec 21 22:04:44 2016 New Revision: 310374 URL: https://svnweb.freebsd.org/changeset/base/310374 Log: MFC r310092: Add a free_iovec() function to reset iovec's. The primary purpose is to call nmount() in a loop with new iovec's so free_iovec takes arguments by reference and resets their values. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Modified: stable/11/sbin/mount/getmntopts.c stable/11/sbin/mount/mntopts.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount/getmntopts.c ============================================================================== --- stable/11/sbin/mount/getmntopts.c Wed Dec 21 20:19:12 2016 (r310373) +++ stable/11/sbin/mount/getmntopts.c Wed Dec 21 22:04:44 2016 (r310374) @@ -181,3 +181,17 @@ build_iovec_argf(struct iovec **iov, int va_end(ap); build_iovec(iov, iovlen, name, strdup(val), (size_t)-1); } + +/* + * Free the iovec and reset to NULL with zero length. Useful for calling + * nmount in a loop. + */ +void +free_iovec(struct iovec **iov, int *iovlen) +{ + int i; + + for (i = 0; i < *iovlen; i++) + free((*iov)[i].iov_base); + free(*iov); +} Modified: stable/11/sbin/mount/mntopts.h ============================================================================== --- stable/11/sbin/mount/mntopts.h Wed Dec 21 20:19:12 2016 (r310373) +++ stable/11/sbin/mount/mntopts.h Wed Dec 21 22:04:44 2016 (r310374) @@ -99,3 +99,4 @@ int checkpath(const char *, char resolve extern int getmnt_silent; void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len); void build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...); +void free_iovec(struct iovec **iovec, int *iovlen); From owner-svn-src-stable-11@freebsd.org Wed Dec 21 22:53:11 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D93FC8B251; Wed, 21 Dec 2016 22:53:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5805A18F9; Wed, 21 Dec 2016 22:53:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLMrAxT001008; Wed, 21 Dec 2016 22:53:10 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLMrAs3001006; Wed, 21 Dec 2016 22:53:10 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201612212253.uBLMrAs3001006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Dec 2016 22:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310377 - stable/11/bin/df X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:53:11 -0000 Author: brooks Date: Wed Dec 21 22:53:10 2016 New Revision: 310377 URL: https://svnweb.freebsd.org/changeset/base/310377 Log: MFC r310088, r310090, r310095 r310088: Put the undocumented df feature of mounting filesystems from device nodes under an ifdef. Leave enabled. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 r310090: Mount filesystems without executable permissions since they should never be used. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 r310095: Use nmount(2) rather than the obsolete mount(2). Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Modified: stable/11/bin/df/Makefile stable/11/bin/df/df.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/df/Makefile ============================================================================== --- stable/11/bin/df/Makefile Wed Dec 21 22:47:10 2016 (r310376) +++ stable/11/bin/df/Makefile Wed Dec 21 22:53:10 2016 (r310377) @@ -10,6 +10,9 @@ SRCS= df.c vfslist.c CFLAGS+= -I${MOUNT} +CFLAGS+= -DMOUNT_CHAR_DEVS +SRCS+= getmntopts.c + LIBADD= xo util .include Modified: stable/11/bin/df/df.c ============================================================================== --- stable/11/bin/df/df.c Wed Dec 21 22:47:10 2016 (r310376) +++ stable/11/bin/df/df.c Wed Dec 21 22:53:10 2016 (r310377) @@ -50,10 +50,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef MOUNT_CHAR_DEVS #include +#endif #include #include #include +#ifdef MOUNT_CHAR_DEVS +#include +#endif #include #include #include @@ -98,7 +103,9 @@ imax(int a, int b) static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag; static int thousands; +#ifdef MOUNT_CHAR_DEVS static struct ufs_args mdev; +#endif int main(int argc, char *argv[]) @@ -107,11 +114,21 @@ main(int argc, char *argv[]) struct statfs statfsbuf, totalbuf; struct maxwidths maxwidths; struct statfs *mntbuf; +#ifdef MOUNT_CHAR_DEVS + struct iovec *iov = NULL; +#endif const char *fstype; - char *mntpath, *mntpt; +#ifdef MOUNT_CHAR_DEVS + char *mntpath; + char errmsg[255] = {0}; +#endif + char *mntpt; const char **vfslist; int i, mntsize; int ch, rv; +#ifdef MOUNT_CHAR_DEVS + int iovlen = 0; +#endif fstype = "ufs"; (void)setlocale(LC_ALL, ""); @@ -224,6 +241,7 @@ main(int argc, char *argv[]) rv = 1; continue; } +#ifdef MOUNT_CHAR_DEVS } else if (S_ISCHR(stbuf.st_mode)) { if ((mntpt = getmntpt(*argv)) == NULL) { mdev.fspec = *argv; @@ -240,9 +258,23 @@ main(int argc, char *argv[]) free(mntpath); continue; } - if (mount(fstype, mntpt, MNT_RDONLY, - &mdev) != 0) { - xo_warn("%s", *argv); + if (iov != NULL) + free_iovec(&iov, &iovlen); + build_iovec_argf(&iov, &iovlen, "fstype", "%s", + fstype); + build_iovec_argf(&iov, &iovlen, "fspath", "%s", + mntpath); + build_iovec_argf(&iov, &iovlen, "from", "%s", + *argv); + build_iovec(&iov, &iovlen, "errmsg", errmsg, + sizeof(errmsg)); + if (nmount(iov, iovlen, + MNT_RDONLY|MNT_NOEXEC) < 0) { + if (errmsg[0]) + xo_warn("%s: %s", *argv, + errmsg); + else + xo_warn("%s", *argv); rv = 1; (void)rmdir(mntpt); free(mntpath); @@ -261,6 +293,7 @@ main(int argc, char *argv[]) free(mntpath); continue; } +#endif } else mntpt = *argv; From owner-svn-src-stable-11@freebsd.org Thu Dec 22 20:16:12 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03BB1C8C4CA; Thu, 22 Dec 2016 20:16:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6320103D; Thu, 22 Dec 2016 20:16:11 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMKGAhB021074; Thu, 22 Dec 2016 20:16:10 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMKGAGN021068; Thu, 22 Dec 2016 20:16:10 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612222016.uBMKGAGN021068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 22 Dec 2016 20:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310427 - in stable/11/sys/powerpc: conf conf/dpaa mpc85xx X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 20:16:12 -0000 Author: jhibbits Date: Thu Dec 22 20:16:10 2016 New Revision: 310427 URL: https://svnweb.freebsd.org/changeset/base/310427 Log: Partial MFC r303693: Merge MPC85XX and QorIQ config options Only a partial MFC, keeping files.powerpc and options.powerpc intact, to retain compatibility with any kernel configs that may use the QORIQ_DPAA option. Modified: stable/11/sys/powerpc/conf/MPC85XX stable/11/sys/powerpc/conf/dpaa/DPAA stable/11/sys/powerpc/mpc85xx/mpc85xx.c stable/11/sys/powerpc/mpc85xx/mpc85xx.h stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/conf/MPC85XX ============================================================================== --- stable/11/sys/powerpc/conf/MPC85XX Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/conf/MPC85XX Thu Dec 22 20:16:10 2016 (r310427) @@ -10,7 +10,9 @@ ident MPC85XX machine powerpc powerpc +include "dpaa/config.dpaa" makeoptions DEBUG="-Wa,-me500 -g" +makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" makeoptions NO_MODULES=yes options FPU_EMU @@ -21,7 +23,6 @@ options BREAK_TO_DEBUGGER options BOOTP options BOOTP_NFSROOT #options BOOTP_NFSV3 -options BOOTP_WIRED_TO=tsec0 options CD9660 options COMPAT_43 options DDB @@ -29,7 +30,6 @@ options DDB options DEVICE_POLLING #options DIAGNOSTIC options FDT -makeoptions FDT_DTS_FILE=mpc8572ds.dts #makeoptions FDT_DTS_FILE=mpc8555cds.dts options FFS options GDB @@ -69,6 +69,7 @@ device em device alc device ether device fxp +device gpio device iic device iicbus #device isa Modified: stable/11/sys/powerpc/conf/dpaa/DPAA ============================================================================== --- stable/11/sys/powerpc/conf/dpaa/DPAA Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/conf/dpaa/DPAA Thu Dec 22 20:16:10 2016 (r310427) @@ -16,7 +16,7 @@ makeoptions WERROR="-Werror -Wno-format makeoptions NO_MODULES=yes # Platform support -options QORIQ_DPAA #Freescale SoC family +options MPC85XX #Freescale SoC family options SMP #Symmetric Multi Processing Modified: stable/11/sys/powerpc/mpc85xx/mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/mpc85xx.c Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/mpc85xx.c Thu Dec 22 20:16:10 2016 (r310427) @@ -108,13 +108,17 @@ law_getmax(void) static inline void law_write(uint32_t n, uint64_t bar, uint32_t sr) { -#if defined(QORIQ_DPAA) - ccsr_write4(OCP85XX_LAWBARH(n), bar >> 32); - ccsr_write4(OCP85XX_LAWBARL(n), bar); -#else - ccsr_write4(OCP85XX_LAWBAR(n), bar >> 12); -#endif - ccsr_write4(OCP85XX_LAWSR(n), sr); + + if (mpc85xx_is_qoriq()) { + ccsr_write4(OCP85XX_LAWBARH(n), bar >> 32); + ccsr_write4(OCP85XX_LAWBARL(n), bar); + ccsr_write4(OCP85XX_LAWSR_QORIQ(n), sr); + ccsr_read4(OCP85XX_LAWSR_QORIQ(n)); + } else { + ccsr_write4(OCP85XX_LAWBAR(n), bar >> 12); + ccsr_write4(OCP85XX_LAWSR_85XX(n), sr); + ccsr_read4(OCP85XX_LAWSR_85XX(n)); + } /* * The last write to LAWAR should be followed by a read @@ -123,20 +127,21 @@ law_write(uint32_t n, uint64_t bar, uint * instruction. */ - ccsr_read4(OCP85XX_LAWSR(n)); isync(); } static inline void law_read(uint32_t n, uint64_t *bar, uint32_t *sr) { -#if defined(QORIQ_DPAA) - *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBARH(n)) << 32 | - ccsr_read4(OCP85XX_LAWBARL(n)); -#else - *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR(n)) << 12; -#endif - *sr = ccsr_read4(OCP85XX_LAWSR(n)); + + if (mpc85xx_is_qoriq()) { + *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBARH(n)) << 32 | + ccsr_read4(OCP85XX_LAWBARL(n)); + *sr = ccsr_read4(OCP85XX_LAWSR_QORIQ(n)); + } else { + *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR(n)) << 12; + *sr = ccsr_read4(OCP85XX_LAWSR_85XX(n)); + } } static int @@ -306,6 +311,18 @@ mpc85xx_enable_l3_cache(void) } } +int +mpc85xx_is_qoriq(void) +{ + uint16_t pvr = mfpvr() >> 16; + + /* QorIQ register set is only in e500mc and derivative core based SoCs. */ + if (pvr == FSL_E500mc || pvr == FSL_E5500 || pvr == FSL_E6500) + return (1); + + return (0); +} + static void mpc85xx_dataloss_erratum_spr976(void) { @@ -352,9 +369,7 @@ moveon: if (err != 0) return (err); -#ifdef QORIQ_DPAA law_enable(OCP85XX_TGTIF_DCSR, b, 0x400000); -#endif return pmap_early_io_map(b, 0x400000); } Modified: stable/11/sys/powerpc/mpc85xx/mpc85xx.h ============================================================================== --- stable/11/sys/powerpc/mpc85xx/mpc85xx.h Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/mpc85xx.h Thu Dec 22 20:16:10 2016 (r310427) @@ -67,36 +67,44 @@ extern vm_offset_t ccsrbar_va; /* * Local access registers */ -#if defined(QORIQ_DPAA) /* Write order: OCP_LAWBARH -> OCP_LAWBARL -> OCP_LAWSR */ #define OCP85XX_LAWBARH(n) (CCSRBAR_VA + 0xc00 + 0x10 * (n)) #define OCP85XX_LAWBARL(n) (CCSRBAR_VA + 0xc04 + 0x10 * (n)) -#define OCP85XX_LAWSR(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) -#else +#define OCP85XX_LAWSR_QORIQ(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) #define OCP85XX_LAWBAR(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) -#define OCP85XX_LAWSR(n) (CCSRBAR_VA + 0xc10 + 0x10 * (n)) -#endif +#define OCP85XX_LAWSR_85XX(n) (CCSRBAR_VA + 0xc10 + 0x10 * (n)) +#define OCP85XX_LAWSR(n) (mpc85xx_is_qoriq() ? OCP85XX_LAWSR_QORIQ(n) : \ + OCP85XX_LAWSR_85XX(n)) /* Attribute register */ #define OCP85XX_ENA_MASK 0x80000000 #define OCP85XX_DIS_MASK 0x7fffffff -#if defined(QORIQ_DPAA) -#define OCP85XX_TGTIF_LBC 0x1f -#define OCP85XX_TGTIF_RAM_INTL 0x14 -#define OCP85XX_TGTIF_RAM1 0x10 -#define OCP85XX_TGTIF_RAM2 0x11 -#define OCP85XX_TGTIF_BMAN 0x18 -#define OCP85XX_TGTIF_DCSR 0x1D -#define OCP85XX_TGTIF_QMAN 0x3C -#define OCP85XX_TRGT_SHIFT 20 -#else -#define OCP85XX_TGTIF_LBC 0x04 -#define OCP85XX_TGTIF_RAM_INTL 0x0b -#define OCP85XX_TGTIF_RIO 0x0c -#define OCP85XX_TGTIF_RAM1 0x0f -#define OCP85XX_TGTIF_RAM2 0x16 -#endif +#define OCP85XX_TGTIF_LBC_QORIQ 0x1f +#define OCP85XX_TGTIF_RAM_INTL_QORIQ 0x14 +#define OCP85XX_TGTIF_RAM1_QORIQ 0x10 +#define OCP85XX_TGTIF_RAM2_QORIQ 0x11 +#define OCP85XX_TGTIF_BMAN 0x18 +#define OCP85XX_TGTIF_DCSR 0x1D +#define OCP85XX_TGTIF_QMAN 0x3C +#define OCP85XX_TRGT_SHIFT_QORIQ 20 + +#define OCP85XX_TGTIF_LBC_85XX 0x04 +#define OCP85XX_TGTIF_RAM_INTL_85XX 0x0b +#define OCP85XX_TGTIF_RIO_85XX 0x0c +#define OCP85XX_TGTIF_RAM1_85XX 0x0f +#define OCP85XX_TGTIF_RAM2_85XX 0x16 + +#define OCP85XX_TGTIF_LBC \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_LBC_QORIQ : OCP85XX_TGTIF_LBC_85XX) +#define OCP85XX_TGTIF_RAM_INTL \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM_INTL_QORIQ : OCP85XX_TGTIF_RAM_INTL_85XX) +#define OCP85XX_TGTIF_RIO \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RIO_QORIQ : OCP85XX_TGTIF_RIO_85XX) +#define OCP85XX_TGTIF_RAM1 \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM1_QORIQ : OCP85XX_TGTIF_RAM1_85XX) +#define OCP85XX_TGTIF_RAM2 \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM2_QORIQ : OCP85XX_TGTIF_RAM2_85XX) /* * L2 cache registers @@ -153,5 +161,6 @@ int mpc85xx_attach(platform_t); void mpc85xx_enable_l3_cache(void); void mpc85xx_fix_errata(vm_offset_t); void dataloss_erratum_access(vm_offset_t, uint32_t); +int mpc85xx_is_qoriq(void); #endif /* _MPC85XX_H_ */ Modified: stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Dec 22 20:16:10 2016 (r310427) @@ -655,7 +655,8 @@ fsl_pcib_inbound(struct fsl_pcib_softc * switch (tgt) { /* XXX OCP85XX_TGTIF_RAM2, OCP85XX_TGTIF_RAM_INTL should be handled */ - case OCP85XX_TGTIF_RAM1: + case OCP85XX_TGTIF_RAM1_85XX: + case OCP85XX_TGTIF_RAM1_QORIQ: attr = 0xa0f55000 | (ffsl(size) - 2); break; default: Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Thu Dec 22 20:16:10 2016 (r310427) @@ -258,16 +258,17 @@ mpc85xx_timebase_freq(platform_t plat, s sizeof(freq)) <= 0) goto out; + if (freq == 0) + goto out; + /* * Time Base and Decrementer are updated every 8 CCB bus clocks. * HID0[SEL_TBCLK] = 0 */ - if (freq != 0) -#ifdef QORIQ_DPAA + if (mpc85xx_is_qoriq()) ticks = freq / 32; -#else + else ticks = freq / 8; -#endif out: if (ticks <= 0) @@ -324,24 +325,24 @@ mpc85xx_smp_start_cpu(platform_t plat, s int timeout; uintptr_t brr; int cpuid; - -#ifdef QORIQ_DPAA uint32_t tgt; - reg = ccsr_read4(OCP85XX_COREDISR); - cpuid = pc->pc_cpuid; - - if ((reg & cpuid) != 0) { - printf("%s: CPU %d is disabled!\n", __func__, pc->pc_cpuid); - return (-1); + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_COREDISR); + cpuid = pc->pc_cpuid; + + if ((reg & (1 << cpuid)) != 0) { + printf("%s: CPU %d is disabled!\n", __func__, pc->pc_cpuid); + return (-1); + } + + brr = OCP85XX_BRR; + } else { + brr = OCP85XX_EEBPCR; + cpuid = pc->pc_cpuid + 24; } - - brr = OCP85XX_BRR; -#else /* QORIQ_DPAA */ - brr = OCP85XX_EEBPCR; - cpuid = pc->pc_cpuid + 24; -#endif bp_kernload = kernload; + reg = ccsr_read4(brr); if ((reg & (1 << cpuid)) != 0) { printf("SMP: CPU %d already out of hold-off state!\n", @@ -358,55 +359,52 @@ mpc85xx_smp_start_cpu(platform_t plat, s bptr = ((vm_paddr_t)(uintptr_t)__boot_page - KERNBASE) + kernload; KASSERT((bptr & 0xfff) == 0, ("%s: boot page is not aligned (%#jx)", __func__, (uintmax_t)bptr)); -#ifdef QORIQ_DPAA - - /* - * Read DDR controller configuration to select proper BPTR target ID. - * - * On P5020 bit 29 of DDR1_CS0_CONFIG enables DDR controllers - * interleaving. If this bit is set, we have to use - * OCP85XX_TGTIF_RAM_INTL as BPTR target ID. On other QorIQ DPAA SoCs, - * this bit is reserved and always 0. - */ - - reg = ccsr_read4(OCP85XX_DDR1_CS0_CONFIG); - if (reg & (1 << 29)) - tgt = OCP85XX_TGTIF_RAM_INTL; - else - tgt = OCP85XX_TGTIF_RAM1; - - /* - * Set BSTR to the physical address of the boot page - */ - ccsr_write4(OCP85XX_BSTRH, bptr >> 32); - ccsr_write4(OCP85XX_BSTRL, bptr); - ccsr_write4(OCP85XX_BSTAR, OCP85XX_ENA_MASK | - (tgt << OCP85XX_TRGT_SHIFT) | (ffsl(PAGE_SIZE) - 2)); - - /* Read back OCP85XX_BSTAR to synchronize write */ - ccsr_read4(OCP85XX_BSTAR); - - /* - * Enable and configure time base on new CPU. - */ - - /* Set TB clock source to platform clock / 32 */ - reg = ccsr_read4(CCSR_CTBCKSELR); - ccsr_write4(CCSR_CTBCKSELR, reg & ~(1 << pc->pc_cpuid)); - - /* Enable TB */ - reg = ccsr_read4(CCSR_CTBENR); - ccsr_write4(CCSR_CTBENR, reg | (1 << pc->pc_cpuid)); -#else - - /* - * Set BPTR to the physical address of the boot page - */ - bptr = (bptr >> 12) | 0x80000000u; - ccsr_write4(OCP85XX_BPTR, bptr); - __asm __volatile("isync; msync"); - -#endif /* QORIQ_DPAA */ + if (mpc85xx_is_qoriq()) { + /* + * Read DDR controller configuration to select proper BPTR target ID. + * + * On P5020 bit 29 of DDR1_CS0_CONFIG enables DDR controllers + * interleaving. If this bit is set, we have to use + * OCP85XX_TGTIF_RAM_INTL as BPTR target ID. On other QorIQ DPAA SoCs, + * this bit is reserved and always 0. + */ + + reg = ccsr_read4(OCP85XX_DDR1_CS0_CONFIG); + if (reg & (1 << 29)) + tgt = OCP85XX_TGTIF_RAM_INTL; + else + tgt = OCP85XX_TGTIF_RAM1; + + /* + * Set BSTR to the physical address of the boot page + */ + ccsr_write4(OCP85XX_BSTRH, bptr >> 32); + ccsr_write4(OCP85XX_BSTRL, bptr); + ccsr_write4(OCP85XX_BSTAR, OCP85XX_ENA_MASK | + (tgt << OCP85XX_TRGT_SHIFT_QORIQ) | (ffsl(PAGE_SIZE) - 2)); + + /* Read back OCP85XX_BSTAR to synchronize write */ + ccsr_read4(OCP85XX_BSTAR); + + /* + * Enable and configure time base on new CPU. + */ + + /* Set TB clock source to platform clock / 32 */ + reg = ccsr_read4(CCSR_CTBCKSELR); + ccsr_write4(CCSR_CTBCKSELR, reg & ~(1 << pc->pc_cpuid)); + + /* Enable TB */ + reg = ccsr_read4(CCSR_CTBENR); + ccsr_write4(CCSR_CTBENR, reg | (1 << pc->pc_cpuid)); + } else { + /* + * Set BPTR to the physical address of the boot page + */ + bptr = (bptr >> 12) | 0x80000000u; + ccsr_write4(OCP85XX_BPTR, bptr); + __asm __volatile("isync; msync"); + } /* * Release AP from hold-off state @@ -424,15 +422,14 @@ mpc85xx_smp_start_cpu(platform_t plat, s * address (= 0xfffff000) isn't permanently remapped and thus not * usable otherwise. */ -#ifdef QORIQ_DPAA - ccsr_write4(OCP85XX_BSTAR, 0); -#else - ccsr_write4(OCP85XX_BPTR, 0); -#endif + if (mpc85xx_is_qoriq()) + ccsr_write4(OCP85XX_BSTAR, 0); + else + ccsr_write4(OCP85XX_BPTR, 0); __asm __volatile("isync; msync"); if (!pc->pc_awake) - printf("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); + panic("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); return ((pc->pc_awake) ? 0 : EBUSY); #else /* No SMP support */ @@ -469,33 +466,32 @@ mpc85xx_reset(platform_t plat) static void mpc85xx_idle(platform_t plat, int cpu) { -#ifdef QORIQ_DPAA uint32_t reg; - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); -#else - register_t msr; - - msr = mfmsr(); - /* Freescale E500 core RM section 6.4.1. */ - __asm __volatile("msync; mtmsr %0; isync" :: - "r" (msr | PSL_WE)); -#endif + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); + } else { + reg = mfmsr(); + /* Freescale E500 core RM section 6.4.1. */ + __asm __volatile("msync; mtmsr %0; isync" :: + "r" (reg | PSL_WE)); + } } static int mpc85xx_idle_wakeup(platform_t plat, int cpu) { -#ifdef QORIQ_DPAA uint32_t reg; - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); + + return (1); + } - return (1); -#endif return (0); } From owner-svn-src-stable-11@freebsd.org Thu Dec 22 21:29:59 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FF51C8D119; Thu, 22 Dec 2016 21:29:59 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A5B16D0; Thu, 22 Dec 2016 21:29:58 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMLTwdM050027; Thu, 22 Dec 2016 21:29:58 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMLTvXd050022; Thu, 22 Dec 2016 21:29:57 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612222129.uBMLTvXd050022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 22 Dec 2016 21:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310431 - in stable/11/sys/dev: evdev syscons vt X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 21:29:59 -0000 Author: gonzo Date: Thu Dec 22 21:29:57 2016 New Revision: 310431 URL: https://svnweb.freebsd.org/changeset/base/310431 Log: MFC r309823: [evdev] Adds evdev support to sysmouse(4) driver For horizontal (T-axis) wheel reporting which is not supported by sysmouse protocol kern.evdev.sysmouse_t_axis sysctl is introduced. It can take following values: 0 - no T-axis events (default) 1 - T-axis events are originated in ums(4) driver. 2 - T-axis events are originated in psm(4) driver. Submitted by: Vladimir Kondratiev Differential Revision: https://reviews.freebsd.org/D8597 Modified: stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/evdev.h stable/11/sys/dev/syscons/sysmouse.c stable/11/sys/dev/vt/vt_sysmouse.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- stable/11/sys/dev/evdev/evdev.c Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/evdev/evdev.c Thu Dec 22 21:29:57 2016 (r310431) @@ -63,11 +63,14 @@ enum evdev_sparse_result MALLOC_DEFINE(M_EVDEV, "evdev", "evdev memory"); int evdev_rcpt_mask = EVDEV_RCPT_SYSMOUSE | EVDEV_RCPT_KBDMUX; +int evdev_sysmouse_t_axis = 0; SYSCTL_NODE(_kern, OID_AUTO, evdev, CTLFLAG_RW, 0, "Evdev args"); SYSCTL_INT(_kern_evdev, OID_AUTO, rcpt_mask, CTLFLAG_RW, &evdev_rcpt_mask, 0, "Who is receiving events: bit0 - sysmouse, bit1 - kbdmux, " "bit2 - mouse hardware, bit3 - keyboard hardware"); +SYSCTL_INT(_kern_evdev, OID_AUTO, sysmouse_t_axis, CTLFLAG_RW, + &evdev_sysmouse_t_axis, 0, "Extract T-axis from 0-none, 1-ums, 2-psm"); static void evdev_start_repeat(struct evdev_dev *, uint16_t); static void evdev_stop_repeat(struct evdev_dev *); Modified: stable/11/sys/dev/evdev/evdev.h ============================================================================== --- stable/11/sys/dev/evdev/evdev.h Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/evdev/evdev.h Thu Dec 22 21:29:57 2016 (r310431) @@ -56,6 +56,22 @@ typedef void (evdev_keycode_t)(struct ev #define EVDEV_RCPT_HW_MOUSE (1<<2) #define EVDEV_RCPT_HW_KBD (1<<3) extern int evdev_rcpt_mask; +/* + * Sysmouse protocol does not support horizontal wheel movement reporting. + * To overcome this limitation different drivers use different sysmouse proto + * extensions. Set kern.evdev.sysmouse_t_axis to tell sysmouse evdev driver + * which protocol extension is used. + * 0 - do not extract horizontal wheel movement (default). + * 1 - ums(4) horizontal wheel encoding. T-axis is mapped to buttons 6 and 7 + * 2 - psm(4) wheels encoding: z = 1,-1 - vert. wheel, z = 2,-2 - horiz. wheel + */ +enum +{ + EVDEV_SYSMOUSE_T_AXIS_NONE = 0, + EVDEV_SYSMOUSE_T_AXIS_UMS = 1, + EVDEV_SYSMOUSE_T_AXIS_PSM = 2, +}; +extern int evdev_sysmouse_t_axis; #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR #define ABS_MT_LAST ABS_MT_TOOL_Y Modified: stable/11/sys/dev/syscons/sysmouse.c ============================================================================== --- stable/11/sys/dev/syscons/sysmouse.c Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/syscons/sysmouse.c Thu Dec 22 21:29:57 2016 (r310431) @@ -28,6 +28,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_evdev.h" #include "opt_syscons.h" #include @@ -43,6 +44,11 @@ __FBSDID("$FreeBSD$"); #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #ifndef SC_NO_SYSMOUSE /* local variables */ @@ -50,6 +56,72 @@ static struct tty *sysmouse_tty; static int mouse_level; /* sysmouse protocol level */ static mousestatus_t mouse_status; +#ifdef EVDEV_SUPPORT +static struct evdev_dev *sysmouse_evdev; + +static void +smdev_evdev_init(void) +{ + int i; + + sysmouse_evdev = evdev_alloc(); + evdev_set_name(sysmouse_evdev, "System mouse"); + evdev_set_phys(sysmouse_evdev, "sysmouse"); + evdev_set_id(sysmouse_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_prop(sysmouse_evdev, INPUT_PROP_POINTER); + evdev_support_event(sysmouse_evdev, EV_SYN); + evdev_support_event(sysmouse_evdev, EV_REL); + evdev_support_event(sysmouse_evdev, EV_KEY); + evdev_support_rel(sysmouse_evdev, REL_X); + evdev_support_rel(sysmouse_evdev, REL_Y); + evdev_support_rel(sysmouse_evdev, REL_WHEEL); + evdev_support_rel(sysmouse_evdev, REL_HWHEEL); + for (i = 0; i < 8; i++) + evdev_support_key(sysmouse_evdev, BTN_MOUSE + i); + if (evdev_register(sysmouse_evdev)) { + evdev_free(sysmouse_evdev); + sysmouse_evdev = NULL; + } +} + +static void +smdev_evdev_write(int x, int y, int z, int buttons) +{ + + if (sysmouse_evdev == NULL || !(evdev_rcpt_mask & EVDEV_RCPT_SYSMOUSE)) + return; + + evdev_push_event(sysmouse_evdev, EV_REL, REL_X, x); + evdev_push_event(sysmouse_evdev, EV_REL, REL_Y, y); + switch (evdev_sysmouse_t_axis) { + case EVDEV_SYSMOUSE_T_AXIS_PSM: + switch (z) { + case 1: + case -1: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + break; + case 2: + case -2: + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, z / 2); + break; + } + break; + case EVDEV_SYSMOUSE_T_AXIS_UMS: + /* XXX: Edge triggering should be used here */ + if (buttons & (1 << 5)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, 1); + else if (buttons & (1 << 6)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, -1); + /* PASSTHROUGH */ + case EVDEV_SYSMOUSE_T_AXIS_NONE: + default: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + } + evdev_push_mouse_btn(sysmouse_evdev, buttons); + evdev_sync(sysmouse_evdev); +} +#endif + static void smdev_close(struct tty *tp) { @@ -170,6 +242,9 @@ sm_attach_mouse(void *unused) return; sysmouse_tty = tty_alloc(&smdev_ttydevsw, NULL); tty_makedev(sysmouse_tty, NULL, "sysmouse"); +#ifdef EVDEV_SUPPORT + smdev_evdev_init(); +#endif } SYSINIT(sysmouse, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sm_attach_mouse, NULL); @@ -220,7 +295,14 @@ sysmouse_event(mouse_info_t *info) mouse_status.flags |= ((x || y || z) ? MOUSE_POSCHANGED : 0) | (mouse_status.obutton ^ mouse_status.button); flags = mouse_status.flags; - if (flags == 0 || !tty_opened(sysmouse_tty)) + if (flags == 0) + goto done; + +#ifdef EVDEV_SUPPORT + smdev_evdev_write(x, y, z, mouse_status.button); +#endif + + if (!tty_opened(sysmouse_tty)) goto done; /* the first five bytes are compatible with MouseSystems' */ Modified: stable/11/sys/dev/vt/vt_sysmouse.c ============================================================================== --- stable/11/sys/dev/vt/vt_sysmouse.c Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/vt/vt_sysmouse.c Thu Dec 22 21:29:57 2016 (r310431) @@ -33,6 +33,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_evdev.h" + #include #include #include @@ -50,6 +52,11 @@ __FBSDID("$FreeBSD$"); #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + static d_open_t sysmouse_open; static d_close_t sysmouse_close; static d_read_t sysmouse_read; @@ -81,6 +88,72 @@ static MALLOC_DEFINE(M_SYSMOUSE, "sysmou static unsigned char *sysmouse_buffer; static unsigned int sysmouse_start, sysmouse_length; +#ifdef EVDEV_SUPPORT +static struct evdev_dev *sysmouse_evdev; + +static void +sysmouse_evdev_init(void) +{ + int i; + + sysmouse_evdev = evdev_alloc(); + evdev_set_name(sysmouse_evdev, "System mouse"); + evdev_set_phys(sysmouse_evdev, "sysmouse"); + evdev_set_id(sysmouse_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_prop(sysmouse_evdev, INPUT_PROP_POINTER); + evdev_support_event(sysmouse_evdev, EV_SYN); + evdev_support_event(sysmouse_evdev, EV_REL); + evdev_support_event(sysmouse_evdev, EV_KEY); + evdev_support_rel(sysmouse_evdev, REL_X); + evdev_support_rel(sysmouse_evdev, REL_Y); + evdev_support_rel(sysmouse_evdev, REL_WHEEL); + evdev_support_rel(sysmouse_evdev, REL_HWHEEL); + for (i = 0; i < 8; i++) + evdev_support_key(sysmouse_evdev, BTN_MOUSE + i); + if (evdev_register(sysmouse_evdev)) { + evdev_free(sysmouse_evdev); + sysmouse_evdev = NULL; + } +} + +static void +sysmouse_evdev_store(int x, int y, int z, int buttons) +{ + + if (sysmouse_evdev == NULL || !(evdev_rcpt_mask & EVDEV_RCPT_SYSMOUSE)) + return; + + evdev_push_event(sysmouse_evdev, EV_REL, REL_X, x); + evdev_push_event(sysmouse_evdev, EV_REL, REL_Y, y); + switch (evdev_sysmouse_t_axis) { + case EVDEV_SYSMOUSE_T_AXIS_PSM: + switch (z) { + case 1: + case -1: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + break; + case 2: + case -2: + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, z / 2); + break; + } + break; + case EVDEV_SYSMOUSE_T_AXIS_UMS: + /* XXX: Edge triggering should be used here */ + if (buttons & (1 << 5)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, 1); + else if (buttons & (1 << 6)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, -1); + /* PASSTHROUGH */ + case EVDEV_SYSMOUSE_T_AXIS_NONE: + default: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + } + evdev_push_mouse_btn(sysmouse_evdev, buttons); + evdev_sync(sysmouse_evdev); +} +#endif + static int sysmouse_buf_read(struct uio *uio, unsigned int length) { @@ -170,6 +243,9 @@ sysmouse_process_event(mouse_info_t *mi) if (sysmouse_status.flags == 0) goto done; +#ifdef EVDEV_SUPPORT + sysmouse_evdev_store(x, y, z, sysmouse_status.button); +#endif /* The first five bytes are compatible with MouseSystems. */ buf[0] = MOUSE_MSC_SYNC | @@ -404,6 +480,9 @@ sysmouse_drvinit(void *unused) cv_init(&sysmouse_sleep, "sysmrd"); make_dev(&sysmouse_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "sysmouse"); +#ifdef EVDEV_SUPPORT + sysmouse_evdev_init(); +#endif } SYSINIT(sysmouse, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sysmouse_drvinit, NULL); From owner-svn-src-stable-11@freebsd.org Thu Dec 22 21:56:43 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1179EC8D6B4; Thu, 22 Dec 2016 21:56:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE23015F4; Thu, 22 Dec 2016 21:56:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMLugLH062819; Thu, 22 Dec 2016 21:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMLug5k062813; Thu, 22 Dec 2016 21:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201612222156.uBMLug5k062813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 22 Dec 2016 21:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310432 - stable/11/usr.sbin/nfsd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 21:56:43 -0000 Author: rmacklem Date: Thu Dec 22 21:56:41 2016 New Revision: 310432 URL: https://svnweb.freebsd.org/changeset/base/310432 Log: MFC: r309723 Patch the nfsd so that it doesn't register with rpcbind for an NFSv4 only server. This patch uses the sysctl vfs.nfsd.server_min_nfsvers to determine if/what versions of NFS service should be registered with rpcbind. For NFSv4 only, it does not register at all, since NFSv4 always uses 2049 and does not require rpcbind. For NFSv3 minimum, it registers NFSv3 but not NFSv2. Modified: stable/11/usr.sbin/nfsd/nfsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/nfsd/nfsd.c ============================================================================== --- stable/11/usr.sbin/nfsd/nfsd.c Thu Dec 22 21:29:57 2016 (r310431) +++ stable/11/usr.sbin/nfsd/nfsd.c Thu Dec 22 21:56:41 2016 (r310432) @@ -82,6 +82,9 @@ static int debug = 0; #define NFSD_STABLEBACKUP "/var/db/nfs-stablerestart.bak" #define MAXNFSDCNT 256 #define DEFNFSDCNT 4 +#define NFS_VER2 2 +#define NFS_VER3 3 +#define NFS_VER4 4 static pid_t children[MAXNFSDCNT]; /* PIDs of children */ static int nfsdcnt; /* number of children */ static int nfsdcnt_set; @@ -158,6 +161,8 @@ main(int argc, char **argv) int bindhostc, bindanyflag, rpcbreg, rpcbregcnt; int nfssvc_addsock; int longindex = 0; + int nfs_minvers = NFS_VER2; + size_t nfs_minvers_size; const char *lopt; char **bindhost = NULL; pid_t pid; @@ -266,6 +271,15 @@ main(int argc, char **argv) errx(1, "Out of memory"); } + nfs_minvers_size = sizeof(nfs_minvers); + error = sysctlbyname("vfs.nfsd.server_min_nfsvers", &nfs_minvers, + &nfs_minvers_size, NULL, 0); + if (error != 0 || nfs_minvers < NFS_VER2 || nfs_minvers > NFS_VER4) { + warnx("sysctlbyname(vfs.nfsd.server_min_nfsvers) failed," + " defaulting to NFSv2"); + nfs_minvers = NFS_VER2; + } + if (unregister) { unregistration(); exit (0); @@ -285,9 +299,14 @@ main(int argc, char **argv) err(1, "getnetconfigent udp failed"); nb_udp.buf = ai_udp->ai_addr; nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp))) - err(1, "rpcb_set udp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); freeaddrinfo(ai_udp); } if (udpflag && ip6flag) { @@ -304,9 +323,14 @@ main(int argc, char **argv) err(1, "getnetconfigent udp6 failed"); nb_udp6.buf = ai_udp6->ai_addr; nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6))) - err(1, "rpcb_set udp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, + &nb_udp6)) + err(1, "rpcb_set udp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, + &nb_udp6)) + err(1, "rpcb_set udp6 failed"); freeaddrinfo(ai_udp6); } if (tcpflag) { @@ -323,9 +347,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp failed"); nb_tcp.buf = ai_tcp->ai_addr; nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, &nb_tcp)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, &nb_tcp))) - err(1, "rpcb_set tcp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); freeaddrinfo(ai_tcp); } if (tcpflag && ip6flag) { @@ -342,9 +371,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp6 failed"); nb_tcp6.buf = ai_tcp6->ai_addr; nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6))) - err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); freeaddrinfo(ai_tcp6); } exit (0); @@ -475,9 +509,14 @@ main(int argc, char **argv) err(1, "getnetconfigent udp failed"); nb_udp.buf = ai_udp->ai_addr; nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp))) - err(1, "rpcb_set udp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); freeaddrinfo(ai_udp); } } @@ -544,9 +583,16 @@ main(int argc, char **argv) err(1, "getnetconfigent udp6 failed"); nb_udp6.buf = ai_udp6->ai_addr; nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6))) - err(1, "rpcb_set udp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, + &nb_udp6)) + err(1, + "rpcb_set udp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, + &nb_udp6)) + err(1, + "rpcb_set udp6 failed"); freeaddrinfo(ai_udp6); } } @@ -610,10 +656,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp failed"); nb_tcp.buf = ai_tcp->ai_addr; nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, - &nb_tcp)) || (!rpcb_set(NFS_PROGRAM, 3, - nconf_tcp, &nb_tcp))) - err(1, "rpcb_set tcp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); freeaddrinfo(ai_tcp); } } @@ -685,9 +735,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp6 failed"); nb_tcp6.buf = ai_tcp6->ai_addr; nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6))) - err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); freeaddrinfo(ai_tcp6); } } From owner-svn-src-stable-11@freebsd.org Fri Dec 23 00:38:44 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE048C8B969; Fri, 23 Dec 2016 00:38:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E0941E17; Fri, 23 Dec 2016 00:38:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN0ch2M029261; Fri, 23 Dec 2016 00:38:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN0chRm029259; Fri, 23 Dec 2016 00:38:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612230038.uBN0chRm029259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 00:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310436 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 00:38:45 -0000 Author: jhb Date: Fri Dec 23 00:38:43 2016 New Revision: 310436 URL: https://svnweb.freebsd.org/changeset/base/310436 Log: MFC 308948: Initialize 'ticks' earlier in boot after 'hz' is set. This avoids the time-warp after kthreads have started running and the required fixup to td_slptick and td_blktick in the EARLY_AP_STARTUP case. Now, 'ticks' is initialized before any kthreads are created or any context switches are performed. Modified: stable/11/sys/kern/kern_clock.c stable/11/sys/kern/subr_param.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_clock.c ============================================================================== --- stable/11/sys/kern/kern_clock.c Thu Dec 22 23:59:53 2016 (r310435) +++ stable/11/sys/kern/kern_clock.c Fri Dec 23 00:38:43 2016 (r310436) @@ -393,10 +393,6 @@ static void initclocks(dummy) void *dummy; { -#ifdef EARLY_AP_STARTUP - struct proc *p; - struct thread *td; -#endif register int i; /* @@ -416,40 +412,6 @@ initclocks(dummy) #ifdef SW_WATCHDOG EVENTHANDLER_REGISTER(watchdog_list, watchdog_config, NULL, 0); #endif - /* - * Arrange for ticks to wrap 10 minutes after boot to help catch - * sign problems sooner. - */ - ticks = INT_MAX - (hz * 10 * 60); - -#ifdef EARLY_AP_STARTUP - /* - * Fixup the tick counts in any blocked or sleeping threads to - * account for the jump above. - */ - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - if (p->p_state == PRS_NEW) { - PROC_UNLOCK(p); - continue; - } - FOREACH_THREAD_IN_PROC(p, td) { - thread_lock(td); - if (TD_ON_LOCK(td)) { - MPASS(td->td_blktick == 0); - td->td_blktick = ticks; - } - if (TD_ON_SLEEPQ(td)) { - MPASS(td->td_slptick == 0); - td->td_slptick = ticks; - } - thread_unlock(td); - } - PROC_UNLOCK(p); - } - sx_sunlock(&allproc_lock); -#endif } /* Modified: stable/11/sys/kern/subr_param.c ============================================================================== --- stable/11/sys/kern/subr_param.c Thu Dec 22 23:59:53 2016 (r310435) +++ stable/11/sys/kern/subr_param.c Fri Dec 23 00:38:43 2016 (r310436) @@ -171,6 +171,12 @@ init_param1(void) tick_sbt = SBT_1S / hz; tick_bt = sbttobt(tick_sbt); + /* + * Arrange for ticks to wrap 10 minutes after boot to help catch + * sign problems sooner. + */ + ticks = INT_MAX - (hz * 10 * 60); + #ifdef VM_SWZONE_SIZE_MAX maxswzone = VM_SWZONE_SIZE_MAX; #endif From owner-svn-src-stable-11@freebsd.org Fri Dec 23 02:57:20 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8402EC8DD20; Fri, 23 Dec 2016 02:57:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52A1C1CB8; Fri, 23 Dec 2016 02:57:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN2vJfl085714; Fri, 23 Dec 2016 02:57:19 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN2vJUm085713; Fri, 23 Dec 2016 02:57:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230257.uBN2vJUm085713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 02:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310438 - stable/11/sys/cddl/dev/dtrace/powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 02:57:20 -0000 Author: jhibbits Date: Fri Dec 23 02:57:19 2016 New Revision: 310438 URL: https://svnweb.freebsd.org/changeset/base/310438 Log: MFC r303796: Two fixups for dtrace * Use the right incantation to get the next stack pointer. * Clear EE using the correct instruction sequence. Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Fri Dec 23 02:57:00 2016 (r310437) +++ stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Fri Dec 23 02:57:19 2016 (r310438) @@ -67,7 +67,13 @@ dtrace_icookie_t dtrace_interrupt_disabl */ ASENTRY_NOPROF(dtrace_interrupt_disable) mfmsr %r3 - andi. %r0,%r3,~PSL_EE@l +#ifdef __powerpc64__ + /* Two-instruction sequence to clear EE flag */ + rldicl %r0,%r3,48,1 + rotldi %r0,%r0,16 +#else + rlwinm %r0,%r3,0,~PSL_EE /* Clear EE flag */ +#endif mtmsr %r0 blr END(dtrace_interrupt_disable) Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Fri Dec 23 02:57:00 2016 (r310437) +++ stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Fri Dec 23 02:57:19 2016 (r310438) @@ -545,7 +545,7 @@ dtrace_getstackdepth(int aframes) else aframes--; osp = sp; - sp = *(uintptr_t *)sp; + sp = dtrace_next_sp(sp); } if (depth < aframes) return (0); From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:07:20 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB8DCC8C12D; Fri, 23 Dec 2016 03:07:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A9371761; Fri, 23 Dec 2016 03:07:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN37Jw7090795; Fri, 23 Dec 2016 03:07:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN37Jse090793; Fri, 23 Dec 2016 03:07:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612230307.uBN37Jse090793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 03:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310439 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:07:21 -0000 Author: jhb Date: Fri Dec 23 03:07:19 2016 New Revision: 310439 URL: https://svnweb.freebsd.org/changeset/base/310439 Log: MFC 309148: Permit timed sleeps for threads other than thread0 before timers are working. The callout subsystem already handles early callouts and schedules the first clock interrupt appropriately based on the currently pending callouts. The one nit to fix was that callouts scheduled via C_HARDCLOCK during early boot could fire too early once timers were enabled as the per-CPU base time is always zero until timers are initialized. The change in callout_when() handles this case by using the current uptime as the base time of the callout during bootup if the per-CPU base time is zero. Modified: stable/11/sys/kern/kern_timeout.c stable/11/sys/kern/subr_sleepqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_timeout.c ============================================================================== --- stable/11/sys/kern/kern_timeout.c Fri Dec 23 02:57:19 2016 (r310438) +++ stable/11/sys/kern/kern_timeout.c Fri Dec 23 03:07:19 2016 (r310439) @@ -981,6 +981,8 @@ callout_when(sbintime_t sbt, sbintime_t spinlock_exit(); #endif #endif + if (cold && to_sbt == 0) + to_sbt = sbinuptime(); if ((flags & C_HARDCLOCK) == 0) to_sbt += tick_sbt; } else Modified: stable/11/sys/kern/subr_sleepqueue.c ============================================================================== --- stable/11/sys/kern/subr_sleepqueue.c Fri Dec 23 02:57:19 2016 (r310438) +++ stable/11/sys/kern/subr_sleepqueue.c Fri Dec 23 03:07:19 2016 (r310439) @@ -386,7 +386,7 @@ sleepq_set_timeout_sbt(void *wchan, sbin MPASS(TD_ON_SLEEPQ(td)); MPASS(td->td_sleepqueue == NULL); MPASS(wchan != NULL); - if (cold) + if (cold && td == &thread0) panic("timed sleep before timers are working"); KASSERT(td->td_sleeptimo == 0, ("td %d %p td_sleeptimo %jx", td->td_tid, td, (uintmax_t)td->td_sleeptimo)); From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:08:28 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F64BC8C1BD; Fri, 23 Dec 2016 03:08:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31CF218FE; Fri, 23 Dec 2016 03:08:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN38RME090893; Fri, 23 Dec 2016 03:08:27 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN38ROT090891; Fri, 23 Dec 2016 03:08:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230308.uBN38ROT090891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310440 - in stable/11/sys/powerpc: booke mpc85xx X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:08:28 -0000 Author: jhibbits Date: Fri Dec 23 03:08:27 2016 New Revision: 310440 URL: https://svnweb.freebsd.org/changeset/base/310440 Log: MFC r304047,r304068: r304047: Add ePAPR boot support for PowerPC book-E (MPC85xx) hardware r304068: Only flush bp_kernload from the dcache, no need to sync the icache on the boot CPU. Modified: stable/11/sys/powerpc/booke/locore.S stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/booke/locore.S ============================================================================== --- stable/11/sys/powerpc/booke/locore.S Fri Dec 23 03:07:19 2016 (r310439) +++ stable/11/sys/powerpc/booke/locore.S Fri Dec 23 03:08:27 2016 (r310440) @@ -409,6 +409,8 @@ bp_kernload: ori %r3, %r3, (MAS3_SX | MAS3_SW | MAS3_SR)@l mtspr SPR_MAS3, %r3 isync + bl zero_mas7 + bl zero_mas8 tlbwe isync msync Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:07:19 2016 (r310439) +++ stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:08:27 2016 (r310440) @@ -39,7 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -53,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -63,6 +66,15 @@ extern void *ap_pcpu; extern vm_paddr_t kernload; /* Kernel physical load address */ extern uint8_t __boot_page[]; /* Boot page body */ extern uint32_t bp_kernload; + +struct cpu_release { + uint32_t entry_h; + uint32_t entry_l; + uint32_t r3_h; + uint32_t r3_l; + uint32_t reserved; + uint32_t pir; +}; #endif extern uint32_t *bootinfo; @@ -316,6 +328,51 @@ mpc85xx_smp_get_bsp(platform_t plat, str return (0); } +#ifdef SMP +static int +mpc85xx_smp_start_cpu_epapr(platform_t plat, struct pcpu *pc) +{ + vm_paddr_t rel_pa, bptr; + volatile struct cpu_release *rel; + vm_offset_t rel_va, rel_page; + phandle_t node; + int i; + + /* If we're calling this, the node already exists. */ + node = OF_finddevice("/cpus"); + for (i = 0, node = OF_child(node); i < pc->pc_cpuid; + i++, node = OF_peer(node)) + ; + if (OF_getencprop(node, "cpu-release-addr", (pcell_t *)&rel_pa, + sizeof(rel_pa)) == -1) { + return (ENOENT); + } + + rel_page = kva_alloc(PAGE_SIZE); + if (rel_page == 0) + return (ENOMEM); + + critical_enter(); + rel_va = rel_page + (rel_pa & PAGE_MASK); + pmap_kenter(rel_page, rel_pa & ~PAGE_MASK); + rel = (struct cpu_release *)rel_va; + bptr = ((vm_paddr_t)(uintptr_t)__boot_page - KERNBASE) + kernload; + cpu_flush_dcache(__DEVOLATILE(struct cpu_release *,rel), sizeof(*rel)); + rel->pir = pc->pc_cpuid; __asm __volatile("sync"); + rel->entry_h = (bptr >> 32); + rel->entry_l = bptr; __asm __volatile("sync"); + cpu_flush_dcache(__DEVOLATILE(struct cpu_release *,rel), sizeof(*rel)); + if (bootverbose) + printf("Waking up CPU %d via CPU release page %p\n", + pc->pc_cpuid, rel); + critical_exit(); + pmap_kremove(rel_page); + kva_free(rel_page, PAGE_SIZE); + + return (0); +} +#endif + static int mpc85xx_smp_start_cpu(platform_t plat, struct pcpu *pc) { @@ -325,6 +382,7 @@ mpc85xx_smp_start_cpu(platform_t plat, s int timeout; uintptr_t brr; int cpuid; + int epapr_boot = 0; uint32_t tgt; if (mpc85xx_is_qoriq()) { @@ -342,6 +400,20 @@ mpc85xx_smp_start_cpu(platform_t plat, s cpuid = pc->pc_cpuid + 24; } bp_kernload = kernload; + /* + * bp_kernload is in the boot page. Sync the cache because ePAPR + * booting has the other core(s) already running. + */ + cpu_flush_dcache(&bp_kernload, sizeof(bp_kernload)); + + ap_pcpu = pc; + __asm __volatile("msync; isync"); + + /* First try the ePAPR way. */ + if (mpc85xx_smp_start_cpu_epapr(plat, pc) == 0) { + epapr_boot = 1; + goto spin_wait; + } reg = ccsr_read4(brr); if ((reg & (1 << cpuid)) != 0) { @@ -350,9 +422,6 @@ mpc85xx_smp_start_cpu(platform_t plat, s return (ENXIO); } - ap_pcpu = pc; - __asm __volatile("msync; isync"); - /* Flush caches to have our changes hit DRAM. */ cpu_flush_dcache(__boot_page, 4096); @@ -413,6 +482,7 @@ mpc85xx_smp_start_cpu(platform_t plat, s ccsr_write4(brr, reg | (1 << cpuid)); __asm __volatile("isync; msync"); +spin_wait: timeout = 500; while (!pc->pc_awake && timeout--) DELAY(1000); /* wait 1ms */ @@ -422,11 +492,13 @@ mpc85xx_smp_start_cpu(platform_t plat, s * address (= 0xfffff000) isn't permanently remapped and thus not * usable otherwise. */ - if (mpc85xx_is_qoriq()) - ccsr_write4(OCP85XX_BSTAR, 0); - else - ccsr_write4(OCP85XX_BPTR, 0); - __asm __volatile("isync; msync"); + if (!epapr_boot) { + if (mpc85xx_is_qoriq()) + ccsr_write4(OCP85XX_BSTAR, 0); + else + ccsr_write4(OCP85XX_BPTR, 0); + __asm __volatile("isync; msync"); + } if (!pc->pc_awake) panic("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:14:06 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBA13C8C4EB; Fri, 23 Dec 2016 03:14:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A073F1EC0; Fri, 23 Dec 2016 03:14:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3E5kM094666; Fri, 23 Dec 2016 03:14:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3E5wV094664; Fri, 23 Dec 2016 03:14:05 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230314.uBN3E5wV094664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310441 - in stable/11/sys/powerpc: mpc85xx powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:14:07 -0000 Author: jhibbits Date: Fri Dec 23 03:14:05 2016 New Revision: 310441 URL: https://svnweb.freebsd.org/changeset/base/310441 Log: MFC r305320,r306702: r305320: Use the right ifdef macro. r306702: Fix e500mc/derivatives cpu idle Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c stable/11/sys/powerpc/powerpc/cpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:08:27 2016 (r310440) +++ stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:14:05 2016 (r310441) @@ -541,9 +541,11 @@ mpc85xx_idle(platform_t plat, int cpu) uint32_t reg; if (mpc85xx_is_qoriq()) { - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); + /* + * Base binutils doesn't know what the 'wait' instruction is, so + * use the opcode encoding here. + */ + __asm __volatile("wrteei 1; .long 0x7c00007c"); } else { reg = mfmsr(); /* Freescale E500 core RM section 6.4.1. */ @@ -555,15 +557,6 @@ mpc85xx_idle(platform_t plat, int cpu) static int mpc85xx_idle_wakeup(platform_t plat, int cpu) { - uint32_t reg; - - if (mpc85xx_is_qoriq()) { - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); - - return (1); - } return (0); } Modified: stable/11/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/11/sys/powerpc/powerpc/cpu.c Fri Dec 23 03:08:27 2016 (r310440) +++ stable/11/sys/powerpc/powerpc/cpu.c Fri Dec 23 03:14:05 2016 (r310441) @@ -663,7 +663,7 @@ static void cpu_idle_booke(sbintime_t sbt) { -#ifdef E500 +#ifdef BOOKE_E500 platform_cpu_idle(PCPU_GET(cpuid)); #endif } From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:19:49 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBB00C8C639; Fri, 23 Dec 2016 03:19:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 857AA11A5; Fri, 23 Dec 2016 03:19:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3JmQP095214; Fri, 23 Dec 2016 03:19:48 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3JmKK095211; Fri, 23 Dec 2016 03:19:48 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230319.uBN3JmKK095211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:19:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310442 - in stable/11/sys/powerpc: booke powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:19:50 -0000 Author: jhibbits Date: Fri Dec 23 03:19:48 2016 New Revision: 310442 URL: https://svnweb.freebsd.org/changeset/base/310442 Log: MFC r304052: Add missing pmap_kremove() method for book-e. Modified: stable/11/sys/powerpc/booke/pmap.c stable/11/sys/powerpc/powerpc/mmu_if.m stable/11/sys/powerpc/powerpc/pmap_dispatch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/booke/pmap.c ============================================================================== --- stable/11/sys/powerpc/booke/pmap.c Fri Dec 23 03:14:05 2016 (r310441) +++ stable/11/sys/powerpc/booke/pmap.c Fri Dec 23 03:19:48 2016 (r310442) @@ -385,7 +385,7 @@ static mmu_method_t mmu_booke_methods[] MMUMETHOD(mmu_kenter, mmu_booke_kenter), MMUMETHOD(mmu_kenter_attr, mmu_booke_kenter_attr), MMUMETHOD(mmu_kextract, mmu_booke_kextract), -/* MMUMETHOD(mmu_kremove, mmu_booke_kremove), */ + MMUMETHOD(mmu_kremove, mmu_booke_kremove), MMUMETHOD(mmu_unmapdev, mmu_booke_unmapdev), MMUMETHOD(mmu_change_attr, mmu_booke_change_attr), Modified: stable/11/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- stable/11/sys/powerpc/powerpc/mmu_if.m Fri Dec 23 03:14:05 2016 (r310441) +++ stable/11/sys/powerpc/powerpc/mmu_if.m Fri Dec 23 03:19:48 2016 (r310442) @@ -870,6 +870,16 @@ METHOD void kenter_attr { } DEFAULT mmu_null_kenter_attr; /** + * @brief Unmap a wired page from kernel virtual address space + * + * @param _va mapped virtual address + */ +METHOD void kremove { + mmu_t _mmu; + vm_offset_t _va; +}; + +/** * @brief Determine if the given physical address range has been direct-mapped. * * @param _pa physical address start Modified: stable/11/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- stable/11/sys/powerpc/powerpc/pmap_dispatch.c Fri Dec 23 03:14:05 2016 (r310441) +++ stable/11/sys/powerpc/powerpc/pmap_dispatch.c Fri Dec 23 03:19:48 2016 (r310442) @@ -510,6 +510,14 @@ pmap_kenter_attr(vm_offset_t va, vm_offs MMU_KENTER_ATTR(mmu_obj, va, pa, ma); } +void +pmap_kremove(vm_offset_t va) +{ + + CTR2(KTR_PMAP, "%s(%#x)", __func__, va); + return (MMU_KREMOVE(mmu_obj, va)); +} + boolean_t pmap_dev_direct_mapped(vm_paddr_t pa, vm_size_t size) { From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:23:15 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEC8AC8C902; Fri, 23 Dec 2016 03:23:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F8BA17C8; Fri, 23 Dec 2016 03:23:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3NEA3099185; Fri, 23 Dec 2016 03:23:14 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3NEKa099183; Fri, 23 Dec 2016 03:23:14 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230323.uBN3NEKa099183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310444 - stable/11/sys/dev/tsec X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:23:15 -0000 Author: jhibbits Date: Fri Dec 23 03:23:14 2016 New Revision: 310444 URL: https://svnweb.freebsd.org/changeset/base/310444 Log: MFC r305040: Add support for NXP/Freescale etsec2 ethernet controller Modified: stable/11/sys/dev/tsec/if_tsec.h stable/11/sys/dev/tsec/if_tsec_fdt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/tsec/if_tsec.h ============================================================================== --- stable/11/sys/dev/tsec/if_tsec.h Fri Dec 23 03:20:34 2016 (r310443) +++ stable/11/sys/dev/tsec/if_tsec.h Fri Dec 23 03:23:14 2016 (r310444) @@ -135,6 +135,7 @@ struct tsec_softc { int phyaddr; bus_space_tag_t phy_bst; bus_space_handle_t phy_bsh; + int phy_regoff; }; /* interface to get/put generic objects */ @@ -258,9 +259,11 @@ extern struct mtx tsec_phy_mtx; #define TSEC_PHY_LOCK(sc) mtx_lock(&tsec_phy_mtx) #define TSEC_PHY_UNLOCK(sc) mtx_unlock(&tsec_phy_mtx) #define TSEC_PHY_READ(sc, reg) \ - bus_space_read_4((sc)->phy_bst, (sc)->phy_bsh, (reg)) + bus_space_read_4((sc)->phy_bst, (sc)->phy_bsh, \ + (reg) + (sc)->phy_regoff) #define TSEC_PHY_WRITE(sc, reg, val) \ - bus_space_write_4((sc)->phy_bst, (sc)->phy_bsh, (reg), (val)) + bus_space_write_4((sc)->phy_bst, (sc)->phy_bsh, \ + (reg) + (sc)->phy_regoff, (val)) /* Lock for transmitter */ #define TSEC_TRANSMIT_LOCK(sc) do { \ Modified: stable/11/sys/dev/tsec/if_tsec_fdt.c ============================================================================== --- stable/11/sys/dev/tsec/if_tsec_fdt.c Fri Dec 23 03:20:34 2016 (r310443) +++ stable/11/sys/dev/tsec/if_tsec_fdt.c Fri Dec 23 03:23:14 2016 (r310444) @@ -121,25 +121,33 @@ tsec_fdt_probe(device_t dev) sc = device_get_softc(dev); - sc->sc_rrid = 0; - sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid, - RF_ACTIVE); - if (sc->sc_rres == NULL) - return (ENXIO); - - sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); - sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); - - /* Check if we are eTSEC (enhanced TSEC) */ - id = TSEC_READ(sc, TSEC_REG_ID); - sc->is_etsec = ((id >> 16) == TSEC_ETSEC_ID) ? 1 : 0; - id |= TSEC_READ(sc, TSEC_REG_ID2); - - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_rrid, sc->sc_rres); - - if (id == 0) { - device_printf(dev, "could not identify TSEC type\n"); - return (ENXIO); + /* + * Device trees with "fsl,etsec2" compatible nodes don't have a reg + * property, as it's been relegated to the queue-group children. + */ + if (ofw_bus_is_compatible(dev, "fsl,etsec2")) + sc->is_etsec = 1; + else { + sc->sc_rrid = 0; + sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid, + RF_ACTIVE); + if (sc->sc_rres == NULL) + return (ENXIO); + + sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); + sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); + + /* Check if we are eTSEC (enhanced TSEC) */ + id = TSEC_READ(sc, TSEC_REG_ID); + sc->is_etsec = ((id >> 16) == TSEC_ETSEC_ID) ? 1 : 0; + id |= TSEC_READ(sc, TSEC_REG_ID2); + + bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_rrid, sc->sc_rres); + + if (id == 0) { + device_printf(dev, "could not identify TSEC type\n"); + return (ENXIO); + } } if (sc->is_etsec) @@ -154,13 +162,31 @@ static int tsec_fdt_attach(device_t dev) { struct tsec_softc *sc; - phandle_t phy; + struct resource_list *rl; + phandle_t child, mdio, phy; + int acells, scells; int error = 0; sc = device_get_softc(dev); sc->dev = dev; sc->node = ofw_bus_get_node(dev); + if (fdt_addrsize_cells(sc->node, &acells, &scells) != 0) { + acells = 1; + scells = 1; + } + if (ofw_bus_is_compatible(dev, "fsl,etsec2")) { + rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev); + + /* + * TODO: Add all children resources to the list. Will be + * required to support multigroup mode. + */ + child = OF_child(sc->node); + ofw_bus_reg_to_rl(dev, child, acells, scells, rl); + ofw_bus_intr_to_rl(dev, child, rl, NULL); + } + /* Get phy address from fdt */ if (OF_getencprop(sc->node, "phy-handle", &phy, sizeof(phy)) <= 0) { device_printf(dev, "PHY not found in device tree"); @@ -168,9 +194,17 @@ tsec_fdt_attach(device_t dev) } phy = OF_node_from_xref(phy); - OF_decode_addr(OF_parent(phy), 0, &sc->phy_bst, &sc->phy_bsh, NULL); + mdio = OF_parent(phy); + OF_decode_addr(mdio, 0, &sc->phy_bst, &sc->phy_bsh, NULL); OF_getencprop(phy, "reg", &sc->phyaddr, sizeof(sc->phyaddr)); + /* + * etsec2 MDIO nodes are given the MDIO module base address, so we need + * to add the MII offset to get the PHY registers. + */ + if (ofw_bus_node_is_compatible(mdio, "fsl,etsec2-mdio")) + sc->phy_regoff = TSEC_REG_MIIBASE; + /* Init timer */ callout_init(&sc->tsec_callout, 1); From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:28:44 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B36A7C8CC37; Fri, 23 Dec 2016 03:28:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 825921C21; Fri, 23 Dec 2016 03:28:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3ShHo099561; Fri, 23 Dec 2016 03:28:43 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3ShFB099560; Fri, 23 Dec 2016 03:28:43 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230328.uBN3ShFB099560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:28:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310446 - stable/11/sys/powerpc/conf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:28:44 -0000 Author: jhibbits Date: Fri Dec 23 03:28:43 2016 New Revision: 310446 URL: https://svnweb.freebsd.org/changeset/base/310446 Log: MFC r305677: Add ehci to the MPC85XX build Modified: stable/11/sys/powerpc/conf/MPC85XX Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/conf/MPC85XX ============================================================================== --- stable/11/sys/powerpc/conf/MPC85XX Fri Dec 23 03:27:11 2016 (r310445) +++ stable/11/sys/powerpc/conf/MPC85XX Fri Dec 23 03:28:43 2016 (r310446) @@ -89,6 +89,7 @@ device tun device uart options USB_DEBUG # enable debug msgs #device uhci +device ehci device umass device usb device vlan From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:31:55 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 315B2C8CD2D; Fri, 23 Dec 2016 03:31:55 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 005A71EB9; Fri, 23 Dec 2016 03:31:54 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3VsDA003390; Fri, 23 Dec 2016 03:31:54 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3VseB003389; Fri, 23 Dec 2016 03:31:54 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230331.uBN3VseB003389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:31:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310447 - stable/11/sys/powerpc/fpu X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:31:55 -0000 Author: jhibbits Date: Fri Dec 23 03:31:53 2016 New Revision: 310447 URL: https://svnweb.freebsd.org/changeset/base/310447 Log: MFC r307598: Un-static two local variables in the FPU emulator Static variables aren't MP-safe, and this was causing bizarre segfaults on a dual-core e500v2 system (P1022). Modified: stable/11/sys/powerpc/fpu/fpu_emu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/fpu/fpu_emu.c ============================================================================== --- stable/11/sys/powerpc/fpu/fpu_emu.c Fri Dec 23 03:28:43 2016 (r310446) +++ stable/11/sys/powerpc/fpu/fpu_emu.c Fri Dec 23 03:31:53 2016 (r310447) @@ -185,8 +185,8 @@ fpu_dumpfpn(struct fpn *fp) int fpu_emulate(struct trapframe *frame, struct fpu *fpf) { - static union instr insn; - static struct fpemu fe; + union instr insn; + struct fpemu fe; static int lastill = 0; int sig; From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:35:40 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 771C0C8CF82; Fri, 23 Dec 2016 03:35:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 457D812AB; Fri, 23 Dec 2016 03:35:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3Zdd1003646; Fri, 23 Dec 2016 03:35:39 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3ZdIU003644; Fri, 23 Dec 2016 03:35:39 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230335.uBN3ZdIU003644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310448 - stable/11/sys/powerpc/mpc85xx X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:35:40 -0000 Author: jhibbits Date: Fri Dec 23 03:35:39 2016 New Revision: 310448 URL: https://svnweb.freebsd.org/changeset/base/310448 Log: MFC r308669: Write to the correct GPIO registers. Modified: stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c Fri Dec 23 03:31:53 2016 (r310447) +++ stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c Fri Dec 23 03:35:39 2016 (r310448) @@ -173,7 +173,7 @@ qoriq_gpio_pin_set(device_t dev, uint32_ outvals = bus_read_4(sc->sc_mem, GPIO_GPDAT); outvals &= ~(1 << pinbit); outvals |= (value << pinbit); - bus_write_4(sc->sc_mem, 0, outvals); + bus_write_4(sc->sc_mem, GPIO_GPDAT, outvals); GPIO_UNLOCK(sc); @@ -208,7 +208,7 @@ qoriq_gpio_pin_toggle(device_t dev, uint val = bus_read_4(sc->sc_mem, GPIO_GPDAT); val ^= (1 << (31 - pin)); - bus_write_4(sc->sc_mem, 0, val); + bus_write_4(sc->sc_mem, GPIO_GPDAT, val); GPIO_UNLOCK(sc); From owner-svn-src-stable-11@freebsd.org Fri Dec 23 03:42:39 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D24EC8D253; Fri, 23 Dec 2016 03:42:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 355FC1A00; Fri, 23 Dec 2016 03:42:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3gccT008395; Fri, 23 Dec 2016 03:42:38 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3gc2W008394; Fri, 23 Dec 2016 03:42:38 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230342.uBN3gc2W008394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:42:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310449 - stable/11/sys/powerpc/powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:42:39 -0000 Author: jhibbits Date: Fri Dec 23 03:42:38 2016 New Revision: 310449 URL: https://svnweb.freebsd.org/changeset/base/310449 Log: MFC r309309,r310150: Bring the powerpc DDB disassembler into the 21st century Modified: stable/11/sys/powerpc/powerpc/db_disasm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/powerpc/db_disasm.c ============================================================================== --- stable/11/sys/powerpc/powerpc/db_disasm.c Fri Dec 23 03:35:39 2016 (r310448) +++ stable/11/sys/powerpc/powerpc/db_disasm.c Fri Dec 23 03:42:38 2016 (r310449) @@ -1,13 +1,14 @@ -/* $FreeBSD$ */ -/* $NetBSD: db_disasm.c,v 1.12 2002/01/05 22:07:26 jhawk Exp $ */ +/* $NetBSD: db_disasm.c,v 1.28 2013/07/04 23:00:23 joerg Exp $ */ /* $OpenBSD: db_disasm.c,v 1.2 1996/12/28 06:21:48 rahnds Exp $ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include #include -#include #include #include @@ -20,11 +21,13 @@ enum function_mask { Op_B = 0x00000002, Op_BI = 0x00000004, Op_BO = 0x00000008, + Op_BC = Op_BI | Op_BO, Op_CRM = 0x00000010, - Op_D = 0x00000020, /* yes, Op_S and Op_D are the same */ - Op_S = 0x00000020, - Op_FM = 0x00000040, - Op_IMM = 0x00000080, + Op_D = 0x00000020, + Op_ST = 0x00000020, /* Op_S for store-operations, same as D */ + Op_S = 0x00000040, /* S-field is swapped with A-field */ + Op_FM = Op_D | Op_S, /* kludge (reduce Op_s) */ + Op_dA = 0x00000080, Op_LK = 0x00000100, Op_Rc = 0x00000200, Op_AA = Op_LK | Op_Rc, /* kludge (reduce Op_s) */ @@ -37,10 +40,10 @@ enum function_mask { Op_const = 0x00004000, Op_SIMM = Op_const | Op_sign, Op_UIMM = Op_const, - Op_d = Op_const | Op_sign, Op_crbA = 0x00008000, Op_crbB = 0x00010000, Op_WS = Op_crbB, /* kludge, same field as crbB */ + Op_rSH = Op_crbB, /* kludge, same field as crbB */ Op_crbD = 0x00020000, Op_crfD = 0x00040000, Op_crfS = 0x00080000, @@ -50,7 +53,7 @@ enum function_mask { Op_dcr = Op_spr, /* out of bits - cheat with Op_spr */ Op_tbr = 0x00800000, - Op_L = 0x01000000, + Op_BP = 0x01000000, Op_BD = 0x02000000, Op_LI = 0x04000000, Op_C = 0x08000000, @@ -67,7 +70,7 @@ enum function_mask { }; struct opcode { - char *name; + const char *name; u_int32_t mask; u_int32_t code; enum function_mask func; @@ -78,7 +81,7 @@ typedef void (op_class_func) (instr_t, v u_int32_t extract_field(u_int32_t value, u_int32_t base, u_int32_t width); void disasm_fields(const struct opcode *popcode, instr_t instr, vm_offset_t loc, - char *disasm_str); + char *disasm_str, size_t slen); void dis_ppc(const struct opcode *opcodeset, instr_t instr, vm_offset_t loc); op_class_func op_ill, op_base; @@ -89,7 +92,7 @@ op_class_func op_cl_x3e, op_cl_x3f; op_class_func *opcodes_base[] = { /*x00*/ op_ill, op_ill, op_base, op_ill, /*x04*/ op_ill, op_ill, op_ill, op_base, -/*x08*/ op_base, op_base, op_ill, op_base, +/*x08*/ op_base, op_base, op_base, op_base, /*x0C*/ op_base, op_base, op_base/*XXX*/, op_base/*XXX*/, /*x10*/ op_base, op_base, op_base, op_cl_x13, /*x14*/ op_base, op_base, op_ill, op_base, @@ -118,14 +121,16 @@ const struct opcode opcodes[] = { { "twi", 0xfc000000, 0x0c000000, Op_TO | Op_A | Op_SIMM }, { "mulli", 0xfc000000, 0x1c000000, Op_D | Op_A | Op_SIMM }, { "subfic", 0xfc000000, 0x20000000, Op_D | Op_A | Op_SIMM }, - { "cmpli", 0xfc000000, 0x28000000, Op_crfD | Op_L | Op_A | Op_SIMM }, - { "cmpi", 0xfc000000, 0x2c000000, Op_crfD | Op_L | Op_A | Op_SIMM }, + { "cmplwi", 0xfc200000, 0x28000000, Op_crfD | Op_A | Op_SIMM }, + { "cmpldi", 0xfc200000, 0x28200000, Op_crfD | Op_A | Op_SIMM }, + { "cmpwi", 0xfc200000, 0x2c000000, Op_crfD | Op_A | Op_SIMM }, + { "cmpdi", 0xfc200000, 0x2c200000, Op_crfD | Op_A | Op_SIMM }, { "addic", 0xfc000000, 0x30000000, Op_D | Op_A | Op_SIMM }, { "addic.", 0xfc000000, 0x34000000, Op_D | Op_A | Op_SIMM }, { "addi", 0xfc000000, 0x38000000, Op_D | Op_A | Op_SIMM }, { "addis", 0xfc000000, 0x3c000000, Op_D | Op_A | Op_SIMM }, - { "bc", 0xfc000000, 0x40000000, Op_BO | Op_BI | Op_BD | Op_AA | Op_LK }, - { "sc", 0xffffffff, 0x44000002, Op_BO | Op_BI | Op_BD | Op_AA | Op_LK }, + { "b", 0xfc000000, 0x40000000, Op_BC | Op_BD | Op_AA | Op_LK }, /* bc */ + { "sc", 0xffffffff, 0x44000002, 0 }, { "b", 0xfc000000, 0x48000000, Op_LI | Op_AA | Op_LK }, { "rlwimi", 0xfc000000, 0x50000000, Op_S | Op_A | Op_SH | Op_MB | Op_ME | Op_Rc }, @@ -140,33 +145,33 @@ const struct opcode opcodes[] = { { "andi.", 0xfc000000, 0x70000000, Op_S | Op_A | Op_UIMM }, { "andis.", 0xfc000000, 0x74000000, Op_S | Op_A | Op_UIMM }, - { "lwz", 0xfc000000, 0x80000000, Op_D | Op_A | Op_d }, - { "lwzu", 0xfc000000, 0x84000000, Op_D | Op_A | Op_d }, - { "lbz", 0xfc000000, 0x88000000, Op_D | Op_A | Op_d }, - { "lbzu", 0xfc000000, 0x8c000000, Op_D | Op_A | Op_d }, - { "stw", 0xfc000000, 0x90000000, Op_S | Op_A | Op_d }, - { "stwu", 0xfc000000, 0x94000000, Op_S | Op_A | Op_d }, - { "stb", 0xfc000000, 0x98000000, Op_S | Op_A | Op_d }, - { "stbu", 0xfc000000, 0x9c000000, Op_S | Op_A | Op_d }, - - { "lhz", 0xfc000000, 0xa0000000, Op_D | Op_A | Op_d }, - { "lhzu", 0xfc000000, 0xa4000000, Op_D | Op_A | Op_d }, - { "lha", 0xfc000000, 0xa8000000, Op_D | Op_A | Op_d }, - { "lhau", 0xfc000000, 0xac000000, Op_D | Op_A | Op_d }, - { "sth", 0xfc000000, 0xb0000000, Op_S | Op_A | Op_d }, - { "sthu", 0xfc000000, 0xb4000000, Op_S | Op_A | Op_d }, - { "lmw", 0xfc000000, 0xb8000000, Op_D | Op_A | Op_d }, - { "stmw", 0xfc000000, 0xbc000000, Op_S | Op_A | Op_d }, - - { "lfs", 0xfc000000, 0xc0000000, Op_D | Op_A | Op_d }, - { "lfsu", 0xfc000000, 0xc4000000, Op_D | Op_A | Op_d }, - { "lfd", 0xfc000000, 0xc8000000, Op_D | Op_A | Op_d }, - { "lfdu", 0xfc000000, 0xcc000000, Op_D | Op_A | Op_d }, - - { "stfs", 0xfc000000, 0xd0000000, Op_S | Op_A | Op_d }, - { "stfsu", 0xfc000000, 0xd4000000, Op_S | Op_A | Op_d }, - { "stfd", 0xfc000000, 0xd8000000, Op_S | Op_A | Op_d }, - { "stfdu", 0xfc000000, 0xdc000000, Op_S | Op_A | Op_d }, + { "lwz", 0xfc000000, 0x80000000, Op_D | Op_dA }, + { "lwzu", 0xfc000000, 0x84000000, Op_D | Op_dA }, + { "lbz", 0xfc000000, 0x88000000, Op_D | Op_dA }, + { "lbzu", 0xfc000000, 0x8c000000, Op_D | Op_dA }, + { "stw", 0xfc000000, 0x90000000, Op_ST | Op_dA }, + { "stwu", 0xfc000000, 0x94000000, Op_ST | Op_dA }, + { "stb", 0xfc000000, 0x98000000, Op_ST | Op_dA }, + { "stbu", 0xfc000000, 0x9c000000, Op_ST | Op_dA }, + + { "lhz", 0xfc000000, 0xa0000000, Op_D | Op_dA }, + { "lhzu", 0xfc000000, 0xa4000000, Op_D | Op_dA }, + { "lha", 0xfc000000, 0xa8000000, Op_D | Op_dA }, + { "lhau", 0xfc000000, 0xac000000, Op_D | Op_dA }, + { "sth", 0xfc000000, 0xb0000000, Op_ST | Op_dA }, + { "sthu", 0xfc000000, 0xb4000000, Op_ST | Op_dA }, + { "lmw", 0xfc000000, 0xb8000000, Op_D | Op_dA }, + { "stmw", 0xfc000000, 0xbc000000, Op_ST | Op_dA }, + + { "lfs", 0xfc000000, 0xc0000000, Op_D | Op_dA }, + { "lfsu", 0xfc000000, 0xc4000000, Op_D | Op_dA }, + { "lfd", 0xfc000000, 0xc8000000, Op_D | Op_dA }, + { "lfdu", 0xfc000000, 0xcc000000, Op_D | Op_dA }, + + { "stfs", 0xfc000000, 0xd0000000, Op_ST | Op_dA }, + { "stfsu", 0xfc000000, 0xd4000000, Op_ST | Op_dA }, + { "stfd", 0xfc000000, 0xd8000000, Op_ST | Op_dA }, + { "stfdu", 0xfc000000, 0xdc000000, Op_ST | Op_dA }, { "", 0x0, 0x0, 0 } }; @@ -174,10 +179,10 @@ const struct opcode opcodes[] = { const struct opcode opcodes_13[] = { /* 0x13 << 2 */ { "mcrf", 0xfc0007fe, 0x4c000000, Op_crfD | Op_crfS }, - { "bclr", 0xfc0007fe, 0x4c000020, Op_BO | Op_BI | Op_LK }, + { "b", 0xfc0007fe, 0x4c000020, Op_BC | Op_LK }, /* bclr */ { "crnor", 0xfc0007fe, 0x4c000042, Op_crbD | Op_crbA | Op_crbB }, { "rfi", 0xfc0007fe, 0x4c000064, 0 }, - { "crandc", 0xfc0007fe, 0x4c000102, Op_BO | Op_BI | Op_LK }, + { "crandc", 0xfc0007fe, 0x4c000102, Op_crbD | Op_crbA | Op_crbB }, { "isync", 0xfc0007fe, 0x4c00012c, 0 }, { "crxor", 0xfc0007fe, 0x4c000182, Op_crbD | Op_crbA | Op_crbB }, { "crnand", 0xfc0007fe, 0x4c0001c2, Op_crbD | Op_crbA | Op_crbB }, @@ -185,7 +190,7 @@ const struct opcode opcodes_13[] = { { "creqv", 0xfc0007fe, 0x4c000242, Op_crbD | Op_crbA | Op_crbB }, { "crorc", 0xfc0007fe, 0x4c000342, Op_crbD | Op_crbA | Op_crbB }, { "cror", 0xfc0007fe, 0x4c000382, Op_crbD | Op_crbA | Op_crbB }, - { "bcctr", 0xfc0007fe, 0x4c000420, Op_BO | Op_BI | Op_LK }, + { "b", 0xfc0007fe, 0x4c000420, Op_BC | Op_LK }, /* bcctr */ { "", 0x0, 0x0, 0 } }; @@ -203,12 +208,16 @@ const struct opcode opcodes_1e[] = { /* 1f * 4 = 7c */ const struct opcode opcodes_1f[] = { /* 1f << 2 */ - { "cmp", 0xfc0007fe, 0x7c000000, Op_S | Op_A | Op_B | Op_me | Op_Rc }, + { "cmpw", 0xfc2007fe, 0x7c000000, Op_crfD | Op_A | Op_B }, + { "cmpd", 0xfc2007fe, 0x7c200000, Op_crfD | Op_A | Op_B }, { "tw", 0xfc0007fe, 0x7c000008, Op_TO | Op_A | Op_B }, { "subfc", 0xfc0003fe, 0x7c000010, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mulhdu", 0xfc0007fe, 0x7c000012, Op_D | Op_A | Op_B | Op_Rc }, { "addc", 0xfc0003fe, 0x7c000014, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mulhwu", 0xfc0007fe, 0x7c000016, Op_D | Op_A | Op_B | Op_Rc }, + { "isellt", 0xfc0007ff, 0x7c00001e, Op_D | Op_A | Op_B }, + { "iselgt", 0xfc0007ff, 0x7c00005e, Op_D | Op_A | Op_B }, + { "iseleq", 0xfc0007ff, 0x7c00009e, Op_D | Op_A | Op_B }, { "mfcr", 0xfc0007fe, 0x7c000026, Op_D }, { "lwarx", 0xfc0007fe, 0x7c000028, Op_D | Op_A | Op_B }, @@ -218,7 +227,8 @@ const struct opcode opcodes_1f[] = { { "cntlzw", 0xfc0007fe, 0x7c000034, Op_D | Op_A | Op_Rc }, { "sld", 0xfc0007fe, 0x7c000036, Op_D | Op_A | Op_B | Op_Rc }, { "and", 0xfc0007fe, 0x7c000038, Op_D | Op_A | Op_B | Op_Rc }, - { "cmpl", 0xfc0007fe, 0x7c000040, Op_crfD | Op_L | Op_A | Op_B }, + { "cmplw", 0xfc2007fe, 0x7c000040, Op_crfD | Op_A | Op_B }, + { "cmpld", 0xfc2007fe, 0x7c200040, Op_crfD | Op_A | Op_B }, { "subf", 0xfc0003fe, 0x7c000050, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "ldux", 0xfc0007fe, 0x7c00006a, Op_D | Op_A | Op_B }, { "dcbst", 0xfc0007fe, 0x7c00006c, Op_A | Op_B }, @@ -240,24 +250,24 @@ const struct opcode opcodes_1f[] = { { "adde", 0xfc0003fe, 0x7c000114, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mtcrf", 0xfc0007fe, 0x7c000120, Op_S | Op_CRM }, { "mtmsr", 0xfc0007fe, 0x7c000124, Op_S }, - { "stdx", 0xfc0007fe, 0x7c00012a, Op_S | Op_A | Op_B }, - { "stwcx.", 0xfc0007ff, 0x7c00012d, Op_S | Op_A | Op_B }, - { "stwx", 0xfc0007fe, 0x7c00012e, Op_S | Op_A | Op_B }, - { "wrteei", 0xfc0003fe, 0x7c000146 }, /* XXX: out of flags! */ - { "stdux", 0xfc0007fe, 0x7c00016a, Op_S | Op_A | Op_B }, - { "stwux", 0xfc0007fe, 0x7c00016e, Op_S | Op_A | Op_B }, + { "stdx", 0xfc0007fe, 0x7c00012a, Op_ST | Op_A | Op_B }, + { "stwcx.", 0xfc0007ff, 0x7c00012d, Op_ST | Op_A | Op_B }, + { "stwx", 0xfc0007fe, 0x7c00012e, Op_ST | Op_A | Op_B }, + { "wrteei", 0xfc0003fe, 0x7c000146, 0 }, /* XXX: out of flags! */ + { "stdux", 0xfc0007fe, 0x7c00016a, Op_ST | Op_A | Op_B }, + { "stwux", 0xfc0007fe, 0x7c00016e, Op_ST | Op_A | Op_B }, { "subfze", 0xfc0003fe, 0x7c000190, Op_D | Op_A | Op_OE | Op_Rc }, { "addze", 0xfc0003fe, 0x7c000194, Op_D | Op_A | Op_OE | Op_Rc }, { "mtsr", 0xfc0007fe, 0x7c0001a4, Op_S | Op_SR }, - { "stdcx.", 0xfc0007ff, 0x7c0001ad, Op_S | Op_A | Op_B }, - { "stbx", 0xfc0007fe, 0x7c0001ae, Op_S | Op_A | Op_B }, + { "stdcx.", 0xfc0007ff, 0x7c0001ad, Op_ST | Op_A | Op_B }, + { "stbx", 0xfc0007fe, 0x7c0001ae, Op_ST | Op_A | Op_B }, { "subfme", 0xfc0003fe, 0x7c0001d0, Op_D | Op_A | Op_OE | Op_Rc }, { "mulld", 0xfc0003fe, 0x7c0001d2, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "addme", 0xfc0003fe, 0x7c0001d4, Op_D | Op_A | Op_OE | Op_Rc }, { "mullw", 0xfc0003fe, 0x7c0001d6, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mtsrin", 0xfc0007fe, 0x7c0001e4, Op_S | Op_B }, { "dcbtst", 0xfc0007fe, 0x7c0001ec, Op_A | Op_B }, - { "stbux", 0xfc0007fe, 0x7c0001ee, Op_S | Op_A | Op_B }, + { "stbux", 0xfc0007fe, 0x7c0001ee, Op_ST | Op_A | Op_B }, { "add", 0xfc0003fe, 0x7c000214, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "dcbt", 0xfc0007fe, 0x7c00022c, Op_A | Op_B }, { "lhzx", 0xfc0007ff, 0x7c00022e, Op_D | Op_A | Op_B }, @@ -274,11 +284,11 @@ const struct opcode opcodes_1f[] = { { "mftb", 0xfc0007fe, 0x7c0002e6, Op_D | Op_tbr }, { "lwaux", 0xfc0007fe, 0x7c0002ea, Op_D | Op_A | Op_B }, { "lhaux", 0xfc0007fe, 0x7c0002ee, Op_D | Op_A | Op_B }, - { "sthx", 0xfc0007fe, 0x7c00032e, Op_S | Op_A | Op_B }, + { "sthx", 0xfc0007fe, 0x7c00032e, Op_ST | Op_A | Op_B }, { "orc", 0xfc0007fe, 0x7c000338, Op_S | Op_A | Op_B | Op_Rc }, - { "ecowx", 0xfc0007fe, 0x7c00036c, Op_S | Op_A | Op_B | Op_Rc }, + { "ecowx", 0xfc0007fe, 0x7c00036c, Op_ST | Op_A | Op_B | Op_Rc }, { "slbie", 0xfc0007fc, 0x7c000364, Op_B }, - { "sthux", 0xfc0007fe, 0x7c00036e, Op_S | Op_A | Op_B }, + { "sthux", 0xfc0007fe, 0x7c00036e, Op_ST | Op_A | Op_B }, { "or", 0xfc0007fe, 0x7c000378, Op_S | Op_A | Op_B | Op_Rc }, { "mtdcr", 0xfc0007fe, 0x7c000386, Op_S | Op_dcr }, { "divdu", 0xfc0003fe, 0x7c000392, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, @@ -304,27 +314,27 @@ const struct opcode opcodes_1f[] = { { "lfdx", 0xfc0007fe, 0x7c0004ae, Op_D | Op_A | Op_B }, { "lfdux", 0xfc0007fe, 0x7c0004ee, Op_D | Op_A | Op_B }, { "mfsrin", 0xfc0007fe, 0x7c000526, Op_D | Op_B }, - { "stswx", 0xfc0007fe, 0x7c00052a, Op_S | Op_A | Op_B }, - { "stwbrx", 0xfc0007fe, 0x7c00052c, Op_S | Op_A | Op_B }, - { "stfsx", 0xfc0007fe, 0x7c00052e, Op_S | Op_A | Op_B }, - { "stfsux", 0xfc0007fe, 0x7c00056e, Op_S | Op_A | Op_B }, - { "stswi", 0xfc0007fe, 0x7c0005aa, Op_S | Op_A | Op_NB }, - { "stfdx", 0xfc0007fe, 0x7c0005ae, Op_S | Op_A | Op_B }, - { "stfdux", 0xfc0007fe, 0x7c0005ee, Op_S | Op_A | Op_B }, + { "stswx", 0xfc0007fe, 0x7c00052a, Op_ST | Op_A | Op_B }, + { "stwbrx", 0xfc0007fe, 0x7c00052c, Op_ST | Op_A | Op_B }, + { "stfsx", 0xfc0007fe, 0x7c00052e, Op_ST | Op_A | Op_B }, + { "stfsux", 0xfc0007fe, 0x7c00056e, Op_ST | Op_A | Op_B }, + { "stswi", 0xfc0007fe, 0x7c0005aa, Op_ST | Op_A | Op_NB }, + { "stfdx", 0xfc0007fe, 0x7c0005ae, Op_ST | Op_A | Op_B }, + { "stfdux", 0xfc0007fe, 0x7c0005ee, Op_ST | Op_A | Op_B }, { "lhbrx", 0xfc0007fe, 0x7c00062c, Op_D | Op_A | Op_B }, { "sraw", 0xfc0007fe, 0x7c000630, Op_S | Op_A | Op_B }, { "srad", 0xfc0007fe, 0x7c000634, Op_S | Op_A | Op_B | Op_Rc }, - { "srawi", 0xfc0007fe, 0x7c000670, Op_S | Op_A | Op_B | Op_Rc }, + { "srawi", 0xfc0007fe, 0x7c000670, Op_S | Op_A | Op_rSH | Op_Rc }, { "sradi", 0xfc0007fc, 0x7c000674, Op_S | Op_A | Op_sh }, { "eieio", 0xfc0007fe, 0x7c0006ac, 0 }, { "tlbsx", 0xfc0007fe, 0x7c000724, Op_S | Op_A | Op_B | Op_Rc }, - { "sthbrx", 0xfc0007fe, 0x7c00072c, Op_S | Op_A | Op_B }, - { "extsh", 0xfc0007fe, 0x7c000734, Op_S | Op_A | Op_B | Op_Rc }, + { "sthbrx", 0xfc0007fe, 0x7c00072c, Op_ST | Op_A | Op_B }, + { "extsh", 0xfc0007fe, 0x7c000734, Op_S | Op_A | Op_Rc }, { "tlbre", 0xfc0007fe, 0x7c000764, Op_D | Op_A | Op_WS }, { "extsb", 0xfc0007fe, 0x7c000774, Op_S | Op_A | Op_Rc }, { "icbi", 0xfc0007fe, 0x7c0007ac, Op_A | Op_B }, { "tlbwe", 0xfc0007fe, 0x7c0007a4, Op_S | Op_A | Op_WS }, - { "stfiwx", 0xfc0007fe, 0x7c0007ae, Op_S | Op_A | Op_B }, + { "stfiwx", 0xfc0007fe, 0x7c0007ae, Op_ST | Op_A | Op_B }, { "extsw", 0xfc0007fe, 0x7c0007b4, Op_S | Op_A | Op_Rc }, { "dcbz", 0xfc0007fe, 0x7c0007ec, Op_A | Op_B }, { "", 0x0, 0x0, 0 } @@ -354,8 +364,8 @@ const struct opcode opcodes_3b[] = { }; /* 3e * 4 = f8 */ const struct opcode opcodes_3e[] = { - { "std", 0xfc000003, 0xf8000000, Op_S | Op_A | Op_ds }, - { "stdu", 0xfc000003, 0xf8000001, Op_S | Op_A | Op_ds }, + { "std", 0xfc000003, 0xf8000000, Op_ST | Op_A | Op_ds }, + { "stdu", 0xfc000003, 0xf8000001, Op_ST | Op_A | Op_ds }, { "", 0x0, 0x0, 0 } }; @@ -384,7 +394,7 @@ const struct opcode opcodes_3f[] = { { "mcrfs", 0xfc0007fe, 0xfc000080, Op_D | Op_B | Op_Rc }, { "mtfsb0", 0xfc0007fe, 0xfc00008c, Op_crfD | Op_Rc }, { "fmr", 0xfc0007fe, 0xfc000090, Op_D | Op_B | Op_Rc }, - { "mtfsfi", 0xfc0007fe, 0xfc00010c, Op_crfD | Op_IMM | Op_Rc }, + { "mtfsfi", 0xfc0007fe, 0xfc00010c, 0 }, /* XXX: out of flags! */ { "fnabs", 0xfc0007fe, 0xfc000110, Op_D | Op_B | Op_Rc }, { "fabs", 0xfc0007fe, 0xfc000210, Op_D | Op_B | Op_Rc }, @@ -399,10 +409,11 @@ const struct opcode opcodes_3f[] = { struct specialreg { int reg; - char *name; + const char *name; }; const struct specialreg sprregs[] = { + { 0x000, "mq" }, { 0x001, "xer" }, { 0x008, "lr" }, { 0x009, "ctr" }, @@ -412,7 +423,11 @@ const struct specialreg sprregs[] = { { 0x019, "sdr1" }, { 0x01a, "srr0" }, { 0x01b, "srr1" }, +#ifdef BOOKE_PPC4XX { 0x100, "usprg0" }, +#else + { 0x100, "vrsave" }, +#endif { 0x110, "sprg0" }, { 0x111, "sprg1" }, { 0x112, "sprg2" }, @@ -442,6 +457,22 @@ const struct specialreg sprregs[] = { { 0x21d, "dbat2l" }, { 0x21e, "dbat3u" }, { 0x21f, "dbat3l" }, + { 0x230, "ibat4u" }, + { 0x231, "ibat4l" }, + { 0x232, "ibat5u" }, + { 0x233, "ibat5l" }, + { 0x234, "ibat6u" }, + { 0x235, "ibat6l" }, + { 0x236, "ibat7u" }, + { 0x237, "ibat7l" }, + { 0x238, "dbat4u" }, + { 0x239, "dbat4l" }, + { 0x23a, "dbat5u" }, + { 0x23b, "dbat5l" }, + { 0x23c, "dbat6u" }, + { 0x23d, "dbat6l" }, + { 0x23e, "dbat7u" }, + { 0x23f, "dbat7l" }, { 0x3b0, "zpr" }, { 0x3b1, "pid" }, { 0x3b3, "ccr0" }, @@ -463,12 +494,22 @@ const struct specialreg sprregs[] = { { 0x3db, "pit" }, { 0x3de, "srr2" }, { 0x3df, "srr3" }, +#ifdef BOOKE_PPC4XX { 0x3f0, "dbsr" }, { 0x3f2, "dbcr0" }, { 0x3f4, "iac1" }, { 0x3f5, "iac2" }, { 0x3f6, "dac1" }, { 0x3f7, "dac2" }, +#else + { 0x3f0, "hid0" }, + { 0x3f1, "hid1" }, + { 0x3f2, "iabr" }, + { 0x3f3, "hid2" }, + { 0x3f5, "dabr" }, + { 0x3f6, "msscr0" }, + { 0x3f7, "msscr1" }, +#endif { 0x3f9, "l2cr" }, { 0x3fa, "dccr" }, { 0x3fb, "iccr" }, @@ -553,6 +594,11 @@ const struct specialreg dcrregs[] = { { 0, NULL } }; +static const char *condstr[8] = { + "ge", "le", "ne", "ns", "lt", "gt", "eq", "so" +}; + + void op_ill(instr_t instr, vm_offset_t loc) { @@ -570,154 +616,267 @@ const struct opcode * search_op(const st void disasm_fields(const struct opcode *popcode, instr_t instr, vm_offset_t loc, - char *disasm_str) + char *disasm_str, size_t slen) { char * pstr; enum function_mask func; + int len; + +#define ADD_LEN(s) do { \ + len = (s); \ + slen -= len; \ + pstr += len; \ + } while(0) +#define APP_PSTR(fmt, arg) ADD_LEN(snprintf(pstr, slen, (fmt), (arg))) +#define APP_PSTRS(fmt) ADD_LEN(snprintf(pstr, slen, "%s", (fmt))) pstr = disasm_str; func = popcode->func; + if (func & Op_BC) { + u_int BO, BI; + BO = extract_field(instr, 31 - 10, 5); + BI = extract_field(instr, 31 - 15, 5); + func &= ~Op_BC; + if (BO & 4) { + /* standard, no decrement */ + if (BO & 16) { + if (popcode->code == 0x40000000) { + APP_PSTRS("c"); + func |= Op_BO | Op_BI; + } + } + else { + APP_PSTRS(condstr[((BO & 8) >> 1) + (BI & 3)]); + if (BI >= 4) + func |= Op_crfS; + } + } + else { + /* decrement and branch */ + if (BO & 2) + APP_PSTRS("dz"); + else + APP_PSTRS("dnz"); + if ((BO & 24) == 0) + APP_PSTRS("f"); + else if ((BO & 24) == 8) + APP_PSTRS("t"); + else + func |= Op_BI; + } + if (popcode->code == 0x4c000020) + APP_PSTRS("lr"); + else if (popcode->code == 0x4c000420) + APP_PSTRS("ctr"); + if ((BO & 20) != 20 && (func & Op_BO) == 0) + func |= Op_BP; /* branch prediction hint */ + } if (func & Op_OE) { u_int OE; - /* also for Op_S (they are the same) */ OE = extract_field(instr, 31 - 21, 1); if (OE) { - pstr += sprintf(pstr, "o"); + APP_PSTRS("o"); } func &= ~Op_OE; } switch (func & Op_LKM) { case Op_Rc: - if (instr & 0x1) { - pstr += sprintf(pstr, "."); - } + if (instr & 0x1) + APP_PSTRS("."); break; case Op_AA: + if (instr & 0x1) + APP_PSTRS("l"); if (instr & 0x2) { - pstr += sprintf(pstr, "a"); + APP_PSTRS("a"); loc = 0; /* Absolute address */ } + break; case Op_LK: - if (instr & 0x1) { - pstr += sprintf(pstr, "l"); - } + if (instr & 0x1) + APP_PSTRS("l"); break; default: func &= ~Op_LKM; } - pstr += sprintf(pstr, "\t"); + if (func & Op_BP) { + int y; + y = (instr & 0x200000) != 0; + if (popcode->code == 0x40000000) { + int BD; + BD = extract_field(instr, 31 - 29, 14); + BD = BD << 18; + BD = BD >> 16; + BD += loc; + if ((vm_offset_t)BD < loc) + y ^= 1; + } + APP_PSTR("%c", y ? '+' : '-'); + func &= ~Op_BP; + } + APP_PSTRS("\t"); /* XXX: special cases here, out of flags in a 32bit word. */ if (strcmp(popcode->name, "wrteei") == 0) { int E; E = extract_field(instr, 31 - 16, 5); - pstr += sprintf(pstr, "%d", E); + APP_PSTR("%d", E); return; } + else if (strcmp(popcode->name, "mtfsfi") == 0) { + u_int UI; + UI = extract_field(instr, 31 - 8, 3); + APP_PSTR("crf%u, ", UI); + UI = extract_field(instr, 31 - 19, 4); + APP_PSTR("0x%x", UI); + } /* XXX: end of special cases here. */ - if (func & Op_D) { + if ((func & Op_FM) == Op_FM) { + u_int FM; + FM = extract_field(instr, 31 - 14, 8); + APP_PSTR("0x%x, ", FM); + func &= ~Op_FM; + } + if (func & Op_D) { /* Op_ST is the same */ u_int D; - /* also for Op_S (they are the same) */ D = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "r%d, ", D); + APP_PSTR("r%d, ", D); func &= ~Op_D; } if (func & Op_crbD) { u_int crbD; crbD = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "crb%d, ", crbD); + APP_PSTR("crb%d, ", crbD); func &= ~Op_crbD; } if (func & Op_crfD) { u_int crfD; crfD = extract_field(instr, 31 - 8, 3); - pstr += sprintf(pstr, "crf%d, ", crfD); + APP_PSTR("crf%d, ", crfD); func &= ~Op_crfD; } - if (func & Op_L) { - u_int L; - L = extract_field(instr, 31 - 10, 1); - if (L) { - pstr += sprintf(pstr, "L, "); - } - func &= ~Op_L; - } - if (func & Op_FM) { - u_int FM; - FM = extract_field(instr, 31 - 10, 8); - pstr += sprintf(pstr, "%d, ", FM); - func &= ~Op_FM; - } if (func & Op_TO) { u_int TO; TO = extract_field(instr, 31 - 10, 1); - pstr += sprintf(pstr, "%d, ", TO); + APP_PSTR("%d, ", TO); func &= ~Op_TO; } if (func & Op_crfS) { u_int crfS; crfS = extract_field(instr, 31 - 13, 3); - pstr += sprintf(pstr, "%d, ", crfS); + APP_PSTR("crf%d, ", crfS); func &= ~Op_crfS; } + if (func & Op_CRM) { + u_int CRM; + CRM = extract_field(instr, 31 - 19, 8); + APP_PSTR("0x%x, ", CRM); + func &= ~Op_CRM; + } if (func & Op_BO) { u_int BO; BO = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "%d, ", BO); + APP_PSTR("%d, ", BO); func &= ~Op_BO; } + if (func & Op_BI) { + u_int BI; + BI = extract_field(instr, 31 - 15, 5); + APP_PSTR("%d, ", BI); + func &= ~Op_BI; + } + if (func & Op_dA) { /* register A indirect with displacement */ + u_int A; + A = extract_field(instr, 31 - 31, 16); + if (A & 0x8000) { + APP_PSTRS("-"); + A = 0x10000-A; + } + APP_PSTR("0x%x", A); + A = extract_field(instr, 31 - 15, 5); + APP_PSTR("(r%d)", A); + func &= ~Op_dA; + } + if (func & Op_spr) { + u_int spr; + u_int sprl; + u_int sprh; + const struct specialreg *regs; + int i; + sprl = extract_field(instr, 31 - 15, 5); + sprh = extract_field(instr, 31 - 20, 5); + spr = sprh << 5 | sprl; + + /* ugly hack - out of bitfields in the function mask */ + if (popcode->name[2] == 'd') /* m.Dcr */ + regs = dcrregs; + else + regs = sprregs; + for (i = 0; regs[i].name != NULL; i++) + if (spr == regs[i].reg) + break; + if (regs[i].name == NULL) + APP_PSTR("[unknown special reg (%d)]", spr); + else + APP_PSTR("%s", regs[i].name); + + if (popcode->name[1] == 't') /* spr is destination */ + APP_PSTRS(", "); + func &= ~Op_spr; + } + if (func & Op_SR) { + u_int SR; + SR = extract_field(instr, 31 - 15, 3); + APP_PSTR("sr%d", SR); + if (popcode->name[1] == 't') /* SR is destination */ + APP_PSTRS(", "); + func &= ~Op_SR; + } if (func & Op_A) { u_int A; A = extract_field(instr, 31 - 15, 5); - pstr += sprintf(pstr, "r%d, ", A); + APP_PSTR("r%d, ", A); func &= ~Op_A; } - if (func & Op_B) { - u_int B; - B = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "r%d, ", B); - func &= ~Op_B; + if (func & Op_S) { + u_int D; + D = extract_field(instr, 31 - 10, 5); + APP_PSTR("r%d, ", D); + func &= ~Op_S; } if (func & Op_C) { u_int C; C = extract_field(instr, 31 - 25, 5); - pstr += sprintf(pstr, "r%d, ", C); + APP_PSTR("r%d, ", C); func &= ~Op_C; } - if (func & Op_BI) { - u_int BI; - BI = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "%d, ", BI); - func &= ~Op_BI; + if (func & Op_B) { + u_int B; + B = extract_field(instr, 31 - 20, 5); + APP_PSTR("r%d", B); + func &= ~Op_B; } if (func & Op_crbA) { u_int crbA; crbA = extract_field(instr, 31 - 15, 5); - pstr += sprintf(pstr, "%d, ", crbA); + APP_PSTR("%d, ", crbA); func &= ~Op_crbA; } if (func & Op_crbB) { u_int crbB; crbB = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "%d, ", crbB); + APP_PSTR("%d, ", crbB); func &= ~Op_crbB; } - if (func & Op_CRM) { - u_int CRM; - CRM = extract_field(instr, 31 - 19, 8); - pstr += sprintf(pstr, "0x%x, ", CRM); - func &= ~Op_CRM; - } if (func & Op_LI) { int LI; LI = extract_field(instr, 31 - 29, 24); - /* Need to sign extend and shift up 2, then add addr */ LI = LI << 8; LI = LI >> 6; LI += loc; - pstr += sprintf (pstr, "0x%x, ", LI); + APP_PSTR("0x%x", LI); func &= ~Op_LI; } switch (func & Op_SIMM) { @@ -725,7 +884,7 @@ disasm_fields(const struct opcode *popco case Op_SIMM: /* same as Op_d */ IMM = extract_field(instr, 31 - 31, 16); if (IMM & 0x8000) { - pstr += sprintf(pstr, "-"); + APP_PSTRS("-"); IMM = 0x10000-IMM; } func &= ~Op_SIMM; @@ -735,95 +894,74 @@ disasm_fields(const struct opcode *popco func &= ~Op_UIMM; goto common; common: - pstr += sprintf(pstr, "0x%x", IMM); + APP_PSTR("0x%x", IMM); break; default: - break; + ; } if (func & Op_BD) { - u_int BD; + int BD; BD = extract_field(instr, 31 - 29, 14); - pstr += sprintf(pstr, "0x%x, ", BD); + BD = BD << 18; + BD = BD >> 16; + BD += loc; + /* Need to sign extend and shift up 2, then add addr */ + APP_PSTR("0x%x", BD); func &= ~Op_BD; } if (func & Op_ds) { u_int ds; ds = extract_field(instr, 31 - 29, 14) << 2; - pstr += sprintf(pstr, "0x%x, ", ds); + APP_PSTR("0x%x", ds); func &= ~Op_ds; } - if (func & Op_spr) { - u_int spr; - u_int sprl; - u_int sprh; - const struct specialreg *regs; - int i; - sprl = extract_field(instr, 31 - 15, 5); - sprh = extract_field(instr, 31 - 20, 5); - spr = sprh << 5 | sprl; - - /* ugly hack - out of bitfields in the function mask */ - if (popcode->name[2] == 'd') /* m.Dcr */ - regs = dcrregs; - else - regs = sprregs; - for (i = 0; regs[i].name != NULL; i++) - if (spr == regs[i].reg) - break; - if (regs[i].reg == 0) - pstr += sprintf(pstr, "[unknown special reg (%d)]", spr); - else - pstr += sprintf(pstr, "%s", regs[i].name); - func &= ~Op_spr; - } - if (func & Op_me) { u_int me, mel, meh; mel = extract_field(instr, 31 - 25, 4); meh = extract_field(instr, 31 - 26, 1); me = meh << 4 | mel; - pstr += sprintf(pstr, ", 0x%x", me); + APP_PSTR(", 0x%x", me); func &= ~Op_me; } - if ((func & Op_MB) && (func & Op_sh_mb_sh)) { - u_int MB; - u_int ME; - MB = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, ", %d", MB); - ME = extract_field(instr, 31 - 25, 5); - pstr += sprintf(pstr, ", %d", ME); - } if ((func & Op_SH) && (func & Op_sh_mb_sh)) { u_int SH; SH = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, ", %d", SH); + APP_PSTR("%d", SH); + } + if ((func & Op_MB) && (func & Op_sh_mb_sh)) { + u_int MB; + u_int ME; + MB = extract_field(instr, 31 - 25, 5); + APP_PSTR(", %d", MB); + ME = extract_field(instr, 31 - 30, 5); + APP_PSTR(", %d", ME); } if ((func & Op_sh) && ! (func & Op_sh_mb_sh)) { u_int sh, shl, shh; shl = extract_field(instr, 31 - 19, 4); shh = extract_field(instr, 31 - 20, 1); sh = shh << 4 | shl; - pstr += sprintf(pstr, ", %d", sh); + APP_PSTR(", %d", sh); } if ((func & Op_mb) && ! (func & Op_sh_mb_sh)) { u_int mb, mbl, mbh; mbl = extract_field(instr, 31 - 25, 4); mbh = extract_field(instr, 31 - 26, 1); mb = mbh << 4 | mbl; - pstr += sprintf(pstr, ", %d", mb); + APP_PSTR(", %d", mb); } if ((func & Op_me) && ! (func & Op_sh_mb_sh)) { u_int me, mel, meh; mel = extract_field(instr, 31 - 25, 4); meh = extract_field(instr, 31 - 26, 1); me = meh << 4 | mel; - pstr += sprintf(pstr, ", %d", me); + APP_PSTR(", %d", me); } if (func & Op_tbr) { u_int tbr; u_int tbrl; u_int tbrh; - char *reg; + const char *reg; tbrl = extract_field(instr, 31 - 15, 5); tbrh = extract_field(instr, 31 - 20, 5); tbr = tbrh << 5 | tbrl; @@ -839,31 +977,22 @@ disasm_fields(const struct opcode *popco reg = NULL; } if (reg == NULL) - pstr += sprintf(pstr, ", [unknown tbr %d ]", tbr); + APP_PSTR(", [unknown tbr %d ]", tbr); else - pstr += sprintf(pstr, ", %s", reg); + APP_PSTR(", %s", reg); func &= ~Op_tbr; } - if (func & Op_SR) { - u_int SR; - SR = extract_field(instr, 31 - 15, 3); - pstr += sprintf(pstr, ", sr%d", SR); - func &= ~Op_SR; - } if (func & Op_NB) { u_int NB; NB = extract_field(instr, 31 - 20, 5); if (NB == 0) NB = 32; - pstr += sprintf(pstr, ", %d", NB); - func &= ~Op_SR; - } - if (func & Op_IMM) { - u_int IMM; - IMM = extract_field(instr, 31 - 19, 4); - pstr += sprintf(pstr, ", %d", IMM); + APP_PSTR(", %d", NB); func &= ~Op_SR; } +#undef ADD_LEN +#undef APP_PSTR +#undef APP_PSTRS } void @@ -920,14 +1049,15 @@ dis_ppc(const struct opcode *opcodeset, const struct opcode *op; int found = 0; int i; - char disasm_str[30]; + char disasm_str[80]; for (i = 0, op = &opcodeset[0]; found == 0 && op->mask != 0; i++, op = &opcodeset[i]) { if ((instr & op->mask) == op->code) { found = 1; - disasm_fields(op, instr, loc, disasm_str); + disasm_fields(op, instr, loc, disasm_str, + sizeof disasm_str); db_printf("%s%s\n", op->name, disasm_str); return; } From owner-svn-src-stable-11@freebsd.org Fri Dec 23 08:44:11 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D64C3C898B6; Fri, 23 Dec 2016 08:44:11 +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 A59901A5C; Fri, 23 Dec 2016 08:44:11 +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 uBN8iAl9033236; Fri, 23 Dec 2016 08:44:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN8iAo5033235; Fri, 23 Dec 2016 08:44:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230844.uBN8iAo5033235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 08:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310463 - stable/11/sys/modules/ioat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 08:44:11 -0000 Author: ngie Date: Fri Dec 23 08:44:10 2016 New Revision: 310463 URL: https://svnweb.freebsd.org/changeset/base/310463 Log: MFC r309521: Unbreak "make depend" with sys/modules/ioat by adding opt_ddb.h to SRCS Modified: stable/11/sys/modules/ioat/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/ioat/Makefile ============================================================================== --- stable/11/sys/modules/ioat/Makefile Fri Dec 23 08:41:28 2016 (r310462) +++ stable/11/sys/modules/ioat/Makefile Fri Dec 23 08:44:10 2016 (r310463) @@ -9,6 +9,7 @@ IOAT_SRC_PATH = ${.CURDIR}/../.. KMOD= ioat SRCS= ioat.c ioat_test.c SRCS+= device_if.h bus_if.h pci_if.h +SRCS+= opt_ddb.h CFLAGS+= -I${IOAT_SRC_PATH} From owner-svn-src-stable-11@freebsd.org Fri Dec 23 09:27:27 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28EC1C8CA51; Fri, 23 Dec 2016 09:27:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D244F14E2; Fri, 23 Dec 2016 09:27:26 +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 uBN9RQHT049776; Fri, 23 Dec 2016 09:27:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN9RQNH049775; Fri, 23 Dec 2016 09:27:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612230927.uBN9RQNH049775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Dec 2016 09:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310469 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 09:27:27 -0000 Author: kib Date: Fri Dec 23 09:27:25 2016 New Revision: 310469 URL: https://svnweb.freebsd.org/changeset/base/310469 Log: MFC r310159: Switch from stdatomic.h to atomic.h for kernel. Modified: stable/11/sys/kern/kern_event.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_event.c ============================================================================== --- stable/11/sys/kern/kern_event.c Fri Dec 23 09:10:57 2016 (r310468) +++ stable/11/sys/kern/kern_event.c Fri Dec 23 09:27:25 2016 (r310469) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -69,6 +68,7 @@ __FBSDID("$FreeBSD$"); #ifdef KTRACE #include #endif +#include #include @@ -188,7 +188,7 @@ static struct filterops user_filtops = { }; static uma_zone_t knote_zone; -static atomic_uint kq_ncallouts = ATOMIC_VAR_INIT(0); +static unsigned int kq_ncallouts = 0; static unsigned int kq_calloutmax = 4 * 1024; SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW, &kq_calloutmax, 0, "Maximum number of callouts allocated for kqueue"); @@ -672,13 +672,11 @@ filt_timerattach(struct knote *kn) if (to < 0) return (EINVAL); - ncallouts = atomic_load_explicit(&kq_ncallouts, memory_order_relaxed); do { + ncallouts = kq_ncallouts; if (ncallouts >= kq_calloutmax) return (ENOMEM); - } while (!atomic_compare_exchange_weak_explicit(&kq_ncallouts, - &ncallouts, ncallouts + 1, memory_order_relaxed, - memory_order_relaxed)); + } while (!atomic_cmpset_int(&kq_ncallouts, ncallouts, ncallouts + 1)); kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */ @@ -703,7 +701,7 @@ filt_timerdetach(struct knote *kn) callout_drain(calloutp); free(calloutp, M_KQUEUE); free(kn->kn_ptr.p_nexttime, M_KQUEUE); - old = atomic_fetch_sub_explicit(&kq_ncallouts, 1, memory_order_relaxed); + old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); kn->kn_status |= KN_DETACHED; /* knlist_remove sets it */ } From owner-svn-src-stable-11@freebsd.org Fri Dec 23 09:30:36 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ECBAC8CB86; Fri, 23 Dec 2016 09:30:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F244416B7; Fri, 23 Dec 2016 09:30:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN9UZLO050104; Fri, 23 Dec 2016 09:30:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN9UZoA050103; Fri, 23 Dec 2016 09:30:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612230930.uBN9UZoA050103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Dec 2016 09:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310470 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 09:30:36 -0000 Author: kib Date: Fri Dec 23 09:30:34 2016 New Revision: 310470 URL: https://svnweb.freebsd.org/changeset/base/310470 Log: MFC r310182: In swp_pager_meta_free_all(), fix type of the index variable. Style. Modified: stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Fri Dec 23 09:27:25 2016 (r310469) +++ stable/11/sys/vm/swap_pager.c Fri Dec 23 09:30:34 2016 (r310470) @@ -1913,30 +1913,30 @@ swp_pager_meta_free(vm_object_t object, static void swp_pager_meta_free_all(vm_object_t object) { - daddr_t index = 0; + struct swblock **pswap, *swap; + vm_pindex_t index; + daddr_t v; + int i; VM_OBJECT_ASSERT_WLOCKED(object); if (object->type != OBJT_SWAP) return; - while (object->un_pager.swp.swp_bcount) { - struct swblock **pswap; - struct swblock *swap; - + index = 0; + while (object->un_pager.swp.swp_bcount != 0) { mtx_lock(&swhash_mtx); pswap = swp_pager_hash(object, index); if ((swap = *pswap) != NULL) { - int i; - for (i = 0; i < SWAP_META_PAGES; ++i) { - daddr_t v = swap->swb_pages[i]; + v = swap->swb_pages[i]; if (v != SWAPBLK_NONE) { --swap->swb_count; swp_pager_freeswapspace(v, 1); } } if (swap->swb_count != 0) - panic("swap_pager_meta_free_all: swb_count != 0"); + panic( + "swap_pager_meta_free_all: swb_count != 0"); *pswap = swap->swb_hnext; uma_zfree(swap_zone, swap); --object->un_pager.swp.swp_bcount; From owner-svn-src-stable-11@freebsd.org Fri Dec 23 15:02:42 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B91BC8E7D0; Fri, 23 Dec 2016 15:02:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4169189; Fri, 23 Dec 2016 15:02:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNF2fTu090164; Fri, 23 Dec 2016 15:02:41 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNF2ep4090162; Fri, 23 Dec 2016 15:02:40 GMT (envelope-from des@FreeBSD.org) Message-Id: <201612231502.uBNF2ep4090162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 23 Dec 2016 15:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310479 - stable/11/lib/libutil X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 15:02:42 -0000 Author: des Date: Fri Dec 23 15:02:40 2016 New Revision: 310479 URL: https://svnweb.freebsd.org/changeset/base/310479 Log: MFH (r309269): use malloc()ed buffers instead of stack buffers Modified: stable/11/lib/libutil/gr_util.c stable/11/lib/libutil/pw_util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libutil/gr_util.c ============================================================================== --- stable/11/lib/libutil/gr_util.c Fri Dec 23 14:54:40 2016 (r310478) +++ stable/11/lib/libutil/gr_util.c Fri Dec 23 15:02:40 2016 (r310479) @@ -164,11 +164,12 @@ gr_tmp(int mfd) int gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr) { - char buf[8192], *end, *line, *p, *q, *r, t; + char *buf, *end, *line, *p, *q, *r, *tmp; struct group *fgr; const struct group *sgr; - size_t len; + size_t len, size; int eof, readlen; + char t; if (old_gr == NULL && gr == NULL) return(-1); @@ -186,6 +187,10 @@ gr_copy(int ffd, int tfd, const struct g if (sgr == NULL) sgr = gr; + /* initialize the buffer */ + if ((buf = malloc(size = 1024)) == NULL) + goto err; + eof = 0; len = 0; p = q = end = buf; @@ -199,10 +204,16 @@ gr_copy(int ffd, int tfd, const struct g if (q >= end) { if (eof) break; - if ((size_t)(q - p) >= sizeof(buf)) { - warnx("group line too long"); - errno = EINVAL; /* hack */ - goto err; + while ((size_t)(q - p) >= size) { + if ((tmp = realloc(buf, size * 2)) == NULL) { + warnx("group line too long"); + goto err; + } + p = tmp + (p - buf); + q = tmp + (q - buf); + end = tmp + (end - buf); + buf = tmp; + size = size * 2; } if (p < end) { q = memmove(buf, p, end -p); @@ -210,7 +221,7 @@ gr_copy(int ffd, int tfd, const struct g } else { p = q = end = buf; } - readlen = read(ffd, end, sizeof(buf) - (end -buf)); + readlen = read(ffd, end, size - (end - buf)); if (readlen == -1) goto err; else @@ -219,7 +230,7 @@ gr_copy(int ffd, int tfd, const struct g break; end += len; len = end - buf; - if (len < (ssize_t)sizeof(buf)) { + if (len < size) { eof = 1; if (len > 0 && buf[len -1] != '\n') ++len, *end++ = '\n'; @@ -281,7 +292,7 @@ gr_copy(int ffd, int tfd, const struct g if (write(tfd, q, end - q) != end - q) goto err; q = buf; - readlen = read(ffd, buf, sizeof(buf)); + readlen = read(ffd, buf, size); if (readlen == 0) break; else @@ -303,12 +314,12 @@ gr_copy(int ffd, int tfd, const struct g write(tfd, "\n", 1) != 1) goto err; done: - if (line != NULL) - free(line); + free(line); + free(buf); return (0); err: - if (line != NULL) - free(line); + free(line); + free(buf); return (-1); } Modified: stable/11/lib/libutil/pw_util.c ============================================================================== --- stable/11/lib/libutil/pw_util.c Fri Dec 23 14:54:40 2016 (r310478) +++ stable/11/lib/libutil/pw_util.c Fri Dec 23 15:02:40 2016 (r310479) @@ -427,11 +427,12 @@ pw_make_v7(const struct passwd *pw) int pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw) { - char buf[8192], *end, *line, *p, *q, *r, t; + char *buf, *end, *line, *p, *q, *r, *tmp; struct passwd *fpw; const struct passwd *spw; - size_t len; + size_t len, size; int eof, readlen; + char t; if (old_pw == NULL && pw == NULL) return (-1); @@ -449,6 +450,10 @@ pw_copy(int ffd, int tfd, const struct p if (spw == NULL) spw = pw; + /* initialize the buffer */ + if ((buf = malloc(size = 1024)) == NULL) + goto err; + eof = 0; len = 0; p = q = end = buf; @@ -462,10 +467,16 @@ pw_copy(int ffd, int tfd, const struct p if (q >= end) { if (eof) break; - if ((size_t)(q - p) >= sizeof(buf)) { - warnx("passwd line too long"); - errno = EINVAL; /* hack */ - goto err; + while ((size_t)(q - p) >= size) { + if ((tmp = realloc(buf, size * 2)) == NULL) { + warnx("passwd line too long"); + goto err; + } + p = tmp + (p - buf); + q = tmp + (q - buf); + end = tmp + (end - buf); + buf = tmp; + size = size * 2; } if (p < end) { q = memmove(buf, p, end - p); @@ -473,7 +484,7 @@ pw_copy(int ffd, int tfd, const struct p } else { p = q = end = buf; } - readlen = read(ffd, end, sizeof(buf) - (end - buf)); + readlen = read(ffd, end, size - (end - buf)); if (readlen == -1) goto err; else @@ -482,7 +493,7 @@ pw_copy(int ffd, int tfd, const struct p break; end += len; len = end - buf; - if (len < (ssize_t)sizeof(buf)) { + if (len < size) { eof = 1; if (len > 0 && buf[len - 1] != '\n') ++len, *end++ = '\n'; @@ -545,7 +556,7 @@ pw_copy(int ffd, int tfd, const struct p if (write(tfd, q, end - q) != end - q) goto err; q = buf; - readlen = read(ffd, buf, sizeof(buf)); + readlen = read(ffd, buf, size); if (readlen == 0) break; else @@ -567,12 +578,12 @@ pw_copy(int ffd, int tfd, const struct p write(tfd, "\n", 1) != 1) goto err; done: - if (line != NULL) - free(line); + free(line); + free(buf); return (0); err: - if (line != NULL) - free(line); + free(line); + free(buf); return (-1); } From owner-svn-src-stable-11@freebsd.org Fri Dec 23 18:25:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F28BC8ED52; Fri, 23 Dec 2016 18:25:45 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F63593C; Fri, 23 Dec 2016 18:25:45 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNIPiRK071695; Fri, 23 Dec 2016 18:25:44 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNIPiqr071692; Fri, 23 Dec 2016 18:25:44 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201612231825.uBNIPiqr071692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 23 Dec 2016 18:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310483 - in stable/11: share/man/man4 sys/conf sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 18:25:45 -0000 Author: ken Date: Fri Dec 23 18:25:43 2016 New Revision: 310483 URL: https://svnweb.freebsd.org/changeset/base/310483 Log: MFC, r310338: ------------------------------------------------------------------------ r310338 | ken | 2016-12-20 14:17:07 -0700 (Tue, 20 Dec 2016) | 37 lines Turn on FC-Tape by default in the isp(4) driver. FC-Tape provides additional link level error recovery, and is highly recommended for tape devices. It will only be turned on for a given target if the target supports it. Without this setting, we default to whatever FC-Tape setting is in NVRAM on the card. This can be overridden by setting the following loader tunable, for example for isp0: hint.isp.0.nofctape=1 sys/conf/options: Add a new kernel config option, ISP_FCTAPE_OFF, that defaults the FC-Tape configuration to off. sys/dev/isp/isp_pci.c: If ISP_FCTAPE_OFF is defined, turn off FC-Tape. Otherwise, turn it on if the card supports it. share/man/man4/isp.4: Add a description of FC-Tape to the isp(4) man page. Add descriptions of the fctape and nofctape options, as well as the ISP_FCTAPE_OFF kernel configuration option. Add the ispfw module and kernel drivers to the suggested configurations at the top of the man page so that users are less likely to leave it out. The driver works well with the included firmware, but may not work at all with whatever firmware the user has flashed on their card. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Sponsored by: Spectra Logic Modified: stable/11/share/man/man4/isp.4 stable/11/sys/conf/options stable/11/sys/dev/isp/isp_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/isp.4 ============================================================================== --- stable/11/share/man/man4/isp.4 Fri Dec 23 16:06:41 2016 (r310482) +++ stable/11/share/man/man4/isp.4 Fri Dec 23 18:25:43 2016 (r310483) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 9, 2015 +.Dd December 20, 2016 .Dt ISP 4 .Os .Sh NAME @@ -39,13 +39,15 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" .Cd "device isp" +.Cd "device ispfw" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent isp_load="YES" +ispfw_load="YES" .Ed .Sh DESCRIPTION This driver provides access to @@ -62,6 +64,30 @@ Fibre Channel supports initiator and tar utilizing Class 3 and Class 2 (2200 and later) connections. Support is available for Public and Private loops, Point-to-Point and Fabric connections. +.Pp +FC-Tape is supported on 4Gb (2400) and newer controllers. +FC-Tape is highly recommended for connections to tape drives that support +it. +It encompasses four elements from the the T-10 FCP-4 specification: +.Bl -bullet -offset indent +.It +Precise Delivery of Commands +.It +Confirmed Completion of FCP I/O Operations +.It +Retransmission of Unsuccessfully Transmitted IUs +.It +Task Retry Identification +.El +.Pp +Together these features allow for link level error recovery with tape +devices. +Without it, an initiator cannot, for instance, tell whether a tape write +command that has timed out resulted in all, part or none of the data going to +the tape drive. +FC-Tape is automatically enabled when connecting controller that supports +it to a target that supports it. +It may be disabled using configuration and hint options described below. .Sh FIRMWARE Firmware loading is supported if the .Xr ispfw 4 @@ -120,6 +146,13 @@ Target mode support for Fibre Channel ad .Cd options ISP_TARGET_MODE .Pp option. +.Pp +To disable FC-Tape, use the following configuration option: +.Pp +.Cd options ISP_FCTAPE_OFF +.Pp +Note that even if the ISP_FCTAPE_OFF option is used, it may be overridden +by the fctape hint described below. .Sh BOOT OPTIONS The following options are switchable by setting values in .Pa /boot/device.hints . @@ -169,6 +202,11 @@ A hint value for a driver debug level (s for the values. .It Va hint.isp.0.vports A hint to create specified number of additional virtual ports. +.It Va hint.isp.0.nofctape +Set this to 1 to disable FC-Tape operation on the given isp instance. +.It Va hint.isp.0.fctape +Set this to 1 to enable FC-Tape operation on the given isp instance for +targets that support it. .El .Sh SYSCTL OPTIONS .Bl -tag -width indent Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Fri Dec 23 16:06:41 2016 (r310482) +++ stable/11/sys/conf/options Fri Dec 23 18:25:43 2016 (r310483) @@ -381,6 +381,7 @@ ISP_TARGET_MODE opt_isp.h ISP_FW_CRASH_DUMP opt_isp.h ISP_DEFAULT_ROLES opt_isp.h ISP_INTERNAL_TARGET opt_isp.h +ISP_FCTAPE_OFF opt_isp.h # Options used only in dev/iscsi ISCSI_INITIATOR_DEBUG opt_iscsi_initiator.h Modified: stable/11/sys/dev/isp/isp_pci.c ============================================================================== --- stable/11/sys/dev/isp/isp_pci.c Fri Dec 23 16:06:41 2016 (r310482) +++ stable/11/sys/dev/isp/isp_pci.c Fri Dec 23 18:25:43 2016 (r310483) @@ -598,11 +598,18 @@ isp_get_specific_options(device_t dev, i } } +#ifdef ISP_FCTAPE_OFF + isp->isp_confopts |= ISP_CFG_NOFCTAPE; +#else + isp->isp_confopts |= ISP_CFG_FCTAPE; +#endif + tval = 0; snprintf(name, sizeof(name), "%snofctape", prefix); (void) resource_int_value(device_get_name(dev), device_get_unit(dev), name, &tval); if (tval) { + isp->isp_confopts &= ~ISP_CFG_FCTAPE; isp->isp_confopts |= ISP_CFG_NOFCTAPE; } From owner-svn-src-stable-11@freebsd.org Fri Dec 23 19:28:16 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F259DC8D053; Fri, 23 Dec 2016 19:28:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B353CA91; Fri, 23 Dec 2016 19:28:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNJSFYi095999; Fri, 23 Dec 2016 19:28:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNJSFGT095997; Fri, 23 Dec 2016 19:28:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612231928.uBNJSFGT095997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 19:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310485 - in stable: 10/sys/amd64/amd64 10/sys/i386/i386 11/sys/amd64/amd64 11/sys/i386/i386 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 19:28:17 -0000 Author: jhb Date: Fri Dec 23 19:28:15 2016 New Revision: 310485 URL: https://svnweb.freebsd.org/changeset/base/310485 Log: MFC 308820,308821: Fixes for fatal page faults on x86. 308820: Report page faults due to reserved bits in PTEs as a separate fault type. Rather than reporting a page fault due to a bad PTE as a protection violation with the "rsv" flag, treat these faults as a separate type of fault altogether. 308821: MFamd64: Various fatal page fault fixes. - If a page fault is triggered due to reserved bits in a PTE, treat it as a fatal fault and panic. - If PG_NX is in use, report whether a fatal page fault is due to an instruction fetch or a data access. - If a fatal page fault is due to reserved bits in a PTE, report that as the page fault type rather than a protection violation. Modified: stable/11/sys/amd64/amd64/trap.c stable/11/sys/i386/i386/trap.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/amd64/amd64/trap.c stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Fri Dec 23 18:29:10 2016 (r310484) +++ stable/11/sys/amd64/amd64/trap.c Fri Dec 23 19:28:15 2016 (r310485) @@ -761,11 +761,11 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%lx\n", eva); - printf("fault code = %s %s %s%s, %s\n", + printf("fault code = %s %s %s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", code & PGEX_I ? "instruction" : "data", - code & PGEX_RSV ? " rsv" : "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%lx:0x%lx\n", Modified: stable/11/sys/i386/i386/trap.c ============================================================================== --- stable/11/sys/i386/i386/trap.c Fri Dec 23 18:29:10 2016 (r310484) +++ stable/11/sys/i386/i386/trap.c Fri Dec 23 19:28:15 2016 (r310485) @@ -857,6 +857,14 @@ trap_pfault(frame, usermode, eva) } /* + * If the trap was caused by errant bits in the PTE then panic. + */ + if (frame->tf_err & PGEX_RSV) { + trap_fatal(frame, eva); + return (-1); + } + + /* * PGEX_I is defined only if the execute disable bit capability is * supported and enabled. */ @@ -926,9 +934,15 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%x\n", eva); - printf("fault code = %s %s, %s\n", + printf("fault code = %s %s%s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", +#if defined(PAE) || defined(PAE_TABLES) + pg_nx != 0 ? + (code & PGEX_I ? " instruction" : " data") : +#endif + "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%x:0x%x\n", From owner-svn-src-stable-11@freebsd.org Fri Dec 23 19:42:19 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C7DCC8D620; Fri, 23 Dec 2016 19:42:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F05B8164E; Fri, 23 Dec 2016 19:42:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNJgIpQ003681; Fri, 23 Dec 2016 19:42:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNJgIbo003680; Fri, 23 Dec 2016 19:42:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612231942.uBNJgIbo003680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 19:42:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310487 - in stable: 10/sys/dev/acpica 11/sys/dev/acpica X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 19:42:19 -0000 Author: jhb Date: Fri Dec 23 19:42:17 2016 New Revision: 310487 URL: https://svnweb.freebsd.org/changeset/base/310487 Log: MFC 309588: Don't attach to Host-PCI bridges with a bad bus number. If the bus number assigned to a Host-PCI bridge doesn't match the first bus number in the associated producer range from _CRS, print a warning and fail to attach rather than panicking due to an assertion failure. At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge device in the ACPI namespace that seems to correspond to the I/O hub in the second socket of a two-socket machine. However, the BIOS doesn't configure the settings for this "ghost" bridge correctly, nor does it have any PCI devices behind it. Modified: stable/11/sys/dev/acpica/acpi_pcib_acpi.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/acpica/acpi_pcib_acpi.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_pcib_acpi.c Fri Dec 23 19:30:14 2016 (r310486) +++ stable/11/sys/dev/acpica/acpi_pcib_acpi.c Fri Dec 23 19:42:17 2016 (r310487) @@ -488,10 +488,17 @@ acpi_pcib_acpi_attach(device_t dev) pci_domain_release_bus(sc->ap_segment, dev, rid, bus_res); } } else { -#ifdef INVARIANTS - if (first_decoded_bus(sc, &start) == 0) - KASSERT(start == sc->ap_bus, ("bus number mismatch")); -#endif + /* + * Require the bus number from _BBN to match the start of any + * decoded range. + */ + if (first_decoded_bus(sc, &start) == 0 && sc->ap_bus != start) { + device_printf(dev, + "bus number %d does not match start of decoded range %ju\n", + sc->ap_bus, (uintmax_t)start); + pcib_host_res_free(dev, &sc->ap_host_res); + return (ENXIO); + } } #else /* @@ -514,6 +521,9 @@ acpi_pcib_acpi_attach(device_t dev) if (device_add_child(dev, "pci", -1) == NULL) { device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + pcib_host_res_free(dev, &sc->ap_host_res); +#endif return (ENXIO); } return (bus_generic_attach(dev)); From owner-svn-src-stable-11@freebsd.org Fri Dec 23 22:42:16 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E17C8E54B; Fri, 23 Dec 2016 22:42:16 +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 ECE9015A5; Fri, 23 Dec 2016 22:42:15 +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 uBNMgF8x077260; Fri, 23 Dec 2016 22:42:15 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNMgEdt077255; Fri, 23 Dec 2016 22:42:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201612232242.uBNMgEdt077255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 23 Dec 2016 22:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310490 - in stable: 10/contrib/amd 10/contrib/amd/amd 10/contrib/amd/amq 10/contrib/amd/conf/checkmount 10/contrib/amd/conf/mtab 10/contrib/amd/conf/nfs_prot 10/contrib/amd/conf/transp... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 22:42:16 -0000 Author: cy Date: Fri Dec 23 22:42:14 2016 New Revision: 310490 URL: https://svnweb.freebsd.org/changeset/base/310490 Log: MFC r308493, r308619: Update amd from am-utils 6.1.5 to 6.2. Used extensively on my network over the past ten weeks. Reviewed by: pfg, brooks Suggested by: pfg Obtained from: ftp://ftp.am-utils.org/pub/am-utils/ Relnotes: yes Differential Revision: D8405 Added: stable/11/contrib/amd/amd/info_sun.c - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c stable/11/contrib/amd/amd/ops_ext.c - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c stable/11/contrib/amd/amd/ops_lustre.c - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c stable/11/contrib/amd/amd/ops_nfs4.c - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c stable/11/contrib/amd/amd/ops_udf.c - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c stable/11/contrib/amd/amd/sun2amd.8 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8 stable/11/contrib/amd/amd/sun2amd.c - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c stable/11/contrib/amd/amd/sun_map.c - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c stable/11/contrib/amd/amd/sun_map.h - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h stable/11/contrib/amd/amd/sun_map_parse.y - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y stable/11/contrib/amd/amd/sun_map_tok.l - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l stable/11/contrib/amd/amd/test1.sh - copied unchanged from r308493, head/contrib/amd/amd/test1.sh stable/11/contrib/amd/fsinfo/null_gram.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c stable/11/contrib/amd/fsinfo/null_gram.h - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h stable/11/contrib/amd/fsinfo/null_gram.y - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y stable/11/contrib/amd/fsinfo/null_lex.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c stable/11/contrib/amd/fsinfo/null_lex.l - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l stable/11/contrib/amd/include/nfs_common.h - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h Modified: stable/11/contrib/amd/AUTHORS stable/11/contrib/amd/BUGS stable/11/contrib/amd/COPYING stable/11/contrib/amd/ChangeLog stable/11/contrib/amd/FAQ stable/11/contrib/amd/INSTALL stable/11/contrib/amd/MIRRORS.html stable/11/contrib/amd/MIRRORS.txt stable/11/contrib/amd/NEWS stable/11/contrib/amd/README stable/11/contrib/amd/README.attrcache stable/11/contrib/amd/README.ldap stable/11/contrib/amd/README.y2k stable/11/contrib/amd/amd/am_ops.c stable/11/contrib/amd/amd/amd.8 stable/11/contrib/amd/amd/amd.c stable/11/contrib/amd/amd/amd.h stable/11/contrib/amd/amd/amfs_auto.c stable/11/contrib/amd/amd/amfs_direct.c stable/11/contrib/amd/amd/amfs_error.c stable/11/contrib/amd/amd/amfs_generic.c stable/11/contrib/amd/amd/amfs_host.c stable/11/contrib/amd/amd/amfs_link.c stable/11/contrib/amd/amd/amfs_linkx.c stable/11/contrib/amd/amd/amfs_nfsl.c stable/11/contrib/amd/amd/amfs_nfsx.c stable/11/contrib/amd/amd/amfs_program.c stable/11/contrib/amd/amd/amfs_root.c stable/11/contrib/amd/amd/amfs_toplvl.c stable/11/contrib/amd/amd/amfs_union.c stable/11/contrib/amd/amd/amq_subr.c stable/11/contrib/amd/amd/amq_svc.c stable/11/contrib/amd/amd/autil.c stable/11/contrib/amd/amd/clock.c stable/11/contrib/amd/amd/conf.c stable/11/contrib/amd/amd/conf_parse.y stable/11/contrib/amd/amd/conf_tok.l stable/11/contrib/amd/amd/get_args.c stable/11/contrib/amd/amd/info_exec.c stable/11/contrib/amd/amd/info_file.c stable/11/contrib/amd/amd/info_hesiod.c stable/11/contrib/amd/amd/info_ldap.c stable/11/contrib/amd/amd/info_ndbm.c stable/11/contrib/amd/amd/info_nis.c stable/11/contrib/amd/amd/info_nisplus.c stable/11/contrib/amd/amd/info_passwd.c stable/11/contrib/amd/amd/info_union.c stable/11/contrib/amd/amd/map.c stable/11/contrib/amd/amd/mapc.c stable/11/contrib/amd/amd/mntfs.c stable/11/contrib/amd/amd/nfs_prot_svc.c stable/11/contrib/amd/amd/nfs_start.c stable/11/contrib/amd/amd/nfs_subr.c stable/11/contrib/amd/amd/ops_TEMPLATE.c stable/11/contrib/amd/amd/ops_cachefs.c stable/11/contrib/amd/amd/ops_cdfs.c stable/11/contrib/amd/amd/ops_efs.c stable/11/contrib/amd/amd/ops_lofs.c stable/11/contrib/amd/amd/ops_mfs.c stable/11/contrib/amd/amd/ops_nfs.c stable/11/contrib/amd/amd/ops_nfs3.c stable/11/contrib/amd/amd/ops_nullfs.c stable/11/contrib/amd/amd/ops_pcfs.c stable/11/contrib/amd/amd/ops_tfs.c stable/11/contrib/amd/amd/ops_tmpfs.c stable/11/contrib/amd/amd/ops_ufs.c stable/11/contrib/amd/amd/ops_umapfs.c stable/11/contrib/amd/amd/ops_unionfs.c stable/11/contrib/amd/amd/ops_xfs.c stable/11/contrib/amd/amd/opts.c stable/11/contrib/amd/amd/readdir.c stable/11/contrib/amd/amd/restart.c stable/11/contrib/amd/amd/rpc_fwd.c stable/11/contrib/amd/amd/sched.c stable/11/contrib/amd/amd/srvr_amfs_auto.c stable/11/contrib/amd/amd/srvr_nfs.c stable/11/contrib/amd/amq/amq.8 stable/11/contrib/amd/amq/amq.c stable/11/contrib/amd/amq/amq.h stable/11/contrib/amd/amq/amq_clnt.c stable/11/contrib/amd/amq/amq_xdr.c stable/11/contrib/amd/amq/pawd.1 stable/11/contrib/amd/amq/pawd.c stable/11/contrib/amd/bootstrap stable/11/contrib/amd/conf/checkmount/checkmount_bsd44.c stable/11/contrib/amd/conf/mtab/mtab_bsd.c stable/11/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h stable/11/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h stable/11/contrib/amd/conf/transp/transp_sockets.c stable/11/contrib/amd/conf/umount/umount_bsd44.c stable/11/contrib/amd/doc/am-utils.texi stable/11/contrib/amd/doc/stamp-vti stable/11/contrib/amd/doc/texinfo.tex stable/11/contrib/amd/doc/version.texi stable/11/contrib/amd/fixmount/fixmount.8 stable/11/contrib/amd/fixmount/fixmount.c stable/11/contrib/amd/fsinfo/fsi_analyze.c stable/11/contrib/amd/fsinfo/fsi_data.h stable/11/contrib/amd/fsinfo/fsi_dict.c stable/11/contrib/amd/fsinfo/fsi_gram.y stable/11/contrib/amd/fsinfo/fsi_lex.l stable/11/contrib/amd/fsinfo/fsi_util.c stable/11/contrib/amd/fsinfo/fsinfo.8 stable/11/contrib/amd/fsinfo/fsinfo.c stable/11/contrib/amd/fsinfo/fsinfo.h stable/11/contrib/amd/fsinfo/wr_atab.c stable/11/contrib/amd/fsinfo/wr_bparam.c stable/11/contrib/amd/fsinfo/wr_dumpset.c stable/11/contrib/amd/fsinfo/wr_exportfs.c stable/11/contrib/amd/fsinfo/wr_fstab.c stable/11/contrib/amd/hlfsd/hlfsd.8 stable/11/contrib/amd/hlfsd/hlfsd.c stable/11/contrib/amd/hlfsd/hlfsd.h stable/11/contrib/amd/hlfsd/homedir.c stable/11/contrib/amd/hlfsd/nfs_prot_svc.c stable/11/contrib/amd/hlfsd/stubs.c stable/11/contrib/amd/include/am_compat.h stable/11/contrib/amd/include/am_defs.h stable/11/contrib/amd/include/am_utils.h stable/11/contrib/amd/include/am_xdr_func.h stable/11/contrib/amd/include/amq_defs.h stable/11/contrib/amd/include/mount_headers1.h stable/11/contrib/amd/include/mount_headers2.h stable/11/contrib/amd/ldap-id.ms stable/11/contrib/amd/ldap-id.txt stable/11/contrib/amd/libamu/amu.h stable/11/contrib/amd/libamu/hasmntopt.c stable/11/contrib/amd/libamu/misc_rpc.c stable/11/contrib/amd/libamu/mount_fs.c stable/11/contrib/amd/libamu/mtab.c stable/11/contrib/amd/libamu/nfs_prot_xdr.c stable/11/contrib/amd/libamu/strerror.c stable/11/contrib/amd/libamu/strutil.c stable/11/contrib/amd/libamu/wire.c stable/11/contrib/amd/libamu/xdr_func.c stable/11/contrib/amd/libamu/xutil.c stable/11/contrib/amd/mk-amd-map/mk-amd-map.8 stable/11/contrib/amd/mk-amd-map/mk-amd-map.c stable/11/contrib/amd/scripts/amd.conf-sample stable/11/contrib/amd/scripts/amd.conf.5 stable/11/contrib/amd/scripts/automount2amd.8 stable/11/contrib/amd/scripts/fixrmtab.in stable/11/contrib/amd/vers.m4 stable/11/contrib/amd/wire-test/wire-test.8 stable/11/contrib/amd/wire-test/wire-test.c stable/11/usr.sbin/amd/amd/Makefile stable/11/usr.sbin/amd/fsinfo/Makefile stable/11/usr.sbin/amd/include/config.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/10/contrib/amd/amd/info_sun.c - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c stable/10/contrib/amd/amd/ops_ext.c - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c stable/10/contrib/amd/amd/ops_lustre.c - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c stable/10/contrib/amd/amd/ops_nfs4.c - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c stable/10/contrib/amd/amd/ops_udf.c - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c stable/10/contrib/amd/amd/sun2amd.8 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8 stable/10/contrib/amd/amd/sun2amd.c - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c stable/10/contrib/amd/amd/sun_map.c - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c stable/10/contrib/amd/amd/sun_map.h - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h stable/10/contrib/amd/amd/sun_map_parse.y - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y stable/10/contrib/amd/amd/sun_map_tok.l - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l stable/10/contrib/amd/amd/test1.sh - copied unchanged from r308493, head/contrib/amd/amd/test1.sh stable/10/contrib/amd/fsinfo/null_gram.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c stable/10/contrib/amd/fsinfo/null_gram.h - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h stable/10/contrib/amd/fsinfo/null_gram.y - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y stable/10/contrib/amd/fsinfo/null_lex.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c stable/10/contrib/amd/fsinfo/null_lex.l - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l stable/10/contrib/amd/include/nfs_common.h - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h Modified: stable/10/contrib/amd/AUTHORS stable/10/contrib/amd/BUGS stable/10/contrib/amd/COPYING stable/10/contrib/amd/ChangeLog stable/10/contrib/amd/FAQ stable/10/contrib/amd/INSTALL stable/10/contrib/amd/MIRRORS.html stable/10/contrib/amd/MIRRORS.txt stable/10/contrib/amd/NEWS stable/10/contrib/amd/README stable/10/contrib/amd/README.attrcache stable/10/contrib/amd/README.ldap stable/10/contrib/amd/README.y2k stable/10/contrib/amd/amd/am_ops.c stable/10/contrib/amd/amd/amd.8 stable/10/contrib/amd/amd/amd.c stable/10/contrib/amd/amd/amd.h stable/10/contrib/amd/amd/amfs_auto.c stable/10/contrib/amd/amd/amfs_direct.c stable/10/contrib/amd/amd/amfs_error.c stable/10/contrib/amd/amd/amfs_generic.c stable/10/contrib/amd/amd/amfs_host.c stable/10/contrib/amd/amd/amfs_link.c stable/10/contrib/amd/amd/amfs_linkx.c stable/10/contrib/amd/amd/amfs_nfsl.c stable/10/contrib/amd/amd/amfs_nfsx.c stable/10/contrib/amd/amd/amfs_program.c stable/10/contrib/amd/amd/amfs_root.c stable/10/contrib/amd/amd/amfs_toplvl.c stable/10/contrib/amd/amd/amfs_union.c stable/10/contrib/amd/amd/amq_subr.c stable/10/contrib/amd/amd/amq_svc.c stable/10/contrib/amd/amd/autil.c stable/10/contrib/amd/amd/clock.c stable/10/contrib/amd/amd/conf.c stable/10/contrib/amd/amd/conf_parse.y stable/10/contrib/amd/amd/conf_tok.l stable/10/contrib/amd/amd/get_args.c stable/10/contrib/amd/amd/info_exec.c stable/10/contrib/amd/amd/info_file.c stable/10/contrib/amd/amd/info_hesiod.c stable/10/contrib/amd/amd/info_ldap.c stable/10/contrib/amd/amd/info_ndbm.c stable/10/contrib/amd/amd/info_nis.c stable/10/contrib/amd/amd/info_nisplus.c stable/10/contrib/amd/amd/info_passwd.c stable/10/contrib/amd/amd/info_union.c stable/10/contrib/amd/amd/map.c stable/10/contrib/amd/amd/mapc.c stable/10/contrib/amd/amd/mntfs.c stable/10/contrib/amd/amd/nfs_prot_svc.c stable/10/contrib/amd/amd/nfs_start.c stable/10/contrib/amd/amd/nfs_subr.c stable/10/contrib/amd/amd/ops_TEMPLATE.c stable/10/contrib/amd/amd/ops_cachefs.c stable/10/contrib/amd/amd/ops_cdfs.c stable/10/contrib/amd/amd/ops_efs.c stable/10/contrib/amd/amd/ops_lofs.c stable/10/contrib/amd/amd/ops_mfs.c stable/10/contrib/amd/amd/ops_nfs.c stable/10/contrib/amd/amd/ops_nfs3.c stable/10/contrib/amd/amd/ops_nullfs.c stable/10/contrib/amd/amd/ops_pcfs.c stable/10/contrib/amd/amd/ops_tfs.c stable/10/contrib/amd/amd/ops_tmpfs.c stable/10/contrib/amd/amd/ops_ufs.c stable/10/contrib/amd/amd/ops_umapfs.c stable/10/contrib/amd/amd/ops_unionfs.c stable/10/contrib/amd/amd/ops_xfs.c stable/10/contrib/amd/amd/opts.c stable/10/contrib/amd/amd/readdir.c stable/10/contrib/amd/amd/restart.c stable/10/contrib/amd/amd/rpc_fwd.c stable/10/contrib/amd/amd/sched.c stable/10/contrib/amd/amd/srvr_amfs_auto.c stable/10/contrib/amd/amd/srvr_nfs.c stable/10/contrib/amd/amq/amq.8 stable/10/contrib/amd/amq/amq.c stable/10/contrib/amd/amq/amq.h stable/10/contrib/amd/amq/amq_clnt.c stable/10/contrib/amd/amq/amq_xdr.c stable/10/contrib/amd/amq/pawd.1 stable/10/contrib/amd/amq/pawd.c stable/10/contrib/amd/bootstrap stable/10/contrib/amd/conf/checkmount/checkmount_bsd44.c stable/10/contrib/amd/conf/mtab/mtab_bsd.c stable/10/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h stable/10/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h stable/10/contrib/amd/conf/transp/transp_sockets.c stable/10/contrib/amd/conf/umount/umount_bsd44.c stable/10/contrib/amd/doc/am-utils.texi stable/10/contrib/amd/doc/stamp-vti stable/10/contrib/amd/doc/texinfo.tex stable/10/contrib/amd/doc/version.texi stable/10/contrib/amd/fixmount/fixmount.8 stable/10/contrib/amd/fixmount/fixmount.c stable/10/contrib/amd/fsinfo/fsi_analyze.c stable/10/contrib/amd/fsinfo/fsi_data.h stable/10/contrib/amd/fsinfo/fsi_dict.c stable/10/contrib/amd/fsinfo/fsi_gram.y stable/10/contrib/amd/fsinfo/fsi_lex.l stable/10/contrib/amd/fsinfo/fsi_util.c stable/10/contrib/amd/fsinfo/fsinfo.8 stable/10/contrib/amd/fsinfo/fsinfo.c stable/10/contrib/amd/fsinfo/fsinfo.h stable/10/contrib/amd/fsinfo/wr_atab.c stable/10/contrib/amd/fsinfo/wr_bparam.c stable/10/contrib/amd/fsinfo/wr_dumpset.c stable/10/contrib/amd/fsinfo/wr_exportfs.c stable/10/contrib/amd/fsinfo/wr_fstab.c stable/10/contrib/amd/hlfsd/hlfsd.8 stable/10/contrib/amd/hlfsd/hlfsd.c stable/10/contrib/amd/hlfsd/hlfsd.h stable/10/contrib/amd/hlfsd/homedir.c stable/10/contrib/amd/hlfsd/nfs_prot_svc.c stable/10/contrib/amd/hlfsd/stubs.c stable/10/contrib/amd/include/am_compat.h stable/10/contrib/amd/include/am_defs.h stable/10/contrib/amd/include/am_utils.h stable/10/contrib/amd/include/am_xdr_func.h stable/10/contrib/amd/include/amq_defs.h stable/10/contrib/amd/include/mount_headers1.h stable/10/contrib/amd/include/mount_headers2.h stable/10/contrib/amd/ldap-id.ms stable/10/contrib/amd/ldap-id.txt stable/10/contrib/amd/libamu/amu.h stable/10/contrib/amd/libamu/hasmntopt.c stable/10/contrib/amd/libamu/misc_rpc.c stable/10/contrib/amd/libamu/mount_fs.c stable/10/contrib/amd/libamu/mtab.c stable/10/contrib/amd/libamu/nfs_prot_xdr.c stable/10/contrib/amd/libamu/strerror.c stable/10/contrib/amd/libamu/strutil.c stable/10/contrib/amd/libamu/wire.c stable/10/contrib/amd/libamu/xdr_func.c stable/10/contrib/amd/libamu/xutil.c stable/10/contrib/amd/mk-amd-map/mk-amd-map.8 stable/10/contrib/amd/mk-amd-map/mk-amd-map.c stable/10/contrib/amd/scripts/amd.conf-sample stable/10/contrib/amd/scripts/amd.conf.5 stable/10/contrib/amd/scripts/automount2amd.8 stable/10/contrib/amd/scripts/fixrmtab.in stable/10/contrib/amd/vers.m4 stable/10/contrib/amd/wire-test/wire-test.8 stable/10/contrib/amd/wire-test/wire-test.c stable/10/usr.sbin/amd/amd/Makefile stable/10/usr.sbin/amd/fsinfo/Makefile stable/10/usr.sbin/amd/include/config.h Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/amd/AUTHORS ============================================================================== --- stable/11/contrib/amd/AUTHORS Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/AUTHORS Fri Dec 23 22:42:14 2016 (r310490) @@ -6,22 +6,22 @@ This file lists the ones who contributed particular order, and I thank them all. This is of course not to diminish the smaller contributes of the many others. Thank you all. -* Erez Zadok +* Erez Zadok The most significant changes were made by Erez Zadok in terms of bug fixes, ports, and new features added. Erez Zadok is the current maintainer of am-utils, as of January 1997. -* Ion Badulescu +* Ion Badulescu Co-maintainer of am-utils since late 1999: Linux and Solaris autofs support, Linux NFSv3 support, major code reorganization, etc... -* Randall S. Winchester +* Randall S. Winchester May 7, 1997: contributed a special version of upl102 that included NFS V.3 support. Some of the code was contributed by Christos Zoulas -. I (Erez) ported these changes to am-utils. +. I (Erez) ported these changes to am-utils. September 12, 1997: lots of small prototype cleanups and fixes to numerous files. @@ -35,12 +35,12 @@ February 1, 1998: fixes for NetBSD to be September 4, 1999: assorted fixes for NetBSD 1.4+. -* Hannes Reinecke +* Hannes Reinecke Back in 1995, contributed code for linux. A new parser for file system specific options that only exist under linux. -* Leif Johansson +* Leif Johansson June 22, 1997: minor patch to ensure that systems without an RE library work. @@ -52,7 +52,7 @@ functions. Contributed scripts/amd2ldif August 4, 1997: info_ldap.c fixes and adding two new amd.conf ldap variables: ldap_cache_seconds and ldap_cache_maxmem. -* Andreas Stolcke +* Andreas Stolcke June 22, 1997: patches to ensure that proto= and vers= options work properly in mount tables and can be overridden. Later on, more code @@ -68,11 +68,11 @@ message. December 19, 1997: detected an FMR (Free Memory Read) in amd/mntfs.c, uninit_mntfs(). -* Danny Braniss +* Danny Braniss July, 6 1997: contributed patches to hesiod on bsdi3. -* Tom Schmidt +* Tom Schmidt July 10, 1997: Recommdation to include libgdbm if libc has no dbm_open. Patches for netgrp(host) command. Mods to aux/config.guess to recognize @@ -86,7 +86,7 @@ IFF_ROUTE instead of IFF_LOOPBACK. May 30, 2000: correct logging types for addopts/mergeopts messages. -* Daniel S. Riley +* Daniel S. Riley July 11, 1997: fixes to DU-4.0 to support string POSIX.1 signals, and struct sockaddr with sa_len field. @@ -99,15 +99,15 @@ grpid, nosuid, and actimo. August 15, 1998: fix memory leak in processing of /defaults, and avoid accessing uninitialized memory in osf1. -* Roman Hodek +* Roman Hodek July 23, 1997: Got lots of patches from the Debian Linux folks, who fixed several generic bugs, and one serious one for Linux. The latter involved using connected sockets for NFS mounts on kernels 1.3.10 and older. Roman's -work is baed on amd-upl102, and work from Ian Murdock -and Dominik Kubla . +work is baed on amd-upl102, and work from Ian Murdock +and Dominik Kubla . -* Rainer Orth +* Rainer Orth August 6, 1997: assorted fixes to support hesiod-1.3, solaris 2.4 (which I already fixed but did not release yet), and support for $LDFLAGS at @@ -132,34 +132,34 @@ mount tables in Solaris 8. February 9, 2000: new debug options hrtime (hi-res timer) and xdrtrace. bug fixes. -* Jason Thorpe +* Jason Thorpe August 25, 1997: make amd work when talking to NIS+ servers in NIS compatibility mode. Fix originally came from Matthieu Herrb -. +. -* Chris Metcalf +* Chris Metcalf August 29, 1997: patch to make amd use FQHN for NFS/RPC authentication, useful esp. for cross-domain NFS mounts. September 2, 1997: if plock() succeeded, don't display errno string. -* Enami Tsugutomo +* Enami Tsugutomo September 4, 1997: don't ping remote servers with NFS V.3 always, but V.2, regardless of client's NFS version. (conf/transp/transp_sockets.c) -* Dan Riley +* Dan Riley September 19, 1997: make sure that amd works with more secure portmappers that do not allow forwarding of RPC messages to other services. -* Wolfgang Rupprecht +* Wolfgang Rupprecht August 10, 1997: netbsd and other bsd systems have a mask flag for pcfs_args (msdos mount). -* Christos Zoulas +* Christos Zoulas September 25, 1997: fix to initialize uid/gid fields of pcfs_args_t on netbsd. @@ -181,7 +181,7 @@ TLI implementations. Patch to print ver options had been initialized, so we can print domain, host, and hostd. Linux patch to use umount2(2) if umount(2) fails. -* Bill Paul +* Bill Paul November 5, 1997: NFS v.3 support for AIX 4.2.1, which does *not* include headers for this. Bill had to guess at the right structures, field names, @@ -189,26 +189,26 @@ sizes, alignment, etc. January 15, 1999: small ldap bug fixes. -* Stefan Vogel +* Stefan Vogel November 14, 1997: typo in the subscription instructions to amd-dev. -* Guntram Wolski +* Guntram Wolski November 15, 1997: pointed out mismatching documentation for the -o option. -* Michael Hucka +* Michael Hucka January 11, 1997: pointed out reversed definition of NFS mount options vers and proto. -* Albert Chin +* Albert Chin January 12, 1998: minor bug in output of amd -H. June 23, 2005: assortment of small compile bugs on aix4, and solaris 5/6/7. -* Thomas Richter +* Thomas Richter January 13, 1998: use case insensitive comparisons for variables that need it (such as all hostname related ones, and more). @@ -216,11 +216,11 @@ it (such as all hostname related ones, a July 20, 1998: don't leak memory in the private version of yp_all (when vendor yp_all is bad). -* Fred Korz +* Fred Korz January 30, 1998: minor typo fixed to tftp example in am-utils.texi. -* Donald Buczek +* Donald Buczek March 6, 1998: correctly inherit existing NFS V.3 mounts upon restart. @@ -230,36 +230,36 @@ March 20, 1998: do not close stdout in c allow startup script to redirect it. Set a temporary secure umask(0022) before writing log file and restore it afterwards. -* Matthew Crosby +* Matthew Crosby April 20, 1998: allow arbitrary number of interfaces in wire listing. -* David O'Brien +* David O'Brien September 4, 1998: bug fix to avoid overrunning hostname buffer, and minor amd.conf man page typo correction. September 22, 1999: use more secure vsnprintf in real_plog(). -* Danny Rathjens +* Danny Rathjens October 29, 1998: swap arguments to kill(2) in amd.c. -* Mike Mitchell +* Mike Mitchell November 3, 1998: amd/nfs_subr.c (nfsproc_lookup_2_svc): try to avoid a race condition between unmounting and re-mounting an entry, by increasing the ttl of a looked up entry before unmounting it. -* Douglas K. Rand" +* Douglas K. Rand" December 3, 1998: case insensitive host name match for nfsl. -* David Wolfskill +* David Wolfskill January 28, 1999: don't turn on/off noconn option if it was already in that state. -* Jeffrey C Honig +* Jeffrey C Honig March 14, 1999: clean up more autogenerated files upon "make distclean". March 15, 1999: avoid overly verbose NIS warning even on systems that don't @@ -271,30 +271,30 @@ detection for bsdi4. September 17, 1999: fixes to expn. -* Paul Balyoz +* Paul Balyoz March 26, 1999: ensure lostaltmail displays Y2K compliant dates. -* Jon Peatfield +* Jon Peatfield March 30, 1999: turn off incomplete NFS V.3 support in HPUX 10.20. September 22, 1999: safe reloading of maps without first clearing old copies, and using cached copies if map failed to reload. -* Peter Breitenlohner +* Peter Breitenlohner July 24, 1999: patch for linux 2.2.x to work with older libc5 systems, and nis_isup mis-logic fixes. December 13, 2001: report typos in scripts/amd.conf.5. -* Dale Talcott +* Dale Talcott July 26, 1999: added NFS3 support for AIX mounting. -* Christophe Kalt +* Christophe Kalt July 14, 1999: add netgrpd() syntax function which uses FQHN. -* Andrew J. Korty +* Andrew J. Korty September 5, 1999: pawd works for type:=nfsl. -* Nick Williams +* Nick Williams September 1, 1999: bug fix for incorrect symlinks when two locations are requested simultaneously. @@ -306,38 +306,38 @@ doing rapid mounts and umounts in succes June 5, 2000: better handling of potential race-conditions during rapid u/mounts. Correctly update d_drops stats for amq -s. -* Johann Pfefferl +* Johann Pfefferl November 16, 1999: fix to ldap code so repeated calls to string2he don't corrupt the string passed. -* Amitha Perera +* Amitha Perera December 9, 1999: detect all wire() interfaces correctly. -* Steven Danz +* Steven Danz January 25, 2000: allow browsable auto maps. -* Wolfram Klaus . +* Wolfram Klaus . November 21, 2000: recognize proplist mnttab flag. -* Thomas Klausner +* Thomas Klausner November 21, 2000: lots of NetBSD fixes (many of which are generic). April 18, 2003: patch to reference am-utils info pages in man page. November 28, 2004: small fixes to typos in amd.conf(5) man page. -* Olaf Kirch +* Olaf Kirch February 1, 2001: important Linux NFS error number mapping fixed -* Ahmon Dancy +* Ahmon Dancy February 9, 2001: Apple Rhapsody/Darwin/OS X port -* Sebastien Bahloul +* Sebastien Bahloul July 3, 2001: LDAP fixes and updates to support new APIs March 27, 2002: LDAP bug and port to HPUX-11. -* Philippe Troin +* Philippe Troin July 12, 2001: Proper handling of GNU getopt, support for optionally disabling LDAP/Hesiod, fixes for the dev/nodev option on Linux. Texi documentation fix. @@ -348,65 +348,65 @@ generic mount option. July 17, 2003: pref:=null core dump fix. libgdbm portability. tcpd/librap support. And a few other things for the 6.0 branch. -* Trond Myklebust +* Trond Myklebust January 10, 2002: Proper initialization of the timeo parameter on Linux, TCP _must_ have a timeout 2 orders of magnitude larger than UDP -* George Ross +* George Ross April 29, 2002: Rework of old code, support for wildcards in LDAP queries, and an FD leak fix. Amd -A support. October 21, 2002: ldap_unbind fix for SIGPIPE, and support for LDAPv3 -protocol version parameter (with Tim Colles ). +protocol version parameter (with Tim Colles ). -* Matthias Scheler +* Matthias Scheler June 14, 2002: patch to use "xlatecookie" NFS mount option. -* Jun-ichiro itojun Hagino . +* Jun-ichiro itojun Hagino . June 11, 2002: minor fixes to support NetBSD 1.6A. -* Sean Fagan +* Sean Fagan March 14, 2003: detect and use the MNT2_GEN_OPT_AUTOMNTFS mount flag on OS X / Darwin. -* Hendrik Scholz +* Hendrik Scholz June 9, 2003: mk-amd-map should open temp db file using O_EXCL. -* Mark Davies +* Mark Davies July 14, 2003: define "xlatecookie" mnttab option if not defined (for NetBSD). Support null hesiod entries if they start with a ".". -* Eric S. Raymond +* Eric S. Raymond December 9, 2003: fix unbalanced [] typo in fsinfo man page. -* Martin Blapp +* Martin Blapp July 6, 2004: recognize fields in pcfs_args_t in FreeBSD 5. -* Dan Nelson +* Dan Nelson August 2, 2004: pawd to recognize "host" type mounts. -* Hauke Fath +* Hauke Fath August 3, 2004: pawd to recognize "linkx" type mounts. -* Michael van Elst +* Michael van Elst September 1, 2004: bug fix to avoid race condition in calls to mntctl on AIX. -* Jonathan Chen +* Jonathan Chen October 22, 2004: patch/fix to move mlock/mlockall/plock code after the fork(). June 29, 2005: core dump going off end of exported_ap[] array. September 29, 2005: patch/fix for pawd not to go into an infinite loop. October 25, 2005: patch/fix for pawd to repeatedly resolve path. -* David Rage +* David Rage January 17, 2005: prevent Amd from logging 'Read-only filesystem' errors when the mount point has an ancestor (i.e. '/') that is mounted read-only. -* Kevin Layer +* Kevin Layer January 28, 2005: basic instructions how to setup Amd on Mac OS-X. -* Dan Ottavio +* Dan Ottavio March 2, 2005: new global amd.conf option debug_mtab_file, to set the debug mtab file when using debug_options=mtab. Default has changed from "./mtab" to "/tmp/mtab" to avoid security problem. Bug fixed to ensure that Amd @@ -415,16 +415,13 @@ terminates properly even mtab file doesn * Erik Kline January 3, 2005: implementation of executable maps for Amd. -* Jim Zajkowski +* Jim Zajkowski March 14, 2005: small patch to amd2ldif. * Adam Morley January 27, 2005: synchronize what amd2ldif does vs. what the ldap.schema expects. -* Graeme Wilford +* Graeme Wilford July 4, 2005: buffer overflow in pawd. -* Steve Plite -September 22, 2005: repair reversed meaning of D_AMQ, so amq will unregister -on exit. Modified: stable/11/contrib/amd/BUGS ============================================================================== --- stable/11/contrib/amd/BUGS Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/BUGS Fri Dec 23 22:42:14 2016 (r310490) @@ -1,7 +1,7 @@ LIST OF KNOWN BUGS IN AM-UTILS OR OPERATING SYSTEMS Note: report am-utils bugs via Bugzilla to https://bugzilla.am-utils.org/ or -by email to the am-utils@am-utils.org mailing list. +by email to the am-utils mailing list (see www.am-utils.org). (1) mips-sgi-irix* @@ -98,11 +98,11 @@ diff -u -r1.1 utsname.h (4) powerpc-ibm-aix4.2.1.0 -[4A] "Randall S. Winchester" reports that for amd to +[4A] "Randall S. Winchester" reports that for amd to start, you need to kill and restart rpc.mountd and possibly also make sure that nfsd is running. Normally these are not required. -[4B] "Stefan Vogel" reports that if your amq +[4B] "Stefan Vogel" reports that if your amq executable dump core unexpectedly, then it may be a bug in gcc 2.7.x. Upgrade to gcc 2.8.x or use IBM's xlC compiler. @@ -123,7 +123,7 @@ but it is not yet in the glibc-2.0.7-19 A bug in libc results in an amq binary that doesn't work; amq -v dumps core in xdr_string. There is no known fix (source code or vendor patch) at this -time. (Please let am-utils@am-utils.org know if you know of a fix.) +time. (Please let us know if you have a fix; see www.am-utils.org.) (7) *-aix4.3.2.0 Modified: stable/11/contrib/amd/COPYING ============================================================================== --- stable/11/contrib/amd/COPYING Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/COPYING Fri Dec 23 22:42:14 2016 (r310490) @@ -1,4 +1,4 @@ -Copyright (c) 1997-2006 Erez Zadok +Copyright (c) 1997-2014 Erez Zadok Copyright (c) 1989 Jan-Simon Pendry Copyright (c) 1989 Imperial College of Science, Technology & Medicine Copyright (c) 1989 The Regents of the University of California. @@ -15,12 +15,7 @@ are met: 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 acknowledgment: - This product includes software developed by the University of - California, Berkeley and its contributors, as well as the Trustees of - Columbia University. -4. Neither the name of the University nor the names of its contributors +3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. Modified: stable/11/contrib/amd/ChangeLog ============================================================================== --- stable/11/contrib/amd/ChangeLog Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/ChangeLog Fri Dec 23 22:42:14 2016 (r310490) @@ -1,14 +1,564 @@ -2006-05-11 Erez Zadok +2014-10-28 Christos Zoulas ******************************************************************* - *** Released am-utils-6.1.5 *** + *** Released am-utils-6.2 *** ******************************************************************* -2006-05-10 Erez Zadok + * add ylwrap.amd, sick and tired of patching broken ylwrap. + +2014-09-05 Christos Zoulas + + * factor out the size check for both readdir methods + (raven at themaw.net) + +2014-09-03 Christos Zoulas + + * configure test for 64 bit xdr function (raven at themaw.net) + +2014-09-01 Christos Zoulas + + * bug fix from raven at themaw.net to prevent writing v3 handle + to a v2 structure. + +2014-07-21 Christos Zoulas + + * fix permission problems with access + * auto_nfs_version = 3 now works for me. + +2014-07-20 Christos Zoulas + + * refresh some autoconf files + * force autoconf version since earlier versions don't work + * changes from raven at themaw.net to support NFSv3 for automounted + toplevel filesystems presented to the list in May. A few bug fixes + and integration changes by me. The code now works well enough to + mount the filesystem with NFSv3 and automount children but readdir + does not work yet (so no listing of automounted filesystems). + The new code is not enabled by default. To enable use + auto_nfs_version = 3 + in your configuration file. + +2014-03-26 Christos Zoulas + + From Ian Kent + + * use mktemp in scripts/fixrmtab + * fix documentatio nits + * [linux] Add ext2, ext3, ext4 specific mount options + * fix tcpwrappers (hosts.{allow,deny} problems for specific host + entries + +2014-03-20 Christos Zoulas + + + * don't background autofs umount + * avoid fh NULL dereference on umount + * handle ENOENT umount return for autofs mounts + * fix error message in get_nfs_version + * fix debug log deadlock + * [linux] retry umount on EBUSY + * handle failed umount on exit + +2014-03-09 Christos Zoulas + + * Remove BSD advertising clause. + * Remove expn program which is not used by anything + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + +2013-05-14 Christos Zoulas + + * update to handle new autoconf and regen files + +2012-11-23 Christos Zoulas + + * recognize mountport=, noacl options + * simplify the bootstrap process, by forcing + all the files to be rebuild with autoreconf -f - i + +2012-10-03 Christos Zoulas + + * add missing ops_nfs4.c to the Makefile.am + +2012-09-14 Christos Zoulas + + * add locking option handling for lustre + * fix noatime, nodiratime, mandlock for linux + +2012-07-25 Christos Zoulas + + * bug fixes for lustre rhost parsing + +2012-06-27 Christos Zoulas + + * Disable 1/2-baked sun map support to avoid SIGSEGV + +2012-06-16 Christos Zoulas + + ******************************************************************* + *** Released am-utils-6.2-rc1 *** + ******************************************************************* + + * Fix libtool.m4 to work with later versions of autoconf. + * In buildall, use eval so that quoted strings work + * Centralize nfs version checking function, and introduce + new configuration variable nfs_vers_ping, which is the + max version we ping for. This is not documented yet, because + there might be a better way separate the max version we can + use vs the max version we ping for. + +2012-06-09 Christos Zoulas + + * fix issue with parsing nfsv4 security option strings + +2012-05-01 Christos Zoulas + + * Handle EPERM return from v4 file handles + in old linux kernels + +2012-03-09 Christos Zoulas + + * fix linux autofs detection + * fix wrong types in new amq mount xdr processing + +2012-01-25 Christos Zoulas + + * FreeBSD portability fixes + +2012-01-23 Christos Zoulas + + * Avoid type punned warnings + +2011-12-29 Christos Zoulas + + * fix bug I introduced in get_nfs_version that caused it to return 0 + * add direct support for ext{2,3,4} + +2011-12-15 Christos Zoulas + + * Include on linux, to grab extra mount flags + * Add support for lustre + +2011-11-28 Christos Zoulas + + * For nfsl mounts, match against either the short local + host name or the fqdn name. + +2011-10-06 Christos Zoulas + + * Add NFSv4 support (loosely based on Ramya's code). + Currently if the NFSv4 mount fails with ENOENT we fail + back to NFSv3, unless -DNO_FALLBACK. + * Replace strdup with xstrdup. It is not nice to replace + system functions with ones that behave differently. + * Add various consistency checks (caller function checks + variable for NULL, but callee does not). + * Fix error handling in various paths. + * Don't check before using XFREE(). free(NULL) works. + +2011-09-15 Christos Zoulas + + * amq -i addition (prints info about the map files) + +2011-09-14 Christos Zoulas + + * Solaris OS and compiler fixes from: + Hofmann, Frank + Sayle, Alex + - (void)&var generates warnings, removed + - __inline is invalid, changed with inline + - and other headers have extra dependendcies + ` +2011-08-11 Christos Zoulas + + * fix potential buffer overflow in expand_error() + (Richard Kettlewell). Does not seem to be exploitable. + + * simplify %option parsing to appease ancient flex. + +2011-06-21 Christos Zoulas + + * add support for linux autofs version 5 (untested) + +2011-06-18 Christos Zoulas + + * roll back to an older version of libtool that works + + * newer versions of config.guess and config.sub + + * minor fixes to buildall + +2011-05-19 Christos Zoulas + + * m4/macros/libtool.m4: for AIX AC_LANG_PROGRAM is incorrectly + used and the latest autoconf gives an error. For now just + quote it. + + * configure.in: Fedora Core 15 and RedHat 6 now don't define + af_family_t in , but in . + Include so that we get + indirectly. This caused the detection + test to fail. + +2010-11-24 Erez Zadok + + * m4/macros/os_cflags.m4: for linux, define _GNU_SOURCE (to get + definitions for O_LARGEFILE and more). + +2010-11-20 Christos Zoulas + + * Update news items, add release readme, mark as rc1 + + * Fix addopts code to work with options that are key=value + when the built-in hasmntopt() code is not used. The problem + was that the code passed "key=" to hasmntopt not "key". + +2009-12-10 Christos Zoulas + + * Copy all fields of the am_opts structure + When we introduced am_loc we also added a function to + create a duplicate of an am_opts structure. As it turns + out, that only made a partial copy of the struct and some + fields (e.g. opt_cache) was left blank in the new structure. + Unfortunately any code that was checking the options + through the mntfs structure was mislead by the partial + copy: caching was disabled completely, for example, and + since browsing relies on caching being enabled it wasn't + working either. + From: Krisztian Kovacs + + * Initialize RPC authentication flavor to AUTH_UNIX instead + of zero. RHEL 5 uses version 6 of the mount_arg structure + that includes the desired RPC authorization flavour. + Unfortunately amd initializes that value to zero, meaning + AUTH_NULL, resulting in all NFS servers denying operations. + From: Krisztian Kovacs + + * Make sure to remove nodes in the proper order when going + down. Depending on what order the nodes got created it's + possible that the parent of a node has a bigger am_mapno + (index in exported_ap[]) so that it gets freed before + its child while the child's am_parent pointer is still + pointing to the already freed block of memory. + This change makes sure that umount_exported() cleans up + all children of a node first before freeing the node. + From: Krisztian Kovacs + + * Fix Linux-specific stuff in ops_tmpfs.c + AUTOFS_TMPFS_FS_FLAGS is defined only in the Linux-specific + conf_linux.c file, so it cannot be built on Solaris. + From: Krisztian Kovacs + + * Add missing parenthesis to fix defined(XXX + From: Krisztian Kovacs + + * In the previous commit we've already made a change that + makes this code unnecessary since the node is returned + even if the backing file server is known to be down. + Since the code path is unused it should be removed. + From: Krisztian Kovacs + + * amfs_generic_lookup_child() tries to find an alternate + file server if it detects that the current one is down. + However, in the comparison used to decide if a possible + mount is the same as the current one it compares the am_loc + pointers instead of the actual mntfs pointers. Since + amfs_lookup_one_location() creates a brand new am_loc + structure for the returned mntfs structure the am_loc + pointer will be different even if the mntfs it's pointing + to is the same. + This tricks amfs_generic_lookup_child() think it has + found an alternate file server while it hasn't and thus + starts multiple racing mounts for the very same node and + mntfs. + From: Krisztian Kovacs + + * In the new am_loc scheme mounted mntfs structures still + have their mf_fo structure left intact. So when restart + creates a fake mntfs for an already mounted filesystem it + should not free mf_fo right away. + From: Krisztian Kovacs + + * Setting the error flag of the mntfs for which the share + is already mounted results in the mount point not being + removed when it times out. (Amd considers it an error + mntfs and thus umount becomse a no-op.) + From: Krisztian Kovacs + + * Right now AMD sets all timeout values to their defaults + even if you explicitly set them to zero. This patch + introduces separate flags that store if the respective + values have been set and the code path setting default + values checks these flags instead of testing the values + for zero. [Linux only] + From: Krisztian Kovacs + + * Fix mntfs related lookup/(un)mount race conditions, by + introducing a new structure linking an mntfs to a node. + From: Krisztian Kovacs + + * We have to free the buffers allocated by the XDR routines when + decoding the mount response after copying them to their final place. + From: Krisztian Kovacs + +2009-12-09 Christos Zoulas + + * Free continuation in amfs_retry() if we don't call amfs_bgmount() + Normally it's amfs_bgmount() which frees the continuation. However, if + the mount is already in progress and we're in amfs_retry() for another + node we don't try mounting the filesystem once again. Still, we have + to free the continuation as we won't get called again and thus would + leak the continuation structure and our am_loc references. + From: Krisztian Kovacs + + * Fix use-after-free and double free of mntfs private data + ops_nfs.c(nfs_init) does not clear private data pointer after free(). + This leads to use-after-free and double free in case mount() fails. + (found by valgrind) + From: Krisztian Kovacs + +2009-11-23 Christos Zoulas + + * The temporary filename buffer was leaked in lock_mtab(). + From: Krisztian Kovacs + +2009-10-27 Christos Zoulas + + * Deal with errno.h->sys/errno.h better + +2009-10-26 Christos Zoulas + + * Fix issue with autoconf 2.63 + + * Fix compile warnings for gcc-4.4.x + +2009-04-15 Christos Zoulas + + * Share the LDAP connection between different maps to save resources + on the LDAP server. (Olaf Flebbe ) + +2009-03-20 Christos Zoulas + + * Fix largefile re-definitions + + * Fix compilation error caused in previous patch + +2009-02-19 Christos Zoulas + + * Add a synchronous unmount amq rpc that will wait for the remote + filesystem to be unmounted, or return an error. Enabled by amq -uu + +2009-01-11 Erez Zadok + + * amd/ops_udf.c: don't define functions/variables which may not be + used. + + * amd/ops_tmpfs.c (mount_tmpfs): force gcc not to complain about + unused variables. + + * config.guess.long: properly support Fedora Core. + +2009-01-09 Christos Zoulas + + * Fix nfs mounts on linux 2.6.26 by explicitly initializing context. + + * Treat an empty sublink as an unset sublink; this allows us to + say sublink:=; in a spec to override the default. (This produces + Bad selector error, but it works. XXX: We need to decide how to + unset a selector. I proposed an unset keyword a while ago). + +2009-01-06 Christos Zoulas + + * re-renerate all generated files with newer versions of the + auto-tools. + + * move INSTALL to INSTALL.am-utils to avoid conflicts + + * fix incompatibilities with new m4 and new autoconf. + + * add UDF filesystem support. + + * fix NetBSD nfs file handle detection. + +2009-01-02 Christos Zoulas + + * add nocasetrans, nojoliet, rrcaseins for cd9660 filesystems + +2008-12-03 Christos Zoulas + + * allow ldap queries try a comma-separated list of servers given as: + + ldap_hostports = host1:port1,host2,host3:port3 + + original patch from Florian Geyer + +2008-09-19 Christos Zoulas + + * the auth_create gid on NetBSD is int + + * deal with lossage from flex -P + + * fix missing/incorrect prototypes + +2008-09-17 Christos Zoulas + + * fix manual page section issues (sorting, non-existant) + + * add missing forward declarations + + * avoid null pointer derefs (coverity) + + * more portable endian detection support + + * implement tmpfs support + + * use sizeof var instead of constant + + * fix yyerror declaration and definition + + * fix yy function renaming, and correct some renaming issues. + + * work around automake < 1.9 issue where ylwrap is not being run + for a single yacc or lex file. + + * NetBSD + - handle headers that need other headers to compile + - add exfs and tmpfs specific glue + - add options log, noatime, nocoredump, nodevmtime, softdep, + symperm, union + - NetBSD's new mount system call needs the size of the opaque + filesystem specific structure, but passing 0 for now works. + We would need to change a lot more code to pass the size from + the fs-specific calls, so for now punt. + - recvfrom takes socklen_t * on NetBSD + - handle newer NetBSD using statvfs + - NetBSD calls its ufs ffs + + * Linux + - Most recent kernels have trouble with trying to parse the pid + hostname and do locking. What before was a silent failure, now + there is a warning printed and the mount is rejected. This is + the simplest fix: + (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479884) + +2007-04-13 Erez Zadok + + * amd/sun_map.c (sun_append_str): When translating '&' from Sun + automounter maps, replace it with "${key}" in the Amd map, not + with the value of the key at the time. This way '*' maps work + too. + + * config.guess.long: don't use -q option to grep because some + systems don't support it. Bug fix for solaris. + +2007-03-11 Christos Zoulas + + * amd/opts.c (expand_op): Don't call xstrlcpy() to truncate a + string. It causes spurious xstrlcpy() syslog() errors. Use + memcpy() and explicitly terminate the string. + +2007-01-20 Erez Zadok + + * updated copyright year to 2007 on all files. + +2006-12-27 Erez Zadok + + * minor new port: ia64-hp-hpux11.23 + + * m4/macros/check_libwrap_severity.m4 (LIBS): also test if caller + needs to define rfc931_timeout. + + * amd/sun2amd.c: define rfc931_timeout and allow/deny_severity for + libwrap. + + * amd/amq_svc.c: some versions of libwrap require the caller to + define rfc931_timeout in addition to allow/deny_severity. + + * amd/amfs_toplvl.c (amfs_toplvl_init): properly detect when + forced unmount functionality exists for all systems. + + * libamu/mount_fs.c (compute_nfs_args): reset nfs_args_t->pathconf + only if field exists. + + * conf/nfs_prot/nfs_prot_hpux11.h: prevent HPUX 11.23 from + including or (TLI definitions are already + included from elsewhere). + + * configure.in: detect nfs_args_t->pathconf field. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: properly publish html files using newer + text2html. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: obfuscate emails in ChangeLog before it is *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Dec 24 08:59:31 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E59C3C8CEF8; Sat, 24 Dec 2016 08:59:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9743EF2; Sat, 24 Dec 2016 08:59:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBO8xUin025712; Sat, 24 Dec 2016 08:59:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBO8xUYR025711; Sat, 24 Dec 2016 08:59:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612240859.uBO8xUYR025711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 24 Dec 2016 08:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310495 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 08:59:32 -0000 Author: tuexen Date: Sat Dec 24 08:59:30 2016 New Revision: 310495 URL: https://svnweb.freebsd.org/changeset/base/310495 Log: MFC r310193: Fix the handling of buffered messages in stream reset deferred handling. Thanks to Eugen-Andrei Gavriloaie for reporting the issue and providing substantial help in nailing down the issue. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Dec 24 07:13:33 2016 (r310494) +++ stable/11/sys/netinet/sctp_indata.c Sat Dec 24 08:59:30 2016 (r310495) @@ -472,7 +472,6 @@ sctp_clean_up_control(struct sctp_tcb *s */ static void sctp_queue_data_to_stream(struct sctp_tcb *stcb, - struct sctp_stream_in *strm, struct sctp_association *asoc, struct sctp_queued_to_read *control, int *abort_flag, int *need_reasm) { @@ -498,16 +497,17 @@ sctp_queue_data_to_stream(struct sctp_tc int queue_needed; uint32_t nxt_todel; struct mbuf *op_err; + struct sctp_stream_in *strm; char msg[SCTP_DIAG_INFO_LEN]; + strm = &asoc->strmin[control->sinfo_stream]; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); } if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ: %u delivered: %u from peer, Abort association\n", - control->mid, strm->last_mid_delivered); -protocol_error: + strm->last_mid_delivered, control->mid); /* * throw it in the stream so it gets cleaned up in * association destruction @@ -531,9 +531,6 @@ protocol_error: return; } - if ((SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) && (asoc->idata_supported == 0)) { - goto protocol_error; - } queue_needed = 1; asoc->size_on_all_streams += control->length; sctp_ucount_incr(asoc->cnt_on_all_streams); @@ -1041,7 +1038,7 @@ sctp_deliver_reasm_check(struct sctp_tcb } control = TAILQ_FIRST(&strm->uno_inqueue); - if ((control) && + if ((control != NULL) && (asoc->idata_supported == 0)) { /* Special handling needed for "old" data format */ if (sctp_handle_old_unordered_data(stcb, asoc, strm, control, pd_point, inp_read_lock_held)) { @@ -1280,7 +1277,6 @@ sctp_add_chk_to_control(struct sctp_queu */ static void sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_in *strm, struct sctp_queued_to_read *control, struct sctp_tmit_chunk *chk, int created_control, @@ -1288,8 +1284,10 @@ sctp_queue_data_for_reasm(struct sctp_tc { uint32_t next_fsn; struct sctp_tmit_chunk *at, *nat; + struct sctp_stream_in *strm; int do_wakeup, unordered; + strm = &asoc->strmin[control->sinfo_stream]; /* * For old un-ordered data chunks. */ @@ -1582,7 +1580,6 @@ sctp_process_a_data_chunk(struct sctp_tc uint32_t ppid; uint8_t chk_flags; struct sctp_stream_reset_list *liste; - struct sctp_stream_in *strm; int ordered; size_t clen; int created_control = 0; @@ -1733,7 +1730,6 @@ sctp_process_a_data_chunk(struct sctp_tc } return (0); } - strm = &asoc->strmin[sid]; /* * If its a fragmented message, lets see if we can find the control * on the reassembly queues. @@ -1750,7 +1746,7 @@ sctp_process_a_data_chunk(struct sctp_tc mid, chk_flags); goto err_out; } - control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); + control = sctp_find_reasm_entry(&asoc->strmin[sid], mid, ordered, asoc->idata_supported); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", chk_flags, control); if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { @@ -2020,7 +2016,7 @@ sctp_process_a_data_chunk(struct sctp_tc if ((chk_flags & SCTP_DATA_UNORDERED) == 0) { /* for ordered, bump what we delivered */ - strm->last_mid_delivered++; + asoc->strmin[sid].last_mid_delivered++; } SCTP_STAT_INCR(sctps_recvexpress); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { @@ -2130,7 +2126,7 @@ sctp_process_a_data_chunk(struct sctp_tc } else { SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering MID: %u\n", control, mid); - sctp_queue_data_to_stream(stcb, strm, asoc, control, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check); if (*abort_flag) { if (last_chunk) { *m = NULL; @@ -2145,7 +2141,7 @@ sctp_process_a_data_chunk(struct sctp_tc SCTPDBG(SCTP_DEBUG_XXX, "Queue data to stream for reasm control: %p MID: %u\n", control, mid); - sctp_queue_data_for_reasm(stcb, asoc, strm, control, chk, created_control, abort_flag, tsn); + sctp_queue_data_for_reasm(stcb, asoc, control, chk, created_control, abort_flag, tsn); if (*abort_flag) { /* * the assoc is now gone and chk was put onto the reasm @@ -2179,6 +2175,10 @@ finish_express_del: sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[sid], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } /* check the special flag for stream resets */ if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && SCTP_TSN_GE(asoc->cumulative_tsn, liste->tsn)) { @@ -2200,10 +2200,14 @@ finish_express_del: /* All can be removed */ TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, strm, asoc, ctl, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } } } else { TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { @@ -2216,22 +2220,16 @@ finish_express_del: * ctl->sinfo_tsn > liste->tsn */ TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, strm, asoc, ctl, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } } } - /* - * Now service re-assembly to pick up anything that has been - * held on reassembly queue? - */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); - need_reasm_check = 0; - } - if (need_reasm_check) { - /* Another one waits ? */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); } return (1); } From owner-svn-src-stable-11@freebsd.org Sat Dec 24 12:55:38 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 813D6C8E355; Sat, 24 Dec 2016 12:55:38 +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 419EE192B; Sat, 24 Dec 2016 12:55:38 +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 uBOCtbSp023926; Sat, 24 Dec 2016 12:55:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOCtbOV023924; Sat, 24 Dec 2016 12:55:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241255.uBOCtbOV023924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 12:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310505 - in stable/11: lib/libelftc tools/build/mk X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 12:55:38 -0000 Author: ngie Date: Sat Dec 24 12:55:37 2016 New Revision: 310505 URL: https://svnweb.freebsd.org/changeset/base/310505 Log: MFC r310186,r310187: r310186: Install the lib/libelftc manpages Some other manpages, e.g. c++filt reference these r310187: Remove lib/libelf's manpages if MK_TOOLCHAIN == no Add a comment to help figure out which set is lib/libelf's and which set is lib/libelftc's Modified: stable/11/lib/libelftc/Makefile stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libelftc/Makefile ============================================================================== --- stable/11/lib/libelftc/Makefile Sat Dec 24 12:50:17 2016 (r310504) +++ stable/11/lib/libelftc/Makefile Sat Dec 24 12:55:37 2016 (r310505) @@ -28,7 +28,15 @@ SRCS= elftc_bfdtarget.c INCS= libelftc.h CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common -MAN= +MAN+= elftc.3 \ + elftc_bfd_find_target.3 \ + elftc_copyfile.3 \ + elftc_demangle.3 \ + elftc_reloc_type_str.3 \ + elftc_set_timestamps.3 \ + elftc_timestamp.3 \ + elftc_string_table_create.3 \ + elftc_version.3 # This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile # We need to link against the correct version of these files. One Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 24 12:50:17 2016 (r310504) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 24 12:55:37 2016 (r310505) @@ -8066,6 +8066,65 @@ OLD_FILES+=usr/share/man/man1/strip.1.gz OLD_FILES+=usr/bin/objcopy OLD_FILES+=usr/share/man/man1/objcopy.1.gz .endif +# lib/libelf +OLD_FILES+=usr/share/man/man3/elf.3.gz +OLD_FILES+=usr/share/man/man3/elf_begin.3.gz +OLD_FILES+=usr/share/man/man3/elf_cntl.3.gz +OLD_FILES+=usr/share/man/man3/elf_end.3.gz +OLD_FILES+=usr/share/man/man3/elf_errmsg.3.gz +OLD_FILES+=usr/share/man/man3/elf_fill.3.gz +OLD_FILES+=usr/share/man/man3/elf_flagdata.3.gz +OLD_FILES+=usr/share/man/man3/elf_getarhdr.3.gz +OLD_FILES+=usr/share/man/man3/elf_getarsym.3.gz +OLD_FILES+=usr/share/man/man3/elf_getbase.3.gz +OLD_FILES+=usr/share/man/man3/elf_getdata.3.gz +OLD_FILES+=usr/share/man/man3/elf_getident.3.gz +OLD_FILES+=usr/share/man/man3/elf_getscn.3.gz +OLD_FILES+=usr/share/man/man3/elf_getphdrnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getphnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshdrnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshdrstrndx.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshstrndx.3.gz +OLD_FILES+=usr/share/man/man3/elf_hash.3.gz +OLD_FILES+=usr/share/man/man3/elf_kind.3.gz +OLD_FILES+=usr/share/man/man3/elf_memory.3.gz +OLD_FILES+=usr/share/man/man3/elf_next.3.gz +OLD_FILES+=usr/share/man/man3/elf_open.3.gz +OLD_FILES+=usr/share/man/man3/elf_rawfile.3.gz +OLD_FILES+=usr/share/man/man3/elf_rand.3.gz +OLD_FILES+=usr/share/man/man3/elf_strptr.3.gz +OLD_FILES+=usr/share/man/man3/elf_update.3.gz +OLD_FILES+=usr/share/man/man3/elf_version.3.gz +OLD_FILES+=usr/share/man/man3/gelf.3.gz +OLD_FILES+=usr/share/man/man3/gelf_checksum.3.gz +OLD_FILES+=usr/share/man/man3/gelf_fsize.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getcap.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getclass.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getdyn.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getehdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getmove.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getphdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getrel.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getrela.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getshdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getsym.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getsyminfo.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getsymshndx.3.gz +OLD_FILES+=usr/share/man/man3/gelf_newehdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_newphdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_update_ehdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_xlatetof.3.gz +# lib/libelftc +OLD_FILES+=usr/share/man/man3/elftc.3.gz +OLD_FILES+=usr/share/man/man3/elftc_bfd_find_target.3.gz +OLD_FILES+=usr/share/man/man3/elftc_copyfile.3.gz +OLD_FILES+=usr/share/man/man3/elftc_demangle.3.gz +OLD_FILES+=usr/share/man/man3/elftc_reloc_type_str.3.gz +OLD_FILES+=usr/share/man/man3/elftc_set_timestamps.3.gz +OLD_FILES+=usr/share/man/man3/elftc_timestamp.3.gz +OLD_FILES+=usr/share/man/man3/elftc_string_table_create.3.gz +OLD_FILES+=usr/share/man/man3/elftc_version.3.gz OLD_FILES+=usr/tests/usr.bin/yacc/Kyuafile OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_calc1.y OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_demo.y From owner-svn-src-stable-11@freebsd.org Sat Dec 24 12:58:34 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BB19C8E496; Sat, 24 Dec 2016 12:58:34 +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 30F001C4E; Sat, 24 Dec 2016 12:58:34 +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 uBOCwXbK024312; Sat, 24 Dec 2016 12:58:33 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOCwXIu024311; Sat, 24 Dec 2016 12:58:33 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241258.uBOCwXIu024311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 12:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310506 - stable/11/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 12:58:34 -0000 Author: ngie Date: Sat Dec 24 12:58:33 2016 New Revision: 310506 URL: https://svnweb.freebsd.org/changeset/base/310506 Log: MFC r309837: Change the process limits for RLIMIT_MEMLOCK to RLIM_INFINITY when executing :mincore_resid The default process limits in FreeBSD is 64kB for unprivileged users, which empirically is too low to run the :mincore_resid testcase. Process limits are inherited, so even though the default limit for root users is RLIM_INFINITY, the inherited limit with "sudo" with the default login.conf will be 64kB. Use setrlimit to set rlim_max for RLIMIT_MEMLOCK to RLIM_INFINITY to avoid ENOMEM issues when calling mlock to wire the mmap'ed address space. setrlimit requires root access to increase rlim_max, so require root privileges when running the test Discovered when executing the tests with sudo, e.g. "sudo kyua test -k /usr/tests/lib/libc/sys/Kyuafile mincore_test" Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Dec 24 12:55:37 2016 (r310505) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Dec 24 12:58:33 2016 (r310506) @@ -144,6 +144,9 @@ ATF_TC_WITH_CLEANUP(mincore_resid); ATF_TC_HEAD(mincore_resid, tc) { atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(mincore_resid, tc) @@ -155,6 +158,13 @@ ATF_TC_BODY(mincore_resid, tc) struct rlimit rlim; ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0); +#ifdef __FreeBSD__ + /* + * Bump the mlock limit to unlimited so the rest of the testcase + * passes instead of failing on the mlock call. + */ + rlim.rlim_max = RLIM_INFINITY; +#endif rlim.rlim_cur = rlim.rlim_max; ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0); @@ -206,8 +216,9 @@ ATF_TC_BODY(mincore_resid, tc) "might be low on memory"); #ifdef __FreeBSD__ - ATF_REQUIRE_MSG(mlock(addr, npgs * page) == 0, "mlock failed: %s", - strerror(errno)); + if (mlock(addr, npgs * page) == -1 && errno != ENOMEM) + atf_tc_skip("could not wire anonymous test area, system might " + "be low on memory"); #endif ATF_REQUIRE(check_residency(addr, npgs) == npgs); ATF_REQUIRE(munmap(addr, npgs * page) == 0); From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:12:54 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F198C8FE6E; Sat, 24 Dec 2016 14:12:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F62B19FC; Sat, 24 Dec 2016 14:12:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOECrf2058486; Sat, 24 Dec 2016 14:12:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOECrLc058483; Sat, 24 Dec 2016 14:12:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241412.uBOECrLc058483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310509 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:12:54 -0000 Author: avg Date: Sat Dec 24 14:12:52 2016 New Revision: 310509 URL: https://svnweb.freebsd.org/changeset/base/310509 Log: MFC r309097: MFV r308987: 7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Dec 24 13:28:39 2016 (r310508) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Dec 24 14:12:52 2016 (r310509) @@ -142,7 +142,7 @@ extern uint_t zfs_fsyncer_key; extern int zfs_super_owner; extern int zfs_suspend_fs(zfsvfs_t *zfsvfs); -extern int zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname); +extern int zfs_resume_fs(zfsvfs_t *zfsvfs, struct dsl_dataset *ds); extern int zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, const char *domain, uint64_t rid, uint64_t *valuep); extern int zfs_userspace_many(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Dec 24 13:28:39 2016 (r310508) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Dec 24 14:12:52 2016 (r310509) @@ -3788,12 +3788,15 @@ zfs_ioc_rollback(const char *fsname, nvl int error; if (getzfsvfs(fsname, &zfsvfs) == 0) { + dsl_dataset_t *ds; + + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); if (error == 0) { int resume_err; error = dsl_dataset_rollback(fsname, zfsvfs, outnvl); - resume_err = zfs_resume_fs(zfsvfs, fsname); + resume_err = zfs_resume_fs(zfsvfs, ds); error = error ? error : resume_err; } #ifdef illumos @@ -4444,8 +4447,10 @@ zfs_ioc_recv(zfs_cmd_t *zc) if (getzfsvfs(tofs, &zfsvfs) == 0) { /* online recv */ + dsl_dataset_t *ds; int end_err; + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); /* * If the suspend fails, then the recv_end will @@ -4453,7 +4458,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) */ end_err = dmu_recv_end(&drc, zfsvfs); if (error == 0) - error = zfs_resume_fs(zfsvfs, tofs); + error = zfs_resume_fs(zfsvfs, ds); error = error ? error : end_err; #ifdef illumos VFS_RELE(zfsvfs->z_vfs); @@ -4999,11 +5004,14 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc) * objset needs to be closed & reopened (to grow the * objset_phys_t). Suspend/resume the fs will do that. */ + dsl_dataset_t *ds; + + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); if (error == 0) { dmu_objset_refresh_ownership(zfsvfs->z_os, zfsvfs); - error = zfs_resume_fs(zfsvfs, zc->zc_name); + error = zfs_resume_fs(zfsvfs, ds); } } if (error == 0) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 13:28:39 2016 (r310508) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:12:52 2016 (r310509) @@ -2225,7 +2225,7 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs) * zfsvfs, held, and long held on entry. */ int -zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname) +zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) { int err; znode_t *zp; @@ -2234,14 +2234,13 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const ch ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); /* - * We already own this, so just hold and rele it to update the - * objset_t, as the one we had before may have been evicted. + * We already own this, so just update the objset_t, as the one we + * had before may have been evicted. */ objset_t *os; - VERIFY0(dmu_objset_hold(osname, zfsvfs, &os)); - VERIFY3P(os->os_dsl_dataset->ds_owner, ==, zfsvfs); - VERIFY(dsl_dataset_long_held(os->os_dsl_dataset)); - dmu_objset_rele(os, zfsvfs); + VERIFY3P(ds->ds_owner, ==, zfsvfs); + VERIFY(dsl_dataset_long_held(ds)); + VERIFY0(dmu_objset_from_ds(ds, &os)); err = zfsvfs_init(zfsvfs, os); if (err != 0) From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:17:42 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B850BC8FFA2; Sat, 24 Dec 2016 14:17:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92CBD1D45; Sat, 24 Dec 2016 14:17:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEHfnK058761; Sat, 24 Dec 2016 14:17:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEHfC8058758; Sat, 24 Dec 2016 14:17:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241417.uBOEHfC8058758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310511 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:17:42 -0000 Author: avg Date: Sat Dec 24 14:17:41 2016 New Revision: 310511 URL: https://svnweb.freebsd.org/changeset/base/310511 Log: MFC r309098: MFV r308988: 7199, 7200 dsl_dataset_rollback_sync may try to free already free blocks Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 24 14:13:21 2016 (r310510) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 24 14:17:41 2016 (r310511) @@ -88,6 +88,8 @@ extern inline dsl_dataset_phys_t *dsl_da extern int spa_asize_inflation; +static zil_header_t zero_zil; + /* * Figure out how much of this delta should be propogated to the dsl_dir * layer. If there's a refreservation, that space has already been @@ -132,6 +134,7 @@ dsl_dataset_block_born(dsl_dataset_t *ds return; } + ASSERT3U(bp->blk_birth, >, dsl_dataset_phys(ds)->ds_prev_snap_txg); dmu_buf_will_dirty(ds->ds_dbuf, tx); mutex_enter(&ds->ds_lock); delta = parent_delta(ds, used); @@ -902,8 +905,20 @@ dsl_dataset_zero_zil(dsl_dataset_t *ds, objset_t *os; VERIFY0(dmu_objset_from_ds(ds, &os)); - bzero(&os->os_zil_header, sizeof (os->os_zil_header)); - dsl_dataset_dirty(ds, tx); + if (bcmp(&os->os_zil_header, &zero_zil, sizeof (zero_zil)) != 0) { + dsl_pool_t *dp = ds->ds_dir->dd_pool; + zio_t *zio; + + bzero(&os->os_zil_header, sizeof (os->os_zil_header)); + + zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED); + dsl_dataset_sync(ds, zio, tx); + VERIFY0(zio_wait(zio)); + + /* dsl_dataset_sync_done will drop this reference. */ + dmu_buf_add_ref(ds->ds_dbuf, ds); + dsl_dataset_sync_done(ds, tx); + } } uint64_t @@ -1083,8 +1098,10 @@ dsl_dataset_dirty(dsl_dataset_t *ds, dmu if (dsl_dataset_phys(ds)->ds_next_snap_obj != 0) panic("dirtying snapshot!"); - dp = ds->ds_dir->dd_pool; + /* Must not dirty a dataset in the same txg where it got snapshotted. */ + ASSERT3U(tx->tx_txg, >, dsl_dataset_phys(ds)->ds_prev_snap_txg); + dp = ds->ds_dir->dd_pool; if (txg_list_add(&dp->dp_dirty_datasets, ds, tx->tx_txg)) { /* up the hold count until we can be written out */ dmu_buf_add_ref(ds->ds_dbuf, ds); @@ -1339,8 +1356,6 @@ void dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, const char *snapname, dmu_tx_t *tx) { - static zil_header_t zero_zil; - dsl_pool_t *dp = ds->ds_dir->dd_pool; dmu_buf_t *dbuf; dsl_dataset_phys_t *dsphys; @@ -1359,6 +1374,10 @@ dsl_dataset_snapshot_sync_impl(dsl_datas bcmp(&os->os_phys->os_zil_header, &zero_zil, sizeof (zero_zil)) == 0); + /* Should not snapshot a dirty dataset. */ + ASSERT(!txg_list_member(&ds->ds_dir->dd_pool->dp_dirty_datasets, + ds, tx->tx_txg)); + dsl_fs_ss_count_adjust(ds->ds_dir, 1, DD_FIELD_SNAPSHOT_COUNT, tx); /* @@ -1718,6 +1737,27 @@ dsl_dataset_sync(dsl_dataset_t *ds, zio_ } } +static int +deadlist_enqueue_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + dsl_deadlist_t *dl = arg; + dsl_deadlist_insert(dl, bp, tx); + return (0); +} + +void +dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx) +{ + objset_t *os = ds->ds_objset; + + bplist_iterate(&ds->ds_pending_deadlist, + deadlist_enqueue_cb, &ds->ds_deadlist, tx); + + ASSERT(!dmu_objset_is_dirty(os, dmu_tx_get_txg(tx))); + + dmu_buf_rele(ds->ds_dbuf, ds); +} + static void get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) { @@ -2237,6 +2277,18 @@ dsl_dataset_rollback_check(void *arg, dm return (SET_ERROR(EINVAL)); } + /* + * No rollback to a snapshot created in the current txg, because + * the rollback may dirty the dataset and create blocks that are + * not reachable from the rootbp while having a birth txg that + * falls into the snapshot's range. + */ + if (dmu_tx_is_syncing(tx) && + dsl_dataset_phys(ds)->ds_prev_snap_txg >= tx->tx_txg) { + dsl_dataset_rele(ds, FTAG); + return (SET_ERROR(EAGAIN)); + } + /* must not have any bookmarks after the most recent snapshot */ nvlist_t *proprequest = fnvlist_alloc(); fnvlist_add_boolean(proprequest, zfs_prop_to_name(ZFS_PROP_CREATETXG)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:13:21 2016 (r310510) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:17:41 2016 (r310511) @@ -524,14 +524,6 @@ dsl_pool_mos_diduse_space(dsl_pool_t *dp mutex_exit(&dp->dp_lock); } -static int -deadlist_enqueue_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) -{ - dsl_deadlist_t *dl = arg; - dsl_deadlist_insert(dl, bp, tx); - return (0); -} - static void dsl_pool_sync_mos(dsl_pool_t *dp, dmu_tx_t *tx) { @@ -632,11 +624,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t t * - release hold from dsl_dataset_dirty() */ while ((ds = list_remove_head(&synced_datasets)) != NULL) { - objset_t *os = ds->ds_objset; - bplist_iterate(&ds->ds_pending_deadlist, - deadlist_enqueue_cb, &ds->ds_deadlist, tx); - ASSERT(!dmu_objset_is_dirty(os, txg)); - dmu_buf_rele(ds->ds_dbuf, ds); + dsl_dataset_sync_done(ds, tx); } while ((dd = txg_list_remove(&dp->dp_dirty_dirs, txg)) != NULL) { dsl_dir_sync(dd, tx); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Dec 24 14:13:21 2016 (r310510) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Dec 24 14:17:41 2016 (r310511) @@ -274,6 +274,7 @@ boolean_t dsl_dataset_modified_since_sna dsl_dataset_t *snap); void dsl_dataset_sync(dsl_dataset_t *os, zio_t *zio, dmu_tx_t *tx); +void dsl_dataset_sync_done(dsl_dataset_t *os, dmu_tx_t *tx); void dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx); From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:23:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99325C8E2F8; Sat, 24 Dec 2016 14:23:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 682685E0; Sat, 24 Dec 2016 14:23:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEN9xo062658; Sat, 24 Dec 2016 14:23:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEN9X3062657; Sat, 24 Dec 2016 14:23:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241423.uBOEN9X3062657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310513 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:23:10 -0000 Author: avg Date: Sat Dec 24 14:23:09 2016 New Revision: 310513 URL: https://svnweb.freebsd.org/changeset/base/310513 Log: MFC r309099: MFV r308990: 7181 race between zfs_mount and zfs_ioc_rollback Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:17:50 2016 (r310512) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:23:09 2016 (r310513) @@ -1039,13 +1039,6 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t if (error) return (error); - /* - * Set the objset user_ptr to track its zfsvfs. - */ - mutex_enter(&zfsvfs->z_os->os_user_ptr_lock); - dmu_objset_set_user(zfsvfs->z_os, zfsvfs); - mutex_exit(&zfsvfs->z_os->os_user_ptr_lock); - zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); /* @@ -1106,6 +1099,13 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */ } + /* + * Set the objset user_ptr to track its zfsvfs. + */ + mutex_enter(&zfsvfs->z_os->os_user_ptr_lock); + dmu_objset_set_user(zfsvfs->z_os, zfsvfs); + mutex_exit(&zfsvfs->z_os->os_user_ptr_lock); + return (0); } From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:25:21 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA5B6C8E482; Sat, 24 Dec 2016 14:25:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 820AFA0F; Sat, 24 Dec 2016 14:25:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEPKWG062947; Sat, 24 Dec 2016 14:25:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEPKcA062944; Sat, 24 Dec 2016 14:25:20 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241425.uBOEPKcA062944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310515 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:25:21 -0000 Author: avg Date: Sat Dec 24 14:25:20 2016 New Revision: 310515 URL: https://svnweb.freebsd.org/changeset/base/310515 Log: MFC r309250: MFV r309249: 3821 Race in rollback, zil close, and zil flush Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:23:14 2016 (r310514) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:25:20 2016 (r310515) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -681,9 +681,16 @@ dsl_pool_sync_done(dsl_pool_t *dp, uint6 { zilog_t *zilog; - while (zilog = txg_list_remove(&dp->dp_dirty_zilogs, txg)) { + while (zilog = txg_list_head(&dp->dp_dirty_zilogs, txg)) { dsl_dataset_t *ds = dmu_objset_ds(zilog->zl_os); + /* + * We don't remove the zilog from the dp_dirty_zilogs + * list until after we've cleaned it. This ensures that + * callers of zilog_is_dirty() receive an accurate + * answer when they are racing with the spa sync thread. + */ zil_clean(zilog, txg); + (void) txg_list_remove_this(&dp->dp_dirty_zilogs, zilog, txg); ASSERT(!dmu_objset_is_dirty(zilog->zl_os, txg)); dmu_buf_rele(ds->ds_dbuf, zilog); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Dec 24 14:23:14 2016 (r310514) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Dec 24 14:25:20 2016 (r310515) @@ -7091,8 +7091,6 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_config_syncing = NULL; } - spa->spa_ubsync = spa->spa_uberblock; - dsl_pool_sync_done(dp, txg); mutex_enter(&spa->spa_alloc_lock); @@ -7117,6 +7115,13 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_sync_pass = 0; + /* + * Update the last synced uberblock here. We want to do this at + * the end of spa_sync() so that consumers of spa_last_synced_txg() + * will be guaranteed that all the processing associated with + * that txg has been completed. + */ + spa->spa_ubsync = spa->spa_uberblock; spa_config_exit(spa, SCL_CONFIG, FTAG); spa_handle_ignored_writes(spa); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Dec 24 14:23:14 2016 (r310514) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Dec 24 14:25:20 2016 (r310515) @@ -20,8 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -492,6 +491,27 @@ zilog_dirty(zilog_t *zilog, uint64_t txg } } +/* + * Determine if the zil is dirty in the specified txg. Callers wanting to + * ensure that the dirty state does not change must hold the itxg_lock for + * the specified txg. Holding the lock will ensure that the zil cannot be + * dirtied (zil_itx_assign) or cleaned (zil_clean) while we check its current + * state. + */ +boolean_t +zilog_is_dirty_in_txg(zilog_t *zilog, uint64_t txg) +{ + dsl_pool_t *dp = zilog->zl_dmu_pool; + + if (txg_list_member(&dp->dp_dirty_zilogs, zilog, txg & TXG_MASK)) + return (B_TRUE); + return (B_FALSE); +} + +/* + * Determine if the zil is dirty. The zil is considered dirty if it has + * any pending itx records that have not been cleaned by zil_clean(). + */ boolean_t zilog_is_dirty(zilog_t *zilog) { @@ -1055,8 +1075,6 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it return (NULL); ASSERT(lwb->lwb_buf != NULL); - ASSERT(zilog_is_dirty(zilog) || - spa_freeze_txg(zilog->zl_spa) != UINT64_MAX); if (lrc->lrc_txtype == TX_WRITE && itx->itx_wr_state == WR_NEED_COPY) dlen = P2ROUNDUP_TYPED( @@ -1389,6 +1407,11 @@ zil_get_commit_list(zilog_t *zilog) else otxg = spa_last_synced_txg(zilog->zl_spa) + 1; + /* + * This is inherently racy, since there is nothing to prevent + * the last synced txg from changing. That's okay since we'll + * only commit things in the future. + */ for (txg = otxg; txg < (otxg + TXG_CONCURRENT_STATES); txg++) { itxg_t *itxg = &zilog->zl_itxg[txg & TXG_MASK]; @@ -1398,6 +1421,16 @@ zil_get_commit_list(zilog_t *zilog) continue; } + /* + * If we're adding itx records to the zl_itx_commit_list, + * then the zil better be dirty in this "txg". We can assert + * that here since we're holding the itxg_lock which will + * prevent spa_sync from cleaning it. Once we add the itxs + * to the zl_itx_commit_list we must commit it to disk even + * if it's unnecessary (i.e. the txg was synced). + */ + ASSERT(zilog_is_dirty_in_txg(zilog, txg) || + spa_freeze_txg(zilog->zl_spa) != UINT64_MAX); list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); push_sod += itxg->itxg_sod; itxg->itxg_sod = 0; @@ -1423,6 +1456,10 @@ zil_async_to_sync(zilog_t *zilog, uint64 else otxg = spa_last_synced_txg(zilog->zl_spa) + 1; + /* + * This is inherently racy, since there is nothing to prevent + * the last synced txg from changing. + */ for (txg = otxg; txg < (otxg + TXG_CONCURRENT_STATES); txg++) { itxg_t *itxg = &zilog->zl_itxg[txg & TXG_MASK]; @@ -1494,8 +1531,14 @@ zil_commit_writer(zilog_t *zilog) DTRACE_PROBE1(zil__cw1, zilog_t *, zilog); while (itx = list_head(&zilog->zl_itx_commit_list)) { txg = itx->itx_lr.lrc_txg; - ASSERT(txg); + ASSERT3U(txg, !=, 0); + /* + * This is inherently racy and may result in us writing + * out a log block for a txg that was just synced. This is + * ok since we'll end cleaning up that log block the next + * time we call zil_sync(). + */ if (txg > spa_last_synced_txg(spa) || txg > spa_freeze_txg(spa)) lwb = zil_lwb_commit(zilog, itx, lwb); list_remove(&zilog->zl_itx_commit_list, itx); @@ -1812,7 +1855,10 @@ zil_close(zilog_t *zilog) mutex_exit(&zilog->zl_lock); if (txg) txg_wait_synced(zilog->zl_dmu_pool, txg); - ASSERT(!zilog_is_dirty(zilog)); + + if (zilog_is_dirty(zilog)) + zfs_dbgmsg("zil (%p) is dirty, txg %llu", zilog, txg); + VERIFY(!zilog_is_dirty(zilog)); taskq_destroy(zilog->zl_clean_taskq); zilog->zl_clean_taskq = NULL; From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:33:37 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B12BC8E8F2; Sat, 24 Dec 2016 14:33:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06ED0126D; Sat, 24 Dec 2016 14:33:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEXatm067155; Sat, 24 Dec 2016 14:33:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEXZJh067151; Sat, 24 Dec 2016 14:33:35 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241433.uBOEXZJh067151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310517 - stable/11/sys/dev/ichiic X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:33:37 -0000 Author: avg Date: Sat Dec 24 14:33:35 2016 New Revision: 310517 URL: https://svnweb.freebsd.org/changeset/base/310517 Log: MFC r308219: ichiic/ig4: completely disengage from smbus Modified: stable/11/sys/dev/ichiic/ig4_iic.c stable/11/sys/dev/ichiic/ig4_pci.c stable/11/sys/dev/ichiic/ig4_reg.h stable/11/sys/dev/ichiic/ig4_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ichiic/ig4_iic.c ============================================================================== --- stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:33:35 2016 (r310517) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); /* - * Intel fourth generation mobile cpus integrated I2C device, smbus driver. + * Intel fourth generation mobile cpus integrated I2C deviceer. * * See ig4_reg.h for datasheet reference and notes. * See ig4_var.h for locking semantics. @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -236,18 +235,13 @@ data_read(ig4iic_softc_t *sc) * the target address for when the controller later issues a START. */ static void -set_slave_addr(ig4iic_softc_t *sc, uint8_t slave, int trans_op) +set_slave_addr(ig4iic_softc_t *sc, uint8_t slave) { uint32_t tar; uint32_t ctl; int use_10bit; - use_10bit = sc->use_10bit; - if (trans_op & SMB_TRANS_7BIT) - use_10bit = 0; - if (trans_op & SMB_TRANS_10BIT) - use_10bit = 1; - + use_10bit = 0; if (sc->slave_valid && sc->last_slave == slave && sc->use_10bit == use_10bit) { return; @@ -291,208 +285,12 @@ set_slave_addr(ig4iic_softc_t *sc, uint8 } /* - * Issue START with byte command, possible count, and a variable length - * read or write buffer, then possible turn-around read. The read also - * has a possible count received. - * - * For SMBUS - - * - * Quick: START+ADDR+RD/WR STOP - * - * Normal: START+ADDR+WR CMD DATA..DATA STOP - * - * START+ADDR+RD CMD - * RESTART+ADDR RDATA..RDATA STOP - * (can also be used for I2C transactions) - * - * Process Call: START+ADDR+WR CMD DATAL DATAH - * RESTART+ADDR+RD RDATAL RDATAH STOP - * - * Block: START+ADDR+RD CMD - * RESTART+ADDR+RD RCOUNT DATA... STOP - * - * START+ADDR+WR CMD - * RESTART+ADDR+WR WCOUNT DATA... STOP - * - * For I2C - basically, no *COUNT fields, possibly no *CMD field. If the - * sender needs to issue a 2-byte command it will incorporate it - * into the write buffer and also set NOCMD. - * - * Generally speaking, the START+ADDR / RESTART+ADDR is handled automatically - * by the controller at the beginning of a command sequence or on a data - * direction turn-around, and we only need to tell it when to issue the STOP. - */ -static int -smb_transaction(ig4iic_softc_t *sc, char cmd, int op, - char *wbuf, int wcount, char *rbuf, int rcount, int *actualp) -{ - int error; - int unit; - uint32_t last; - - /* - * Debugging - dump registers - */ - if (ig4_dump) { - unit = device_get_unit(sc->dev); - if (ig4_dump & (1 << unit)) { - ig4_dump &= ~(1 << unit); - ig4iic_dump(sc); - } - } - - /* - * Issue START or RESTART with next data byte, clear any previous - * abort condition that may have been holding the txfifo in reset. - */ - last = IG4_DATA_RESTART; - reg_read(sc, IG4_REG_CLR_TX_ABORT); - if (actualp) - *actualp = 0; - - /* - * Issue command if not told otherwise (smbus). - */ - if ((op & SMB_TRANS_NOCMD) == 0) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (error) - goto done; - last |= (u_char)cmd; - if (wcount == 0 && rcount == 0 && (op & SMB_TRANS_NOSTOP) == 0) - last |= IG4_DATA_STOP; - reg_write(sc, IG4_REG_DATA_CMD, last); - last = 0; - } - - /* - * Clean out any previously received data. - */ - if (sc->rpos != sc->rnext && - (op & SMB_TRANS_NOREPORT) == 0) { - device_printf(sc->dev, - "discarding %d bytes of spurious data\n", - sc->rnext - sc->rpos); - } - sc->rpos = 0; - sc->rnext = 0; - - /* - * If writing and not told otherwise, issue the write count (smbus). - */ - if (wcount && (op & SMB_TRANS_NOCNT) == 0) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (error) - goto done; - last |= (u_char)cmd; - reg_write(sc, IG4_REG_DATA_CMD, last); - last = 0; - } - - /* - * Bulk write (i2c) - */ - while (wcount) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (error) - goto done; - last |= (u_char)*wbuf; - if (wcount == 1 && rcount == 0 && (op & SMB_TRANS_NOSTOP) == 0) - last |= IG4_DATA_STOP; - reg_write(sc, IG4_REG_DATA_CMD, last); - --wcount; - ++wbuf; - last = 0; - } - - /* - * Issue reads to xmit FIFO (strange, I know) to tell the controller - * to clock in data. At the moment just issue one read ahead to - * pipeline the incoming data. - * - * NOTE: In the case of NOCMD and wcount == 0 we still issue a - * RESTART here, even if the data direction has not changed - * from the previous CHAINing call. This we force the RESTART. - * (A new START is issued automatically by the controller in - * the other nominal cases such as a data direction change or - * a previous STOP was issued). - * - * If this will be the last byte read we must also issue the STOP - * at the end of the read. - */ - if (rcount) { - last = IG4_DATA_RESTART | IG4_DATA_COMMAND_RD; - if (rcount == 1 && - (op & (SMB_TRANS_NOSTOP | SMB_TRANS_NOCNT)) == - SMB_TRANS_NOCNT) { - last |= IG4_DATA_STOP; - } - reg_write(sc, IG4_REG_DATA_CMD, last); - last = IG4_DATA_COMMAND_RD; - } - - /* - * Bulk read (i2c) and count field handling (smbus) - */ - while (rcount) { - /* - * Maintain a pipeline by queueing the allowance for the next - * read before waiting for the current read. - */ - if (rcount > 1) { - if (op & SMB_TRANS_NOCNT) - last = (rcount == 2) ? IG4_DATA_STOP : 0; - else - last = 0; - reg_write(sc, IG4_REG_DATA_CMD, IG4_DATA_COMMAND_RD | - last); - } - error = wait_status(sc, IG4_STATUS_RX_NOTEMPTY); - if (error) { - if ((op & SMB_TRANS_NOREPORT) == 0) { - device_printf(sc->dev, - "rx timeout addr 0x%02x\n", - sc->last_slave); - } - goto done; - } - last = data_read(sc); - - if (op & SMB_TRANS_NOCNT) { - *rbuf = (u_char)last; - ++rbuf; - --rcount; - if (actualp) - ++*actualp; - } else { - /* - * Handle count field (smbus), which is not part of - * the rcount'ed buffer. The first read data in a - * bulk transfer is the count. - * - * XXX if rcount is loaded as 0 how do I generate a - * STOP now without issuing another RD or WR? - */ - if (rcount > (u_char)last) - rcount = (u_char)last; - op |= SMB_TRANS_NOCNT; - } - } - error = 0; -done: - /* XXX wait for xmit buffer to become empty */ - last = reg_read(sc, IG4_REG_TX_ABRT_SOURCE); - - return (error); -} - -/* * IICBUS API FUNCTIONS */ static int ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave) { - /* XXX 10-bit address support? */ - set_slave_addr(sc, slave >> 1, 0); + set_slave_addr(sc, slave >> 1); return (0); } @@ -706,7 +504,7 @@ ig4iic_reset(device_t dev, u_char speed, /* TODO handle speed configuration? */ if (oldaddr != NULL) *oldaddr = sc->last_slave << 1; - set_slave_addr(sc, addr >> 1, 0); + set_slave_addr(sc, addr >> 1); if (addr == IIC_UNKNOWN) sc->slave_valid = false; @@ -716,8 +514,6 @@ ig4iic_reset(device_t dev, u_char speed, } /* - * SMBUS API FUNCTIONS - * * Called from ig4iic_pci_attach/detach() */ int @@ -836,7 +632,6 @@ ig4iic_start(void *xdev) config_intrhook_disestablish(&sc->enum_hook); - /* Attach us to the smbus */ error = bus_generic_attach(sc->dev); if (error) { device_printf(sc->dev, @@ -844,8 +639,6 @@ ig4iic_start(void *xdev) } } - - int ig4iic_detach(ig4iic_softc_t *sc) { @@ -874,276 +667,6 @@ ig4iic_detach(ig4iic_softc_t *sc) return (0); } -int -ig4iic_smb_callback(device_t dev, int index, void *data) -{ - int error; - - switch (index) { - case SMB_REQUEST_BUS: - error = 0; - break; - case SMB_RELEASE_BUS: - error = 0; - break; - default: - error = SMB_EABORT; - break; - } - - return (error); -} - -/* - * Quick command. i.e. START + cmd + R/W + STOP and no data. It is - * unclear to me how I could implement this with the intel i2c controller - * because the controller sends STARTs and STOPs automatically with data. - */ -int -ig4iic_smb_quick(device_t dev, u_char slave, int how) -{ - - return (SMB_ENOTSUPP); -} - -/* - * Incremental send byte without stop (?). It is unclear why the slave - * address is specified if this presumably is used in combination with - * ig4iic_smb_quick(). - * - * (Also, how would this work anyway? Issue the last byte with writeb()?) - */ -int -ig4iic_smb_sendb(device_t dev, u_char slave, char byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - uint32_t cmd; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - cmd = byte; - if (wait_status(sc, IG4_STATUS_TX_NOTFULL) == 0) { - reg_write(sc, IG4_REG_DATA_CMD, cmd); - error = 0; - } else { - error = SMB_ETIMEOUT; - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * Incremental receive byte without stop (?). It is unclear why the slave - * address is specified if this presumably is used in combination with - * ig4iic_smb_quick(). - */ -int -ig4iic_smb_recvb(device_t dev, u_char slave, char *byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - reg_write(sc, IG4_REG_DATA_CMD, IG4_DATA_COMMAND_RD); - if (wait_status(sc, IG4_STATUS_RX_NOTEMPTY) == 0) { - *byte = data_read(sc); - error = 0; - } else { - *byte = 0; - error = SMB_ETIMEOUT; - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * Write command and single byte in transaction. - */ -int -ig4iic_smb_writeb(device_t dev, u_char slave, char cmd, char byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - &byte, 1, NULL, 0, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * Write command and single word in transaction. - */ -int -ig4iic_smb_writew(device_t dev, u_char slave, char cmd, short word) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - char buf[2]; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - buf[0] = word & 0xFF; - buf[1] = word >> 8; - error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - buf, 2, NULL, 0, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * write command and read single byte in transaction. - */ -int -ig4iic_smb_readb(device_t dev, u_char slave, char cmd, char *byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - NULL, 0, byte, 1, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * write command and read word in transaction. - */ -int -ig4iic_smb_readw(device_t dev, u_char slave, char cmd, short *word) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - char buf[2]; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - if ((error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - NULL, 0, buf, 2, NULL)) == 0) { - *word = (u_char)buf[0] | ((u_char)buf[1] << 8); - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * write command and word and read word in transaction - */ -int -ig4iic_smb_pcall(device_t dev, u_char slave, char cmd, - short sdata, short *rdata) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - char rbuf[2]; - char wbuf[2]; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - wbuf[0] = sdata & 0xFF; - wbuf[1] = sdata >> 8; - if ((error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - wbuf, 2, rbuf, 2, NULL)) == 0) { - *rdata = (u_char)rbuf[0] | ((u_char)rbuf[1] << 8); - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -int -ig4iic_smb_bwrite(device_t dev, u_char slave, char cmd, - u_char wcount, char *buf) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, 0, - buf, wcount, NULL, 0, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -int -ig4iic_smb_bread(device_t dev, u_char slave, char cmd, - u_char *countp_char, char *buf) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int rcount = *countp_char; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, 0, - NULL, 0, buf, rcount, &rcount); - *countp_char = rcount; - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -int -ig4iic_smb_trans(device_t dev, int slave, char cmd, int op, - char *wbuf, int wcount, char *rbuf, int rcount, - int *actualp) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, op); - error = smb_transaction(sc, cmd, op, - wbuf, wcount, rbuf, rcount, actualp); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - /* * Interrupt Operation, see ig4_var.h for locking semantics. */ Modified: stable/11/sys/dev/ichiic/ig4_pci.c ============================================================================== --- stable/11/sys/dev/ichiic/ig4_pci.c Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_pci.c Sat Dec 24 14:33:35 2016 (r310517) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); /* - * Intel fourth generation mobile cpus integrated I2C device, smbus driver. + * Intel fourth generation mobile cpus integrated I2C device. * * See ig4_reg.h for datasheet reference and notes. */ @@ -59,11 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include -#include "smbus_if.h" - #include #include @@ -167,20 +164,6 @@ static device_method_t ig4iic_pci_method DEVMETHOD(device_attach, ig4iic_pci_attach), DEVMETHOD(device_detach, ig4iic_pci_detach), - /* SMBus methods from ig4_smb.c */ - DEVMETHOD(smbus_callback, ig4iic_smb_callback), - DEVMETHOD(smbus_quick, ig4iic_smb_quick), - DEVMETHOD(smbus_sendb, ig4iic_smb_sendb), - DEVMETHOD(smbus_recvb, ig4iic_smb_recvb), - DEVMETHOD(smbus_writeb, ig4iic_smb_writeb), - DEVMETHOD(smbus_writew, ig4iic_smb_writew), - DEVMETHOD(smbus_readb, ig4iic_smb_readb), - DEVMETHOD(smbus_readw, ig4iic_smb_readw), - DEVMETHOD(smbus_pcall, ig4iic_smb_pcall), - DEVMETHOD(smbus_bwrite, ig4iic_smb_bwrite), - DEVMETHOD(smbus_bread, ig4iic_smb_bread), - DEVMETHOD(smbus_trans, ig4iic_smb_trans), - DEVMETHOD(iicbus_transfer, ig4iic_transfer), DEVMETHOD(iicbus_reset, ig4iic_reset), DEVMETHOD(iicbus_callback, iicbus_null_callback), @@ -199,6 +182,5 @@ static devclass_t ig4iic_pci_devclass; DRIVER_MODULE_ORDERED(ig4iic, pci, ig4iic_pci_driver, ig4iic_pci_devclass, 0, 0, SI_ORDER_ANY); MODULE_DEPEND(ig4iic, pci, 1, 1, 1); -MODULE_DEPEND(ig4iic, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); MODULE_DEPEND(ig4iic, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); MODULE_VERSION(ig4iic, 1); Modified: stable/11/sys/dev/ichiic/ig4_reg.h ============================================================================== --- stable/11/sys/dev/ichiic/ig4_reg.h Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_reg.h Sat Dec 24 14:33:35 2016 (r310517) @@ -47,14 +47,14 @@ * I am also using the linux driver code as a reference to help resolve any * issues that come. These will be specifically documented in the code. * - * Please see protocol notes in section 5.21. This controller is an I2C - * master only and cannot act as a slave. The IO voltage should be set by - * the BIOS. Standard (100Kb/s) and Fast (400Kb/s) and fast mode plus - * (1MB/s) is supported. High speed mode (3.4 MB/s) is NOT supported. + * This controller is an I2C master only and cannot act as a slave. The IO + * voltage should be set by the BIOS. Standard (100Kb/s) and Fast (400Kb/s) + * and fast mode plus (1MB/s) is supported. High speed mode (3.4 MB/s) is NOT + * supported. */ -#ifndef _BUS_SMBUS_INTELGEN4_IG4_REG_H_ -#define _BUS_SMBUS_INTELGEN4_IG4_REG_H_ +#ifndef _ICHIIC_IG4_REG_H_ +#define _ICHIIC_IG4_REG_H_ /* * 22.2 MMIO registers can be accessed through BAR0 in PCI mode or through @@ -619,4 +619,4 @@ #define IG4_SWLTR_SNOOP_VALUE_DECODE(v) ((v) & 0x3F) #define IG4_SWLTR_SNOOP_VALUE_ENCODE(v) ((v) & 0x3F) -#endif +#endif /* _ICHIIC_IG4_REG_H_ */ Modified: stable/11/sys/dev/ichiic/ig4_var.h ============================================================================== --- stable/11/sys/dev/ichiic/ig4_var.h Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_var.h Sat Dec 24 14:33:35 2016 (r310517) @@ -35,13 +35,12 @@ * $FreeBSD$ */ -#ifndef _BUS_SMBUS_INTELGEN4_IG4_VAR_H_ -#define _BUS_SMBUS_INTELGEN4_IG4_VAR_H_ +#ifndef _ICHIIC_IG4_VAR_H_ +#define _ICHIIC_IG4_VAR_H_ #include "bus_if.h" #include "device_if.h" #include "pci_if.h" -#include "smbus_if.h" #include "iicbus_if.h" #define IG4_RBUFSIZE 128 @@ -75,12 +74,12 @@ struct ig4iic_softc { /* * Locking semantics: * - * Functions implementing the smbus interface that interact + * Functions implementing the icbus interface that interact * with the controller acquire an exclusive lock on call_lock * to prevent interleaving of calls to the interface and a lock on * io_lock right afterwards, to synchronize controller I/O activity. - * - * The interrupt handler can only read data while no ig4iic_smb_* call + * + * The interrupt handler can only read data while no iicbus call * is in progress or while io_lock is dropped during mtx_sleep in * wait_status and set_controller. It is safe to drop io_lock in those * places, because the interrupt handler only accesses those registers: @@ -91,7 +90,7 @@ struct ig4iic_softc { * * Locking outside of those places is required to make the content * of rpos/rnext predictable (e.g. whenever data_read is called and in - * smb_transaction). + * ig4iic_transfer). */ struct sx call_lock; struct mtx io_lock; @@ -103,20 +102,8 @@ typedef struct ig4iic_softc ig4iic_softc int ig4iic_attach(ig4iic_softc_t *sc); int ig4iic_detach(ig4iic_softc_t *sc); -/* SMBus methods */ -extern smbus_callback_t ig4iic_smb_callback; -extern smbus_quick_t ig4iic_smb_quick; -extern smbus_sendb_t ig4iic_smb_sendb; -extern smbus_recvb_t ig4iic_smb_recvb; -extern smbus_writeb_t ig4iic_smb_writeb; -extern smbus_writew_t ig4iic_smb_writew; -extern smbus_readb_t ig4iic_smb_readb; -extern smbus_readw_t ig4iic_smb_readw; -extern smbus_pcall_t ig4iic_smb_pcall; -extern smbus_bwrite_t ig4iic_smb_bwrite; -extern smbus_bread_t ig4iic_smb_bread; -extern smbus_trans_t ig4iic_smb_trans; +/* iicbus methods */ extern iicbus_transfer_t ig4iic_transfer; extern iicbus_reset_t ig4iic_reset; -#endif +#endif /* _ICHIIC_IG4_VAR_H_ */ From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:39:31 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4253DC8EA0B; Sat, 24 Dec 2016 14:39:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 117DE14DD; Sat, 24 Dec 2016 14:39:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEdU6G067406; Sat, 24 Dec 2016 14:39:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEdUhg067405; Sat, 24 Dec 2016 14:39:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241439.uBOEdUhg067405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:39:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310518 - stable/11/sys/dev/smbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:39:31 -0000 Author: avg Date: Sat Dec 24 14:39:30 2016 New Revision: 310518 URL: https://svnweb.freebsd.org/changeset/base/310518 Log: MFC r308220: smbus: remove the potentially very dangerous slave probing code Modified: stable/11/sys/dev/smbus/smbus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/smbus/smbus.c ============================================================================== --- stable/11/sys/dev/smbus/smbus.c Sat Dec 24 14:33:35 2016 (r310517) +++ stable/11/sys/dev/smbus/smbus.c Sat Dec 24 14:39:30 2016 (r310518) @@ -50,7 +50,6 @@ struct smbus_ivar /* * Autoconfiguration and support routines for System Management bus */ -static void smbus_probe_device(device_t dev, u_char addr); static int smbus_probe(device_t dev) @@ -65,13 +64,9 @@ static int smbus_attach(device_t dev) { struct smbus_softc *sc = device_get_softc(dev); - unsigned char addr; mtx_init(&sc->lock, device_get_nameunit(dev), "smbus", MTX_DEF); bus_generic_probe(dev); - for (addr = SMBUS_ADDR_MIN; addr < SMBUS_ADDR_MAX; ++addr) { - smbus_probe_device(dev, addr); - } bus_enumerate_hinted_children(dev); bus_generic_attach(dev); @@ -98,30 +93,6 @@ smbus_generic_intr(device_t dev, u_char { } -static void -smbus_probe_device(device_t dev, u_char addr) -{ - device_t child; - int error; - u_char cmd; - u_char buf[2]; - struct smbus_ivar *devi; - - cmd = 0x01; - error = smbus_trans(dev, addr, cmd, - SMB_TRANS_NOCNT | SMB_TRANS_NOREPORT, - NULL, 0, buf, 1, NULL); - if (error == 0) { - if (bootverbose) - device_printf(dev, "Probed address 0x%02x\n", addr); - child = BUS_ADD_CHILD(dev, SMBUS_ORDER_PNP, NULL, -1); - if (child == NULL) - return; - devi = device_get_ivars(child); - devi->addr = addr; - } -} - static device_t smbus_add_child(device_t dev, u_int order, const char *name, int unit) { From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:41:12 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0B07C8ECF5; Sat, 24 Dec 2016 14:41:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7023518B9; Sat, 24 Dec 2016 14:41:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEfBlI067653; Sat, 24 Dec 2016 14:41:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEfBme067652; Sat, 24 Dec 2016 14:41:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241441.uBOEfBme067652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310519 - stable/11/sys/dev/ichiic X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:41:12 -0000 Author: avg Date: Sat Dec 24 14:41:11 2016 New Revision: 310519 URL: https://svnweb.freebsd.org/changeset/base/310519 Log: MFC r308221: fix typo in a comment Modified: stable/11/sys/dev/ichiic/ig4_iic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ichiic/ig4_iic.c ============================================================================== --- stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:39:30 2016 (r310518) +++ stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:41:11 2016 (r310519) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); /* - * Intel fourth generation mobile cpus integrated I2C deviceer. + * Intel fourth generation mobile cpus integrated I2C device. * * See ig4_reg.h for datasheet reference and notes. * See ig4_var.h for locking semantics. From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:44:26 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1B87C8EF61; Sat, 24 Dec 2016 14:44:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 724ED1C68; Sat, 24 Dec 2016 14:44:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEiPs9071693; Sat, 24 Dec 2016 14:44:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEiPoL071688; Sat, 24 Dec 2016 14:44:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241444.uBOEiPoL071688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310520 - in stable/11: share/man/man4 sys/dev/smbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:44:26 -0000 Author: avg Date: Sat Dec 24 14:44:25 2016 New Revision: 310520 URL: https://svnweb.freebsd.org/changeset/base/310520 Log: MFC r308242: smbus: remove smbus_trans / SMB_TRANS This change reverts most of r281985. The method did not map to anything defined by SMBus protocol and could not be implemented for SMBus controllers. This change is obviously not backwards compatible, but I have good reasons to believe that there have never been any users of SMB_TRANS. Modified: stable/11/share/man/man4/smb.4 stable/11/sys/dev/smbus/smb.c stable/11/sys/dev/smbus/smb.h stable/11/sys/dev/smbus/smbconf.h stable/11/sys/dev/smbus/smbus_if.m Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/smb.4 ============================================================================== --- stable/11/share/man/man4/smb.4 Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/share/man/man4/smb.4 Sat Dec 24 14:44:25 2016 (r310520) @@ -162,33 +162,6 @@ to the device, then reads bytes of data that from the device. This data is returned in the buffer pointed to by .Fa rbuf . -.It Dv SMB_TRANS Ta -.Em Trans -sends an SMB roll-up transaction with flags that also allow it to -be used for (mostly) I2C pass-through and with 10-bit addresses. -This function can be utilized to roll up all of the above functions. -It first sends the byte from -.Fa cmd -to the device, followed by -.Fa wcount -bytes of data that are taken from the buffer pointed to by -.Fa wbuf , -then reads -.Fa rcount -bytes of data that from the device. -This data is returned in the buffer pointed to by -.Fa rbuf . -.Pp -The following flags are allowed in -.Fa op : -.Pp -.Bd -literal -compact -SMB_TRANS_NOSTOP Do not send STOP at end -SMB_TRANS_NOCMD Ignore cmd field (do not tx) -SMB_TRANS_NOCNT Do not tx or rx count field -SMB_TRANS_7BIT Change address mode to 7-bit -SMB_TRANS_10BIT Change address mode to 10-bit -.Ed .El .Pp The Modified: stable/11/sys/dev/smbus/smb.c ============================================================================== --- stable/11/sys/dev/smbus/smb.c Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smb.c Sat Dec 24 14:44:25 2016 (r310520) @@ -301,24 +301,6 @@ smbioctl(struct cdev *dev, u_long cmd, c error = copyout(buf, s->rbuf, s->rcount); break; - case SMB_TRANS: - if (s->rcount < 0 || s->wcount < 0) { - error = EINVAL; - break; - } - if (s->rcount > SMB_MAXBLOCKSIZE) - s->rcount = SMB_MAXBLOCKSIZE; - if (s->wcount > SMB_MAXBLOCKSIZE) - s->wcount = SMB_MAXBLOCKSIZE; - if (s->wcount) - error = copyin(s->wbuf, buf, s->wcount); - if (error) - break; - error = smbus_error(smbus_trans(parent, s->slave, s->cmd, - s->op, buf, s->wcount, buf, s->rcount, &s->rcount)); - if (error == 0) - error = copyout(buf, s->rbuf, s->rcount); - break; default: error = ENOTTY; } Modified: stable/11/sys/dev/smbus/smb.h ============================================================================== --- stable/11/sys/dev/smbus/smb.h Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smb.h Sat Dec 24 14:44:25 2016 (r310520) @@ -54,11 +54,8 @@ struct smbcmd { /* * SMBus spec 2.0 says block transfers may be at most 32 bytes. - * We use SMBus for i2c as well, make the size limit something more - * reasonable. Keep in mind that a char buf array is declared on the - * kernel stack. */ -#define SMB_MAXBLOCKSIZE 1024 +#define SMB_MAXBLOCKSIZE 32 #define SMB_QUICK_WRITE _IOW('i', 1, struct smbcmd) #define SMB_QUICK_READ _IOW('i', 2, struct smbcmd) @@ -71,6 +68,6 @@ struct smbcmd { #define SMB_PCALL _IOWR('i', 9, struct smbcmd) #define SMB_BWRITE _IOW('i', 10, struct smbcmd) #define SMB_BREAD _IOWR('i', 11, struct smbcmd) -#define SMB_TRANS _IOWR('i', 12, struct smbcmd) +#define SMB_OLD_TRANS _IOWR('i', 12, struct smbcmd) #endif Modified: stable/11/sys/dev/smbus/smbconf.h ============================================================================== --- stable/11/sys/dev/smbus/smbconf.h Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smbconf.h Sat Dec 24 14:44:25 2016 (r310520) @@ -72,25 +72,6 @@ #define SMB_QREAD 0x1 /* - * smbus transction op with pass-thru capabilities - * - * This smbus function is capable of doing a smbus command transaction - * (read or write), and can be flagged to not issue the 'cmd' and/or - * issue or expect a count field as well as flagged for chaining (no STOP), - * which gives it an i2c pass-through capability. - * - * NOSTOP- Caller chaining transactions, do not issue STOP - * NOCMD- Do not transmit the command field - * NOCNT- Do not transmit (wr) or expect (rd) the count field - */ -#define SMB_TRANS_NOSTOP 0x0001 /* do not send STOP at end */ -#define SMB_TRANS_NOCMD 0x0002 /* ignore cmd field (do not tx) */ -#define SMB_TRANS_NOCNT 0x0004 /* do not tx or rx count field */ -#define SMB_TRANS_7BIT 0x0008 /* change address mode to 7-bit */ -#define SMB_TRANS_10BIT 0x0010 /* change address mode to 10-bit */ -#define SMB_TRANS_NOREPORT 0x0020 /* do not report errors */ - -/* * ivars codes */ enum smbus_ivars { Modified: stable/11/sys/dev/smbus/smbus_if.m ============================================================================== --- stable/11/sys/dev/smbus/smbus_if.m Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smbus_if.m Sat Dec 24 14:44:25 2016 (r310520) @@ -149,20 +149,3 @@ METHOD int bread { u_char *count; char *buf; }; - -# -# SMB roll-up transaction with flags that also allow it to be -# used for (mostly) i2c pass-through and with 10-bit addresses. -# This function can be used to roll-up all of the above functions. -# -METHOD int trans { - device_t dev; - int slave; - char cmd; - int op; - char *wbuf; - int wcount; - char *rbuf; - int rcount; - int *actualp; -}; From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:48:51 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 182E4C8D1B9; Sat, 24 Dec 2016 14:48:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C255C1F67; Sat, 24 Dec 2016 14:48:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEmnJo071956; Sat, 24 Dec 2016 14:48:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEmneZ071955; Sat, 24 Dec 2016 14:48:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241448.uBOEmneZ071955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310522 - stable/11/sys/dev/iicbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:48:51 -0000 Author: avg Date: Sat Dec 24 14:48:49 2016 New Revision: 310522 URL: https://svnweb.freebsd.org/changeset/base/310522 Log: MFC r308530: iicsmb: SMB_MAXBLOCKSIZE can be used again Modified: stable/11/sys/dev/iicbus/iicsmb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/iicsmb.c ============================================================================== --- stable/11/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:48:28 2016 (r310521) +++ stable/11/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:48:49 2016 (r310522) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "iicbus_if.h" @@ -432,7 +433,7 @@ iicsmb_bwrite(device_t dev, u_char slave }; int error; - if (count > 32 || count == 0) + if (count > SMB_MAXBLOCKSIZE || count == 0) return (SMB_EINVAL); error = TRANSFER_MSGS(dev, msgs); return (iic2smb_error(error)); @@ -450,12 +451,6 @@ iicsmb_bread(device_t dev, u_char slave, }; device_t parent = device_get_parent(dev); int error; - u_char bufsz; - - /* Stash output buffer size before overwriting it. */ - bufsz = *count; - if (bufsz == 0) - return (SMB_EINVAL); /* Have to do this because the command is split in two transfers. */ error = iicbus_request_bus(parent, dev, IIC_WAIT); @@ -465,18 +460,13 @@ iicsmb_bread(device_t dev, u_char slave, /* * If the slave offers an empty or a too long reply, * read one byte to generate the stop or abort. - * XXX 32 is hardcoded until SMB_MAXBLOCKSIZE is restored - * to sanity. */ - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) block_msg[0].len = 1; - /* If longer than the buffer, then clamp at the buffer size. */ - if (*count > bufsz) - block_msg[0].len = bufsz; else block_msg[0].len = *count; error = TRANSFER_MSGS(dev, block_msg); - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) error = SMB_EINVAL; } (void)iicbus_release_bus(parent, dev); From owner-svn-src-stable-11@freebsd.org Sat Dec 24 14:50:14 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A132C8D261; Sat, 24 Dec 2016 14:50:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38FB314D; Sat, 24 Dec 2016 14:50:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEoDMW072093; Sat, 24 Dec 2016 14:50:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEoDf3072092; Sat, 24 Dec 2016 14:50:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241450.uBOEoDf3072092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310523 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:50:14 -0000 Author: avg Date: Sat Dec 24 14:50:13 2016 New Revision: 310523 URL: https://svnweb.freebsd.org/changeset/base/310523 Log: MFC r308532: update SMB_BWRITE documentation, clarify SMB_BREAD Modified: stable/11/share/man/man4/smb.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/smb.4 ============================================================================== --- stable/11/share/man/man4/smb.4 Sat Dec 24 14:48:49 2016 (r310522) +++ stable/11/share/man/man4/smb.4 Sat Dec 24 14:50:13 2016 (r310523) @@ -141,26 +141,25 @@ in .Em BlockWrite first sends the byte from .Fa cmd -to the device, followed by +to the device, then the byte from +.Fa wcount +followed by .Fa wcount bytes of data that are taken from the buffer pointed to by .Fa wbuf . The SMBus specification mandates that no more than 32 bytes of -data can be transferred in a single block read or write command, -but since -.Xr smbus 4 -is also used to access I2C devices, the limit has been increased -to 1024. +data can be transferred in a single block read or write command. This value can be read from the constant .Dv SMB_MAXBLOCKSIZE . .It Dv SMB_BREAD Ta .Em BlockRead first sends the byte from .Fa cmd -to the device, then reads -.Fa rcount -bytes of data that from the device. -This data is returned in the buffer pointed to by +to the device, then reads a count of data bytes that the device +is going to provide and then reads that many bytes. +The count is returned in +.Fa rcount. +The data is returned in the buffer pointed to by .Fa rbuf . .El .Pp From owner-svn-src-stable-11@freebsd.org Sat Dec 24 16:01:21 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A25ECC8F5B3; Sat, 24 Dec 2016 16:01:21 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B83D86E; Sat, 24 Dec 2016 16:01:20 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id uBOG1ALN082264; Sat, 24 Dec 2016 08:01:13 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id uBOG15jv082263; Sat, 24 Dec 2016 08:01:05 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201612241601.uBOG15jv082263@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r310517 - stable/11/sys/dev/ichiic In-Reply-To: <201612241433.uBOEXZJh067151@repo.freebsd.org> To: Andriy Gapon Date: Sat, 24 Dec 2016 08:01:05 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 16:01:21 -0000 Small typo to fix please. > Author: avg > Date: Sat Dec 24 14:33:35 2016 > New Revision: 310517 > URL: https://svnweb.freebsd.org/changeset/base/310517 > > Log: > MFC r308219: ichiic/ig4: completely disengage from smbus > > Modified: > stable/11/sys/dev/ichiic/ig4_iic.c > stable/11/sys/dev/ichiic/ig4_pci.c > stable/11/sys/dev/ichiic/ig4_reg.h > stable/11/sys/dev/ichiic/ig4_var.h > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/dev/ichiic/ig4_iic.c > ============================================================================== > --- stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:25:25 2016 (r310516) > +++ stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:33:35 2016 (r310517) > @@ -37,7 +37,7 @@ > __FBSDID("$FreeBSD$"); > > /* > - * Intel fourth generation mobile cpus integrated I2C device, smbus driver. > + * Intel fourth generation mobile cpus integrated I2C deviceer. ^^^^^^^^^^^^^^ -- Rod Grimes rgrimes@freebsd.org