svn commit: r321307 - in projects/clang500-import: bin/date lib/libc/sys lib/librt share/misc sys/amd64/include sys/boot/efi/boot1 sys/conf sys/dev/e1000 sys/dev/hyperv/storvsc sys/net sys/netinet ...

Dimitry Andric dim at FreeBSD.org
Thu Jul 20 20:37:26 UTC 2017


Author: dim
Date: Thu Jul 20 20:37:23 2017
New Revision: 321307
URL: https://svnweb.freebsd.org/changeset/base/321307

Log:
  Merge ^/head r321239 through r321306.

Modified:
  projects/clang500-import/bin/date/date.c
  projects/clang500-import/lib/libc/sys/Symbol.map
  projects/clang500-import/lib/librt/Symbol.map
  projects/clang500-import/lib/librt/aio.c
  projects/clang500-import/share/misc/committers-src.dot
  projects/clang500-import/sys/amd64/include/efi.h
  projects/clang500-import/sys/boot/efi/boot1/zfs_module.c
  projects/clang500-import/sys/conf/kern.pre.mk
  projects/clang500-import/sys/conf/kmod.mk
  projects/clang500-import/sys/dev/e1000/if_em.c
  projects/clang500-import/sys/dev/e1000/if_em.h
  projects/clang500-import/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  projects/clang500-import/sys/net/iflib.c
  projects/clang500-import/sys/netinet/sctp_indata.c
  projects/clang500-import/sys/netinet/sctp_os_bsd.h
  projects/clang500-import/sys/netinet/sctp_ss_functions.c
  projects/clang500-import/sys/sys/_pctrie.h
  projects/clang500-import/sys/sys/efi.h
  projects/clang500-import/sys/sys/pctrie.h
  projects/clang500-import/sys/vm/_vm_radix.h
  projects/clang500-import/sys/vm/vm_object.c
  projects/clang500-import/sys/vm/vm_radix.c
  projects/clang500-import/sys/vm/vm_radix.h
  projects/clang500-import/usr.bin/procstat/procstat.c
  projects/clang500-import/usr.bin/truss/syscalls.c
  projects/clang500-import/usr.sbin/acpi/acpidump/acpi.c
  projects/clang500-import/usr.sbin/cron/cron/cron.8
  projects/clang500-import/usr.sbin/newsyslog/tests/legacy_test.sh
  projects/clang500-import/usr.sbin/nfsd/nfsv4.4
Directory Properties:
  projects/clang500-import/   (props changed)

Modified: projects/clang500-import/bin/date/date.c
==============================================================================
--- projects/clang500-import/bin/date/date.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/bin/date/date.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -85,7 +85,7 @@ main(int argc, char *argv[])
 	int set_timezone;
 	struct vary *v;
 	const struct vary *badv;
-	struct tm lt;
+	struct tm *lt;
 	struct stat sb;
 
 	v = NULL;
@@ -174,8 +174,10 @@ main(int argc, char *argv[])
 	if (*argv && **argv == '+')
 		format = *argv + 1;
 
