From owner-svn-src-stable-10@FreeBSD.ORG Sun Jun 14 03:14:49 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0F719EEB; Sun, 14 Jun 2015 03:14:49 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEE66951; Sun, 14 Jun 2015 03:14:48 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5E3EmZL089285; Sun, 14 Jun 2015 03:14:48 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5E3EjFb089270; Sun, 14 Jun 2015 03:14:45 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201506140314.t5E3EjFb089270@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sun, 14 Jun 2015 03:14:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284365 - in stable/10: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2015 03:14:49 -0000 Author: bryanv Date: Sun Jun 14 03:14:45 2015 New Revision: 284365 URL: https://svnweb.freebsd.org/changeset/base/284365 Log: MFC r273331, r273371, r275851: - Add vxlan interface - Use the size of the Ethernet address, not the entire header, when copying into forwarding entry. - Prefix all the vxlan ifconfig commands so they are unique Added: stable/10/sbin/ifconfig/ifvxlan.c - copied, changed from r273331, head/sbin/ifconfig/ifvxlan.c stable/10/share/man/man4/vxlan.4 - copied, changed from r273331, head/share/man/man4/vxlan.4 stable/10/sys/modules/if_vxlan/ - copied from r273331, head/sys/modules/if_vxlan/ stable/10/sys/net/if_vxlan.c - copied, changed from r273331, head/sys/net/if_vxlan.c stable/10/sys/net/if_vxlan.h - copied unchanged from r273331, head/sys/net/if_vxlan.h Modified: stable/10/sbin/ifconfig/Makefile stable/10/sbin/ifconfig/ifconfig.8 stable/10/share/man/man4/Makefile stable/10/sys/conf/NOTES stable/10/sys/conf/files stable/10/sys/modules/Makefile stable/10/sys/sys/priv.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ifconfig/Makefile ============================================================================== --- stable/10/sbin/ifconfig/Makefile Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/sbin/ifconfig/Makefile Sun Jun 14 03:14:45 2015 (r284365) @@ -31,6 +31,7 @@ SRCS+= ifmac.c # MAC support SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support SRCS+= iffib.c # non-default FIB support SRCS+= ifvlan.c # SIOC[GS]ETVLAN support +SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround Modified: stable/10/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/10/sbin/ifconfig/ifconfig.8 Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/sbin/ifconfig/ifconfig.8 Sun Jun 14 03:14:45 2015 (r284365) @@ -2586,6 +2586,76 @@ argument is useless and hence deprecated .El .Pp The following parameters are used to configure +.Xr vxlan 4 +interfaces. +.Bl -tag -width indent +.It Cm vxlanid Ar identifier +This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the +virtual network segment membership of the interface. +.It Cm vxlanlocal Ar address +The source address used in the encapsulating IPv4/IPv6 header. +The address should already be assigned to an existing interface. +When the interface is configured in unicast mode, the listening socket +is bound to this address. +.It Cm vxlanremote Ar address +The interface can be configured in a unicast, or point-to-point, mode +to create a tunnel between two hosts. +This is the IP address of the remote end of the tunnel. +.It Cm vxlangroup Ar address +The interface can be configured in a multicast mode +to create a virtual network of hosts. +This is the IP multicast group address the interface will join. +.It Cm vxlanlocalport Ar port +The port number the interface will listen on. +The default port number is 4789. +.It Cm vxlanremoteport Ar port +The destination port number used in the encapsulating IPv4/IPv6 header. +The remote host should be listening on this port. +The default port number is 4789. +Note some other implementations, such as Linux, +do not default to the IANA assigned port, +but instead listen on port 8472. +.It Cm vxlanportrange Ar low high +The range of source ports used in the encapsulating IPv4/IPv6 header. +The port selected within the range is based on a hash of the inner frame. +A range is useful to provide entropy within the outer IP header +for more effective load balancing. +The default range is between the +.Xr sysctl 8 +variables +.Va net.inet.ip.portrange.first +and +.Va net.inet.ip.portrange.last +.It Cm vxlantimeout Ar timeout +The maximum time, in seconds, before an entry in the forwarding table +is pruned. +The default is 1200 seconds (20 minutes). +.It Cm vxlanmaxaddr Ar max +The maximum number of entries in the forwarding table. +The default is 2000. +.It Cm vxlandev Ar dev +When the interface is configured in multicast mode, the +.Cm dev +interface is used to transmit IP multicast packets. +.It Cm vxlanttl Ar ttl +The TTL used in the encapsulating IPv4/IPv6 header. +The default is 64. +.It Cm vxlanlearn +The source IP address and inner source Ethernet MAC address of +received packets are used to dynamically populate the forwarding table. +When in multicast mode, an entry in the forwarding table allows the +interface to send the frame directly to the remote host instead of +broadcasting the frame to the multicast group. +This is the default. +.It Fl vxlanlearn +The forwarding table is not populated by recevied packets. +.It Cm vxlanflush +Delete all dynamically-learned addresses from the forwarding table. +.It Cm vxlanflushall +Delete all addresses, including static addresses, from the forwarding table. +.El +.Pp +The following parameters are used to configure .Xr carp 4 protocol on an interface: .Bl -tag -width indent @@ -2790,6 +2860,7 @@ tried to alter an interface's configurat .Xr pfsync 4 , .Xr polling 4 , .Xr vlan 4 , +.Xr vxlan 4 , .Xr devd.conf 5 , .\" .Xr eon 5 , .Xr devd 8 , Copied and modified: stable/10/sbin/ifconfig/ifvxlan.c (from r273331, head/sbin/ifconfig/ifvxlan.c) ============================================================================== --- head/sbin/ifconfig/ifvxlan.c Mon Oct 20 14:42:42 2014 (r273331, copy source) +++ stable/10/sbin/ifconfig/ifvxlan.c Sun Jun 14 03:14:45 2015 (r284365) @@ -595,36 +595,36 @@ setvxlan_flush(const char *val, int d, i static struct cmd vxlan_cmds[] = { - DEF_CLONE_CMD_ARG("vni", setvxlan_vni), - DEF_CLONE_CMD_ARG("local", setvxlan_local), - DEF_CLONE_CMD_ARG("remote", setvxlan_remote), - DEF_CLONE_CMD_ARG("group", setvxlan_group), - DEF_CLONE_CMD_ARG("localport", setvxlan_local_port), - DEF_CLONE_CMD_ARG("remoteport", setvxlan_remote_port), - DEF_CLONE_CMD_ARG2("portrange", setvxlan_port_range), - DEF_CLONE_CMD_ARG("timeout", setvxlan_timeout), - DEF_CLONE_CMD_ARG("maxaddr", setvxlan_maxaddr), + DEF_CLONE_CMD_ARG("vxlanid", setvxlan_vni), + DEF_CLONE_CMD_ARG("vxlanlocal", setvxlan_local), + DEF_CLONE_CMD_ARG("vxlanremote", setvxlan_remote), + DEF_CLONE_CMD_ARG("vxlangroup", setvxlan_group), + DEF_CLONE_CMD_ARG("vxlanlocalport", setvxlan_local_port), + DEF_CLONE_CMD_ARG("vxlanremoteport", setvxlan_remote_port), + DEF_CLONE_CMD_ARG2("vxlanportrange", setvxlan_port_range), + DEF_CLONE_CMD_ARG("vxlantimeout", setvxlan_timeout), + DEF_CLONE_CMD_ARG("vxlanmaxaddr", setvxlan_maxaddr), DEF_CLONE_CMD_ARG("vxlandev", setvxlan_dev), - DEF_CLONE_CMD_ARG("ttl", setvxlan_ttl), - DEF_CLONE_CMD("learn", 1, setvxlan_learn), - DEF_CLONE_CMD("-learn", 0, setvxlan_learn), - - DEF_CMD_ARG("vni", setvxlan_vni), - DEF_CMD_ARG("local", setvxlan_local), - DEF_CMD_ARG("remote", setvxlan_remote), - DEF_CMD_ARG("group", setvxlan_group), - DEF_CMD_ARG("localport", setvxlan_local_port), - DEF_CMD_ARG("remoteport", setvxlan_remote_port), - DEF_CMD_ARG2("portrange", setvxlan_port_range), - DEF_CMD_ARG("timeout", setvxlan_timeout), - DEF_CMD_ARG("maxaddr", setvxlan_maxaddr), + DEF_CLONE_CMD_ARG("vxlanttl", setvxlan_ttl), + DEF_CLONE_CMD("vxlanlearn", 1, setvxlan_learn), + DEF_CLONE_CMD("-vxlanlearn", 0, setvxlan_learn), + + DEF_CMD_ARG("vxlanvni", setvxlan_vni), + DEF_CMD_ARG("vxlanlocal", setvxlan_local), + DEF_CMD_ARG("vxlanremote", setvxlan_remote), + DEF_CMD_ARG("vxlangroup", setvxlan_group), + DEF_CMD_ARG("vxlanlocalport", setvxlan_local_port), + DEF_CMD_ARG("vxlanremoteport", setvxlan_remote_port), + DEF_CMD_ARG2("vxlanportrange", setvxlan_port_range), + DEF_CMD_ARG("vxlantimeout", setvxlan_timeout), + DEF_CMD_ARG("vxlanmaxaddr", setvxlan_maxaddr), DEF_CMD_ARG("vxlandev", setvxlan_dev), - DEF_CMD_ARG("ttl", setvxlan_ttl), - DEF_CMD("learn", 1, setvxlan_learn), - DEF_CMD("-learn", 0, setvxlan_learn), + DEF_CMD_ARG("vxlanttl", setvxlan_ttl), + DEF_CMD("vxlanlearn", 1, setvxlan_learn), + DEF_CMD("-vxlanlearn", 0, setvxlan_learn), - DEF_CMD("flush", 0, setvxlan_flush), - DEF_CMD("flushall", 1, setvxlan_flush), + DEF_CMD("vxlanflush", 0, setvxlan_flush), + DEF_CMD("vxlanflushall", 1, setvxlan_flush), }; static struct afswtch af_vxlan = { Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/share/man/man4/Makefile Sun Jun 14 03:14:45 2015 (r284365) @@ -518,6 +518,7 @@ MAN= aac.4 \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ + vxlan.4 \ ${_vmx.4} \ vpo.4 \ vr.4 \ @@ -688,6 +689,7 @@ MLINKS+=tx.4 if_tx.4 MLINKS+=txp.4 if_txp.4 MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 +MLINKS+=vxlan.4 if_vxlan.4 MLINKS+=${_vmx.4} ${_if_vmx.4} MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 Copied and modified: stable/10/share/man/man4/vxlan.4 (from r273331, head/share/man/man4/vxlan.4) ============================================================================== --- head/share/man/man4/vxlan.4 Mon Oct 20 14:42:42 2014 (r273331, copy source) +++ stable/10/share/man/man4/vxlan.4 Sun Jun 14 03:14:45 2015 (r284365) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 20, 2014 +.Dd December 16, 2014 .Dt VXLAN 4 .Os .Sh NAME @@ -140,7 +140,7 @@ or VNI. .Pp When configured with the .Xr ifconfig 8 -.Cm learn +.Cm vxlanlearn parameter, the interface dynamically creates forwarding table entries from received packets. An entry in the forwarding table maps the inner source MAC address @@ -153,16 +153,16 @@ Otherwise, when configured in multicast the interface must flood the frame to all hosts in the group. The maximum number of entries in the table is configurable with the .Xr ifconfig 8 -.Cm maxaddr +.Cm vxlanmaxaddr command. Stale entries in the table periodically pruned. The timeout is configurable with the .Xr ifconfig 8 -.Cm timeout +.Cm vxlantimeout command. The table may be viewed with the .Xr sysctl 8 -.Cm net.link.vlxan.N.ftable.dump +.Cm net.link.vxlan.N.ftable.dump command. .Sh MTU Since the @@ -187,13 +187,13 @@ Create a .Nm interface in unicast mode with the -.Cm local +.Cm vxlanlocal tunnel address of 192.168.100.1, and the -.Cm remote +.Cm vxlanremote tunnel address of 192.168.100.2. .Bd -literal -offset indent -ifconfig vxlan create vni 108 local 192.168.100.1 remote 192.168.100.2 +ifconfig vxlan create vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 192.168.100.2 .Ed .Pp Create a @@ -207,7 +207,7 @@ and the address of 224.0.2.6. The em0 interface will be used to transmit multicast packets. .Bd -literal -offset indent -ifconfig vxlan create vni 42 local 192.168.10.95 group 224.0.2.6 vxlandev em0 +ifconfig vxlan create vxlanid 42 vxlanlocal 192.168.10.95 vxlangroup 224.0.2.6 vxlandev em0 .Ed .Pp Once created, the Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/sys/conf/NOTES Sun Jun 14 03:14:45 2015 (r284365) @@ -793,6 +793,10 @@ device ether # according to IEEE 802.1Q. device vlan +# The `vxlan' device implements the VXLAN encapsulation of Ethernet +# frames in UDP packets according to RFC7348. +device vxlan + # The `wlan' device provides generic code to support 802.11 # drivers, including host AP mode; it is MANDATORY for the wi, # and ath drivers and will eventually be required by all 802.11 drivers. Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/sys/conf/files Sun Jun 14 03:14:45 2015 (r284365) @@ -3238,6 +3238,7 @@ net/if_stf.c optional stf inet inet6 net/if_tun.c optional tun net/if_tap.c optional tap net/if_vlan.c optional vlan +net/if_vxlan.c optional vxlan inet | vxlan inet6 net/mppcc.c optional netgraph_mppc_compression net/mppcd.c optional netgraph_mppc_compression net/netisr.c standard Modified: stable/10/sys/modules/Makefile ============================================================================== --- stable/10/sys/modules/Makefile Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/sys/modules/Makefile Sun Jun 14 03:14:45 2015 (r284365) @@ -150,6 +150,7 @@ SUBDIR= \ if_tap \ if_tun \ if_vlan \ + if_vxlan \ ${_igb} \ ${_iir} \ ${_imgact_binmisc} \ Copied and modified: stable/10/sys/net/if_vxlan.c (from r273331, head/sys/net/if_vxlan.c) ============================================================================== --- head/sys/net/if_vxlan.c Mon Oct 20 14:42:42 2014 (r273331, copy source) +++ stable/10/sys/net/if_vxlan.c Sun Jun 14 03:14:45 2015 (r284365) @@ -716,7 +716,7 @@ vxlan_ftable_entry_init(struct vxlan_sof fe->vxlfe_flags = flags; fe->vxlfe_expire = time_uptime + sc->vxl_ftable_timeout; - memcpy(fe->vxlfe_mac, mac, ETHER_HDR_LEN); + memcpy(fe->vxlfe_mac, mac, ETHER_ADDR_LEN); vxlan_sockaddr_copy(&fe->vxlfe_raddr, sa); } Copied: stable/10/sys/net/if_vxlan.h (from r273331, head/sys/net/if_vxlan.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/net/if_vxlan.h Sun Jun 14 03:14:45 2015 (r284365, copy of r273331, head/sys/net/if_vxlan.h) @@ -0,0 +1,148 @@ +/*- + * Copyright (c) 2014, Bryan Venteicher + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NET_IF_VXLAN_H_ +#define _NET_IF_VXLAN_H_ + +#include +#include +#include +#include +#include + +struct vxlan_header { + uint32_t vxlh_flags; + uint32_t vxlh_vni; +}; + +#define VXLAN_HDR_FLAGS_VALID_VNI 0x08000000 +#define VXLAN_HDR_VNI_SHIFT 8 + +#define VXLAN_VNI_MAX (1 << 24) +#define VXLAN_VNI_MASK (VXLAN_VNI_MAX - 1) + +/* + * The port assigned by IANA is 4789, but some early implementations + * (like Linux) use 8472 instead. If not specified, we default to + * the IANA port. + */ +#define VXLAN_PORT 4789 +#define VXLAN_LEGACY_PORT 8472 + +struct ifvxlanparam { + uint64_t vxlp_with; + +#define VXLAN_PARAM_WITH_VNI 0x0001 +#define VXLAN_PARAM_WITH_LOCAL_ADDR4 0x0002 +#define VXLAN_PARAM_WITH_LOCAL_ADDR6 0x0004 +#define VXLAN_PARAM_WITH_REMOTE_ADDR4 0x0008 +#define VXLAN_PARAM_WITH_REMOTE_ADDR6 0x0010 +#define VXLAN_PARAM_WITH_LOCAL_PORT 0x0020 +#define VXLAN_PARAM_WITH_REMOTE_PORT 0x0040 +#define VXLAN_PARAM_WITH_PORT_RANGE 0x0080 +#define VXLAN_PARAM_WITH_FTABLE_TIMEOUT 0x0100 +#define VXLAN_PARAM_WITH_FTABLE_MAX 0x0200 +#define VXLAN_PARAM_WITH_MULTICAST_IF 0x0400 +#define VXLAN_PARAM_WITH_TTL 0x0800 +#define VXLAN_PARAM_WITH_LEARN 0x1000 + + uint32_t vxlp_vni; + struct in_addr vxlp_local_in4; + struct in6_addr vxlp_local_in6; + struct in_addr vxlp_remote_in4; + struct in6_addr vxlp_remote_in6; + uint16_t vxlp_local_port; + uint16_t vxlp_remote_port; + uint16_t vxlp_min_port; + uint16_t vxlp_max_port; + char vxlp_mc_ifname[IFNAMSIZ]; + uint32_t vxlp_ftable_timeout; + uint32_t vxlp_ftable_max; + uint8_t vxlp_ttl; + uint8_t vxlp_learn; +}; + +union vxlan_sockaddr { + struct sockaddr sa; + struct sockaddr_in in4; + struct sockaddr_in6 in6; +}; + +#define VXLAN_SOCKADDR_IS_IPV4(_vxsin) ((_vxsin)->sa.sa_family == AF_INET) +#define VXLAN_SOCKADDR_IS_IPV6(_vxsin) ((_vxsin)->sa.sa_family == AF_INET6) +#define VXLAN_SOCKADDR_IS_IPV46(_vxsin) \ + (VXLAN_SOCKADDR_IS_IPV4(_vxsin) || VXLAN_SOCKADDR_IS_IPV6(_vxsin)) + +#define VXLAN_CMD_GET_CONFIG 0 +#define VXLAN_CMD_SET_VNI 1 +#define VXLAN_CMD_SET_LOCAL_ADDR 2 +#define VXLAN_CMD_SET_REMOTE_ADDR 4 +#define VXLAN_CMD_SET_LOCAL_PORT 5 +#define VXLAN_CMD_SET_REMOTE_PORT 6 +#define VXLAN_CMD_SET_PORT_RANGE 7 +#define VXLAN_CMD_SET_FTABLE_TIMEOUT 8 +#define VXLAN_CMD_SET_FTABLE_MAX 9 +#define VXLAN_CMD_SET_MULTICAST_IF 10 +#define VXLAN_CMD_SET_TTL 11 +#define VXLAN_CMD_SET_LEARN 12 +#define VXLAN_CMD_FTABLE_ENTRY_ADD 13 +#define VXLAN_CMD_FTABLE_ENTRY_REM 14 +#define VXLAN_CMD_FLUSH 15 + +struct ifvxlancfg { + uint32_t vxlc_vni; + union vxlan_sockaddr vxlc_local_sa; + union vxlan_sockaddr vxlc_remote_sa; + uint32_t vxlc_mc_ifindex; + uint32_t vxlc_ftable_cnt; + uint32_t vxlc_ftable_max; + uint32_t vxlc_ftable_timeout; + uint16_t vxlc_port_min; + uint16_t vxlc_port_max; + uint8_t vxlc_learn; + uint8_t vxlc_ttl; +}; + +struct ifvxlancmd { + uint32_t vxlcmd_flags; +#define VXLAN_CMD_FLAG_FLUSH_ALL 0x0001 +#define VXLAN_CMD_FLAG_LEARN 0x0002 + + uint32_t vxlcmd_vni; + uint32_t vxlcmd_ftable_timeout; + uint32_t vxlcmd_ftable_max; + uint16_t vxlcmd_port; + uint16_t vxlcmd_port_min; + uint16_t vxlcmd_port_max; + uint8_t vxlcmd_mac[ETHER_ADDR_LEN]; + uint8_t vxlcmd_ttl; + union vxlan_sockaddr vxlcmd_sa; + char vxlcmd_ifname[IFNAMSIZ]; +}; + +#endif /* _NET_IF_VXLAN_H_ */ Modified: stable/10/sys/sys/priv.h ============================================================================== --- stable/10/sys/sys/priv.h Sun Jun 14 02:21:19 2015 (r284364) +++ stable/10/sys/sys/priv.h Sun Jun 14 03:14:45 2015 (r284365) @@ -340,6 +340,7 @@ #define PRIV_NET_SETIFVNET 417 /* Move interface to vnet. */ #define PRIV_NET_SETIFDESCR 418 /* Set interface description. */ #define PRIV_NET_SETIFFIB 419 /* Set interface fib. */ +#define PRIV_NET_VXLAN 420 /* Administer vxlan. */ /* * 802.11-related privileges. From owner-svn-src-stable-10@FreeBSD.ORG Sun Jun 14 05:12:49 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 10309FF5; Sun, 14 Jun 2015 05:12:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F21677E1; Sun, 14 Jun 2015 05:12:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5E5CmV1054052; Sun, 14 Jun 2015 05:12:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5E5CmE2054051; Sun, 14 Jun 2015 05:12:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201506140512.t5E5CmE2054051@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 14 Jun 2015 05:12:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284375 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2015 05:12:49 -0000 Author: kib Date: Sun Jun 14 05:12:48 2015 New Revision: 284375 URL: https://svnweb.freebsd.org/changeset/base/284375 Log: MFC r283832: Remove unused variable. Modified: stable/10/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_softdep.c Sun Jun 14 03:34:09 2015 (r284374) +++ stable/10/sys/ufs/ffs/ffs_softdep.c Sun Jun 14 05:12:48 2015 (r284375) @@ -7208,7 +7208,6 @@ deallocate_dependencies(bp, freeblks, of { struct indirdep *indirdep; struct pagedep *pagedep; - struct allocdirect *adp; struct worklist *wk, *wkn; struct ufsmount *ump; @@ -7255,7 +7254,6 @@ deallocate_dependencies(bp, freeblks, of break; case D_ALLOCDIRECT: - adp = WK_ALLOCDIRECT(wk); if (off != 0) continue; /* FALLTHROUGH */ From owner-svn-src-stable-10@FreeBSD.ORG Sun Jun 14 10:39:30 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B43AB6 for ; Sun, 14 Jun 2015 10:39:30 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A3791943 for ; Sun, 14 Jun 2015 10:39:29 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by wifx6 with SMTP id x6so51237302wif.0 for ; Sun, 14 Jun 2015 03:39:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=tfLrXrwA8AiGlFt+4TBIu6F/iwHH8njy8W2MPL+mU+g=; b=bI5vnaAkieaYxPM4B7yEiq53QT3uGu18OAoEU/xm08m2ip+oSIErQne+L8uzY9LZe+ L17A2XuDWJWjQU366PULr463Y5DfnFZMeIgacreSjp9EBmBknMPsRl0g0XSh3X9hrq5g YzIDGkU1iWzBjBexJegVVxI/IK2hYqBi2lkieslbg7RTHhpGZ4grcJe0gHrO0SxjK2ni s7GqGA8Rbz7ReDGM31ZOIo3PA1eZpuDnsWeolBy2jHbW6arxGyBLPwhsQZhjSu/gFFOe 7cAqvMKb+kfUlDLaM6AzFSdcLzmN4KVJL9pzZwcHafG2tiwG/gcaqbK9Z7SD7pvjJ1/N koQw== X-Gm-Message-State: ALoCoQk2/QMVuszpAtS7OEeIAOKHv1Hkv64Rj4ezlmUCDHanK6hHA2Ha6LhMKrkbRxx0QWTP2wu+ MIME-Version: 1.0 X-Received: by 10.180.102.227 with SMTP id fr3mr21794009wib.19.1434278361658; Sun, 14 Jun 2015 03:39:21 -0700 (PDT) Received: by 10.194.162.225 with HTTP; Sun, 14 Jun 2015 03:39:21 -0700 (PDT) In-Reply-To: <201506131615.t5DGFhUm038534@svn.freebsd.org> References: <201506131615.t5DGFhUm038534@svn.freebsd.org> Date: Sun, 14 Jun 2015 12:39:21 +0200 Message-ID: Subject: Re: svn commit: r284343 - in stable: 10/sys/kern 10/sys/sys 9/sys/kern 9/sys/sys From: Oliver Pinter To: John Baldwin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2015 10:39:30 -0000 On Sat, Jun 13, 2015 at 6:15 PM, John Baldwin wrote: > Author: jhb > Date: Sat Jun 13 16:15:43 2015 > New Revision: 284343 > URL: https://svnweb.freebsd.org/changeset/base/284343 > > Log: > MFC 283546: > Add KTR tracing for some MI ptrace events. > > Modified: > stable/10/sys/kern/kern_exit.c > stable/10/sys/kern/kern_fork.c > stable/10/sys/kern/kern_sig.c > stable/10/sys/kern/sys_process.c > stable/10/sys/sys/ktr.h > Directory Properties: > stable/10/ (props changed) > > Changes in other areas also in this revision: > Modified: > stable/9/sys/kern/kern_exit.c > stable/9/sys/kern/kern_fork.c > stable/9/sys/kern/kern_sig.c > stable/9/sys/kern/sys_process.c > stable/9/sys/sys/ktr.h > Directory Properties: > stable/9/sys/ (props changed) > stable/9/sys/sys/ (props changed) > > Modified: stable/10/sys/kern/kern_exit.c > ============================================================================== > --- stable/10/sys/kern/kern_exit.c Sat Jun 13 16:13:31 2015 (r284342) > +++ stable/10/sys/kern/kern_exit.c Sat Jun 13 16:15:43 2015 (r284343) > @@ -531,6 +531,8 @@ exit1(struct thread *td, int rv) > */ > while ((q = LIST_FIRST(&p->p_orphans)) != NULL) { > PROC_LOCK(q); > + CTR2(KTR_PTRACE, "exit: pid %d, clearing orphan %d", p->p_pid, > + q->p_pid); > clear_orphan(q); > PROC_UNLOCK(q); > } > @@ -865,6 +867,9 @@ proc_reap(struct thread *td, struct proc > t = proc_realparent(p); > PROC_LOCK(t); > PROC_LOCK(p); > + CTR2(KTR_PTRACE, > + "wait: traced child %d moved back to parent %d", p->p_pid, > + t->p_pid); > proc_reparent(p, t); > p->p_oppid = 0; > PROC_UNLOCK(p); > @@ -1219,6 +1224,10 @@ loop: > PROC_UNLOCK(q); > } > > + CTR4(KTR_PTRACE, > + "wait: returning trapped pid %d status %#x (xstat %d) xthread %d", > + p->p_pid, W_STOPCODE(p->p_xstat), p->p_xstat, > + p->p_xthread != NULL ? p->p_xthread->td_tid : -1); > PROC_UNLOCK(p); > return (0); > } > > Modified: stable/10/sys/kern/kern_fork.c > ============================================================================== > --- stable/10/sys/kern/kern_fork.c Sat Jun 13 16:13:31 2015 (r284342) > +++ stable/10/sys/kern/kern_fork.c Sat Jun 13 16:15:43 2015 (r284343) > @@ -1056,6 +1056,9 @@ fork_return(struct thread *td, struct tr > dbg = p->p_pptr->p_pptr; > p->p_flag |= P_TRACED; > p->p_oppid = p->p_pptr->p_pid; > + CTR2(KTR_PTRACE, > + "fork_return: attaching to new child pid %d: oppid %d", > + p->p_pid, p->p_oppid); > proc_reparent(p, dbg); > sx_xunlock(&proctree_lock); > td->td_dbgflags |= TDB_CHILD; > > Modified: stable/10/sys/kern/kern_sig.c > ============================================================================== > --- stable/10/sys/kern/kern_sig.c Sat Jun 13 16:13:31 2015 (r284342) > +++ stable/10/sys/kern/kern_sig.c Sat Jun 13 16:15:43 2015 (r284343) > @@ -2484,6 +2484,8 @@ ptracestop(struct thread *td, int sig) > > td->td_dbgflags |= TDB_XSIG; > td->td_xsig = sig; > + CTR4(KTR_PTRACE, "ptracestop: tid %d (pid %d) flags %#x sig %d", > + td->td_tid, p->p_pid, td->td_dbgflags, sig); > PROC_SLOCK(p); > while ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_XSIG)) { > if (p->p_flag & P_SINGLE_EXIT) { > > Modified: stable/10/sys/kern/sys_process.c > ============================================================================== > --- stable/10/sys/kern/sys_process.c Sat Jun 13 16:13:31 2015 (r284342) > +++ stable/10/sys/kern/sys_process.c Sat Jun 13 16:15:43 2015 (r284343) > @@ -432,6 +432,9 @@ ptrace_vm_entry(struct thread *td, struc > free(freepath, M_TEMP); > } > } > + if (error == 0) > + CTR3(KTR_PTRACE, "PT_VM_ENTRY: pid %d, entry %d, start %p", > + p->p_pid, pve->pve_entry, pve->pve_start); > > return (error); > } > @@ -826,6 +829,7 @@ kern_ptrace(struct thread *td, int req, > if (p->p_flag & P_PPWAIT) > p->p_flag |= P_PPTRACE; > p->p_oppid = p->p_pptr->p_pid; > + CTR1(KTR_PTRACE, "PT_TRACE_ME: pid %d", p->p_pid); > break; > > case PT_ATTACH: > @@ -845,17 +849,25 @@ kern_ptrace(struct thread *td, int req, > proc_reparent(p, td->td_proc); > } > data = SIGSTOP; > + CTR2(KTR_PTRACE, "PT_ATTACH: pid %d, oppid %d", p->p_pid, > + p->p_oppid); > goto sendsig; /* in PT_CONTINUE below */ > > case PT_CLEARSTEP: > + CTR2(KTR_PTRACE, "PT_CLEARSTEP: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > error = ptrace_clear_single_step(td2); > break; > > case PT_SETSTEP: > + CTR2(KTR_PTRACE, "PT_SETSTEP: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > error = ptrace_single_step(td2); > break; > > case PT_SUSPEND: > + CTR2(KTR_PTRACE, "PT_SUSPEND: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > td2->td_dbgflags |= TDB_SUSPEND; > thread_lock(td2); > td2->td_flags |= TDF_NEEDSUSPCHK; > @@ -863,10 +875,15 @@ kern_ptrace(struct thread *td, int req, > break; > > case PT_RESUME: > + CTR2(KTR_PTRACE, "PT_RESUME: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > td2->td_dbgflags &= ~TDB_SUSPEND; > break; > > case PT_FOLLOW_FORK: > + CTR3(KTR_PTRACE, "PT_FOLLOW_FORK: pid %d %s -> %s", p->p_pid, > + p->p_flag & P_FOLLOWFORK ? "enabled" : "disabled", > + data ? "enabled" : "disabled"); > if (data) > p->p_flag |= P_FOLLOWFORK; > else > @@ -887,6 +904,8 @@ kern_ptrace(struct thread *td, int req, > > switch (req) { > case PT_STEP: > + CTR2(KTR_PTRACE, "PT_STEP: tid %d (pid %d)", > + td2->td_tid, p->p_pid); > error = ptrace_single_step(td2); > if (error) > goto out; > @@ -904,12 +923,25 @@ kern_ptrace(struct thread *td, int req, > switch (req) { > case PT_TO_SCE: > p->p_stops |= S_PT_SCE; > + CTR2(KTR_PTRACE, > + "PT_TO_SCE: pid %d, stops = %#x", p->p_pid, > + p->p_stops); > break; > case PT_TO_SCX: > p->p_stops |= S_PT_SCX; > + CTR2(KTR_PTRACE, > + "PT_TO_SCX: pid %d, stops = %#x", p->p_pid, > + p->p_stops); > break; > case PT_SYSCALL: > p->p_stops |= S_PT_SCE | S_PT_SCX; > + CTR2(KTR_PTRACE, > + "PT_SYSCALL: pid %d, stops = %#x", p->p_pid, > + p->p_stops); > + break; > + case PT_CONTINUE: > + CTR1(KTR_PTRACE, > + "PT_CONTINUE: pid %d", p->p_pid); > break; > } > break; > @@ -924,7 +956,11 @@ kern_ptrace(struct thread *td, int req, > proc_reparent(p, pp); > if (pp == initproc) > p->p_sigparent = SIGCHLD; > - } > + CTR2(KTR_PTRACE, > + "PT_DETACH: pid %d reparented to pid %d", > + p->p_pid, pp->p_pid); > + } else > + CTR1(KTR_PTRACE, "PT_DETACH: pid %d", p->p_pid); > p->p_oppid = 0; > p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); > > @@ -1001,6 +1037,14 @@ kern_ptrace(struct thread *td, int req, > } > if (!write) > td->td_retval[0] = tmp; > + if (error == 0) { > + if (write) > + CTR3(KTR_PTRACE, "PT_WRITE: pid %d: %p <= %#x", > + p->p_pid, addr, data); > + else > + CTR3(KTR_PTRACE, "PT_READ: pid %d: %p >= %#x", > + p->p_pid, addr, tmp); > + } > PROC_LOCK(p); > break; > > @@ -1033,10 +1077,14 @@ kern_ptrace(struct thread *td, int req, > switch (tmp) { > case PIOD_READ_D: > case PIOD_READ_I: > + CTR3(KTR_PTRACE, "PT_IO: pid %d: READ (%p, %#x)", > + p->p_pid, (uintptr_t)uio.uio_offset, uio.uio_resid); > uio.uio_rw = UIO_READ; > break; > case PIOD_WRITE_D: > case PIOD_WRITE_I: > + CTR3(KTR_PTRACE, "PT_IO: pid %d: WRITE (%p, %#x)", > + p->p_pid, (uintptr_t)uio.uio_offset, uio.uio_resid); > td2->td_dbgflags |= TDB_USERWR; > uio.uio_rw = UIO_WRITE; > break; > @@ -1056,33 +1104,46 @@ kern_ptrace(struct thread *td, int req, > break; > > case PT_KILL: > + CTR1(KTR_PTRACE, "PT_KILL: pid %d", p->p_pid); > data = SIGKILL; > goto sendsig; /* in PT_CONTINUE above */ > > case PT_SETREGS: > + CTR2(KTR_PTRACE, "PT_SETREGS: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > td2->td_dbgflags |= TDB_USERWR; > error = PROC_WRITE(regs, td2, addr); > break; > > case PT_GETREGS: > + CTR2(KTR_PTRACE, "PT_GETREGS: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > error = PROC_READ(regs, td2, addr); > break; > > case PT_SETFPREGS: > + CTR2(KTR_PTRACE, "PT_SETFPREGS: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > td2->td_dbgflags |= TDB_USERWR; > error = PROC_WRITE(fpregs, td2, addr); > break; > > case PT_GETFPREGS: > + CTR2(KTR_PTRACE, "PT_GETFPREGS: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > error = PROC_READ(fpregs, td2, addr); > break; > > case PT_SETDBREGS: > + CTR2(KTR_PTRACE, "PT_SETDBREGS: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > td2->td_dbgflags |= TDB_USERWR; > error = PROC_WRITE(dbregs, td2, addr); > break; > > case PT_GETDBREGS: > + CTR2(KTR_PTRACE, "PT_GETDBREGS: tid %d (pid %d)", td2->td_tid, > + p->p_pid); > error = PROC_READ(dbregs, td2, addr); > break; > > @@ -1145,13 +1206,21 @@ kern_ptrace(struct thread *td, int req, > if (wrap32) > ptrace_lwpinfo_to32(pl, pl32); > #endif > + CTR5(KTR_PTRACE, > + "PT_LWPINFO: tid %d (pid %d) event %d flags %#x child pid %d", > + td2->td_tid, p->p_pid, pl->pl_event, pl->pl_flags, > + pl->pl_child_pid); > break; > > case PT_GETNUMLWPS: > + CTR2(KTR_PTRACE, "PT_GETNUMLWPS: pid %d: %d threads", p->p_pid, > + p->p_numthreads); > td->td_retval[0] = p->p_numthreads; > break; > > case PT_GETLWPLIST: > + CTR3(KTR_PTRACE, "PT_GETLWPLIST: pid %d: data %d, actual %d", > + p->p_pid, data, p->p_numthreads); > if (data <= 0) { > error = EINVAL; > break; > @@ -1175,6 +1244,8 @@ kern_ptrace(struct thread *td, int req, > break; > > case PT_VM_TIMESTAMP: > + CTR2(KTR_PTRACE, "PT_VM_TIMESTAMP: pid %d: timestamp %d", > + p->p_pid, p->p_vmspace->vm_map.timestamp); > td->td_retval[0] = p->p_vmspace->vm_map.timestamp; > break; > > @@ -1225,6 +1296,8 @@ stopevent(struct proc *p, unsigned int e > > PROC_LOCK_ASSERT(p, MA_OWNED); > p->p_step = 1; > + CTR3(KTR_PTRACE, "stopevent: pid %d event %u val %u", p->p_pid, event, > + val); > do { > p->p_xstat = val; > p->p_xthread = NULL; > > Modified: stable/10/sys/sys/ktr.h > ============================================================================== > --- stable/10/sys/sys/ktr.h Sat Jun 13 16:13:31 2015 (r284342) > +++ stable/10/sys/sys/ktr.h Sat Jun 13 16:15:43 2015 (r284343) > @@ -75,7 +75,8 @@ > #define KTR_INET6 0x10000000 /* IPv6 stack */ > #define KTR_SCHED 0x20000000 /* Machine parsed sched info. */ > #define KTR_BUF 0x40000000 /* Buffer cache */ > -#define KTR_ALL 0x7fffffff > +#define KTR_PTRACE 0x80000000 /* Process debugging. */ > +#define KTR_ALL 0xffffffff > > /* Trace classes to compile in */ > #ifdef KTR Hi John! Could you please MFC this commit too: commit 4331ca7813ee01d1745c6ff2ced7030329586b30 Author: jhb Date: Fri May 22 11:09:41 2015 +0000 Expand ktr_mask to be a 64-bit unsigned integer. The mask does not really need to be updated with atomic operations and the downside of losing races during transitions is not great (it is not marked volatile, so those races are pretty wide open as it is). Differential Revision: https://reviews.freebsd.org/D2595 Reviewed by: emaste, neel, rpaulo MFC after: 2 weeks > _______________________________________________ > svn-src-stable-10@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 > To unsubscribe, send any mail to "svn-src-stable-10-unsubscribe@freebsd.org" From owner-svn-src-stable-10@FreeBSD.ORG Sun Jun 14 11:48:44 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0AEA6E39; Sun, 14 Jun 2015 11:48:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3836AFA; Sun, 14 Jun 2015 11:48:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (unknown [137.122.64.71]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8B443B91F; Sun, 14 Jun 2015 07:48:41 -0400 (EDT) Message-ID: <557D6A19.8000301@FreeBSD.org> Date: Sun, 14 Jun 2015 07:48:41 -0400 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Oliver Pinter CC: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r284343 - in stable: 10/sys/kern 10/sys/sys 9/sys/kern 9/sys/sys References: <201506131615.t5DGFhUm038534@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sun, 14 Jun 2015 07:48:42 -0400 (EDT) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2015 11:48:44 -0000 On 6/14/15 6:39 AM, Oliver Pinter wrote: > On Sat, Jun 13, 2015 at 6:15 PM, John Baldwin wrote: > > Hi John! > > Could you please MFC this commit too: > > commit 4331ca7813ee01d1745c6ff2ced7030329586b30 > Author: jhb > Date: Fri May 22 11:09:41 2015 +0000 > > Expand ktr_mask to be a 64-bit unsigned integer. > > The mask does not really need to be updated with atomic operations and > the downside of losing races during transitions is not great (it is > not marked volatile, so those races are pretty wide open as it is). > > Differential Revision: https://reviews.freebsd.org/D2595 > Reviewed by: emaste, neel, rpaulo > MFC after: 2 weeks Hmm, I might not get too it in the near future. The only reason I've hesitated to do so is that it does slightly break the in-kernel ABI in that 'ktr_mask' is a public symbol to kernel modules. (I've used it in various hackish tests where I would clear ktr_mask to 0 when some unusual event happened so that the KTR trace buffer contained the events leading up to the unusual event.) OTOH, this is a bit of a special case, so I'm not sure if this is part of the ABI that we really have to worry about. -- John Baldwin From owner-svn-src-stable-10@FreeBSD.ORG Mon Jun 15 01:01:26 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B663AA4; Mon, 15 Jun 2015 01:01:26 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A367C972; Mon, 15 Jun 2015 01:01:26 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5F11QVv051203; Mon, 15 Jun 2015 01:01:26 GMT (envelope-from edwin@FreeBSD.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5F11PoQ051199; Mon, 15 Jun 2015 01:01:25 GMT (envelope-from edwin@FreeBSD.org) Message-Id: <201506150101.t5F11PoQ051199@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: edwin set sender to edwin@FreeBSD.org using -f From: Edwin Groothuis Date: Mon, 15 Jun 2015 01:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284398 - stable/10/contrib/tzdata X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 01:01:26 -0000 Author: edwin Date: Mon Jun 15 01:01:25 2015 New Revision: 284398 URL: https://svnweb.freebsd.org/changeset/base/284398 Log: MFC of 284397,tzdata10: Update to tzdata2015e: Changes affecting future time stamps Morocco will suspend DST from 2015-06-14 03:00 through 2015-07-19 02:00, not 06-13 and 07-18 as we had guessed. (Thanks to Milamber.) Assume Cayman Islands will observe DST starting next year, using US rules. Although it isn't guaranteed, it is the most likely. Modified: stable/10/contrib/tzdata/africa stable/10/contrib/tzdata/northamerica stable/10/contrib/tzdata/southamerica stable/10/contrib/tzdata/zone1970.tab Modified: stable/10/contrib/tzdata/africa ============================================================================== --- stable/10/contrib/tzdata/africa Mon Jun 15 00:59:47 2015 (r284397) +++ stable/10/contrib/tzdata/africa Mon Jun 15 01:01:25 2015 (r284398) @@ -338,9 +338,10 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 # time this summer, and carry out studies on the possibility of canceling the # practice altogether in future years." # -# From Paul Eggert (2015-04-20): -# For now, assume DST will be canceled. Any resumption would likely -# use different rules anyway. +# From Paul Eggert (2015-04-24): +# Yesterday the office of Egyptian President El-Sisi announced his +# decision to abandon DST permanently. See Ahram Online 2015-04-24. +# http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx Rule Egypt 2008 only - Aug lastThu 24:00 0 - Rule Egypt 2009 only - Aug 20 24:00 0 - @@ -787,20 +788,41 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # will resume again at 02:00 on Saturday, August 2, 2014.... # http://www.mmsp.gov.ma/fr/actualites.aspx?id=586 -# From Paul Eggert (2014-06-05): -# For now, guess that later spring and fall transitions will use 2014's rules, +# From Milamber (2015-06-08): +# (Google Translation) The hour will thus be delayed 60 minutes +# Sunday, June 14 at 3:00, the ministry said in a statement, adding +# that the time will be advanced again 60 minutes Sunday, July 19, +# 2015 at 2:00. The move comes under 2.12.126 Decree of 26 Jumada I +# 1433 (18 April 2012) and the decision of the Head of Government of +# 16 N. 3-29-15 Chaaban 1435 (4 June 2015). +# Source (french): +# http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/ +# +# From Milamber (2015-06-09): +# http://www.mmsp.gov.ma/fr/actualites.aspx?id=863 +# +# From Michael Deckers (2015-06-09): +# [The gov.ma announcement] would (probably) make the switch on 2015-07-19 go +# from 03:00 to 04:00 rather than from 02:00 to 03:00, as in the patch.... +# I think the patch is correct and the quoted text is wrong; the text in +# agrees +# with the patch. + +# From Paul Eggert (2015-06-08): +# For now, guess that later spring and fall transitions will use 2015's rules, # and guess that Morocco will switch to standard time at 03:00 the last -# Saturday before Ramadan, and back to DST at 02:00 the first Saturday after -# Ramadan. To implement this, transition dates for 2015 through 2037 were +# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after +# Ramadan. To implement this, transition dates for 2016 through 2037 were # determined by running the following program under GNU Emacs 24.3, with the # results integrated by hand into the table below. -# (let ((islamic-year 1436)) +# (let ((islamic-year 1437)) +# (require 'cal-islam) # (while (< islamic-year 1460) # (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) # (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (saturday 6)) -# (while (/= saturday (mod (setq a (1- a)) 7))) -# (while (/= saturday (mod b 7)) +# (sunday 0)) +# (while (/= sunday (mod (setq a (1- a)) 7))) +# (while (/= sunday (mod b 7)) # (setq b (1+ b))) # (setq a (calendar-gregorian-from-absolute a)) # (setq b (calendar-gregorian-from-absolute b)) @@ -844,32 +866,30 @@ Rule Morocco 2012 only - Aug 20 2:00 1: Rule Morocco 2013 only - Jul 7 3:00 0 - Rule Morocco 2013 only - Aug 10 2:00 1:00 S Rule Morocco 2013 max - Oct lastSun 3:00 0 - -Rule Morocco 2014 2022 - Mar lastSun 2:00 1:00 S +Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S Rule Morocco 2014 only - Jun 28 3:00 0 - Rule Morocco 2014 only - Aug 2 2:00 1:00 S -Rule Morocco 2015 only - Jun 13 3:00 0 - -Rule Morocco 2015 only - Jul 18 2:00 1:00 S -Rule Morocco 2016 only - Jun 4 3:00 0 - -Rule Morocco 2016 only - Jul 9 2:00 1:00 S -Rule Morocco 2017 only - May 20 3:00 0 - -Rule Morocco 2017 only - Jul 1 2:00 1:00 S -Rule Morocco 2018 only - May 12 3:00 0 - -Rule Morocco 2018 only - Jun 16 2:00 1:00 S -Rule Morocco 2019 only - May 4 3:00 0 - -Rule Morocco 2019 only - Jun 8 2:00 1:00 S -Rule Morocco 2020 only - Apr 18 3:00 0 - -Rule Morocco 2020 only - May 30 2:00 1:00 S -Rule Morocco 2021 only - Apr 10 3:00 0 - -Rule Morocco 2021 only - May 15 2:00 1:00 S -Rule Morocco 2022 only - Apr 2 3:00 0 - -Rule Morocco 2022 only - May 7 2:00 1:00 S -Rule Morocco 2023 only - Apr 22 2:00 1:00 S -Rule Morocco 2024 only - Apr 13 2:00 1:00 S -Rule Morocco 2025 only - Apr 5 2:00 1:00 S +Rule Morocco 2015 only - Jun 14 3:00 0 - +Rule Morocco 2015 only - Jul 19 2:00 1:00 S +Rule Morocco 2016 only - Jun 5 3:00 0 - +Rule Morocco 2016 only - Jul 10 2:00 1:00 S +Rule Morocco 2017 only - May 21 3:00 0 - +Rule Morocco 2017 only - Jul 2 2:00 1:00 S +Rule Morocco 2018 only - May 13 3:00 0 - +Rule Morocco 2018 only - Jun 17 2:00 1:00 S +Rule Morocco 2019 only - May 5 3:00 0 - +Rule Morocco 2019 only - Jun 9 2:00 1:00 S +Rule Morocco 2020 only - Apr 19 3:00 0 - +Rule Morocco 2020 only - May 24 2:00 1:00 S +Rule Morocco 2021 only - Apr 11 3:00 0 - +Rule Morocco 2021 only - May 16 2:00 1:00 S +Rule Morocco 2022 only - May 8 2:00 1:00 S +Rule Morocco 2023 only - Apr 23 2:00 1:00 S +Rule Morocco 2024 only - Apr 14 2:00 1:00 S +Rule Morocco 2025 only - Apr 6 2:00 1:00 S Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S -Rule Morocco 2035 only - Oct 27 3:00 0 - -Rule Morocco 2036 only - Oct 18 3:00 0 - -Rule Morocco 2037 only - Oct 10 3:00 0 - +Rule Morocco 2036 only - Oct 19 3:00 0 - +Rule Morocco 2037 only - Oct 4 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 Modified: stable/10/contrib/tzdata/northamerica ============================================================================== --- stable/10/contrib/tzdata/northamerica Mon Jun 15 00:59:47 2015 (r284397) +++ stable/10/contrib/tzdata/northamerica Mon Jun 15 01:01:25 2015 (r284398) @@ -2661,7 +2661,17 @@ Zone Atlantic/Bermuda -4:19:18 - LMT 193 -4:00 US A%sT # Cayman Is -# See America/Panama. + +# From Paul Eggert (2015-05-15): +# The Cayman government has decided to introduce DST in 2016, the idea being +# to keep in sync with New York. The legislation hasn't passed but the change +# seems quite likely. See: Meade B. Cayman 27. +# http://www.cayman27.com.ky/2015/05/15/clock-ticks-toward-daylight-saving-time-in-cayman + +Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown + -5:07:11 - KMT 1912 Feb # Kingston Mean Time + -5:00 - EST 2016 + -5:00 US E%sT # Costa Rica @@ -3184,7 +3194,6 @@ Zone America/Managua -5:45:08 - LMT 1890 Zone America/Panama -5:18:08 - LMT 1890 -5:19:36 - CMT 1908 Apr 22 # Colón Mean Time -5:00 - EST -Link America/Panama America/Cayman # Puerto Rico # There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'. Modified: stable/10/contrib/tzdata/southamerica ============================================================================== --- stable/10/contrib/tzdata/southamerica Mon Jun 15 00:59:47 2015 (r284397) +++ stable/10/contrib/tzdata/southamerica Mon Jun 15 01:01:25 2015 (r284398) @@ -30,7 +30,7 @@ # I suggest the use of _Summer time_ instead of the more cumbersome # _daylight-saving time_. _Summer time_ seems to be in general use # in Europe and South America. -# -- E O Cutler, _New York Times_ (1937-02-14), quoted in +# -- E O Cutler, _New York Times_ (1937-02-14), quoted in # H L Mencken, _The American Language: Supplement I_ (1960), p 466 # # Earlier editions of these tables also used the North American style Modified: stable/10/contrib/tzdata/zone1970.tab ============================================================================== --- stable/10/contrib/tzdata/zone1970.tab Mon Jun 15 00:59:47 2015 (r284397) +++ stable/10/contrib/tzdata/zone1970.tab Mon Jun 15 01:01:25 2015 (r284398) @@ -207,6 +207,7 @@ KI -0308-17105 Pacific/Enderbury Phoenix KI +0152-15720 Pacific/Kiritimati Line Islands KP +3901+12545 Asia/Pyongyang KR +3733+12658 Asia/Seoul +KY +1918-08123 America/Cayman KZ +4315+07657 Asia/Almaty most locations KZ +4448+06528 Asia/Qyzylorda Qyzylorda (Kyzylorda, Kzyl-Orda) KZ +5017+05710 Asia/Aqtobe Aqtobe (Aktobe) @@ -260,7 +261,7 @@ NR -0031+16655 Pacific/Nauru NU -1901-16955 Pacific/Niue NZ,AQ -3652+17446 Pacific/Auckland New Zealand time NZ -4357-17633 Pacific/Chatham Chatham Islands -PA,KY +0858-07932 America/Panama +PA +0858-07932 America/Panama PE -1203-07703 America/Lima PF -1732-14934 Pacific/Tahiti Society Islands PF -0900-13930 Pacific/Marquesas Marquesas Islands From owner-svn-src-stable-10@FreeBSD.ORG Mon Jun 15 04:20:33 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 57A50E29; Mon, 15 Jun 2015 04:20:33 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45E3CDED; Mon, 15 Jun 2015 04:20:33 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5F4KXvN048208; Mon, 15 Jun 2015 04:20:33 GMT (envelope-from gshapiro@FreeBSD.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5F4KXv3048207; Mon, 15 Jun 2015 04:20:33 GMT (envelope-from gshapiro@FreeBSD.org) Message-Id: <201506150420.t5F4KXv3048207@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gshapiro set sender to gshapiro@FreeBSD.org using -f From: Gregory Neil Shapiro Date: Mon, 15 Jun 2015 04:20:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284404 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 04:20:33 -0000 Author: gshapiro Date: Mon Jun 15 04:20:32 2015 New Revision: 284404 URL: https://svnweb.freebsd.org/changeset/base/284404 Log: MFC: Add a quick (?) note for users who may be having sendmail interoperability issues due to the recent (FreeBSD-SA-15:10.openssl) OpenSSL change to reject 512 bit DH parameters. Affects 11-CURRENT and 10-STABLE. Modified: stable/10/UPDATING Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Mon Jun 15 04:18:29 2015 (r284403) +++ stable/10/UPDATING Mon Jun 15 04:20:32 2015 (r284404) @@ -16,6 +16,30 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20150614: + The import of openssl to address the FreeBSD-SA-15:10.openssl + security advisory includes a change which rejects handshakes + with DH parameters below 768 bits. sendmail releases prior + to 8.15.2 (not yet released), defaulted to a 512 bit + DH parameter setting for client connections. To work around + this interoperability, sendmail can be configured to use a + 2048 bit DH parameter by: + + 1. Edit /etc/mail/`hostname`.mc + 2. If a setting for confDH_PARAMETERS does not exist or + exists and is set to a string beginning with '5', + replace it with '2'. + 3. If a setting for confDH_PARAMETERS exists and is set to + a file path, create a new file with: + openssl dhparam -out /path/to/file 2048 + 4. Rebuild the .cf file: + cd /etc/mail/; make; make install + 5. Restart sendmail: + cd /etc/mail/; make restart + + A sendmail patch is coming, at which time this file will be + updated. + 20150601: chmod, chflags, chown and chgrp now affect symlinks in -R mode as defined in symlink(7); previously symlinks were silently ignored. From owner-svn-src-stable-10@FreeBSD.ORG Mon Jun 15 13:01:43 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B74FF91; Mon, 15 Jun 2015 13:01:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 192D9D28; Mon, 15 Jun 2015 13:01:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5FD1gnw025762; Mon, 15 Jun 2015 13:01:42 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5FD1gjx025760; Mon, 15 Jun 2015 13:01:42 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201506151301.t5FD1gjx025760@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 15 Jun 2015 13:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284413 - stable/10/share/examples/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 13:01:43 -0000 Author: avg Date: Mon Jun 15 13:01:42 2015 New Revision: 284413 URL: https://svnweb.freebsd.org/changeset/base/284413 Log: MFC r284023: bhyve/vmrun.sh: support passing disk options same as for bhyve(8) Modified: stable/10/share/examples/bhyve/vmrun.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/share/examples/bhyve/vmrun.sh ============================================================================== --- stable/10/share/examples/bhyve/vmrun.sh Mon Jun 15 12:50:43 2015 (r284412) +++ stable/10/share/examples/bhyve/vmrun.sh Mon Jun 15 13:01:42 2015 (r284413) @@ -96,7 +96,10 @@ while getopts ac:C:d:e:g:hH:iI:m:t: c ; console=${OPTARG} ;; d) - eval "disk_dev${disk_total}=\"${OPTARG}\"" + disk_dev=${OPTARG%%,*} + disk_opts=${OPTARG#${disk_dev}} + eval "disk_dev${disk_total}=\"${disk_dev}\"" + eval "disk_opts${disk_total}=\"${disk_opts}\"" disk_total=$(($disk_total + 1)) ;; e) @@ -225,8 +228,9 @@ while [ 1 ]; do i=0 while [ $i -lt $disk_total ] ; do eval "disk=\$disk_dev${i}" + eval "opts=\$disk_opts${i}" make_and_check_diskdev "${disk}" - devargs="$devargs -s $nextslot:0,virtio-blk,${disk} " + devargs="$devargs -s $nextslot:0,virtio-blk,${disk}${opts} " nextslot=$(($nextslot + 1)) i=$(($i + 1)) done From owner-svn-src-stable-10@FreeBSD.ORG Mon Jun 15 13:18:31 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B04BE7A2; Mon, 15 Jun 2015 13:18:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E4102B; Mon, 15 Jun 2015 13:18:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5FDIVpS035723; Mon, 15 Jun 2015 13:18:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5FDIVqo035722; Mon, 15 Jun 2015 13:18:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201506151318.t5FDIVqo035722@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 15 Jun 2015 13:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284414 - stable/10/share/examples/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 13:18:31 -0000 Author: avg Date: Mon Jun 15 13:18:30 2015 New Revision: 284414 URL: https://svnweb.freebsd.org/changeset/base/284414 Log: MFC r284024: bhyve/vmrun.sh: pass all existing readable disks to bhyveload(8) Modified: stable/10/share/examples/bhyve/vmrun.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/share/examples/bhyve/vmrun.sh ============================================================================== --- stable/10/share/examples/bhyve/vmrun.sh Mon Jun 15 13:01:42 2015 (r284413) +++ stable/10/share/examples/bhyve/vmrun.sh Mon Jun 15 13:18:30 2015 (r284414) @@ -174,16 +174,16 @@ make_and_check_diskdev() echo "Launching virtual machine \"$vmname\" ..." -virtio_diskdev="$disk_dev0" +first_diskdev="$disk_dev0" ${BHYVECTL} --vm=${vmname} --destroy > /dev/null 2>&1 while [ 1 ]; do - file -s ${virtio_diskdev} | grep "boot sector" > /dev/null + file -s ${first_diskdev} | grep "boot sector" > /dev/null rc=$? if [ $rc -ne 0 ]; then - file -s ${virtio_diskdev} | grep ": Unix Fast File sys" > /dev/null + file -s ${first_diskdev} | grep ": Unix Fast File sys" > /dev/null rc=$? fi if [ $rc -ne 0 ]; then @@ -198,14 +198,22 @@ while [ 1 ]; do echo "is not readable" exit 1 fi - BOOTDISK=${isofile} - installer_opt="-s 31:0,ahci-cd,${BOOTDISK}" + BOOTDISKS="-d ${isofile}" + installer_opt="-s 31:0,ahci-cd,${isofile}" else - BOOTDISK=${virtio_diskdev} + BOOTDISKS="" + i=0 + while [ $i -lt $disk_total ] ; do + eval "disk=\$disk_dev${i}" + if [ -r ${disk} ] ; then + BOOTDISKS="$BOOTDISKS -d ${disk} " + fi + i=$(($i + 1)) + done installer_opt="" fi - ${LOADER} -c ${console} -m ${memsize} -d ${BOOTDISK} ${loader_opt} \ + ${LOADER} -c ${console} -m ${memsize} ${BOOTDISKS} ${loader_opt} \ ${vmname} bhyve_exit=$? if [ $bhyve_exit -ne 0 ]; then From owner-svn-src-stable-10@FreeBSD.ORG Mon Jun 15 18:16:24 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A5E25FC; Mon, 15 Jun 2015 18:16:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48110A5A; Mon, 15 Jun 2015 18:16:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5FIGOsD088429; Mon, 15 Jun 2015 18:16:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5FIGNlC088427; Mon, 15 Jun 2015 18:16:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201506151816.t5FIGNlC088427@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 15 Jun 2015 18:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284418 - in stable/10/sys: fs/procfs kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 18:16:24 -0000 Author: delphij Date: Mon Jun 15 18:16:23 2015 New Revision: 284418 URL: https://svnweb.freebsd.org/changeset/base/284418 Log: MFC r283889,r283891: Clear p_stops when doing PT_DETACH and PROCFS_CTL_DETACH. Without this, if a process was being traced by truss(1), which uses different p_stops bits than gdb(1), the latter would misbehave because of the unexpected bits. Reported by: jceel Submitted by: sef Sponsored by: iXsystems, Inc. Modified: stable/10/sys/fs/procfs/procfs_ctl.c stable/10/sys/kern/sys_process.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/procfs/procfs_ctl.c ============================================================================== --- stable/10/sys/fs/procfs/procfs_ctl.c Mon Jun 15 15:34:20 2015 (r284417) +++ stable/10/sys/fs/procfs/procfs_ctl.c Mon Jun 15 18:16:23 2015 (r284418) @@ -235,6 +235,7 @@ out: } else PROC_LOCK(p); p->p_oppid = 0; + p->p_stops = 0; p->p_flag &= ~P_WAITED; /* XXX ? */ sx_xunlock(&proctree_lock); Modified: stable/10/sys/kern/sys_process.c ============================================================================== --- stable/10/sys/kern/sys_process.c Mon Jun 15 15:34:20 2015 (r284417) +++ stable/10/sys/kern/sys_process.c Mon Jun 15 18:16:23 2015 (r284418) @@ -963,6 +963,7 @@ kern_ptrace(struct thread *td, int req, CTR1(KTR_PTRACE, "PT_DETACH: pid %d", p->p_pid); p->p_oppid = 0; p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); + p->p_stops = 0; /* should we send SIGCHLD? */ /* childproc_continued(p); */ From owner-svn-src-stable-10@FreeBSD.ORG Mon Jun 15 21:08:09 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C2319F3; Mon, 15 Jun 2015 21:08:09 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29F1AB33; Mon, 15 Jun 2015 21:08:09 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5FL89Q7073826; Mon, 15 Jun 2015 21:08:09 GMT (envelope-from ambrisko@FreeBSD.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5FL898C073825; Mon, 15 Jun 2015 21:08:09 GMT (envelope-from ambrisko@FreeBSD.org) Message-Id: <201506152108.t5FL898C073825@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ambrisko set sender to ambrisko@FreeBSD.org using -f From: Doug Ambrisko Date: Mon, 15 Jun 2015 21:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284429 - stable/10/sys/dev/mfi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 21:08:09 -0000 Author: ambrisko Date: Mon Jun 15 21:08:08 2015 New Revision: 284429 URL: https://svnweb.freebsd.org/changeset/base/284429 Log: MFC r284180: Switch from make_dev_alias to make_dev_alias_p since make_dev_alias_p can gracefully fail if the /dev/megaraid_sas_ioctl_node symlink already exists. Modified: stable/10/sys/dev/mfi/mfi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mfi/mfi.c ============================================================================== --- stable/10/sys/dev/mfi/mfi.c Mon Jun 15 20:47:26 2015 (r284428) +++ stable/10/sys/dev/mfi/mfi.c Mon Jun 15 21:08:08 2015 (r284429) @@ -375,6 +375,7 @@ mfi_attach(struct mfi_softc *sc) int error, commsz, framessz, sensesz; int frames, unit, max_fw_sge, max_fw_cmds; uint32_t tb_mem_size = 0; + struct cdev *dev_t; if (sc == NULL) return EINVAL; @@ -769,7 +770,8 @@ mfi_attach(struct mfi_softc *sc) sc->mfi_cdev = make_dev(&mfi_cdevsw, unit, UID_ROOT, GID_OPERATOR, 0640, "mfi%d", unit); if (unit == 0) - make_dev_alias(sc->mfi_cdev, "megaraid_sas_ioctl_node"); + make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev_t, + sc->mfi_cdev, "%s", "megaraid_sas_ioctl_node"); if (sc->mfi_cdev != NULL) sc->mfi_cdev->si_drv1 = sc; SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->mfi_dev), From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 02:31:16 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A3BEBA2; Tue, 16 Jun 2015 02:31:16 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24DC8238; Tue, 16 Jun 2015 02:31:16 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5G2VGYg045118; Tue, 16 Jun 2015 02:31:16 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5G2VCLQ045080; Tue, 16 Jun 2015 02:31:12 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201506160231.t5G2VCLQ045080@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 16 Jun 2015 02:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284435 - in stable/10: lib/libsbuf lib/libutil sbin/camcontrol share/man/man9 sys/cam sys/cam/scsi sys/kern sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 02:31:16 -0000 Author: ken Date: Tue Jun 16 02:31:11 2015 New Revision: 284435 URL: https://svnweb.freebsd.org/changeset/base/284435 Log: MFC, r284192: ------------------------------------------------------------------------ r284192 | ken | 2015-06-09 15:39:38 -0600 (Tue, 09 Jun 2015) | 102 lines Add support for reading MAM attributes to camcontrol(8) and libcam(3). MAM is Medium Auxiliary Memory and is most commonly found as flash chips on tapes. This includes support for reading attributes and decoding most known attributes, but does not yet include support for writing attributes or reporting attributes in XML format. libsbuf/Makefile: Add subr_prf.c for the new sbuf_hexdump() function. This function is essentially the same function. libsbuf/Symbol.map: Add a new shared library minor version, and include the sbuf_hexdump() function. libsbuf/Version.def: Add version 1.4 of the libsbuf library. libutil/hexdump.3: Document sbuf_hexdump() alongside hexdump(3), since it is essentially the same function. camcontrol/Makefile: Add attrib.c. camcontrol/attrib.c: Implementation of READ ATTRIBUTE support for camcontrol(8). camcontrol/camcontrol.8: Document the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.c: Add the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.h: Add a function prototype for scsiattrib(). share/man/man9/sbuf.9: Document the existence of sbuf_hexdump() and point users to the hexdump(3) man page for more details. sys/cam/scsi/scsi_all.c: Add a table of known attributes, text descriptions and handler functions. Add a new scsi_attrib_sbuf() function along with a number of other related functions that help decode attributes. scsi_attrib_ascii_sbuf() decodes ASCII format attributes. scsi_attrib_int_sbuf() decodes binary format attributes, and will pass them off to scsi_attrib_hexdump_sbuf() if they're bigger than 8 bytes. scsi_attrib_vendser_sbuf() decodes the vendor and drive serial number attribute. scsi_attrib_volcoh_sbuf() decodes the Volume Coherency Information attribute that LTFS writes out. sys/cam/scsi/scsi_all.h: Add a number of attribute-related structure definitions and other defines. Add function prototypes for all of the functions added in scsi_all.c. sys/kern/subr_prf.c: Add a new function, sbuf_hexdump(). This is the same as the existing hexdump(9) function, except that it puts the result in an sbuf. This also changes subr_prf.c so that it can be compiled in userland for includsion in libsbuf. We should work to change this so that the kernel hexdump implementation is a wrapper around sbuf_hexdump() with a statically allocated sbuf with a drain. That will require a drain function that goes to the kernel printf() buffer that can take a non-NUL terminated string as input. That is because an sbuf isn't NUL-terminated until it is finished, and we don't want to finish it while we're still using it. We should also work to consolidate the userland hexdump and kernel hexdump implemenatations, which are currently separate. This would also mean making applications that currently link in libutil link in libsbuf. sys/sys/sbuf.h: Add the prototype for sbuf_hexdump(), and add another copy of the hexdump flag values if they aren't already defined. Ideally the flags should be defined in one place but the implemenation makes it difficult to do properly. (See above.) Sponsored by: Spectra Logic Corporation ------------------------------------------------------------------------ Added: stable/10/sbin/camcontrol/attrib.c - copied unchanged from r284192, head/sbin/camcontrol/attrib.c Modified: stable/10/lib/libsbuf/Makefile stable/10/lib/libsbuf/Symbol.map stable/10/lib/libsbuf/Version.def stable/10/lib/libutil/hexdump.3 stable/10/sbin/camcontrol/Makefile stable/10/sbin/camcontrol/camcontrol.8 stable/10/sbin/camcontrol/camcontrol.c stable/10/sbin/camcontrol/camcontrol.h stable/10/share/man/man9/sbuf.9 stable/10/sys/cam/cam.c stable/10/sys/cam/cam.h stable/10/sys/cam/scsi/scsi_all.c stable/10/sys/cam/scsi/scsi_all.h stable/10/sys/kern/subr_prf.c stable/10/sys/sys/sbuf.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libsbuf/Makefile ============================================================================== --- stable/10/lib/libsbuf/Makefile Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/lib/libsbuf/Makefile Tue Jun 16 02:31:11 2015 (r284435) @@ -2,7 +2,7 @@ LIB= sbuf SHLIBDIR?= /lib -SRCS= subr_sbuf.c +SRCS= subr_prf.c subr_sbuf.c SHLIB_MAJOR = 6 Modified: stable/10/lib/libsbuf/Symbol.map ============================================================================== --- stable/10/lib/libsbuf/Symbol.map Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/lib/libsbuf/Symbol.map Tue Jun 16 02:31:11 2015 (r284435) @@ -27,3 +27,7 @@ FBSD_1.3 { sbuf_start_section; sbuf_end_section; }; + +FBSD_1.4 { + sbuf_hexdump; +}; Modified: stable/10/lib/libsbuf/Version.def ============================================================================== --- stable/10/lib/libsbuf/Version.def Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/lib/libsbuf/Version.def Tue Jun 16 02:31:11 2015 (r284435) @@ -5,3 +5,6 @@ FBSD_1.2 { FBSD_1.3 { } FBSD_1.2; + +FBSD_1.4 { +} FBSD_1.3; Modified: stable/10/lib/libutil/hexdump.3 ============================================================================== --- stable/10/lib/libutil/hexdump.3 Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/lib/libutil/hexdump.3 Tue Jun 16 02:31:11 2015 (r284435) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2008 +.Dd May 8, 2014 .Dt HEXDUMP 3 .Os .Sh NAME @@ -36,8 +36,17 @@ .Nd "dump a block of bytes to standard out in hexadecimal form" .Sh SYNOPSIS .In libutil.h +.In sys/sbuf.h .Ft void .Fn hexdump "void *ptr" "int length" "const char *hdr" "int flags" +.Ft void +.Fo sbuf_hexdump +.Fa "struct sbuf *sb" +.Fa "void *ptr" +.Fa "int length" +.Fa "const char *hdr" +.Fa "int flags" +.Fc .Sh DESCRIPTION The .Fn hexdump @@ -50,6 +59,11 @@ output will start with an offset count, followed by 16 .Tn ASCII characters. +.Pp +The +.Fn sbuf_hexdump +function prints the hexdump to the supplied +.Xr sbuf 9 . .Bl -tag -width indent .It Fa ptr Pointer to the array of bytes to print. @@ -88,7 +102,8 @@ Do not print the character values on eac .El .El .Sh SEE ALSO -.Xr ascii 7 +.Xr ascii 7 , +.Xr sbuf 9 .Sh AUTHORS This manual page was written by .An Scott Long . Modified: stable/10/sbin/camcontrol/Makefile ============================================================================== --- stable/10/sbin/camcontrol/Makefile Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/sbin/camcontrol/Makefile Tue Jun 16 02:31:11 2015 (r284435) @@ -3,7 +3,7 @@ PROG= camcontrol SRCS= camcontrol.c util.c .if !defined(RELEASE_CRUNCH) -SRCS+= fwdownload.c modeedit.c persist.c progress.c +SRCS+= attrib.c fwdownload.c modeedit.c persist.c progress.c .else CFLAGS+= -DMINIMALISTIC .endif Copied: stable/10/sbin/camcontrol/attrib.c (from r284192, head/sbin/camcontrol/attrib.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sbin/camcontrol/attrib.c Tue Jun 16 02:31:11 2015 (r284435, copy of r284192, head/sbin/camcontrol/attrib.c) @@ -0,0 +1,509 @@ +/*- + * Copyright (c) 2014 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * Authors: Ken Merry (Spectra Logic Corporation) + */ +/* + * SCSI Read and Write Attribute support for camcontrol(8). + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "camcontrol.h" + +#if 0 +struct scsi_attr_desc { + int attr_id; + + STAILQ_ENTRY(scsi_attr_desc) links; +}; +#endif + +static struct scsi_nv elem_type_map[] = { + { "all", ELEMENT_TYPE_ALL }, + { "picker", ELEMENT_TYPE_MT }, + { "slot", ELEMENT_TYPE_ST }, + { "portal", ELEMENT_TYPE_IE }, + { "drive", ELEMENT_TYPE_DT }, +}; + +static struct scsi_nv sa_map[] = { + { "attr_values", SRA_SA_ATTR_VALUES }, + { "attr_list", SRA_SA_ATTR_LIST }, + { "lv_list", SRA_SA_LOG_VOL_LIST }, + { "part_list", SRA_SA_PART_LIST }, + { "supp_attr", SRA_SA_SUPPORTED_ATTRS } +}; + +static struct scsi_nv output_format_map[] = { + { "text_esc", SCSI_ATTR_OUTPUT_TEXT_ESC }, + { "text_raw", SCSI_ATTR_OUTPUT_TEXT_RAW }, + { "nonascii_esc", SCSI_ATTR_OUTPUT_NONASCII_ESC }, + { "nonascii_trim", SCSI_ATTR_OUTPUT_NONASCII_TRIM }, + { "nonascii_raw", SCSI_ATTR_OUTPUT_NONASCII_RAW }, + { "field_all", SCSI_ATTR_OUTPUT_FIELD_ALL }, + { "field_none", SCSI_ATTR_OUTPUT_FIELD_NONE }, + { "field_desc", SCSI_ATTR_OUTPUT_FIELD_DESC }, + { "field_num", SCSI_ATTR_OUTPUT_FIELD_NUM }, + { "field_size", SCSI_ATTR_OUTPUT_FIELD_SIZE }, + { "field_rw", SCSI_ATTR_OUTPUT_FIELD_RW }, +}; + +int +scsiattrib(struct cam_device *device, int argc, char **argv, char *combinedopt, + int retry_count, int timeout, int verbosemode, int err_recover) +{ + union ccb *ccb = NULL; + int attr_num = -1; +#if 0 + int num_attrs = 0; +#endif + int start_attr = 0; + int cached_attr = 0; + int read_service_action = -1; + int read_attr = 0, write_attr = 0; + int element_address = 0; + int element_type = ELEMENT_TYPE_ALL; + int partition = 0; + int logical_volume = 0; + char *endptr; + uint8_t *data_buf = NULL; + uint32_t dxfer_len = UINT16_MAX - 1; + uint32_t valid_len; + uint32_t output_format; + STAILQ_HEAD(, scsi_attr_desc) write_attr_list; + int error = 0; + int c; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("%s: error allocating CCB", __func__); + error = 1; + goto bailout; + } + + bzero(&(&ccb->ccb_h)[1], + sizeof(union ccb) - sizeof(struct ccb_hdr)); + + STAILQ_INIT(&write_attr_list); + + /* + * By default, when displaying attribute values, we trim out + * non-ASCII characters in ASCII fields. We display all fields + * (description, attribute number, attribute size, and readonly + * status). We default to displaying raw text. + * + * XXX KDM need to port this to stable/10 and newer FreeBSD + * versions that have iconv built in and can convert codesets. + */ + output_format = SCSI_ATTR_OUTPUT_NONASCII_TRIM | + SCSI_ATTR_OUTPUT_FIELD_ALL | + SCSI_ATTR_OUTPUT_TEXT_RAW; + + data_buf = malloc(dxfer_len); + if (data_buf == NULL) { + warn("%s: error allocating %u bytes", __func__, dxfer_len); + error = 1; + goto bailout; + } + + while ((c = getopt(argc, argv, combinedopt)) != -1) { + switch (c) { + case 'a': + attr_num = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid attribute number %s", + __func__, optarg); + error = 1; + goto bailout; + } + start_attr = attr_num; + break; + case 'c': + cached_attr = 1; + break; + case 'e': + element_address = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid element address %s", + __func__, optarg); + error = 1; + goto bailout; + } + break; + case 'F': { + scsi_nv_status status; + scsi_attrib_output_flags new_outflags; + int entry_num = 0; + char *tmpstr; + + if (isdigit(optarg[0])) { + output_format = strtoul(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid numeric output " + "format argument %s", __func__, + optarg); + error = 1; + goto bailout; + } + break; + } + new_outflags = SCSI_ATTR_OUTPUT_NONE; + + while ((tmpstr = strsep(&optarg, ",")) != NULL) { + status = scsi_get_nv(output_format_map, + sizeof(output_format_map) / + sizeof(output_format_map[0]), tmpstr, + &entry_num, SCSI_NV_FLAG_IG_CASE); + + if (status == SCSI_NV_FOUND) + new_outflags |= + output_format_map[entry_num].value; + else { + warnx("%s: %s format option %s", + __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", tmpstr); + error = 1; + goto bailout; + } + } + output_format = new_outflags; + break; + } + case 'p': + partition = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid partition number %s", + __func__, optarg); + error = 1; + goto bailout; + } + break; + case 'r': { + scsi_nv_status status; + int entry_num = 0; + + status = scsi_get_nv(sa_map, sizeof(sa_map) / + sizeof(sa_map[0]), optarg, &entry_num, + SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + read_service_action = sa_map[entry_num].value; + else { + warnx("%s: %s %s option %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", "service action", + optarg); + error = 1; + goto bailout; + } + read_attr = 1; + break; + } + case 's': + start_attr = strtol(optarg, &endptr, 0); + if (*endptr != '\0') { + warnx("%s: invalid starting attr argument %s", + __func__, optarg); + error = 1; + goto bailout; + } + break; + case 'T': { + scsi_nv_status status; + int entry_num = 0; + + status = scsi_get_nv(elem_type_map, + sizeof(elem_type_map) / sizeof(elem_type_map[0]), + optarg, &entry_num, SCSI_NV_FLAG_IG_CASE); + if (status == SCSI_NV_FOUND) + element_type = elem_type_map[entry_num].value; + else { + warnx("%s: %s %s option %s", __func__, + (status == SCSI_NV_AMBIGUOUS) ? + "ambiguous" : "invalid", "element type", + optarg); + error = 1; + goto bailout; + } + break; + } + case 'w': + warnx("%s: writing attributes is not implemented yet", + __func__); + error = 1; + goto bailout; + break; + case 'V': + logical_volume = strtol(optarg, &endptr, 0); + + if (*endptr != '\0') { + warnx("%s: invalid logical volume argument %s", + __func__, optarg); + error = 1; + goto bailout; + } + break; + default: + break; + } + } + + /* + * Default to reading attributes + */ + if (((read_attr == 0) && (write_attr == 0)) + || ((read_attr != 0) && (write_attr != 0))) { + warnx("%s: Must specify either -r or -w", __func__); + error = 1; + goto bailout; + } + + if (read_attr != 0) { + scsi_read_attribute(&ccb->csio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*service_action*/ read_service_action, + /*element*/ element_address, + /*elem_type*/ element_type, + /*logical_volume*/ logical_volume, + /*partition*/ partition, + /*first_attribute*/ start_attr, + /*cache*/ cached_attr, + /*data_ptr*/ data_buf, + /*length*/ dxfer_len, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ timeout ? timeout : 60000); +#if 0 + } else { +#endif + + } + + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (err_recover != 0) + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + + if (cam_send_ccb(device, ccb) < 0) { + warn("error sending %s ATTRIBUTE", (read_attr != 0) ? + "READ" : "WRITE"); + + if (verbosemode != 0) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + error = 1; + goto bailout; + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (verbosemode != 0) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + error = 1; + goto bailout; + } + + if (read_attr == 0) + goto bailout; + + valid_len = dxfer_len - ccb->csio.resid; + + switch (read_service_action) { + case SRA_SA_ATTR_VALUES: { + uint32_t len_left, hdr_len, cur_len; + struct scsi_read_attribute_values *hdr; + struct scsi_mam_attribute_header *cur_id; + char error_str[512]; + uint8_t *cur_pos; + struct sbuf *sb; + + hdr = (struct scsi_read_attribute_values *)data_buf; + + if (valid_len < sizeof(*hdr)) { + fprintf(stdout, "No attributes returned.\n"); + error = 0; + goto bailout; + } + + sb = sbuf_new_auto(); + if (sb == NULL) { + warn("%s: Unable to allocate sbuf", __func__); + error = 1; + goto bailout; + } + /* + * XXX KDM grab more data if it is available. + */ + hdr_len = scsi_4btoul(hdr->length); + + for (len_left = MIN(valid_len, hdr_len), + cur_pos = &hdr->attribute_0[0]; len_left > sizeof(*cur_id); + len_left -= cur_len, cur_pos += cur_len) { + int cur_attr_num; + cur_id = (struct scsi_mam_attribute_header *)cur_pos; + cur_len = scsi_2btoul(cur_id->length) + sizeof(*cur_id); + cur_attr_num = scsi_2btoul(cur_id->id); + + if ((attr_num != -1) + && (cur_attr_num != attr_num)) + continue; + + error = scsi_attrib_sbuf(sb, cur_id, len_left, + /*user_table*/ NULL, /*num_user_entries*/ 0, + /*prefer_user_table*/ 0, output_format, error_str, + sizeof(error_str)); + if (error != 0) { + warnx("%s: %s", __func__, error_str); + sbuf_delete(sb); + error = 1; + goto bailout; + } + if (attr_num != -1) + break; + } + + sbuf_finish(sb); + fprintf(stdout, "%s", sbuf_data(sb)); + sbuf_delete(sb); + break; + } + case SRA_SA_SUPPORTED_ATTRS: + case SRA_SA_ATTR_LIST: { + uint32_t len_left, hdr_len; + struct scsi_attrib_list_header *hdr; + struct scsi_attrib_table_entry *entry = NULL; + const char *sa_name = "Supported Attributes"; + const char *at_name = "Available Attributes"; + int attr_id; + uint8_t *cur_id; + + hdr = (struct scsi_attrib_list_header *)data_buf; + if (valid_len < sizeof(*hdr)) { + fprintf(stdout, "No %s\n", + (read_service_action == SRA_SA_SUPPORTED_ATTRS)? + sa_name : at_name); + error = 0; + goto bailout; + } + fprintf(stdout, "%s:\n", + (read_service_action == SRA_SA_SUPPORTED_ATTRS) ? + sa_name : at_name); + hdr_len = scsi_4btoul(hdr->length); + for (len_left = MIN(valid_len, hdr_len), + cur_id = &hdr->first_attr_0[0]; len_left > 1; + len_left -= sizeof(uint16_t), cur_id += sizeof(uint16_t)) { + attr_id = scsi_2btoul(cur_id); + + if ((attr_num != -1) + && (attr_id != attr_num)) + continue; + + entry = scsi_get_attrib_entry(attr_id); + fprintf(stdout, "0x%.4x", attr_id); + if (entry == NULL) + fprintf(stdout, "\n"); + else + fprintf(stdout, ": %s\n", entry->desc); + + if (attr_num != -1) + break; + } + break; + } + case SRA_SA_PART_LIST: + case SRA_SA_LOG_VOL_LIST: { + struct scsi_attrib_lv_list *lv_list; + const char *partition_name = "Partition"; + const char *lv_name = "Logical Volume"; + + if (valid_len < sizeof(*lv_list)) { + fprintf(stdout, "No %s list returned\n", + (read_service_action == SRA_SA_PART_LIST) ? + partition_name : lv_name); + error = 0; + goto bailout; + } + + lv_list = (struct scsi_attrib_lv_list *)data_buf; + + fprintf(stdout, "First %s: %d\n", + (read_service_action == SRA_SA_PART_LIST) ? + partition_name : lv_name, + lv_list->first_lv_number); + fprintf(stdout, "Number of %ss: %d\n", + (read_service_action == SRA_SA_PART_LIST) ? + partition_name : lv_name, + lv_list->num_logical_volumes); + break; + } + default: + break; + } +bailout: + if (ccb != NULL) + cam_freeccb(ccb); + + free(data_buf); + + return (error); +} Modified: stable/10/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/10/sbin/camcontrol/camcontrol.8 Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/sbin/camcontrol/camcontrol.8 Tue Jun 16 02:31:11 2015 (r284435) @@ -298,6 +298,19 @@ .Op Fl T Ar res_type .Op Fl U .Nm +.Ic attrib +.Op device id +.Op generic args +.Aq Fl r Ar action | Fl w Ar attrib +.Op Fl a Ar attr_num +.Op Fl c +.Op Fl e Ar elem_addr +.Op Fl F Ar form1,form2 +.Op Fl p Ar part +.Op Fl s Ar start_addr +.Op Fl T Ar elem_type +.Op Fl V Ar lv_num +.Nm .Ic help .Sh DESCRIPTION The @@ -1823,6 +1836,129 @@ Register and Move request. This option only applies to the Register and Move service action of the Persistent Reserve Out command. .El +.It Ic attrib +Issue the +.Tn SCSI +READ or WRITE ATTRIBUTE commands. +These commands are used to read and write attributes in Medium Auxiliary +Memory (MAM). +The most common place Medium Auxiliary Memory is found is small flash chips +included tape cartriges. +For instance, +.Tn LTO +tapes have MAM. +Either the +.Fl r +option or the +.Fl w +option must be specified. +.Bl -tag -width 14n +.It Fl r Ar action +Specify the READ ATTRIBUTE service action. +.Bl -tag -width 11n +.It attr_values +Issue the ATTRIBUTE VALUES service action. +Read and decode the available attributes and their values. +.It attr_list +Issue the ATTRIBUTE LIST service action. +List the attributes that are available to read and write. +.It lv_list +Issue the LOGICAL VOLUME LIST service action. +List the available logical volumes in the MAM. +.It part_list +Issue the PARTITION LIST service action. +List the available partitions in the MAM. +.It supp_attr +Issue the SUPPORTED ATTRIBUTES service action. +List attributes that are supported for reading or writing. +These attributes may or may not be currently present in the MAM. +.El +.It Fl w Ar attr +Specify an attribute to write to the MAM. +This option is not yet implemented. +.It Fl a Ar num +Specify the attribute number to display. +This option only works with the attr_values, attr_list and supp_attr +arguments to +.Fl r . +.It Fl c +Display cached attributes. +If the device supports this flag, it allows displaying attributes for the +last piece of media loaded in the drive. +.It Fl e Ar num +Specify the element address. +This is used for specifying which element number in a medium changer to +access when reading attributes. +The element number could be for a picker, portal, slot or drive. +.It Fl F Ar form1,form2 +Specify the output format for the attribute values (attr_val) display as a +comma separated list of options. +The default output is currently set to field_all,nonascii_trim,text_raw. +Once this code is ported to FreeBSD 10, any text fields will be converted +from their codeset to the user's native codeset with +.Xr iconv 3 . +.Pp +The text options are mutually exclusive; if you specify more than one, you +will get unpredictable results. +The nonascii options are also mutually exclusive. +Most of the field options may be logically ORed together. +.Bl -tag -width 12n +.It text_esc +Print text fields with non-ASCII characters escaped. +.It text_raw +Print text fields natively, with no codeset conversion. +.It nonascii_esc +If any non-ASCII characters occur in fields that are supposed to be ASCII, +escape the non-ASCII characters. +.It nonascii_trim +If any non-ASCII characters occur in fields that are supposed to be ASCII, +omit the non-ASCII characters. +.It nonascii_raw +If any non-ASCII characters occur in fields that are supposed to be ASCII, +print them as they are. +.It field_all +Print all of the prefix fields: description, attribute number, attribute +size, and the attribute's readonly status. +If field_all is specified, specifying any other field options will not have +an effect. +.It field_none +Print none of the prefix fields, and only print out the attribute value. +If field_none is specified, specifying any other field options will result +in those fields being printed. +.It field_desc +Print out the attribute description. +.It field_num +Print out the attribute number. +.It field_size +Print out the attribute size. +.It field_rw +Print out the attribute's readonly status. +.El +.It Fl p Ar part +Specify the partition. +When the media has multiple partitions, specifying different partition +numbers allows seeing the values for each individual partition. +.It Fl s Ar start_num +Specify the starting attribute number. +This requests that the target device return attribute information starting +at the given number. +.It Fl T Ar elem_type +Specify the element type. +For medium changer devices, this allows specifying the type the element +referenced in the element address ( +.Fl e ) . +Valid types are: +.Dq all , +.Dq picker , +.Dq slot , +.Dq portal , +and +.Dq drive . +.El +.It Fl V Ar vol_num +Specify the number of the logical volume to operate on. +If the media has multiple logical volumes, this will allow displaying +or writing attributes on the given logical volume. .It Ic help Print out verbose usage information. .El @@ -2049,6 +2185,15 @@ current initiator will be unregistered f The reservation will be moved to relative target port 2 on the target device. The registration will persist across power losses. +.Pp +.Bd -literal -offset indent +camcontrol attrib sa0 -v -i attr_values -p 1 +.Ed +.Pp +This will read and decode the attribute values from partition 1 on the tape +in tape drive sa0, and will display any +.Tn SCSI +errors that result. .Sh SEE ALSO .Xr cam 3 , .Xr cam_cdbparse 3 , Modified: stable/10/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/10/sbin/camcontrol/camcontrol.c Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/sbin/camcontrol/camcontrol.c Tue Jun 16 02:31:11 2015 (r284435) @@ -98,7 +98,8 @@ typedef enum { CAM_CMD_SANITIZE = 0x0000001f, CAM_CMD_PERSIST = 0x00000020, CAM_CMD_APM = 0x00000021, - CAM_CMD_AAM = 0x00000022 + CAM_CMD_AAM = 0x00000022, + CAM_CMD_ATTRIB = 0x00000023 } cam_cmdmask; typedef enum { @@ -224,6 +225,7 @@ static struct camcontrol_opts option_tab {"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"}, {"hpa", CAM_CMD_HPA, CAM_ARG_NONE, "Pflp:qs:U:y"}, {"persist", CAM_CMD_PERSIST, CAM_ARG_NONE, "ai:I:k:K:o:ps:ST:U"}, + {"attrib", CAM_CMD_ATTRIB, CAM_ARG_NONE, "a:ce:F:p:r:s:T:w:V:"}, #endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -8118,6 +8120,9 @@ usage(int printlong) " camcontrol persist [dev_id][generic args] <-i action|-o action>\n" " [-a][-I tid][-k key][-K sa_key][-p][-R rtp]\n" " [-s scope][-S][-T type][-U]\n" +" camcontrol attrib [dev_id][generic args] <-r action|-w attr>\n" +" [-a attr_num][-c][-e elem][-F form1,form1]\n" +" [-p part][-s start][-T type][-V vol]\n" #endif /* MINIMALISTIC */ " camcontrol help\n"); if (!printlong) @@ -8157,6 +8162,7 @@ usage(int printlong) "fwdownload program firmware of the named device with the given image\n" "security report or send ATA security commands to the named device\n" "persist send the SCSI PERSISTENT RESERVE IN or OUT commands\n" +"attrib send the SCSI READ or WRITE ATTRIBUTE commands\n" "help this message\n" "Device Identifiers:\n" "bus:target specify the bus and target, lun defaults to 0\n" @@ -8307,6 +8313,20 @@ usage(int printlong) "-T res_type specify the reservation type: read_shared, wr_ex, rd_ex,\n" " ex_ac, wr_ex_ro, ex_ac_ro, wr_ex_ar, ex_ac_ar\n" "-U unregister the current initiator for register_move\n" +"attrib arguments:\n" +"-r action specify attr_values, attr_list, lv_list, part_list, or\n" +" supp_attr\n" +"-w attr specify an attribute to write, one -w argument per attr\n" +"-a attr_num only display this attribute number\n" +"-c get cached attributes\n" +"-e elem_addr request attributes for the given element in a changer\n" +"-F form1,form2 output format, comma separated list: text_esc, text_raw,\n" +" nonascii_esc, nonascii_trim, nonascii_raw, field_all,\n" +" field_none, field_desc, field_num, field_size, field_rw\n" +"-p partition request attributes for the given partition\n" +"-s start_attr request attributes starting at the given number\n" +"-T elem_type specify the element type (used with -e)\n" +"-V logical_vol specify the logical volume ID\n" ); #endif /* MINIMALISTIC */ } @@ -8651,6 +8671,11 @@ main(int argc, char **argv) retry_count, timeout, arglist & CAM_ARG_VERBOSE, arglist & CAM_ARG_ERR_RECOVER); break; + case CAM_CMD_ATTRIB: + error = scsiattrib(cam_dev, argc, argv, combinedopt, + retry_count, timeout, arglist & CAM_ARG_VERBOSE, + arglist & CAM_ARG_ERR_RECOVER); + break; #endif /* MINIMALISTIC */ case CAM_CMD_USAGE: usage(1); Modified: stable/10/sbin/camcontrol/camcontrol.h ============================================================================== --- stable/10/sbin/camcontrol/camcontrol.h Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/sbin/camcontrol/camcontrol.h Tue Jun 16 02:31:11 2015 (r284435) @@ -66,6 +66,9 @@ int scsidoinquiry(struct cam_device *dev int scsipersist(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout, int verbose, int err_recover); +int scsiattrib(struct cam_device *device, int argc, char **argv, + char *combinedopt, int retry_count, int timeout, int verbose, + int err_recover); char *cget(void *hook, char *name); int iget(void *hook, char *name); void arg_put(void *hook, int letter, void *arg, int count, char *name); Modified: stable/10/share/man/man9/sbuf.9 ============================================================================== --- stable/10/share/man/man9/sbuf.9 Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/share/man/man9/sbuf.9 Tue Jun 16 02:31:11 2015 (r284435) @@ -53,7 +53,8 @@ .Nm sbuf_done , .Nm sbuf_delete , .Nm sbuf_start_section , -.Nm sbuf_end_section +.Nm sbuf_end_section , +.Nm sbuf_hexdump .Nd safe string composition .Sh SYNOPSIS .In sys/types.h @@ -106,6 +107,14 @@ .Fn sbuf_start_section "struct sbuf *s" "ssize_t *old_lenp" .Ft ssize_t .Fn sbuf_end_section "struct sbuf *s" "ssize_t old_len" "size_t pad" "int c" +.Ft void +.Fo sbuf_hexdump +.Fa "struct sbuf *sb" +.Fa "void *ptr" +.Fa "int length" +.Fa "const char *hdr" +.Fa "int flags" +.Fc .In sys/sysctl.h .Ft struct sbuf * .Fn sbuf_new_for_sysctl "struct sbuf *s" "char *buf" "int length" "struct sysctl_req *req" @@ -432,6 +441,14 @@ and \-1 can be specified for and .Fa old_len respectively. +.Pp +The +.Fn sbuf_hexdump +function prints an array of bytes to the supplied sbuf, along with an ASCII +representation of the bytes if possible. +See the +.Xr hexdump 3 +man page for more details on the interface. .Sh NOTES If an operation caused an .Fa sbuf @@ -535,6 +552,7 @@ transmit_msg(sbuf_data(sb), sbuf_len(sb) sbuf_delete(sb); .Ed .Sh SEE ALSO +.Xr hexdump 3 , .Xr printf 3 , .Xr strcat 3 , .Xr strcpy 3 , Modified: stable/10/sys/cam/cam.c ============================================================================== --- stable/10/sys/cam/cam.c Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/sys/cam/cam.c Tue Jun 16 02:31:11 2015 (r284435) @@ -158,6 +158,56 @@ cam_strvis(u_int8_t *dst, const u_int8_t *dst = '\0'; } +void +cam_strvis_sbuf(struct sbuf *sb, const u_int8_t *src, int srclen, + uint32_t flags) +{ + + /* Trim leading/trailing spaces, nulls. */ + while (srclen > 0 && src[0] == ' ') + src++, srclen--; + while (srclen > 0 + && (src[srclen-1] == ' ' || src[srclen-1] == '\0')) + srclen--; + + while (srclen > 0) { + if (*src < 0x20 || *src >= 0x80) { + /* SCSI-II Specifies that these should never occur. */ + /* non-printable character */ + switch (flags & CAM_STRVIS_FLAG_NONASCII_MASK) { + case CAM_STRVIS_FLAG_NONASCII_ESC: + sbuf_printf(sb, "\\%c%c%c", + ((*src & 0300) >> 6) + '0', + ((*src & 0070) >> 3) + '0', + ((*src & 0007) >> 0) + '0'); + break; + case CAM_STRVIS_FLAG_NONASCII_RAW: + /* + * If we run into a NUL, just transform it + * into a space. + */ + if (*src != 0x00) + sbuf_putc(sb, *src); + else + sbuf_putc(sb, ' '); + break; + case CAM_STRVIS_FLAG_NONASCII_SPC: + sbuf_putc(sb, ' '); + break; + case CAM_STRVIS_FLAG_NONASCII_TRIM: + default: + break; + } + } else { + /* normal character */ + sbuf_putc(sb, *src); + } + src++; + srclen--; + } +} + + /* * Compare string with pattern, returning 0 on match. * Short pattern matches trailing blanks in name, Modified: stable/10/sys/cam/cam.h ============================================================================== --- stable/10/sys/cam/cam.h Mon Jun 15 23:30:54 2015 (r284434) +++ stable/10/sys/cam/cam.h Tue Jun 16 02:31:11 2015 (r284435) @@ -346,6 +346,15 @@ typedef enum { CAM_EAF_PRINT_RESULT = 0x20 } cam_error_ata_flags; +typedef enum { + CAM_STRVIS_FLAG_NONE = 0x00, + CAM_STRVIS_FLAG_NONASCII_MASK = 0x03, + CAM_STRVIS_FLAG_NONASCII_TRIM = 0x00, + CAM_STRVIS_FLAG_NONASCII_RAW = 0x01, + CAM_STRVIS_FLAG_NONASCII_SPC = 0x02, + CAM_STRVIS_FLAG_NONASCII_ESC = 0x03 +} cam_strvis_flags; + struct cam_status_entry { cam_status status_code; @@ -358,6 +367,7 @@ extern const int num_cam_status_entries; extern int cam_sort_io_queues; #endif union ccb; +struct sbuf; #ifdef SYSCTL_DECL /* from sysctl.h */ SYSCTL_DECL(_kern_cam); @@ -370,6 +380,8 @@ caddr_t cam_quirkmatch(caddr_t target, c int entry_size, cam_quirkmatch_t *comp_func); void cam_strvis(u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen); +void cam_strvis_sbuf(struct sbuf *sb, const u_int8_t *src, int srclen, + uint32_t flags); int cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len); const struct cam_status_entry* Modified: stable/10/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.c Mon Jun 15 23:30:54 2015 (r284434) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 08:21:59 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD288D1E; Tue, 16 Jun 2015 08:21:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 813FA665; Tue, 16 Jun 2015 08:21:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5G8Lxpx020487; Tue, 16 Jun 2015 08:21:59 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5G8LxfG020486; Tue, 16 Jun 2015 08:21:59 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506160821.t5G8LxfG020486@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 16 Jun 2015 08:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284438 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 08:21:59 -0000 Author: tuexen Date: Tue Jun 16 08:21:58 2015 New Revision: 284438 URL: https://svnweb.freebsd.org/changeset/base/284438 Log: MFC r284326: In case of an output error, continue with the next net, don't try to continue sending on the same net. This fixes a bug where an invalid mbuf chain was constructed, if a full size frame of control chunks should be sent and there is a output error. Based on a discussion with rrs@, change move to the next net. This fixes the bug and improves the behaviour. Thanks to Irene Ruengeler for spending a lot of time in narrowing this problem down. Modified: stable/10/sys/netinet/sctp_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_output.c ============================================================================== --- stable/10/sys/netinet/sctp_output.c Tue Jun 16 03:03:26 2015 (r284437) +++ stable/10/sys/netinet/sctp_output.c Tue Jun 16 08:21:58 2015 (r284438) @@ -8001,6 +8001,7 @@ again_one_more_time: } else { r_mtu = mtu; } + error = 0; /************************/ /* ASCONF transmission */ /************************/ @@ -8159,7 +8160,7 @@ again_one_more_time: sctp_move_chunks_from_net(stcb, net); } *reason_code = 7; - continue; + break; } else asoc->ifp_had_enobuf = 0; if (*now_filled == 0) { @@ -8202,6 +8203,10 @@ again_one_more_time: } } } + if (error != 0) { + /* try next net */ + continue; + } /************************/ /* Control transmission */ /************************/ @@ -8436,7 +8441,7 @@ again_one_more_time: sctp_move_chunks_from_net(stcb, net); } *reason_code = 7; - continue; + break; } else asoc->ifp_had_enobuf = 0; /* Only HB or ASCONF advances time */ @@ -8482,6 +8487,10 @@ again_one_more_time: } } } + if (error != 0) { + /* try next net */ + continue; + } /* JRI: if dest is in PF state, do not send data to it */ if ((asoc->sctp_cmt_on_off > 0) && (net != stcb->asoc.alternate) && From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 08:24:09 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44F68E7A; Tue, 16 Jun 2015 08:24:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26618693; Tue, 16 Jun 2015 08:24:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5G8O9FT020872; Tue, 16 Jun 2015 08:24:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5G8O81w020871; Tue, 16 Jun 2015 08:24:08 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506160824.t5G8O81w020871@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 16 Jun 2015 08:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284439 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 08:24:09 -0000 Author: tuexen Date: Tue Jun 16 08:24:08 2015 New Revision: 284439 URL: https://svnweb.freebsd.org/changeset/base/284439 Log: MFC r284331: Code cleanup. Modified: stable/10/sys/netinet/sctp_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_output.c ============================================================================== --- stable/10/sys/netinet/sctp_output.c Tue Jun 16 08:21:58 2015 (r284438) +++ stable/10/sys/netinet/sctp_output.c Tue Jun 16 08:24:08 2015 (r284439) @@ -8125,6 +8125,12 @@ again_one_more_time: * it is used to do appropriate * source address selection. */ + if (*now_filled == 0) { + (void)SCTP_GETTIME_TIMEVAL(now); + *now_filled = 1; + } + net->last_sent_time = *now; + hbflag = 0; if ((error = sctp_lowlevel_chunk_output(inp, stcb, net, (struct sockaddr *)&net->ro._l_addr, outchain, auth_offset, auth, @@ -8135,21 +8141,18 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - if (error == ENOBUFS) { - asoc->ifp_had_enobuf = 1; - SCTP_STAT_INCR(sctps_lowlevelerr); - } + /* + * error, we could not + * output + */ + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); } - if (*now_filled == 0) { - (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); - *now_filled = 1; - *now = net->last_sent_time; - } else { - net->last_sent_time = *now; + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); } - hbflag = 0; /* error, could not output */ if (error == EHOSTUNREACH) { /* @@ -8161,16 +8164,9 @@ again_one_more_time: } *reason_code = 7; break; - } else - asoc->ifp_had_enobuf = 0; - if (*now_filled == 0) { - (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); - *now_filled = 1; - *now = net->last_sent_time; } else { - net->last_sent_time = *now; + asoc->ifp_had_enobuf = 0; } - hbflag = 0; /* * increase the number we sent, if a * cookie is sent we don't tell them @@ -8403,6 +8399,15 @@ again_one_more_time: sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, inp, stcb, net); cookie = 0; } + /* Only HB or ASCONF advances time */ + if (hbflag) { + if (*now_filled == 0) { + (void)SCTP_GETTIME_TIMEVAL(now); + *now_filled = 1; + } + net->last_sent_time = *now; + hbflag = 0; + } if ((error = sctp_lowlevel_chunk_output(inp, stcb, net, (struct sockaddr *)&net->ro._l_addr, outchain, @@ -8414,23 +8419,17 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - if (error == ENOBUFS) { - asoc->ifp_had_enobuf = 1; - SCTP_STAT_INCR(sctps_lowlevelerr); - } + /* + * error, we could not + * output + */ + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); } - /* error, could not output */ - if (hbflag) { - if (*now_filled == 0) { - (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); - *now_filled = 1; - *now = net->last_sent_time; - } else { - net->last_sent_time = *now; - } - hbflag = 0; + if (error == ENOBUFS) { + asoc->ifp_had_enobuf = 1; + SCTP_STAT_INCR(sctps_lowlevelerr); } if (error == EHOSTUNREACH) { /* @@ -8442,18 +8441,8 @@ again_one_more_time: } *reason_code = 7; break; - } else + } else { asoc->ifp_had_enobuf = 0; - /* Only HB or ASCONF advances time */ - if (hbflag) { - if (*now_filled == 0) { - (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); - *now_filled = 1; - *now = net->last_sent_time; - } else { - net->last_sent_time = *now; - } - hbflag = 0; } /* * increase the number we sent, if a @@ -8745,6 +8734,14 @@ no_data_fill: */ sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net); } + if (bundle_at || hbflag) { + /* For data/asconf and hb set time */ + if (*now_filled == 0) { + (void)SCTP_GETTIME_TIMEVAL(now); + *now_filled = 1; + } + net->last_sent_time = *now; + } /* Now send it, if there is anything to send :> */ if ((error = sctp_lowlevel_chunk_output(inp, stcb, @@ -8763,23 +8760,13 @@ no_data_fill: 0, 0, so_locked))) { /* error, we could not output */ - if (error == ENOBUFS) { - SCTP_STAT_INCR(sctps_lowlevelerr); - asoc->ifp_had_enobuf = 1; - } + SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); } - SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); - if (hbflag) { - if (*now_filled == 0) { - (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); - *now_filled = 1; - *now = net->last_sent_time; - } else { - net->last_sent_time = *now; - } - hbflag = 0; + if (error == ENOBUFS) { + SCTP_STAT_INCR(sctps_lowlevelerr); + asoc->ifp_had_enobuf = 1; } if (error == EHOSTUNREACH) { /* @@ -8804,16 +8791,6 @@ no_data_fill: endoutchain = NULL; auth = NULL; auth_offset = 0; - if (bundle_at || hbflag) { - /* For data/asconf and hb set time */ - if (*now_filled == 0) { - (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); - *now_filled = 1; - *now = net->last_sent_time; - } else { - net->last_sent_time = *now; - } - } if (!no_out_cnt) { *num_out += (ctl_cnt + bundle_at); } From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 08:26:34 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 87995FD2; Tue, 16 Jun 2015 08:26:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 759706AC; Tue, 16 Jun 2015 08:26:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5G8QY79021279; Tue, 16 Jun 2015 08:26:34 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5G8QY93021278; Tue, 16 Jun 2015 08:26:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506160826.t5G8QY93021278@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 16 Jun 2015 08:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284440 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 08:26:34 -0000 Author: tuexen Date: Tue Jun 16 08:26:33 2015 New Revision: 284440 URL: https://svnweb.freebsd.org/changeset/base/284440 Log: MFC r284332: Fix the reporting of the PMTUD state for specific paths. Modified: stable/10/sys/netinet/sctp_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/10/sys/netinet/sctp_usrreq.c Tue Jun 16 08:24:08 2015 (r284439) +++ stable/10/sys/netinet/sctp_usrreq.c Tue Jun 16 08:26:33 2015 (r284440) @@ -2464,9 +2464,9 @@ flags_out: } /* get flags for PMTU */ if (net->dest_state & SCTP_ADDR_NO_PMTUD) { - paddrp->spp_flags |= SPP_PMTUD_ENABLE; - } else { paddrp->spp_flags |= SPP_PMTUD_DISABLE; + } else { + paddrp->spp_flags |= SPP_PMTUD_ENABLE; } if (net->dscp & 0x01) { paddrp->spp_dscp = net->dscp & 0xfc; From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 08:36:59 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F326930E; Tue, 16 Jun 2015 08:36:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFEA692C; Tue, 16 Jun 2015 08:36:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5G8aw4C026359; Tue, 16 Jun 2015 08:36:58 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5G8awLj026357; Tue, 16 Jun 2015 08:36:58 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506160836.t5G8awLj026357@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 16 Jun 2015 08:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284441 - stable/10/usr.bin/sockstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 08:36:59 -0000 Author: tuexen Date: Tue Jun 16 08:36:57 2015 New Revision: 284441 URL: https://svnweb.freebsd.org/changeset/base/284441 Log: MFC r284351: Simplify printaddr(). No functional change. MFC r284352: Allow more than one socket entry for a file descriptor. This is needed for supporting 1-to-many style SCTP sockets. For other sochets, there is no functional change. MFC r284353: Allow more than one local or remote address per socket. This is needed to support SCTP (and MPTCP in the future). No functional change for existing protocols. MFC r284354: Add support for SCTP. MFC r284355: When using -L the code skips a socket if the local or foreign address is loopback. So it is shown if both are not loopback. The man page says that it is shown if the local or foreign address is not loopback. Change the man page to reflect the code. Modified: stable/10/usr.bin/sockstat/sockstat.1 stable/10/usr.bin/sockstat/sockstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/sockstat/sockstat.1 ============================================================================== --- stable/10/usr.bin/sockstat/sockstat.1 Tue Jun 16 08:26:33 2015 (r284440) +++ stable/10/usr.bin/sockstat/sockstat.1 Tue Jun 16 08:36:57 2015 (r284441) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2015 +.Dd June 13, 2015 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -61,7 +61,7 @@ Show connected sockets. .It Fl j Ar jid Show only sockets belonging to the specified jail ID. .It Fl L -Only show Internet sockets if the local or foreign addresses are not +Only show Internet sockets if the local and foreign addresses are not in the loopback network prefix .Li 127.0.0.0/8 , or do not contain the IPv6 loopback address Modified: stable/10/usr.bin/sockstat/sockstat.c ============================================================================== --- stable/10/usr.bin/sockstat/sockstat.c Tue Jun 16 08:26:33 2015 (r284440) +++ stable/10/usr.bin/sockstat/sockstat.c Tue Jun 16 08:36:57 2015 (r284441) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -71,7 +72,7 @@ static int opt_v; /* Verbose mode */ /* * Default protocols to use if no -P was defined. */ -static const char *default_protos[] = {"tcp", "udp", "divert" }; +static const char *default_protos[] = {"sctp", "tcp", "udp", "divert" }; static size_t default_numprotos = sizeof(default_protos) / sizeof(default_protos[0]); @@ -84,6 +85,11 @@ static int *ports; #define SET_PORT(p) do { ports[p / INT_BIT] |= 1 << (p % INT_BIT); } while (0) #define CHK_PORT(p) (ports[p / INT_BIT] & (1 << (p % INT_BIT))) +struct addr { + struct sockaddr_storage address; + struct addr *next; +}; + struct sock { void *socket; void *pcb; @@ -92,8 +98,8 @@ struct sock { int family; int proto; const char *protoname; - struct sockaddr_storage laddr; - struct sockaddr_storage faddr; + struct addr *laddr; + struct addr *faddr; struct sock *next; }; @@ -249,6 +255,241 @@ sockaddr(struct sockaddr_storage *sa, in } static void +gather_sctp(void) +{ + struct sock *sock; + struct addr *laddr, *prev_laddr, *faddr, *prev_faddr; + struct xsctp_inpcb *xinpcb; + struct xsctp_tcb *xstcb; + struct xsctp_raddr *xraddr; + struct xsctp_laddr *xladdr; + const char *varname; + size_t len, offset; + char *buf; + int hash, vflag; + int no_stcb, local_all_loopback, foreign_all_loopback; + + vflag = 0; + if (opt_4) + vflag |= INP_IPV4; + if (opt_6) + vflag |= INP_IPV6; + + varname = "net.inet.sctp.assoclist"; + if (sysctlbyname(varname, 0, &len, 0, 0) < 0) { + if (errno != ENOENT) + err(1, "sysctlbyname()"); + return; + } + if ((buf = (char *)malloc(len)) == NULL) { + err(1, "malloc()"); + return; + } + if (sysctlbyname(varname, buf, &len, 0, 0) < 0) { + err(1, "sysctlbyname()"); + free(buf); + return; + } + xinpcb = (struct xsctp_inpcb *)(void *)buf; + offset = sizeof(struct xsctp_inpcb); + while ((offset < len) && (xinpcb->last == 0)) { + if ((sock = calloc(1, sizeof *sock)) == NULL) + err(1, "malloc()"); + sock->socket = xinpcb->socket; + sock->proto = IPPROTO_SCTP; + sock->protoname = "sctp"; + if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) { + sock->family = AF_INET6; + sock->vflag = INP_IPV6; + } else { + sock->family = AF_INET; + sock->vflag = INP_IPV4; + } + prev_laddr = NULL; + local_all_loopback = 1; + while (offset < len) { + xladdr = (struct xsctp_laddr *)(void *)(buf + offset); + offset += sizeof(struct xsctp_laddr); + if (xladdr->last == 1) + break; + if ((laddr = calloc(1, sizeof(struct addr))) == NULL) + err(1, "malloc()"); + switch (xladdr->address.sa.sa_family) { + case AF_INET: +#define __IN_IS_ADDR_LOOPBACK(pina) \ + ((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) + if (!__IN_IS_ADDR_LOOPBACK(&xladdr->address.sin.sin_addr)) + local_all_loopback = 0; +#undef __IN_IS_ADDR_LOOPBACK + sockaddr(&laddr->address, + AF_INET, + &xladdr->address.sin.sin_addr, + htons(xinpcb->local_port)); + break; + case AF_INET6: + if (!IN6_IS_ADDR_LOOPBACK(&xladdr->address.sin6.sin6_addr)) + local_all_loopback = 0; + sockaddr(&laddr->address, + AF_INET6, + &xladdr->address.sin6.sin6_addr, + htons(xinpcb->local_port)); + break; + default: + errx(1, "adress family %d not supported", + xladdr->address.sa.sa_family); + } + laddr->next = NULL; + if (prev_laddr == NULL) + sock->laddr = laddr; + else + prev_laddr->next = laddr; + prev_laddr = laddr; + } + if (sock->laddr == NULL) { + if ((sock->laddr = calloc(1, sizeof(struct addr))) == NULL) + err(1, "malloc()"); + sock->laddr->address.ss_family = sock->family; + if (sock->family == AF_INET) + sock->laddr->address.ss_len = sizeof(struct sockaddr_in); + else + sock->laddr->address.ss_len = sizeof(struct sockaddr_in); + local_all_loopback = 0; + } + if ((sock->faddr = calloc(1, sizeof(struct addr))) == NULL) + err(1, "malloc()"); + sock->faddr->address.ss_family = sock->family; + if (sock->family == AF_INET) + sock->faddr->address.ss_len = sizeof(struct sockaddr_in); + else + sock->faddr->address.ss_len = sizeof(struct sockaddr_in); + no_stcb = 1; + while (offset < len) { + xstcb = (struct xsctp_tcb *)(void *)(buf + offset); + offset += sizeof(struct xsctp_tcb); + if (no_stcb && + opt_l && + (!opt_L || !local_all_loopback) && + ((xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE) || + (xstcb->last == 1))) { + hash = (int)((uintptr_t)sock->socket % HASHSIZE); + sock->next = sockhash[hash]; + sockhash[hash] = sock; + } + if (xstcb->last == 1) + break; + no_stcb = 0; + if (opt_c) { + if ((sock = calloc(1, sizeof *sock)) == NULL) + err(1, "malloc()"); + sock->socket = xinpcb->socket; + sock->proto = IPPROTO_SCTP; + sock->protoname = "sctp"; + if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) { + sock->family = AF_INET6; + sock->vflag = INP_IPV6; + } else { + sock->family = AF_INET; + sock->vflag = INP_IPV4; + } + } + prev_laddr = NULL; + local_all_loopback = 1; + while (offset < len) { + xladdr = (struct xsctp_laddr *)(void *)(buf + offset); + offset += sizeof(struct xsctp_laddr); + if (xladdr->last == 1) + break; + if (!opt_c) + continue; + if ((laddr = calloc(1, sizeof(struct addr))) == NULL) + err(1, "malloc()"); + switch (xladdr->address.sa.sa_family) { + case AF_INET: +#define __IN_IS_ADDR_LOOPBACK(pina) \ + ((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) + if (!__IN_IS_ADDR_LOOPBACK(&xladdr->address.sin.sin_addr)) + local_all_loopback = 0; +#undef __IN_IS_ADDR_LOOPBACK + sockaddr(&laddr->address, + AF_INET, + &xladdr->address.sin.sin_addr, + htons(xstcb->local_port)); + break; + case AF_INET6: + if (!IN6_IS_ADDR_LOOPBACK(&xladdr->address.sin6.sin6_addr)) + local_all_loopback = 0; + sockaddr(&laddr->address, + AF_INET6, + &xladdr->address.sin6.sin6_addr, + htons(xstcb->local_port)); + break; + default: + errx(1, "adress family %d not supported", + xladdr->address.sa.sa_family); + } + laddr->next = NULL; + if (prev_laddr == NULL) + sock->laddr = laddr; + else + prev_laddr->next = laddr; + prev_laddr = laddr; + } + prev_faddr = NULL; + foreign_all_loopback = 1; + while (offset < len) { + xraddr = (struct xsctp_raddr *)(void *)(buf + offset); + offset += sizeof(struct xsctp_raddr); + if (xraddr->last == 1) + break; + if (!opt_c) + continue; + if ((faddr = calloc(1, sizeof(struct addr))) == NULL) + err(1, "malloc()"); + switch (xraddr->address.sa.sa_family) { + case AF_INET: +#define __IN_IS_ADDR_LOOPBACK(pina) \ + ((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) + if (!__IN_IS_ADDR_LOOPBACK(&xraddr->address.sin.sin_addr)) + foreign_all_loopback = 0; +#undef __IN_IS_ADDR_LOOPBACK + sockaddr(&faddr->address, + AF_INET, + &xraddr->address.sin.sin_addr, + htons(xstcb->remote_port)); + break; + case AF_INET6: + if (!IN6_IS_ADDR_LOOPBACK(&xraddr->address.sin6.sin6_addr)) + foreign_all_loopback = 0; + sockaddr(&faddr->address, + AF_INET6, + &xraddr->address.sin6.sin6_addr, + htons(xstcb->remote_port)); + break; + default: + errx(1, "adress family %d not supported", + xraddr->address.sa.sa_family); + } + faddr->next = NULL; + if (prev_faddr == NULL) + sock->faddr = faddr; + else + prev_faddr->next = faddr; + prev_faddr = faddr; + } + if (opt_c && + (!opt_L || !(local_all_loopback || foreign_all_loopback))) { + hash = (int)((uintptr_t)sock->socket % HASHSIZE); + sock->next = sockhash[hash]; + sockhash[hash] = sock; + } + } + xinpcb = (struct xsctp_inpcb *)(void *)(buf + offset); + offset += sizeof(struct xsctp_inpcb); + } + free(buf); +} + +static void gather_inet(int proto) { struct xinpgen *xig, *exig; @@ -257,6 +498,7 @@ gather_inet(int proto) struct inpcb *inp; struct xsocket *so; struct sock *sock; + struct addr *laddr, *faddr; const char *varname, *protoname; size_t len, bufsize; void *buf; @@ -368,21 +610,29 @@ gather_inet(int proto) } if ((sock = calloc(1, sizeof *sock)) == NULL) err(1, "malloc()"); + if ((laddr = calloc(1, sizeof *laddr)) == NULL) + err(1, "malloc()"); + if ((faddr = calloc(1, sizeof *faddr)) == NULL) + err(1, "malloc()"); sock->socket = so->xso_so; sock->proto = proto; if (inp->inp_vflag & INP_IPV4) { sock->family = AF_INET; - sockaddr(&sock->laddr, sock->family, + sockaddr(&laddr->address, sock->family, &inp->inp_laddr, inp->inp_lport); - sockaddr(&sock->faddr, sock->family, + sockaddr(&faddr->address, sock->family, &inp->inp_faddr, inp->inp_fport); } else if (inp->inp_vflag & INP_IPV6) { sock->family = AF_INET6; - sockaddr(&sock->laddr, sock->family, + sockaddr(&laddr->address, sock->family, &inp->in6p_laddr, inp->inp_lport); - sockaddr(&sock->faddr, sock->family, + sockaddr(&faddr->address, sock->family, &inp->in6p_faddr, inp->inp_fport); } + laddr->next = NULL; + faddr->next = NULL; + sock->laddr = laddr; + sock->faddr = faddr; sock->vflag = inp->inp_vflag; sock->protoname = protoname; hash = (int)((uintptr_t)sock->socket % HASHSIZE); @@ -399,6 +649,7 @@ gather_unix(int proto) struct xunpgen *xug, *exug; struct xunpcb *xup; struct sock *sock; + struct addr *laddr, *faddr; const char *varname, *protoname; size_t len, bufsize; void *buf; @@ -457,16 +708,24 @@ gather_unix(int proto) continue; if ((sock = calloc(1, sizeof *sock)) == NULL) err(1, "malloc()"); + if ((laddr = calloc(1, sizeof *laddr)) == NULL) + err(1, "malloc()"); + if ((faddr = calloc(1, sizeof *faddr)) == NULL) + err(1, "malloc()"); sock->socket = xup->xu_socket.xso_so; sock->pcb = xup->xu_unpp; sock->proto = proto; sock->family = AF_UNIX; sock->protoname = protoname; if (xup->xu_unp.unp_addr != NULL) - sock->laddr = + laddr->address = *(struct sockaddr_storage *)(void *)&xup->xu_addr; else if (xup->xu_unp.unp_conn != NULL) - *(void **)&sock->faddr = xup->xu_unp.unp_conn; + *(void **)&(faddr->address) = xup->xu_unp.unp_conn; + laddr->next = NULL; + faddr->next = NULL; + sock->laddr = laddr; + sock->faddr = faddr; hash = (int)((uintptr_t)sock->socket % HASHSIZE); sock->next = sockhash[hash]; sockhash[hash] = sock; @@ -496,14 +755,14 @@ getfiles(void) } static int -printaddr(int af, struct sockaddr_storage *ss) +printaddr(struct sockaddr_storage *ss) { char addrstr[INET6_ADDRSTRLEN] = { '\0', '\0' }; struct sockaddr_un *sun; void *addr = NULL; /* Keep compiler happy. */ int off, port = 0; - switch (af) { + switch (ss->ss_family) { case AF_INET: addr = &((struct sockaddr_in *)ss)->sin_addr; if (inet_lnaof(*(struct in_addr *)addr) == INADDR_ANY) @@ -522,7 +781,7 @@ printaddr(int af, struct sockaddr_storag return (xprintf("%.*s", sun->sun_len - off, sun->sun_path)); } if (addrstr[0] == '\0') - inet_ntop(af, addr, addrstr, sizeof addrstr); + inet_ntop(ss->ss_family, addr, addrstr, sizeof addrstr); if (port == 0) return xprintf("%s:*", addrstr); else @@ -575,23 +834,28 @@ static int check_ports(struct sock *s) { int port; + struct addr *addr; if (ports == NULL) return (1); if ((s->family != AF_INET) && (s->family != AF_INET6)) return (1); - if (s->family == AF_INET) - port = ntohs(((struct sockaddr_in *)(&s->laddr))->sin_port); - else - port = ntohs(((struct sockaddr_in6 *)(&s->laddr))->sin6_port); - if (CHK_PORT(port)) - return (1); - if (s->family == AF_INET) - port = ntohs(((struct sockaddr_in *)(&s->faddr))->sin_port); - else - port = ntohs(((struct sockaddr_in6 *)(&s->faddr))->sin6_port); - if (CHK_PORT(port)) - return (1); + for (addr = s->laddr; addr != NULL; addr = addr->next) { + if (addr->address.ss_family == AF_INET) + port = ntohs(((struct sockaddr_in *)(&addr->address))->sin_port); + else + port = ntohs(((struct sockaddr_in6 *)(&addr->address))->sin6_port); + if (CHK_PORT(port)) + return (1); + } + for (addr = s->faddr; addr != NULL; addr = addr->next) { + if (addr->address.ss_family == AF_INET) + port = ntohs(((struct sockaddr_in *)&(addr->address))->sin_port); + else + port = ntohs(((struct sockaddr_in6 *)&(addr->address))->sin6_port); + if (CHK_PORT(port)) + return (1); + } return (0); } @@ -600,6 +864,7 @@ displaysock(struct sock *s, int pos) { void *p; int hash; + struct addr *laddr, *faddr; while (pos < 29) pos += xprintf(" "); @@ -608,45 +873,65 @@ displaysock(struct sock *s, int pos) pos += xprintf("4 "); if (s->vflag & INP_IPV6) pos += xprintf("6 "); - while (pos < 36) - pos += xprintf(" "); - switch (s->family) { - case AF_INET: - case AF_INET6: - pos += printaddr(s->family, &s->laddr); - if (s->family == AF_INET6 && pos >= 58) + laddr = s->laddr; + faddr = s->faddr; + while (laddr != NULL || faddr != NULL) { + while (pos < 36) pos += xprintf(" "); - while (pos < 58) - pos += xprintf(" "); - pos += printaddr(s->family, &s->faddr); - break; - case AF_UNIX: - /* server */ - if (s->laddr.ss_len > 0) { - pos += printaddr(s->family, &s->laddr); + switch (s->family) { + case AF_INET: + case AF_INET6: + if (laddr != NULL) { + pos += printaddr(&laddr->address); + if (s->family == AF_INET6 && pos >= 58) + pos += xprintf(" "); + } + while (pos < 58) + pos += xprintf(" "); + if (faddr != NULL) + pos += printaddr(&faddr->address); break; - } - /* client */ - p = *(void **)&s->faddr; - if (p == NULL) { - pos += xprintf("(not connected)"); + case AF_UNIX: + if ((laddr == NULL) || (faddr == NULL)) + errx(1, "laddr = %p or faddr = %p is NULL", + (void *)laddr, (void *)faddr); + /* server */ + if (laddr->address.ss_len > 0) { + pos += printaddr(&laddr->address); + break; + } + /* client */ + p = *(void **)&(faddr->address); + if (p == NULL) { + pos += xprintf("(not connected)"); + break; + } + pos += xprintf("-> "); + for (hash = 0; hash < HASHSIZE; ++hash) { + for (s = sockhash[hash]; s != NULL; s = s->next) + if (s->pcb == p) + break; + if (s != NULL) + break; + } + if (s == NULL || + s->laddr == NULL || + s->laddr->address.ss_len == 0) + pos += xprintf("??"); + else + pos += printaddr(&s->laddr->address); break; + default: + abort(); } - pos += xprintf("-> "); - for (hash = 0; hash < HASHSIZE; ++hash) { - for (s = sockhash[hash]; s != NULL; s = s->next) - if (s->pcb == p) - break; - if (s != NULL) - break; + if (laddr != NULL) + laddr = laddr->next; + if (faddr != NULL) + faddr = faddr->next; + if ((laddr != NULL) || (faddr != NULL)) { + xprintf("\n"); + pos = 0; } - if (s == NULL || s->laddr.ss_len == 0) - pos += xprintf("??"); - else - pos += printaddr(s->family, &s->laddr); - break; - default: - abort(); } xprintf("\n"); } @@ -669,29 +954,28 @@ display(void) if (opt_j >= 0 && opt_j != getprocjid(xf->xf_pid)) continue; hash = (int)((uintptr_t)xf->xf_data % HASHSIZE); - for (s = sockhash[hash]; s != NULL; s = s->next) - if ((void *)s->socket == xf->xf_data) - break; - if (s == NULL) - continue; - if (!check_ports(s)) - continue; - s->shown = 1; - pos = 0; - if ((pwd = getpwuid(xf->xf_uid)) == NULL) - pos += xprintf("%lu ", (u_long)xf->xf_uid); - else - pos += xprintf("%s ", pwd->pw_name); - while (pos < 9) - pos += xprintf(" "); - pos += xprintf("%.10s", getprocname(xf->xf_pid)); - while (pos < 20) - pos += xprintf(" "); - pos += xprintf("%lu ", (u_long)xf->xf_pid); - while (pos < 26) - pos += xprintf(" "); - pos += xprintf("%d ", xf->xf_fd); - displaysock(s, pos); + for (s = sockhash[hash]; s != NULL; s = s->next) { + if ((void *)s->socket != xf->xf_data) + continue; + if (!check_ports(s)) + continue; + s->shown = 1; + pos = 0; + if ((pwd = getpwuid(xf->xf_uid)) == NULL) + pos += xprintf("%lu ", (u_long)xf->xf_uid); + else + pos += xprintf("%s ", pwd->pw_name); + while (pos < 9) + pos += xprintf(" "); + pos += xprintf("%.10s", getprocname(xf->xf_pid)); + while (pos < 20) + pos += xprintf(" "); + pos += xprintf("%lu ", (u_long)xf->xf_pid); + while (pos < 26) + pos += xprintf(" "); + pos += xprintf("%d ", xf->xf_fd); + displaysock(s, pos); + } } if (opt_j >= 0) return; @@ -797,7 +1081,10 @@ main(int argc, char *argv[]) if (opt_4 || opt_6) { for (i = 0; i < protos_defined; i++) - gather_inet(protos[i]); + if (protos[i] == IPPROTO_SCTP) + gather_sctp(); + else + gather_inet(protos[i]); } if (opt_u || (protos_defined == -1 && !opt_4 && !opt_6)) { From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 12:10:57 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 140167D5; Tue, 16 Jun 2015 12:10:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00F9422B; Tue, 16 Jun 2015 12:10:57 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5GCAukZ033971; Tue, 16 Jun 2015 12:10:56 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5GCAukt033825; Tue, 16 Jun 2015 12:10:56 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201506161210.t5GCAukt033825@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 16 Jun 2015 12:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284444 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 12:10:57 -0000 Author: sbruno Date: Tue Jun 16 12:10:55 2015 New Revision: 284444 URL: https://svnweb.freebsd.org/changeset/base/284444 Log: MFC r283923 Simplify hang detection by stealing the techniques used in ixl(4) and applying them to em(4). Rely on iterations through the local timer, and the tx queue state to determine if an actual hang has occurred. Any time a descriptor is used (packet sent), the tx queue is flagged as busy. Then when txeof runs, it either clears the flag when all is clean, or resets it to 1 if ANY are cleaned, if nothing is cleaned it increments the flag. Local timer simply checks to see if busy ever reaches MAX (10, which is compile time configurable), and then sets it as HUNG, at that point there is one more timer cycle in which to have any cleans, if not a watchdog reset will occur. Modified: stable/10/sys/dev/e1000/if_em.c stable/10/sys/dev/e1000/if_em.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/if_em.c ============================================================================== --- stable/10/sys/dev/e1000/if_em.c Tue Jun 16 09:52:36 2015 (r284443) +++ stable/10/sys/dev/e1000/if_em.c Tue Jun 16 12:10:55 2015 (r284444) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2014, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -953,11 +953,9 @@ em_mq_start_locked(struct ifnet *ifp, st break; } - if (enq > 0) { - /* Set the watchdog */ - txr->queue_status = EM_QUEUE_WORKING; - txr->watchdog_time = ticks; - } + /* Mark the queue as having work */ + if ((enq > 0) && (txr->busy == EM_TX_IDLE)) + txr->busy = EM_TX_BUSY; if (txr->tx_avail < EM_MAX_SCATTER) em_txeof(txr); @@ -1042,12 +1040,12 @@ em_start_locked(struct ifnet *ifp, struc break; } + /* Mark the queue as having work */ + if (txr->busy == EM_TX_IDLE) + txr->busy = EM_TX_BUSY; + /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, m_head); - - /* Set timeout in case hardware has problems transmitting. */ - txr->watchdog_time = ticks; - txr->queue_status = EM_QUEUE_WORKING; } return; @@ -2114,8 +2112,6 @@ retry: */ tx_buffer = &txr->tx_buffers[first]; tx_buffer->next_eop = last; - /* Update the watchdog time early and often */ - txr->watchdog_time = ticks; /* * Advance the Transmit Descriptor Tail (TDT), this tells the E1000 @@ -2297,15 +2293,16 @@ em_local_timer(void *arg) ** and the HUNG state will be static if set. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { - if ((txr->queue_status == EM_QUEUE_HUNG) && - (adapter->pause_frames == 0)) + /* Last cycle a queue was declared hung */ + if (txr->busy == EM_TX_HUNG) goto hung; + if (txr->busy >= EM_TX_MAXTRIES) + txr->busy = EM_TX_HUNG; /* Schedule a TX tasklet if needed */ if (txr->tx_avail <= EM_MAX_SCATTER) taskqueue_enqueue(txr->tq, &txr->tx_task); } - adapter->pause_frames = 0; callout_reset(&adapter->timer, hz, em_local_timer, adapter); #ifndef DEVICE_POLLING /* Trigger an RX interrupt to guarantee mbuf refresh */ @@ -2324,7 +2321,6 @@ hung: txr->me, txr->tx_avail, txr->next_to_clean); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; adapter->watchdog_events++; - adapter->pause_frames = 0; em_init_locked(adapter); } @@ -2392,9 +2388,9 @@ em_update_link_status(struct adapter *ad if (bootverbose) device_printf(dev, "Link is Down\n"); adapter->link_active = 0; - /* Link down, disable watchdog */ + /* Link down, disable hang detection */ for (int i = 0; i < adapter->num_queues; i++, txr++) - txr->queue_status = EM_QUEUE_IDLE; + txr->busy = EM_TX_IDLE; if_link_state_change(ifp, LINK_STATE_DOWN); } } @@ -2426,10 +2422,10 @@ em_stop(void *arg) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ifp->if_drv_flags |= IFF_DRV_OACTIVE; - /* Unarm watchdog timer. */ + /* Disarm Hang Detection. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { EM_TX_LOCK(txr); - txr->queue_status = EM_QUEUE_IDLE; + txr->busy = EM_TX_IDLE; EM_TX_UNLOCK(txr); } @@ -3405,7 +3401,7 @@ em_setup_transmit_ring(struct tx_ring *t /* Set number of descriptors available */ txr->tx_avail = adapter->num_tx_desc; - txr->queue_status = EM_QUEUE_IDLE; + txr->busy = EM_TX_IDLE; /* Clear checksum offload context. */ txr->last_hw_offload = 0; @@ -3466,7 +3462,7 @@ em_initialize_transmit_unit(struct adapt E1000_READ_REG(&adapter->hw, E1000_TDBAL(i)), E1000_READ_REG(&adapter->hw, E1000_TDLEN(i))); - txr->queue_status = EM_QUEUE_IDLE; + txr->busy = EM_TX_IDLE; } /* Set the default values for the Tx Inter Packet Gap timer */ @@ -3849,9 +3845,9 @@ em_txeof(struct tx_ring *txr) return; #endif /* DEV_NETMAP */ - /* No work, make sure watchdog is off */ + /* No work, make sure hang detection is disabled */ if (txr->tx_avail == adapter->num_tx_desc) { - txr->queue_status = EM_QUEUE_IDLE; + txr->busy = EM_TX_IDLE; return; } @@ -3894,7 +3890,6 @@ em_txeof(struct tx_ring *txr) tx_buffer->m_head = NULL; } tx_buffer->next_eop = -1; - txr->watchdog_time = ticks; if (++first == adapter->num_tx_desc) first = 0; @@ -3919,14 +3914,16 @@ em_txeof(struct tx_ring *txr) txr->next_to_clean = first; /* - ** Watchdog calculation, we know there's - ** work outstanding or the first return - ** would have been taken, so none processed - ** for too long indicates a hang. local timer - ** will examine this and do a reset if needed. + ** Hang detection: we know there's work outstanding + ** or the entry return would have been taken, so no + ** descriptor processed here indicates a potential hang. + ** The local timer will examine this and do a reset if needed. */ - if ((!processed) && ((ticks - txr->watchdog_time) > EM_WATCHDOG)) - txr->queue_status = EM_QUEUE_HUNG; + if (processed == 0) { + if (txr->busy != EM_TX_HUNG) + ++txr->busy; + } else /* At least one descriptor was cleaned */ + txr->busy = EM_TX_BUSY; /* note this clears HUNG */ /* * If we have a minimum free, clear IFF_DRV_OACTIVE @@ -3938,10 +3935,9 @@ em_txeof(struct tx_ring *txr) if (txr->tx_avail >= EM_MAX_SCATTER) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - /* Disable watchdog if all clean */ - if (txr->tx_avail == adapter->num_tx_desc) { - txr->queue_status = EM_QUEUE_IDLE; - } + /* Disable hang detection if all clean */ + if (txr->tx_avail == adapter->num_tx_desc) + txr->busy = EM_TX_IDLE; } @@ -5176,12 +5172,7 @@ em_update_stats_counters(struct adapter adapter->stats.rlec += E1000_READ_REG(&adapter->hw, E1000_RLEC); adapter->stats.xonrxc += E1000_READ_REG(&adapter->hw, E1000_XONRXC); adapter->stats.xontxc += E1000_READ_REG(&adapter->hw, E1000_XONTXC); - /* - ** For watchdog management we need to know if we have been - ** paused during the last interval, so capture that here. - */ - adapter->pause_frames = E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); - adapter->stats.xoffrxc += adapter->pause_frames; + adapter->stats.xoffrxc += E1000_READ_REG(&adapter->hw, E1000_XOFFRXC); adapter->stats.xofftxc += E1000_READ_REG(&adapter->hw, E1000_XOFFTXC); adapter->stats.fcruc += E1000_READ_REG(&adapter->hw, E1000_FCRUC); adapter->stats.prc64 += E1000_READ_REG(&adapter->hw, E1000_PRC64); @@ -5798,7 +5789,7 @@ em_print_debug_info(struct adapter *adap device_printf(dev, "hw rdh = %d, hw rdt = %d\n", E1000_READ_REG(&adapter->hw, E1000_RDH(0)), E1000_READ_REG(&adapter->hw, E1000_RDT(0))); - device_printf(dev, "Tx Queue Status = %d\n", txr->queue_status); + device_printf(dev, "Tx Queue Status = %d\n", txr->busy); device_printf(dev, "TX descriptors avail = %d\n", txr->tx_avail); device_printf(dev, "Tx Descriptors avail failure = %ld\n", Modified: stable/10/sys/dev/e1000/if_em.h ============================================================================== --- stable/10/sys/dev/e1000/if_em.h Tue Jun 16 09:52:36 2015 (r284443) +++ stable/10/sys/dev/e1000/if_em.h Tue Jun 16 12:10:55 2015 (r284444) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -188,9 +188,19 @@ #define EM_EEPROM_APME 0x400; #define EM_82544_APME 0x0004; -#define EM_QUEUE_IDLE 0 -#define EM_QUEUE_WORKING 1 -#define EM_QUEUE_HUNG 2 +/* + * Driver state logic for the detection of a hung state + * in hardware. Set TX_HUNG whenever a TX packet is used + * (data is sent) and clear it when txeof() is invoked if + * any descriptors from the ring are cleaned/reclaimed. + * Increment internal counter if no descriptors are cleaned + * and compare to TX_MAXTRIES. When counter > TX_MAXTRIES, + * reset adapter. + */ +#define EM_TX_IDLE 0x00000000 +#define EM_TX_BUSY 0x00000001 +#define EM_TX_HUNG 0x80000000 +#define EM_TX_MAXTRIES 10 /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be @@ -281,8 +291,7 @@ struct tx_ring { u32 me; u32 msix; u32 ims; - int queue_status; - int watchdog_time; + int busy; struct em_dma_alloc txdma; struct e1000_tx_desc *tx_base; struct task tx_task; @@ -368,7 +377,6 @@ struct adapter { int if_flags; int max_frame_size; int min_frame_size; - int pause_frames; struct mtx core_mtx; int em_insert_vlan_header; u32 ims; From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 18:39:12 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1DEE1639; Tue, 16 Jun 2015 18:39:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B6FCFB9; Tue, 16 Jun 2015 18:39:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5GIdBhN026091; Tue, 16 Jun 2015 18:39:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5GIdBYd026090; Tue, 16 Jun 2015 18:39:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201506161839.t5GIdBYd026090@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 16 Jun 2015 18:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284455 - stable/10/sys/sparc64/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 18:39:12 -0000 Author: emaste Date: Tue Jun 16 18:39:11 2015 New Revision: 284455 URL: https://svnweb.freebsd.org/changeset/base/284455 Log: MFC r281930 by jhb: Update this driver to not save copies of registers that are no longer used after r281874. While here, also update it to always write the parent's PCI bus number to the primary bus register. Modified: stable/10/sys/sparc64/pci/apb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sparc64/pci/apb.c ============================================================================== --- stable/10/sys/sparc64/pci/apb.c Tue Jun 16 17:55:20 2015 (r284454) +++ stable/10/sys/sparc64/pci/apb.c Tue Jun 16 18:39:11 2015 (r284455) @@ -171,20 +171,14 @@ apb_attach(device_t dev) * Get current bridge configuration. */ sc->sc_bsc.ops_pcib_sc.domain = pci_get_domain(dev); - sc->sc_bsc.ops_pcib_sc.secstat = - pci_read_config(dev, PCIR_SECSTAT_1, 2); - sc->sc_bsc.ops_pcib_sc.command = - pci_read_config(dev, PCIR_COMMAND, 2); - sc->sc_bsc.ops_pcib_sc.pribus = - pci_read_config(dev, PCIR_PRIBUS_1, 1); + sc->sc_bsc.ops_pcib_sc.pribus = pci_get_bus(dev); + pci_write_config(dev, PCIR_PRIBUS_1, sc->sc_bsc.ops_pcib_sc.pribus, 1); sc->sc_bsc.ops_pcib_sc.bus.sec = pci_read_config(dev, PCIR_SECBUS_1, 1); sc->sc_bsc.ops_pcib_sc.bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1); sc->sc_bsc.ops_pcib_sc.bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2); - sc->sc_bsc.ops_pcib_sc.seclat = - pci_read_config(dev, PCIR_SECLAT_1, 1); sc->sc_iomap = pci_read_config(dev, APBR_IOMAP, 1); sc->sc_memmap = pci_read_config(dev, APBR_MEMMAP, 1); From owner-svn-src-stable-10@FreeBSD.ORG Tue Jun 16 20:00:56 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35B6C7AA; Tue, 16 Jun 2015 20:00:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FD10843; Tue, 16 Jun 2015 20:00:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5GK0tpj068178; Tue, 16 Jun 2015 20:00:55 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5GK0rrd068167; Tue, 16 Jun 2015 20:00:53 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201506162000.t5GK0rrd068167@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 16 Jun 2015 20:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284460 - in stable/10: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2015 20:00:56 -0000 Author: jkim Date: Tue Jun 16 20:00:53 2015 New Revision: 284460 URL: https://svnweb.freebsd.org/changeset/base/284460 Log: MFC: r283092, r283966 Merge ACPICA 20150515. Relnotes: yes Added: stable/10/sys/contrib/dev/acpica/common/ahtable.c - copied unchanged from r283092, head/sys/contrib/dev/acpica/common/ahtable.c stable/10/sys/contrib/dev/acpica/include/acuuid.h - copied, changed from r283092, head/sys/contrib/dev/acpica/include/acuuid.h Modified: stable/10/sys/contrib/dev/acpica/changes.txt stable/10/sys/contrib/dev/acpica/common/adisasm.c stable/10/sys/contrib/dev/acpica/common/ahpredef.c stable/10/sys/contrib/dev/acpica/common/ahuuids.c stable/10/sys/contrib/dev/acpica/common/dmextern.c stable/10/sys/contrib/dev/acpica/common/dmtable.c stable/10/sys/contrib/dev/acpica/common/dmtbdump.c stable/10/sys/contrib/dev/acpica/common/dmtbinfo.c stable/10/sys/contrib/dev/acpica/compiler/aslascii.c stable/10/sys/contrib/dev/acpica/compiler/aslcompiler.h stable/10/sys/contrib/dev/acpica/compiler/aslcompiler.l stable/10/sys/contrib/dev/acpica/compiler/asldefine.h stable/10/sys/contrib/dev/acpica/compiler/aslfiles.c stable/10/sys/contrib/dev/acpica/compiler/aslmessages.c stable/10/sys/contrib/dev/acpica/compiler/aslmessages.h stable/10/sys/contrib/dev/acpica/compiler/aslprepkg.c stable/10/sys/contrib/dev/acpica/compiler/aslstartup.c stable/10/sys/contrib/dev/acpica/compiler/aslutils.c stable/10/sys/contrib/dev/acpica/compiler/dtcompile.c stable/10/sys/contrib/dev/acpica/compiler/dtcompiler.h stable/10/sys/contrib/dev/acpica/compiler/dtio.c stable/10/sys/contrib/dev/acpica/compiler/dtsubtable.c stable/10/sys/contrib/dev/acpica/compiler/dttable.c stable/10/sys/contrib/dev/acpica/compiler/dttemplate.c stable/10/sys/contrib/dev/acpica/compiler/dttemplate.h stable/10/sys/contrib/dev/acpica/compiler/dtutils.c stable/10/sys/contrib/dev/acpica/compiler/preprocess.h stable/10/sys/contrib/dev/acpica/compiler/prscan.c stable/10/sys/contrib/dev/acpica/compiler/prutils.c stable/10/sys/contrib/dev/acpica/components/debugger/dbfileio.c stable/10/sys/contrib/dev/acpica/components/debugger/dbinput.c stable/10/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c stable/10/sys/contrib/dev/acpica/components/hardware/hwpci.c stable/10/sys/contrib/dev/acpica/components/namespace/nsprepkg.c stable/10/sys/contrib/dev/acpica/components/namespace/nsrepair.c stable/10/sys/contrib/dev/acpica/components/parser/psopinfo.c stable/10/sys/contrib/dev/acpica/components/utilities/utfileio.c stable/10/sys/contrib/dev/acpica/components/utilities/uthex.c stable/10/sys/contrib/dev/acpica/components/utilities/utxferror.c stable/10/sys/contrib/dev/acpica/include/acdebug.h stable/10/sys/contrib/dev/acpica/include/acdisasm.h stable/10/sys/contrib/dev/acpica/include/aclocal.h stable/10/sys/contrib/dev/acpica/include/acparser.h stable/10/sys/contrib/dev/acpica/include/acpixf.h stable/10/sys/contrib/dev/acpica/include/acpredef.h stable/10/sys/contrib/dev/acpica/include/actbl.h stable/10/sys/contrib/dev/acpica/include/actbl1.h stable/10/sys/contrib/dev/acpica/include/actbl2.h stable/10/sys/contrib/dev/acpica/include/actbl3.h stable/10/sys/contrib/dev/acpica/include/actypes.h stable/10/sys/contrib/dev/acpica/include/acutils.h stable/10/sys/contrib/dev/acpica/include/platform/acenv.h stable/10/sys/contrib/dev/acpica/include/platform/acenvex.h stable/10/usr.sbin/acpi/acpidb/acpidb.c stable/10/usr.sbin/acpi/iasl/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/dev/acpica/changes.txt ============================================================================== --- stable/10/sys/contrib/dev/acpica/changes.txt Tue Jun 16 19:49:12 2015 (r284459) +++ stable/10/sys/contrib/dev/acpica/changes.txt Tue Jun 16 20:00:53 2015 (r284460) @@ -1,4 +1,52 @@ ---------------------------------------- +08 April 2015. Summary of changes for version 20150515: + +This release implements most of ACPI 6.0 as described below. + +1) ACPICA kernel-resident subsystem: + +Implemented runtime argument checking and return value checking for all +new ACPI 6.0 predefined names. This includes: _BTH, _CR3, _DSD, _LPI, +_MTL, _PRR, _RDI, _RST, _TFP, _TSN. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 99.9K Code, 27.5K Data, 127.4K Total + Debug Version: 195.2K Code, 80.8K Data, 276.0K Total + Previous Release: + Non-Debug Version: 99.1K Code, 27.3K Data, 126.4K Total + Debug Version: 192.8K Code, 79.9K Data, 272.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL compiler: Added compile-time support for all new ACPI 6.0 predefined +names (argument count validation and return value typechecking.) + +iASL disassembler and table compiler: implemented support for all new +ACPI 6.0 tables. This includes: DRTM, IORT, LPIT, NFIT, STAO, WPBT, XENV. + +iASL disassembler and table compiler: Added ACPI 6.0 changes to existing +tables: FADT, MADT. + +iASL preprocessor: Added a new directive to enable inclusion of binary +blobs into ASL code. The new directive is #includebinary. It takes a +binary file as input and emits a named ascii buffer object into the ASL +code. + +AcpiHelp: Added support for all new ACPI 6.0 predefined names. + +AcpiHelp: Added a new option, -d, to display all iASL preprocessor +directives. + +AcpiHelp: Added a new option, -t, to display all known/supported ACPI +tables. + +---------------------------------------- 10 April 2015. Summary of changes for version 20150410: Reverted a change introduced in version 20150408 that caused Modified: stable/10/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- stable/10/sys/contrib/dev/acpica/common/adisasm.c Tue Jun 16 19:49:12 2015 (r284459) +++ stable/10/sys/contrib/dev/acpica/common/adisasm.c Tue Jun 16 20:00:53 2015 (r284460) @@ -214,6 +214,7 @@ AdAmlDisassemble ( char **OutFilename) { ACPI_STATUS Status; + ACPI_STATUS GlobalStatus = AE_OK; char *DisasmFilename = NULL; char *ExternalFilename; ACPI_EXTERNAL_FILE *ExternalFileList = AcpiGbl_ExternalFileList; @@ -229,7 +230,7 @@ AdAmlDisassemble ( */ if (Filename) { - Status = AcpiDbGetTableFromFile (Filename, &Table); + Status = AcpiDbGetTableFromFile (Filename, &Table, FALSE); if (ACPI_FAILURE (Status)) { return (Status); @@ -250,9 +251,16 @@ AdAmlDisassemble ( continue; } - Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable); + Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable, TRUE); if (ACPI_FAILURE (Status)) { + if (Status == AE_TYPE) + { + ExternalFileList = ExternalFileList->Next; + GlobalStatus = AE_TYPE; + Status = AE_OK; + continue; + } return (Status); } @@ -282,6 +290,11 @@ AdAmlDisassemble ( ExternalFileList = ExternalFileList->Next; } + if (ACPI_FAILURE (GlobalStatus)) + { + return (GlobalStatus); + } + /* Clear external list generated by Scope in external tables */ if (AcpiGbl_ExternalFileList) Modified: stable/10/sys/contrib/dev/acpica/common/ahpredef.c ============================================================================== --- stable/10/sys/contrib/dev/acpica/common/ahpredef.c Tue Jun 16 19:49:12 2015 (r284459) +++ stable/10/sys/contrib/dev/acpica/common/ahpredef.c Tue Jun 16 20:00:53 2015 (r284460) @@ -94,6 +94,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"), AH_PREDEF ("_BQC", "Brightness Query Current", "Returns the current display brightness level"), AH_PREDEF ("_BST", "Battery Status", "Returns a Control Method Battery status block"), + AH_PREDEF ("_BTH", "Battery Throttle Limit", "Thermal limit for charging and discharging"), AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), @@ -102,6 +103,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), AH_PREDEF ("_CLS", "Class Code", "Returns PCI class code and subclass"), AH_PREDEF ("_CPC", "Continuous Performance Control", "Returns a list of performance control interfaces"), + AH_PREDEF ("_CR3", "Warm/Standby Temperature", "Temperature for a fast low power state"), AH_PREDEF ("_CRS", "Current Resource Settings", "Returns the current resource settings for a device"), AH_PREDEF ("_CRT", "Critical Temperature", "Returns the shutdown critical temperature"), AH_PREDEF ("_CSD", "C-State Dependencies", "Returns a list of C-state dependencies"), @@ -175,6 +177,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"), AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), AH_PREDEF ("_LPD", "Low Power Dependencies", "Returns a list of dependencies for low power idle entry"), + AH_PREDEF ("_LPI", "Low Power Idle States", "Returns a list of supported low power idle states"), AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), @@ -186,6 +189,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_MOD", "Mode", "Interrupt mode, Resource Descriptor field"), AH_PREDEF ("_MSG", "Message", "Sets the system message waiting status indicator"), AH_PREDEF ("_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"), + AH_PREDEF ("_MTL", "Minimum Throttle Limit", "Returns the minimum throttle limit for a thermal zone"), AH_PREDEF ("_MTP", "Memory Type", "Resource Descriptor field"), AH_PREDEF ("_NTT", "Notification Temperature Threshold", "Returns a threshold for device temperature change that requires platform notification"), AH_PREDEF ("_OFF", "Power Off", "Sets a power resource to the off state"), @@ -209,7 +213,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"), AH_PREDEF ("_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"), AH_PREDEF ("_POL", "Polarity", "Interrupt polarity, Resource Descriptor field"), - AH_PREDEF ("_PPC", "Performance Present Capabilites", "Returns a list of the performance states currently supported by the platform"), + AH_PREDEF ("_PPC", "Performance Present Capabilities", "Returns a list of the performance states currently supported by the platform"), AH_PREDEF ("_PPE", "Polling for Platform Error", "Returns the polling interval to retrieve Corrected Platform Error information"), AH_PREDEF ("_PPI", "Pin Configuration", "Resource Descriptor field"), AH_PREDEF ("_PR", "Processor", "Predefined scope for processor objects"), @@ -219,6 +223,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_PR3", "Power Resources for D3hot", "Returns a list of dependent power resources to enter state D3hot"), AH_PREDEF ("_PRE", "Power Resources for Enumeration", "Returns a list of dependent power resources to enumerate devices on a bus"), AH_PREDEF ("_PRL", "Power Source Redundancy List", "Returns a list of power source devices in the same redundancy grouping"), + AH_PREDEF ("_PRR", "Power Resource for Reset", "Execute a reset on a device"), AH_PREDEF ("_PRS", "Possible Resource Settings", "Returns a list of a device's possible resource settings"), AH_PREDEF ("_PRT", "PCI Routing Table", "Returns a list of PCI interrupt mappings"), AH_PREDEF ("_PRW", "Power Resources for Wake", "Returns a list of dependent power resources for waking"), @@ -242,10 +247,12 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_Qxx", "EC Query", "Embedded Controller query and SMBus Alarm control method"), AH_PREDEF ("_RBO", "Register Bit Offset", "Resource Descriptor field"), AH_PREDEF ("_RBW", "Register Bit Width", "Resource Descriptor field"), + AH_PREDEF ("_RDI", "Resource Dependencies for Idle", "Returns a list of dependencies for idle states"), AH_PREDEF ("_REG", "Region Availability", "Inform AML code of an operation region availability change"), AH_PREDEF ("_REV", "Supported ACPI Revision", "Returns the revision of the ACPI specification that is implemented"), AH_PREDEF ("_RMV", "Removal Status", "Returns a device's removal ability status (docking)"), AH_PREDEF ("_RNG", "Range", "Memory range type, Resource Descriptor field"), + AH_PREDEF ("_RST", "Device Reset", "Executes a reset on a device"), AH_PREDEF ("_ROM", "Read-Only Memory", "Returns a copy of the ROM data for a display device"), AH_PREDEF ("_RT_", "Resource Type", "Resource Descriptor field"), AH_PREDEF ("_RTV", "Relative Temperature Values", "Returns temperature value information"), @@ -296,6 +303,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_TC1", "Thermal Constant 1", "Returns TC1 for the passive cooling formula"), AH_PREDEF ("_TC2", "Thermal Constant 2", "Returns TC2 for the passive cooling formula"), AH_PREDEF ("_TDL", "T-State Depth Limit", "Returns the _TSS entry number of the lowest power throttling state"), + AH_PREDEF ("_TFP", "Thermal Fast Sampling Period", "Returns the sampling period for passive cooling"), AH_PREDEF ("_TIP", "Expired Timer Wake Policy", "Returns timer policies of the wake alarm device"), AH_PREDEF ("_TIV", "Timer Values", "Returns remaining time of the wake alarm device"), AH_PREDEF ("_TMP", "Temperature", "Returns a thermal zone's current temperature"), @@ -306,6 +314,7 @@ const AH_PREDEFINED_NAME AslPredefine AH_PREDEF ("_TRT", "Thermal Relationship Table", "Returns thermal relationships between platform devices"), AH_PREDEF ("_TSD", "Throttling State Dependencies", "Returns a list of T-state dependencies"), AH_PREDEF ("_TSF", "Type-Specific Flags", "Resource Descriptor field"), + AH_PREDEF ("_TSN", "Thermal Sensor Device", "Returns a reference to a thermal sensor"), AH_PREDEF ("_TSP", "Thermal Sampling Period", "Returns the thermal sampling period for passive cooling"), AH_PREDEF ("_TSS", "Throttling Supported States", "Returns supported throttling state information"), AH_PREDEF ("_TST", "Temperature Sensor Threshold", "Returns the minimum separation for a device's temperature trip points"), Copied: stable/10/sys/contrib/dev/acpica/common/ahtable.c (from r283092, head/sys/contrib/dev/acpica/common/ahtable.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/contrib/dev/acpica/common/ahtable.c Tue Jun 16 20:00:53 2015 (r284460, copy of r283092, head/sys/contrib/dev/acpica/common/ahtable.c) @@ -0,0 +1,150 @@ +/****************************************************************************** + * + * Module Name: ahtable - Table of known ACPI tables with descriptions + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include +#include + + +/* Local prototypes */ + +const AH_TABLE * +AcpiAhGetTableInfo ( + char *Signature); + +extern const AH_TABLE AcpiSupportedTables[]; + + +/******************************************************************************* + * + * FUNCTION: AcpiAhGetTableInfo + * + * PARAMETERS: Signature - ACPI signature (4 chars) to match + * + * RETURN: Pointer to a valid AH_TABLE. Null if no match found. + * + * DESCRIPTION: Find a match in the "help" table of supported ACPI tables + * + ******************************************************************************/ + +const AH_TABLE * +AcpiAhGetTableInfo ( + char *Signature) +{ + const AH_TABLE *Info; + + + for (Info = AcpiSupportedTables; Info->Signature; Info++) + { + if (ACPI_COMPARE_NAME (Signature, Info->Signature)) + { + return (Info); + } + } + + return (NULL); +} + + +/* + * Note: Any tables added here should be duplicated within AcpiDmTableData + * in the file common/dmtable.c + */ +const AH_TABLE AcpiSupportedTables[] = +{ + {ACPI_SIG_ASF, "Alert Standard Format table"}, + {ACPI_SIG_BERT, "Boot Error Record Table"}, + {ACPI_SIG_BGRT, "Boot Graphics Resource Table"}, + {ACPI_SIG_BOOT, "Simple Boot Flag Table"}, + {ACPI_SIG_CPEP, "Corrected Platform Error Polling table"}, + {ACPI_SIG_CSRT, "Core System Resource Table"}, + {ACPI_SIG_DBG2, "Debug Port table type 2"}, + {ACPI_SIG_DBGP, "Debug Port table"}, + {ACPI_SIG_DMAR, "DMA Remapping table"}, + {ACPI_SIG_DRTM, "Dynamic Root of Trust for Measurement table"}, + {ACPI_SIG_DSDT, "Differentiated System Description Table (AML table)"}, + {ACPI_SIG_ECDT, "Embedded Controller Boot Resources Table"}, + {ACPI_SIG_EINJ, "Error Injection table"}, + {ACPI_SIG_ERST, "Error Record Serialization Table"}, + {ACPI_SIG_FACS, "Firmware ACPI Control Structure"}, + {ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)"}, + {ACPI_SIG_FPDT, "Firmware Performance Data Table"}, + {ACPI_SIG_GTDT, "Generic Timer Description Table"}, + {ACPI_SIG_HEST, "Hardware Error Source Table"}, + {ACPI_SIG_HPET, "High Precision Event Timer table"}, + {ACPI_SIG_IORT, "IO Remapping Table"}, + {ACPI_SIG_IVRS, "I/O Virtualization Reporting Structure"}, + {ACPI_SIG_LPIT, "Low Power Idle Table"}, + {ACPI_SIG_MADT, "Multiple APIC Description Table (MADT)"}, + {ACPI_SIG_MCFG, "Memory Mapped Configuration table"}, + {ACPI_SIG_MCHI, "Management Controller Host Interface table"}, + {ACPI_SIG_MPST, "Memory Power State Table"}, + {ACPI_SIG_MSCT, "Maximum System Characteristics Table"}, + {ACPI_SIG_MSDM, "Microsoft Data Management table"}, + {ACPI_SIG_MTMR, "MID Timer Table"}, + {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, + {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, + {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, + {ACPI_RSDP_NAME,"Root System Description Pointer"}, + {ACPI_SIG_RSDT, "Root System Description Table"}, + {ACPI_SIG_S3PT, "S3 Performance Table"}, + {ACPI_SIG_SBST, "Smart Battery Specification Table"}, + {ACPI_SIG_SLIC, "Software Licensing Description Table"}, + {ACPI_SIG_SLIT, "System Locality Information Table"}, + {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, + {ACPI_SIG_SPMI, "Server Platform Management Interface table"}, + {ACPI_SIG_SRAT, "System Resource Affinity Table"}, + {ACPI_SIG_SSDT, "Secondary System Description Table (AML table)"}, + {ACPI_SIG_STAO, "Status Override table"}, + {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance table"}, + {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface table"}, + {ACPI_SIG_UEFI, "UEFI Boot Optimization Table"}, + {ACPI_SIG_VRTC, "Virtual Real-Time Clock Table"}, + {ACPI_SIG_WAET, "Windows ACPI Emulated Devices Table"}, + {ACPI_SIG_WDAT, "Watchdog Action Table"}, + {ACPI_SIG_WDDT, "Watchdog Description Table"}, + {ACPI_SIG_WDRT, "Watchdog Resource Table"}, + {ACPI_SIG_WPBT, "Windows Platform Binary Table"}, + {ACPI_SIG_XENV, "Xen Environment table"}, + {ACPI_SIG_XSDT, "Extended System Description Table"}, + {NULL, NULL} +}; Modified: stable/10/sys/contrib/dev/acpica/common/ahuuids.c ============================================================================== --- stable/10/sys/contrib/dev/acpica/common/ahuuids.c Tue Jun 16 19:49:12 2015 (r284459) +++ stable/10/sys/contrib/dev/acpica/common/ahuuids.c Tue Jun 16 20:00:53 2015 (r284460) @@ -43,6 +43,7 @@ #include #include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("ahuuids") @@ -52,44 +53,36 @@ */ const AH_UUID AcpiUuids[] = { - {"PCI Host Bridge Device", - "33db4d5b-1ff7-401c-9657-7441c03dd766"}, - - {"Platform-wide Capabilities", - "0811b06e-4a27-44f9-8d60-3cbbc22e7b48"}, - - {"Dynamic Enumeration", - "d8c1a3a6-be9b-4c9b-91bf-c3cb81fc5daf"}, - - {"GPIO Controller", - "4f248f40-d5e2-499f-834c-27758ea1cd3f"}, - - {"Battery Thermal Limit", - "4c2067e3-887d-475c-9720-4af1d3ed602e"}, - - {"Thermal Extensions", - "14d399cd-7a27-4b18-8fb4-7cb7b9f4e500"}, - - {"USB Controller", - "ce2ee385-00e6-48cb-9f05-2edb927c4899"}, - - {"HID I2C Device", - "3cdff6f7-4267-4555-ad05-b30a3d8938de"}, - - {"Power Button Device", - "dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c"}, - - {"Device Labeling Interface", - "e5c937d0-3553-4d7a-9117-ea4d19c3434d"}, - - {"SATA Controller", - "e4db149b-fcfe-425b-a6d8-92357d78fc7f"}, - - {"Physical Presence Interface", - "3dddfaa6-361b-4eb4-a424-8d10089d1653"}, - - {"Device Properties for _DSD", - "daffd814-6eba-4d8c-8a91-bc9bbf4aa301"}, + {"[Controllers]", NULL}, + {"GPIO Controller", UUID_GPIO_CONTROLLER}, + {"USB Controller", UUID_USB_CONTROLLER}, + {"SATA Controller", UUID_SATA_CONTROLLER}, + + {"[Devices]", NULL}, + {"PCI Host Bridge Device", UUID_PCI_HOST_BRIDGE}, + {"HID I2C Device", UUID_I2C_DEVICE}, + {"Power Button Device", UUID_POWER_BUTTON}, + + {"[Interfaces]", NULL}, + {"Device Labeling Interface", UUID_DEVICE_LABELING}, + {"Physical Presence Interface", UUID_PHYSICAL_PRESENCE}, + + {"[Non-volatile DIMM and NFIT table]", NULL}, + {"Volatile Memory Region", UUID_VOLATILE_MEMORY}, + {"Persistent Memory Region", UUID_PERSISTENT_MEMORY}, + {"NVDIMM Control Region", UUID_CONTROL_REGION}, + {"NVDIMM Data Region", UUID_DATA_REGION}, + {"Volatile Virtual Disk", UUID_VOLATILE_VIRTUAL_DISK}, + {"Volatile Virtual CD", UUID_VOLATILE_VIRTUAL_CD}, + {"Persistent Virtual Disk", UUID_PERSISTENT_VIRTUAL_DISK}, + {"Persistent Virtual CD", UUID_PERSISTENT_VIRTUAL_CD}, + + {"[Miscellaneous]", NULL}, + {"Platform-wide Capabilities", UUID_PLATFORM_CAPABILITIES}, + {"Dynamic Enumeration", UUID_DYNAMIC_ENUMERATION}, + {"Battery Thermal Limit", UUID_BATTERY_THERMAL_LIMIT}, + {"Thermal Extensions", UUID_THERMAL_EXTENSIONS}, + {"Device Properties for _DSD", UUID_DEVICE_PROPERTIES}, {NULL, NULL} }; @@ -120,6 +113,13 @@ AcpiAhMatchUuid ( for (Info = AcpiUuids; Info->Description; Info++) { + /* Null string means desciption is a UUID class */ + + if (!Info->String) + { + continue; + } + AcpiUtConvertStringToUuid (Info->String, UuidBuffer); if (!ACPI_MEMCMP (Data, UuidBuffer, UUID_BUFFER_LENGTH)) Modified: stable/10/sys/contrib/dev/acpica/common/dmextern.c ============================================================================== --- stable/10/sys/contrib/dev/acpica/common/dmextern.c Tue Jun 16 19:49:12 2015 (r284459) +++ stable/10/sys/contrib/dev/acpica/common/dmextern.c Tue Jun 16 20:00:53 2015 (r284460) @@ -1286,7 +1286,9 @@ AcpiDmUnresolvedWarning ( " * compile because the disassembler did not know how many arguments\n" " * to assign to these methods. To specify the tables needed to resolve\n" " * external control method references, the -e option can be used to\n" - " * specify the filenames. Example iASL invocations:\n" + " * specify the filenames. Note: SSDTs can be dynamically loaded at\n" + " * runtime and may or may not be available via the host OS.\n" + " * Example iASL invocations:\n" " * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" " * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" " * iasl -e ssdt*.aml -d dsdt.aml\n" @@ -1314,7 +1316,8 @@ AcpiDmUnresolvedWarning ( " * ACPI tables may be required to properly disassemble the code. This\n" " * resulting disassembler output file may not compile because the\n" " * disassembler did not know how many arguments to assign to the\n" - " * unresolved methods.\n" + " * unresolved methods. Note: SSDTs can be dynamically loaded at\n" + " * runtime and may or may not be available via the host OS.\n" " *\n" " * If necessary, the -fe option can be used to specify a file containing\n" " * control method external declarations with the associated method\n" @@ -1345,7 +1348,9 @@ AcpiDmUnresolvedWarning ( "compile because the disassembler did not know how many arguments\n" "to assign to these methods. To specify the tables needed to resolve\n" "external control method references, the -e option can be used to\n" - "specify the filenames. Example iASL invocations:\n" + "specify the filenames. Note: SSDTs can be dynamically loaded at\n" + "runtime and may or may not be available via the host OS.\n" + "Example iASL invocations:\n" " iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" " iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" " iasl -e ssdt*.aml -d dsdt.aml\n" @@ -1368,7 +1373,8 @@ AcpiDmUnresolvedWarning ( "ACPI tables may be required to properly disassemble the code. The\n" "resulting disassembler output file may not compile because the\n" "disassembler did not know how many arguments to assign to the\n" - "unresolved methods.\n" + "unresolved methods. Note: SSDTs can be dynamically loaded at\n" + "runtime and may or may not be available via the host OS.\n" "\n" "If necessary, the -fe option can be used to specify a file containing\n" "control method external declarations with the associated method\n" Modified: stable/10/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- stable/10/sys/contrib/dev/acpica/common/dmtable.c Tue Jun 16 19:49:12 2015 (r284459) +++ stable/10/sys/contrib/dev/acpica/common/dmtable.c Tue Jun 16 20:00:53 2015 (r284460) @@ -53,6 +53,11 @@ #define _COMPONENT ACPI_CA_DISASSEMBLER ACPI_MODULE_NAME ("dmtable") +const AH_TABLE * +AcpiAhGetTableInfo ( + char *Signature); + + /* Local Prototypes */ static void @@ -78,7 +83,7 @@ static const char *AcpiDmAsfSu "ASF Remote Control", "ASF RMCP Boot Options", "ASF Address", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmDmarSubnames[] = @@ -88,7 +93,7 @@ static const char *AcpiDmDmarS "Root Port ATS Capability", "Remapping Hardware Static Affinity", "ACPI Namespace Device Declaration", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmDmarScope[] = @@ -176,7 +181,7 @@ static const char *AcpiDmGtdtS { "Generic Timer Block", "Generic Watchdog Timer", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmHestSubnames[] = @@ -191,7 +196,7 @@ static const char *AcpiDmHestS "PCI Express AER (AER Endpoint)", "PCI Express/PCI-X Bridge AER", "Generic Hardware Error Source", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmHestNotifySubnames[] = @@ -223,14 +228,27 @@ static const char *AcpiDmMadtS "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */ "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */ "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */ - "Unknown SubTable Type" /* Reserved */ + "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */ + "Unknown Subtable Type" /* Reserved */ +}; + +static const char *AcpiDmNfitSubnames[] = +{ + "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */ + "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */ + "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */ + "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */ + "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */ + "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */ + "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmPcctSubnames[] = { "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */ - "HW-Reduced Communications Subspace", - "Unknown SubTable Type" /* Reserved */ + "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmPmttSubnames[] = @@ -238,7 +256,7 @@ static const char *AcpiDmPmttS "Socket", /* ACPI_PMTT_TYPE_SOCKET */ "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmSratSubnames[] = @@ -247,21 +265,20 @@ static const char *AcpiDmSratS "Memory Affinity", "Processor Local x2APIC Affinity", "GICC Affinity", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmIvrsSubnames[] = { "Hardware Definition Block", "Memory Definition Block", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmLpitSubnames[] = { "Native C-state Idle Structure", - "Simple I/O Idle Structure", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; #define ACPI_FADT_PM_RESERVED 9 @@ -304,56 +321,65 @@ static const char *AcpiDmGasAc * handler. This table must be NULL terminated. RSDP and FACS are * special-cased elsewhere. * + * Note: Any tables added here should be duplicated within AcpiSupportedTables + * in the file common/ahtable.c + * ******************************************************************************/ -ACPI_DMTABLE_DATA AcpiDmTableData[] = +const ACPI_DMTABLE_DATA AcpiDmTableData[] = { - {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"}, - {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"}, - {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"}, - {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, - {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, - {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"}, - {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2, "Debug Port table type 2"}, - {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"}, - {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"}, - {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"}, - {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"}, - {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"}, - {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"}, - {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"}, - {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt, "Generic Timer Description Table"}, - {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"}, - {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"}, - {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"}, - {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit, "Low Power Idle Table"}, - {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"}, - {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"}, - {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, - {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"}, - {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, - {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm, "Microsoft Data Management table"}, - {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"}, - {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"}, - {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"}, - {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, - {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"}, - {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, - {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"}, - {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, - {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"}, - {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"}, - {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"}, - {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"}, - {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"}, - {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"}, - {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"}, - {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"}, - {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"}, - {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"}, - {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"}, - {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf}, + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, + {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt}, + {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot}, + {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep}, + {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt}, + {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2}, + {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp}, + {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar}, + {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm}, + {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt}, + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj}, + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst}, + {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt}, + {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt}, + {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt}, + {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest}, + {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet}, + {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort}, + {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs}, + {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit}, + {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt}, + {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg}, + {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi}, + {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst}, + {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct}, + {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm}, + {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr}, + {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, + {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, + {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, + {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, + {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, + {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, + {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, + {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, + {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, + {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, + {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, + {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, + {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa}, + {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, + {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, + {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, + {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, + {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, + {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, + {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt}, + {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt}, + {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv}, + {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt}, + {NULL, NULL, NULL, NULL, NULL} }; @@ -407,18 +433,18 @@ AcpiDmGenerateChecksum ( * ******************************************************************************/ -ACPI_DMTABLE_DATA * +const ACPI_DMTABLE_DATA * AcpiDmGetTableData ( char *Signature) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *Info; - for (TableData = AcpiDmTableData; TableData->Signature; TableData++) + for (Info = AcpiDmTableData; Info->Signature; Info++) { - if (ACPI_COMPARE_NAME (Signature, TableData->Signature)) + if (ACPI_COMPARE_NAME (Signature, Info->Signature)) { - return (TableData); + return (Info); } } @@ -444,7 +470,7 @@ AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; UINT32 Length; @@ -558,7 +584,6 @@ AcpiDmDumpDataTable ( * PARAMETERS: Offset - Current byte offset, from table start * ByteLength - Length of the field in bytes, 0 for flags * Name - Name of this field - * Value - Optional value, displayed on left of ':' * * RETURN: None * @@ -692,7 +717,7 @@ AcpiDmDumpTable ( UINT16 Temp16; UINT32 Temp32; UINT64 Value; - ACPI_DMTABLE_DATA *TableData; + const AH_TABLE *TableData; const char *Name; BOOLEAN LastOutputBlankLine = FALSE; char RepairedName[8]; @@ -715,13 +740,24 @@ AcpiDmDumpTable ( Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset); CurrentOffset = TableOffset + Info->Offset; - /* Check for beyond EOT or beyond subtable end */ + /* Check for beyond subtable end or (worse) beyond EOT */ + + if (SubtableLength && (Info->Offset >= SubtableLength)) + { + AcpiOsPrintf ( + "/**** ACPI subtable terminates early - " + "may be older version (dump table) */\n"); - if ((CurrentOffset >= TableLength) || - (SubtableLength && (Info->Offset >= SubtableLength))) + /* Move on to next subtable */ + + return (AE_OK); + } + + if (CurrentOffset >= TableLength) { AcpiOsPrintf ( - "**** ACPI table terminates in the middle of a data structure! (dump table)\n"); + "/**** ACPI table terminates " + "in the middle of a data structure! (dump table) */\n"); return (AE_BAD_DATA); } @@ -754,6 +790,7 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: case ACPI_DMT_HEST: + case ACPI_DMT_NFIT: ByteLength = 2; break; @@ -810,6 +847,7 @@ AcpiDmDumpTable ( ByteLength = 128; break; + case ACPI_DMT_UNICODE: case ACPI_DMT_BUFFER: case ACPI_DMT_RAW_BUFFER: @@ -841,16 +879,39 @@ AcpiDmDumpTable ( ByteLength = sizeof (ACPI_HEST_NOTIFY); break; + case ACPI_DMT_IORTMEM: + + if (!LastOutputBlankLine) + { + LastOutputBlankLine = FALSE; + } + ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); + break; + default: ByteLength = 0; break; } + /* Check if we are beyond a subtable, or (worse) beyond EOT */ + if (CurrentOffset + ByteLength > TableLength) { + if (SubtableLength) + { + AcpiOsPrintf ( + "/**** ACPI subtable terminates early - " + "may be older version (dump table) */\n"); + + /* Move on to next subtable */ + + return (AE_OK); + } + AcpiOsPrintf ( - "**** ACPI table terminates in the middle of a data structure!\n"); + "/**** ACPI table terminates " + "in the middle of a data structure! */\n"); return (AE_BAD_DATA); } @@ -980,10 +1041,10 @@ AcpiDmDumpTable ( AcpiDmCheckAscii (Target, RepairedName, 4); AcpiOsPrintf ("\"%.4s\" ", RepairedName); - TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); + TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target)); if (TableData) { - AcpiOsPrintf (STRING_FORMAT, TableData->Name); + AcpiOsPrintf (STRING_FORMAT, TableData->Description); } else { @@ -1209,6 +1270,16 @@ AcpiDmDumpTable ( AcpiDmHestNotifySubnames[Temp8]); break; + case ACPI_DMT_IORTMEM: + + AcpiOsPrintf (STRING_FORMAT, + "IORT Memory Access Properties"); + + AcpiDmDumpTable (TableLength, CurrentOffset, Target, + sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc); + LastOutputBlankLine = TRUE; + break; + case ACPI_DMT_MADT: /* MADT subtable types */ @@ -1223,6 +1294,20 @@ AcpiDmDumpTable ( AcpiDmMadtSubnames[Temp8]); break; + case ACPI_DMT_NFIT: + + /* NFIT subtable types */ + + Temp16 = ACPI_GET16 (Target); + if (Temp16 > ACPI_NFIT_TYPE_RESERVED) + { + Temp16 = ACPI_NFIT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), + AcpiDmNfitSubnames[Temp16]); + break; + case ACPI_DMT_PCCT: /* PCCT subtable types */ @@ -1251,16 +1336,27 @@ AcpiDmDumpTable ( AcpiDmPmttSubnames[Temp8]); break; + case ACPI_DMT_UNICODE: + + if (ByteLength == 0) + { + AcpiOsPrintf ("/* Zero-length Data */\n"); + break; + } + + AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength); + break; + case ACPI_DMT_RAW_BUFFER: - /* - * Currently only used for SLIC table - */ - AcpiOsPrintf ("/* Proprietary data structure */ "); - AcpiDmDumpBuffer (Table, sizeof (ACPI_TABLE_HEADER), - ByteLength, sizeof (ACPI_TABLE_HEADER), - "Licensing Data", TRUE); - AcpiOsPrintf ("\n"); + if (ByteLength == 0) + { + AcpiOsPrintf ("/* Zero-length Data */\n"); + break; + } + + AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength, + CurrentOffset, NULL); break; case ACPI_DMT_SRAT: Modified: stable/10/sys/contrib/dev/acpica/common/dmtbdump.c ============================================================================== --- stable/10/sys/contrib/dev/acpica/common/dmtbdump.c Tue Jun 16 19:49:12 2015 (r284459) +++ stable/10/sys/contrib/dev/acpica/common/dmtbdump.c Tue Jun 16 20:00:53 2015 (r284460) @@ -70,7 +70,6 @@ AcpiDmValidateFadtLength ( * AbsoluteOffset - Offset of buffer in the main ACPI table * Header - Name of the buffer field (printed on the * first line only.) - * MultiLine - TRUE if a large, multi-line buffer * * RETURN: None * @@ -85,8 +84,7 @@ AcpiDmDumpBuffer ( UINT32 BufferOffset, UINT32 Length, UINT32 AbsoluteOffset, - char *Header, - BOOLEAN MultiLine) + char *Header) { UINT8 *Buffer; UINT32 i; @@ -104,18 +102,11 @@ AcpiDmDumpBuffer ( { if (!(i % 16)) { - if (MultiLine) - { - /* Insert a backslash - line continuation character */ + /* Insert a backslash - line continuation character */ - AcpiOsPrintf ("\\\n "); - } - else + if (Length > 16) { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (AbsoluteOffset, - ((Length - i) > 16) ? 16 : (Length - i), Header); - Header = NULL; + AcpiOsPrintf ("\\\n "); } } @@ -131,6 +122,74 @@ AcpiDmDumpBuffer ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpUnicode + * + * PARAMETERS: Table - ACPI Table or subtable + * BufferOffset - Offset of buffer from Table above + * ByteLength - Length of the buffer + * + * RETURN: None + * + * DESCRIPTION: Validate and dump the contents of a buffer that contains + * unicode data. The output is a standard ASCII string. If it + * appears that the data is not unicode, the buffer is dumped + * as hex characters. + * + ******************************************************************************/ + +void +AcpiDmDumpUnicode ( + void *Table, + UINT32 BufferOffset, + UINT32 ByteLength) +{ + UINT8 *Buffer; + UINT32 Length; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 02:30:14 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 495EED96; Wed, 17 Jun 2015 02:30:14 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 348A560; Wed, 17 Jun 2015 02:30:14 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H2UECV063259; Wed, 17 Jun 2015 02:30:14 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H2UDPq063256; Wed, 17 Jun 2015 02:30:13 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201506170230.t5H2UDPq063256@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 17 Jun 2015 02:30:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284484 - in stable/10: contrib/top usr.bin/top X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 02:30:14 -0000 Author: marcel Date: Wed Jun 17 02:30:12 2015 New Revision: 284484 URL: https://svnweb.freebsd.org/changeset/base/284484 Log: MFC 284165: Move contrib/top/top.X to contrib/top/top.xs and move contrib/top/top.local.H to contrib/top/top.local.hs. Change the makefile accordingly. Added: stable/10/contrib/top/top.local.hs - copied unchanged from r284165, head/contrib/top/top.local.hs stable/10/contrib/top/top.xs - copied unchanged from r284165, head/contrib/top/top.xs Deleted: stable/10/contrib/top/top.X stable/10/contrib/top/top.local.H Modified: stable/10/usr.bin/top/Makefile Directory Properties: stable/10/ (props changed) Copied: stable/10/contrib/top/top.local.hs (from r284165, head/contrib/top/top.local.hs) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/top/top.local.hs Wed Jun 17 02:30:12 2015 (r284484, copy of r284165, head/contrib/top/top.local.hs) @@ -0,0 +1,68 @@ +/* + * Top - a top users display for Berkeley Unix + * + * Definitions for things that might vary between installations. + */ + +/* + * The space command forces an immediate update. Sometimes, on loaded + * systems, this update will take a significant period of time (because all + * the output is buffered). So, if the short-term load average is above + * "LoadMax", then top will put the cursor home immediately after the space + * is pressed before the next update is attempted. This serves as a visual + * acknowledgement of the command. On Suns, "LoadMax" will get multiplied by + * "FSCALE" before being compared to avenrun[0]. Therefore, "LoadMax" + * should always be specified as a floating point number. + */ +#ifndef LoadMax +#define LoadMax %LoadMax% +#endif + +/* + * "Table_size" defines the size of the hash tables used to map uid to + * username. The number of users in /etc/passwd CANNOT be greater than + * this number. If the error message "table overflow: too many users" + * is printed by top, then "Table_size" needs to be increased. Things will + * work best if the number is a prime number that is about twice the number + * of lines in /etc/passwd. + */ +#ifndef Table_size +#define Table_size %TableSize% +#endif + +/* + * "Nominal_TOPN" is used as the default TOPN when Default_TOPN is Infinity + * and the output is a dumb terminal. If we didn't do this, then + * installations who use a default TOPN of Infinity will get every + * process in the system when running top on a dumb terminal (or redirected + * to a file). Note that Nominal_TOPN is a default: it can still be + * overridden on the command line, even with the value "infinity". + */ +#ifndef Nominal_TOPN +#define Nominal_TOPN %NominalTopn% +#endif + +#ifndef Default_TOPN +#define Default_TOPN %topn% +#endif + +#ifndef Default_DELAY +#define Default_DELAY %delay% +#endif + +/* + * If the local system's getpwnam interface uses random access to retrieve + * a record (i.e.: 4.3 systems, Sun "yellow pages"), then defining + * RANDOM_PW will take advantage of that fact. If RANDOM_PW is defined, + * then getpwnam is used and the result is cached. If not, then getpwent + * is used to read and cache the password entries sequentially until the + * desired one is found. + * + * We initially set RANDOM_PW to something which is controllable by the + * Configure script. Then if its value is 0, we undef it. + */ + +#define RANDOM_PW %random% +#if RANDOM_PW == 0 +#undef RANDOM_PW +#endif Copied: stable/10/contrib/top/top.xs (from r284165, head/contrib/top/top.xs) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/top/top.xs Wed Jun 17 02:30:12 2015 (r284484, copy of r284165, head/contrib/top/top.xs) @@ -0,0 +1,448 @@ +.\" NOTE: changes to the manual page for "top" should be made in the +.\" file "top.X" and NOT in the file "top.1". +.\" $FreeBSD$ +.nr N %topn% +.nr D %delay% +.TH TOP 1 Local +.UC 4 +.SH NAME +top \- display and update information about the top cpu processes +.SH SYNOPSIS +.B top +[ +.B \-abCHIijnPqStuvz +] [ +.BI \-d count +] [ +.BI \-m io | cpu +] [ +.BI \-o field +] [ +.BI \-s time +] [ +.BI \-J jail +] [ +.BI \-U username +] [ +.I number +] +.SH DESCRIPTION +.\" This defines appropriate quote strings for nroff and troff +.ds lq \&" +.ds rq \&" +.if t .ds lq `` +.if t .ds rq '' +.\" Just in case these number registers aren't set yet... +.if \nN==0 .nr N 10 +.if \nD==0 .nr D 2 +.I Top +displays the top +.if !\nN==-1 \nN +processes on the system and periodically updates this information. +.if \nN==-1 \ +\{\ +If standard output is an intelligent terminal (see below) then +as many processes as will fit on the terminal screen are displayed +by default. Otherwise, a good number of them are shown (around 20). +.\} +Raw cpu percentage is used to rank the processes. If +.I number +is given, then the top +.I number +processes will be displayed instead of the default. +.PP +.I Top +makes a distinction between terminals that support advanced capabilities +and those that do not. This +distinction affects the choice of defaults for certain options. In the +remainder of this document, an \*(lqintelligent\*(rq terminal is one that +supports cursor addressing, clear screen, and clear to end of line. +Conversely, a \*(lqdumb\*(rq terminal is one that does not support such +features. If the output of +.I top +is redirected to a file, it acts as if it were being run on a dumb +terminal. +.SH OPTIONS +.TP +.B \-C +Toggle CPU display mode. +By default top displays the weighted CPU percentage in the WCPU column +(this is the same value that +.IR ps (1) +displays as CPU). +Each time +.B \-C +flag is passed it toggles between \*(lqraw cpu\*(rq mode +and \*(lqweighted cpu\*(rq mode, showing the \*(lqCPU\*(rq or +the \*(lqWCPU\*(rq column respectively. +.TP +.B \-S +Show system processes in the display. Normally, system processes such as +the pager and the swapper are not shown. This option makes them visible. +.TP +.B \-a +Display command names derived from the argv[] vector, rather than real +executable name. It's useful when you want to watch applications, that +puts their status information there. If the real name differs from argv[0], +it will be displayed in parenthesis. +.TP +.B \-b +Use \*(lqbatch\*(rq mode. In this mode, all input from the terminal is +ignored. Interrupt characters (such as ^C and ^\e) still have an effect. +This is the default on a dumb terminal, or when the output is not a terminal. +.TP +.B \-H +Display each thread for a multithreaded process individually. +By default a single summary line is displayed for each process. +.TP +.B \-i +Use \*(lqinteractive\*(rq mode. In this mode, any input is immediately +read for processing. See the section on \*(lqInteractive Mode\*(rq +for an explanation of +which keys perform what functions. After the command is processed, the +screen will immediately be updated, even if the command was not +understood. This mode is the default when standard output is an +intelligent terminal. +.TP +.B \-I +Do not display idle processes. +By default, top displays both active and idle processes. +.TP +.B \-j +Display the +.IR jail (8) +ID. +.TP +.B \-t +Do not display the +.I top +process. +.TP +.BI \-m display +Display either 'cpu' or 'io' statistics. Default is 'cpu'. +.TP +.B \-n +Use \*(lqnon-interactive\*(rq mode. This is identical to \*(lqbatch\*(rq +mode. +.TP +.B \-P +Display per-cpu CPU usage statistics. +.TP +.B \-q +Renice +.I top +to -20 so that it will run faster. This can be used when the system is +being very sluggish to improve the possibility of discovering the problem. +This option can only be used by root. +.TP +.B \-u +Do not take the time to map uid numbers to usernames. Normally, +.I top +will read as much of the file \*(lq/etc/passwd\*(rq as is necessary to map +all the user id numbers it encounters into login names. This option +disables all that, while possibly decreasing execution time. The uid +numbers are displayed instead of the names. +.TP +.B \-v +Write version number information to stderr then exit immediately. +No other processing takes place when this option is used. To see current +revision information while top is running, use the help command \*(lq?\*(rq. +.TP +.B \-z +Do not display the system idle process. +.TP +.BI \-d count +Show only +.I count +displays, then exit. A display is considered to be one update of the +screen. This option allows the user to select the number of displays he +wants to see before +.I top +automatically exits. For intelligent terminals, no upper limit +is set. The default is 1 for dumb terminals. +.TP +.BI \-s time +Set the delay between screen updates to +.I time +seconds. The default delay between updates is \nD seconds. +.TP +.BI \-o field +Sort the process display area on the specified field. The field name is +the name of the column as seen in the output, but in lower case. Likely +values are \*(lqcpu\*(rq, \*(lqsize\*(rq, \*(lqres\*(rq, and \*(lqtime\*(rq, +but may vary on different operating systems. Note that +not all operating systems support this option. +.TP +.BI \-J jail +Show only those processes owned by +.IR jail . +This may be either the +.B jid +or +.B name +of the jail. +Use +.B 0 +to limit to host processes. +Using this option implies the +.B \-j +flag. +.PP +.BI \-U username +Show only those processes owned by +.IR username . +This option currently only accepts usernames and will not understand +uid numbers. +.PP +Both +.I count +and +.I number +fields can be specified as \*(lqinfinite\*(rq, indicating that they can +stretch as far as possible. This is accomplished by using any proper +prefix of the keywords +\*(lqinfinity\*(rq, +\*(lqmaximum\*(rq, +or +\*(lqall\*(rq. +The default for +.I count +on an intelligent terminal is, in fact, +.BI infinity . +.PP +The environment variable +.B TOP +is examined for options before the command line is scanned. This enables +a user to set his or her own defaults. The number of processes to display +can also be specified in the environment variable +.BR TOP . +The options +.BR \-a , +.BR \-C , +.BR \-H , +.BR \-I , +.BR \-j , +.BR \-P , +.BR \-S , +.BR \-t , +.BR \-u , +and +.B \-z +are actually toggles. A second specification of any of these options +will negate the first. Thus a user who has the environment variable +.B TOP +set to \*(lq\-I\*(rq may use the command \*(lqtop \-I\*(rq to see idle processes. +.SH "INTERACTIVE MODE" +When +.I top +is running in \*(lqinteractive mode\*(rq, it reads commands from the +terminal and acts upon them accordingly. In this mode, the terminal is +put in \*(lqCBREAK\*(rq, so that a character will be +processed as soon as it is typed. Almost always, a key will be +pressed when +.I top +is between displays; that is, while it is waiting for +.I time +seconds to elapse. If this is the case, the command will be +processed and the display will be updated immediately thereafter +(reflecting any changes that the command may have specified). This +happens even if the command was incorrect. If a key is pressed while +.I top +is in the middle of updating the display, it will finish the update and +then process the command. Some commands require additional information, +and the user will be prompted accordingly. While typing this information +in, the user's erase and kill keys (as set up by the command +.IR stty ) +are recognized, and a newline terminates the input. +.PP +These commands are currently recognized (^L refers to control-L): +.TP +.B ^L +Redraw the screen. +.IP "\fBh\fP\ or\ \fB?\fP" +Display a summary of the commands (help screen). Version information +is included in this display. +.TP +.B q +Quit +.IR top. +.TP +.B d +Change the number of displays to show (prompt for new number). +Remember that the next display counts as one, so typing +.B d1 +will make +.I top +show one final display and then immediately exit. +.TP +.B m +Toggle the display between 'cpu' and 'io' modes. +.TP +.B n or # +Change the number of processes to display (prompt for new number). +.TP +.B s +Change the number of seconds to delay between displays +(prompt for new number). +.TP +.B S +Toggle the display of system processes. +.TP +.B a +Toggle the display of process titles. +.TP +.B k +Send a signal (\*(lqkill\*(rq by default) to a list of processes. This +acts similarly to the command +.IR kill (1)). +.TP +.B r +Change the priority (the \*(lqnice\*(rq) of a list of processes. +This acts similarly to the command +.IR renice (8)). +.TP +.B u +Display only processes owned by a specific username (prompt for username). +If the username specified is simply \*(lq+\*(rq, then processes belonging +to all users will be displayed. +.TP +.B o +Change the order in which the display is sorted. This command is not +available on all systems. The sort key names vary from system to system +but usually include: \*(lqcpu\*(rq, \*(lqres\*(rq, \*(lqsize\*(rq, +\*(lqtime\*(rq. The default is cpu. +.TP +.B e +Display a list of system errors (if any) generated by the last +.BR k ill +or +.BR r enice +command. +.TP +.B H +Toggle the display of threads. +.TP +.B i +(or +.BR I ) +Toggle the display of idle processes. +.TP +.B j +Toggle the display of +.IR jail (8) +ID. +.TP +.B J +Display only processes owned by a specific jail (prompt for jail). +If the jail specified is simply \*(lq+\*(rq, then processes belonging +to all jails and the host will be displayed. +This will also enable the display of JID. +.TP +.B P +Toggle the display of per-CPU statistics. +.TP +.B t +Toggle the display of the +.I top +process. +.TP +.B z +Toggle the display of the system idle process. +.SH "THE DISPLAY" +The actual display varies depending on the specific variant of Unix +that the machine is running. This description may not exactly match +what is seen by top running on this particular machine. Differences +are listed at the end of this manual entry. +.PP +The top few lines of the display show general information +about the state of the system, including +the last process id assigned to a process (on most systems), +the three load averages, +the current time, +the number of existing processes, +the number of processes in each state +(sleeping, running, starting, zombies, and stopped), +and a percentage of time spent in each of the processor states +(user, nice, system, and idle). +It also includes information about physical and virtual memory allocation. +.PP +The remainder of the screen displays information about individual +processes. This display is similar in spirit to +.IR ps (1) +but it is not exactly the same. PID is the process id, +JID, when displayed, is the +.IR jail (8) +ID corresponding to the process, +USERNAME is the name of the process's owner (if +.B \-u +is specified, a UID column will be substituted for USERNAME), +PRI is the current priority of the process, +NICE is the nice amount (in the range \-20 to 20), +SIZE is the total size of the process (text, data, and stack), +RES is the current amount of resident memory (both SIZE and RES are +given in kilobytes), +STATE is the current state (one of \*(lqSTART\*(rq, \*(lqRUN\*(rq +(shown as \*(lqCPUn\*(rq on SMP systems), \*(lqSLEEP\*(rq, \*(lqSTOP\*(rq, +\*(lqZOMB\*(rq, \*(lqWAIT\*(rq, \*(lqLOCK\*(rq or the event on which the +process waits), +C is the processor number on which the process is executing +(visible only on SMP systems), +TIME is the number of system and user cpu seconds that the process has used, +WCPU, when displayed, is the weighted cpu percentage (this is the same +value that +.IR ps (1) +displays as CPU), +CPU is the raw percentage and is the field that is sorted to determine +the order of the processes, and +COMMAND is the name of the command that the process is currently running +(if the process is swapped out, this column is marked \*(lq\*(rq). +.SH NOTES +If a process is in the \*(lqSLEEP\*(rq or \*(lqLOCK\*(rq state, +the state column will report the name of the event or lock on which the +process is waiting. +Lock names are prefixed with an asterisk \*(lq*\*(rq while sleep events +are not. +.SH AUTHOR +William LeFebvre, EECS Department, Northwestern University +.SH ENVIRONMENT +.DT +TOP user-configurable defaults for options. +.SH FILES +.DT +/dev/kmem kernel memory +.br +/dev/mem physical memory +.br +/etc/passwd used to map uid numbers to user names +.br +/boot/kernel/kernel system image +.SH BUGS +Don't shoot me, but the default for +.B \-I +has changed once again. So many people were confused by the fact that +.I top +wasn't showing them all the processes that I have decided to make the +default behavior show idle processes, just like it did in version 2. +But to appease folks who can't stand that behavior, I have added the +ability to set \*(lqdefault\*(rq options in the environment variable +.B TOP +(see the OPTIONS section). Those who want the behavior that version +3.0 had need only set the environment variable +.B TOP +to \*(lq\-I\*(rq. +.PP +The command name for swapped processes should be tracked down, but this +would make the program run slower. +.PP +As with +.IR ps (1), +things can change while +.I top +is collecting information for an update. The picture it gives is only a +close approximation to reality. +.SH "SEE ALSO" +kill(1), +ps(1), +stty(1), +mem(4), +renice(8) Modified: stable/10/usr.bin/top/Makefile ============================================================================== --- stable/10/usr.bin/top/Makefile Tue Jun 16 23:57:29 2015 (r284483) +++ stable/10/usr.bin/top/Makefile Wed Jun 17 02:30:12 2015 (r284484) @@ -31,8 +31,8 @@ sigdesc.h: ${SIGCONV_AWK} ${SIGNAL_H} awk -f ${SIGCONV_AWK} < ${SIGNAL_H} > ${.TARGET} CLEANFILES+= top.local.h top.x -.SUFFIXES: .X .x .H .h -.X.x .H.h: +.SUFFIXES: .xs .x .hs .h +.xs.x .hs.h: @${ECHO} Making ${.TARGET} from ${.IMPSRC} @sed -e's,%LoadMax%,5.0,g' \ -e's,%TableSize%,20011,g' \ From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 02:39:11 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B0F2128; Wed, 17 Jun 2015 02:39:11 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 785FE289; Wed, 17 Jun 2015 02:39:11 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H2dB4w068173; Wed, 17 Jun 2015 02:39:11 GMT (envelope-from gshapiro@FreeBSD.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H2dBHE068172; Wed, 17 Jun 2015 02:39:11 GMT (envelope-from gshapiro@FreeBSD.org) Message-Id: <201506170239.t5H2dBHE068172@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gshapiro set sender to gshapiro@FreeBSD.org using -f From: Gregory Neil Shapiro Date: Wed, 17 Jun 2015 02:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284485 - stable/10/contrib/sendmail/src X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 02:39:11 -0000 Author: gshapiro Date: Wed Jun 17 02:39:10 2015 New Revision: 284485 URL: https://svnweb.freebsd.org/changeset/base/284485 Log: MFC: The import of openssl to address the FreeBSD-SA-15:10.openssl security advisory includes a change which rejects handshakes with DH parameters below 768 bits. sendmail releases prior to 8.15.2 (not yet released), defaulted to a 512 bit DH parameter setting for client connections. This commit chages that default to 1024 bits. sendmail 8.15.2, when released well use a default of 2048 bits. Modified: stable/10/contrib/sendmail/src/tls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/sendmail/src/tls.c ============================================================================== --- stable/10/contrib/sendmail/src/tls.c Wed Jun 17 02:30:12 2015 (r284484) +++ stable/10/contrib/sendmail/src/tls.c Wed Jun 17 02:39:10 2015 (r284485) @@ -650,7 +650,7 @@ inittls(ctx, req, options, srv, certfile ** 1024 generate 1024 bit parameters ** 2048 generate 2048 bit parameters ** /file/name read parameters from /file/name - ** default is: 1024 for server, 512 for client (OK? XXX) + ** default is: 1024 */ if (bitset(TLS_I_TRY_DH, req)) @@ -676,8 +676,8 @@ inittls(ctx, req, options, srv, certfile } if (dhparam == NULL) { - dhparam = srv ? "1" : "5"; - req |= (srv ? TLS_I_DH1024 : TLS_I_DH512); + dhparam = "1"; + req |= TLS_I_DH1024; } else if (*dhparam == '/') { From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 02:47:31 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4667355B; Wed, 17 Jun 2015 02:47:31 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 341246BC; Wed, 17 Jun 2015 02:47:31 +0000 (UTC) (envelope-from gshapiro@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H2lV7r073043; Wed, 17 Jun 2015 02:47:31 GMT (envelope-from gshapiro@FreeBSD.org) Received: (from gshapiro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H2lVZV073042; Wed, 17 Jun 2015 02:47:31 GMT (envelope-from gshapiro@FreeBSD.org) Message-Id: <201506170247.t5H2lVZV073042@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gshapiro set sender to gshapiro@FreeBSD.org using -f From: Gregory Neil Shapiro Date: Wed, 17 Jun 2015 02:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284487 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 02:47:31 -0000 Author: gshapiro Date: Wed Jun 17 02:47:30 2015 New Revision: 284487 URL: https://svnweb.freebsd.org/changeset/base/284487 Log: MFC: The fix for the issue described in the 20150614 sendmail entry has been been committed in revision 284485.. Modified: stable/10/UPDATING Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Wed Jun 17 02:43:20 2015 (r284486) +++ stable/10/UPDATING Wed Jun 17 02:47:30 2015 (r284487) @@ -16,6 +16,13 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20150615: + The fix for the issue described in the 20150614 sendmail entry + below has been been committed in revision 284485. The work + around described in that entry is no longer needed unless the + default setting is overridden by a confDH_PARAMETERS configuration + setting of '5' or pointing to a 512 bit DH parameter file. + 20150614: The import of openssl to address the FreeBSD-SA-15:10.openssl security advisory includes a change which rejects handshakes From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 04:18:31 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B710F2F3; Wed, 17 Jun 2015 04:18:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4B2FF50; Wed, 17 Jun 2015 04:18:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H4IVff019029; Wed, 17 Jun 2015 04:18:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H4IV0e019028; Wed, 17 Jun 2015 04:18:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201506170418.t5H4IV0e019028@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 17 Jun 2015 04:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284493 - stable/10/lib/libthr/thread X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 04:18:31 -0000 Author: kib Date: Wed Jun 17 04:18:30 2015 New Revision: 284493 URL: https://svnweb.freebsd.org/changeset/base/284493 Log: MFC r284385: Fix typo in comment. Modified: stable/10/lib/libthr/thread/thr_sig.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libthr/thread/thr_sig.c ============================================================================== --- stable/10/lib/libthr/thread/thr_sig.c Wed Jun 17 03:23:45 2015 (r284492) +++ stable/10/lib/libthr/thread/thr_sig.c Wed Jun 17 04:18:30 2015 (r284493) @@ -293,8 +293,8 @@ check_cancel(struct pthread *curthread, * 2) because _thr_ast() may be called by * THR_CRITICAL_LEAVE() which is used by rtld rwlock * and any libthr internal locks, when rtld rwlock - * is used, it is mostly caused my an unresolved PLT. - * those routines may clear the TDP_WAKEUP flag by + * is used, it is mostly caused by an unresolved PLT. + * Those routines may clear the TDP_WAKEUP flag by * invoking some system calls, in those cases, we * also should reenable the flag. * 3) thread is in sigsuspend(), and the syscall insists From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 07:21:44 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C52F71F; Wed, 17 Jun 2015 07:21:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FCD81B9; Wed, 17 Jun 2015 07:21:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H7Lh7W011368; Wed, 17 Jun 2015 07:21:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H7Lhpp011367; Wed, 17 Jun 2015 07:21:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201506170721.t5H7Lhpp011367@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 17 Jun 2015 07:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284496 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 07:21:44 -0000 Author: hselasky Date: Wed Jun 17 07:21:43 2015 New Revision: 284496 URL: https://svnweb.freebsd.org/changeset/base/284496 Log: MFC r280991: Extend fixes made in r278103 and r38754 by copying the complete packet header and not only partial flags and fields. Firewalls can attach classification tags to the outgoing mbufs which should be copied to all the new fragments. Else only the first fragment will be let through by the firewall. This can easily be tested by sending a large ping packet through a firewall. It was also discovered that VLAN related flags and fields should be copied for packets traversing through VLANs. This is all handled by "m_dup_pkthdr()". Regarding the MAC policy check in ip_fragment(), the tag provided by the originating mbuf is copied instead of using the default one provided by m_gethdr(). Tested by: Karim Fodil-Lemelin Sponsored by: Mellanox Technologies PR: 7802 Modified: stable/10/sys/netinet/ip_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_output.c ============================================================================== --- stable/10/sys/netinet/ip_output.c Wed Jun 17 04:46:58 2015 (r284495) +++ stable/10/sys/netinet/ip_output.c Wed Jun 17 07:21:43 2015 (r284496) @@ -797,13 +797,18 @@ smart_frag_failure: goto done; } /* - * make sure the flowid and flowtype are the same for the - * fragmented mbufs + * Make sure the complete packet header gets copied + * from the originating mbuf to the newly created + * mbuf. This also ensures that existing firewall + * classification(s), VLAN tags and so on get copied + * to the resulting fragmented packet(s): */ - M_HASHTYPE_SET(m, M_HASHTYPE_GET(m0)); - m->m_pkthdr.flowid = m0->m_pkthdr.flowid; - /* copy multicast flags, if any */ - m->m_flags |= (m0->m_flags & M_MCAST); + if (m_dup_pkthdr(m, m0, M_NOWAIT) == 0) { + m_free(m); + error = ENOBUFS; + IPSTAT_INC(ips_odropped); + goto done; + } /* * In the first mbuf, leave room for the link header, then * copy the original IP header including options. The payload @@ -833,11 +838,9 @@ smart_frag_failure: goto done; } m->m_pkthdr.len = mhlen + len; - m->m_pkthdr.rcvif = NULL; #ifdef MAC mac_netinet_fragment(m0, m); #endif - m->m_pkthdr.csum_flags = m0->m_pkthdr.csum_flags; mhip->ip_off = htons(mhip->ip_off); mhip->ip_sum = 0; if (m->m_pkthdr.csum_flags & CSUM_IP & ~if_hwassist_flags) { From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 07:32:29 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4769EBC; Wed, 17 Jun 2015 07:32:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91D58688; Wed, 17 Jun 2015 07:32:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H7WTKd016724; Wed, 17 Jun 2015 07:32:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H7WTCF016722; Wed, 17 Jun 2015 07:32:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201506170732.t5H7WTCF016722@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 17 Jun 2015 07:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284499 - in stable/10/sys/dev/usb: . quirk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 07:32:29 -0000 Author: hselasky Date: Wed Jun 17 07:32:28 2015 New Revision: 284499 URL: https://svnweb.freebsd.org/changeset/base/284499 Log: MFC r284125: Add new USB quirk. PR: 200693 Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/10/sys/dev/usb/quirk/usb_quirk.c Wed Jun 17 07:30:53 2015 (r284498) +++ stable/10/sys/dev/usb/quirk/usb_quirk.c Wed Jun 17 07:32:28 2015 (r284499) @@ -94,6 +94,7 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(SILICONPORTALS, YAPPHONE, 0x100, 0x100, UQ_AU_INP_ASYNC), USB_QUIRK(LOGITECH, UN53B, 0x0000, 0xffff, UQ_NO_STRINGS), USB_QUIRK(REALTEK, RTL8196EU, 0x0000, 0xffff, UQ_CFG_INDEX_1), + USB_QUIRK(REALTEK, RTL8153, 0x0000, 0xffff, UQ_CFG_INDEX_1), USB_QUIRK(ELSA, MODEM1, 0x0000, 0xffff, UQ_CFG_INDEX_1), USB_QUIRK(PLANEX2, MZKUE150N, 0x0000, 0xffff, UQ_CFG_INDEX_1), /* Quirks for printer devices */ Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Wed Jun 17 07:30:53 2015 (r284498) +++ stable/10/sys/dev/usb/usbdevs Wed Jun 17 07:32:28 2015 (r284499) @@ -3722,6 +3722,7 @@ product REALTEK USB20CRW 0x0158 USB20CRW product REALTEK RTL8188ETV 0x0179 RTL8188ETV product REALTEK RTL8188CTV 0x018a RTL8188CTV product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet +product REALTEK RTL8153 0x8153 RTL8153 USB Ethernet product REALTEK RTL8188CE_0 0x8170 RTL8188CE product REALTEK RTL8171 0x8171 RTL8171 product REALTEK RTL8172 0x8172 RTL8172 From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 07:36:01 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AF69D9; Wed, 17 Jun 2015 07:36:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5867A6C2; Wed, 17 Jun 2015 07:36:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H7a1YT017305; Wed, 17 Jun 2015 07:36:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H7a15H017303; Wed, 17 Jun 2015 07:36:01 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201506170736.t5H7a15H017303@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 17 Jun 2015 07:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284500 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 07:36:01 -0000 Author: hselasky Date: Wed Jun 17 07:36:00 2015 New Revision: 284500 URL: https://svnweb.freebsd.org/changeset/base/284500 Log: MFC r284011: Don't wait forever for USB data to be flushed. Modified: stable/10/sys/dev/usb/usb_dev.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_dev.c ============================================================================== --- stable/10/sys/dev/usb/usb_dev.c Wed Jun 17 07:32:28 2015 (r284499) +++ stable/10/sys/dev/usb/usb_dev.c Wed Jun 17 07:36:00 2015 (r284500) @@ -831,7 +831,8 @@ usb_fifo_close(struct usb_fifo *f, int f (!f->flag_iserror)) { /* wait until all data has been written */ f->flag_sleeping = 1; - err = cv_wait_sig(&f->cv_io, f->priv_mtx); + err = cv_timedwait_sig(&f->cv_io, f->priv_mtx, + USB_MS_TO_TICKS(USB_DEFAULT_TIMEOUT)); if (err) { DPRINTF("signal received\n"); break; From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 07:41:54 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C06A555; Wed, 17 Jun 2015 07:41:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69BFC92A; Wed, 17 Jun 2015 07:41:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H7fs8s021811; Wed, 17 Jun 2015 07:41:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H7fsoO021809; Wed, 17 Jun 2015 07:41:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201506170741.t5H7fsoO021809@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 17 Jun 2015 07:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284503 - stable/10/sys/dev/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 07:41:54 -0000 Author: hselasky Date: Wed Jun 17 07:41:53 2015 New Revision: 284503 URL: https://svnweb.freebsd.org/changeset/base/284503 Log: MFC r284012: Disable VGA PCI interrupts until a chipset driver is loaded for VGA PCI devices. Else unhandled display adapter interrupts might freeze the CPU or consume a lot of CPU. PR: 156596 Modified: stable/10/sys/dev/pci/vga_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/pci/vga_pci.c ============================================================================== --- stable/10/sys/dev/pci/vga_pci.c Wed Jun 17 07:38:50 2015 (r284502) +++ stable/10/sys/dev/pci/vga_pci.c Wed Jun 17 07:41:53 2015 (r284503) @@ -125,6 +125,13 @@ vga_pci_is_boot_display(device_t dev) if ((config & (PCIM_CMD_PORTEN | PCIM_CMD_MEMEN)) == 0) return (0); + /* + * Disable interrupts until a chipset driver is loaded for + * this PCI device. Else unhandled display adapter interrupts + * might freeze the CPU. + */ + pci_write_config(dev, PCIR_COMMAND, config | PCIM_CMD_INTxDIS, 2); + /* This video card is the boot display: record its unit number. */ vga_pci_default_unit = unit; device_set_flags(dev, 1); From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 12:43:09 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9FEC02CFF; Wed, 17 Jun 2015 12:43:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60038C34; Wed, 17 Jun 2015 12:43:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HBl7s6042084; Wed, 17 Jun 2015 11:47:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HBl7RF042083; Wed, 17 Jun 2015 11:47:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201506171147.t5HBl7RF042083@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 17 Jun 2015 11:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284509 - stable/10/sys/boot/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 12:43:09 -0000 Author: avg Date: Wed Jun 17 11:47:06 2015 New Revision: 284509 URL: https://svnweb.freebsd.org/changeset/base/284509 Log: MFC r284025,284032: dnode_read: handle hole blocks in zfs boot code PR: 199804 Modified: stable/10/sys/boot/zfs/zfsimpl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/10/sys/boot/zfs/zfsimpl.c Wed Jun 17 10:20:59 2015 (r284508) +++ stable/10/sys/boot/zfs/zfsimpl.c Wed Jun 17 11:47:06 2015 (r284509) @@ -1255,6 +1255,10 @@ dnode_read(const spa_t *spa, const dnode ibn = bn >> ((nlevels - i - 1) * ibshift); ibn &= ((1 << ibshift) - 1); bp = indbp[ibn]; + if (BP_IS_HOLE(&bp)) { + memset(dnode_cache_buf, 0, bsize); + break; + } rc = zio_read(spa, &bp, dnode_cache_buf); if (rc) return (rc); From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 12:43:11 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 51EB77D; Wed, 17 Jun 2015 12:43:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04674C4B; Wed, 17 Jun 2015 12:43:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H9i3iY081396; Wed, 17 Jun 2015 09:44:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H9i3Uw081395; Wed, 17 Jun 2015 09:44:03 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506170944.t5H9i3Uw081395@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 17 Jun 2015 09:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284507 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 12:43:11 -0000 Author: tuexen Date: Wed Jun 17 09:44:02 2015 New Revision: 284507 URL: https://svnweb.freebsd.org/changeset/base/284507 Log: MFC r284393: Correctly detect the case where the last address is removed. Modified: stable/10/sys/netinet/sctp_asconf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_asconf.c ============================================================================== --- stable/10/sys/netinet/sctp_asconf.c Wed Jun 17 09:41:16 2015 (r284506) +++ stable/10/sys/netinet/sctp_asconf.c Wed Jun 17 09:44:02 2015 (r284507) @@ -1328,6 +1328,7 @@ sctp_asconf_queue_add(struct sctp_tcb *s { uint32_t status; int pending_delete_queued = 0; + int last; /* see if peer supports ASCONF */ if (stcb->asoc.asconf_supported == 0) { @@ -1337,15 +1338,21 @@ sctp_asconf_queue_add(struct sctp_tcb *s * if this is deleting the last address from the assoc, mark it as * pending. */ - if ((type == SCTP_DEL_IP_ADDRESS) && !stcb->asoc.asconf_del_pending && - (sctp_local_addr_count(stcb) < 2)) { - /* set the pending delete info only */ - stcb->asoc.asconf_del_pending = 1; - stcb->asoc.asconf_addr_del_pending = ifa; - atomic_add_int(&ifa->refcount, 1); - SCTPDBG(SCTP_DEBUG_ASCONF2, - "asconf_queue_add: mark delete last address pending\n"); - return (-1); + if ((type == SCTP_DEL_IP_ADDRESS) && !stcb->asoc.asconf_del_pending) { + if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { + last = (sctp_local_addr_count(stcb) == 0); + } else { + last = (sctp_local_addr_count(stcb) == 1); + } + if (last) { + /* set the pending delete info only */ + stcb->asoc.asconf_del_pending = 1; + stcb->asoc.asconf_addr_del_pending = ifa; + atomic_add_int(&ifa->refcount, 1); + SCTPDBG(SCTP_DEBUG_ASCONF2, + "asconf_queue_add: mark delete last address pending\n"); + return (-1); + } } /* queue an asconf parameter */ status = sctp_asconf_queue_mgmt(stcb, ifa, type); From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 12:43:12 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FB911B3; Wed, 17 Jun 2015 12:43:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6ADCC52; Wed, 17 Jun 2015 12:43:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H9de5O077085; Wed, 17 Jun 2015 09:39:40 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H9de7M077084; Wed, 17 Jun 2015 09:39:40 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506170939.t5H9de7M077084@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 17 Jun 2015 09:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284505 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 12:43:12 -0000 Author: tuexen Date: Wed Jun 17 09:39:40 2015 New Revision: 284505 URL: https://svnweb.freebsd.org/changeset/base/284505 Log: MFC r284384: Stop the heartbeat timer when removing a net. Thanks to the reporter of https://code.google.com/p/sctp-refimpl/issues/detail?id=14 for reporting the issue. Modified: stable/10/sys/netinet/sctp_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_var.h ============================================================================== --- stable/10/sys/netinet/sctp_var.h Wed Jun 17 07:43:20 2015 (r284504) +++ stable/10/sys/netinet/sctp_var.h Wed Jun 17 09:39:40 2015 (r284505) @@ -178,6 +178,7 @@ extern struct pr_usrreqs sctp_usrreqs; if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \ (void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \ (void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \ + (void)SCTP_OS_TIMER_STOP(&(__net)->hb_timer.timer); \ if ((__net)->ro.ro_rt) { \ RTFREE((__net)->ro.ro_rt); \ (__net)->ro.ro_rt = NULL; \ From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 12:43:12 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1603130; Wed, 17 Jun 2015 12:43:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98112C51; Wed, 17 Jun 2015 12:43:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5H9fHFv078422; Wed, 17 Jun 2015 09:41:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5H9fH57078421; Wed, 17 Jun 2015 09:41:17 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506170941.t5H9fH57078421@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 17 Jun 2015 09:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284506 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 12:43:12 -0000 Author: tuexen Date: Wed Jun 17 09:41:16 2015 New Revision: 284506 URL: https://svnweb.freebsd.org/changeset/base/284506 Log: MFC r284386: Fix name of a constant. Modified: stable/10/lib/libc/net/sctp_bindx.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/sctp_bindx.3 ============================================================================== --- stable/10/lib/libc/net/sctp_bindx.3 Wed Jun 17 09:39:40 2015 (r284505) +++ stable/10/lib/libc/net/sctp_bindx.3 Wed Jun 17 09:41:16 2015 (r284506) @@ -28,7 +28,7 @@ .\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 .\" $FreeBSD$ .\" -.Dd December 15, 2006 +.Dd June 14, 2015 .Dt SCTP_BINDX 3 .Os .Sh NAME @@ -71,7 +71,7 @@ must be one of the following values. This value indicates that the listed address(es) need to be added to the endpoint. .Pp -.Dv SCTP_BINDX_DEL_ADDR +.Dv SCTP_BINDX_REM_ADDR This value indicates that the listed address(es) need to be removed from the endpoint. .Pp From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 16:26:14 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AFBB30D; Wed, 17 Jun 2015 16:26:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 596F88F0; Wed, 17 Jun 2015 16:26:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HGQErZ083273; Wed, 17 Jun 2015 16:26:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HGQEnl083272; Wed, 17 Jun 2015 16:26:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201506171626.t5HGQEnl083272@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 17 Jun 2015 16:26:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284516 - stable/10/etc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 16:26:14 -0000 Author: gjb Date: Wed Jun 17 16:26:13 2015 New Revision: 284516 URL: https://svnweb.freebsd.org/changeset/base/284516 Log: MFC r283989: Implement endian-aware services_mkdb(8) in the 'distribute' target. Sponsored by: The FreeBSD Foundation Modified: stable/10/etc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/Makefile ============================================================================== --- stable/10/etc/Makefile Wed Jun 17 15:20:14 2015 (r284515) +++ stable/10/etc/Makefile Wed Jun 17 16:26:13 2015 (r284516) @@ -217,6 +217,8 @@ distribution: ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${BIN1} ${DESTDIR}/etc; \ cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \ + services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \ + ${DESTDIR}/etc/services; \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${BIN2} ${DESTDIR}/etc; \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 16:29:34 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AEDC9527; Wed, 17 Jun 2015 16:29:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90A66943; Wed, 17 Jun 2015 16:29:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HGTYfg083842; Wed, 17 Jun 2015 16:29:34 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HGTWkn083833; Wed, 17 Jun 2015 16:29:32 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201506171629.t5HGTWkn083833@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 17 Jun 2015 16:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284517 - stable/10/release/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 16:29:34 -0000 Author: gjb Date: Wed Jun 17 16:29:32 2015 New Revision: 284517 URL: https://svnweb.freebsd.org/changeset/base/284517 Log: MFC r284333: Reduce the arm/armv6 image size from 1G to 480M. Since the images are effectively mostly zeros at 1G, reduce the size to allow installation on smaller SD cards, such as 512Mb. While here, stop writing the /boot.txt file on the WANDBOARD, which isn't used anyway. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/arm/BEAGLEBONE.conf stable/10/release/arm/CUBOX-HUMMINGBOARD.conf stable/10/release/arm/GUMSTIX.conf stable/10/release/arm/PANDABOARD.conf stable/10/release/arm/RPI-B.conf stable/10/release/arm/RPI2.conf stable/10/release/arm/WANDBOARD.conf Directory Properties: stable/10/ (props changed) Modified: stable/10/release/arm/BEAGLEBONE.conf ============================================================================== --- stable/10/release/arm/BEAGLEBONE.conf Wed Jun 17 16:26:13 2015 (r284516) +++ stable/10/release/arm/BEAGLEBONE.conf Wed Jun 17 16:29:32 2015 (r284517) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-beaglebone" KERNEL="BEAGLEBONE" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="480M" PART_SCHEME="MBR" FAT_SIZE="2m" FAT_TYPE="12" Modified: stable/10/release/arm/CUBOX-HUMMINGBOARD.conf ============================================================================== --- stable/10/release/arm/CUBOX-HUMMINGBOARD.conf Wed Jun 17 16:26:13 2015 (r284516) +++ stable/10/release/arm/CUBOX-HUMMINGBOARD.conf Wed Jun 17 16:29:32 2015 (r284517) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-cubox-hummingboard" KERNEL="IMX6" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x12000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="480M" PART_SCHEME="MBR" FAT_SIZE="50m -b 16384" FAT_TYPE="16" Modified: stable/10/release/arm/GUMSTIX.conf ============================================================================== --- stable/10/release/arm/GUMSTIX.conf Wed Jun 17 16:26:13 2015 (r284516) +++ stable/10/release/arm/GUMSTIX.conf Wed Jun 17 16:29:32 2015 (r284517) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-duovero" KERNEL="GUMSTIX" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="480M" PART_SCHEME="MBR" FAT_SIZE="2m" FAT_TYPE="12" Modified: stable/10/release/arm/PANDABOARD.conf ============================================================================== --- stable/10/release/arm/PANDABOARD.conf Wed Jun 17 16:26:13 2015 (r284516) +++ stable/10/release/arm/PANDABOARD.conf Wed Jun 17 16:29:32 2015 (r284517) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-pandaboard" KERNEL="PANDABOARD" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x88000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="480M" PART_SCHEME="MBR" FAT_SIZE="2m" FAT_TYPE="12" Modified: stable/10/release/arm/RPI-B.conf ============================================================================== --- stable/10/release/arm/RPI-B.conf Wed Jun 17 16:26:13 2015 (r284516) +++ stable/10/release/arm/RPI-B.conf Wed Jun 17 16:29:32 2015 (r284517) @@ -9,7 +9,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-rpi" KERNEL="RPI-B" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="480M" PART_SCHEME="MBR" FAT_SIZE="17m" FAT_TYPE="16" Modified: stable/10/release/arm/RPI2.conf ============================================================================== --- stable/10/release/arm/RPI2.conf Wed Jun 17 16:26:13 2015 (r284516) +++ stable/10/release/arm/RPI2.conf Wed Jun 17 16:29:32 2015 (r284517) @@ -10,7 +10,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-rpi2" KERNEL="RPI2" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x2000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="480M" PART_SCHEME="MBR" FAT_SIZE="50m" FAT_TYPE="16" Modified: stable/10/release/arm/WANDBOARD.conf ============================================================================== --- stable/10/release/arm/WANDBOARD.conf Wed Jun 17 16:26:13 2015 (r284516) +++ stable/10/release/arm/WANDBOARD.conf Wed Jun 17 16:29:32 2015 (r284517) @@ -10,7 +10,7 @@ EMBEDDED_TARGET_ARCH="armv6" EMBEDDEDPORTS="sysutils/u-boot-wandboard" KERNEL="IMX6" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x12000000" -IMAGE_SIZE="1G" +IMAGE_SIZE="480M" PART_SCHEME="MBR" FAT_SIZE="50m -b 16384" FAT_TYPE="16" @@ -29,9 +29,6 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr - chroot ${CHROOTDIR} /bin/sh -c 'echo \ - setenv fdt_file wandboard-quad.dtb\; fatload mmc 0:1 11000000 ubldr\; bootelf 11000000\; \ - > ${FATMOUNT}/boot.txt' chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 18:22:53 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 550C278E; Wed, 17 Jun 2015 18:22:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4310BDAD; Wed, 17 Jun 2015 18:22:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HIMrv3048439; Wed, 17 Jun 2015 18:22:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HIMr2f048438; Wed, 17 Jun 2015 18:22:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201506171822.t5HIMr2f048438@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 17 Jun 2015 18:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284521 - stable/10/etc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 18:22:53 -0000 Author: gjb Date: Wed Jun 17 18:22:52 2015 New Revision: 284521 URL: https://svnweb.freebsd.org/changeset/base/284521 Log: Revert r284516, which broke the build in a way I do not fully understand yet. I'll redo this MFC after investigation. Sponsored by: The FreeBSD Foundation Modified: stable/10/etc/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/Makefile ============================================================================== --- stable/10/etc/Makefile Wed Jun 17 17:16:06 2015 (r284520) +++ stable/10/etc/Makefile Wed Jun 17 18:22:52 2015 (r284521) @@ -217,8 +217,6 @@ distribution: ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${BIN1} ${DESTDIR}/etc; \ cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \ - services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \ - ${DESTDIR}/etc/services; \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${BIN2} ${DESTDIR}/etc; \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 18:50:59 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 97A503D6; Wed, 17 Jun 2015 18:50:59 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8339B7B0; Wed, 17 Jun 2015 18:50:59 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HIoxAp064701; Wed, 17 Jun 2015 18:50:59 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HIow3k064693; Wed, 17 Jun 2015 18:50:58 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201506171850.t5HIow3k064693@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 17 Jun 2015 18:50:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284522 - in stable/10: share/man/man4 sys/conf sys/dev/e1000 sys/dev/netmap sys/modules/em X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 18:50:59 -0000 Author: sbruno Date: Wed Jun 17 18:50:57 2015 New Revision: 284522 URL: https://svnweb.freebsd.org/changeset/base/284522 Log: MFC r284179, r283959 Implement multiqueue (max 2 tx/rx queues) for the 82574L chipset. Change default tuning parameters to handle this new configuration if EM_MULTIQUEUE is set in the kernel configuration. Off by default. See r283959 changelog for the scope of these changes. Relnotes: Yes Sponsored by: Limelight Networks Modified: stable/10/share/man/man4/em.4 stable/10/sys/conf/NOTES stable/10/sys/conf/options stable/10/sys/dev/e1000/e1000_defines.h stable/10/sys/dev/e1000/if_em.c stable/10/sys/dev/e1000/if_em.h stable/10/sys/dev/netmap/if_em_netmap.h stable/10/sys/modules/em/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/em.4 ============================================================================== --- stable/10/share/man/man4/em.4 Wed Jun 17 18:22:52 2015 (r284521) +++ stable/10/share/man/man4/em.4 Wed Jun 17 18:50:57 2015 (r284522) @@ -45,6 +45,14 @@ kernel configuration file: .Cd "device em" .Ed .Pp +Optional multiqueue support is available via the following kernel +compile options: +.Bd -ragged -offset indent +.Cd "options EM_MULTIQUEUE" +.Ed +.Pp +Note: Activating EM_MULTIQUEUE support is not supported by Intel. +.Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : @@ -197,6 +205,18 @@ Tunables can be set at the prompt before booting the kernel or stored in .Xr loader.conf 5 . .Bl -tag -width indent +.It Va hw.em.eee_setting +Disable or enable Energy Efficient Ethernet. +Default 1 (disabled). +.It Va hw.em.msix +Enable or disable MSI-X style interrupts. +Default 1 (enabled). +.It Va hw.em.smart_pwr_down +Enable or disable smart power down features on newer adapters. +Default 0 (disabled). +.It Va hw.em.sbp +Show bad packets when in promiscuous mode. +Default 0 (off). .It Va hw.em.rxd Number of receive descriptors allocated by the driver. The default value is 1024 for adapters newer than 82547, @@ -228,6 +248,11 @@ If .Va hw.em.tx_int_delay is non-zero, this tunable limits the maximum delay in which a transmit interrupt is generated. +.It Va hw.em.num_queues +Number of hardware queues that will be configured on this adapter (maximum of 2) +Defaults to 1. +Only valid with kernel configuration +.Cd "options EM_MULTIQUEUE". .El .Sh FILES .Bl -tag -width /dev/led/em* @@ -287,3 +312,5 @@ You can enable it on an .Nm interface using .Xr ifconfig 8 . +.Pp +Activating EM_MULTIQUEUE support requires MSI-X features. Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Wed Jun 17 18:22:52 2015 (r284521) +++ stable/10/sys/conf/NOTES Wed Jun 17 18:50:57 2015 (r284522) @@ -2990,3 +2990,6 @@ options RANDOM_YARROW # Yarrow RNG ##options RANDOM_FORTUNA # Fortuna RNG - not yet implemented options RANDOM_DEBUG # Debugging messages options RANDOM_RWFILE # Read and write entropy cache + +# Intel em(4) driver +options EM_MULTIQUEUE # Activate multiqueue features/disable MSI-X Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Wed Jun 17 18:22:52 2015 (r284521) +++ stable/10/sys/conf/options Wed Jun 17 18:50:57 2015 (r284522) @@ -934,3 +934,6 @@ RANDOM_YARROW opt_random.h RANDOM_FORTUNA opt_random.h RANDOM_DEBUG opt_random.h RANDOM_RWFILE opt_random.h + +# Intel em(4) driver +EM_MULTIQUEUE opt_em.h Modified: stable/10/sys/dev/e1000/e1000_defines.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_defines.h Wed Jun 17 18:22:52 2015 (r284521) +++ stable/10/sys/dev/e1000/e1000_defines.h Wed Jun 17 18:50:57 2015 (r284522) @@ -158,11 +158,12 @@ E1000_RXDEXT_STATERR_CXE | \ E1000_RXDEXT_STATERR_RXE) -#define E1000_MRQC_ENABLE_RSS_2Q 0x00000001 +#define E1000_MRQC_RSS_ENABLE_2Q 0x00000001 #define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 #define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 #define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 #define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000 +#define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000 #define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 #define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 Modified: stable/10/sys/dev/e1000/if_em.c ============================================================================== --- stable/10/sys/dev/e1000/if_em.c Wed Jun 17 18:22:52 2015 (r284521) +++ stable/10/sys/dev/e1000/if_em.c Wed Jun 17 18:50:57 2015 (r284522) @@ -32,6 +32,8 @@ ******************************************************************************/ /*$FreeBSD$*/ +#include "opt_em.h" +#include "opt_ddb.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -41,6 +43,10 @@ #include #include +#ifdef DDB +#include +#include +#endif #if __FreeBSD_version >= 800000 #include #endif @@ -52,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -207,7 +214,7 @@ static int em_resume(device_t); #ifdef EM_MULTIQUEUE static int em_mq_start(struct ifnet *, struct mbuf *); static int em_mq_start_locked(struct ifnet *, - struct tx_ring *, struct mbuf *); + struct tx_ring *); static void em_qflush(struct ifnet *); #else static void em_start(struct ifnet *); @@ -297,6 +304,10 @@ static void em_handle_tx(void *context, static void em_handle_rx(void *context, int pending); static void em_handle_link(void *context, int pending); +#ifdef EM_MULTIQUEUE +static void em_enable_vectors_82574(struct adapter *); +#endif + static void em_set_sysctl_value(struct adapter *, const char *, const char *, int *, int); static int em_set_flowcntl(SYSCTL_HANDLER_ARGS); @@ -395,6 +406,20 @@ TUNABLE_INT("hw.em.enable_msix", &em_ena SYSCTL_INT(_hw_em, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &em_enable_msix, 0, "Enable MSI-X interrupts"); +#ifdef EM_MULTIQUEUE +static int em_num_queues = 1; +TUNABLE_INT("hw.em.num_queues", &em_num_queues); +SYSCTL_INT(_hw_em, OID_AUTO, num_queues, CTLFLAG_RDTUN, &em_num_queues, 0, + "82574 only: Number of queues to configure, 0 indicates autoconfigure"); +#endif + +/* +** Global variable to store last used CPU when binding queues +** to CPUs in igb_allocate_msix. Starts at CPU_FIRST and increments when a +** queue is bound to a cpu. +*/ +static int em_last_bind_cpu = -1; + /* How many packets rxeof tries to clean at a time */ static int em_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &em_rx_process_limit); @@ -429,10 +454,10 @@ static int em_probe(device_t dev) { char adapter_name[60]; - u16 pci_vendor_id = 0; - u16 pci_device_id = 0; - u16 pci_subvendor_id = 0; - u16 pci_subdevice_id = 0; + uint16_t pci_vendor_id = 0; + uint16_t pci_device_id = 0; + uint16_t pci_subvendor_id = 0; + uint16_t pci_subdevice_id = 0; em_vendor_info_t *ent; INIT_DEBUGOUT("em_probe: begin"); @@ -559,6 +584,11 @@ em_attach(device_t dev) goto err_pci; } + /* + * Setup MSI/X or MSI if PCI Express + */ + adapter->msix = em_setup_msix(adapter); + e1000_get_bus_info(hw); /* Set up some sysctls for the tunable interrupt delays */ @@ -890,7 +920,7 @@ em_resume(device_t dev) EM_TX_LOCK(txr); #ifdef EM_MULTIQUEUE if (!drbr_empty(ifp, txr->br)) - em_mq_start_locked(ifp, txr, NULL); + em_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); @@ -904,7 +934,70 @@ em_resume(device_t dev) } -#ifdef EM_MULTIQUEUE +#ifndef EM_MULTIQUEUE +static void +em_start_locked(struct ifnet *ifp, struct tx_ring *txr) +{ + struct adapter *adapter = ifp->if_softc; + struct mbuf *m_head; + + EM_TX_LOCK_ASSERT(txr); + + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; + + if (!adapter->link_active) + return; + + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + /* Call cleanup if number of TX descriptors low */ + if (txr->tx_avail <= EM_TX_CLEANUP_THRESHOLD) + em_txeof(txr); + if (txr->tx_avail < EM_MAX_SCATTER) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) + break; + /* + * Encapsulation can modify our pointer, and or make it + * NULL on failure. In that event, we can't requeue. + */ + if (em_xmit(txr, &m_head)) { + if (m_head == NULL) + break; + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + break; + } + + /* Mark the queue as having work */ + if (txr->busy == EM_TX_IDLE) + txr->busy = EM_TX_BUSY; + + /* Send a copy of the frame to the BPF listener */ + ETHER_BPF_MTAP(ifp, m_head); + + } + + return; +} + +static void +em_start(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + EM_TX_LOCK(txr); + em_start_locked(ifp, txr); + EM_TX_UNLOCK(txr); + } + return; +} +#else /* EM_MULTIQUEUE */ /********************************************************************* * Multiqueue Transmit routines * @@ -913,8 +1006,38 @@ em_resume(device_t dev) * than do an immediate send. It is this that is an advantage * in this driver, rather than also having multiple tx queues. **********************************************************************/ +/* +** Multiqueue capable stack interface +*/ static int -em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) +em_mq_start(struct ifnet *ifp, struct mbuf *m) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; + unsigned int i, error; + + if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) + i = m->m_pkthdr.flowid % adapter->num_queues; + else + i = curcpu % adapter->num_queues; + + txr = &adapter->tx_rings[i]; + + error = drbr_enqueue(ifp, txr->br, m); + if (error) + return (error); + + if (EM_TX_TRYLOCK(txr)) { + em_mq_start_locked(ifp, txr); + EM_TX_UNLOCK(txr); + } else + taskqueue_enqueue(txr->tq, &txr->tx_task); + + return (0); +} + +static int +em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr) { struct adapter *adapter = txr->adapter; struct mbuf *next; @@ -922,25 +1045,23 @@ em_mq_start_locked(struct ifnet *ifp, st if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING || adapter->link_active == 0) { - if (m != NULL) - err = drbr_enqueue(ifp, txr->br, m); - return (err); + return (ENETDOWN); } - enq = 0; - if (m != NULL) { - err = drbr_enqueue(ifp, txr->br, m); - if (err) - return (err); - } - /* Process the queue */ while ((next = drbr_peek(ifp, txr->br)) != NULL) { if ((err = em_xmit(txr, &next)) != 0) { - if (next == NULL) + if (next == NULL) { + /* It was freed, move forward */ drbr_advance(ifp, txr->br); - else + } else { + /* + * Still have one left, it may not be + * the same since the transmit function + * may have changed it. + */ drbr_putback(ifp, txr->br, next); + } break; } drbr_advance(ifp, txr->br); @@ -959,31 +1080,13 @@ em_mq_start_locked(struct ifnet *ifp, st if (txr->tx_avail < EM_MAX_SCATTER) em_txeof(txr); - if (txr->tx_avail < EM_MAX_SCATTER) + if (txr->tx_avail < EM_MAX_SCATTER) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; + } return (err); } /* -** Multiqueue capable stack interface -*/ -static int -em_mq_start(struct ifnet *ifp, struct mbuf *m) -{ - struct adapter *adapter = ifp->if_softc; - struct tx_ring *txr = adapter->tx_rings; - int error; - - if (EM_TX_TRYLOCK(txr)) { - error = em_mq_start_locked(ifp, txr, m); - EM_TX_UNLOCK(txr); - } else - error = drbr_enqueue(ifp, txr->br, m); - - return (error); -} - -/* ** Flush all ring buffers */ static void @@ -1001,69 +1104,6 @@ em_qflush(struct ifnet *ifp) } if_qflush(ifp); } -#else /* !EM_MULTIQUEUE */ - -static void -em_start_locked(struct ifnet *ifp, struct tx_ring *txr) -{ - struct adapter *adapter = ifp->if_softc; - struct mbuf *m_head; - - EM_TX_LOCK_ASSERT(txr); - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) - return; - - if (!adapter->link_active) - return; - - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - /* Call cleanup if number of TX descriptors low */ - if (txr->tx_avail <= EM_TX_CLEANUP_THRESHOLD) - em_txeof(txr); - if (txr->tx_avail < EM_MAX_SCATTER) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - break; - } - IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); - if (m_head == NULL) - break; - /* - * Encapsulation can modify our pointer, and or make it - * NULL on failure. In that event, we can't requeue. - */ - if (em_xmit(txr, &m_head)) { - if (m_head == NULL) - break; - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); - break; - } - - /* Mark the queue as having work */ - if (txr->busy == EM_TX_IDLE) - txr->busy = EM_TX_BUSY; - - /* Send a copy of the frame to the BPF listener */ - ETHER_BPF_MTAP(ifp, m_head); - } - - return; -} - -static void -em_start(struct ifnet *ifp) -{ - struct adapter *adapter = ifp->if_softc; - struct tx_ring *txr = adapter->tx_rings; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - EM_TX_LOCK(txr); - em_start_locked(ifp, txr); - EM_TX_UNLOCK(txr); - } - return; -} #endif /* EM_MULTIQUEUE */ /********************************************************************* @@ -1460,7 +1500,7 @@ em_poll(struct ifnet *ifp, enum poll_cmd em_txeof(txr); #ifdef EM_MULTIQUEUE if (!drbr_empty(ifp, txr->br)) - em_mq_start_locked(ifp, txr, NULL); + em_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); @@ -1527,14 +1567,14 @@ em_handle_que(void *context, int pending struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { bool more = em_rxeof(rxr, adapter->rx_process_limit, NULL); + EM_TX_LOCK(txr); em_txeof(txr); #ifdef EM_MULTIQUEUE if (!drbr_empty(ifp, txr->br)) - em_mq_start_locked(ifp, txr, NULL); + em_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); @@ -1568,11 +1608,12 @@ em_msix_tx(void *arg) em_txeof(txr); #ifdef EM_MULTIQUEUE if (!drbr_empty(ifp, txr->br)) - em_mq_start_locked(ifp, txr, NULL); + em_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); #endif + /* Reenable this interrupt */ E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); EM_TX_UNLOCK(txr); @@ -1598,9 +1639,10 @@ em_msix_rx(void *arg) more = em_rxeof(rxr, adapter->rx_process_limit, NULL); if (more) taskqueue_enqueue(rxr->tq, &rxr->rx_task); - else + else { /* Reenable this interrupt */ E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxr->ims); + } return; } @@ -1627,6 +1669,16 @@ em_msix_link(void *arg) } else E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC); + /* + ** Because we must read the ICR for this interrupt + ** it may clear other causes using autoclear, for + ** this reason we simply create a soft interrupt + ** for all these vectors. + */ + if (reg_icr) { + E1000_WRITE_REG(&adapter->hw, + E1000_ICS, adapter->ims); + } return; } @@ -1640,9 +1692,10 @@ em_handle_rx(void *context, int pending) more = em_rxeof(rxr, adapter->rx_process_limit, NULL); if (more) taskqueue_enqueue(rxr->tq, &rxr->rx_task); - else + else { /* Reenable this interrupt */ E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxr->ims); + } } static void @@ -1656,7 +1709,7 @@ em_handle_tx(void *context, int pending) em_txeof(txr); #ifdef EM_MULTIQUEUE if (!drbr_empty(ifp, txr->br)) - em_mq_start_locked(ifp, txr, NULL); + em_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); @@ -1686,7 +1739,7 @@ em_handle_link(void *context, int pendin EM_TX_LOCK(txr); #ifdef EM_MULTIQUEUE if (!drbr_empty(ifp, txr->br)) - em_mq_start_locked(ifp, txr, NULL); + em_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); @@ -2269,7 +2322,7 @@ em_local_timer(void *arg) struct ifnet *ifp = adapter->ifp; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - u32 trigger; + u32 trigger = 0; EM_CORE_LOCK_ASSERT(adapter); @@ -2282,9 +2335,11 @@ em_local_timer(void *arg) e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); /* Mask to use in the irq trigger */ - if (adapter->msix_mem) - trigger = rxr->ims; - else + if (adapter->msix_mem) { + for (int i = 0; i < adapter->num_queues; i++, rxr++) + trigger |= rxr->ims; + rxr = adapter->rx_rings; + } else trigger = E1000_ICS_RXDMT0; /* @@ -2293,7 +2348,6 @@ em_local_timer(void *arg) ** and the HUNG state will be static if set. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { - /* Last cycle a queue was declared hung */ if (txr->busy == EM_TX_HUNG) goto hung; if (txr->busy >= EM_TX_MAXTRIES) @@ -2311,14 +2365,9 @@ em_local_timer(void *arg) return; hung: /* Looks like we're hung */ - device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); - device_printf(adapter->dev, - "Queue(%d) tdh = %d, hw tdt = %d\n", txr->me, - E1000_READ_REG(&adapter->hw, E1000_TDH(txr->me)), - E1000_READ_REG(&adapter->hw, E1000_TDT(txr->me))); - device_printf(adapter->dev,"TX(%d) desc avail = %d," - "Next TX to Clean = %d\n", - txr->me, txr->tx_avail, txr->next_to_clean); + device_printf(adapter->dev, "Watchdog timeout Queue[%d]-- resetting\n", + txr->me); + em_print_debug_info(adapter); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; adapter->watchdog_events++; em_init_locked(adapter); @@ -2370,7 +2419,7 @@ em_update_link_status(struct adapter *ad (hw->mac.type == e1000_82572))) { int tarc0; tarc0 = E1000_READ_REG(hw, E1000_TARC(0)); - tarc0 &= ~SPEED_MODE_BIT; + tarc0 &= ~TARC_SPEED_MODE_BIT; E1000_WRITE_REG(hw, E1000_TARC(0), tarc0); } if (bootverbose) @@ -2486,14 +2535,6 @@ em_allocate_pci_resources(struct adapter rman_get_bushandle(adapter->memory); adapter->hw.hw_addr = (u8 *)&adapter->osdep.mem_bus_space_handle; - /* Default to a single queue */ - adapter->num_queues = 1; - - /* - * Setup MSI/X or MSI if PCI Express - */ - adapter->msix = em_setup_msix(adapter); - adapter->hw.back = &adapter->osdep; return (0); @@ -2568,13 +2609,14 @@ em_allocate_msix(struct adapter *adapter struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; int error, rid, vector = 0; + int cpu_id = 0; /* Make sure all interrupts are disabled */ E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); /* First set up ring resources */ - for (int i = 0; i < adapter->num_queues; i++, txr++, rxr++) { + for (int i = 0; i < adapter->num_queues; i++, rxr++, vector++) { /* RX ring */ rid = vector + 1; @@ -2594,14 +2636,20 @@ em_allocate_msix(struct adapter *adapter return (error); } #if __FreeBSD_version >= 800504 - bus_describe_intr(dev, rxr->res, rxr->tag, "rx %d", i); + bus_describe_intr(dev, rxr->res, rxr->tag, "rx%d", i); #endif - rxr->msix = vector++; /* NOTE increment vector for TX */ + rxr->msix = vector; + + if (em_last_bind_cpu < 0) + em_last_bind_cpu = CPU_FIRST(); + cpu_id = em_last_bind_cpu; + bus_bind_intr(dev, rxr->res, cpu_id); + TASK_INIT(&rxr->rx_task, 0, em_handle_rx, rxr); rxr->tq = taskqueue_create_fast("em_rxq", M_NOWAIT, taskqueue_thread_enqueue, &rxr->tq); - taskqueue_start_threads(&rxr->tq, 1, PI_NET, "%s rxq", - device_get_nameunit(adapter->dev)); + taskqueue_start_threads(&rxr->tq, 1, PI_NET, "%s rxq (cpuid %d)", + device_get_nameunit(adapter->dev), cpu_id); /* ** Set the bit to enable interrupt ** in E1000_IMS -- bits 20 and 21 @@ -2609,8 +2657,13 @@ em_allocate_msix(struct adapter *adapter ** NOTHING to do with the MSIX vector */ rxr->ims = 1 << (20 + i); + adapter->ims |= rxr->ims; adapter->ivars |= (8 | rxr->msix) << (i * 4); + em_last_bind_cpu = CPU_NEXT(em_last_bind_cpu); + } + + for (int i = 0; i < adapter->num_queues; i++, txr++, vector++) { /* TX ring */ rid = vector + 1; txr->res = bus_alloc_resource_any(dev, @@ -2628,14 +2681,20 @@ em_allocate_msix(struct adapter *adapter return (error); } #if __FreeBSD_version >= 800504 - bus_describe_intr(dev, txr->res, txr->tag, "tx %d", i); + bus_describe_intr(dev, txr->res, txr->tag, "tx%d", i); #endif - txr->msix = vector++; /* Increment vector for next pass */ + txr->msix = vector; + + if (em_last_bind_cpu < 0) + em_last_bind_cpu = CPU_FIRST(); + cpu_id = em_last_bind_cpu; + bus_bind_intr(dev, txr->res, cpu_id); + TASK_INIT(&txr->tx_task, 0, em_handle_tx, txr); txr->tq = taskqueue_create_fast("em_txq", M_NOWAIT, taskqueue_thread_enqueue, &txr->tq); - taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", - device_get_nameunit(adapter->dev)); + taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq (cpuid %d)", + device_get_nameunit(adapter->dev), cpu_id); /* ** Set the bit to enable interrupt ** in E1000_IMS -- bits 22 and 23 @@ -2643,13 +2702,16 @@ em_allocate_msix(struct adapter *adapter ** NOTHING to do with the MSIX vector */ txr->ims = 1 << (22 + i); + adapter->ims |= txr->ims; adapter->ivars |= (8 | txr->msix) << (8 + (i * 4)); + + em_last_bind_cpu = CPU_NEXT(em_last_bind_cpu); } /* Link interrupt */ - ++rid; + rid = vector + 1; adapter->res = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &rid, RF_ACTIVE); + SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (!adapter->res) { device_printf(dev,"Unable to allocate " "bus resource: Link interrupt [%d]\n", rid); @@ -2665,7 +2727,7 @@ em_allocate_msix(struct adapter *adapter return (error); } #if __FreeBSD_version >= 800504 - bus_describe_intr(dev, adapter->res, adapter->tag, "link"); + bus_describe_intr(dev, adapter->res, adapter->tag, "link"); #endif adapter->linkvec = vector; adapter->ivars |= (8 | vector) << 16; @@ -2689,9 +2751,8 @@ em_free_pci_resources(struct adapter *ad */ for (int i = 0; i < adapter->num_queues; i++) { txr = &adapter->tx_rings[i]; - rxr = &adapter->rx_rings[i]; /* an early abort? */ - if ((txr == NULL) || (rxr == NULL)) + if (txr == NULL) break; rid = txr->msix +1; if (txr->tag != NULL) { @@ -2701,6 +2762,11 @@ em_free_pci_resources(struct adapter *ad if (txr->res != NULL) bus_release_resource(dev, SYS_RES_IRQ, rid, txr->res); + + rxr = &adapter->rx_rings[i]; + /* an early abort? */ + if (rxr == NULL) + break; rid = rxr->msix +1; if (rxr->tag != NULL) { bus_teardown_intr(dev, rxr->res, rxr->tag); @@ -2750,14 +2816,19 @@ em_setup_msix(struct adapter *adapter) device_t dev = adapter->dev; int val; + /* Nearly always going to use one queue */ + adapter->num_queues = 1; + /* - ** Setup MSI/X for Hartwell: tests have shown - ** use of two queues to be unstable, and to - ** provide no great gain anyway, so we simply - ** seperate the interrupts and use a single queue. + ** Try using MSI-X for Hartwell adapters */ if ((adapter->hw.mac.type == e1000_82574) && (em_enable_msix == TRUE)) { +#ifdef EM_MULTIQUEUE + adapter->num_queues = (em_num_queues == 1) ? 1 : 2; + if (adapter->num_queues > 1) + em_enable_vectors_82574(adapter); +#endif /* Map the MSIX BAR */ int rid = PCIR_BAR(EM_MSIX_BAR); adapter->msix_mem = bus_alloc_resource_any(dev, @@ -2769,16 +2840,34 @@ em_setup_msix(struct adapter *adapter) goto msi; } val = pci_msix_count(dev); - /* We only need/want 3 vectors */ - if (val >= 3) - val = 3; - else { - device_printf(adapter->dev, - "MSIX: insufficient vectors, using MSI\n"); - goto msi; + +#ifdef EM_MULTIQUEUE + /* We need 5 vectors in the multiqueue case */ + if (adapter->num_queues > 1 ) { + if (val >= 5) + val = 5; + else { + adapter->num_queues = 1; + device_printf(adapter->dev, + "Insufficient MSIX vectors for >1 queue, " + "using single queue...\n"); + goto msix_one; + } + } else { +msix_one: +#endif + if (val >= 3) + val = 3; + else { + device_printf(adapter->dev, + "Insufficient MSIX vectors, using MSI\n"); + goto msi; + } +#ifdef EM_MULTIQUEUE } +#endif - if ((pci_alloc_msix(dev, &val) == 0) && (val == 3)) { + if ((pci_alloc_msix(dev, &val) == 0)) { device_printf(adapter->dev, "Using MSIX interrupts " "with %d vectors\n", val); @@ -2799,7 +2888,7 @@ msi: } val = 1; if (pci_alloc_msi(dev, &val) == 0) { - device_printf(adapter->dev,"Using an MSI interrupt\n"); + device_printf(adapter->dev, "Using an MSI interrupt\n"); return (val); } /* Should only happen due to manual configuration */ @@ -3441,7 +3530,7 @@ em_initialize_transmit_unit(struct adapt { struct tx_ring *txr = adapter->tx_rings; struct e1000_hw *hw = &adapter->hw; - u32 tctl, tarc, tipg = 0; + u32 tctl, txdctl = 0, tarc, tipg = 0; INIT_DEBUGOUT("em_initialize_transmit_unit: begin"); @@ -3463,6 +3552,15 @@ em_initialize_transmit_unit(struct adapt E1000_READ_REG(&adapter->hw, E1000_TDLEN(i))); txr->busy = EM_TX_IDLE; + txdctl = 0; /* clear txdctl */ + txdctl |= 0x1f; /* PTHRESH */ + txdctl |= 1 << 8; /* HTHRESH */ + txdctl |= 1 << 16;/* WTHRESH */ + txdctl |= 1 << 22; /* Reserved bit 22 must always be 1 */ + txdctl |= E1000_TXDCTL_GRAN; + txdctl |= 1 << 25; /* LWTHRESH */ + + E1000_WRITE_REG(hw, E1000_TXDCTL(i), txdctl); } /* Set the default values for the Tx Inter Packet Gap timer */ @@ -3493,15 +3591,25 @@ em_initialize_transmit_unit(struct adapt if ((adapter->hw.mac.type == e1000_82571) || (adapter->hw.mac.type == e1000_82572)) { tarc = E1000_READ_REG(&adapter->hw, E1000_TARC(0)); - tarc |= SPEED_MODE_BIT; + tarc |= TARC_SPEED_MODE_BIT; E1000_WRITE_REG(&adapter->hw, E1000_TARC(0), tarc); } else if (adapter->hw.mac.type == e1000_80003es2lan) { + /* errata: program both queues to unweighted RR */ tarc = E1000_READ_REG(&adapter->hw, E1000_TARC(0)); tarc |= 1; E1000_WRITE_REG(&adapter->hw, E1000_TARC(0), tarc); tarc = E1000_READ_REG(&adapter->hw, E1000_TARC(1)); tarc |= 1; E1000_WRITE_REG(&adapter->hw, E1000_TARC(1), tarc); + } else if (adapter->hw.mac.type == e1000_82574) { + tarc = E1000_READ_REG(&adapter->hw, E1000_TARC(0)); + tarc |= TARC_ERRATA_BIT; + if ( adapter->num_queues > 1) { + tarc |= (TARC_COMPENSATION_MODE | TARC_MQ_FIX); + E1000_WRITE_REG(&adapter->hw, E1000_TARC(0), tarc); + E1000_WRITE_REG(&adapter->hw, E1000_TARC(1), tarc); + } else + E1000_WRITE_REG(&adapter->hw, E1000_TARC(0), tarc); } adapter->txd_cmd = E1000_TXD_CMD_IFCS; @@ -3932,8 +4040,9 @@ em_txeof(struct tx_ring *txr) * TX lock which, with a single queue, guarantees * sanity. */ - if (txr->tx_avail >= EM_MAX_SCATTER) + if (txr->tx_avail >= EM_MAX_SCATTER) { ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + } /* Disable hang detection if all clean */ if (txr->tx_avail == adapter->num_tx_desc) @@ -4305,6 +4414,9 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(&adapter->hw, E1000_RADV, adapter->rx_abs_int_delay.value); + + E1000_WRITE_REG(&adapter->hw, E1000_RDTR, + adapter->rx_int_delay.value); /* * Set the interrupt throttling rate. Value is calculated * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) @@ -4316,20 +4428,65 @@ em_initialize_receive_unit(struct adapte ** using the EITR register (82574 only) */ if (hw->mac.type == e1000_82574) { + u32 rfctl; for (int i = 0; i < 4; i++) E1000_WRITE_REG(hw, E1000_EITR_82574(i), DEFAULT_ITR); /* Disable accelerated acknowledge */ - E1000_WRITE_REG(hw, E1000_RFCTL, E1000_RFCTL_ACK_DIS); + rfctl = E1000_READ_REG(hw, E1000_RFCTL); + rfctl |= E1000_RFCTL_ACK_DIS; + E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); } rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); - if (ifp->if_capenable & IFCAP_RXCSUM) + if (ifp->if_capenable & IFCAP_RXCSUM) { +#ifdef EM_MULTIQUEUE + rxcsum |= E1000_RXCSUM_TUOFL | + E1000_RXCSUM_IPOFL | + E1000_RXCSUM_PCSD; +#else rxcsum |= E1000_RXCSUM_TUOFL; - else +#endif + } else rxcsum &= ~E1000_RXCSUM_TUOFL; + E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum); +#ifdef EM_MULTIQUEUE + if (adapter->num_queues > 1) { + uint32_t rss_key[10]; + uint32_t reta; + int i; + + /* + * Configure RSS key + */ + arc4rand(rss_key, sizeof(rss_key), 0); + for (i = 0; i < 10; ++i) + E1000_WRITE_REG_ARRAY(hw,E1000_RSSRK(0), i, rss_key[i]); + + /* + * Configure RSS redirect table in following fashion: + * (hash & ring_cnt_mask) == rdr_table[(hash & rdr_table_mask)] + */ + reta = 0; + for (i = 0; i < 4; ++i) { + uint32_t q; + q = (i % adapter->num_queues) << 7; + reta |= q << (8 * i); + } + for (i = 0; i < 32; ++i) + E1000_WRITE_REG(hw, E1000_RETA(i), reta); + + E1000_WRITE_REG(hw, E1000_MRQC, E1000_MRQC_RSS_ENABLE_2Q | + E1000_MRQC_RSS_FIELD_IPV4_TCP | + E1000_MRQC_RSS_FIELD_IPV4 | + E1000_MRQC_RSS_FIELD_IPV6_TCP_EX | + E1000_MRQC_RSS_FIELD_IPV6_EX | + E1000_MRQC_RSS_FIELD_IPV6 | + E1000_MRQC_RSS_FIELD_IPV6_TCP); + } +#endif /* ** XXX TEMPORARY WORKAROUND: on some systems with 82573 ** long latencies are observed, like Lenovo X60. This @@ -4362,13 +4519,30 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDT(i), rdt); } - /* Set PTHRESH for improved jumbo performance */ + /* + * Set PTHRESH for improved jumbo performance + * According to 10.2.5.11 of Intel 82574 Datasheet, + * RXDCTL(1) is written whenever RXDCTL(0) is written. + * Only write to RXDCTL(1) if there is a need for different + * settings. + */ if (((adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_pch2lan) || (adapter->hw.mac.type == e1000_ich10lan)) && (ifp->if_mtu > ETHERMTU)) { u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); + } else if ((adapter->hw.mac.type == e1000_82574) && + (ifp->if_mtu > ETHERMTU)) { + for (int i = 0; i < adapter->num_queues; i++) { + u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i)); + + rxdctl |= 0x20; /* PTHRESH */ + rxdctl |= 4 << 8; /* HTHRESH */ + rxdctl |= 4 << 16;/* WTHRESH */ + rxdctl |= 1 << 24; /* Switch to granularity */ + E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl); + } } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 19:03:34 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3258D977; Wed, 17 Jun 2015 19:03:34 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E8CCB36; Wed, 17 Jun 2015 19:03:34 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HJ3XHp070685; Wed, 17 Jun 2015 19:03:33 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HJ3XxX070679; Wed, 17 Jun 2015 19:03:33 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201506171903.t5HJ3XxX070679@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 17 Jun 2015 19:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284523 - stable/10/usr.bin/mkimg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 19:03:34 -0000 Author: marcel Date: Wed Jun 17 19:03:32 2015 New Revision: 284523 URL: https://svnweb.freebsd.org/changeset/base/284523 Log: MFC 279125, 279126, 279128, 279139: Add the -c option for specifying the capacity of the disk image. Bump the version to 20150222. Modified: stable/10/usr.bin/mkimg/Makefile stable/10/usr.bin/mkimg/mkimg.1 stable/10/usr.bin/mkimg/mkimg.c stable/10/usr.bin/mkimg/scheme.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mkimg/Makefile ============================================================================== --- stable/10/usr.bin/mkimg/Makefile Wed Jun 17 18:50:57 2015 (r284522) +++ stable/10/usr.bin/mkimg/Makefile Wed Jun 17 19:03:32 2015 (r284523) @@ -4,7 +4,7 @@ PROG= mkimg SRCS= format.c image.c mkimg.c scheme.c MAN= mkimg.1 -MKIMG_VERSION=20141211 +MKIMG_VERSION=20150222 mkimg.o: Makefile CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION} Modified: stable/10/usr.bin/mkimg/mkimg.1 ============================================================================== --- stable/10/usr.bin/mkimg/mkimg.1 Wed Jun 17 18:50:57 2015 (r284522) +++ stable/10/usr.bin/mkimg/mkimg.1 Wed Jun 17 19:03:32 2015 (r284523) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2014 +.Dd February 22, 2015 .Dt MKIMG 1 .Os .Sh NAME @@ -37,13 +37,12 @@ .Op Fl S Ar secsz .Op Fl T Ar tracksz .Op Fl b Ar bootcode +.Op Fl c Ar capacity .Op Fl f Ar format .Op Fl o Ar outfile .Op Fl v .Op Fl y -.Fl s Ar scheme -.Fl p Ar partition -.Op Fl p Ar partition ... +.Op Fl s Ar scheme Op Fl p Ar partition ... .Nm .Ar --formats | --schemes | --version .Sh DESCRIPTION @@ -109,13 +108,29 @@ utility will use the (physical) block si partitions and to round the size of the disk image. .Pp The -.Op Fl v +.Fl c +option can be used to specify a minimal capacity for the disk image. +Use this option without the +.Fl s +and +.Fl p +options to create an empty disk image with the given (virtual) size. +An empty partition table can be written to the disk when specifying a +partitioning scheme with the +.Fl s +option, but without specifying any partitions. +When the size required to for all the partitions is larger than the +given capacity, then the disk image will be larger than the capacity +given. +.Pp +The +.Fl v option increases the level of output that the .Nm utility prints. .Pp The -.Op Fl y +.Fl y option is used for testing purposes only and is not to be used in production. When present, the .Nm Modified: stable/10/usr.bin/mkimg/mkimg.c ============================================================================== --- stable/10/usr.bin/mkimg/mkimg.c Wed Jun 17 18:50:57 2015 (r284522) +++ stable/10/usr.bin/mkimg/mkimg.c Wed Jun 17 19:03:32 2015 (r284523) @@ -60,6 +60,8 @@ static struct option longopts[] = { { NULL, 0, NULL, 0 } }; +static uint64_t capacity; + struct partlisthead partlist = STAILQ_HEAD_INITIALIZER(partlist); u_int nparts = 0; @@ -147,6 +149,7 @@ usage(const char *why) fprintf(stderr, "\t--version\t- show version information\n"); fputc('\n', stderr); fprintf(stderr, "\t-b \t- file containing boot code\n"); + fprintf(stderr, "\t-c \t- capacity (in bytes) of the disk\n"); fprintf(stderr, "\t-f \n"); fprintf(stderr, "\t-o \t- file to write image into\n"); fprintf(stderr, "\t-p \n"); @@ -179,7 +182,7 @@ usage(const char *why) } static int -parse_number(u_int *valp, u_int min, u_int max, const char *arg) +parse_uint32(uint32_t *valp, uint32_t min, uint32_t max, const char *arg) { uint64_t val; @@ -187,7 +190,20 @@ parse_number(u_int *valp, u_int min, u_i return (errno); if (val > UINT_MAX || val < (uint64_t)min || val > (uint64_t)max) return (EINVAL); - *valp = (u_int)val; + *valp = (uint32_t)val; + return (0); +} + +static int +parse_uint64(uint64_t *valp, uint64_t min, uint64_t max, const char *arg) +{ + uint64_t val; + + if (expand_number(arg, &val) == -1) + return (errno); + if (val < min || val > max) + return (EINVAL); + *valp = val; return (0); } @@ -376,6 +392,17 @@ mkimg_uuid(struct uuid *uuid) memcpy(uuid, gen, sizeof(uuid_t)); } +static int +capacity_resize(lba_t end) +{ + lba_t capsz; + + capsz = (capacity + secsz - 1) / secsz; + if (end >= capsz) + return (0); + return (image_set_size(capsz)); +} + static void mkimg(void) { @@ -437,12 +464,14 @@ mkimg(void) block = scheme_metadata(SCHEME_META_IMG_END, block); error = image_set_size(block); if (!error) + error = capacity_resize(block); + if (!error) error = format_resize(block); if (error) errc(EX_IOERR, error, "image sizing"); block = image_get_size(); ncyls = block / (nsecs * nheads); - error = (scheme_write(block)); + error = scheme_write(block); if (error) errc(EX_IOERR, error, "writing metadata"); } @@ -455,7 +484,7 @@ main(int argc, char *argv[]) bcfd = -1; outfd = 1; /* Write to stdout by default */ - while ((c = getopt_long(argc, argv, "b:f:o:p:s:vyH:P:S:T:", + while ((c = getopt_long(argc, argv, "b:c:f:o:p:s:vyH:P:S:T:", longopts, NULL)) != -1) { switch (c) { case 'b': /* BOOT CODE */ @@ -465,6 +494,11 @@ main(int argc, char *argv[]) if (bcfd == -1) err(EX_UNAVAILABLE, "%s", optarg); break; + case 'c': /* CAPACITY */ + error = parse_uint64(&capacity, 1, OFF_MAX, optarg); + if (error) + errc(EX_DATAERR, error, "capacity in bytes"); + break; case 'f': /* OUTPUT FORMAT */ if (format_selected() != NULL) usage("multiple formats given"); @@ -499,26 +533,26 @@ main(int argc, char *argv[]) verbose++; break; case 'H': /* GEOMETRY: HEADS */ - error = parse_number(&nheads, 1, 255, optarg); + error = parse_uint32(&nheads, 1, 255, optarg); if (error) errc(EX_DATAERR, error, "number of heads"); break; case 'P': /* GEOMETRY: PHYSICAL SECTOR SIZE */ - error = parse_number(&blksz, 512, INT_MAX+1U, optarg); + error = parse_uint32(&blksz, 512, INT_MAX+1U, optarg); if (error == 0 && !pwr_of_two(blksz)) error = EINVAL; if (error) errc(EX_DATAERR, error, "physical sector size"); break; case 'S': /* GEOMETRY: LOGICAL SECTOR SIZE */ - error = parse_number(&secsz, 512, INT_MAX+1U, optarg); + error = parse_uint32(&secsz, 512, INT_MAX+1U, optarg); if (error == 0 && !pwr_of_two(secsz)) error = EINVAL; if (error) errc(EX_DATAERR, error, "logical sector size"); break; case 'T': /* GEOMETRY: TRACK SIZE */ - error = parse_number(&nsecs, 1, 63, optarg); + error = parse_uint32(&nsecs, 1, 63, optarg); if (error) errc(EX_DATAERR, error, "track size"); break; @@ -541,9 +575,9 @@ main(int argc, char *argv[]) if (argc > optind) usage("trailing arguments"); - if (scheme_selected() == NULL) + if (scheme_selected() == NULL && nparts > 0) usage("no scheme"); - if (nparts == 0) + if (nparts == 0 && capacity == 0) usage("no partitions"); if (secsz > blksz) { @@ -577,8 +611,9 @@ main(int argc, char *argv[]) fprintf(stderr, "Sectors per track: %u\n", nsecs); fprintf(stderr, "Number of heads: %u\n", nheads); fputc('\n', stderr); - fprintf(stderr, "Partitioning scheme: %s\n", - scheme_selected()->name); + if (scheme_selected()) + fprintf(stderr, "Partitioning scheme: %s\n", + scheme_selected()->name); fprintf(stderr, "Output file format: %s\n", format_selected()->name); fputc('\n', stderr); Modified: stable/10/usr.bin/mkimg/scheme.c ============================================================================== --- stable/10/usr.bin/mkimg/scheme.c Wed Jun 17 18:50:57 2015 (r284522) +++ stable/10/usr.bin/mkimg/scheme.c Wed Jun 17 19:03:32 2015 (r284523) @@ -31,8 +31,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -104,7 +106,7 @@ scheme_bootcode(int fd) { struct stat sb; - if (scheme->bootcode == 0) + if (scheme == NULL || scheme->bootcode == 0) return (ENXIO); if (fstat(fd, &sb) == -1) @@ -130,6 +132,8 @@ scheme_check_part(struct part *p) struct mkimg_alias *iter; enum alias alias; + assert(scheme != NULL); + /* Check the partition type alias */ alias = scheme_parse_alias(p->alias); if (alias == ALIAS_NONE) @@ -158,29 +162,26 @@ u_int scheme_max_parts(void) { - return (scheme->nparts); + return ((scheme == NULL) ? 0 : scheme->nparts); } u_int scheme_max_secsz(void) { - return (scheme->maxsecsz); + return ((scheme == NULL) ? INT_MAX+1U : scheme->maxsecsz); } lba_t scheme_metadata(u_int where, lba_t start) { - return (scheme->metadata(where, start)); + return ((scheme == NULL) ? start : scheme->metadata(where, start)); } int scheme_write(lba_t end) { - int error; - end = image_get_size(); - error = scheme->write(end, bootcode); - return (error); + return ((scheme == NULL) ? 0 : scheme->write(end, bootcode)); } From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 19:12:19 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 52FFECF0; Wed, 17 Jun 2015 19:12:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26130DB9; Wed, 17 Jun 2015 19:12:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HJCJ8R075517; Wed, 17 Jun 2015 19:12:19 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HJCI8k075515; Wed, 17 Jun 2015 19:12:18 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201506171912.t5HJCI8k075515@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 17 Jun 2015 19:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284524 - stable/10/lib/libc/locale X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 19:12:19 -0000 Author: delphij Date: Wed Jun 17 19:12:18 2015 New Revision: 284524 URL: https://svnweb.freebsd.org/changeset/base/284524 Log: MFC r264038 (theraven): Fix an issue where the locale and rune locale could become out of sync, causing mb* functions (and similar) to be called with the wrong data (possibly a null pointer, causing a crash). PR: standards/188036 Modified: stable/10/lib/libc/locale/setrunelocale.c stable/10/lib/libc/locale/xlocale.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/locale/setrunelocale.c ============================================================================== --- stable/10/lib/libc/locale/setrunelocale.c Wed Jun 17 19:03:32 2015 (r284523) +++ stable/10/lib/libc/locale/setrunelocale.c Wed Jun 17 19:12:18 2015 (r284524) @@ -202,6 +202,8 @@ __set_thread_rune_locale(locale_t loc) if (loc == NULL) { _ThreadRuneLocale = &_DefaultRuneLocale; + } else if (loc == LC_GLOBAL_LOCALE) { + _ThreadRuneLocale = 0; } else { _ThreadRuneLocale = XLOCALE_CTYPE(loc)->runes; } Modified: stable/10/lib/libc/locale/xlocale.c ============================================================================== --- stable/10/lib/libc/locale/xlocale.c Wed Jun 17 19:03:32 2015 (r284523) +++ stable/10/lib/libc/locale/xlocale.c Wed Jun 17 19:12:18 2015 (r284524) @@ -154,23 +154,24 @@ __get_locale(void) static void set_thread_locale(locale_t loc) { + locale_t l = (loc == LC_GLOBAL_LOCALE) ? 0 : loc; _once(&once_control, init_key); - if (NULL != loc) { - xlocale_retain((struct xlocale_refcounted*)loc); + if (NULL != l) { + xlocale_retain((struct xlocale_refcounted*)l); } locale_t old = pthread_getspecific(locale_info_key); - if ((NULL != old) && (loc != old)) { + if ((NULL != old) && (l != old)) { xlocale_release((struct xlocale_refcounted*)old); } if (fake_tls) { - thread_local_locale = loc; + thread_local_locale = l; } else { - pthread_setspecific(locale_info_key, loc); + pthread_setspecific(locale_info_key, l); } #ifndef __NO_TLS - __thread_locale = loc; + __thread_locale = l; __set_thread_rune_locale(loc); #endif } @@ -361,9 +362,6 @@ locale_t uselocale(locale_t loc) { locale_t old = get_thread_locale(); if (NULL != loc) { - if (LC_GLOBAL_LOCALE == loc) { - loc = NULL; - } set_thread_locale(loc); } return (old ? old : LC_GLOBAL_LOCALE); From owner-svn-src-stable-10@FreeBSD.ORG Wed Jun 17 22:52:13 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D6A4896; Wed, 17 Jun 2015 22:52:13 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF830D2B; Wed, 17 Jun 2015 22:52:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5HMqCIM085173; Wed, 17 Jun 2015 22:52:12 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5HMqCGk085172; Wed, 17 Jun 2015 22:52:12 GMT (envelope-from np@FreeBSD.org) Message-Id: <201506172252.t5HMqCGk085172@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Jun 2015 22:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284530 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 22:52:13 -0000 Author: np Date: Wed Jun 17 22:52:12 2015 New Revision: 284530 URL: https://svnweb.freebsd.org/changeset/base/284530 Log: MFC r277229: Use parentheses instead of close proximity to ensure layer + 1 is evaluated before the rest of the expression. Modified: stable/10/sys/ofed/include/linux/linux_idr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/linux_idr.c ============================================================================== --- stable/10/sys/ofed/include/linux/linux_idr.c Wed Jun 17 22:44:27 2015 (r284529) +++ stable/10/sys/ofed/include/linux/linux_idr.c Wed Jun 17 22:52:12 2015 (r284530) @@ -418,7 +418,7 @@ restart: * to be rare. */ if (idx == IDR_SIZE) { - starting_id = id + (1 << (layer+1 * IDR_BITS)); + starting_id = id + (1 << ((layer + 1) * IDR_BITS)); goto restart; } if (idx > sidx) From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 13:46:33 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3328C21; Thu, 18 Jun 2015 13:46:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 947FD1DA; Thu, 18 Jun 2015 13:46:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IDkXsu021677; Thu, 18 Jun 2015 13:46:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IDkXLb021676; Thu, 18 Jun 2015 13:46:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201506181346.t5IDkXLb021676@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 18 Jun 2015 13:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284548 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 13:46:33 -0000 Author: kib Date: Thu Jun 18 13:46:32 2015 New Revision: 284548 URL: https://svnweb.freebsd.org/changeset/base/284548 Log: MFC r284178: Add barriers when updating and reading th_generation. MFC r284256: Tweaks for r284178. Modified: stable/10/sys/kern/kern_tc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_tc.c ============================================================================== --- stable/10/sys/kern/kern_tc.c Thu Jun 18 13:45:07 2015 (r284547) +++ stable/10/sys/kern/kern_tc.c Thu Jun 18 13:46:32 2015 (r284548) @@ -70,7 +70,7 @@ struct timehands { struct timeval th_microtime; struct timespec th_nanotime; /* Fields not to be copied in tc_windup start with th_generation. */ - volatile u_int th_generation; + u_int th_generation; struct timehands *th_next; }; @@ -189,6 +189,33 @@ tc_delta(struct timehands *th) tc->tc_counter_mask); } +static inline u_int +tc_getgen(struct timehands *th) +{ + +#ifdef SMP + return (atomic_load_acq_int(&th->th_generation)); +#else + u_int gen; + + gen = th->th_generation; + __compiler_membar(); + return (gen); +#endif +} + +static inline void +tc_setgen(struct timehands *th, u_int newgen) +{ + +#ifdef SMP + atomic_store_rel_int(&th->th_generation, newgen); +#else + __compiler_membar(); + th->th_generation = newgen; +#endif +} + /* * Functions for reading the time. We have to loop until we are sure that * the timehands that we operated on was not updated under our feet. See @@ -204,10 +231,10 @@ fbclock_binuptime(struct bintime *bt) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *bt = th->th_offset; bintime_addx(bt, th->th_scale * tc_delta(th)); - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -262,9 +289,9 @@ fbclock_getbinuptime(struct bintime *bt) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *bt = th->th_offset; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -275,9 +302,9 @@ fbclock_getnanouptime(struct timespec *t do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); bintime2timespec(&th->th_offset, tsp); - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -288,9 +315,9 @@ fbclock_getmicrouptime(struct timeval *t do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); bintime2timeval(&th->th_offset, tvp); - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -301,9 +328,9 @@ fbclock_getbintime(struct bintime *bt) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *bt = th->th_offset; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); bintime_add(bt, &boottimebin); } @@ -315,9 +342,9 @@ fbclock_getnanotime(struct timespec *tsp do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *tsp = th->th_nanotime; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -328,9 +355,9 @@ fbclock_getmicrotime(struct timeval *tvp do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *tvp = th->th_microtime; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } #else /* !FFCLOCK */ void @@ -341,10 +368,10 @@ binuptime(struct bintime *bt) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *bt = th->th_offset; bintime_addx(bt, th->th_scale * tc_delta(th)); - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -399,9 +426,9 @@ getbinuptime(struct bintime *bt) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *bt = th->th_offset; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -412,9 +439,9 @@ getnanouptime(struct timespec *tsp) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); bintime2timespec(&th->th_offset, tsp); - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -425,9 +452,9 @@ getmicrouptime(struct timeval *tvp) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); bintime2timeval(&th->th_offset, tvp); - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -438,9 +465,9 @@ getbintime(struct bintime *bt) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *bt = th->th_offset; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); bintime_add(bt, &boottimebin); } @@ -452,9 +479,9 @@ getnanotime(struct timespec *tsp) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *tsp = th->th_nanotime; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } void @@ -465,9 +492,9 @@ getmicrotime(struct timeval *tvp) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *tvp = th->th_microtime; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } #endif /* FFCLOCK */ @@ -880,11 +907,11 @@ ffclock_read_counter(ffcounter *ffcount) */ do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); ffth = fftimehands; delta = tc_delta(th); *ffcount = ffth->tick_ffcount; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); *ffcount += delta; } @@ -988,9 +1015,9 @@ dtrace_getnanotime(struct timespec *tsp) do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); *tsp = th->th_nanotime; - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); } /* @@ -1028,7 +1055,7 @@ sysclock_getsnapshot(struct sysclock_sna do { th = timehands; - gen = th->th_generation; + gen = tc_getgen(th); fbi->th_scale = th->th_scale; fbi->tick_time = th->th_offset; #ifdef FFCLOCK @@ -1042,7 +1069,7 @@ sysclock_getsnapshot(struct sysclock_sna #endif if (!fast) delta = tc_delta(th); - } while (gen == 0 || gen != th->th_generation); + } while (gen == 0 || gen != tc_getgen(th)); clock_snap->delta = delta; clock_snap->sysclock_active = sysclock_active; @@ -1260,7 +1287,7 @@ tc_windup(void) tho = timehands; th = tho->th_next; ogen = th->th_generation; - th->th_generation = 0; + tc_setgen(th, 0); bcopy(tho, th, offsetof(struct timehands, th_generation)); /* @@ -1377,7 +1404,7 @@ tc_windup(void) */ if (++ogen == 0) ogen = 1; - th->th_generation = ogen; + tc_setgen(th, ogen); /* Go live with the new struct timehands. */ #ifdef FFCLOCK @@ -1643,13 +1670,13 @@ pps_capture(struct pps_state *pps) KASSERT(pps != NULL, ("NULL pps pointer in pps_capture")); th = timehands; - pps->capgen = th->th_generation; + pps->capgen = tc_getgen(th); pps->capth = th; #ifdef FFCLOCK pps->capffth = fftimehands; #endif pps->capcount = th->th_counter->tc_get_timecount(th->th_counter); - if (pps->capgen != th->th_generation) + if (pps->capgen != tc_getgen(th)) pps->capgen = 0; } @@ -1669,7 +1696,7 @@ pps_event(struct pps_state *pps, int eve KASSERT(pps != NULL, ("NULL pps pointer in pps_event")); /* If the timecounter was wound up underneath us, bail out. */ - if (pps->capgen == 0 || pps->capgen != pps->capth->th_generation) + if (pps->capgen == 0 || pps->capgen != tc_getgen(pps->capth)) return; /* Things would be easier with arrays. */ @@ -1719,7 +1746,7 @@ pps_event(struct pps_state *pps, int eve bintime2timespec(&bt, &ts); /* If the timecounter was wound up underneath us, bail out. */ - if (pps->capgen != pps->capth->th_generation) + if (pps->capgen != tc_getgen(pps->capth)) return; *pcount = pps->capcount; From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 15:41:10 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A37F646C; Thu, 18 Jun 2015 15:41:10 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 915DA3A5; Thu, 18 Jun 2015 15:41:10 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IFfAnT078036; Thu, 18 Jun 2015 15:41:10 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IFfA3E078035; Thu, 18 Jun 2015 15:41:10 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201506181541.t5IFfA3E078035@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 18 Jun 2015 15:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284554 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 15:41:10 -0000 Author: arybchik Date: Thu Jun 18 15:41:09 2015 New Revision: 284554 URL: https://svnweb.freebsd.org/changeset/base/284554 Log: sfxge: use if_initbaudrate() to set interface baudrate It is required to cope with u_long limit for 10 Gbps in a right way. It is a direct commit to stable/10 since head differs (head does not have if_initbaudrate(), if_baudrate is simply uint64_t). Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D2849 Modified: stable/10/sys/dev/sfxge/sfxge_port.c Modified: stable/10/sys/dev/sfxge/sfxge_port.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_port.c Thu Jun 18 14:29:46 2015 (r284553) +++ stable/10/sys/dev/sfxge/sfxge_port.c Thu Jun 18 15:41:09 2015 (r284554) @@ -224,14 +224,14 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLE #endif /* SFXGE_HAVE_PAUSE_MEDIAOPTS */ -static const u_long sfxge_link_baudrate[EFX_LINK_NMODES] = { +static const uint64_t sfxge_link_baudrate[EFX_LINK_NMODES] = { [EFX_LINK_10HDX] = IF_Mbps(10), [EFX_LINK_10FDX] = IF_Mbps(10), [EFX_LINK_100HDX] = IF_Mbps(100), [EFX_LINK_100FDX] = IF_Mbps(100), [EFX_LINK_1000HDX] = IF_Gbps(1), [EFX_LINK_1000FDX] = IF_Gbps(1), - [EFX_LINK_10000FDX] = MIN(IF_Gbps(10ULL), ULONG_MAX), + [EFX_LINK_10000FDX] = IF_Gbps(10), }; void @@ -250,7 +250,7 @@ sfxge_mac_link_update(struct sfxge_softc /* Push link state update to the OS */ link_state = (port->link_mode != EFX_LINK_DOWN ? LINK_STATE_UP : LINK_STATE_DOWN); - sc->ifnet->if_baudrate = sfxge_link_baudrate[port->link_mode]; + if_initbaudrate(sc->ifnet, sfxge_link_baudrate[port->link_mode]); if_link_state_change(sc->ifnet, link_state); } From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 15:46:41 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92843732; Thu, 18 Jun 2015 15:46:41 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C47D66C; Thu, 18 Jun 2015 15:46:41 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IFkfWB079502; Thu, 18 Jun 2015 15:46:41 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IFke0C079485; Thu, 18 Jun 2015 15:46:40 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201506181546.t5IFke0C079485@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 18 Jun 2015 15:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284555 - in stable/10: share/man/man4 sys/conf sys/dev/sfxge sys/dev/sfxge/common sys/modules/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 15:46:41 -0000 Author: arybchik Date: Thu Jun 18 15:46:39 2015 New Revision: 284555 URL: https://svnweb.freebsd.org/changeset/base/284555 Log: MFC: r283514 sfxge: add 7xxx NICs family support Support 7xxx adapters including firmware-assisted TSO and VLAN tagging: - Solarflare Flareon Ultra 7000 series 10/40G adapters: - Solarflare SFN7042Q QSFP+ Server Adapter - Solarflare SFN7142Q QSFP+ Server Adapter - Solarflare Flareon Ultra 7000 series 10G adapters: - Solarflare SFN7022F SFP+ Server Adapter - Solarflare SFN7122F SFP+ Server Adapter - Solarflare SFN7322F Precision Time Synchronization Server Adapter - Solarflare Flareon 7000 series 10G adapters: - Solarflare SFN7002F SFP+ Server Adapter Support utilities to configure adapters and update firmware. The work is done by Solarflare developers (Andy Moreton, Andrew Lee and many others), Artem V. Andreev and me. Sponsored by: Solarflare Communications, Inc. Added: stable/10/sys/dev/sfxge/common/ef10_tlv_layout.h - copied unchanged from r283514, head/sys/dev/sfxge/common/ef10_tlv_layout.h stable/10/sys/dev/sfxge/common/efx_check.h - copied unchanged from r283514, head/sys/dev/sfxge/common/efx_check.h stable/10/sys/dev/sfxge/common/efx_crc32.c - copied unchanged from r283514, head/sys/dev/sfxge/common/efx_crc32.c stable/10/sys/dev/sfxge/common/efx_hash.c - copied unchanged from r283514, head/sys/dev/sfxge/common/efx_hash.c stable/10/sys/dev/sfxge/common/efx_phy_ids.h - copied unchanged from r283514, head/sys/dev/sfxge/common/efx_phy_ids.h stable/10/sys/dev/sfxge/common/hunt_ev.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_ev.c stable/10/sys/dev/sfxge/common/hunt_filter.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_filter.c stable/10/sys/dev/sfxge/common/hunt_impl.h - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_impl.h stable/10/sys/dev/sfxge/common/hunt_intr.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_intr.c stable/10/sys/dev/sfxge/common/hunt_mac.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_mac.c stable/10/sys/dev/sfxge/common/hunt_mcdi.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_mcdi.c stable/10/sys/dev/sfxge/common/hunt_nic.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_nic.c stable/10/sys/dev/sfxge/common/hunt_nvram.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_nvram.c stable/10/sys/dev/sfxge/common/hunt_phy.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_phy.c stable/10/sys/dev/sfxge/common/hunt_rx.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_rx.c stable/10/sys/dev/sfxge/common/hunt_sram.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_sram.c stable/10/sys/dev/sfxge/common/hunt_tx.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_tx.c stable/10/sys/dev/sfxge/common/hunt_vpd.c - copied unchanged from r283514, head/sys/dev/sfxge/common/hunt_vpd.c stable/10/sys/dev/sfxge/common/mcdi_mon.c - copied unchanged from r283514, head/sys/dev/sfxge/common/mcdi_mon.c stable/10/sys/dev/sfxge/common/mcdi_mon.h - copied unchanged from r283514, head/sys/dev/sfxge/common/mcdi_mon.h stable/10/sys/dev/sfxge/common/siena_mcdi.c - copied unchanged from r283514, head/sys/dev/sfxge/common/siena_mcdi.c stable/10/sys/dev/sfxge/sfxge_ioc.h - copied unchanged from r283514, head/sys/dev/sfxge/sfxge_ioc.h stable/10/sys/dev/sfxge/sfxge_nvram.c - copied unchanged from r283514, head/sys/dev/sfxge/sfxge_nvram.c Deleted: stable/10/sys/dev/sfxge/common/siena_mon.c Modified: stable/10/share/man/man4/sfxge.4 (contents, props changed) stable/10/sys/conf/files stable/10/sys/conf/files.amd64 stable/10/sys/dev/sfxge/common/efsys.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_bootcfg.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_ev.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_filter.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_impl.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_intr.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_mac.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_mcdi.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_mcdi.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_mon.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_nic.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_nvram.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_phy.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_port.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_regs.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_regs_ef10.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_regs_mcdi.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_regs_pci.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_rx.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_sram.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_tx.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_types.h (contents, props changed) stable/10/sys/dev/sfxge/common/efx_vpd.c (contents, props changed) stable/10/sys/dev/sfxge/common/efx_wol.c (contents, props changed) stable/10/sys/dev/sfxge/common/siena_flash.h (contents, props changed) stable/10/sys/dev/sfxge/common/siena_impl.h (contents, props changed) stable/10/sys/dev/sfxge/common/siena_mac.c (contents, props changed) stable/10/sys/dev/sfxge/common/siena_nic.c (contents, props changed) stable/10/sys/dev/sfxge/common/siena_nvram.c (contents, props changed) stable/10/sys/dev/sfxge/common/siena_phy.c (contents, props changed) stable/10/sys/dev/sfxge/common/siena_sram.c (contents, props changed) stable/10/sys/dev/sfxge/common/siena_vpd.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge.h (contents, props changed) stable/10/sys/dev/sfxge/sfxge_dma.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge_ev.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge_intr.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge_mcdi.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge_port.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge_rx.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge_rx.h (contents, props changed) stable/10/sys/dev/sfxge/sfxge_tx.c (contents, props changed) stable/10/sys/dev/sfxge/sfxge_tx.h (contents, props changed) stable/10/sys/dev/sfxge/sfxge_version.h stable/10/sys/modules/sfxge/Makefile (contents, props changed) Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/sfxge.4 ============================================================================== --- stable/10/share/man/man4/sfxge.4 Thu Jun 18 15:41:09 2015 (r284554) +++ stable/10/share/man/man4/sfxge.4 Thu Jun 18 15:46:39 2015 (r284555) @@ -1,26 +1,30 @@ -.\" Copyright (c) 2011 Solarflare Communications, Inc. +.\" Copyright (c) 2011-2015 Solarflare Communications Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL 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. +.\" 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +.\" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" The views and conclusions contained in the software and documentation are +.\" those of the authors and should not be interpreted as representing official +.\" policies, either expressed or implied, of the FreeBSD Project. .\" .\" $FreeBSD$ .\" @@ -116,6 +120,9 @@ If a packet is dropped, the .Va tx_put_overflow counter is incremented and the local sender receives ENOBUFS. The value must be greater than or equal to 0. +.It Va hw.sfxge.tso_fw_assisted +Enable/disable usage of FW-assisted TSO if supported by NIC firmware. +Enabled by default. .It Va hw.sfxge.N.max_rss_channels The maximum number of allocated RSS channels for the Nth adapter. If set to 0 or unset, the number of channels is determined by the number Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Jun 18 15:41:09 2015 (r284554) +++ stable/10/sys/conf/files Thu Jun 18 15:46:39 2015 (r284555) @@ -2135,37 +2135,6 @@ dev/sdhci/sdhci.c optional sdhci dev/sdhci/sdhci_if.m optional sdhci dev/sdhci/sdhci_pci.c optional sdhci pci dev/sf/if_sf.c optional sf pci -dev/sfxge/common/efx_bootcfg.c optional sfxge pci -dev/sfxge/common/efx_ev.c optional sfxge pci -dev/sfxge/common/efx_filter.c optional sfxge pci -dev/sfxge/common/efx_intr.c optional sfxge pci -dev/sfxge/common/efx_mac.c optional sfxge pci -dev/sfxge/common/efx_mcdi.c optional sfxge pci -dev/sfxge/common/efx_mon.c optional sfxge pci -dev/sfxge/common/efx_nic.c optional sfxge pci -dev/sfxge/common/efx_nvram.c optional sfxge pci -dev/sfxge/common/efx_phy.c optional sfxge pci -dev/sfxge/common/efx_port.c optional sfxge pci -dev/sfxge/common/efx_rx.c optional sfxge pci -dev/sfxge/common/efx_sram.c optional sfxge pci -dev/sfxge/common/efx_tx.c optional sfxge pci -dev/sfxge/common/efx_vpd.c optional sfxge pci -dev/sfxge/common/efx_wol.c optional sfxge pci -dev/sfxge/common/siena_mac.c optional sfxge pci -dev/sfxge/common/siena_mon.c optional sfxge pci -dev/sfxge/common/siena_nic.c optional sfxge pci -dev/sfxge/common/siena_nvram.c optional sfxge pci -dev/sfxge/common/siena_phy.c optional sfxge pci -dev/sfxge/common/siena_sram.c optional sfxge pci -dev/sfxge/common/siena_vpd.c optional sfxge pci -dev/sfxge/sfxge.c optional sfxge pci -dev/sfxge/sfxge_dma.c optional sfxge pci -dev/sfxge/sfxge_ev.c optional sfxge pci -dev/sfxge/sfxge_intr.c optional sfxge pci -dev/sfxge/sfxge_mcdi.c optional sfxge pci -dev/sfxge/sfxge_port.c optional sfxge pci -dev/sfxge/sfxge_rx.c optional sfxge pci -dev/sfxge/sfxge_tx.c optional sfxge pci dev/sge/if_sge.c optional sge pci dev/si/si.c optional si dev/si/si2_z280.c optional si Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Thu Jun 18 15:41:09 2015 (r284554) +++ stable/10/sys/conf/files.amd64 Thu Jun 18 15:46:39 2015 (r284555) @@ -299,37 +299,52 @@ dev/qlxgbe/ql_isr.c optional qlxgbe pci dev/qlxgbe/ql_misc.c optional qlxgbe pci dev/qlxgbe/ql_os.c optional qlxgbe pci dev/qlxgbe/ql_reset.c optional qlxgbe pci -dev/sfxge/common/efx_bootcfg.c optional sfxge inet pci -dev/sfxge/common/efx_ev.c optional sfxge inet pci -dev/sfxge/common/efx_filter.c optional sfxge inet pci -dev/sfxge/common/efx_intr.c optional sfxge inet pci -dev/sfxge/common/efx_mac.c optional sfxge inet pci -dev/sfxge/common/efx_mcdi.c optional sfxge inet pci -dev/sfxge/common/efx_mon.c optional sfxge inet pci -dev/sfxge/common/efx_nic.c optional sfxge inet pci -dev/sfxge/common/efx_nvram.c optional sfxge inet pci -dev/sfxge/common/efx_phy.c optional sfxge inet pci -dev/sfxge/common/efx_port.c optional sfxge inet pci -dev/sfxge/common/efx_rx.c optional sfxge inet pci -dev/sfxge/common/efx_sram.c optional sfxge inet pci -dev/sfxge/common/efx_tx.c optional sfxge inet pci -dev/sfxge/common/efx_vpd.c optional sfxge inet pci -dev/sfxge/common/efx_wol.c optional sfxge inet pci -dev/sfxge/common/siena_mac.c optional sfxge inet pci -dev/sfxge/common/siena_mon.c optional sfxge inet pci -dev/sfxge/common/siena_nic.c optional sfxge inet pci -dev/sfxge/common/siena_nvram.c optional sfxge inet pci -dev/sfxge/common/siena_phy.c optional sfxge inet pci -dev/sfxge/common/siena_sram.c optional sfxge inet pci -dev/sfxge/common/siena_vpd.c optional sfxge inet pci -dev/sfxge/sfxge.c optional sfxge inet pci -dev/sfxge/sfxge_dma.c optional sfxge inet pci -dev/sfxge/sfxge_ev.c optional sfxge inet pci -dev/sfxge/sfxge_intr.c optional sfxge inet pci -dev/sfxge/sfxge_mcdi.c optional sfxge inet pci -dev/sfxge/sfxge_port.c optional sfxge inet pci -dev/sfxge/sfxge_rx.c optional sfxge inet pci -dev/sfxge/sfxge_tx.c optional sfxge inet pci +dev/sfxge/common/efx_bootcfg.c optional sfxge pci +dev/sfxge/common/efx_crc32.c optional sfxge pci +dev/sfxge/common/efx_ev.c optional sfxge pci +dev/sfxge/common/efx_filter.c optional sfxge pci +dev/sfxge/common/efx_hash.c optional sfxge pci +dev/sfxge/common/efx_intr.c optional sfxge pci +dev/sfxge/common/efx_mac.c optional sfxge pci +dev/sfxge/common/efx_mcdi.c optional sfxge pci +dev/sfxge/common/efx_mon.c optional sfxge pci +dev/sfxge/common/efx_nic.c optional sfxge pci +dev/sfxge/common/efx_nvram.c optional sfxge pci +dev/sfxge/common/efx_phy.c optional sfxge pci +dev/sfxge/common/efx_port.c optional sfxge pci +dev/sfxge/common/efx_rx.c optional sfxge pci +dev/sfxge/common/efx_sram.c optional sfxge pci +dev/sfxge/common/efx_tx.c optional sfxge pci +dev/sfxge/common/efx_vpd.c optional sfxge pci +dev/sfxge/common/efx_wol.c optional sfxge pci +dev/sfxge/common/hunt_ev.c optional sfxge pci +dev/sfxge/common/hunt_filter.c optional sfxge pci +dev/sfxge/common/hunt_intr.c optional sfxge pci +dev/sfxge/common/hunt_mac.c optional sfxge pci +dev/sfxge/common/hunt_mcdi.c optional sfxge pci +dev/sfxge/common/hunt_nic.c optional sfxge pci +dev/sfxge/common/hunt_nvram.c optional sfxge pci +dev/sfxge/common/hunt_phy.c optional sfxge pci +dev/sfxge/common/hunt_rx.c optional sfxge pci +dev/sfxge/common/hunt_sram.c optional sfxge pci +dev/sfxge/common/hunt_tx.c optional sfxge pci +dev/sfxge/common/hunt_vpd.c optional sfxge pci +dev/sfxge/common/siena_mac.c optional sfxge pci +dev/sfxge/common/siena_mcdi.c optional sfxge pci +dev/sfxge/common/siena_nic.c optional sfxge pci +dev/sfxge/common/siena_nvram.c optional sfxge pci +dev/sfxge/common/siena_phy.c optional sfxge pci +dev/sfxge/common/siena_sram.c optional sfxge pci +dev/sfxge/common/siena_vpd.c optional sfxge pci +dev/sfxge/sfxge.c optional sfxge pci +dev/sfxge/sfxge_dma.c optional sfxge pci +dev/sfxge/sfxge_ev.c optional sfxge pci +dev/sfxge/sfxge_intr.c optional sfxge pci +dev/sfxge/sfxge_mcdi.c optional sfxge pci +dev/sfxge/sfxge_nvram.c optional sfxge pci +dev/sfxge/sfxge_port.c optional sfxge pci +dev/sfxge/sfxge_rx.c optional sfxge pci +dev/sfxge/sfxge_tx.c optional sfxge pci dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/sio/sio_pccard.c optional sio pccard Copied: stable/10/sys/dev/sfxge/common/ef10_tlv_layout.h (from r283514, head/sys/dev/sfxge/common/ef10_tlv_layout.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/sfxge/common/ef10_tlv_layout.h Thu Jun 18 15:46:39 2015 (r284555, copy of r283514, head/sys/dev/sfxge/common/ef10_tlv_layout.h) @@ -0,0 +1,691 @@ +/*- + * Copyright (c) 2012-2015 Solarflare Communications Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are + * those of the authors and should not be interpreted as representing official + * policies, either expressed or implied, of the FreeBSD Project. + * + * $FreeBSD$ + */ + +/* These structures define the layouts for the TLV items stored in static and + * dynamic configuration partitions in NVRAM for EF10 (Huntington etc.). + * + * They contain the same sort of information that was kept in the + * siena_mc_static_config_hdr_t and siena_mc_dynamic_config_hdr_t structures + * (defined in and ) for + * Siena. + * + * These are used directly by the MC and should also be usable directly on host + * systems which are little-endian and do not do strange things with structure + * padding. (Big-endian host systems will require some byte-swapping.) + * + * ----- + * + * Please refer to SF-108797-SW for a general overview of the TLV partition + * format. + * + * ----- + * + * The current tag IDs have a general structure: with the exception of the + * special values defined in the document, they are of the form 0xLTTTNNNN, + * where: + * + * - L is a location, indicating where this tag is expected to be found: + * 0 for static configuration, or 1 for dynamic configuration. Other + * values are reserved. + * + * - TTT is a type, which is just a unique value. The same type value + * might appear in both locations, indicating a relationship between + * the items (e.g. static and dynamic VPD below). + * + * - NNNN is an index of some form. Some item types are per-port, some + * are per-PF, some are per-partition-type. + * + * ----- + * + * As with the previous Siena structures, each structure here is laid out + * carefully: values are aligned to their natural boundary, with explicit + * padding fields added where necessary. (No, technically this does not + * absolutely guarantee portability. But, in practice, compilers are generally + * sensible enough not to introduce completely pointless padding, and it works + * well enough.) + */ + + +#ifndef CI_MGMT_TLV_LAYOUT_H +#define CI_MGMT_TLV_LAYOUT_H + + +/* ---------------------------------------------------------------------------- + * General structure (defined by SF-108797-SW) + * ---------------------------------------------------------------------------- + */ + + +/* The "end" tag. + * + * (Note that this is *not* followed by length or value fields: anything after + * the tag itself is irrelevant.) + */ + +#define TLV_TAG_END (0xEEEEEEEE) + + +/* Other special reserved tag values. + */ + +#define TLV_TAG_SKIP (0x00000000) +#define TLV_TAG_INVALID (0xFFFFFFFF) + + +/* TLV partition header. + * + * In a TLV partition, this must be the first item in the sequence, at offset + * 0. + */ + +#define TLV_TAG_PARTITION_HEADER (0xEF10DA7A) + +struct tlv_partition_header { + uint32_t tag; + uint32_t length; + uint16_t type_id; + uint16_t reserved; + uint32_t generation; + uint32_t total_length; +}; + + +/* TLV partition trailer. + * + * In a TLV partition, this must be the last item in the sequence, immediately + * preceding the TLV_TAG_END word. + */ + +#define TLV_TAG_PARTITION_TRAILER (0xEF101A57) + +struct tlv_partition_trailer { + uint32_t tag; + uint32_t length; + uint32_t generation; + uint32_t checksum; +}; + + +/* Appendable TLV partition header. + * + * In an appendable TLV partition, this must be the first item in the sequence, + * at offset 0. (Note that, unlike the configuration partitions, there is no + * trailer before the TLV_TAG_END word.) + */ + +#define TLV_TAG_APPENDABLE_PARTITION_HEADER (0xEF10ADA7) + +struct tlv_appendable_partition_header { + uint32_t tag; + uint32_t length; + uint16_t type_id; + uint16_t reserved; +}; + + +/* ---------------------------------------------------------------------------- + * Configuration items + * ---------------------------------------------------------------------------- + */ + + +/* NIC global capabilities. + */ + +#define TLV_TAG_GLOBAL_CAPABILITIES (0x00010000) + +struct tlv_global_capabilities { + uint32_t tag; + uint32_t length; + uint32_t flags; +}; + + +/* Siena-style per-port MAC address allocation. + * + * There are addresses, starting at and incrementing + * by adding to the low-order byte(s). + * + * (See also TLV_TAG_GLOBAL_MAC for an alternative, specifying a global pool + * of contiguous MAC addresses for the firmware to allocate as it sees fit.) + */ + +#define TLV_TAG_PORT_MAC(port) (0x00020000 + (port)) + +struct tlv_port_mac { + uint32_t tag; + uint32_t length; + uint8_t base_address[6]; + uint16_t reserved; + uint16_t count; + uint16_t stride; +}; + + +/* Static VPD. + * + * This is the portion of VPD which is set at manufacturing time and not + * expected to change. It is formatted as a standard PCI VPD block. + */ + +#define TLV_TAG_PF_STATIC_VPD(pf) (0x00030000 + (pf)) + +struct tlv_pf_static_vpd { + uint32_t tag; + uint32_t length; + uint8_t bytes[]; +}; + + +/* Dynamic VPD. + * + * This is the portion of VPD which may be changed (e.g. by firmware updates). + * It is formatted as a standard PCI VPD block. + */ + +#define TLV_TAG_PF_DYNAMIC_VPD(pf) (0x10030000 + (pf)) + +struct tlv_pf_dynamic_vpd { + uint32_t tag; + uint32_t length; + uint8_t bytes[]; +}; + + +/* "DBI" PCI config space changes. + * + * This is a set of edits made to the default PCI config space values before + * the device is allowed to enumerate. + */ + +#define TLV_TAG_PF_DBI(pf) (0x00040000 + (pf)) + +struct tlv_pf_dbi { + uint32_t tag; + uint32_t length; + struct { + uint16_t addr; + uint16_t byte_enables; + uint32_t value; + } items[]; +}; + + +/* Partition subtype codes. + * + * A subtype may optionally be stored for each type of partition present in + * the NVRAM. For example, this may be used to allow a generic firmware update + * utility to select a specific variant of firmware for a specific variant of + * board. + * + * The description[] field is an optional string which is returned in the + * MC_CMD_NVRAM_METADATA response if present. + */ + +#define TLV_TAG_PARTITION_SUBTYPE(type) (0x00050000 + (type)) + +struct tlv_partition_subtype { + uint32_t tag; + uint32_t length; + uint32_t subtype; + uint8_t description[]; +}; + + +/* Partition version codes. + * + * A version may optionally be stored for each type of partition present in + * the NVRAM. This provides a standard way of tracking the currently stored + * version of each of the various component images. + */ + +#define TLV_TAG_PARTITION_VERSION(type) (0x10060000 + (type)) + +struct tlv_partition_version { + uint32_t tag; + uint32_t length; + uint16_t version_w; + uint16_t version_x; + uint16_t version_y; + uint16_t version_z; +}; + +/* Global PCIe configuration */ + +#define TLV_TAG_GLOBAL_PCIE_CONFIG (0x10070000) + +struct tlv_pcie_config { + uint32_t tag; + uint32_t length; + int16_t max_pf_number; /**< Largest PF RID (lower PFs may be hidden) */ + uint16_t pf_aper; /**< BIU aperture for PF BAR2 */ + uint16_t vf_aper; /**< BIU aperture for VF BAR0 */ + uint16_t int_aper; /**< BIU aperture for PF BAR4 and VF BAR2 */ +#define TLV_MAX_PF_DEFAULT (-1) /* Use FW default for largest PF RID */ +#define TLV_APER_DEFAULT (0xFFFF) /* Use FW default for a given aperture */ +}; + +/* Per-PF configuration. Note that not all these fields are necessarily useful + * as the apertures are constrained by the BIU settings (the one case we do + * use is to make BAR2 bigger than the BIU thinks to reserve space), but we can + * tidy things up later */ + +#define TLV_TAG_PF_PCIE_CONFIG(pf) (0x10080000 + (pf)) + +struct tlv_per_pf_pcie_config { + uint32_t tag; + uint32_t length; + uint8_t vfs_total; + uint8_t port_allocation; + uint16_t vectors_per_pf; + uint16_t vectors_per_vf; + uint8_t pf_bar0_aperture; + uint8_t pf_bar2_aperture; + uint8_t vf_bar0_aperture; + uint8_t vf_base; + uint16_t supp_pagesz; + uint16_t msix_vec_base; +}; + + +/* Development ONLY. This is a single TLV tag for all the gubbins + * that can be set through the MC command-line other than the PCIe + * settings. This is a temporary measure. */ +#define TLV_TAG_TMP_GUBBINS (0x10090000) + +struct tlv_tmp_gubbins { + uint32_t tag; + uint32_t length; + /* Consumed by dpcpu.c */ + uint64_t tx0_tags; /* Bitmap */ + uint64_t tx1_tags; /* Bitmap */ + uint64_t dl_tags; /* Bitmap */ + uint32_t flags; +#define TLV_DPCPU_TX_STRIPE (1) /* TX striping is on */ +#define TLV_DPCPU_BIU_TAGS (2) /* Use BIU tag manager */ +#define TLV_DPCPU_TX0_TAGS (4) /* tx0_tags is valid */ +#define TLV_DPCPU_TX1_TAGS (8) /* tx1_tags is valid */ +#define TLV_DPCPU_DL_TAGS (16) /* dl_tags is valid */ + /* Consumed by features.c */ + uint32_t dut_features; /* All 1s -> leave alone */ + int8_t with_rmon; /* 0 -> off, 1 -> on, -1 -> leave alone */ + /* Consumed by clocks_hunt.c */ + int8_t clk_mode; /* 0 -> off, 1 -> on, -1 -> leave alone */ + /* Consumed by sram.c */ + int8_t rx_dc_size; /* -1 -> leave alone */ + int8_t tx_dc_size; + int16_t num_q_allocs; +}; + +/* Global port configuration + * + * This is now deprecated in favour of a platform-provided default + * and dynamic config override via tlv_global_port_options. + */ +#define TLV_TAG_GLOBAL_PORT_CONFIG (0x000a0000) + +struct tlv_global_port_config { + uint32_t tag; + uint32_t length; + uint32_t ports_per_core; + uint32_t max_port_speed; +}; + + +/* Firmware options. + * + * This is intended for user-configurable selection of optional firmware + * features and variants. + * + * Initially, this consists only of the satellite CPU firmware variant + * selection, but this tag could be extended in the future (using the + * tag length to determine whether additional fields are present). + */ + +#define TLV_TAG_FIRMWARE_OPTIONS (0x100b0000) + +struct tlv_firmware_options { + uint32_t tag; + uint32_t length; + uint32_t firmware_variant; +#define TLV_FIRMWARE_VARIANT_DRIVER_SELECTED (0xffffffff) + +/* These are the values for overriding the driver's choice; the definitions + * are taken from MCDI so that they don't get out of step. Include + * or the equivalent from your driver's tree if + * you need to use these constants. + */ +#define TLV_FIRMWARE_VARIANT_FULL_FEATURED MC_CMD_FW_FULL_FEATURED +#define TLV_FIRMWARE_VARIANT_LOW_LATENCY MC_CMD_FW_LOW_LATENCY +#define TLV_FIRMWARE_VARIANT_PACKED_STREAM MC_CMD_FW_PACKED_STREAM +#define TLV_FIRMWARE_VARIANT_HIGH_TX_RATE MC_CMD_FW_HIGH_TX_RATE +#define TLV_FIRMWARE_VARIANT_PACKED_STREAM_HASH_MODE_1 \ + MC_CMD_FW_PACKED_STREAM_HASH_MODE_1 +}; + +/* Voltage settings + * + * Intended for boards with A0 silicon where the core voltage may + * need tweaking. Most likely set once when the pass voltage is + * determined. */ + +#define TLV_TAG_0V9_SETTINGS (0x000c0000) + +struct tlv_0v9_settings { + uint32_t tag; + uint32_t length; + uint16_t flags; /* Boards with high 0v9 settings may need active cooling */ +#define TLV_TAG_0V9_REQUIRES_FAN (1) + uint16_t target_voltage; /* In millivolts */ + /* Since the limits are meant to be centred to the target (and must at least + * contain it) they need setting as well. */ + uint16_t warn_low; /* In millivolts */ + uint16_t warn_high; /* In millivolts */ + uint16_t panic_low; /* In millivolts */ + uint16_t panic_high; /* In millivolts */ +}; + + +/* Clock configuration */ + +#define TLV_TAG_CLOCK_CONFIG (0x000d0000) + +struct tlv_clock_config { + uint32_t tag; + uint32_t length; + uint16_t clk_sys; /* MHz */ + uint16_t clk_dpcpu; /* MHz */ + uint16_t clk_icore; /* MHz */ + uint16_t clk_pcs; /* MHz */ +}; + +#define TLV_TAG_CLOCK_CONFIG_MEDFORD (0x00100000) + +struct tlv_clock_config_medford { + uint32_t tag; + uint32_t length; + uint16_t clk_sys; /* MHz */ + uint16_t clk_mc; /* MHz */ + uint16_t clk_rmon; /* MHz */ + uint16_t clk_vswitch; /* MHz */ + uint16_t clk_dpcpu; /* MHz */ + uint16_t clk_pcs; /* MHz */ +}; + + +/* EF10-style global pool of MAC addresses. + * + * There are addresses, starting at , which are + * contiguous. Firmware is responsible for allocating addresses from this + * pool to ports / PFs as appropriate. + */ + +#define TLV_TAG_GLOBAL_MAC (0x000e0000) + +struct tlv_global_mac { + uint32_t tag; + uint32_t length; + uint8_t base_address[6]; + uint16_t reserved1; + uint16_t count; + uint16_t reserved2; +}; + +#define TLV_TAG_ATB_0V9_TARGET (0x000f0000) + +/* The target value for the 0v9 power rail measured on-chip at the + * analogue test bus */ +struct tlv_0v9_atb_target { + uint32_t tag; + uint32_t length; + uint16_t millivolts; + uint16_t reserved; +}; + +/* Global PCIe configuration, second revision. This represents the visible PFs + * by a bitmap rather than having the number of the highest visible one. As such + * it can (for a 16-PF chip) represent a superset of what TLV_TAG_GLOBAL_PCIE_CONFIG + * can and it should be used in place of that tag in future (but compatibility with + * the old tag will be left in the firmware indefinitely). */ + +#define TLV_TAG_GLOBAL_PCIE_CONFIG_R2 (0x10100000) + +struct tlv_pcie_config_r2 { + uint32_t tag; + uint32_t length; + uint16_t visible_pfs; /**< Bitmap of visible PFs */ + uint16_t pf_aper; /**< BIU aperture for PF BAR2 */ + uint16_t vf_aper; /**< BIU aperture for VF BAR0 */ + uint16_t int_aper; /**< BIU aperture for PF BAR4 and VF BAR2 */ +}; + +/* Dynamic port mode. + * + * Allows selecting alternate port configuration for platforms that support it + * (e.g. 1x40G vs 2x10G on Milano, 1x40G vs 4x10G on Medford). This affects the + * number of externally visible ports (and, hence, PF to port mapping), so must + * be done at boot time. + * + * This tag supercedes tlv_global_port_config. + */ + +#define TLV_TAG_GLOBAL_PORT_MODE (0x10110000) + +struct tlv_global_port_mode { + uint32_t tag; + uint32_t length; + uint32_t port_mode; +#define TLV_PORT_MODE_DEFAULT (0xffffffff) /* Default for given platform */ +#define TLV_PORT_MODE_10G (0) /* 10G, single SFP/10G-KR */ +#define TLV_PORT_MODE_40G (1) /* 40G, single QSFP/40G-KR */ +#define TLV_PORT_MODE_10G_10G (2) /* 2x10G, dual SFP/10G-KR or single QSFP */ +#define TLV_PORT_MODE_40G_40G (3) /* 40G + 40G, dual QSFP/40G-KR (Greenport, Medford) */ +#define TLV_PORT_MODE_10G_10G_10G_10G (4) /* 2x10G + 2x10G, quad SFP/10G-KR or dual QSFP (Greenport, Medford) */ +#define TLV_PORT_MODE_10G_10G_10G_10G_Q (5) /* 4x10G, single QSFP, cage 0 (Medford) */ +#define TLV_PORT_MODE_40G_10G_10G (6) /* 1x40G + 2x10G, dual QSFP (Greenport, Medford) */ +#define TLV_PORT_MODE_10G_10G_40G (7) /* 2x10G + 1x40G, dual QSFP (Greenport, Medford) */ +#define TLV_PORT_MODE_10G_10G_10G_10G_Q2 (8) /* 4x10G, single QSFP, cage 1 (Medford) */ +#define TLV_PORT_MODE_MAX TLV_PORT_MODE_10G_10G_10G_10G_Q2 +}; + +/* Type of the v-switch created implicitly by the firmware */ + +#define TLV_TAG_VSWITCH_TYPE(port) (0x10120000 + (port)) + +struct tlv_vswitch_type { + uint32_t tag; + uint32_t length; + uint32_t vswitch_type; +#define TLV_VSWITCH_TYPE_DEFAULT (0xffffffff) /* Firmware default; equivalent to no TLV present for a given port */ +#define TLV_VSWITCH_TYPE_NONE (0) +#define TLV_VSWITCH_TYPE_VLAN (1) +#define TLV_VSWITCH_TYPE_VEB (2) +#define TLV_VSWITCH_TYPE_VEPA (3) +#define TLV_VSWITCH_TYPE_MUX (4) +#define TLV_VSWITCH_TYPE_TEST (5) +}; + +/* A VLAN tag for the v-port created implicitly by the firmware */ + +#define TLV_TAG_VPORT_VLAN_TAG(pf) (0x10130000 + (pf)) + +struct tlv_vport_vlan_tag { + uint32_t tag; + uint32_t length; + uint32_t vlan_tag; +#define TLV_VPORT_NO_VLAN_TAG (0xFFFFFFFF) /* Default in the absence of TLV for a given PF */ +}; + +/* Offset to be applied to the 0v9 setting, wherever it came from */ + +#define TLV_TAG_ATB_0V9_OFFSET (0x10140000) + +struct tlv_0v9_atb_offset { + uint32_t tag; + uint32_t length; + int16_t offset_millivolts; + uint16_t reserved; +}; + +/* A privilege mask given on reset to all non-admin PCIe functions (that is other than first-PF-per-port). + * The meaning of particular bits is defined in mcdi_ef10.yml under MC_CMD_PRIVILEGE_MASK, see also bug 44583. + * TLV_TAG_PRIVILEGE_MASK_ADD specifies bits that should be added (ORed) to firmware default while + * TLV_TAG_PRIVILEGE_MASK_REM specifies bits that should be removed (ANDed) from firmware default: + * Initial_privilege_mask = (firmware_default_mask | privilege_mask_add) & ~privilege_mask_rem */ + +#define TLV_TAG_PRIVILEGE_MASK (0x10150000) /* legacy symbol - do not use */ + +struct tlv_privilege_mask { /* legacy structure - do not use */ + uint32_t tag; + uint32_t length; + uint32_t privilege_mask; +}; + +#define TLV_TAG_PRIVILEGE_MASK_ADD (0x10150000) + +struct tlv_privilege_mask_add { + uint32_t tag; + uint32_t length; + uint32_t privilege_mask_add; +}; + +#define TLV_TAG_PRIVILEGE_MASK_REM (0x10160000) + +struct tlv_privilege_mask_rem { + uint32_t tag; + uint32_t length; + uint32_t privilege_mask_rem; +}; + +/* Additional privileges given to all PFs. + * This tag takes precedence over TLV_TAG_PRIVILEGE_MASK_REM. */ + +#define TLV_TAG_PRIVILEGE_MASK_ADD_ALL_PFS (0x10190000) + +struct tlv_privilege_mask_add_all_pfs { + uint32_t tag; + uint32_t length; + uint32_t privilege_mask_add; +}; + +/* Additional privileges given to a selected PF. + * This tag takes precedence over TLV_TAG_PRIVILEGE_MASK_REM. */ + +#define TLV_TAG_PRIVILEGE_MASK_ADD_SINGLE_PF(pf) (0x101A0000 + (pf)) + +struct tlv_privilege_mask_add_single_pf { + uint32_t tag; + uint32_t length; + uint32_t privilege_mask_add; +}; + +/* Turning on/off the PFIOV mode. + * This tag only takes effect if TLV_TAG_VSWITCH_TYPE is missing or set to DEFAULT. */ + +#define TLV_TAG_PFIOV(port) (0x10170000 + (port)) + +struct tlv_pfiov { + uint32_t tag; + uint32_t length; + uint32_t pfiov; +#define TLV_PFIOV_OFF (0) /* Default */ +#define TLV_PFIOV_ON (1) +}; + +/* Multicast filter chaining mode selection. + * + * When enabled, multicast packets are delivered to all recipients of all + * matching multicast filters, with the exception that IP multicast filters + * will steal traffic from MAC multicast filters on a per-function basis. + * (New behaviour.) + * + * When disabled, multicast packets will always be delivered only to the + * recipients of the highest priority matching multicast filter. + * (Legacy behaviour.) + * + * The DEFAULT mode (which is the same as the tag not being present at all) + * is equivalent to ENABLED in production builds, and DISABLED in eftest + * builds. + * + * This option is intended to provide run-time control over this feature + * while it is being stabilised and may be withdrawn at some point in the + * future; the new behaviour is intended to become the standard behaviour. + */ + +#define TLV_TAG_MCAST_FILTER_CHAINING (0x10180000) + +struct tlv_mcast_filter_chaining { + uint32_t tag; + uint32_t length; + uint32_t mode; +#define TLV_MCAST_FILTER_CHAINING_DEFAULT (0xffffffff) +#define TLV_MCAST_FILTER_CHAINING_DISABLED (0) +#define TLV_MCAST_FILTER_CHAINING_ENABLED (1) +}; + + +/* Pacer rate limit per PF */ +#define TLV_TAG_RATE_LIMIT(pf) (0x101b0000 + (pf)) + +struct tlv_rate_limit { + uint32_t tag; + uint32_t length; + uint32_t rate_mbps; +}; + + +/* OCSD Enable/Disable + * + * This setting allows OCSD to be disabled. This is a requirement for HP + * servers to support PCI passthrough for virtualization. + * + * The DEFAULT mode (which is the same as the tag not being present) is + * equivalent to ENABLED. + * + * This option is not used by the MCFW, and is entirely handled by the various + * drivers that support OCSD, by reading the setting before they attempt + * to enable OCSD. + * + * bit0: OCSD Disabled/Enabled + */ + +#define TLV_TAG_OCSD (0x101C0000) + +struct tlv_ocsd { + uint32_t tag; + uint32_t length; + uint32_t mode; +#define TLV_OCSD_DISABLED 0 +#define TLV_OCSD_ENABLED 1 /* Default */ +}; + +#endif /* CI_MGMT_TLV_LAYOUT_H */ Modified: stable/10/sys/dev/sfxge/common/efsys.h ============================================================================== --- stable/10/sys/dev/sfxge/common/efsys.h Thu Jun 18 15:41:09 2015 (r284554) +++ stable/10/sys/dev/sfxge/common/efsys.h Thu Jun 18 15:46:39 2015 (r284555) @@ -1,30 +1,34 @@ /*- - * Copyright (c) 2010-2011 Solarflare Communications, Inc. + * Copyright (c) 2010-2015 Solarflare Communications Inc. * All rights reserved. * * This software was developed in part by Philip Paeps under contract for * Solarflare Communications, Inc. * * 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. + * modification, are permitted provided that the following conditions are met: * - * 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. + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are + * those of the authors and should not be interpreted as representing official + * policies, either expressed or implied, of the FreeBSD Project. * * $FreeBSD$ */ @@ -56,6 +60,7 @@ extern "C" { #else #define EFSYS_USE_UINT64 0 #endif +#define EFSYS_HAS_SSE2_M128 0 #if _BYTE_ORDER == _BIG_ENDIAN #define EFSYS_IS_BIG_ENDIAN 1 #define EFSYS_IS_LITTLE_ENDIAN 0 @@ -90,6 +95,10 @@ extern "C" { #define P2ROUNDUP(x, align) (-(-(x) & -(align))) #endif +#ifndef P2ALIGN +#define P2ALIGN(_x, _a) ((_x) & -(_a)) +#endif + #ifndef IS2P #define ISP2(x) (((x) & ((x) - 1)) == 0) #endif @@ -176,7 +185,7 @@ prefetch_read_once(void *addr) #endif static __inline void sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map, - struct mbuf *m, bus_dma_segment_t *seg) + struct mbuf *m, bus_dma_segment_t *seg) { #if defined(__i386__) || defined(__amd64__) seg->ds_addr = pmap_kextract(mtod(m, vm_offset_t)); @@ -188,10 +197,6 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b #endif } -/* Modifiers used for DOS builds */ -#define __cs -#define __far - /* Modifiers used for Windows builds */ #define __in #define __in_opt @@ -231,6 +236,7 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b #define EFSYS_OPT_FALCON 0 #define EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE 0 #define EFSYS_OPT_SIENA 1 +#define EFSYS_OPT_HUNTINGTON 1 #ifdef DEBUG #define EFSYS_OPT_CHECK_REG 1 #else @@ -248,19 +254,19 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, b #define EFSYS_OPT_MON_NULL 0 #define EFSYS_OPT_MON_LM87 0 #define EFSYS_OPT_MON_MAX6647 0 -#define EFSYS_OPT_MON_SIENA 0 +#define EFSYS_OPT_MON_MCDI 0 #define EFSYS_OPT_MON_STATS 0 #define EFSYS_OPT_PHY_NULL 0 #define EFSYS_OPT_PHY_QT2022C2 0 #define EFSYS_OPT_PHY_SFX7101 0 #define EFSYS_OPT_PHY_TXC43128 0 -#define EFSYS_OPT_PHY_PM8358 0 #define EFSYS_OPT_PHY_SFT9001 0 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 15:50:43 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8F1E939; Thu, 18 Jun 2015 15:50:43 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E14B763; Thu, 18 Jun 2015 15:50:43 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IFohRx080633; Thu, 18 Jun 2015 15:50:43 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IFohlV080630; Thu, 18 Jun 2015 15:50:43 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201506181550.t5IFohlV080630@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 18 Jun 2015 15:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284556 - in stable/10/sys: dev/sfxge modules/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 15:50:43 -0000 Author: arybchik Date: Thu Jun 18 15:50:42 2015 New Revision: 284556 URL: https://svnweb.freebsd.org/changeset/base/284556 Log: MFC: r283679 sfxge: do not use DEBUG_FLAGS to enable extra debug checks DEBUG_FLAGS are set to DEBUG option value when kernel is built. For example, it is -g in GENERIC config to have debug symbols. Also DEBUG_FLAGS are used to determine if ctfconvert should keep debug symbols. Since we redefined DEBUG_FLAGS, debug symbols were always missing. ctfconvert complains about it during kernel build. It is incorrect to append DEBUG_FLAGS, since if DEBUG has no -g (or similar), we'll have no debug symbols and ctfconvert will complain. If it incorrect to always have -g in our DEBUG_FLAGS, since debug symbols presence should be controllable by kernel config. So, just add disabled by default addition of -DDEBUG=1 to CFLAGS. Reviewed by: imp Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_version.h stable/10/sys/modules/sfxge/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_version.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_version.h Thu Jun 18 15:46:39 2015 (r284555) +++ stable/10/sys/dev/sfxge/sfxge_version.h Thu Jun 18 15:50:42 2015 (r284556) @@ -36,6 +36,6 @@ #ifndef _SFXGE_VERSION_H #define _SFXGE_VERSION_H -#define SFXGE_VERSION_STRING "v4.5.1.1018" +#define SFXGE_VERSION_STRING "v4.5.2.1000" #endif /* _SFXGE_DRIVER_VERSION_H */ Modified: stable/10/sys/modules/sfxge/Makefile ============================================================================== --- stable/10/sys/modules/sfxge/Makefile Thu Jun 18 15:46:39 2015 (r284555) +++ stable/10/sys/modules/sfxge/Makefile Thu Jun 18 15:50:42 2015 (r284556) @@ -36,7 +36,8 @@ SRCS+= hunt_nvram.c hunt_rx.c hunt_phy.c SRCS+= hunt_filter.c SRCS+= hunt_impl.h -DEBUG_FLAGS= -DDEBUG=1 +# Extra debug checks +#CFLAGS += -DDEBUG=1 .if !defined(KERNBUILDDIR) .if ${MK_INET_SUPPORT} != "no" From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 16:39:06 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 30AE0A43; Thu, 18 Jun 2015 16:39:06 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E993367; Thu, 18 Jun 2015 16:39:06 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IGd59N004696; Thu, 18 Jun 2015 16:39:05 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IGd5wD004695; Thu, 18 Jun 2015 16:39:05 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201506181639.t5IGd5wD004695@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Thu, 18 Jun 2015 16:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284559 - stable/10/lib/libc/resolv X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 16:39:06 -0000 Author: ume Date: Thu Jun 18 16:39:05 2015 New Revision: 284559 URL: https://svnweb.freebsd.org/changeset/base/284559 Log: MFC r284229: Add support for '_' occurring at the beginning or end of a name component. PR: 176093 Submitted by: landonf__at__bikemonkey.org Modified: stable/10/lib/libc/resolv/res_comp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/resolv/res_comp.c ============================================================================== --- stable/10/lib/libc/resolv/res_comp.c Thu Jun 18 16:31:32 2015 (r284558) +++ stable/10/lib/libc/resolv/res_comp.c Thu Jun 18 16:39:05 2015 (r284559) @@ -147,12 +147,12 @@ dn_skipname(const u_char *ptr, const u_c || ((c) >= 0x61 && (c) <= 0x7a)) #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) -#define borderchar(c) (alphachar(c) || digitchar(c)) #ifdef RES_ENFORCE_RFC1034 -#define middlechar(c) (borderchar(c) || hyphenchar(c)) +#define borderchar(c) (alphachar(c) || digitchar(c)) #else -#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c)) +#define borderchar(c) (alphachar(c) || digitchar(c) || underscorechar(c)) #endif +#define middlechar(c) (borderchar(c) || hyphenchar(c)) #define domainchar(c) ((c) > 0x20 && (c) < 0x7f) int From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 17:42:24 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E26B3EF6; Thu, 18 Jun 2015 17:42:24 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D098DA24; Thu, 18 Jun 2015 17:42:24 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IHgOsu040377; Thu, 18 Jun 2015 17:42:24 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IHgOKH040376; Thu, 18 Jun 2015 17:42:24 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201506181742.t5IHgOKH040376@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 18 Jun 2015 17:42:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284565 - stable/10/sys/geom/part X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 17:42:25 -0000 Author: ae Date: Thu Jun 18 17:42:24 2015 New Revision: 284565 URL: https://svnweb.freebsd.org/changeset/base/284565 Log: MFC r284151: Teach G_PART_GPT class handle g_resize_provider event. Modified: stable/10/sys/geom/part/g_part_gpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/10/sys/geom/part/g_part_gpt.c Thu Jun 18 17:28:15 2015 (r284564) +++ stable/10/sys/geom/part/g_part_gpt.c Thu Jun 18 17:42:24 2015 (r284565) @@ -760,7 +760,7 @@ g_part_gpt_resize(struct g_part_table *b struct g_part_gpt_entry *entry; if (baseentry == NULL) - return (EOPNOTSUPP); + return (g_part_gpt_recover(basetable)); entry = (struct g_part_gpt_entry *)baseentry; baseentry->gpe_end = baseentry->gpe_start + gpp->gpp_size - 1; From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:21:03 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8A621BC; Thu, 18 Jun 2015 20:21:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A0A5389; Thu, 18 Jun 2015 20:21:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKL36N018329; Thu, 18 Jun 2015 20:21:03 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKL3Aw018327; Thu, 18 Jun 2015 20:21:03 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182021.t5IKL3Aw018327@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284568 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:21:03 -0000 Author: kp Date: Thu Jun 18 20:21:02 2015 New Revision: 284568 URL: https://svnweb.freebsd.org/changeset/base/284568 Log: Merge r278828, r278832 - Factor out ip6_deletefraghdr() function, to be shared between IPv6 stack and pf(4). - Move ip6_deletefraghdr() to frag6.c. (Suggested by bz) Differential Revision: https://reviews.freebsd.org/D2813 Reviewed by: gnn Modified: stable/10/sys/netinet6/frag6.c stable/10/sys/netinet6/ip6_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/frag6.c ============================================================================== --- stable/10/sys/netinet6/frag6.c Thu Jun 18 19:20:00 2015 (r284567) +++ stable/10/sys/netinet6/frag6.c Thu Jun 18 20:21:02 2015 (r284568) @@ -555,27 +555,16 @@ insert: *q6->ip6q_nxtp = (u_char)(nxt & 0xff); #endif - /* Delete frag6 header */ - if (m->m_len >= offset + sizeof(struct ip6_frag)) { - /* This is the only possible case with !PULLDOWN_TEST */ - ovbcopy((caddr_t)ip6, (caddr_t)ip6 + sizeof(struct ip6_frag), - offset); - m->m_data += sizeof(struct ip6_frag); - m->m_len -= sizeof(struct ip6_frag); - } else { - /* this comes with no copy if the boundary is on cluster */ - if ((t = m_split(m, offset, M_NOWAIT)) == NULL) { - frag6_remque(q6); - V_frag6_nfrags -= q6->ip6q_nfrag; + if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) { + frag6_remque(q6); + V_frag6_nfrags -= q6->ip6q_nfrag; #ifdef MAC - mac_ip6q_destroy(q6); + mac_ip6q_destroy(q6); #endif - free(q6, M_FTABLE); - V_frag6_nfragpackets--; - goto dropfrag; - } - m_adj(t, sizeof(struct ip6_frag)); - m_cat(m, t); + free(q6, M_FTABLE); + V_frag6_nfragpackets--; + + goto dropfrag; } /* @@ -789,3 +778,27 @@ frag6_drain(void) IP6Q_UNLOCK(); VNET_LIST_RUNLOCK_NOSLEEP(); } + +int +ip6_deletefraghdr(struct mbuf *m, int offset, int wait) +{ + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct mbuf *t; + + /* Delete frag6 header. */ + if (m->m_len >= offset + sizeof(struct ip6_frag)) { + /* This is the only possible case with !PULLDOWN_TEST. */ + bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), + offset); + m->m_data += sizeof(struct ip6_frag); + m->m_len -= sizeof(struct ip6_frag); + } else { + /* This comes with no copy if the boundary is on cluster. */ + if ((t = m_split(m, offset, wait)) == NULL) + return (ENOMEM); + m_adj(t, sizeof(struct ip6_frag)); + m_cat(m, t); + } + + return (0); +} Modified: stable/10/sys/netinet6/ip6_var.h ============================================================================== --- stable/10/sys/netinet6/ip6_var.h Thu Jun 18 19:20:00 2015 (r284567) +++ stable/10/sys/netinet6/ip6_var.h Thu Jun 18 20:21:02 2015 (r284568) @@ -425,6 +425,7 @@ int ip6_setpktopts(struct mbuf *, struct void ip6_clearpktopts(struct ip6_pktopts *, int); struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int); int ip6_optlen(struct inpcb *); +int ip6_deletefraghdr(struct mbuf *, int, int); int route6_input(struct mbuf **, int *, int); From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:28:54 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 233083A8; Thu, 18 Jun 2015 20:28:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 101A176D; Thu, 18 Jun 2015 20:28:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKSso9022905; Thu, 18 Jun 2015 20:28:54 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKSrxo022901; Thu, 18 Jun 2015 20:28:53 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182028.t5IKSrxo022901@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284569 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:28:54 -0000 Author: kp Date: Thu Jun 18 20:28:52 2015 New Revision: 284569 URL: https://svnweb.freebsd.org/changeset/base/284569 Log: Merge r278831, r278834 Update the pf fragment handling code to closer match recent OpenBSD. That partially fixes IPv6 fragment handling. Differential Revision: https://reviews.freebsd.org/D2814 Reviewed by: gnn Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Thu Jun 18 20:21:02 2015 (r284568) +++ stable/10/sys/net/pfvar.h Thu Jun 18 20:28:52 2015 (r284569) @@ -1668,6 +1668,8 @@ int pfi_clear_flags(const char *, int) int pf_match_tag(struct mbuf *, struct pf_rule *, int *, int); int pf_tag_packet(struct mbuf *, struct pf_pdesc *, int); +int pf_addr_cmp(struct pf_addr *, struct pf_addr *, + sa_family_t); void pf_qid2qname(u_int32_t, char *); VNET_DECLARE(struct pf_kstatus, pf_status); Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Thu Jun 18 20:21:02 2015 (r284568) +++ stable/10/sys/netpfil/pf/pf.c Thu Jun 18 20:28:52 2015 (r284569) @@ -368,6 +368,45 @@ VNET_DEFINE(void *, pf_swi_cookie); VNET_DEFINE(uint32_t, pf_hashseed); #define V_pf_hashseed VNET(pf_hashseed) +int +pf_addr_cmp(struct pf_addr *a, struct pf_addr *b, sa_family_t af) +{ + + switch (af) { +#ifdef INET + case AF_INET: + if (a->addr32[0] > b->addr32[0]) + return (1); + if (a->addr32[0] < b->addr32[0]) + return (-1); + break; +#endif /* INET */ +#ifdef INET6 + case AF_INET6: + if (a->addr32[3] > b->addr32[3]) + return (1); + if (a->addr32[3] < b->addr32[3]) + return (-1); + if (a->addr32[2] > b->addr32[2]) + return (1); + if (a->addr32[2] < b->addr32[2]) + return (-1); + if (a->addr32[1] > b->addr32[1]) + return (1); + if (a->addr32[1] < b->addr32[1]) + return (-1); + if (a->addr32[0] > b->addr32[0]) + return (1); + if (a->addr32[0] < b->addr32[0]) + return (-1); + break; +#endif /* INET6 */ + default: + panic("%s: unknown address family %u", __func__, af); + } + return (0); +} + static __inline uint32_t pf_hashkey(struct pf_state_key *sk) { Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:21:02 2015 (r284568) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:28:52 2015 (r284569) @@ -1,5 +1,6 @@ /*- * Copyright 2001 Niels Provos + * Copyright 2011 Alexander Bluhm * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -57,38 +59,51 @@ __FBSDID("$FreeBSD$"); #endif /* INET6 */ struct pf_frent { - LIST_ENTRY(pf_frent) fr_next; - union { - struct { - struct ip *_fr_ip; - struct mbuf *_fr_m; - } _frag; - struct { - uint16_t _fr_off; - uint16_t _fr_end; - } _cache; - } _u; + TAILQ_ENTRY(pf_frent) fr_next; + struct mbuf *fe_m; + uint16_t fe_hdrlen; /* ipv4 header lenght with ip options + ipv6, extension, fragment header */ + uint16_t fe_extoff; /* last extension header offset or 0 */ + uint16_t fe_len; /* fragment length */ + uint16_t fe_off; /* fragment offset */ + uint16_t fe_mff; /* more fragment flag */ +}; + +struct pf_fragment_cmp { + struct pf_addr frc_src; + struct pf_addr frc_dst; + uint32_t frc_id; + sa_family_t frc_af; + uint8_t frc_proto; + uint8_t frc_direction; }; -#define fr_ip _u._frag._fr_ip -#define fr_m _u._frag._fr_m -#define fr_off _u._cache._fr_off -#define fr_end _u._cache._fr_end struct pf_fragment { + struct pf_fragment_cmp fr_key; +#define fr_src fr_key.frc_src +#define fr_dst fr_key.frc_dst +#define fr_id fr_key.frc_id +#define fr_af fr_key.frc_af +#define fr_proto fr_key.frc_proto +#define fr_direction fr_key.frc_direction + RB_ENTRY(pf_fragment) fr_entry; TAILQ_ENTRY(pf_fragment) frag_next; - struct in_addr fr_src; - struct in_addr fr_dst; - u_int8_t fr_p; /* protocol of this fragment */ - u_int8_t fr_flags; /* status flags */ -#define PFFRAG_SEENLAST 0x0001 /* Seen the last fragment for this */ -#define PFFRAG_NOBUFFER 0x0002 /* Non-buffering fragment cache */ -#define PFFRAG_DROP 0x0004 /* Drop all fragments */ + uint8_t fr_flags; /* status flags */ +#define PFFRAG_SEENLAST 0x0001 /* Seen the last fragment for this */ +#define PFFRAG_NOBUFFER 0x0002 /* Non-buffering fragment cache */ +#define PFFRAG_DROP 0x0004 /* Drop all fragments */ #define BUFFER_FRAGMENTS(fr) (!((fr)->fr_flags & PFFRAG_NOBUFFER)) - u_int16_t fr_id; /* fragment id for reassemble */ - u_int16_t fr_max; /* fragment data max */ - u_int32_t fr_timeout; - LIST_HEAD(, pf_frent) fr_queue; + uint16_t fr_max; /* fragment data max */ + uint32_t fr_timeout; + uint16_t fr_maxlen; /* maximum length of single fragment */ + TAILQ_HEAD(pf_fragq, pf_frent) fr_queue; +}; + +struct pf_fragment_tag { + uint16_t ft_hdrlen; /* header length of reassembled pkt */ + uint16_t ft_extoff; /* last extension header offset or 0 */ + uint16_t ft_maxlen; /* maximum fragment payload length */ }; static struct mtx pf_frag_mtx; @@ -125,15 +140,25 @@ static void pf_remove_fragment(struct static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *, struct tcphdr *, int, sa_family_t); #ifdef INET -static void pf_ip2key(struct pf_fragment *, struct ip *); static void pf_scrub_ip(struct mbuf **, u_int32_t, u_int8_t, u_int8_t); static void pf_flush_fragments(void); -static struct pf_fragment *pf_find_fragment(struct ip *, struct pf_frag_tree *); -static struct mbuf *pf_reassemble(struct mbuf **, struct pf_fragment **, - struct pf_frent *, int); +static struct pf_fragment *pf_find_fragment(struct pf_fragment_cmp *key, + struct pf_frag_tree *tree); +struct pf_frent *pf_create_fragment(u_short *); +static int pf_reassemble(struct mbuf **, struct ip *, int, + u_short *); +int pf_reassemble6(struct mbuf **, struct ip6_hdr *, + struct ip6_frag *, uint16_t, uint16_t, int, + u_short *); static struct mbuf *pf_fragcache(struct mbuf **, struct ip*, struct pf_fragment **, int, int, int *); +static struct pf_fragment *pf_fillup_fragment(struct pf_fragment_cmp *, + struct pf_frent *, u_short *); +int pf_isfull_fragment(struct pf_fragment *); +struct mbuf *pf_join_fragment(struct pf_fragment *); + + #endif /* INET */ #ifdef INET6 static void pf_scrub_ip6(struct mbuf **, u_int8_t); @@ -145,6 +170,18 @@ static void pf_scrub_ip6(struct mbuf * } \ } while(0) +static void +pf_ip2key(struct ip *ip, int dir, struct pf_fragment_cmp *key) +{ + + key->frc_src.v4 = ip->ip_src; + key->frc_dst.v4 = ip->ip_dst; + key->frc_af = AF_INET; + key->frc_proto = ip->ip_p; + key->frc_id = ip->ip_id; + key->frc_direction = dir; +} + void pf_normalize_init(void) { @@ -184,18 +221,16 @@ pf_frag_compare(struct pf_fragment *a, s { int diff; - if ((diff = a->fr_id - b->fr_id)) + if ((diff = a->fr_id - b->fr_id) != 0) return (diff); - else if ((diff = a->fr_p - b->fr_p)) + if ((diff = a->fr_proto - b->fr_proto) != 0) + return (diff); + if ((diff = a->fr_af - b->fr_af) != 0) + return (diff); + if ((diff = pf_addr_cmp(&a->fr_src, &b->fr_src, a->fr_af)) != 0) + return (diff); + if ((diff = pf_addr_cmp(&a->fr_dst, &b->fr_dst, a->fr_af)) != 0) return (diff); - else if (a->fr_src.s_addr < b->fr_src.s_addr) - return (-1); - else if (a->fr_src.s_addr > b->fr_src.s_addr) - return (1); - else if (a->fr_dst.s_addr < b->fr_dst.s_addr) - return (-1); - else if (a->fr_dst.s_addr > b->fr_dst.s_addr) - return (1); return (0); } @@ -270,23 +305,23 @@ pf_free_fragment(struct pf_fragment *fra /* Free all fragments */ if (BUFFER_FRAGMENTS(frag)) { - for (frent = LIST_FIRST(&frag->fr_queue); frent; - frent = LIST_FIRST(&frag->fr_queue)) { - LIST_REMOVE(frent, fr_next); + for (frent = TAILQ_FIRST(&frag->fr_queue); frent; + frent = TAILQ_FIRST(&frag->fr_queue)) { + TAILQ_REMOVE(&frag->fr_queue, frent, fr_next); - m_freem(frent->fr_m); + m_freem(frent->fe_m); uma_zfree(V_pf_frent_z, frent); } } else { - for (frent = LIST_FIRST(&frag->fr_queue); frent; - frent = LIST_FIRST(&frag->fr_queue)) { - LIST_REMOVE(frent, fr_next); - - KASSERT((LIST_EMPTY(&frag->fr_queue) || - LIST_FIRST(&frag->fr_queue)->fr_off > - frent->fr_end), - ("! (LIST_EMPTY() || LIST_FIRST()->fr_off >" - " frent->fr_end): %s", __func__)); + for (frent = TAILQ_FIRST(&frag->fr_queue); frent; + frent = TAILQ_FIRST(&frag->fr_queue)) { + TAILQ_REMOVE(&frag->fr_queue, frent, fr_next); + + KASSERT((TAILQ_EMPTY(&frag->fr_queue) || + TAILQ_FIRST(&frag->fr_queue)->fe_off > + frent->fe_len), + ("! (TAILQ_EMPTY() || TAILQ_FIRST()->fe_off >" + " frent->fe_len): %s", __func__)); uma_zfree(V_pf_frent_z, frent); } @@ -296,26 +331,14 @@ pf_free_fragment(struct pf_fragment *fra } #ifdef INET -static void -pf_ip2key(struct pf_fragment *key, struct ip *ip) -{ - key->fr_p = ip->ip_p; - key->fr_id = ip->ip_id; - key->fr_src.s_addr = ip->ip_src.s_addr; - key->fr_dst.s_addr = ip->ip_dst.s_addr; -} - static struct pf_fragment * -pf_find_fragment(struct ip *ip, struct pf_frag_tree *tree) +pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree) { - struct pf_fragment key; struct pf_fragment *frag; PF_FRAG_ASSERT(); - pf_ip2key(&key, ip); - - frag = RB_FIND(pf_frag_tree, tree, &key); + frag = RB_FIND(pf_frag_tree, tree, (struct pf_fragment *)key); if (frag != NULL) { /* XXX Are we sure we want to update the timeout? */ frag->fr_timeout = time_uptime; @@ -352,210 +375,412 @@ pf_remove_fragment(struct pf_fragment *f } #ifdef INET -#define FR_IP_OFF(fr) ((ntohs((fr)->fr_ip->ip_off) & IP_OFFMASK) << 3) -static struct mbuf * -pf_reassemble(struct mbuf **m0, struct pf_fragment **frag, - struct pf_frent *frent, int mff) +struct pf_frent * +pf_create_fragment(u_short *reason) { - struct mbuf *m = *m0, *m2; - struct pf_frent *frea, *next; - struct pf_frent *frep = NULL; - struct ip *ip = frent->fr_ip; - int hlen = ip->ip_hl << 2; - u_int16_t off = (ntohs(ip->ip_off) & IP_OFFMASK) << 3; - u_int16_t ip_len = ntohs(ip->ip_len) - ip->ip_hl * 4; - u_int16_t max = ip_len + off; + struct pf_frent *frent; PF_FRAG_ASSERT(); - KASSERT((*frag == NULL || BUFFER_FRAGMENTS(*frag)), - ("! (*frag == NULL || BUFFER_FRAGMENTS(*frag)): %s", __FUNCTION__)); - /* Strip off ip header */ - m->m_data += hlen; - m->m_len -= hlen; + frent = uma_zalloc(V_pf_frent_z, M_NOWAIT); + if (frent == NULL) { + pf_flush_fragments(); + frent = uma_zalloc(V_pf_frent_z, M_NOWAIT); + if (frent == NULL) { + REASON_SET(reason, PFRES_MEMORY); + return (NULL); + } + } + + return (frent); +} - /* Create a new reassembly queue for this packet */ - if (*frag == NULL) { - *frag = uma_zalloc(V_pf_frag_z, M_NOWAIT); - if (*frag == NULL) { +struct pf_fragment * +pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, + u_short *reason) +{ + struct pf_frent *after, *next, *prev; + struct pf_fragment *frag; + uint16_t total; + + PF_FRAG_ASSERT(); + + /* No empty fragments. */ + if (frent->fe_len == 0) { + DPFPRINTF(("bad fragment: len 0")); + goto bad_fragment; + } + + /* All fragments are 8 byte aligned. */ + if (frent->fe_mff && (frent->fe_len & 0x7)) { + DPFPRINTF(("bad fragment: mff and len %d", frent->fe_len)); + goto bad_fragment; + } + + /* Respect maximum length, IP_MAXPACKET == IPV6_MAXPACKET. */ + if (frent->fe_off + frent->fe_len > IP_MAXPACKET) { + DPFPRINTF(("bad fragment: max packet %d", + frent->fe_off + frent->fe_len)); + goto bad_fragment; + } + + DPFPRINTF((key->frc_af == AF_INET ? + "reass frag %d @ %d-%d" : "reass frag %#08x @ %d-%d", + key->frc_id, frent->fe_off, frent->fe_off + frent->fe_len)); + + /* Fully buffer all of the fragments in this fragment queue. */ + frag = pf_find_fragment(key, &V_pf_frag_tree); + + /* Create a new reassembly queue for this packet. */ + if (frag == NULL) { + frag = uma_zalloc(V_pf_frag_z, M_NOWAIT); + if (frag == NULL) { pf_flush_fragments(); - *frag = uma_zalloc(V_pf_frag_z, M_NOWAIT); - if (*frag == NULL) + frag = uma_zalloc(V_pf_frag_z, M_NOWAIT); + if (frag == NULL) { + REASON_SET(reason, PFRES_MEMORY); goto drop_fragment; + } } - (*frag)->fr_flags = 0; - (*frag)->fr_max = 0; - (*frag)->fr_src = frent->fr_ip->ip_src; - (*frag)->fr_dst = frent->fr_ip->ip_dst; - (*frag)->fr_p = frent->fr_ip->ip_p; - (*frag)->fr_id = frent->fr_ip->ip_id; - (*frag)->fr_timeout = time_uptime; - LIST_INIT(&(*frag)->fr_queue); + *(struct pf_fragment_cmp *)frag = *key; + frag->fr_timeout = time_second; + frag->fr_maxlen = frent->fe_len; + TAILQ_INIT(&frag->fr_queue); + + RB_INSERT(pf_frag_tree, &V_pf_frag_tree, frag); + TAILQ_INSERT_HEAD(&V_pf_fragqueue, frag, frag_next); - RB_INSERT(pf_frag_tree, &V_pf_frag_tree, *frag); - TAILQ_INSERT_HEAD(&V_pf_fragqueue, *frag, frag_next); + /* We do not have a previous fragment. */ + TAILQ_INSERT_HEAD(&frag->fr_queue, frent, fr_next); - /* We do not have a previous fragment */ - frep = NULL; - goto insert; + return (frag); } - /* - * Find a fragment after the current one: - * - off contains the real shifted offset. - */ - LIST_FOREACH(frea, &(*frag)->fr_queue, fr_next) { - if (FR_IP_OFF(frea) > off) + KASSERT(!TAILQ_EMPTY(&frag->fr_queue), ("!TAILQ_EMPTY()->fr_queue")); + + /* Remember maximum fragment len for refragmentation. */ + if (frent->fe_len > frag->fr_maxlen) + frag->fr_maxlen = frent->fe_len; + + /* Maximum data we have seen already. */ + total = TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_off + + TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_len; + + /* Non terminal fragments must have more fragments flag. */ + if (frent->fe_off + frent->fe_len < total && !frent->fe_mff) + goto bad_fragment; + + /* Check if we saw the last fragment already. */ + if (!TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_mff) { + if (frent->fe_off + frent->fe_len > total || + (frent->fe_off + frent->fe_len == total && frent->fe_mff)) + goto bad_fragment; + } else { + if (frent->fe_off + frent->fe_len == total && !frent->fe_mff) + goto bad_fragment; + } + + /* Find a fragment after the current one. */ + prev = NULL; + TAILQ_FOREACH(after, &frag->fr_queue, fr_next) { + if (after->fe_off > frent->fe_off) break; - frep = frea; + prev = after; } - KASSERT((frep != NULL || frea != NULL), - ("!(frep != NULL || frea != NULL): %s", __FUNCTION__));; + KASSERT(prev != NULL || after != NULL, + ("prev != NULL || after != NULL")); - if (frep != NULL && - FR_IP_OFF(frep) + ntohs(frep->fr_ip->ip_len) - frep->fr_ip->ip_hl * - 4 > off) - { - u_int16_t precut; + if (prev != NULL && prev->fe_off + prev->fe_len > frent->fe_off) { + uint16_t precut; - precut = FR_IP_OFF(frep) + ntohs(frep->fr_ip->ip_len) - - frep->fr_ip->ip_hl * 4 - off; - if (precut >= ip_len) - goto drop_fragment; - m_adj(frent->fr_m, precut); - DPFPRINTF(("overlap -%d\n", precut)); - /* Enforce 8 byte boundaries */ - ip->ip_off = htons(ntohs(ip->ip_off) + (precut >> 3)); - off = (ntohs(ip->ip_off) & IP_OFFMASK) << 3; - ip_len -= precut; - ip->ip_len = htons(ip_len); - } - - for (; frea != NULL && ip_len + off > FR_IP_OFF(frea); - frea = next) - { - u_int16_t aftercut; - - aftercut = ip_len + off - FR_IP_OFF(frea); - DPFPRINTF(("adjust overlap %d\n", aftercut)); - if (aftercut < ntohs(frea->fr_ip->ip_len) - frea->fr_ip->ip_hl - * 4) - { - frea->fr_ip->ip_len = - htons(ntohs(frea->fr_ip->ip_len) - aftercut); - frea->fr_ip->ip_off = htons(ntohs(frea->fr_ip->ip_off) + - (aftercut >> 3)); - m_adj(frea->fr_m, aftercut); + precut = prev->fe_off + prev->fe_len - frent->fe_off; + if (precut >= frent->fe_len) + goto bad_fragment; + DPFPRINTF(("overlap -%d", precut)); + m_adj(frent->fe_m, precut); + frent->fe_off += precut; + frent->fe_len -= precut; + } + + for (; after != NULL && frent->fe_off + frent->fe_len > after->fe_off; + after = next) { + uint16_t aftercut; + + aftercut = frent->fe_off + frent->fe_len - after->fe_off; + DPFPRINTF(("adjust overlap %d", aftercut)); + if (aftercut < after->fe_len) { + m_adj(after->fe_m, aftercut); + after->fe_off += aftercut; + after->fe_len -= aftercut; break; } - /* This fragment is completely overlapped, lose it */ - next = LIST_NEXT(frea, fr_next); - m_freem(frea->fr_m); - LIST_REMOVE(frea, fr_next); - uma_zfree(V_pf_frent_z, frea); + /* This fragment is completely overlapped, lose it. */ + next = TAILQ_NEXT(after, fr_next); + m_freem(after->fe_m); + TAILQ_REMOVE(&frag->fr_queue, after, fr_next); + uma_zfree(V_pf_frent_z, after); } - insert: - /* Update maximum data size */ - if ((*frag)->fr_max < max) - (*frag)->fr_max = max; - /* This is the last segment */ - if (!mff) - (*frag)->fr_flags |= PFFRAG_SEENLAST; - - if (frep == NULL) - LIST_INSERT_HEAD(&(*frag)->fr_queue, frent, fr_next); + if (prev == NULL) + TAILQ_INSERT_HEAD(&frag->fr_queue, frent, fr_next); else - LIST_INSERT_AFTER(frep, frent, fr_next); + TAILQ_INSERT_AFTER(&frag->fr_queue, prev, frent, fr_next); + + return (frag); + +bad_fragment: + REASON_SET(reason, PFRES_FRAG); +drop_fragment: + uma_zfree(V_pf_frent_z, frent); + return (NULL); +} + +int +pf_isfull_fragment(struct pf_fragment *frag) +{ + struct pf_frent *frent, *next; + uint16_t off, total; /* Check if we are completely reassembled */ - if (!((*frag)->fr_flags & PFFRAG_SEENLAST)) - return (NULL); + if (TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_mff) + return (0); + + /* Maximum data we have seen already */ + total = TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_off + + TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_len; /* Check if we have all the data */ off = 0; - for (frep = LIST_FIRST(&(*frag)->fr_queue); frep; frep = next) { - next = LIST_NEXT(frep, fr_next); + for (frent = TAILQ_FIRST(&frag->fr_queue); frent; frent = next) { + next = TAILQ_NEXT(frent, fr_next); - off += ntohs(frep->fr_ip->ip_len) - frep->fr_ip->ip_hl * 4; - if (off < (*frag)->fr_max && - (next == NULL || FR_IP_OFF(next) != off)) - { - DPFPRINTF(("missing fragment at %d, next %d, max %d\n", - off, next == NULL ? -1 : FR_IP_OFF(next), - (*frag)->fr_max)); - return (NULL); + off += frent->fe_len; + if (off < total && (next == NULL || next->fe_off != off)) { + DPFPRINTF(("missing fragment at %d, next %d, total %d", + off, next == NULL ? -1 : next->fe_off, total)); + return (0); } } - DPFPRINTF(("%d < %d?\n", off, (*frag)->fr_max)); - if (off < (*frag)->fr_max) - return (NULL); + DPFPRINTF(("%d < %d?", off, total)); + if (off < total) + return (0); + KASSERT(off == total, ("off == total")); - /* We have all the data */ - frent = LIST_FIRST(&(*frag)->fr_queue); - KASSERT((frent != NULL), ("frent == NULL: %s", __FUNCTION__)); - if ((frent->fr_ip->ip_hl << 2) + off > IP_MAXPACKET) { - DPFPRINTF(("drop: too big: %d\n", off)); - pf_free_fragment(*frag); - *frag = NULL; - return (NULL); - } - next = LIST_NEXT(frent, fr_next); + return (1); +} - /* Magic from ip_input */ - ip = frent->fr_ip; - m = frent->fr_m; +struct mbuf * +pf_join_fragment(struct pf_fragment *frag) +{ + struct mbuf *m, *m2; + struct pf_frent *frent, *next; + + frent = TAILQ_FIRST(&frag->fr_queue); + next = TAILQ_NEXT(frent, fr_next); + + /* Magic from ip_input. */ + m = frent->fe_m; m2 = m->m_next; m->m_next = NULL; m_cat(m, m2); uma_zfree(V_pf_frent_z, frent); for (frent = next; frent != NULL; frent = next) { - next = LIST_NEXT(frent, fr_next); + next = TAILQ_NEXT(frent, fr_next); - m2 = frent->fr_m; + m2 = frent->fe_m; + /* Strip off ip header. */ + m_adj(m2, frent->fe_hdrlen); uma_zfree(V_pf_frent_z, frent); - m->m_pkthdr.csum_flags &= m2->m_pkthdr.csum_flags; - m->m_pkthdr.csum_data += m2->m_pkthdr.csum_data; m_cat(m, m2); } - while (m->m_pkthdr.csum_data & 0xffff0000) - m->m_pkthdr.csum_data = (m->m_pkthdr.csum_data & 0xffff) + - (m->m_pkthdr.csum_data >> 16); - ip->ip_src = (*frag)->fr_src; - ip->ip_dst = (*frag)->fr_dst; - - /* Remove from fragment queue */ - pf_remove_fragment(*frag); - *frag = NULL; - - hlen = ip->ip_hl << 2; - ip->ip_len = htons(off + hlen); - m->m_len += hlen; - m->m_data -= hlen; + /* Remove from fragment queue. */ + pf_remove_fragment(frag); + + return (m); +} + +#define FR_IP_OFF(fr) ((ntohs((fr)->fr_ip->ip_off) & IP_OFFMASK) << 3) +static int +pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason) +{ + struct mbuf *m = *m0; + struct pf_frent *frent; + struct pf_fragment *frag; + struct pf_fragment_cmp key; + uint16_t total, hdrlen; + + /* Get an entry for the fragment queue */ + if ((frent = pf_create_fragment(reason)) == NULL) + return (PF_DROP); + + frent->fe_m = m; + frent->fe_hdrlen = ip->ip_hl << 2; + frent->fe_extoff = 0; + frent->fe_len = ntohs(ip->ip_len) - (ip->ip_hl << 2); + frent->fe_off = (ntohs(ip->ip_off) & IP_OFFMASK) << 3; + frent->fe_mff = ntohs(ip->ip_off) & IP_MF; + + pf_ip2key(ip, dir, &key); + + if ((frag = pf_fillup_fragment(&key, frent, reason)) == NULL) + return (PF_DROP); + + /* The mbuf is part of the fragment entry, no direct free or access */ + m = *m0 = NULL; + + if (!pf_isfull_fragment(frag)) + return (PF_PASS); /* drop because *m0 is NULL, no error */ + + /* We have all the data */ + frent = TAILQ_FIRST(&frag->fr_queue); + KASSERT(frent != NULL, ("frent != NULL")); + total = TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_off + + TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_len; + hdrlen = frent->fe_hdrlen; + + m = *m0 = pf_join_fragment(frag); + frag = NULL; - /* some debugging cruft by sklower, below, will go away soon */ - /* XXX this should be done elsewhere */ if (m->m_flags & M_PKTHDR) { int plen = 0; - for (m2 = m; m2; m2 = m2->m_next) - plen += m2->m_len; + for (m = *m0; m; m = m->m_next) + plen += m->m_len; + m = *m0; m->m_pkthdr.len = plen; } + ip = mtod(m, struct ip *); + ip->ip_len = htons(hdrlen + total); + ip->ip_off &= ~(IP_MF|IP_OFFMASK); + + if (hdrlen + total > IP_MAXPACKET) { + DPFPRINTF(("drop: too big: %d", total)); + ip->ip_len = 0; + REASON_SET(reason, PFRES_SHORT); + /* PF_DROP requires a valid mbuf *m0 in pf_test() */ + return (PF_DROP); + } + DPFPRINTF(("complete: %p(%d)\n", m, ntohs(ip->ip_len))); - return (m); + return (PF_PASS); +} - drop_fragment: - /* Oops - fail safe - drop packet */ - uma_zfree(V_pf_frent_z, frent); - m_freem(m); - return (NULL); +#ifdef INET6 +int +pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, struct ip6_frag *fraghdr, + uint16_t hdrlen, uint16_t extoff, int dir, u_short *reason) +{ + struct mbuf *m = *m0; + struct pf_frent *frent; + struct pf_fragment *frag; + struct pf_fragment_cmp key; + int off; + uint16_t total, maxlen; + uint8_t proto; + + PF_FRAG_LOCK(); + + /* Get an entry for the fragment queue. */ + if ((frent = pf_create_fragment(reason)) == NULL) { + PF_FRAG_UNLOCK(); + return (PF_DROP); + } + + frent->fe_m = m; + frent->fe_hdrlen = hdrlen; + frent->fe_extoff = extoff; + frent->fe_len = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - hdrlen; + frent->fe_off = ntohs(fraghdr->ip6f_offlg & IP6F_OFF_MASK); + frent->fe_mff = fraghdr->ip6f_offlg & IP6F_MORE_FRAG; + + key.frc_src.v6 = ip6->ip6_src; + key.frc_dst.v6 = ip6->ip6_dst; + key.frc_af = AF_INET6; + /* Only the first fragment's protocol is relevant. */ + key.frc_proto = 0; + key.frc_id = fraghdr->ip6f_ident; + key.frc_direction = dir; + + if ((frag = pf_fillup_fragment(&key, frent, reason)) == NULL) { + PF_FRAG_UNLOCK(); + return (PF_DROP); + } + + /* The mbuf is part of the fragment entry, no direct free or access. */ + m = *m0 = NULL; + + if (!pf_isfull_fragment(frag)) { + PF_FRAG_UNLOCK(); + return (PF_PASS); /* Drop because *m0 is NULL, no error. */ + } + + /* We have all the data. */ + extoff = frent->fe_extoff; + maxlen = frag->fr_maxlen; + frent = TAILQ_FIRST(&frag->fr_queue); + KASSERT(frent != NULL, ("frent != NULL")); + total = TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_off + + TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_len; + hdrlen = frent->fe_hdrlen - sizeof(struct ip6_frag); + + m = *m0 = pf_join_fragment(frag); + frag = NULL; + + PF_FRAG_UNLOCK(); + + /* Take protocol from first fragment header. */ + m = m_getptr(m, hdrlen + offsetof(struct ip6_frag, ip6f_nxt), &off); + KASSERT(m, ("%s: short mbuf chain", __func__)); + proto = *(mtod(m, caddr_t) + off); + m = *m0; + + /* Delete frag6 header */ + if (ip6_deletefraghdr(m, hdrlen, M_NOWAIT) != 0) + goto fail; + + if (m->m_flags & M_PKTHDR) { + int plen = 0; + for (m = *m0; m; m = m->m_next) + plen += m->m_len; + m = *m0; + m->m_pkthdr.len = plen; + } + + ip6 = mtod(m, struct ip6_hdr *); + ip6->ip6_plen = htons(hdrlen - sizeof(struct ip6_hdr) + total); + if (extoff) { + /* Write protocol into next field of last extension header. */ + m = m_getptr(m, extoff + offsetof(struct ip6_ext, ip6e_nxt), + &off); + KASSERT(m, ("%s: short mbuf chain", __func__)); + *(mtod(m, char *) + off) = proto; + m = *m0; + } else + ip6->ip6_nxt = proto; + + if (hdrlen - sizeof(struct ip6_hdr) + total > IPV6_MAXPACKET) { + DPFPRINTF(("drop: too big: %d", total)); + ip6->ip6_plen = 0; + REASON_SET(reason, PFRES_SHORT); + /* PF_DROP requires a valid mbuf *m0 in pf_test6(). */ + return (PF_DROP); + } + + DPFPRINTF(("complete: %p(%d)", m, ntohs(ip6->ip6_plen))); + return (PF_PASS); + +fail: + REASON_SET(reason, PFRES_MEMORY); + /* PF_DROP requires a valid mbuf *m0 in pf_test6(), will free later. */ + return (PF_DROP); } +#endif + static struct mbuf * pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int mff, int drop, int *nomem) @@ -591,16 +816,15 @@ pf_fragcache(struct mbuf **m0, struct ip (*frag)->fr_flags = PFFRAG_NOBUFFER; (*frag)->fr_max = 0; - (*frag)->fr_src = h->ip_src; - (*frag)->fr_dst = h->ip_dst; - (*frag)->fr_p = h->ip_p; + (*frag)->fr_src.v4 = h->ip_src; + (*frag)->fr_dst.v4 = h->ip_dst; (*frag)->fr_id = h->ip_id; (*frag)->fr_timeout = time_uptime; - cur->fr_off = off; - cur->fr_end = max; - LIST_INIT(&(*frag)->fr_queue); - LIST_INSERT_HEAD(&(*frag)->fr_queue, cur, fr_next); + cur->fe_off = off; + cur->fe_len = max; /* TODO: fe_len = max - off ? */ + TAILQ_INIT(&(*frag)->fr_queue); + TAILQ_INSERT_HEAD(&(*frag)->fr_queue, cur, fr_next); RB_INSERT(pf_frag_tree, &V_pf_cache_tree, *frag); TAILQ_INSERT_HEAD(&V_pf_cachequeue, *frag, frag_next); @@ -615,8 +839,8 @@ pf_fragcache(struct mbuf **m0, struct ip * - off contains the real shifted offset. */ frp = NULL; - LIST_FOREACH(fra, &(*frag)->fr_queue, fr_next) { - if (fra->fr_off > off) + TAILQ_FOREACH(fra, &(*frag)->fr_queue, fr_next) { + if (fra->fe_off > off) break; frp = fra; } @@ -627,18 +851,18 @@ pf_fragcache(struct mbuf **m0, struct ip if (frp != NULL) { int precut; - precut = frp->fr_end - off; + precut = frp->fe_len - off; if (precut >= ip_len) { /* Fragment is entirely a duplicate */ DPFPRINTF(("fragcache[%d]: dead (%d-%d) %d-%d\n", - h->ip_id, frp->fr_off, frp->fr_end, off, max)); + h->ip_id, frp->fe_off, frp->fe_len, off, max)); goto drop_fragment; } if (precut == 0) { /* They are adjacent. Fixup cache entry */ DPFPRINTF(("fragcache[%d]: adjacent (%d-%d) %d-%d\n", - h->ip_id, frp->fr_off, frp->fr_end, off, max)); - frp->fr_end = max; + h->ip_id, frp->fe_off, frp->fe_len, off, max)); + frp->fe_len = max; } else if (precut > 0) { /* The first part of this payload overlaps with a * fragment that has already been passed. @@ -648,13 +872,13 @@ pf_fragcache(struct mbuf **m0, struct ip */ DPFPRINTF(("fragcache[%d]: chop %d (%d-%d) %d-%d\n", - h->ip_id, precut, frp->fr_off, frp->fr_end, off, + h->ip_id, precut, frp->fe_off, frp->fe_len, off, max)); off += precut; max -= precut; /* Update the previous frag to encompass this one */ - frp->fr_end = max; + frp->fe_len = max; if (!drop) { /* XXX Optimization opportunity @@ -702,16 +926,16 @@ pf_fragcache(struct mbuf **m0, struct ip /* There is a gap between fragments */ DPFPRINTF(("fragcache[%d]: gap %d (%d-%d) %d-%d\n", - h->ip_id, -precut, frp->fr_off, frp->fr_end, off, + h->ip_id, -precut, frp->fe_off, frp->fe_len, off, max)); cur = uma_zalloc(V_pf_frent_z, M_NOWAIT); if (cur == NULL) goto no_mem; - cur->fr_off = off; - cur->fr_end = max; - LIST_INSERT_AFTER(frp, cur, fr_next); + cur->fe_off = off; + cur->fe_len = max; + TAILQ_INSERT_AFTER(&(*frag)->fr_queue, frp, cur, fr_next); } } @@ -719,19 +943,19 @@ pf_fragcache(struct mbuf **m0, struct ip int aftercut; int merge = 0; - aftercut = max - fra->fr_off; + aftercut = max - fra->fe_off; if (aftercut == 0) { /* Adjacent fragments */ DPFPRINTF(("fragcache[%d]: adjacent %d-%d (%d-%d)\n", - h->ip_id, off, max, fra->fr_off, fra->fr_end)); - fra->fr_off = off; + h->ip_id, off, max, fra->fe_off, fra->fe_len)); + fra->fe_off = off; merge = 1; } else if (aftercut > 0) { /* Need to chop off the tail of this fragment */ DPFPRINTF(("fragcache[%d]: chop %d %d-%d (%d-%d)\n", - h->ip_id, aftercut, off, max, fra->fr_off, - fra->fr_end)); - fra->fr_off = off; + h->ip_id, aftercut, off, max, fra->fe_off, + fra->fe_len)); + fra->fe_off = off; max -= aftercut; merge = 1; @@ -756,42 +980,42 @@ pf_fragcache(struct mbuf **m0, struct ip } else if (frp == NULL) { /* There is a gap between fragments */ DPFPRINTF(("fragcache[%d]: gap %d %d-%d (%d-%d)\n", - h->ip_id, -aftercut, off, max, fra->fr_off, - fra->fr_end)); + h->ip_id, -aftercut, off, max, fra->fe_off, + fra->fe_len)); cur = uma_zalloc(V_pf_frent_z, M_NOWAIT); if (cur == NULL) goto no_mem; - cur->fr_off = off; - cur->fr_end = max; - LIST_INSERT_BEFORE(fra, cur, fr_next); + cur->fe_off = off; + cur->fe_len = max; + TAILQ_INSERT_HEAD(&(*frag)->fr_queue, cur, fr_next); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:32:54 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA91D558; Thu, 18 Jun 2015 20:32:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBEFC981; Thu, 18 Jun 2015 20:32:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKWsse027036; Thu, 18 Jun 2015 20:32:54 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKWsug027034; Thu, 18 Jun 2015 20:32:54 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182032.t5IKWsug027034@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284570 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:32:55 -0000 Author: kp Date: Thu Jun 18 20:32:53 2015 New Revision: 284570 URL: https://svnweb.freebsd.org/changeset/base/284570 Log: Merge r278842 Factor out ip6_fragment() function, to be used in IPv6 stack and pf(4). Differential Revision: https://reviews.freebsd.org/D2815 Reviewed by: gnn Modified: stable/10/sys/netinet6/ip6_output.c stable/10/sys/netinet6/ip6_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/ip6_output.c ============================================================================== --- stable/10/sys/netinet6/ip6_output.c Thu Jun 18 20:28:52 2015 (r284569) +++ stable/10/sys/netinet6/ip6_output.c Thu Jun 18 20:32:53 2015 (r284570) @@ -208,6 +208,65 @@ in6_delayed_cksum(struct mbuf *m, uint32 *(u_short *)(m->m_data + offset) = csum; } +int +ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto, + int mtu) +{ + struct mbuf *m, **mnext, *m_frgpart; + struct ip6_hdr *ip6, *mhip6; + struct ip6_frag *ip6f; + int off; + int error; + int tlen = m0->m_pkthdr.len; + uint32_t id = htonl(ip6_randomid()); + + m = m0; + ip6 = mtod(m, struct ip6_hdr *); + mnext = &m->m_nextpkt; + + for (off = hlen; off < tlen; off += mtu) { + m = m_gethdr(M_NOWAIT, MT_DATA); + if (!m) { + IP6STAT_INC(ip6s_odropped); + return (ENOBUFS); + } + m->m_flags = m0->m_flags & M_COPYFLAGS; + *mnext = m; + mnext = &m->m_nextpkt; + m->m_data += max_linkhdr; + mhip6 = mtod(m, struct ip6_hdr *); + *mhip6 = *ip6; + m->m_len = sizeof(*mhip6); + error = ip6_insertfraghdr(m0, m, hlen, &ip6f); + if (error) { + IP6STAT_INC(ip6s_odropped); + return (error); + } + ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7)); + if (off + mtu >= tlen) + mtu = tlen - off; + else + ip6f->ip6f_offlg |= IP6F_MORE_FRAG; + mhip6->ip6_plen = htons((u_short)(mtu + hlen + + sizeof(*ip6f) - sizeof(struct ip6_hdr))); + if ((m_frgpart = m_copy(m0, off, mtu)) == 0) { + IP6STAT_INC(ip6s_odropped); + return (ENOBUFS); + } + m_cat(m, m_frgpart); + m->m_pkthdr.len = mtu + hlen + sizeof(*ip6f); + m->m_pkthdr.fibnum = m0->m_pkthdr.fibnum; + m->m_pkthdr.rcvif = NULL; + ip6f->ip6f_reserved = 0; + ip6f->ip6f_ident = id; + ip6f->ip6f_nxt = nextproto; + IP6STAT_INC(ip6s_ofragments); + in6_ifstat_inc(ifp, ifs6_out_fragcreat); + } + + return (0); +} + /* * IP6 output. The packet in mbuf chain m contains a skeletal IP6 * header (with pri, len, nxt, hlim, src, dst). @@ -229,11 +288,11 @@ ip6_output(struct mbuf *m0, struct ip6_p struct route_in6 *ro, int flags, struct ip6_moptions *im6o, struct ifnet **ifpp, struct inpcb *inp) { - struct ip6_hdr *ip6, *mhip6; + struct ip6_hdr *ip6; struct ifnet *ifp, *origifp; struct mbuf *m = m0; struct mbuf *mprev = NULL; - int hlen, tlen, len, off; + int hlen, tlen, len; struct route_in6 ip6route; struct rtentry *rt = NULL; struct sockaddr_in6 *dst, src_sa, dst_sa; @@ -866,9 +925,6 @@ passout: in6_ifstat_inc(ifp, ifs6_out_fragfail); goto bad; } else { - struct mbuf **mnext, *m_frgpart; - struct ip6_frag *ip6f; - u_int32_t id = htonl(ip6_randomid()); u_char nextproto; int qslots = ifp->if_snd.ifq_maxlen - ifp->if_snd.ifq_len; @@ -916,8 +972,6 @@ passout: m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; } #endif - mnext = &m->m_nextpkt; - /* * Change the next header field of the last header in the * unfragmentable part. @@ -942,47 +996,8 @@ passout: * chain. */ m0 = m; - for (off = hlen; off < tlen; off += len) { - m = m_gethdr(M_NOWAIT, MT_DATA); - if (!m) { - error = ENOBUFS; - IP6STAT_INC(ip6s_odropped); - goto sendorfree; - } - m->m_flags = m0->m_flags & M_COPYFLAGS; - *mnext = m; - mnext = &m->m_nextpkt; - m->m_data += max_linkhdr; - mhip6 = mtod(m, struct ip6_hdr *); - *mhip6 = *ip6; - m->m_len = sizeof(*mhip6); - error = ip6_insertfraghdr(m0, m, hlen, &ip6f); - if (error) { - IP6STAT_INC(ip6s_odropped); - goto sendorfree; - } - ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7)); - if (off + len >= tlen) - len = tlen - off; - else - ip6f->ip6f_offlg |= IP6F_MORE_FRAG; - mhip6->ip6_plen = htons((u_short)(len + hlen + - sizeof(*ip6f) - sizeof(struct ip6_hdr))); - if ((m_frgpart = m_copy(m0, off, len)) == 0) { - error = ENOBUFS; - IP6STAT_INC(ip6s_odropped); - goto sendorfree; - } - m_cat(m, m_frgpart); - m->m_pkthdr.len = len + hlen + sizeof(*ip6f); - m->m_pkthdr.fibnum = m0->m_pkthdr.fibnum; - m->m_pkthdr.rcvif = NULL; - ip6f->ip6f_reserved = 0; - ip6f->ip6f_ident = id; - ip6f->ip6f_nxt = nextproto; - IP6STAT_INC(ip6s_ofragments); - in6_ifstat_inc(ifp, ifs6_out_fragcreat); - } + if ((error = ip6_fragment(ifp, m, hlen, nextproto, len))) + goto sendorfree; in6_ifstat_inc(ifp, ifs6_out_fragok); } Modified: stable/10/sys/netinet6/ip6_var.h ============================================================================== --- stable/10/sys/netinet6/ip6_var.h Thu Jun 18 20:28:52 2015 (r284569) +++ stable/10/sys/netinet6/ip6_var.h Thu Jun 18 20:32:53 2015 (r284570) @@ -426,6 +426,7 @@ void ip6_clearpktopts(struct ip6_pktopts struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int); int ip6_optlen(struct inpcb *); int ip6_deletefraghdr(struct mbuf *, int, int); +int ip6_fragment(struct ifnet *, struct mbuf *, int, u_char, int); int route6_input(struct mbuf **, int *, int); From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:34:41 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 290A271C; Thu, 18 Jun 2015 20:34:41 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 163279A1; Thu, 18 Jun 2015 20:34:41 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKYeG1027347; Thu, 18 Jun 2015 20:34:40 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKYdBi027339; Thu, 18 Jun 2015 20:34:39 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182034.t5IKYdBi027339@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284571 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:34:41 -0000 Author: kp Date: Thu Jun 18 20:34:39 2015 New Revision: 284571 URL: https://svnweb.freebsd.org/changeset/base/284571 Log: Merge r278843, r278858 In the forwarding case refragment the reassembled packets with the same size as they arrived in. This allows the sender to determine the optimal fragment size by Path MTU Discovery. Roughly based on the OpenBSD work by Alexander Bluhm. Differential Revision: https://reviews.freebsd.org/D2816 Reviewed by: gnn Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c stable/10/sys/netpfil/pf/pf.h stable/10/sys/netpfil/pf/pf_mtag.h stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Thu Jun 18 20:32:53 2015 (r284570) +++ stable/10/sys/net/pfvar.h Thu Jun 18 20:34:39 2015 (r284571) @@ -1573,6 +1573,7 @@ int pf_test6(int, struct ifnet *, struct void pf_poolmask(struct pf_addr *, struct pf_addr*, struct pf_addr *, struct pf_addr *, u_int8_t); void pf_addr_inc(struct pf_addr *, sa_family_t); +int pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag); #endif /* INET6 */ u_int32_t pf_new_isn(struct pf_state *); Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Thu Jun 18 20:32:53 2015 (r284570) +++ stable/10/sys/netpfil/pf/pf.c Thu Jun 18 20:34:39 2015 (r284571) @@ -5509,7 +5509,7 @@ pf_route6(struct mbuf **m, struct pf_rul goto bad; if (oifp != ifp) { - if (pf_test6(PF_OUT, ifp, &m0, NULL) != PF_PASS) + if (pf_test6(PF_FWD, ifp, &m0, NULL) != PF_PASS) goto bad; else if (m0 == NULL) goto done; @@ -6067,15 +6067,20 @@ pf_test6(int dir, struct ifnet *ifp, str struct pfi_kif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0, *n = NULL; + struct m_tag *mtag; struct ip6_hdr *h = NULL; struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; struct pf_state *s = NULL; struct pf_ruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0; + int fwdir = dir; M_ASSERTPKTHDR(m); + if (ifp != m->m_pkthdr.rcvif) + fwdir = PF_FWD; + if (!V_pf_status.running) return (PF_PASS); @@ -6437,6 +6442,11 @@ done: if (s) PF_STATE_UNLOCK(s); + /* If reassembled packet passed, create new fragments. */ + if (action == PF_PASS && *m0 && fwdir == PF_FWD && + (mtag = m_tag_find(m, PF_REASSEMBLED, NULL)) != NULL) + action = pf_refragment6(ifp, m0, mtag); + return (action); } #endif /* INET6 */ Modified: stable/10/sys/netpfil/pf/pf.h ============================================================================== --- stable/10/sys/netpfil/pf/pf.h Thu Jun 18 20:32:53 2015 (r284570) +++ stable/10/sys/netpfil/pf/pf.h Thu Jun 18 20:34:39 2015 (r284571) @@ -43,7 +43,7 @@ #endif #endif -enum { PF_INOUT, PF_IN, PF_OUT }; +enum { PF_INOUT, PF_IN, PF_OUT, PF_FWD }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, Modified: stable/10/sys/netpfil/pf/pf_mtag.h ============================================================================== --- stable/10/sys/netpfil/pf/pf_mtag.h Thu Jun 18 20:32:53 2015 (r284570) +++ stable/10/sys/netpfil/pf/pf_mtag.h Thu Jun 18 20:34:39 2015 (r284571) @@ -39,6 +39,7 @@ #define PF_TAG_TRANSLATE_LOCALHOST 0x04 #define PF_PACKET_LOOPED 0x08 #define PF_FASTFWD_OURS_PRESENT 0x10 +#define PF_REASSEMBLED 0x20 struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:32:53 2015 (r284570) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:34:39 2015 (r284571) @@ -678,6 +678,8 @@ pf_reassemble6(struct mbuf **m0, struct struct pf_frent *frent; struct pf_fragment *frag; struct pf_fragment_cmp key; + struct m_tag *mtag; + struct pf_fragment_tag *ftag; int off; uint16_t total, maxlen; uint8_t proto; @@ -750,6 +752,15 @@ pf_reassemble6(struct mbuf **m0, struct m->m_pkthdr.len = plen; } + if ((mtag = m_tag_get(PF_REASSEMBLED, sizeof(struct pf_fragment_tag), + M_NOWAIT)) == NULL) + goto fail; + ftag = (struct pf_fragment_tag *)(mtag + 1); + ftag->ft_hdrlen = hdrlen; + ftag->ft_extoff = extoff; + ftag->ft_maxlen = maxlen; + m_tag_prepend(m, mtag); + ip6 = mtod(m, struct ip6_hdr *); ip6->ip6_plen = htons(hdrlen - sizeof(struct ip6_hdr) + total); if (extoff) { @@ -1084,6 +1095,75 @@ pf_fragcache(struct mbuf **m0, struct ip } int +pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag) +{ + struct mbuf *m = *m0, *t; + struct pf_fragment_tag *ftag = (struct pf_fragment_tag *)(mtag + 1); + struct pf_pdesc pd; + uint16_t hdrlen, extoff, maxlen; + uint8_t proto; + int error, action; + + hdrlen = ftag->ft_hdrlen; + extoff = ftag->ft_extoff; + maxlen = ftag->ft_maxlen; + m_tag_delete(m, mtag); + mtag = NULL; + ftag = NULL; + + if (extoff) { + int off; + + /* Use protocol from next field of last extension header */ + m = m_getptr(m, extoff + offsetof(struct ip6_ext, ip6e_nxt), + &off); + KASSERT((m != NULL), ("pf_refragment6: short mbuf chain")); + proto = *(mtod(m, caddr_t) + off); + *(mtod(m, char *) + off) = IPPROTO_FRAGMENT; + m = *m0; + } else { + struct ip6_hdr *hdr; + + hdr = mtod(m, struct ip6_hdr *); + proto = hdr->ip6_nxt; + hdr->ip6_nxt = IPPROTO_FRAGMENT; + } + + /* + * Maxlen may be less than 8 if there was only a single + * fragment. As it was fragmented before, add a fragment + * header also for a single fragment. If total or maxlen + * is less than 8, ip6_fragment() will return EMSGSIZE and + * we drop the packet. + */ + error = ip6_fragment(ifp, m, hdrlen, proto, maxlen); + m = (*m0)->m_nextpkt; + (*m0)->m_nextpkt = NULL; + if (error == 0) { + /* The first mbuf contains the unfragmented packet. */ + m_freem(*m0); + *m0 = NULL; + action = PF_PASS; + } else { + /* Drop expects an mbuf to free. */ + DPFPRINTF(("refragment error %d", error)); + action = PF_DROP; + } + for (t = m; m; m = t) { + t = m->m_nextpkt; + m->m_nextpkt = NULL; + memset(&pd, 0, sizeof(pd)); + pd.pf_mtag = pf_find_mtag(m); + if (error == 0) + ip6_forward(m, 0); + else + m_freem(m); + } + + return (action); +} + +int pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, struct pf_pdesc *pd) { From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:40:38 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0C5E198D; Thu, 18 Jun 2015 20:40:38 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E17FDAFC; Thu, 18 Jun 2015 20:40:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKeb7I029335; Thu, 18 Jun 2015 20:40:37 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKebAT029329; Thu, 18 Jun 2015 20:40:37 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182040.t5IKebAT029329@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284572 - in stable/10/sys: netinet6 netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:40:38 -0000 Author: kp Date: Thu Jun 18 20:40:36 2015 New Revision: 284572 URL: https://svnweb.freebsd.org/changeset/base/284572 Log: Merge r280955 Preserve IPv6 fragment IDs accross reassembly and refragmentation When forwarding fragmented IPv6 packets and filtering with PF we reassemble and refragment. That means we generate new fragment headers and a new fragment ID. We already save the fragment IDs so we can do the reassembly so it's straightforward to apply the incoming fragment ID on the refragmented packets. Differential Revision: https://reviews.freebsd.org/D2817 Reviewed by: gnn Modified: stable/10/sys/netinet6/ip6_output.c stable/10/sys/netinet6/ip6_var.h stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/ip6_output.c ============================================================================== --- stable/10/sys/netinet6/ip6_output.c Thu Jun 18 20:34:39 2015 (r284571) +++ stable/10/sys/netinet6/ip6_output.c Thu Jun 18 20:40:36 2015 (r284572) @@ -210,7 +210,7 @@ in6_delayed_cksum(struct mbuf *m, uint32 int ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto, - int mtu) + int mtu, uint32_t id) { struct mbuf *m, **mnext, *m_frgpart; struct ip6_hdr *ip6, *mhip6; @@ -218,7 +218,6 @@ ip6_fragment(struct ifnet *ifp, struct m int off; int error; int tlen = m0->m_pkthdr.len; - uint32_t id = htonl(ip6_randomid()); m = m0; ip6 = mtod(m, struct ip6_hdr *); @@ -309,6 +308,7 @@ ip6_output(struct mbuf *m0, struct ip6_p int hdrsplit = 0; int sw_csum, tso; struct m_tag *fwd_tag = NULL; + uint32_t id; ip6 = mtod(m, struct ip6_hdr *); if (ip6 == NULL) { @@ -996,7 +996,8 @@ passout: * chain. */ m0 = m; - if ((error = ip6_fragment(ifp, m, hlen, nextproto, len))) + id = htonl(ip6_randomid()); + if ((error = ip6_fragment(ifp, m, hlen, nextproto, len, id))) goto sendorfree; in6_ifstat_inc(ifp, ifs6_out_fragok); Modified: stable/10/sys/netinet6/ip6_var.h ============================================================================== --- stable/10/sys/netinet6/ip6_var.h Thu Jun 18 20:34:39 2015 (r284571) +++ stable/10/sys/netinet6/ip6_var.h Thu Jun 18 20:40:36 2015 (r284572) @@ -426,7 +426,8 @@ void ip6_clearpktopts(struct ip6_pktopts struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int); int ip6_optlen(struct inpcb *); int ip6_deletefraghdr(struct mbuf *, int, int); -int ip6_fragment(struct ifnet *, struct mbuf *, int, u_char, int); +int ip6_fragment(struct ifnet *, struct mbuf *, int, u_char, int, + uint32_t); int route6_input(struct mbuf **, int *, int); Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:34:39 2015 (r284571) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:40:36 2015 (r284572) @@ -104,6 +104,7 @@ struct pf_fragment_tag { uint16_t ft_hdrlen; /* header length of reassembled pkt */ uint16_t ft_extoff; /* last extension header offset or 0 */ uint16_t ft_maxlen; /* maximum fragment payload length */ + uint32_t ft_id; /* fragment id */ }; static struct mtx pf_frag_mtx; @@ -681,6 +682,7 @@ pf_reassemble6(struct mbuf **m0, struct struct m_tag *mtag; struct pf_fragment_tag *ftag; int off; + uint32_t frag_id; uint16_t total, maxlen; uint8_t proto; @@ -723,6 +725,7 @@ pf_reassemble6(struct mbuf **m0, struct /* We have all the data. */ extoff = frent->fe_extoff; maxlen = frag->fr_maxlen; + frag_id = frag->fr_id; frent = TAILQ_FIRST(&frag->fr_queue); KASSERT(frent != NULL, ("frent != NULL")); total = TAILQ_LAST(&frag->fr_queue, pf_fragq)->fe_off + @@ -759,6 +762,7 @@ pf_reassemble6(struct mbuf **m0, struct ftag->ft_hdrlen = hdrlen; ftag->ft_extoff = extoff; ftag->ft_maxlen = maxlen; + ftag->ft_id = frag_id; m_tag_prepend(m, mtag); ip6 = mtod(m, struct ip6_hdr *); @@ -1100,6 +1104,7 @@ pf_refragment6(struct ifnet *ifp, struct struct mbuf *m = *m0, *t; struct pf_fragment_tag *ftag = (struct pf_fragment_tag *)(mtag + 1); struct pf_pdesc pd; + uint32_t frag_id; uint16_t hdrlen, extoff, maxlen; uint8_t proto; int error, action; @@ -1107,6 +1112,7 @@ pf_refragment6(struct ifnet *ifp, struct hdrlen = ftag->ft_hdrlen; extoff = ftag->ft_extoff; maxlen = ftag->ft_maxlen; + frag_id = ftag->ft_id; m_tag_delete(m, mtag); mtag = NULL; ftag = NULL; @@ -1136,7 +1142,7 @@ pf_refragment6(struct ifnet *ifp, struct * is less than 8, ip6_fragment() will return EMSGSIZE and * we drop the packet. */ - error = ip6_fragment(ifp, m, hdrlen, proto, maxlen); + error = ip6_fragment(ifp, m, hdrlen, proto, maxlen, frag_id); m = (*m0)->m_nextpkt; (*m0)->m_nextpkt = NULL; if (error == 0) { From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:41:56 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 23833AD9; Thu, 18 Jun 2015 20:41:56 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 118B7BE6; Thu, 18 Jun 2015 20:41:56 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKftG9031921; Thu, 18 Jun 2015 20:41:55 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKftxV031920; Thu, 18 Jun 2015 20:41:55 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182041.t5IKftxV031920@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284573 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:41:56 -0000 Author: kp Date: Thu Jun 18 20:41:55 2015 New Revision: 284573 URL: https://svnweb.freebsd.org/changeset/base/284573 Log: Merge r280956 pf: Deal with runt packets On Ethernet packets have a minimal length, so very short packets get padding appended to them. This padding is not stripped off in ip6_input() (due to support for IPv6 Jumbograms, RFC2675). That means PF needs to be careful when reassembling fragmented packets to not include the padding in the reassembled packet. While here also remove the 'Magic from ip_input.' bits. Splitting up and re-joining an mbuf chain here doesn't make any sense. Differential Revision: https://reviews.freebsd.org/D2818 Reviewed by: gnn Modified: stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:40:36 2015 (r284572) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:41:55 2015 (r284573) @@ -582,11 +582,8 @@ pf_join_fragment(struct pf_fragment *fra frent = TAILQ_FIRST(&frag->fr_queue); next = TAILQ_NEXT(frent, fr_next); - /* Magic from ip_input. */ m = frent->fe_m; - m2 = m->m_next; - m->m_next = NULL; - m_cat(m, m2); + m_adj(m, (frent->fe_hdrlen + frent->fe_len) - m->m_pkthdr.len); uma_zfree(V_pf_frent_z, frent); for (frent = next; frent != NULL; frent = next) { next = TAILQ_NEXT(frent, fr_next); @@ -594,6 +591,9 @@ pf_join_fragment(struct pf_fragment *fra m2 = frent->fe_m; /* Strip off ip header. */ m_adj(m2, frent->fe_hdrlen); + /* Strip off any trailing bytes. */ + m_adj(m2, frent->fe_len - m2->m_pkthdr.len); + uma_zfree(V_pf_frent_z, frent); m_cat(m, m2); } From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:43:17 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18ADBC36; Thu, 18 Jun 2015 20:43:17 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1059C0B; Thu, 18 Jun 2015 20:43:16 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKhG6n032156; Thu, 18 Jun 2015 20:43:16 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKhGD9032155; Thu, 18 Jun 2015 20:43:16 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182043.t5IKhGD9032155@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:43:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284574 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:43:17 -0000 Author: kp Date: Thu Jun 18 20:43:16 2015 New Revision: 284574 URL: https://svnweb.freebsd.org/changeset/base/284574 Log: Merge r281164 pf: Skip firewall for refragmented ip6 packets In cases where we scrub (fragment reassemble) on both input and output we risk ending up in infinite loops when forwarding packets. Fragmented packets come in and get collected until we can defragment. At that point the defragmented packet is handed back to the ip stack (at the pfil point in ip6_input(). Normal processing continues. Eventually we figure out that the packet has to be forwarded and we end up at the pfil hook in ip6_forward(). After doing the inspection on the defragmented packet we see that the packet has been defragmented and because we're forwarding we have to refragment it. In pf_refragment6() we split the packet up again and then ip6_forward() the individual fragments. Those fragments hit the pfil hook on the way out, so they're collected until we can reconstruct the full packet, at which point we're right back where we left off and things continue until we run out of stack. Break that loop by marking the fragments generated by pf_refragment6() as M_SKIP_FIREWALL. There's no point in processing those packets in the firewall anyway. We've already filtered on the full packet. Differential Revision: https://reviews.freebsd.org/D2819 Reviewed by: gnn Modified: stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:41:55 2015 (r284573) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 20:43:16 2015 (r284574) @@ -1158,6 +1158,7 @@ pf_refragment6(struct ifnet *ifp, struct for (t = m; m; m = t) { t = m->m_nextpkt; m->m_nextpkt = NULL; + m->m_flags |= M_SKIP_FIREWALL; memset(&pd, 0, sizeof(pd)); pd.pf_mtag = pf_find_mtag(m); if (error == 0) From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:45:38 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 187F4D90; Thu, 18 Jun 2015 20:45:38 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 068C8C24; Thu, 18 Jun 2015 20:45:38 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKjb64032561; Thu, 18 Jun 2015 20:45:37 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKjbhA032560; Thu, 18 Jun 2015 20:45:37 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182045.t5IKjbhA032560@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284575 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:45:38 -0000 Author: kp Date: Thu Jun 18 20:45:37 2015 New Revision: 284575 URL: https://svnweb.freebsd.org/changeset/base/284575 Log: Merge r281165 Remove duplicate code We'll just fall into the same local delivery block under the 'if (m->m_flags & M_FASTFWD_OURS)'. Suggested by: ae Differential Revision: https://reviews.freebsd.org/D2820 Reviewed by: gnn Modified: stable/10/sys/netinet6/ip6_forward.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/ip6_forward.c ============================================================================== --- stable/10/sys/netinet6/ip6_forward.c Thu Jun 18 20:43:16 2015 (r284574) +++ stable/10/sys/netinet6/ip6_forward.c Thu Jun 18 20:45:37 2015 (r284575) @@ -557,22 +557,9 @@ again2: if (!IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst)) { m->m_flags |= M_SKIP_FIREWALL; /* If destination is now ourself drop to ip6_input(). */ - if (in6_localip(&ip6->ip6_dst)) { + if (in6_localip(&ip6->ip6_dst)) m->m_flags |= M_FASTFWD_OURS; - if (m->m_pkthdr.rcvif == NULL) - m->m_pkthdr.rcvif = V_loif; - if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xffff; - } -#ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; -#endif - error = netisr_queue(NETISR_IPV6, m); - goto out; - } else + else goto again; /* Redo the routing table lookup. */ } From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:57:22 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 39F3C307; Thu, 18 Jun 2015 20:57:22 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27982E83; Thu, 18 Jun 2015 20:57:22 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKvMZq037771; Thu, 18 Jun 2015 20:57:22 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKvMtu037770; Thu, 18 Jun 2015 20:57:22 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182057.t5IKvMtu037770@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:57:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284576 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:57:22 -0000 Author: kp Date: Thu Jun 18 20:57:21 2015 New Revision: 284576 URL: https://svnweb.freebsd.org/changeset/base/284576 Log: Merge r281234 Evaluate packet size after the firewall had its chance Defer the packet size check until after the firewall has had a look at it. This means that the firewall now has the opportunity to (re-)fragment an oversized packet. Differential Revision: https://reviews.freebsd.org/D2821 Reviewed by: gnn Modified: stable/10/sys/netinet6/ip6_forward.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/ip6_forward.c ============================================================================== --- stable/10/sys/netinet6/ip6_forward.c Thu Jun 18 20:45:37 2015 (r284575) +++ stable/10/sys/netinet6/ip6_forward.c Thu Jun 18 20:57:21 2015 (r284576) @@ -423,46 +423,6 @@ again2: goto bad; } - if (m->m_pkthdr.len > IN6_LINKMTU(rt->rt_ifp)) { - in6_ifstat_inc(rt->rt_ifp, ifs6_in_toobig); - if (mcopy) { - u_long mtu; -#ifdef IPSEC - struct secpolicy *sp; - int ipsecerror; - size_t ipsechdrsiz; -#endif /* IPSEC */ - - mtu = IN6_LINKMTU(rt->rt_ifp); -#ifdef IPSEC - /* - * When we do IPsec tunnel ingress, we need to play - * with the link value (decrement IPsec header size - * from mtu value). The code is much simpler than v4 - * case, as we have the outgoing interface for - * encapsulated packet as "rt->rt_ifp". - */ - sp = ipsec_getpolicybyaddr(mcopy, IPSEC_DIR_OUTBOUND, - IP_FORWARDING, &ipsecerror); - if (sp) { - ipsechdrsiz = ipsec_hdrsiz(mcopy, - IPSEC_DIR_OUTBOUND, NULL); - if (ipsechdrsiz < mtu) - mtu -= ipsechdrsiz; - } - - /* - * if mtu becomes less than minimum MTU, - * tell minimum MTU (and I'll need to fragment it). - */ - if (mtu < IPV6_MMTU) - mtu = IPV6_MMTU; -#endif /* IPSEC */ - icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, mtu); - } - goto bad; - } - if (rt->rt_flags & RTF_GATEWAY) dst = (struct sockaddr_in6 *)rt->rt_gateway; @@ -591,6 +551,47 @@ again2: } pass: + /* See if the size was changed by the packet filter. */ + if (m->m_pkthdr.len > IN6_LINKMTU(rt->rt_ifp)) { + in6_ifstat_inc(rt->rt_ifp, ifs6_in_toobig); + if (mcopy) { + u_long mtu; +#ifdef IPSEC + struct secpolicy *sp; + int ipsecerror; + size_t ipsechdrsiz; +#endif /* IPSEC */ + + mtu = IN6_LINKMTU(rt->rt_ifp); +#ifdef IPSEC + /* + * When we do IPsec tunnel ingress, we need to play + * with the link value (decrement IPsec header size + * from mtu value). The code is much simpler than v4 + * case, as we have the outgoing interface for + * encapsulated packet as "rt->rt_ifp". + */ + sp = ipsec_getpolicybyaddr(mcopy, IPSEC_DIR_OUTBOUND, + IP_FORWARDING, &ipsecerror); + if (sp) { + ipsechdrsiz = ipsec_hdrsiz(mcopy, + IPSEC_DIR_OUTBOUND, NULL); + if (ipsechdrsiz < mtu) + mtu -= ipsechdrsiz; + } + + /* + * if mtu becomes less than minimum MTU, + * tell minimum MTU (and I'll need to fragment it). + */ + if (mtu < IPV6_MMTU) + mtu = IPV6_MMTU; +#endif /* IPSEC */ + icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, mtu); + } + goto bad; + } + error = nd6_output(rt->rt_ifp, origifp, m, dst, rt); if (error) { in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard); From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 20:59:49 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BF24961A; Thu, 18 Jun 2015 20:59:49 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD419EA6; Thu, 18 Jun 2015 20:59:49 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5IKxnRm038110; Thu, 18 Jun 2015 20:59:49 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5IKxnMZ038109; Thu, 18 Jun 2015 20:59:49 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182059.t5IKxnMZ038109@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 20:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284577 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 20:59:49 -0000 Author: kp Date: Thu Jun 18 20:59:48 2015 New Revision: 284577 URL: https://svnweb.freebsd.org/changeset/base/284577 Log: Merge r281536 pf: Fix forwarding detection If the direction is not PF_OUT we can never be forwarding. Some input packets have rcvif != ifp (looped back packets), which lead us to ip6_forward() inbound packets, causing panics. Equally, we need to ensure that packets were really received and not locally generated before trying to ip6_forward() them. Differential Revision: https://reviews.freebsd.org/D2822 Reviewed by: gnn Modified: stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Thu Jun 18 20:57:21 2015 (r284576) +++ stable/10/sys/netpfil/pf/pf.c Thu Jun 18 20:59:48 2015 (r284577) @@ -6078,7 +6078,7 @@ pf_test6(int dir, struct ifnet *ifp, str M_ASSERTPKTHDR(m); - if (ifp != m->m_pkthdr.rcvif) + if (dir == PF_OUT && m->m_pkthdr.rcvif && ifp != m->m_pkthdr.rcvif) fwdir = PF_FWD; if (!V_pf_status.running) From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 21:21:53 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44EC7D28; Thu, 18 Jun 2015 21:21:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 267C37EA; Thu, 18 Jun 2015 21:21:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5ILLrRx051766; Thu, 18 Jun 2015 21:21:53 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5ILLqI1051764; Thu, 18 Jun 2015 21:21:52 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182121.t5ILLqI1051764@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 21:21:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284579 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 21:21:53 -0000 Author: kp Date: Thu Jun 18 21:21:52 2015 New Revision: 284579 URL: https://svnweb.freebsd.org/changeset/base/284579 Log: Merge r278874, r278925, r278868 - Improve INET/INET6 scope. - style(9) declarations. - Make couple of local functions static. - Even more fixes to !INET and !INET6 kernels. In collaboration with pluknet - Toss declarations to fix regular build and NO_INET6 build. Differential Revision: https://reviews.freebsd.org/D2823 Reviewed by: gnn Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Thu Jun 18 21:18:43 2015 (r284578) +++ stable/10/sys/net/pfvar.h Thu Jun 18 21:21:52 2015 (r284579) @@ -1566,14 +1566,18 @@ void pf_free_rule(struct pf_rule *); #ifdef INET int pf_test(int, struct ifnet *, struct mbuf **, struct inpcb *); +int pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *, + struct pf_pdesc *); #endif /* INET */ #ifdef INET6 int pf_test6(int, struct ifnet *, struct mbuf **, struct inpcb *); +int pf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *, + struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, struct pf_addr *, struct pf_addr *, u_int8_t); void pf_addr_inc(struct pf_addr *, sa_family_t); -int pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag); +int pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *); #endif /* INET6 */ u_int32_t pf_new_isn(struct pf_state *); @@ -1589,10 +1593,6 @@ int pf_match_port(u_int8_t, u_int16_t, u void pf_normalize_init(void); void pf_normalize_cleanup(void); -int pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *, - struct pf_pdesc *); -int pf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *, - struct pf_pdesc *); int pf_normalize_tcp(int, struct pfi_kif *, struct mbuf *, int, int, void *, struct pf_pdesc *); void pf_normalize_tcp_cleanup(struct pf_state *); Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 21:18:43 2015 (r284578) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 21:21:52 2015 (r284579) @@ -135,35 +135,30 @@ static int pf_frag_compare(struct pf_f static RB_PROTOTYPE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare); static RB_GENERATE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare); -/* Private prototypes */ -static void pf_free_fragment(struct pf_fragment *); -static void pf_remove_fragment(struct pf_fragment *); -static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *, - struct tcphdr *, int, sa_family_t); -#ifdef INET -static void pf_scrub_ip(struct mbuf **, u_int32_t, u_int8_t, - u_int8_t); -static void pf_flush_fragments(void); +static void pf_flush_fragments(void); +static void pf_free_fragment(struct pf_fragment *); +static void pf_remove_fragment(struct pf_fragment *); +static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *, + struct tcphdr *, int, sa_family_t); +static struct pf_frent *pf_create_fragment(u_short *); static struct pf_fragment *pf_find_fragment(struct pf_fragment_cmp *key, - struct pf_frag_tree *tree); -struct pf_frent *pf_create_fragment(u_short *); -static int pf_reassemble(struct mbuf **, struct ip *, int, - u_short *); -int pf_reassemble6(struct mbuf **, struct ip6_hdr *, - struct ip6_frag *, uint16_t, uint16_t, int, - u_short *); -static struct mbuf *pf_fragcache(struct mbuf **, struct ip*, - struct pf_fragment **, int, int, int *); + struct pf_frag_tree *tree); static struct pf_fragment *pf_fillup_fragment(struct pf_fragment_cmp *, - struct pf_frent *, u_short *); -int pf_isfull_fragment(struct pf_fragment *); -struct mbuf *pf_join_fragment(struct pf_fragment *); - - -#endif /* INET */ + struct pf_frent *, u_short *); +static int pf_isfull_fragment(struct pf_fragment *); +static struct mbuf *pf_join_fragment(struct pf_fragment *); +#ifdef INET +static void pf_scrub_ip(struct mbuf **, uint32_t, uint8_t, uint8_t); +static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *); +static struct mbuf *pf_fragcache(struct mbuf **, struct ip*, + struct pf_fragment **, int, int, int *); +#endif /* INET */ #ifdef INET6 -static void pf_scrub_ip6(struct mbuf **, u_int8_t); -#endif +static int pf_reassemble6(struct mbuf **, struct ip6_hdr *, + struct ip6_frag *, uint16_t, uint16_t, int, u_short *); +static void pf_scrub_ip6(struct mbuf **, uint8_t); +#endif /* INET6 */ + #define DPFPRINTF(x) do { \ if (V_pf_status.debug >= PF_DEBUG_MISC) { \ printf("%s: ", __func__); \ @@ -171,6 +166,7 @@ static void pf_scrub_ip6(struct mbuf * } \ } while(0) +#ifdef INET static void pf_ip2key(struct ip *ip, int dir, struct pf_fragment_cmp *key) { @@ -182,6 +178,7 @@ pf_ip2key(struct ip *ip, int dir, struct key->frc_id = ip->ip_id; key->frc_direction = dir; } +#endif /* INET */ void pf_normalize_init(void) @@ -269,7 +266,6 @@ pf_purge_expired_fragments(void) PF_FRAG_UNLOCK(); } -#ifdef INET /* * Try to flush old fragments to make space for new ones */ @@ -294,7 +290,6 @@ pf_flush_fragments(void) break; } } -#endif /* INET */ /* Frees the fragments and all associated entries */ static void @@ -331,7 +326,6 @@ pf_free_fragment(struct pf_fragment *fra pf_remove_fragment(frag); } -#ifdef INET static struct pf_fragment * pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree) { @@ -354,10 +348,8 @@ pf_find_fragment(struct pf_fragment_cmp return (frag); } -#endif /* INET */ /* Removes a fragment from the fragment queue and frees the fragment */ - static void pf_remove_fragment(struct pf_fragment *frag) { @@ -375,8 +367,7 @@ pf_remove_fragment(struct pf_fragment *f } } -#ifdef INET -struct pf_frent * +static struct pf_frent * pf_create_fragment(u_short *reason) { struct pf_frent *frent; @@ -539,7 +530,7 @@ drop_fragment: return (NULL); } -int +static int pf_isfull_fragment(struct pf_fragment *frag) { struct pf_frent *frent, *next; @@ -573,7 +564,7 @@ pf_isfull_fragment(struct pf_fragment *f return (1); } -struct mbuf * +static struct mbuf * pf_join_fragment(struct pf_fragment *frag) { struct mbuf *m, *m2; @@ -604,7 +595,7 @@ pf_join_fragment(struct pf_fragment *fra return (m); } -#define FR_IP_OFF(fr) ((ntohs((fr)->fr_ip->ip_off) & IP_OFFMASK) << 3) +#ifdef INET static int pf_reassemble(struct mbuf **m0, struct ip *ip, int dir, u_short *reason) { @@ -669,11 +660,12 @@ pf_reassemble(struct mbuf **m0, struct i DPFPRINTF(("complete: %p(%d)\n", m, ntohs(ip->ip_len))); return (PF_PASS); } +#endif /* INET */ #ifdef INET6 -int +static int pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, struct ip6_frag *fraghdr, - uint16_t hdrlen, uint16_t extoff, int dir, u_short *reason) + uint16_t hdrlen, uint16_t extoff, int dir, u_short *reason) { struct mbuf *m = *m0; struct pf_frent *frent; @@ -793,9 +785,9 @@ fail: /* PF_DROP requires a valid mbuf *m0 in pf_test6(), will free later. */ return (PF_DROP); } +#endif /* INET6 */ -#endif - +#ifdef INET static struct mbuf * pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int mff, int drop, int *nomem) @@ -1097,7 +1089,9 @@ pf_fragcache(struct mbuf **m0, struct ip m_freem(m); return (NULL); } +#endif /* INET */ +#ifdef INET6 int pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag) { @@ -1169,7 +1163,9 @@ pf_refragment6(struct ifnet *ifp, struct return (action); } +#endif /* INET6 */ +#ifdef INET int pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, struct pf_pdesc *pd) From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 21:23:42 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 378365EC; Thu, 18 Jun 2015 21:23:42 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 252BC82C; Thu, 18 Jun 2015 21:23:42 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5ILNgCx052934; Thu, 18 Jun 2015 21:23:42 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5ILNgXi052933; Thu, 18 Jun 2015 21:23:42 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182123.t5ILNgXi052933@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 21:23:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284580 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 21:23:42 -0000 Author: kp Date: Thu Jun 18 21:23:41 2015 New Revision: 284580 URL: https://svnweb.freebsd.org/changeset/base/284580 Log: Merge r284222, r284260 pf: address family must be set when creating a pf_fragment Fix a panic when handling fragmented ip4 packets with 'drop-ovl' set. In that scenario we take a different branch in pf_normalize_ip(), taking us to pf_fragcache() (rather than pf_reassemble()). In pf_fragcache() we create a pf_fragment, but do not set the address family. This leads to a panic when we try to insert that into pf_frag_tree because pf_addr_cmp(), which is used to compare the pf_fragments doesn't know what to do if the address family is not set. Simply ensure that the address family is set correctly (always AF_INET in this path). When we try to look up a pf_fragment with pf_find_fragment() we compare (see pf_frag_compare()) addresses (and family), but also protocol. We failed to save the protocol to the pf_fragment in pf_fragcache(), resulting in failing reassembly. PR: 200330 Differential Revision: https://reviews.freebsd.org/D2824 Reviewed by: gnn Modified: stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 21:21:52 2015 (r284579) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 21:23:41 2015 (r284580) @@ -825,6 +825,8 @@ pf_fragcache(struct mbuf **m0, struct ip (*frag)->fr_max = 0; (*frag)->fr_src.v4 = h->ip_src; (*frag)->fr_dst.v4 = h->ip_dst; + (*frag)->fr_af = AF_INET; + (*frag)->fr_proto = h->ip_p; (*frag)->fr_id = h->ip_id; (*frag)->fr_timeout = time_uptime; From owner-svn-src-stable-10@FreeBSD.ORG Thu Jun 18 21:25:08 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F9FEF97; Thu, 18 Jun 2015 21:25:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2604185D; Thu, 18 Jun 2015 21:25:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5ILP8kN054208; Thu, 18 Jun 2015 21:25:08 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5ILP8NU054207; Thu, 18 Jun 2015 21:25:08 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201506182125.t5ILP8NU054207@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Jun 2015 21:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284581 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 21:25:08 -0000 Author: kp Date: Thu Jun 18 21:25:07 2015 New Revision: 284581 URL: https://svnweb.freebsd.org/changeset/base/284581 Log: Merge r284280 pf: Remove frc_direction We don't use the direction of the fragments for anything. The frc_direction field is assigned, but never read. Just remove it. Differential Revision: https://reviews.freebsd.org/D2825 Reviewed by: gnn Modified: stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 21:23:41 2015 (r284580) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jun 18 21:25:07 2015 (r284581) @@ -75,7 +75,6 @@ struct pf_fragment_cmp { uint32_t frc_id; sa_family_t frc_af; uint8_t frc_proto; - uint8_t frc_direction; }; struct pf_fragment { @@ -85,7 +84,6 @@ struct pf_fragment { #define fr_id fr_key.frc_id #define fr_af fr_key.frc_af #define fr_proto fr_key.frc_proto -#define fr_direction fr_key.frc_direction RB_ENTRY(pf_fragment) fr_entry; TAILQ_ENTRY(pf_fragment) frag_next; @@ -155,7 +153,7 @@ static struct mbuf *pf_fragcache(struct #endif /* INET */ #ifdef INET6 static int pf_reassemble6(struct mbuf **, struct ip6_hdr *, - struct ip6_frag *, uint16_t, uint16_t, int, u_short *); + struct ip6_frag *, uint16_t, uint16_t, u_short *); static void pf_scrub_ip6(struct mbuf **, uint8_t); #endif /* INET6 */ @@ -176,7 +174,6 @@ pf_ip2key(struct ip *ip, int dir, struct key->frc_af = AF_INET; key->frc_proto = ip->ip_p; key->frc_id = ip->ip_id; - key->frc_direction = dir; } #endif /* INET */ @@ -665,7 +662,7 @@ pf_reassemble(struct mbuf **m0, struct i #ifdef INET6 static int pf_reassemble6(struct mbuf **m0, struct ip6_hdr *ip6, struct ip6_frag *fraghdr, - uint16_t hdrlen, uint16_t extoff, int dir, u_short *reason) + uint16_t hdrlen, uint16_t extoff, u_short *reason) { struct mbuf *m = *m0; struct pf_frent *frent; @@ -699,7 +696,6 @@ pf_reassemble6(struct mbuf **m0, struct /* Only the first fragment's protocol is relevant. */ key.frc_proto = 0; key.frc_id = fraghdr->ip6f_ident; - key.frc_direction = dir; if ((frag = pf_fillup_fragment(&key, frent, reason)) == NULL) { PF_FRAG_UNLOCK(); @@ -1572,7 +1568,7 @@ pf_normalize_ip6(struct mbuf **m0, int d off += sizeof(frag); /* Returns PF_DROP or *m0 is NULL or completely reassembled mbuf. */ - if (pf_reassemble6(m0, h, &frag, off, extoff, dir, reason) != PF_PASS) + if (pf_reassemble6(m0, h, &frag, off, extoff, reason) != PF_PASS) return (PF_DROP); m = *m0; if (m == NULL) From owner-svn-src-stable-10@FreeBSD.ORG Fri Jun 19 00:00:34 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15F1C1A2; Fri, 19 Jun 2015 00:00:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCDC0BB; Fri, 19 Jun 2015 00:00:33 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5J00XZp028309; Fri, 19 Jun 2015 00:00:33 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5J00XpO028306; Fri, 19 Jun 2015 00:00:33 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201506190000.t5J00XpO028306@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 19 Jun 2015 00:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284584 - in stable/10: gnu/usr.bin/groff/tmac lib/clang sys/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 00:00:34 -0000 Author: gjb Date: Fri Jun 19 00:00:32 2015 New Revision: 284584 URL: https://svnweb.freebsd.org/changeset/base/284584 Log: Update stable/10 from 10.1-STABLE to 10.2-PRERELEASE, marking the official start of the code slush. Set the default mdoc(7) version to 10.2, and update the clang(1) TARGET_TRIPLE and BUILD_TRIPLE to reflect 10.2. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/gnu/usr.bin/groff/tmac/mdoc.local stable/10/lib/clang/clang.build.mk stable/10/sys/conf/newvers.sh Modified: stable/10/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- stable/10/gnu/usr.bin/groff/tmac/mdoc.local Thu Jun 18 23:14:45 2015 (r284583) +++ stable/10/gnu/usr.bin/groff/tmac/mdoc.local Fri Jun 19 00:00:32 2015 (r284584) @@ -50,7 +50,7 @@ .ds doc-str-Lb-libstdthreads C11 Threads Library (libstdthreads, \-lstdthreads) . .\" Default .Os value -.ds doc-default-operating-system FreeBSD\~10.1 +.ds doc-default-operating-system FreeBSD\~10.2 . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 @@ -61,6 +61,7 @@ .ds doc-operating-system-FreeBSD-9.3 9.3 .ds doc-operating-system-FreeBSD-10.0 10.0 .ds doc-operating-system-FreeBSD-10.1 10.1 +.ds doc-operating-system-FreeBSD-10.2 10.2 .ds doc-operating-system-FreeBSD-11.0 11.0 . .\" Definitions for other *BSDs not (yet) in doc-common Modified: stable/10/lib/clang/clang.build.mk ============================================================================== --- stable/10/lib/clang/clang.build.mk Thu Jun 18 23:14:45 2015 (r284583) +++ stable/10/lib/clang/clang.build.mk Fri Jun 19 00:00:32 2015 (r284584) @@ -27,8 +27,8 @@ TARGET_ABI= gnueabi TARGET_ABI= unknown .endif -TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.1 -BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.1 +TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.2 +BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.2 CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \ -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" \ -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Thu Jun 18 23:14:45 2015 (r284583) +++ stable/10/sys/conf/newvers.sh Fri Jun 19 00:00:32 2015 (r284584) @@ -31,8 +31,8 @@ # $FreeBSD$ TYPE="FreeBSD" -REVISION="10.1" -BRANCH="STABLE" +REVISION="10.2" +BRANCH="PRERELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable-10@FreeBSD.ORG Fri Jun 19 00:53:16 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 91B52603; Fri, 19 Jun 2015 00:53:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F231F69; Fri, 19 Jun 2015 00:53:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5J0rGpn059042; Fri, 19 Jun 2015 00:53:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5J0rG5t059041; Fri, 19 Jun 2015 00:53:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201506190053.t5J0rG5t059041@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 19 Jun 2015 00:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284586 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 00:53:16 -0000 Author: mav Date: Fri Jun 19 00:53:15 2015 New Revision: 284586 URL: https://svnweb.freebsd.org/changeset/base/284586 Log: MFC r284013: Allow setting only WWNN or only WWPN. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Fri Jun 19 00:10:30 2015 (r284585) +++ stable/10/sys/cam/ctl/scsi_ctl.c Fri Jun 19 00:53:15 2015 (r284586) @@ -1657,16 +1657,24 @@ ctlfe_onoffline(void *arg, int online) * down to the SIM. Otherwise, record what the SIM * has reported. */ - if ((bus_softc->port.wwnn != 0) - && (bus_softc->port.wwpn != 0)) { + if (bus_softc->port.wwnn != 0 && bus_softc->port.wwnn + != ccb->knob.xport_specific.fc.wwnn) { ccb->knob.xport_specific.fc.wwnn = - bus_softc->port.wwnn; - ccb->knob.xport_specific.fc.wwpn = - bus_softc->port.wwpn; + bus_softc->port.wwnn; set_wwnn = 1; } else { ctl_port_set_wwns(&bus_softc->port, true, ccb->knob.xport_specific.fc.wwnn, + false, 0); + } + if (bus_softc->port.wwpn != 0 && bus_softc->port.wwpn + != ccb->knob.xport_specific.fc.wwpn) { + ccb->knob.xport_specific.fc.wwpn = + bus_softc->port.wwpn; + set_wwnn = 1; + } else { + ctl_port_set_wwns(&bus_softc->port, + false, 0, true, ccb->knob.xport_specific.fc.wwpn); } #endif /* RANDOM_WWNN */ From owner-svn-src-stable-10@FreeBSD.ORG Fri Jun 19 13:29:46 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9EB08F2C; Fri, 19 Jun 2015 13:29:46 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57CF6A0D; Fri, 19 Jun 2015 13:29:46 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Z5wMU-000EAF-0Y; Fri, 19 Jun 2015 16:29:38 +0300 Date: Fri, 19 Jun 2015 16:29:37 +0300 From: Slawa Olhovchenkov To: Glen Barber Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r284584 - in stable/10: gnu/usr.bin/groff/tmac lib/clang sys/conf Message-ID: <20150619132937.GI58397@zxy.spb.ru> References: <201506190000.t5J00XpO028306@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201506190000.t5J00XpO028306@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 13:29:46 -0000 On Fri, Jun 19, 2015 at 12:00:33AM +0000, Glen Barber wrote: > Author: gjb > Date: Fri Jun 19 00:00:32 2015 > New Revision: 284584 > URL: https://svnweb.freebsd.org/changeset/base/284584 > > Log: > Update stable/10 from 10.1-STABLE to 10.2-PRERELEASE, > marking the official start of the code slush. > > Set the default mdoc(7) version to 10.2, and update the > clang(1) TARGET_TRIPLE and BUILD_TRIPLE to reflect 10.2. Please, generate release images from release/ branch (10.1 release generated from releng/ branch) From owner-svn-src-stable-10@FreeBSD.ORG Fri Jun 19 19:36:23 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1DA21913; Fri, 19 Jun 2015 19:36:23 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B263238; Fri, 19 Jun 2015 19:36:23 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5JJaMYj013793; Fri, 19 Jun 2015 19:36:22 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5JJaMBf013788; Fri, 19 Jun 2015 19:36:22 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201506191936.t5JJaMBf013788@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Fri, 19 Jun 2015 19:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284603 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 19:36:23 -0000 Author: hiren Date: Fri Jun 19 19:36:21 2015 New Revision: 284603 URL: https://svnweb.freebsd.org/changeset/base/284603 Log: MFC r266420 (by adrian) Ensure that the flowid hashtype is assigned to the inp if the flowid is also assigned. Spotted by: gallatin Tested by: gallatin Modified: stable/10/sys/netinet/tcp_input.c stable/10/sys/netinet/tcp_syncache.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Fri Jun 19 18:57:36 2015 (r284602) +++ stable/10/sys/netinet/tcp_input.c Fri Jun 19 19:36:21 2015 (r284603) @@ -876,6 +876,7 @@ findpcb: ((inp->inp_socket == NULL) || (inp->inp_socket->so_options & SO_ACCEPTCONN) == 0)) { inp->inp_flowid = m->m_pkthdr.flowid; + inp->inp_flowtype = M_HASHTYPE_GET(m); } #ifdef IPSEC #ifdef INET6 Modified: stable/10/sys/netinet/tcp_syncache.c ============================================================================== --- stable/10/sys/netinet/tcp_syncache.c Fri Jun 19 18:57:36 2015 (r284602) +++ stable/10/sys/netinet/tcp_syncache.c Fri Jun 19 19:36:21 2015 (r284603) @@ -725,6 +725,7 @@ syncache_socket(struct syncache *sc, str */ if (m != NULL && M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { inp->inp_flowid = m->m_pkthdr.flowid; + inp->inp_flowtype = M_HASHTYPE_GET(m); } /* From owner-svn-src-stable-10@FreeBSD.ORG Sat Jun 20 08:25:31 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 81A40479; Sat, 20 Jun 2015 08:25:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DBF9D6C; Sat, 20 Jun 2015 08:25:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5K8PVGw094458; Sat, 20 Jun 2015 08:25:31 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5K8PSdj094438; Sat, 20 Jun 2015 08:25:28 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506200825.t5K8PSdj094438@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 20 Jun 2015 08:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284633 - in stable/10/sys: netinet netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 08:25:31 -0000 Author: tuexen Date: Sat Jun 20 08:25:27 2015 New Revision: 284633 URL: https://svnweb.freebsd.org/changeset/base/284633 Log: MFC r284515: Add FIB support for SCTP. This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200379 PR: 200379 Modified: stable/10/sys/netinet/sctp_asconf.c stable/10/sys/netinet/sctp_input.c stable/10/sys/netinet/sctp_input.h stable/10/sys/netinet/sctp_os_bsd.h stable/10/sys/netinet/sctp_output.c stable/10/sys/netinet/sctp_output.h stable/10/sys/netinet/sctp_pcb.c stable/10/sys/netinet/sctp_pcb.h stable/10/sys/netinet/sctp_usrreq.c stable/10/sys/netinet/sctputil.c stable/10/sys/netinet/sctputil.h stable/10/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_asconf.c ============================================================================== --- stable/10/sys/netinet/sctp_asconf.c Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_asconf.c Sat Jun 20 08:25:27 2015 (r284633) @@ -1109,7 +1109,8 @@ sctp_path_check_and_react(struct sctp_tc * not be changed. */ SCTP_RTALLOC((sctp_route_t *) & net->ro, - stcb->sctp_ep->def_vrf_id); + stcb->sctp_ep->def_vrf_id, + stcb->sctp_ep->fibnum); if (net->ro.ro_rt == NULL) continue; Modified: stable/10/sys/netinet/sctp_input.c ============================================================================== --- stable/10/sys/netinet/sctp_input.c Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_input.c Sat Jun 20 08:25:27 2015 (r284633) @@ -186,7 +186,7 @@ sctp_handle_init(struct mbuf *m, int iph op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "No listener"); sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); } goto outnow; @@ -1484,7 +1484,7 @@ sctp_process_cookie_existing(struct mbuf sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination); op_err = sctp_generate_cause(SCTP_CAUSE_COOKIE_IN_SHUTDOWN, ""); sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, net->port); if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 2; @@ -1694,7 +1694,7 @@ sctp_process_cookie_existing(struct mbuf */ op_err = sctp_generate_cause(SCTP_CAUSE_NAT_COLLIDING_STATE, ""); sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); return (NULL); } @@ -2572,7 +2572,7 @@ sctp_handle_cookie_echo(struct mbuf *m, tim = now.tv_usec - cookie->time_entered.tv_usec; scm->time_usec = htonl(tim); sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err, - mflowtype, mflowid, + mflowtype, mflowid, l_inp->fibnum, vrf_id, port); return (NULL); } @@ -2794,6 +2794,7 @@ sctp_handle_cookie_echo(struct mbuf *m, inp->partial_delivery_point = (*inp_p)->partial_delivery_point; inp->sctp_context = (*inp_p)->sctp_context; inp->local_strreset_support = (*inp_p)->local_strreset_support; + inp->fibnum = (*inp_p)->fibnum; inp->inp_starting_point_for_iterator = NULL; /* * copy in the authentication parameters from the @@ -4404,7 +4405,7 @@ __attribute__((noinline)) struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, - uint8_t mflowtype, uint32_t mflowid, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; @@ -4568,7 +4569,7 @@ __attribute__((noinline)) msg); /* no association, so it's out of the blue... */ sctp_handle_ootb(m, iphlen, *offset, src, dst, sh, inp, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); *offset = length; if (locked_tcb) { @@ -4612,7 +4613,7 @@ __attribute__((noinline)) msg); sctp_handle_ootb(m, iphlen, *offset, src, dst, sh, inp, op_err, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); return (NULL); } @@ -5622,7 +5623,7 @@ sctp_common_input_processing(struct mbuf uint8_t compute_crc, #endif uint8_t ecn_bits, - uint8_t mflowtype, uint32_t mflowid, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) { uint32_t high_tsn; @@ -5701,7 +5702,7 @@ sctp_common_input_processing(struct mbuf } if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { sctp_send_shutdown_complete2(src, dst, sh, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); goto out; } @@ -5716,7 +5717,7 @@ sctp_common_input_processing(struct mbuf "Out of the blue"); sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); } } @@ -5777,7 +5778,7 @@ sctp_common_input_processing(struct mbuf op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); goto out; } @@ -5788,7 +5789,7 @@ sctp_common_input_processing(struct mbuf stcb = sctp_process_control(m, iphlen, &offset, length, src, dst, sh, ch, inp, stcb, &net, &fwd_tsn_seen, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); if (stcb) { /* @@ -5829,7 +5830,7 @@ sctp_common_input_processing(struct mbuf op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); goto out; } @@ -5901,7 +5902,7 @@ sctp_common_input_processing(struct mbuf op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); goto out; /* sa_ignore NOTREACHED */ @@ -6038,6 +6039,7 @@ sctp_input_with_port(struct mbuf *i_pak, #endif uint32_t mflowid; uint8_t mflowtype; + uint16_t fibnum; iphlen = off; if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) { @@ -6063,6 +6065,7 @@ sctp_input_with_port(struct mbuf *i_pak, (int)m->m_pkthdr.csum_flags, CSUM_BITS); mflowid = m->m_pkthdr.flowid; mflowtype = M_HASHTYPE_GET(m); + fibnum = M_GETFIB(m); SCTP_STAT_INCR(sctps_recvpackets); SCTP_STAT_INCR_COUNTER64(sctps_inpackets); /* Get IP, SCTP, and first chunk header together in the first mbuf. */ @@ -6122,7 +6125,7 @@ sctp_input_with_port(struct mbuf *i_pak, compute_crc, #endif ecn_bits, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); out: if (m) { Modified: stable/10/sys/netinet/sctp_input.h ============================================================================== --- stable/10/sys/netinet/sctp_input.h Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_input.h Sat Jun 20 08:25:27 2015 (r284633) @@ -45,7 +45,7 @@ sctp_common_input_processing(struct mbuf uint8_t, #endif uint8_t, - uint8_t, uint32_t, + uint8_t, uint32_t, uint16_t, uint32_t, uint16_t); struct sctp_stream_reset_request * Modified: stable/10/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/10/sys/netinet/sctp_os_bsd.h Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_os_bsd.h Sat Jun 20 08:25:27 2015 (r284633) @@ -412,13 +412,8 @@ typedef struct callout sctp_os_timer_t; typedef struct route sctp_route_t; typedef struct rtentry sctp_rtentry_t; -/* - * XXX multi-FIB support was backed out in r179783 and it seems clear that the - * VRF support as currently in FreeBSD is not ready to support multi-FIB. - * It might be best to implement multi-FIB support for both v4 and v6 indepedent - * of VRFs and leave those to a real MPLS stack. - */ -#define SCTP_RTALLOC(ro, vrf_id) rtalloc_ign((struct route *)ro, 0UL) +#define SCTP_RTALLOC(ro, vrf_id, fibnum) \ + rtalloc_ign_fib((struct route *)ro, 0UL, fibnum) /* Future zero copy wakeup/send function */ #define SCTP_ZERO_COPY_EVENT(inp, so) Modified: stable/10/sys/netinet/sctp_output.c ============================================================================== --- stable/10/sys/netinet/sctp_output.c Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_output.c Sat Jun 20 08:25:27 2015 (r284633) @@ -3389,7 +3389,7 @@ sctp_source_address_selection(struct sct /* * Need a route to cache. */ - SCTP_RTALLOC(ro, vrf_id); + SCTP_RTALLOC(ro, vrf_id, inp->fibnum); } if (ro->ro_rt == NULL) { return (NULL); @@ -4170,7 +4170,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_free_ifa(_lsrc); } else { ip->ip_src = over_addr->sin.sin_addr; - SCTP_RTALLOC(ro, vrf_id); + SCTP_RTALLOC(ro, vrf_id, inp->fibnum); } } if (port) { @@ -4484,7 +4484,7 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_free_ifa(_lsrc); } else { lsa6->sin6_addr = over_addr->sin6.sin6_addr; - SCTP_RTALLOC(ro, vrf_id); + SCTP_RTALLOC(ro, vrf_id, inp->fibnum); } (void)sa6_recoverscope(sin6); } @@ -5511,7 +5511,7 @@ sctp_send_initiate_ack(struct sctp_inpcb op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); sctp_send_abort(init_pkt, iphlen, src, dst, sh, 0, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); return; } @@ -5530,7 +5530,7 @@ do_a_abort: } sctp_send_abort(init_pkt, iphlen, src, dst, sh, init_chk->init.initiate_tag, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); return; } @@ -10855,7 +10855,7 @@ static void sctp_send_resp_msg(struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint32_t vtag, uint8_t type, struct mbuf *cause, - uint8_t mflowtype, uint32_t mflowid, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) { struct mbuf *o_pak; @@ -10935,6 +10935,7 @@ sctp_send_resp_msg(struct sockaddr *src, SCTP_BUF_RESV_UF(mout, max_linkhdr); SCTP_BUF_LEN(mout) = len; SCTP_BUF_NEXT(mout) = cause; + M_SETFIB(mout, fibnum); mout->m_pkthdr.flowid = mflowid; M_HASHTYPE_SET(mout, mflowtype); #ifdef INET @@ -11122,11 +11123,11 @@ sctp_send_resp_msg(struct sockaddr *src, void sctp_send_shutdown_complete2(struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, - uint8_t mflowtype, uint32_t mflowid, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) { sctp_send_resp_msg(src, dst, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); } @@ -11945,7 +11946,7 @@ skip_stuff: void sctp_send_abort(struct mbuf *m, int iphlen, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint32_t vtag, struct mbuf *cause, - uint8_t mflowtype, uint32_t mflowid, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) { /* Don't respond to an ABORT with an ABORT. */ @@ -11955,7 +11956,7 @@ sctp_send_abort(struct mbuf *m, int iphl return; } sctp_send_resp_msg(src, dst, sh, vtag, SCTP_ABORT_ASSOCIATION, cause, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); return; } @@ -11963,11 +11964,11 @@ sctp_send_abort(struct mbuf *m, int iphl void sctp_send_operr_to(struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, uint32_t vtag, struct mbuf *cause, - uint8_t mflowtype, uint32_t mflowid, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) { sctp_send_resp_msg(src, dst, sh, vtag, SCTP_OPERATION_ERROR, cause, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); return; } Modified: stable/10/sys/netinet/sctp_output.h ============================================================================== --- stable/10/sys/netinet/sctp_output.h Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_output.h Sat Jun 20 08:25:27 2015 (r284633) @@ -117,7 +117,7 @@ void sctp_send_shutdown_complete(struct void sctp_send_shutdown_complete2(struct sockaddr *, struct sockaddr *, struct sctphdr *, - uint8_t, uint32_t, + uint8_t, uint32_t, uint16_t, uint32_t, uint16_t); void sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked); @@ -187,13 +187,13 @@ sctp_send_str_reset_req(struct sctp_tcb void sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *, struct sctphdr *, uint32_t, struct mbuf *, - uint8_t, uint32_t, + uint8_t, uint32_t, uint16_t, uint32_t, uint16_t); void sctp_send_operr_to(struct sockaddr *, struct sockaddr *, struct sctphdr *, uint32_t, struct mbuf *, - uint8_t, uint32_t, + uint8_t, uint32_t, uint16_t, uint32_t, uint16_t); #endif /* _KERNEL || __Userspace__ */ Modified: stable/10/sys/netinet/sctp_pcb.c ============================================================================== --- stable/10/sys/netinet/sctp_pcb.c Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_pcb.c Sat Jun 20 08:25:27 2015 (r284633) @@ -2489,6 +2489,7 @@ sctp_inpcb_alloc(struct socket *so, uint inp->reconfig_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_reconfig_enable); inp->nrsack_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_nrsack_enable); inp->pktdrop_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_pktdrop_enable); + inp->fibnum = so->so_fibnum; /* init the small hash table we use to track asocid <-> tcb */ inp->sctp_asocidhash = SCTP_HASH_INIT(SCTP_STACK_VTAG_HASH_SIZE, &inp->hashasocidmark); if (inp->sctp_asocidhash == NULL) { @@ -3953,7 +3954,9 @@ sctp_add_remote_addr(struct sctp_tcb *st sin6->sin6_scope_id = 0; } #endif - SCTP_RTALLOC((sctp_route_t *) & net->ro, stcb->asoc.vrf_id); + SCTP_RTALLOC((sctp_route_t *) & net->ro, + stcb->asoc.vrf_id, + stcb->sctp_ep->fibnum); if (SCTP_ROUTE_HAS_VALID_IFN(&net->ro)) { /* Get source address */ Modified: stable/10/sys/netinet/sctp_pcb.h ============================================================================== --- stable/10/sys/netinet/sctp_pcb.h Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_pcb.h Sat Jun 20 08:25:27 2015 (r284633) @@ -430,6 +430,7 @@ struct sctp_inpcb { struct mtx inp_rdata_mtx; int32_t refcount; uint32_t def_vrf_id; + uint16_t fibnum; uint32_t total_sends; uint32_t total_recvs; uint32_t last_abort_code; Modified: stable/10/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/10/sys/netinet/sctp_usrreq.c Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctp_usrreq.c Sat Jun 20 08:25:27 2015 (r284633) @@ -6712,7 +6712,20 @@ sctp_ctloutput(struct socket *so, struct size_t optsize = 0; void *p; int error = 0; + struct sctp_inpcb *inp; + if ((sopt->sopt_level == SOL_SOCKET) && + (sopt->sopt_name == SO_SETFIB)) { + inp = (struct sctp_inpcb *)so->so_pcb; + if (inp == NULL) { + SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS); + return (EINVAL); + } + SCTP_INP_WLOCK(inp); + inp->fibnum = so->so_fibnum; + SCTP_INP_WUNLOCK(inp); + return (0); + } if (sopt->sopt_level != IPPROTO_SCTP) { /* wrong proto level... send back up to IP */ #ifdef INET6 Modified: stable/10/sys/netinet/sctputil.c ============================================================================== --- stable/10/sys/netinet/sctputil.c Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctputil.c Sat Jun 20 08:25:27 2015 (r284633) @@ -3895,7 +3895,7 @@ sctp_abort_association(struct sctp_inpcb stcb->asoc.state |= SCTP_STATE_WAS_ABORTED; } sctp_send_abort(m, iphlen, src, dst, sh, vtag, op_err, - mflowtype, mflowid, + mflowtype, mflowid, inp->fibnum, vrf_id, port); if (stcb != NULL) { /* Ok, now lets free it */ @@ -4051,7 +4051,7 @@ sctp_handle_ootb(struct mbuf *m, int iph struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_inpcb *inp, struct mbuf *cause, - uint8_t mflowtype, uint32_t mflowid, + uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, uint32_t vrf_id, uint16_t port) { struct sctp_chunkhdr *ch, chunk_buf; @@ -4093,7 +4093,7 @@ sctp_handle_ootb(struct mbuf *m, int iph return; case SCTP_SHUTDOWN_ACK: sctp_send_shutdown_complete2(src, dst, sh, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); return; default: @@ -4107,7 +4107,7 @@ sctp_handle_ootb(struct mbuf *m, int iph ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (contains_init_chunk == 0))) { sctp_send_abort(m, iphlen, src, dst, sh, 0, cause, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); } } Modified: stable/10/sys/netinet/sctputil.h ============================================================================== --- stable/10/sys/netinet/sctputil.h Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet/sctputil.h Sat Jun 20 08:25:27 2015 (r284633) @@ -208,7 +208,7 @@ sctp_handle_ootb(struct mbuf *, int, int struct sockaddr *, struct sockaddr *, struct sctphdr *, struct sctp_inpcb *, struct mbuf *, - uint8_t, uint32_t, + uint8_t, uint32_t, uint16_t, uint32_t, uint16_t); int Modified: stable/10/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/10/sys/netinet6/sctp6_usrreq.c Sat Jun 20 08:24:17 2015 (r284632) +++ stable/10/sys/netinet6/sctp6_usrreq.c Sat Jun 20 08:25:27 2015 (r284633) @@ -84,6 +84,7 @@ sctp6_input_with_port(struct mbuf **i_pa #endif uint32_t mflowid; uint8_t mflowtype; + uint16_t fibnum; iphlen = *offp; if (SCTP_GET_PKT_VRFID(*i_pak, vrf_id)) { @@ -109,6 +110,7 @@ sctp6_input_with_port(struct mbuf **i_pa (int)m->m_pkthdr.csum_flags, CSUM_BITS); mflowid = m->m_pkthdr.flowid; mflowtype = M_HASHTYPE_GET(m); + fibnum = M_GETFIB(m); SCTP_STAT_INCR(sctps_recvpackets); SCTP_STAT_INCR_COUNTER64(sctps_inpackets); /* Get IP, SCTP, and first chunk header together in the first mbuf. */ @@ -173,7 +175,7 @@ sctp6_input_with_port(struct mbuf **i_pa compute_crc, #endif ecn_bits, - mflowtype, mflowid, + mflowtype, mflowid, fibnum, vrf_id, port); out: if (m) { From owner-svn-src-stable-10@FreeBSD.ORG Sat Jun 20 08:28:48 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A2606B2; Sat, 20 Jun 2015 08:28:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08016D97; Sat, 20 Jun 2015 08:28:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5K8SlLQ094948; Sat, 20 Jun 2015 08:28:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5K8SlFH094946; Sat, 20 Jun 2015 08:28:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201506200828.t5K8SlFH094946@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 20 Jun 2015 08:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284634 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 08:28:48 -0000 Author: tuexen Date: Sat Jun 20 08:28:47 2015 New Revision: 284634 URL: https://svnweb.freebsd.org/changeset/base/284634 Log: MFC r284526: Fix a bug related to flow assignment I introduced in https://svnweb.freebsd.org/base?view=revision&revision=275483 Modified: stable/10/sys/netinet/sctp_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_input.c ============================================================================== --- stable/10/sys/netinet/sctp_input.c Sat Jun 20 08:25:27 2015 (r284633) +++ stable/10/sys/netinet/sctp_input.c Sat Jun 20 08:28:47 2015 (r284634) @@ -2676,8 +2676,9 @@ sctp_handle_cookie_echo(struct mbuf *m, /* still no TCB... must be bad cookie-echo */ return (NULL); } - if ((*netp != NULL) && (mflowtype != M_HASHTYPE_NONE)) { + if (*netp != NULL) { (*netp)->flowtype = mflowtype; + (*netp)->flowid = mflowid; } /* * Ok, we built an association so confirm the address we sent the @@ -5662,8 +5663,9 @@ sctp_common_input_processing(struct mbuf net->port = port; } #endif - if ((net != NULL) && (mflowtype != M_HASHTYPE_NONE)) { + if (net != NULL) { net->flowtype = mflowtype; + net->flowid = mflowid; } if ((inp != NULL) && (stcb != NULL)) { sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); @@ -5692,8 +5694,9 @@ sctp_common_input_processing(struct mbuf net->port = port; } #endif - if ((net != NULL) && (mflowtype != M_HASHTYPE_NONE)) { + if (net != NULL) { net->flowtype = mflowtype; + net->flowid = mflowid; } if (inp == NULL) { SCTP_STAT_INCR(sctps_noport); From owner-svn-src-stable-10@FreeBSD.ORG Sat Jun 20 13:25:29 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DDF8F542; Sat, 20 Jun 2015 13:25:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB93DB14; Sat, 20 Jun 2015 13:25:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5KDPTh2043267; Sat, 20 Jun 2015 13:25:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5KDPTuc043266; Sat, 20 Jun 2015 13:25:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201506201325.t5KDPTuc043266@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 20 Jun 2015 13:25:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284642 - in stable: 10/sys/i386/i386 9/sys/i386/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 13:25:30 -0000 Author: dim Date: Sat Jun 20 13:25:28 2015 New Revision: 284642 URL: https://svnweb.freebsd.org/changeset/base/284642 Log: MFC r284167: Merge r283870 from amd64: Remove unneeded NULL checks in trap_fatal(). Since td_name is an array member of struct thread, it can never be NULL, so the check can be removed. In addition, curproc can never be NULL, so remove the if statement, and splice the two printfs() together. While here, remove the u_long cast, and use the correct printf format specifier for curproc->p_pid. Requested by: jhb Modified: stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/i386/i386/trap.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/10/sys/i386/i386/trap.c ============================================================================== --- stable/10/sys/i386/i386/trap.c Sat Jun 20 13:02:57 2015 (r284641) +++ stable/10/sys/i386/i386/trap.c Sat Jun 20 13:25:28 2015 (r284642) @@ -1001,12 +1001,8 @@ trap_fatal(frame, eva) if (frame->tf_eflags & PSL_VM) printf("vm86, "); printf("IOPL = %d\n", (frame->tf_eflags & PSL_IOPL) >> 12); - printf("current process = "); - if (curproc) { - printf("%lu (%s)\n", (u_long)curproc->p_pid, curthread->td_name); - } else { - printf("Idle\n"); - } + printf("current process = %d (%s)\n", + curproc->p_pid, curthread->td_name); #ifdef KDB if (debugger_on_panic || kdb_active) { From owner-svn-src-stable-10@FreeBSD.ORG Sat Jun 20 13:30:11 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3993B7E8; Sat, 20 Jun 2015 13:30:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27250B58; Sat, 20 Jun 2015 13:30:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5KDUBsZ044200; Sat, 20 Jun 2015 13:30:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5KDUBGx044199; Sat, 20 Jun 2015 13:30:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201506201330.t5KDUBGx044199@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 20 Jun 2015 13:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284643 - in stable: 10/lib/libfetch 7/lib/libfetch 8/lib/libfetch 9/lib/libfetch X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 13:30:11 -0000 Author: dim Date: Sat Jun 20 13:30:09 2015 New Revision: 284643 URL: https://svnweb.freebsd.org/changeset/base/284643 Log: MFC r284346: Fix the following clang 3.7.0 warnings in lib/libfetch/http.c: lib/libfetch/http.c:1628:26: error: address of array 'purl->user' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.user = purl->user ? ~~~~~~^~~~ ~ lib/libfetch/http.c:1630:30: error: address of array 'purl->pwd' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.password = purl->pwd? ~~~~~~^~~~ lib/libfetch/http.c:1657:25: error: address of array 'url->user' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.user = url->user ? ~~~~~^~~~ ~ lib/libfetch/http.c:1659:29: error: address of array 'url->pwd' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.password = url->pwd ? ~~~~~^~~ ~ lib/libfetch/http.c:1669:25: error: address of array 'url->user' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.user = url->user ? ~~~~~^~~~ ~ lib/libfetch/http.c:1671:29: error: address of array 'url->pwd' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] aparams.password = url->pwd ? ~~~~~^~~ ~ Since url->user and url->pwd are arrays, they can never be NULL, so the checks can be removed. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D2673 Modified: stable/10/lib/libfetch/http.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/7/lib/libfetch/http.c stable/8/lib/libfetch/http.c stable/9/lib/libfetch/http.c Directory Properties: stable/7/ (props changed) stable/7/lib/ (props changed) stable/7/lib/libfetch/ (props changed) stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/libfetch/ (props changed) stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/libfetch/ (props changed) Modified: stable/10/lib/libfetch/http.c ============================================================================== --- stable/10/lib/libfetch/http.c Sat Jun 20 13:25:28 2015 (r284642) +++ stable/10/lib/libfetch/http.c Sat Jun 20 13:30:09 2015 (r284643) @@ -1625,10 +1625,8 @@ http_request_body(struct url *URL, const http_auth_params_t aparams; init_http_auth_params(&aparams); if (*purl->user || *purl->pwd) { - aparams.user = purl->user ? - strdup(purl->user) : strdup(""); - aparams.password = purl->pwd? - strdup(purl->pwd) : strdup(""); + aparams.user = strdup(purl->user); + aparams.password = strdup(purl->pwd); } else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { @@ -1654,10 +1652,8 @@ http_request_body(struct url *URL, const http_auth_params_t aparams; init_http_auth_params(&aparams); if (*url->user || *url->pwd) { - aparams.user = url->user ? - strdup(url->user) : strdup(""); - aparams.password = url->pwd ? - strdup(url->pwd) : strdup(""); + aparams.user = strdup(url->user); + aparams.password = strdup(url->pwd); } else if ((p = getenv("HTTP_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { @@ -1666,10 +1662,8 @@ http_request_body(struct url *URL, const } } else if (fetchAuthMethod && fetchAuthMethod(url) == 0) { - aparams.user = url->user ? - strdup(url->user) : strdup(""); - aparams.password = url->pwd ? - strdup(url->pwd) : strdup(""); + aparams.user = strdup(url->user); + aparams.password = strdup(url->pwd); } else { http_seterr(HTTP_NEED_AUTH); goto ouch; From owner-svn-src-stable-10@FreeBSD.ORG Sat Jun 20 15:55:54 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 565FE94C; Sat, 20 Jun 2015 15:55:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43E4A1D6; Sat, 20 Jun 2015 15:55:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5KFtsBm016551; Sat, 20 Jun 2015 15:55:54 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5KFtslv016550; Sat, 20 Jun 2015 15:55:54 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201506201555.t5KFtslv016550@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 20 Jun 2015 15:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284645 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 15:55:54 -0000 Author: trasz Date: Sat Jun 20 15:55:53 2015 New Revision: 284645 URL: https://svnweb.freebsd.org/changeset/base/284645 Log: MFC r281820: Add hint about "volmode=dev" to ctl.conf(5). Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctl.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Sat Jun 20 15:03:02 2015 (r284644) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Sat Jun 20 15:55:53 2015 (r284645) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 4, 2015 +.Dd April 19, 2015 .Dt CTL.CONF 5 .Os .Sh NAME @@ -362,7 +362,12 @@ All CTL-specific options are documented section of .Xr ctladm 8 . .It Ic path Ar path -The path to the file or device node used to back the LUN. +The path to the file, device node, or +.Xr zfs 8 +volume used to back the LUN. +For optimal performance, create the volume with the +.Qq Ar volmode=dev +property set. .It Ic serial Ar string The SCSI serial number presented to the initiator. .It Ic size Ar size @@ -431,7 +436,8 @@ target naa.50015178f369f092 { .Sh SEE ALSO .Xr ctl 4 , .Xr ctladm 8 , -.Xr ctld 8 +.Xr ctld 8 , +.Xr zfs 8 .Sh AUTHORS The .Nm From owner-svn-src-stable-10@FreeBSD.ORG Sat Jun 20 23:15:59 2015 Return-Path: Delivered-To: svn-src-stable-10@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71802D38; Sat, 20 Jun 2015 23:15:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E7BB1C8; Sat, 20 Jun 2015 23:15:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5KNFvEp034437; Sat, 20 Jun 2015 23:15:57 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5KNFv0C034436; Sat, 20 Jun 2015 23:15:57 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201506202315.t5KNFv0C034436@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 20 Jun 2015 23:15:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284652 - stable/10/sbin/umount X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 23:15:59 -0000 Author: rmacklem Date: Sat Jun 20 23:15:57 2015 New Revision: 284652 URL: https://svnweb.freebsd.org/changeset/base/284652 Log: MFC: r284531 Document that a forced dismount of an NFSv3 mount when the NLM (rpc.lockd) is running can crash the system. Unfortunately this is not easy to fix, but I have left PR#200585 open. Modified: stable/10/sbin/umount/umount.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/umount/umount.8 ============================================================================== --- stable/10/sbin/umount/umount.8 Sat Jun 20 22:24:44 2015 (r284651) +++ stable/10/sbin/umount/umount.8 Sat Jun 20 23:15:57 2015 (r284652) @@ -28,7 +28,7 @@ .\" @(#)umount.8 8.2 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd November 22, 2014 +.Dd June 17, 2015 .Dt UMOUNT 8 .Os .Sh NAME @@ -81,6 +81,9 @@ The root file system cannot be forcibly For NFS, a forced dismount can take up to 1 minute or more to complete against an unresponsive server and may throw away data not yet written to the server for this case. +Also, doing a forced dismount of an NFSv3 mount when +.Xr rpc.lockd 8 +is running is unsafe and can result in a crash. .It Fl h Ar host Only file systems mounted from the specified host will be unmounted.