-	lt = *localtime(&tval);
-	badv = vary_apply(v, &lt);
+	lt = localtime(&tval);
+	if (lt == NULL)
+		errx(1, "invalid time");
+	badv = vary_apply(v, lt);
 	if (badv) {
 		fprintf(stderr, "%s: Cannot apply date adjustment\n",
 			badv->arg);
@@ -191,7 +193,7 @@ main(int argc, char *argv[])
 		 */
 		setlocale(LC_TIME, "C");
 
-	(void)strftime(buf, sizeof(buf), format, &lt);
+	(void)strftime(buf, sizeof(buf), format, lt);
 	(void)printf("%s\n", buf);
 	if (fflush(stdout))
 		err(1, "stdout");
@@ -210,6 +212,8 @@ setthetime(const char *fmt, const char *p, int jflag, 
 	int century;
 
 	lt = localtime(&tval);
+	if (lt == NULL)
+		errx(1, "invalid time");
 	lt->tm_isdst = -1;		/* divine correct DST */
 
 	if (fmt != NULL) {

Modified: projects/clang500-import/lib/libc/sys/Symbol.map
==============================================================================
--- projects/clang500-import/lib/libc/sys/Symbol.map	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/lib/libc/sys/Symbol.map	Thu Jul 20 20:37:23 2017	(r321307)
@@ -469,21 +469,13 @@ FBSDprivate_1.0 {
 	__sys_acct;
 	_adjtime;
 	__sys_adjtime;
-	_aio_cancel;
 	__sys_aio_cancel;
-	_aio_error;
 	__sys_aio_error;
-	_aio_fsync;
 	__sys_aio_fsync;
-	_aio_read;
 	__sys_aio_read;
-	_aio_return;
 	__sys_aio_return;
-	_aio_suspend;
 	__sys_aio_suspend;
-	_aio_waitcomplete;
 	__sys_aio_waitcomplete;
-	_aio_write;
 	__sys_aio_write;
 	_audit;
 	__sys_audit;
@@ -727,7 +719,6 @@ FBSDprivate_1.0 {
 	__sys_lgetfh;
 	_link;
 	__sys_link;
-	_lio_listio;
 	__sys_lio_listio;
 	_listen;
 	__sys_listen;

Modified: projects/clang500-import/lib/librt/Symbol.map
==============================================================================
--- projects/clang500-import/lib/librt/Symbol.map	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/lib/librt/Symbol.map	Thu Jul 20 20:37:23 2017	(r321307)
@@ -31,16 +31,6 @@ FBSD_1.5 {
 };
 
 FBSDprivate_1.0 {
-	_aio_read;
-	_aio_write;
-	_aio_return;
-	_aio_waitcomplete;
-	_aio_fsync;
-	__aio_read;
-	__aio_write;
-	__aio_return;
-	__aio_waitcomplete;
-	__aio_fsync;
 	_mq_open;
 	_mq_close;
 	_mq_notify;

Modified: projects/clang500-import/lib/librt/aio.c
==============================================================================
--- projects/clang500-import/lib/librt/aio.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/lib/librt/aio.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -39,15 +39,10 @@
 #include "sigev_thread.h"
 #include "un-namespace.h"
 
-__weak_reference(__aio_read, _aio_read);
 __weak_reference(__aio_read, aio_read);
-__weak_reference(__aio_write, _aio_write);
 __weak_reference(__aio_write, aio_write);
-__weak_reference(__aio_return, _aio_return);
 __weak_reference(__aio_return, aio_return);
-__weak_reference(__aio_waitcomplete, _aio_waitcomplete);
 __weak_reference(__aio_waitcomplete, aio_waitcomplete);
-__weak_reference(__aio_fsync, _aio_fsync);
 __weak_reference(__aio_fsync, aio_fsync);
 
 typedef void (*aio_func)(union sigval val, struct aiocb *iocb);

Modified: projects/clang500-import/share/misc/committers-src.dot
==============================================================================
--- projects/clang500-import/share/misc/committers-src.dot	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/share/misc/committers-src.dot	Thu Jul 20 20:37:23 2017	(r321307)
@@ -244,6 +244,7 @@ melifaro [label="Alexander V. Chernikov\nmelifaro at Free
 mizhka [label="Michael Zhilin\nmizhka at FreeBSD.org\n2016/07/19"]
 mjacob [label="Matt Jacob\nmjacob at FreeBSD.org\n1997/08/13"]
 mjg [label="Mateusz Guzik\nmjg at FreeBSD.org\n2012/06/04"]
+mjoras [label="Matt Joras\nmjoras at FreeBSD.org\n2017/07/12"]
 mlaier [label="Max Laier\nmlaier at FreeBSD.org\n2004/02/10"]
 mmel [label="Michal Meloun\nmmel at FreeBSD.org\n2015/11/01"]
 monthadar [label="Monthadar Al Jaberi\nmonthadar at FreeBSD.org\n2012/04/02"]
@@ -720,6 +721,7 @@ rrs -> jchandra
 rrs -> tuexen
 
 rstone -> markj
+rstone -> mjoras
 
 ru -> ceri
 ru -> cjc

Modified: projects/clang500-import/sys/amd64/include/efi.h
==============================================================================
--- projects/clang500-import/sys/amd64/include/efi.h	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/amd64/include/efi.h	Thu Jul 20 20:37:23 2017	(r321307)
@@ -36,8 +36,14 @@
  * XXX: from gcc 6.2 manual:
  * Note, the ms_abi attribute for Microsoft Windows 64-bit targets
  * currently requires the -maccumulate-outgoing-args option.
+ *
+ * Avoid EFIABI_ATTR declarations for compilers that don't support it.
+ * GCC support began in version 4.4.
  */
+#if defined(__clang__) || defined(__GNUC__) && \
+    (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)
 #define	EFIABI_ATTR	__attribute__((ms_abi))
+#endif
 
 #ifdef _KERNEL
 struct uuid;

Modified: projects/clang500-import/sys/boot/efi/boot1/zfs_module.c
==============================================================================
--- projects/clang500-import/sys/boot/efi/boot1/zfs_module.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/boot/efi/boot1/zfs_module.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -182,8 +182,8 @@ load(const char *filepath, dev_info_t *devinfo, void *
 
 	if ((status = bs->AllocatePool(EfiLoaderData, (UINTN)st.st_size, &buf))
 	    != EFI_SUCCESS) {
-		printf("Failed to allocate load buffer %zd for pool '%s' for '%s' "
-		    "(%lu)\n", st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status));
+		printf("Failed to allocate load buffer %jd for pool '%s' for '%s' "
+		    "(%lu)\n", (intmax_t)st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status));
 		return (EFI_INVALID_PARAMETER);
 	}
 

Modified: projects/clang500-import/sys/conf/kern.pre.mk
==============================================================================
--- projects/clang500-import/sys/conf/kern.pre.mk	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/conf/kern.pre.mk	Thu Jul 20 20:37:23 2017	(r321307)
@@ -216,6 +216,7 @@ MKMODULESENV+=	MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMO
 MKMODULESENV+=	MACHINE_CPUARCH=${MACHINE_CPUARCH}
 MKMODULESENV+=	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH}
 MKMODULESENV+=	MODULES_EXTRA="${MODULES_EXTRA}" WITHOUT_MODULES="${WITHOUT_MODULES}"
+MKMODULESENV+=	ARCH_FLAGS="${ARCH_FLAGS}"
 .if (${KERN_IDENT} == LINT)
 MKMODULESENV+=	ALL_MODULES=LINT
 .endif
@@ -250,6 +251,7 @@ EMBEDFS_ARCH.${MACHINE_ARCH}!= sed -n '/OUTPUT_ARCH/s/
 
 EMBEDFS_FORMAT.arm?=		elf32-littlearm
 EMBEDFS_FORMAT.armv6?=		elf32-littlearm
+EMBEDFS_FORMAT.aarch64?=	elf64-littleaarch64
 EMBEDFS_FORMAT.mips?=		elf32-tradbigmips
 EMBEDFS_FORMAT.mipsel?=		elf32-tradlittlemips
 EMBEDFS_FORMAT.mips64?=		elf64-tradbigmips

Modified: projects/clang500-import/sys/conf/kmod.mk
==============================================================================
--- projects/clang500-import/sys/conf/kmod.mk	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/conf/kmod.mk	Thu Jul 20 20:37:23 2017	(r321307)
@@ -366,7 +366,7 @@ ${_src}:
 .endif
 
 # Respect configuration-specific C flags.
-CFLAGS+=	${CONF_CFLAGS}
+CFLAGS+=	${ARCH_FLAGS} ${CONF_CFLAGS}
 
 .if !empty(SRCS:Mvnode_if.c)
 CLEANFILES+=	vnode_if.c

Modified: projects/clang500-import/sys/dev/e1000/if_em.c
==============================================================================
--- projects/clang500-import/sys/dev/e1000/if_em.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/dev/e1000/if_em.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -203,7 +203,7 @@ static pci_vendor_info_t igb_vendor_info_array[] =
 	PVID(0x8086, E1000_DEV_ID_I210_COPPER_OEM1, "Intel(R) PRO/1000 PCI-Express Network Driver"),
 	PVID(0x8086, E1000_DEV_ID_I210_COPPER_FLASHLESS, "Intel(R) PRO/1000 PCI-Express Network Driver"),
 	PVID(0x8086, E1000_DEV_ID_I210_SERDES_FLASHLESS, "Intel(R) PRO/1000 PCI-Express Network Driver"),
-	PVID(0x8086, E1000_DEV_ID_I210_FIBER, "Intel(R) PRO/1000 PCI-Express Network Driver"), 
+	PVID(0x8086, E1000_DEV_ID_I210_FIBER, "Intel(R) PRO/1000 PCI-Express Network Driver"),
 	PVID(0x8086, E1000_DEV_ID_I210_SERDES, "Intel(R) PRO/1000 PCI-Express Network Driver"),
 	PVID(0x8086, E1000_DEV_ID_I210_SGMII, "Intel(R) PRO/1000 PCI-Express Network Driver"),
 	PVID(0x8086, E1000_DEV_ID_I211_COPPER, "Intel(R) PRO/1000 PCI-Express Network Driver"),
@@ -231,8 +231,8 @@ static int	em_if_rx_queues_alloc(if_ctx_t ctx, caddr_t
 static void	em_if_queues_free(if_ctx_t ctx);
 
 static uint64_t	em_if_get_counter(if_ctx_t, ift_counter);
-static void	em_if_init(if_ctx_t ctx); 
-static void	em_if_stop(if_ctx_t ctx); 
+static void	em_if_init(if_ctx_t ctx);
+static void	em_if_stop(if_ctx_t ctx);
 static void	em_if_media_status(if_ctx_t, struct ifmediareq *);
 static int	em_if_media_change(if_ctx_t ctx);
 static int	em_if_mtu_set(if_ctx_t ctx, uint32_t mtu);
@@ -357,11 +357,11 @@ static device_method_t em_if_methods[] = {
 	DEVMETHOD(ifdi_detach, em_if_detach),
 	DEVMETHOD(ifdi_shutdown, em_if_shutdown),
 	DEVMETHOD(ifdi_suspend, em_if_suspend),
-	DEVMETHOD(ifdi_resume, em_if_resume), 
+	DEVMETHOD(ifdi_resume, em_if_resume),
 	DEVMETHOD(ifdi_init, em_if_init),
 	DEVMETHOD(ifdi_stop, em_if_stop),
 	DEVMETHOD(ifdi_msix_intr_assign, em_if_msix_intr_assign),
-	DEVMETHOD(ifdi_intr_enable, em_if_enable_intr), 
+	DEVMETHOD(ifdi_intr_enable, em_if_enable_intr),
 	DEVMETHOD(ifdi_intr_disable, em_if_disable_intr),
 	DEVMETHOD(ifdi_tx_queues_alloc, em_if_tx_queues_alloc),
 	DEVMETHOD(ifdi_rx_queues_alloc, em_if_rx_queues_alloc),
@@ -1025,7 +1025,7 @@ em_if_attach_post(if_ctx_t ctx)
 	/* Non-AMT based hardware can now take control from firmware */
 	if (adapter->has_manage && !adapter->has_amt)
 		em_get_hw_control(adapter);
-	
+
 	INIT_DEBUGOUT("em_if_attach_post: end");
 
 	return (error);
@@ -1401,7 +1401,7 @@ em_msix_link(void *arg)
 	u32 reg_icr;
 
 	++adapter->link_irq;
-	MPASS(adapter->hw.back != NULL); 
+	MPASS(adapter->hw.back != NULL);
 	reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR);
 
 	if (reg_icr & E1000_ICR_RXO)
@@ -1691,8 +1691,9 @@ em_if_update_admin_status(if_ctx_t ctx)
 	struct e1000_hw *hw = &adapter->hw;
 	struct ifnet *ifp = iflib_get_ifp(ctx);
 	device_t dev = iflib_get_dev(ctx);
-	u32 link_check = 0;
+	u32 link_check, thstat, ctrl;
 
+	link_check = thstat = ctrl = 0;
 	/* Get the cached link value or read phy for real */
 	switch (hw->phy.media_type) {
 	case e1000_media_type_copper:
@@ -1717,11 +1718,21 @@ em_if_update_admin_status(if_ctx_t ctx)
 		e1000_check_for_link(hw);
 		link_check = adapter->hw.mac.serdes_has_link;
 		break;
-	default:
+	/* VF device is type_unknown */
 	case e1000_media_type_unknown:
+		e1000_check_for_link(hw);
+		link_check = !hw->mac.get_link_status;
+		/* FALLTHROUGH */
+	default:
 		break;
 	}
 
+	/* Check for thermal downshift or shutdown */
+	if (hw->mac.type == e1000_i350) {
+		thstat = E1000_READ_REG(hw, E1000_THSTAT);
+		ctrl = E1000_READ_REG(hw, E1000_CTRL_EXT);
+	}
+
 	/* Now check for a transition */
 	if (link_check && (adapter->link_active == 0)) {
 		e1000_get_speed_and_duplex(hw, &adapter->link_speed,
@@ -1743,6 +1754,21 @@ em_if_update_admin_status(if_ctx_t ctx)
 		adapter->link_active = 1;
 		adapter->smartspeed = 0;
 		if_setbaudrate(ifp, adapter->link_speed * 1000000);
+		if ((ctrl & E1000_CTRL_EXT_LINK_MODE_GMII) &&
+		    (thstat & E1000_THSTAT_LINK_THROTTLE))
+			device_printf(dev, "Link: thermal downshift\n");
+		/* Delay Link Up for Phy update */
+		if (((hw->mac.type == e1000_i210) ||
+		    (hw->mac.type == e1000_i211)) &&
+		    (hw->phy.id == I210_I_PHY_ID))
+			msec_delay(I210_LINK_DELAY);
+		/* Reset if the media type changed. */
+		if ((hw->dev_spec._82575.media_changed) &&
+			(adapter->hw.mac.type >= igb_mac_min)) {
+			hw->dev_spec._82575.media_changed = false;
+			adapter->flags |= IGB_MEDIA_RESET;
+			em_reset(ctx);
+		}
 		iflib_link_state_change(ctx, LINK_STATE_UP, ifp->if_baudrate);
 		printf("Link state changed to up\n");
 	} else if (!link_check && (adapter->link_active == 1)) {
@@ -2210,7 +2236,115 @@ lem_smartspeed(struct adapter *adapter)
 		adapter->smartspeed = 0;
 }
 
+/*********************************************************************
+ *
+ *  Initialize the DMA Coalescing feature
+ *
+ **********************************************************************/
+static void
+igb_init_dmac(struct adapter *adapter, u32 pba)
+{
+	device_t	dev = adapter->dev;
+	struct e1000_hw *hw = &adapter->hw;
+	u32 		dmac, reg = ~E1000_DMACR_DMAC_EN;
+	u16		hwm;
+	u16		max_frame_size;
 
+	if (hw->mac.type == e1000_i211)
+		return;
+
+	max_frame_size = adapter->shared->isc_max_frame_size;
+	if (hw->mac.type > e1000_82580) {
+
+		if (adapter->dmac == 0) { /* Disabling it */
+			E1000_WRITE_REG(hw, E1000_DMACR, reg);
+			return;
+		} else
+			device_printf(dev, "DMA Coalescing enabled\n");
+
+		/* Set starting threshold */
+		E1000_WRITE_REG(hw, E1000_DMCTXTH, 0);
+
+		hwm = 64 * pba - max_frame_size / 16;
+		if (hwm < 64 * (pba - 6))
+			hwm = 64 * (pba - 6);
+		reg = E1000_READ_REG(hw, E1000_FCRTC);
+		reg &= ~E1000_FCRTC_RTH_COAL_MASK;
+		reg |= ((hwm << E1000_FCRTC_RTH_COAL_SHIFT)
+		    & E1000_FCRTC_RTH_COAL_MASK);
+		E1000_WRITE_REG(hw, E1000_FCRTC, reg);
+
+
+		dmac = pba - max_frame_size / 512;
+		if (dmac < pba - 10)
+			dmac = pba - 10;
+		reg = E1000_READ_REG(hw, E1000_DMACR);
+		reg &= ~E1000_DMACR_DMACTHR_MASK;
+		reg = ((dmac << E1000_DMACR_DMACTHR_SHIFT)
+		    & E1000_DMACR_DMACTHR_MASK);
+
+		/* transition to L0x or L1 if available..*/
+		reg |= (E1000_DMACR_DMAC_EN | E1000_DMACR_DMAC_LX_MASK);
+
+		/* Check if status is 2.5Gb backplane connection
+		* before configuration of watchdog timer, which is
+		* in msec values in 12.8usec intervals
+		* watchdog timer= msec values in 32usec intervals
+		* for non 2.5Gb connection
+		*/
+		if (hw->mac.type == e1000_i354) {
+			int status = E1000_READ_REG(hw, E1000_STATUS);
+			if ((status & E1000_STATUS_2P5_SKU) &&
+			    (!(status & E1000_STATUS_2P5_SKU_OVER)))
+				reg |= ((adapter->dmac * 5) >> 6);
+			else
+				reg |= (adapter->dmac >> 5);
+		} else {
+			reg |= (adapter->dmac >> 5);
+		}
+
+		E1000_WRITE_REG(hw, E1000_DMACR, reg);
+
+		E1000_WRITE_REG(hw, E1000_DMCRTRH, 0);
+
+		/* Set the interval before transition */
+		reg = E1000_READ_REG(hw, E1000_DMCTLX);
+		if (hw->mac.type == e1000_i350)
+			reg |= IGB_DMCTLX_DCFLUSH_DIS;
+		/*
+		** in 2.5Gb connection, TTLX unit is 0.4 usec
+		** which is 0x4*2 = 0xA. But delay is still 4 usec
+		*/
+		if (hw->mac.type == e1000_i354) {
+			int status = E1000_READ_REG(hw, E1000_STATUS);
+			if ((status & E1000_STATUS_2P5_SKU) &&
+			    (!(status & E1000_STATUS_2P5_SKU_OVER)))
+				reg |= 0xA;
+			else
+				reg |= 0x4;
+		} else {
+			reg |= 0x4;
+		}
+
+		E1000_WRITE_REG(hw, E1000_DMCTLX, reg);
+
+		/* free space in tx packet buffer to wake from DMA coal */
+		E1000_WRITE_REG(hw, E1000_DMCTXTH, (IGB_TXPBSIZE -
+		    (2 * max_frame_size)) >> 6);
+
+		/* make low power state decision controlled by DMA coal */
+		reg = E1000_READ_REG(hw, E1000_PCIEMISC);
+		reg &= ~E1000_PCIEMISC_LX_DECISION;
+		E1000_WRITE_REG(hw, E1000_PCIEMISC, reg);
+
+	} else if (hw->mac.type == e1000_82580) {
+		u32 reg = E1000_READ_REG(hw, E1000_PCIEMISC);
+		E1000_WRITE_REG(hw, E1000_PCIEMISC,
+		    reg & ~E1000_PCIEMISC_LX_DECISION);
+		E1000_WRITE_REG(hw, E1000_DMACR, 0);
+	}
+}
+
 static void
 em_reset(if_ctx_t ctx)
 {
@@ -2222,6 +2356,8 @@ em_reset(if_ctx_t ctx)
 	u32 pba;
 
 	INIT_DEBUGOUT("em_reset: begin");
+	/* Let the firmware know the OS is in control */
+	em_get_hw_control(adapter);
 
 	/* Set up smart power down as default off on newer adapters. */
 	if (!em_smart_pwr_down && (hw->mac.type == e1000_82571 ||
@@ -2400,15 +2536,15 @@ em_reset(if_ctx_t ctx)
 	case e1000_vfadapt_i350:
 		/* 16-byte granularity */
 		hw->fc.low_water = hw->fc.high_water - 16;
-		break; 
-        case e1000_ich9lan:
-        case e1000_ich10lan:
+		break;
+	case e1000_ich9lan:
+	case e1000_ich10lan:
 		if (if_getmtu(ifp) > ETHERMTU) {
 			hw->fc.high_water = 0x2800;
 			hw->fc.low_water = hw->fc.high_water - 8;
 			break;
 		}
-		/* else fall thru */
+		/* FALLTHROUGH */
 	default:
 		if (hw->mac.type == e1000_80003es2lan)
 			hw->fc.pause_time = 0xFFFF;
@@ -2417,13 +2553,24 @@ em_reset(if_ctx_t ctx)
 
 	/* Issue a global reset */
 	e1000_reset_hw(hw);
-	E1000_WRITE_REG(hw, E1000_WUFC, 0);
-	em_disable_aspm(adapter);
+	if (adapter->hw.mac.type >= igb_mac_min) {
+		E1000_WRITE_REG(hw, E1000_WUC, 0);
+	} else {
+		E1000_WRITE_REG(hw, E1000_WUFC, 0);
+		em_disable_aspm(adapter);
+	}
+	if (adapter->flags & IGB_MEDIA_RESET) {
+		e1000_setup_init_funcs(hw, TRUE);
+		e1000_get_bus_info(hw);
+		adapter->flags &= ~IGB_MEDIA_RESET;
+	}
 	/* and a re-init */
 	if (e1000_init_hw(hw) < 0) {
 		device_printf(dev, "Hardware Initialization Failed\n");
 		return;
 	}
+	if (adapter->hw.mac.type >= igb_mac_min)
+		igb_init_dmac(adapter, pba);
 
 	E1000_WRITE_REG(hw, E1000_VET, ETHERTYPE_VLAN);
 	e1000_get_phy_info(hw);
@@ -2464,7 +2611,7 @@ em_initialize_rss_mapping(struct adapter *adapter)
 	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_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 |
@@ -2551,8 +2698,7 @@ igb_initialize_rss_mapping(struct adapter *adapter)
 	arc4rand(&rss_key, sizeof(rss_key), 0);
 #endif
 	for (i = 0; i < 10; i++)
-		E1000_WRITE_REG_ARRAY(hw,
-		    E1000_RSSRK(0), i, rss_key[i]);
+		E1000_WRITE_REG_ARRAY(hw, E1000_RSSRK(0), i, rss_key[i]);
 
 	/*
 	 * Configure the RSS fields to hash upon.
@@ -2619,7 +2765,7 @@ em_setup_interface(if_ctx_t ctx)
 	/* Enable only WOL MAGIC by default */
 	if (adapter->wol) {
 		if_setcapenablebit(ifp, IFCAP_WOL_MAGIC,
-			     IFCAP_WOL_MCAST| IFCAP_WOL_UCAST);
+			    IFCAP_WOL_MCAST| IFCAP_WOL_UCAST);
 	} else {
 		if_setcapenablebit(ifp, 0, IFCAP_WOL_MAGIC |
 			     IFCAP_WOL_MCAST| IFCAP_WOL_UCAST);
@@ -2691,7 +2837,7 @@ em_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u
 		txr->tx_base = (struct e1000_tx_desc *)vaddrs[i*ntxqs];
 		txr->tx_paddr = paddrs[i*ntxqs];
 	}
-	
+
 	device_printf(iflib_get_dev(ctx), "allocated for %d tx_queues\n", adapter->tx_num_queues);
 	return (0);
 fail:
@@ -2716,7 +2862,7 @@ em_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, u
 	    adapter->rx_num_queues, M_DEVBUF, M_NOWAIT | M_ZERO))) {
 		device_printf(iflib_get_dev(ctx), "Unable to allocate queue memory\n");
 		error = ENOMEM;
-		goto fail; 
+		goto fail;
 	}
 
 	for (i = 0, que = adapter->rx_queues; i < nrxqsets; i++, que++) {
@@ -2756,7 +2902,7 @@ em_if_queues_free(if_ctx_t ctx)
 			txr->tx_rsq = NULL;
 		}
 		free(adapter->tx_queues, M_DEVBUF);
-		adapter->tx_queues = NULL; 
+		adapter->tx_queues = NULL;
 	}
 
 	if (rx_que != NULL) {
@@ -3031,7 +3177,7 @@ em_initialize_receive_unit(if_ctx_t ctx)
 		u64 bus_addr = rxr->rx_paddr;
 #if 0
 		u32 rdt = adapter->rx_num_queues -1;  /* default */
-#endif		
+#endif
 
 		E1000_WRITE_REG(hw, E1000_RDLEN(i),
 		    scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended));
@@ -3086,7 +3232,7 @@ em_initialize_receive_unit(if_ctx_t ctx)
 			srrctl |= 2048 >> E1000_SRRCTL_BSIZEPKT_SHIFT;
 			rctl |= E1000_RCTL_SZ_2048;
 		}
-	
+
 		/*
 		 * If TX flow control is disabled and there's >1 queue defined,
 		 * enable DROP.
@@ -3124,7 +3270,7 @@ em_initialize_receive_unit(if_ctx_t ctx)
 			rxdctl &= 0xFFF00000;
 			rxdctl |= IGB_RX_PTHRESH;
 			rxdctl |= IGB_RX_HTHRESH << 8;
-			rxdctl |= IGB_RX_WTHRESH << 16; 
+			rxdctl |= IGB_RX_WTHRESH << 16;
 			E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl);
 		}		
 	} else if (adapter->hw.mac.type >= e1000_pch2lan) {
@@ -3253,7 +3399,7 @@ em_if_disable_intr(if_ctx_t ctx)
 /*
  * Bit of a misnomer, what this really means is
  * to enable OS management of the system... aka
- * to disable special hardware management features 
+ * to disable special hardware management features
  */
 static void
 em_init_manageability(struct adapter *adapter)
@@ -3307,6 +3453,9 @@ em_get_hw_control(struct adapter *adapter)
 {
 	u32 ctrl_ext, swsm;
 
+	if (adapter->vf_ifp)
+		return;
+
 	if (adapter->hw.mac.type == e1000_82573) {
 		swsm = E1000_READ_REG(&adapter->hw, E1000_SWSM);
 		E1000_WRITE_REG(&adapter->hw, E1000_SWSM,
@@ -3317,7 +3466,6 @@ em_get_hw_control(struct adapter *adapter)
 	ctrl_ext = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT);
 	E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT,
 	    ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
-	return;
 }
 
 /*
@@ -3637,7 +3785,7 @@ static void
 em_if_led_func(if_ctx_t ctx, int onoff)
 {
 	struct adapter *adapter = iflib_get_softc(ctx);
- 
+
 	if (onoff) {
 		e1000_setup_led(&adapter->hw);
 		e1000_led_on(&adapter->hw);
@@ -3783,7 +3931,7 @@ static uint64_t
 em_if_get_counter(if_ctx_t ctx, ift_counter cnt)
 {
 	struct adapter *adapter = iflib_get_softc(ctx);
-	struct ifnet *ifp = iflib_get_ifp(ctx); 
+	struct ifnet *ifp = iflib_get_ifp(ctx);
 
 	switch (cnt) {
 	case IFCOUNTER_COLLISIONS:
@@ -3820,7 +3968,7 @@ static void
 em_add_hw_stats(struct adapter *adapter)
 {
 	device_t dev = iflib_get_dev(adapter->ctx);
-        struct em_tx_queue *tx_que = adapter->tx_queues;
+	struct em_tx_queue *tx_que = adapter->tx_queues;
 	struct em_rx_queue *rx_que = adapter->rx_queues;
 
 	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
@@ -4065,7 +4213,7 @@ em_add_hw_stats(struct adapter *adapter)
 
 	/* Interrupt Stats */
 
-	int_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "interrupts", 
+	int_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "interrupts",
 				    CTLFLAG_RD, NULL, "Interrupt Statistics");
 	int_list = SYSCTL_CHILDREN(int_node);
 
@@ -4242,7 +4390,7 @@ em_set_flowcntl(SYSCTL_HANDLER_ARGS)
 	case e1000_fc_none:
 		adapter->hw.fc.requested_mode = input;
 		adapter->fc = input;
-                break;
+		break;
 	default:
 		/* Do nothing */
 		return (error);
@@ -4290,7 +4438,7 @@ em_sysctl_debug_info(SYSCTL_HANDLER_ARGS)
 	if (result == 1) {
 		adapter = (struct adapter *) arg1;
 		em_print_debug_info(adapter);
-        }
+	}
 
 	return (error);
 }

Modified: projects/clang500-import/sys/dev/e1000/if_em.h
==============================================================================
--- projects/clang500-import/sys/dev/e1000/if_em.h	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/dev/e1000/if_em.h	Thu Jul 20 20:37:23 2017	(r321307)
@@ -235,6 +235,27 @@
 #define EM_EEPROM_APME			0x400;
 #define EM_82544_APME			0x0004;
 
+
+/* Support AutoMediaDetect for Marvell M88 PHY in i354 */
+#define IGB_MEDIA_RESET			(1 << 0)
+
+/* Define the starting Interrupt rate per Queue */
+#define IGB_INTS_PER_SEC        8000
+#define IGB_DEFAULT_ITR         ((1000000/IGB_INTS_PER_SEC) << 2)
+
+#define IGB_LINK_ITR            2000
+#define I210_LINK_DELAY		1000
+
+#define IGB_MAX_SCATTER		40
+#define IGB_VFTA_SIZE		128
+#define IGB_BR_SIZE		4096	/* ring buf size */
+#define IGB_TSO_SIZE		(65535 + sizeof(struct ether_vlan_header))
+#define IGB_TSO_SEG_SIZE	4096	/* Max dma segment size */
+#define IGB_TXPBSIZE		20408
+#define IGB_HDR_BUF		128
+#define IGB_PKTTYPE_MASK	0x0000FFF0
+#define IGB_DMCTLX_DCFLUSH_DIS	0x80000000  /* Disable DMA Coalesce Flush */
+
 /*
  * Driver state logic for the detection of a hung state
  * in hardware.  Set TX_HUNG whenever a TX packet is used
@@ -455,11 +476,11 @@ struct adapter {
 	struct ifmedia	*media;
 	int		msix;
 	int		if_flags;
-	int		min_frame_size;
 	int		em_insert_vlan_header;
 	u32		ims;
 	bool		in_detach;
 
+	u32		flags;
 	/* Task for FAST handling */
 	struct grouptask link_task;
 
@@ -514,6 +535,7 @@ struct adapter {
 	unsigned long	watchdog_events;
 
 	struct e1000_hw_stats stats;
+	u16		vf_ifp;
 };
 
 /********************************************************************************

Modified: projects/clang500-import/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- projects/clang500-import/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -2210,6 +2210,23 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 				    resp_buf[3], resp_buf[4]);
 			}
 			/*
+			 * XXX: Hyper-V (since win2012r2) responses inquiry with
+			 * unknown version (0) for GEN-2 DVD device.
+			 * Manually set the version number to SPC3 in order to
+			 * ask CAM to continue probing with "PROBE_REPORT_LUNS".
+			 * see probedone() in scsi_xpt.c
+			 */
+			if (SID_TYPE(inq_data) == T_CDROM &&
+			    inq_data->version == 0 &&
+			    (vmstor_proto_version >= VMSTOR_PROTOCOL_VERSION_WIN8)) {
+				inq_data->version = SCSI_REV_SPC3;
+				if (bootverbose) {
+					xpt_print(ccb->ccb_h.path,
+					    "set version from 0 to %d\n",
+					    inq_data->version);
+				}
+			}
+			/*
 			 * XXX: Manually fix the wrong response returned from WS2012
 			 */
 			if (!is_scsi_valid(inq_data) &&
@@ -2218,7 +2235,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 			    vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN7)) {
 				if (data_len >= 4 &&
 				    (resp_buf[2] == 0 || resp_buf[3] == 0)) {
-					resp_buf[2] = 5; // verion=5 means SPC-3
+					resp_buf[2] = SCSI_REV_SPC3;
 					resp_buf[3] = 2; // resp fmt must be 2
 					if (bootverbose)
 						xpt_print(ccb->ccb_h.path,

Modified: projects/clang500-import/sys/net/iflib.c
==============================================================================
--- projects/clang500-import/sys/net/iflib.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/net/iflib.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -1513,8 +1513,8 @@ iflib_txsd_alloc(iflib_txq_t txq)
 			       NULL,			/* lockfuncarg */
 			       &txq->ift_desc_tag))) {
 		device_printf(dev,"Unable to allocate TX DMA tag: %d\n", err);
-		device_printf(dev,"maxsize: %zd nsegments: %d maxsegsize: %zd\n",
-					  sctx->isc_tx_maxsize, nsegments, sctx->isc_tx_maxsegsize);
+		device_printf(dev,"maxsize: %ju nsegments: %d maxsegsize: %ju\n",
+		    (uintmax_t)sctx->isc_tx_maxsize, nsegments, (uintmax_t)sctx->isc_tx_maxsegsize);
 		goto fail;
 	}
 	if ((err = bus_dma_tag_create(bus_get_dma_tag(dev),
@@ -2927,6 +2927,14 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag
 				m_free(tmp);
 				continue;
 			}
+			m = m->m_next;
+			count++;
+		} while (m != NULL);
+		if (count > *nsegs)
+			return (0);
+		m = *m0;
+		count = 0;
+		do {
 			next = (pidx + count) & (ntxd-1);
 			MPASS(ifsd_m[next] == NULL);
 			ifsd_m[next] = m;

Modified: projects/clang500-import/sys/netinet/sctp_indata.c
==============================================================================
--- projects/clang500-import/sys/netinet/sctp_indata.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/netinet/sctp_indata.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -4293,47 +4293,44 @@ again:
 		    ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) {
 			asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT;
 		}
+		if (((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
+		    (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) &&
+		    (asoc->stream_queue_cnt == 1) &&
+		    (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) {
+			struct mbuf *op_err;
+
+			*abort_now = 1;
+			/* XXX */
+			op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, "");
+			stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24;
+			sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
+			return;
+		}
 		if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) &&
 		    (asoc->stream_queue_cnt == 0)) {
-			if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
-				/* Need to abort here */
-				struct mbuf *op_err;
+			struct sctp_nets *netp;
 
-		abort_out_now:
-				*abort_now = 1;
-				/* XXX */
-				op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, "");
-				stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24;
-				sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
-				return;
+			if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
+			    (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
+				SCTP_STAT_DECR_GAUGE32(sctps_currestab);
+			}
+			SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
+			SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
+			sctp_stop_timers_for_shutdown(stcb);
+			if (asoc->alternate) {
+				netp = asoc->alternate;
 			} else {
-				struct sctp_nets *netp;
-
-				if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
-				    (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
-					SCTP_STAT_DECR_GAUGE32(sctps_currestab);
-				}
-				SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
-				SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
-				sctp_stop_timers_for_shutdown(stcb);
-				if (asoc->alternate) {
-					netp = asoc->alternate;
-				} else {
-					netp = asoc->primary_destination;
-				}
-				sctp_send_shutdown(stcb, netp);
-				sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN,
-				    stcb->sctp_ep, stcb, netp);
-				sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
-				    stcb->sctp_ep, stcb, netp);
+				netp = asoc->primary_destination;
 			}
+			sctp_send_shutdown(stcb, netp);
+			sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN,
+			    stcb->sctp_ep, stcb, netp);
+			sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
+			    stcb->sctp_ep, stcb, netp);
 		} else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
 		    (asoc->stream_queue_cnt == 0)) {
 			struct sctp_nets *netp;
 
-			if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
-				goto abort_out_now;
-			}
 			SCTP_STAT_DECR_GAUGE32(sctps_currestab);
 			SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
 			SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
@@ -4989,48 +4986,45 @@ hopeless_peer:
 		    ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc))) {
 			asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT;
 		}
+		if (((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
+		    (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) &&
+		    (asoc->stream_queue_cnt == 1) &&
+		    (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) {
+			struct mbuf *op_err;
+
+			*abort_now = 1;
+			/* XXX */
+			op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, "");
+			stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_24;
+			sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
+			return;
+		}
 		if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) &&
 		    (asoc->stream_queue_cnt == 0)) {
-			if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
-				/* Need to abort here */
-				struct mbuf *op_err;
+			struct sctp_nets *netp;
 
-		abort_out_now:
-				*abort_now = 1;
-				/* XXX */
-				op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, "");
-				stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_31;
-				sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED);
-				return;
+			if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
+			    (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
+				SCTP_STAT_DECR_GAUGE32(sctps_currestab);
+			}
+			SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
+			SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
+			sctp_stop_timers_for_shutdown(stcb);
+			if (asoc->alternate) {
+				netp = asoc->alternate;
 			} else {
-				struct sctp_nets *netp;
-
-				if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
-				    (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
-					SCTP_STAT_DECR_GAUGE32(sctps_currestab);
-				}
-				SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
-				SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
-				sctp_stop_timers_for_shutdown(stcb);
-				if (asoc->alternate) {
-					netp = asoc->alternate;
-				} else {
-					netp = asoc->primary_destination;
-				}
-				sctp_send_shutdown(stcb, netp);
-				sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN,
-				    stcb->sctp_ep, stcb, netp);
-				sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
-				    stcb->sctp_ep, stcb, netp);
+				netp = asoc->primary_destination;
 			}
+			sctp_send_shutdown(stcb, netp);
+			sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN,
+			    stcb->sctp_ep, stcb, netp);
+			sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD,
+			    stcb->sctp_ep, stcb, netp);
 			return;
 		} else if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) &&
 		    (asoc->stream_queue_cnt == 0)) {
 			struct sctp_nets *netp;
 
-			if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) {
-				goto abort_out_now;
-			}
 			SCTP_STAT_DECR_GAUGE32(sctps_currestab);
 			SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
 			SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);

Modified: projects/clang500-import/sys/netinet/sctp_os_bsd.h
==============================================================================
--- projects/clang500-import/sys/netinet/sctp_os_bsd.h	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/netinet/sctp_os_bsd.h	Thu Jul 20 20:37:23 2017	(r321307)
@@ -392,8 +392,8 @@ typedef struct callout sctp_os_timer_t;
 	(sb).sb_mb = NULL;	\
 	(sb).sb_mbcnt = 0;
 
-#define SCTP_SB_LIMIT_RCV(so) so->so_rcv.sb_hiwat
-#define SCTP_SB_LIMIT_SND(so) so->so_snd.sb_hiwat
+#define SCTP_SB_LIMIT_RCV(so) (SOLISTENING(so) ? so->sol_sbrcv_hiwat : so->so_rcv.sb_hiwat)
+#define SCTP_SB_LIMIT_SND(so) (SOLISTENING(so) ? so->sol_sbsnd_hiwat : so->so_snd.sb_hiwat)
 
 /*
  * routes, output, etc.

Modified: projects/clang500-import/sys/netinet/sctp_ss_functions.c
==============================================================================
--- projects/clang500-import/sys/netinet/sctp_ss_functions.c	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/netinet/sctp_ss_functions.c	Thu Jul 20 20:37:23 2017	(r321307)
@@ -268,9 +268,23 @@ sctp_ss_default_set_value(struct sctp_tcb *stcb SCTP_U
 }
 
 static int
-sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc SCTP_UNUSED)
+sctp_ss_default_is_user_msgs_incomplete(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_association *asoc)
 {
-	return (0);
+	struct sctp_stream_out *strq;
+	struct sctp_stream_queue_pending *sp;
+
+	if (asoc->stream_queue_cnt != 1) {
+		return (0);
+	}
+	strq = asoc->ss_data.locked_on_sending;
+	if (strq == NULL) {
+		return (0);
+	}
+	sp = TAILQ_FIRST(&strq->outqueue);
+	if (sp == NULL) {
+		return (0);
+	}
+	return (!sp->msg_is_complete);
 }
 
 /*

Modified: projects/clang500-import/sys/sys/_pctrie.h
==============================================================================
--- projects/clang500-import/sys/sys/_pctrie.h	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/sys/_pctrie.h	Thu Jul 20 20:37:23 2017	(r321307)
@@ -38,14 +38,4 @@ struct pctrie {
 	uintptr_t	pt_root;
 };
 
-#ifdef _KERNEL
-
-static __inline boolean_t
-pctrie_is_empty(struct pctrie *ptree)
-{
-
-	return (ptree->pt_root == 0);
-}
-
-#endif /* _KERNEL */
 #endif /* !__SYS_PCTRIE_H_ */

Modified: projects/clang500-import/sys/sys/efi.h
==============================================================================
--- projects/clang500-import/sys/sys/efi.h	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/sys/efi.h	Thu Jul 20 20:37:23 2017	(r321307)
@@ -122,6 +122,9 @@ struct efi_tblhdr {
 	uint32_t	__res;
 };
 
+#ifdef _KERNEL
+
+#ifdef EFIABI_ATTR
 struct efi_rt {
 	struct efi_tblhdr rt_hdr;
 	efi_status	(*rt_gettime)(struct efi_tm *, struct efi_tmcap *)
@@ -144,6 +147,7 @@ struct efi_rt {
 	efi_status	(*rt_reset)(enum efi_reset, efi_status, u_long,
 	    efi_char *) EFIABI_ATTR;
 };
+#endif
 
 struct efi_systbl {
 	struct efi_tblhdr st_hdr;
@@ -163,7 +167,6 @@ struct efi_systbl {
 	uint64_t	st_cfgtbl;
 };
 
-#ifdef _KERNEL
 extern vm_paddr_t efi_systbl_phys;
 #endif	/* _KERNEL */
 

Modified: projects/clang500-import/sys/sys/pctrie.h
==============================================================================
--- projects/clang500-import/sys/sys/pctrie.h	Thu Jul 20 20:28:31 2017	(r321306)
+++ projects/clang500-import/sys/sys/pctrie.h	Thu Jul 20 20:37:23 2017	(r321307)
@@ -119,5 +119,19 @@ void		pctrie_remove(struct pctrie *ptree, uint64_t key
 size_t		pctrie_node_size(void);
 int		pctrie_zone_init(void *mem, int size, int flags);
 
+static __inline void
+pctrie_init(struct pctrie *ptree)
+{
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list