svn commit: r320485 - in projects/pnfs-planb-server-stable11/sys: amd64/amd64 amd64/include arm/arm cam/scsi compat/freebsd32 compat/linux conf contrib/octeon-sdk dev/e1000 dev/hyperv/pcib dev/hype...

Rick Macklem rmacklem at FreeBSD.org
Thu Jun 29 23:52:52 UTC 2017


Author: rmacklem
Date: Thu Jun 29 23:52:47 2017
New Revision: 320485
URL: https://svnweb.freebsd.org/changeset/base/320485

Log:
  Update the kernel to stable/11.

Modified:
  projects/pnfs-planb-server-stable11/sys/amd64/amd64/pmap.c
  projects/pnfs-planb-server-stable11/sys/amd64/include/pmap.h
  projects/pnfs-planb-server-stable11/sys/arm/arm/gic.c
  projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_enc_ses.c
  projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_sa.c
  projects/pnfs-planb-server-stable11/sys/compat/freebsd32/capabilities.conf
  projects/pnfs-planb-server-stable11/sys/compat/freebsd32/freebsd32_sysent.c
  projects/pnfs-planb-server-stable11/sys/compat/linux/linux_file.c
  projects/pnfs-planb-server-stable11/sys/compat/linux/linux_misc.c
  projects/pnfs-planb-server-stable11/sys/conf/kern.post.mk
  projects/pnfs-planb-server-stable11/sys/conf/newvers.sh
  projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-app-init.h
  projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-helper-board.c
  projects/pnfs-planb-server-stable11/sys/dev/e1000/if_em.c
  projects/pnfs-planb-server-stable11/sys/dev/hyperv/pcib/vmbus_pcib.c
  projects/pnfs-planb-server-stable11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  projects/pnfs-planb-server-stable11/sys/dev/jedec_ts/jedec_ts.c
  projects/pnfs-planb-server-stable11/sys/dev/md/md.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/bcm_osal.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/common_hsi.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_chain.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_cxt.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_cxt.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_dbg_fw_funcs.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_dbg_values.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_dcbx.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_dcbx.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_dev.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_dev_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_fcoe_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_gtt_reg_addr.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_common.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_debug_tools.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_eth.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_fcoe.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_iscsi.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_iwarp.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_rdma.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hsi_roce.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hw.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_hw.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_init_fw_funcs.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_init_fw_funcs.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_init_ops.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_init_ops.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_init_values.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_int.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_int.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_int_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_iov_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_iro.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_iro_values.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_iscsi.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_iscsi_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_l2.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_l2.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_l2_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_ll2.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_ll2_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_mcp.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_mcp.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_mcp_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_ooo.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_proto_if.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_roce.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_roce_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_rt_defs.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_sp_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_sp_commands.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_sp_commands.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_spq.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_sriov.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_vf.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_vf_api.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore_vfpf_if.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/eth_common.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/fcoe_common.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/iscsi_common.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/mcp_private.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/mcp_public.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/mfw_hsi.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/nvm_cfg.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/nvm_map.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/pcics_reg_driver.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/qlnx_def.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/qlnx_os.c
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/qlnx_ver.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/rdma_common.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/reg_addr.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/spad_layout.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/storage_common.h
  projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/tcp_common.h
  projects/pnfs-planb-server-stable11/sys/dev/qlxgbe/ql_hw.c
  projects/pnfs-planb-server-stable11/sys/dev/qlxgbe/ql_hw.h
  projects/pnfs-planb-server-stable11/sys/dev/vmware/vmxnet3/if_vmx.c
  projects/pnfs-planb-server-stable11/sys/dev/xen/netfront/netfront.c
  projects/pnfs-planb-server-stable11/sys/fs/cuse/cuse.c
  projects/pnfs-planb-server-stable11/sys/i386/i386/pmap.c
  projects/pnfs-planb-server-stable11/sys/i386/include/pmap.h
  projects/pnfs-planb-server-stable11/sys/i386/isa/npx.c
  projects/pnfs-planb-server-stable11/sys/kern/capabilities.conf
  projects/pnfs-planb-server-stable11/sys/kern/imgact_elf.c
  projects/pnfs-planb-server-stable11/sys/kern/init_sysent.c
  projects/pnfs-planb-server-stable11/sys/kern/kern_cpuset.c
  projects/pnfs-planb-server-stable11/sys/kern/kern_event.c
  projects/pnfs-planb-server-stable11/sys/kern/kern_mutex.c
  projects/pnfs-planb-server-stable11/sys/kern/kern_rwlock.c
  projects/pnfs-planb-server-stable11/sys/kern/kern_sendfile.c
  projects/pnfs-planb-server-stable11/sys/kern/kern_sx.c
  projects/pnfs-planb-server-stable11/sys/kern/subr_blist.c
  projects/pnfs-planb-server-stable11/sys/kern/subr_prf.c
  projects/pnfs-planb-server-stable11/sys/kern/vfs_aio.c
  projects/pnfs-planb-server-stable11/sys/net/route.c
  projects/pnfs-planb-server-stable11/sys/net/route.h
  projects/pnfs-planb-server-stable11/sys/netinet/sctp_auth.c
  projects/pnfs-planb-server-stable11/sys/netinet/sctp_constants.h
  projects/pnfs-planb-server-stable11/sys/netinet/sctp_input.c
  projects/pnfs-planb-server-stable11/sys/netinet/sctp_output.c
  projects/pnfs-planb-server-stable11/sys/netinet/sctp_pcb.c
  projects/pnfs-planb-server-stable11/sys/ofed/drivers/net/mlx4/en_netdev.c
  projects/pnfs-planb-server-stable11/sys/sys/blist.h
  projects/pnfs-planb-server-stable11/sys/ufs/ffs/ffs_softdep.c
  projects/pnfs-planb-server-stable11/sys/ufs/ffs/softdep.h
  projects/pnfs-planb-server-stable11/sys/vm/swap_pager.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_map.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_page.c
  projects/pnfs-planb-server-stable11/sys/vm/vnode_pager.c
  projects/pnfs-planb-server-stable11/sys/x86/acpica/acpi_wakeup.c
  projects/pnfs-planb-server-stable11/sys/x86/iommu/intel_ctx.c
  projects/pnfs-planb-server-stable11/sys/x86/iommu/intel_dmar.h
  projects/pnfs-planb-server-stable11/sys/x86/iommu/intel_qi.c
  projects/pnfs-planb-server-stable11/sys/x86/x86/intr_machdep.c
Directory Properties:
  projects/pnfs-planb-server-stable11/sys/   (props changed)

Modified: projects/pnfs-planb-server-stable11/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/amd64/amd64/pmap.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/amd64/amd64/pmap.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -613,6 +613,8 @@ static vm_page_t pmap_enter_quick_locked(pmap_t pmap, 
     vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp);
 static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte);
 static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
+static void pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va,
+		    pd_entry_t pde);
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
 static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask);
 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
@@ -1838,6 +1840,27 @@ pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_
 }
 #endif /* !SMP */
 
+static void
+pmap_invalidate_pde_page(pmap_t pmap, vm_offset_t va, pd_entry_t pde)
+{
+
+	/*
+	 * When the PDE has PG_PROMOTED set, the 2MB page mapping was created
+	 * by a promotion that did not invalidate the 512 4KB page mappings
+	 * that might exist in the TLB.  Consequently, at this point, the TLB
+	 * may hold both 4KB and 2MB page mappings for the address range [va,
+	 * va + NBPDR).  Therefore, the entire range must be invalidated here.
+	 * In contrast, when PG_PROMOTED is clear, the TLB will not hold any
+	 * 4KB page mappings for the address range [va, va + NBPDR), and so a
+	 * single INVLPG suffices to invalidate the 2MB page mapping from the
+	 * TLB.
+	 */
+	if ((pde & PG_PROMOTED) != 0)
+		pmap_invalidate_range(pmap, va, va + NBPDR - 1);
+	else
+		pmap_invalidate_page(pmap, va);
+}
+
 #define PMAP_CLFLUSH_THRESHOLD   (2 * 1024 * 1024)
 
 void
@@ -3472,7 +3495,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, v
 			SLIST_INIT(&free);
 			sva = trunc_2mpage(va);
 			pmap_remove_pde(pmap, pde, sva, &free, lockp);
-			pmap_invalidate_range(pmap, sva, sva + NBPDR - 1);
+			if ((oldpde & PG_G) == 0)
+				pmap_invalidate_pde_page(pmap, sva, oldpde);
 			pmap_free_zero_pages(&free);
 			CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx"
 			    " in pmap %p", va, pmap);
@@ -3612,25 +3636,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse
 	oldpde = pte_load_clear(pdq);
 	if (oldpde & PG_W)
 		pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE;
-
-	/*
-	 * When workaround_erratum383 is false, a promotion to a 2M
-	 * page mapping does not invalidate the 512 4K page mappings
-	 * from the TLB.  Consequently, at this point, the TLB may
-	 * hold both 4K and 2M page mappings.  Therefore, the entire
-	 * range of addresses must be invalidated here.  In contrast,
-	 * when workaround_erratum383 is true, a promotion does
-	 * invalidate the 512 4K page mappings, and so a single INVLPG
-	 * suffices to invalidate the 2M page mapping.
-	 */
-	if ((oldpde & PG_G) != 0) {
-		if (workaround_erratum383)
-			pmap_invalidate_page(kernel_pmap, sva);
-		else
-			pmap_invalidate_range(kernel_pmap, sva,
-			    sva + NBPDR - 1);
-	}
-
+	if ((oldpde & PG_G) != 0)
+		pmap_invalidate_pde_page(kernel_pmap, sva, oldpde);
 	pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
 	if (oldpde & PG_MANAGED) {
 		CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME);
@@ -4010,16 +4017,16 @@ retry:
 	if ((prot & VM_PROT_EXECUTE) == 0)
 		newpde |= pg_nx;
 	if (newpde != oldpde) {
-		if (!atomic_cmpset_long(pde, oldpde, newpde))
+		/*
+		 * As an optimization to future operations on this PDE, clear
+		 * PG_PROMOTED.  The impending invalidation will remove any
+		 * lingering 4KB page mappings from the TLB.
+		 */
+		if (!atomic_cmpset_long(pde, oldpde, newpde & ~PG_PROMOTED))
 			goto retry;
-		if (oldpde & PG_G) {
-			/* See pmap_remove_pde() for explanation. */
-			if (workaround_erratum383)
-				pmap_invalidate_page(kernel_pmap, sva);
-			else
-				pmap_invalidate_range(kernel_pmap, sva,
-				    sva + NBPDR - 1);
-		} else
+		if ((oldpde & PG_G) != 0)
+			pmap_invalidate_pde_page(kernel_pmap, sva, oldpde);
+		else
 			anychanged = TRUE;
 	}
 	return (anychanged);
@@ -4272,7 +4279,7 @@ setpte:
 	if (workaround_erratum383)
 		pmap_update_pde(pmap, va, pde, PG_PS | newpde);
 	else
-		pde_store(pde, PG_PS | newpde);
+		pde_store(pde, PG_PROMOTED | PG_PS | newpde);
 
 	atomic_add_long(&pmap_pde_promotions, 1);
 	CTR2(KTR_PMAP, "pmap_promote_pde: success for va %#lx"
@@ -4585,7 +4592,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t 
 	pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE);
 
 	/*
-	 * Map the superpage.
+	 * Map the superpage.  (This is not a promoted mapping; there will not
+	 * be any lingering 4KB page mappings in the TLB.)
 	 */
 	pde_store(pde, newpde);
 

Modified: projects/pnfs-planb-server-stable11/sys/amd64/include/pmap.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/amd64/include/pmap.h	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/amd64/include/pmap.h	Thu Jun 29 23:52:47 2017	(r320485)
@@ -109,6 +109,7 @@
 #define	PG_MANAGED	X86_PG_AVAIL2
 #define	EPT_PG_EMUL_V	X86_PG_AVAIL(52)
 #define	EPT_PG_EMUL_RW	X86_PG_AVAIL(53)
+#define	PG_PROMOTED	X86_PG_AVAIL(54)	/* PDE only */
 #define	PG_FRAME	(0x000ffffffffff000ul)
 #define	PG_PS_FRAME	(0x000fffffffe00000ul)
 

Modified: projects/pnfs-planb-server-stable11/sys/arm/arm/gic.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/arm/arm/gic.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/arm/arm/gic.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -1640,7 +1640,7 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int
 	mtx_lock(&sc->sc_mutex);
 
 	found = false;
-	for (irq = sc->sc_spi_start; irq < sc->sc_spi_end && !found; irq++) {
+	for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) {
 		/* Start on an aligned interrupt */
 		if ((irq & (maxcount - 1)) != 0)
 			continue;
@@ -1649,7 +1649,7 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int
 		found = true;
 
 		/* Check this range is valid */
-		for (end_irq = irq; end_irq != irq + count - 1; end_irq++) {
+		for (end_irq = irq; end_irq != irq + count; end_irq++) {
 			/* No free interrupts */
 			if (end_irq == sc->sc_spi_end) {
 				found = false;
@@ -1666,6 +1666,8 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int
 				break;
 			}
 		}
+		if (found)
+			break;
 	}
 
 	/* Not enough interrupts were found */

Modified: projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_enc_ses.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_enc_ses.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -2684,10 +2684,11 @@ ses_get_elm_devnames(enc_softc_t *enc, encioc_elm_devn
 	cam_periph_unlock(enc->periph);
 	sbuf_new(&sb, NULL, len, SBUF_FIXEDLEN);
 	ses_paths_iter(enc, &enc->enc_cache.elm_map[elmdn->elm_idx],
-		       ses_elmdevname_callback, &sb);
+	    ses_elmdevname_callback, &sb);
 	sbuf_finish(&sb);
 	elmdn->elm_names_len = sbuf_len(&sb);
 	copyout(sbuf_data(&sb), elmdn->elm_devnames, elmdn->elm_names_len + 1);
+	sbuf_delete(&sb);
 	cam_periph_lock(enc->periph);
 	return (elmdn->elm_names_len > 0 ? 0 : ENODEV);
 }

Modified: projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_sa.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_sa.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_sa.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -4465,7 +4465,18 @@ saextget(struct cdev *dev, struct cam_periph *periph, 
 		if (cgd.serial_num_len > sizeof(tmpstr)) {
 			ts2_len = cgd.serial_num_len + 1;
 			ts2_malloc = 1;
-			tmpstr2 = malloc(ts2_len, M_SCSISA, M_WAITOK | M_ZERO);
+			tmpstr2 = malloc(ts2_len, M_SCSISA, M_NOWAIT | M_ZERO);
+			/*
+			 * The 80 characters allocated on the stack above
+			 * will handle the vast majority of serial numbers.
+			 * If we run into one that is larger than that, and
+			 * we can't malloc the length without blocking,
+			 * bail out with an out of memory error.
+			 */
+			if (tmpstr2 == NULL) {
+				error = ENOMEM;
+				goto extget_bailout;
+			}
 		} else {
 			ts2_len = sizeof(tmpstr);
 			ts2_malloc = 0;

Modified: projects/pnfs-planb-server-stable11/sys/compat/freebsd32/capabilities.conf
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/compat/freebsd32/capabilities.conf	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/compat/freebsd32/capabilities.conf	Thu Jun 29 23:52:47 2017	(r320485)
@@ -76,9 +76,9 @@ close
 closefrom
 connectat
 #cpuset
-#freebsd32_cpuset_getaffinity
+freebsd32_cpuset_getaffinity
 #freebsd32_cpuset_getid
-#freebsd32_cpuset_setaffinity
+freebsd32_cpuset_setaffinity
 #freebsd32_cpuset_setid
 dup
 dup2

Modified: projects/pnfs-planb-server-stable11/sys/compat/freebsd32/freebsd32_sysent.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/compat/freebsd32/freebsd32_sysent.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/compat/freebsd32/freebsd32_sysent.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -552,8 +552,8 @@ struct sysent freebsd32_sysent[] = {
 	{ AS(freebsd32_cpuset_setid_args), (sy_call_t *)freebsd32_cpuset_setid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 485 = freebsd32_cpuset_setid */
 #endif
 	{ AS(freebsd32_cpuset_getid_args), (sy_call_t *)freebsd32_cpuset_getid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 486 = freebsd32_cpuset_getid */
-	{ AS(freebsd32_cpuset_getaffinity_args), (sy_call_t *)freebsd32_cpuset_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 487 = freebsd32_cpuset_getaffinity */
-	{ AS(freebsd32_cpuset_setaffinity_args), (sy_call_t *)freebsd32_cpuset_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 488 = freebsd32_cpuset_setaffinity */
+	{ AS(freebsd32_cpuset_getaffinity_args), (sy_call_t *)freebsd32_cpuset_getaffinity, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 487 = freebsd32_cpuset_getaffinity */
+	{ AS(freebsd32_cpuset_setaffinity_args), (sy_call_t *)freebsd32_cpuset_setaffinity, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 488 = freebsd32_cpuset_setaffinity */
 	{ AS(faccessat_args), (sy_call_t *)sys_faccessat, AUE_FACCESSAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 489 = faccessat */
 	{ AS(fchmodat_args), (sy_call_t *)sys_fchmodat, AUE_FCHMODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 490 = fchmodat */
 	{ AS(fchownat_args), (sy_call_t *)sys_fchownat, AUE_FCHOWNAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },	/* 491 = fchownat */

Modified: projects/pnfs-planb-server-stable11/sys/compat/linux/linux_file.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/compat/linux/linux_file.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/compat/linux/linux_file.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -394,9 +394,9 @@ linux_getdents(struct thread *td, struct linux_getdent
 	td->td_retval[0] = retval;
 
 out:
-	free(lbuf, M_LINUX);
+	free(lbuf, M_TEMP);
 out1:
-	free(buf, M_LINUX);
+	free(buf, M_TEMP);
 	return (error);
 }
 
@@ -522,9 +522,9 @@ linux_readdir(struct thread *td, struct linux_readdir_
 	if (error == 0)
 		td->td_retval[0] = linuxreclen;
 
-	free(lbuf, M_LINUX);
+	free(lbuf, M_TEMP);
 out:
-	free(buf, M_LINUX);
+	free(buf, M_TEMP);
 	return (error);
 }
 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */

Modified: projects/pnfs-planb-server-stable11/sys/compat/linux/linux_misc.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/compat/linux/linux_misc.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/compat/linux/linux_misc.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -2516,6 +2516,7 @@ linux_getrandom(struct thread *td, struct linux_getran
 {
 	struct uio uio;
 	struct iovec iov;
+	int error;
 
 	if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM))
 		return (EINVAL);
@@ -2532,7 +2533,10 @@ linux_getrandom(struct thread *td, struct linux_getran
 	uio.uio_rw = UIO_READ;
 	uio.uio_td = td;
 
-	return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK));
+	error = read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK);
+	if (error == 0)
+		td->td_retval[0] = args->count - uio.uio_resid;
+	return (error);
 }
 
 int

Modified: projects/pnfs-planb-server-stable11/sys/conf/kern.post.mk
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/conf/kern.post.mk	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/conf/kern.post.mk	Thu Jun 29 23:52:47 2017	(r320485)
@@ -200,10 +200,10 @@ _meta_filemon=	1
 # lookups.  For install, only do this if no other targets are specified.
 # Also skip generating or including .depend.* files if in meta+filemon mode
 # since it will track dependencies itself.  OBJS_DEPEND_GUESS is still used.
-.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
+.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(*obj) || \
+    ${.TARGETS:M*clean*} == ${.TARGETS} || \
     ${.TARGETS:M*install*} == ${.TARGETS} || \
-    make(kernel-obj) || make(kernel-clean*) || \
-    make(kernel-install*) || defined(_meta_filemon)
+    defined(_meta_filemon)
 _SKIP_READ_DEPEND=	1
 .MAKE.DEPENDFILE=	/dev/null
 .endif

Modified: projects/pnfs-planb-server-stable11/sys/conf/newvers.sh
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/conf/newvers.sh	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/conf/newvers.sh	Thu Jun 29 23:52:47 2017	(r320485)
@@ -44,7 +44,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.1"
-BRANCH="BETA1"
+BRANCH="BETA3"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
 	BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-app-init.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-app-init.h	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-app-init.h	Thu Jun 29 23:52:47 2017	(r320485)
@@ -311,6 +311,7 @@ enum cvmx_board_types_enum {
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
     CVMX_BOARD_TYPE_CUST_UBIQUITI_E100=20002,
+    CVMX_BOARD_TYPE_CUST_UBIQUITI_USG= 20004,
 #endif
 #if defined(OCTEON_VENDOR_RADISYS)
     CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE=20002,
@@ -457,6 +458,7 @@ static inline const char *cvmx_board_type_to_string(en
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
 	ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_E100)
+	ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_USG)
 #endif
 #if defined(OCTEON_VENDOR_RADISYS)
 	ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE)

Modified: projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-helper-board.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-helper-board.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/contrib/octeon-sdk/cvmx-helper-board.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -598,6 +598,7 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
 	case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100:
+	case CVMX_BOARD_TYPE_CUST_UBIQUITI_USG:
 	    if (ipd_port > 2)
 		return -1;
 	    return (7 - ipd_port);
@@ -1499,7 +1500,8 @@ int __cvmx_helper_board_hardware_enable(int interface)
         }
     }
 #if defined(OCTEON_VENDOR_UBIQUITI)
-    else if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_E100)
+    else if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_E100 ||
+        cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_USG)
     {
 	/* Configure ASX cloks for all ports on interface 0.  */
 	if (interface == 0)
@@ -1590,6 +1592,7 @@ cvmx_helper_board_usb_clock_types_t __cvmx_helper_boar
 #endif
 #if defined(OCTEON_VENDOR_UBIQUITI)
         case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100:
+        case CVMX_BOARD_TYPE_CUST_UBIQUITI_USG:
 #endif
 #if defined(OCTEON_BOARD_CAPK_0100ND)
 	case CVMX_BOARD_TYPE_CN3010_EVB_HS5:

Modified: projects/pnfs-planb-server-stable11/sys/dev/e1000/if_em.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/e1000/if_em.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/e1000/if_em.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -5115,7 +5115,7 @@ em_enable_intr(struct adapter *adapter)
 
 	if (hw->mac.type == e1000_82574) {
 		E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK);
-		ims_mask |= adapter->ims;
+		ims_mask |= EM_MSIX_MASK;
 	} 
 	E1000_WRITE_REG(hw, E1000_IMS, ims_mask);
 }

Modified: projects/pnfs-planb-server-stable11/sys/dev/hyperv/pcib/vmbus_pcib.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/hyperv/pcib/vmbus_pcib.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/hyperv/pcib/vmbus_pcib.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -574,6 +574,8 @@ new_pcichild_device(struct hv_pcibus *hbus, struct pci
 	hpdev->desc = *desc;
 
 	mtx_lock(&hbus->device_list_lock);
+	if (TAILQ_EMPTY(&hbus->children))
+		hbus->pci_domain = desc->ser & 0xFFFF;
 	TAILQ_INSERT_TAIL(&hbus->children, hpdev, link);
 	mtx_unlock(&hbus->device_list_lock);
 	return (hpdev);

Modified: projects/pnfs-planb-server-stable11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -2095,6 +2095,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 	struct vmscsi_req *vm_srb = &reqp->vstor_packet.u.vm_srb;
 	bus_dma_segment_t *ori_sglist = NULL;
 	int ori_sg_count = 0;
+	const struct scsi_generic *cmd;
 
 	/* destroy bounce buffer if it is used */
 	if (reqp->bounce_sgl_count) {
@@ -2145,16 +2146,14 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 		callout_drain(&reqp->callout);
 	}
 #endif
+	cmd = (const struct scsi_generic *)
+	    ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
+	     csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
 
 	ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
 	ccb->ccb_h.status &= ~CAM_STATUS_MASK;
 	int srb_status = SRB_STATUS(vm_srb->srb_status);
 	if (vm_srb->scsi_status == SCSI_STATUS_OK) {
-		const struct scsi_generic *cmd;
-
-		cmd = (const struct scsi_generic *)
-		    ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
-		     csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
 		if (srb_status != SRB_STATUS_SUCCESS) {
 			/*
 			 * If there are errors, for example, invalid LUN,
@@ -2252,11 +2251,23 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 			}
 		}
 	} else {
-		mtx_lock(&sc->hs_lock);
-		xpt_print(ccb->ccb_h.path,
-			"storvsc scsi_status = %d\n",
-			vm_srb->scsi_status);
-		mtx_unlock(&sc->hs_lock);
+		/**
+		 * On Some Windows hosts TEST_UNIT_READY command can return
+		 * SRB_STATUS_ERROR and sense data, for example, asc=0x3a,1
+		 * "(Medium not present - tray closed)". This error can be
+		 * ignored since it will be sent to host periodically.
+		 */
+		boolean_t unit_not_ready = \
+		    vm_srb->scsi_status == SCSI_STATUS_CHECK_COND &&
+		    cmd->opcode == TEST_UNIT_READY &&
+		    srb_status == SRB_STATUS_ERROR;
+		if (!unit_not_ready && bootverbose) {
+			mtx_lock(&sc->hs_lock);
+			xpt_print(ccb->ccb_h.path,
+				"storvsc scsi_status = %d, srb_status = %d\n",
+				vm_srb->scsi_status, srb_status);
+			mtx_unlock(&sc->hs_lock);
+		}
 		ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR;
 	}
 

Modified: projects/pnfs-planb-server-stable11/sys/dev/jedec_ts/jedec_ts.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/jedec_ts/jedec_ts.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/jedec_ts/jedec_ts.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -114,7 +114,7 @@ ts_attach(device_t dev)
 		device_printf(dev, "failed to read Manufacturer ID\n");
 		return (ENXIO);
 	}
-	err = ts_readw_be(dev, 6, &devid);
+	err = ts_readw_be(dev, 7, &devid);
 	if (err != 0) {
 		device_printf(dev, "failed to read Device ID\n");
 		return (ENXIO);

Modified: projects/pnfs-planb-server-stable11/sys/dev/md/md.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/md/md.c	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/md/md.c	Thu Jun 29 23:52:47 2017	(r320485)
@@ -969,6 +969,16 @@ unmapped_step:
 	return (error);
 }
 
+static void
+md_swap_page_free(vm_page_t m)
+{
+
+	vm_page_xunbusy(m);
+	vm_page_lock(m);
+	vm_page_free(m);
+	vm_page_unlock(m);
+}
+
 static int
 mdstart_swap(struct md_s *sc, struct bio *bp)
 {
@@ -1041,15 +1051,17 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
 				cpu_flush_dcache(p, len);
 			}
 		} else if (bp->bio_cmd == BIO_WRITE) {
-			if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL)
+			if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL)
+				rv = VM_PAGER_OK;
+			else
 				rv = vm_pager_get_pages(sc->object, &m, 1,
 				    NULL, NULL);
-			else
-				rv = VM_PAGER_OK;
 			if (rv == VM_PAGER_ERROR) {
 				vm_page_xunbusy(m);
 				break;
-			}
+			} else if (rv == VM_PAGER_FAIL)
+				pmap_zero_page(m);
+
 			if ((bp->bio_flags & BIO_UNMAPPED) != 0) {
 				pmap_copy_pages(bp->bio_ma, ma_offs, &m,
 				    offs, len);
@@ -1059,34 +1071,40 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
 			} else {
 				physcopyin(p, VM_PAGE_TO_PHYS(m) + offs, len);
 			}
+
 			m->valid = VM_PAGE_BITS_ALL;
+			vm_page_dirty(m);
+			vm_pager_page_unswapped(m);
 		} else if (bp->bio_cmd == BIO_DELETE) {
-			if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL)
+			if (len == PAGE_SIZE || m->valid == VM_PAGE_BITS_ALL)
+				rv = VM_PAGER_OK;
+			else
 				rv = vm_pager_get_pages(sc->object, &m, 1,
 				    NULL, NULL);
-			else
-				rv = VM_PAGER_OK;
 			if (rv == VM_PAGER_ERROR) {
 				vm_page_xunbusy(m);
 				break;
-			}
-			if (len != PAGE_SIZE) {
-				pmap_zero_page_area(m, offs, len);
-				vm_page_clear_dirty(m, offs, len);
-				m->valid = VM_PAGE_BITS_ALL;
-			} else
+			} else if (rv == VM_PAGER_FAIL) {
+				md_swap_page_free(m);
+				m = NULL;
+			} else {
+				/* Page is valid. */
+				if (len != PAGE_SIZE) {
+					pmap_zero_page_area(m, offs, len);
+					vm_page_dirty(m);
+				}
 				vm_pager_page_unswapped(m);
+				if (len == PAGE_SIZE) {
+					md_swap_page_free(m);
+					m = NULL;
+				}
+			}
 		}
-		vm_page_xunbusy(m);
-		vm_page_lock(m);
-		if (bp->bio_cmd == BIO_DELETE && len == PAGE_SIZE)
-			vm_page_free(m);
-		else
+		if (m != NULL) {
+			vm_page_xunbusy(m);
+			vm_page_lock(m);
 			vm_page_activate(m);
-		vm_page_unlock(m);
-		if (bp->bio_cmd == BIO_WRITE) {
-			vm_page_dirty(m);
-			vm_pager_page_unswapped(m);
+			vm_page_unlock(m);
 		}
 
 		/* Actions on further pages start at offset 0 */

Modified: projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/bcm_osal.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/bcm_osal.h	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/bcm_osal.h	Thu Jun 29 23:52:47 2017	(r320485)
@@ -34,12 +34,17 @@
 #include "ecore_status.h"
 #include <sys/bitstring.h>
 
+#if __FreeBSD_version >= 1200000
+#include <compat/linuxkpi/common/include/linux/bitops.h>
+#else
 #if __FreeBSD_version >= 1100090
 #include <compat/linuxkpi/common/include/linux/bitops.h>
 #else
 #include <ofed/include/linux/bitops.h>
 #endif
+#endif
 
+#define OSAL_NUM_CPUS()	mp_ncpus
 /*
  * prototypes of freebsd specific functions required by ecore
  */
@@ -60,6 +65,7 @@ extern int qlnx_pci_find_capability(void *ecore_dev, i
 
 extern uint32_t qlnx_direct_reg_rd32(void *p_hwfn, uint32_t *reg_addr);
 extern void qlnx_direct_reg_wr32(void *p_hwfn, void *reg_addr, uint32_t value);
+extern void qlnx_direct_reg_wr64(void *p_hwfn, void *reg_addr, uint64_t value);
 
 extern uint32_t qlnx_reg_rd32(void *p_hwfn, uint32_t reg_addr);
 extern void qlnx_reg_wr32(void *p_hwfn, uint32_t reg_addr, uint32_t value);
@@ -129,6 +135,8 @@ rounddown_pow_of_two(unsigned long x)
 
 #endif /* #ifndef QLNX_RDMA */
 
+#define OSAL_UNUSED
+
 #define OSAL_CPU_TO_BE64(val) htobe64(val)
 #define OSAL_BE64_TO_CPU(val) be64toh(val)
 
@@ -199,6 +207,8 @@ typedef struct osal_list_t
 #define REG_WR(hwfn, addr, val)  qlnx_reg_wr32(hwfn, addr, val)
 #define REG_WR16(hwfn, addr, val) qlnx_reg_wr16(hwfn, addr, val)
 #define DIRECT_REG_WR(p_hwfn, addr, value) qlnx_direct_reg_wr32(p_hwfn, addr, value)
+#define DIRECT_REG_WR64(p_hwfn, addr, value) \
+		qlnx_direct_reg_wr64(p_hwfn, addr, value)
 #define DIRECT_REG_RD(p_hwfn, addr) qlnx_direct_reg_rd32(p_hwfn, addr)
 #define REG_RD(hwfn, addr) qlnx_reg_rd32(hwfn, addr)
 #define DOORBELL(hwfn, addr, value) \

Modified: projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/common_hsi.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/common_hsi.h	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/common_hsi.h	Thu Jun 29 23:52:47 2017	(r320485)
@@ -88,7 +88,7 @@
 #define CORE_SPQE_PAGE_SIZE_BYTES			4096
 
 /*
- * Usually LL2 queues are opened in pairs TX-RX.
+ * Usually LL2 queues are opened in pairs – TX-RX.
  * There is a hard restriction on number of RX queues (limited by Tstorm RAM) and TX counters (Pstorm RAM).
  * Number of TX queues is almost unlimited.
  * The constants are different so as to allow asymmetric LL2 connections
@@ -99,13 +99,13 @@
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// Include firmware version number only- do not add constants here to avoid redundunt compilations
+// Include firmware verison number only- do not add constants here to avoid redundunt compilations
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 #define FW_MAJOR_VERSION		8
-#define FW_MINOR_VERSION		18
-#define FW_REVISION_VERSION		14
+#define FW_MINOR_VERSION		30
+#define FW_REVISION_VERSION		0
 #define FW_ENGINEERING_VERSION	0
 
 /***********************/
@@ -113,60 +113,60 @@
 /***********************/
 
 /* PCI functions */
-#define MAX_NUM_PORTS_K2		(4)
 #define MAX_NUM_PORTS_BB		(2)
-#define MAX_NUM_PORTS			(MAX_NUM_PORTS_K2)
+#define MAX_NUM_PORTS_K2		(4)
+#define MAX_NUM_PORTS_E5		(MAX_NUM_PORTS_K2)
+#define MAX_NUM_PORTS			(MAX_NUM_PORTS_E5)
 
-#define MAX_NUM_PFS_K2			(16)
 #define MAX_NUM_PFS_BB			(8)
-#define MAX_NUM_PFS				(MAX_NUM_PFS_K2)
+#define MAX_NUM_PFS_K2			(16)
+#define MAX_NUM_PFS_E5			(MAX_NUM_PFS_K2)
+#define MAX_NUM_PFS				(MAX_NUM_PFS_E5)
 #define MAX_NUM_OF_PFS_IN_CHIP	(16) /* On both engines */
 
 #define MAX_NUM_VFS_BB			(120)
 #define MAX_NUM_VFS_K2			(192)
-#define E4_MAX_NUM_VFS			(MAX_NUM_VFS_K2)
-#define E5_MAX_NUM_VFS			(240)
-#define COMMON_MAX_NUM_VFS		(E5_MAX_NUM_VFS)
+#define MAX_NUM_VFS_E4			(MAX_NUM_VFS_K2)
+#define MAX_NUM_VFS_E5			(240)
+#define COMMON_MAX_NUM_VFS		(MAX_NUM_VFS_E5)
 
 #define MAX_NUM_FUNCTIONS_BB	(MAX_NUM_PFS_BB + MAX_NUM_VFS_BB)
 #define MAX_NUM_FUNCTIONS_K2	(MAX_NUM_PFS_K2 + MAX_NUM_VFS_K2)
-#define MAX_NUM_FUNCTIONS		(MAX_NUM_PFS + E4_MAX_NUM_VFS)
+#define MAX_NUM_FUNCTIONS		(MAX_NUM_PFS + MAX_NUM_VFS_E4)
 
 /* in both BB and K2, the VF number starts from 16. so for arrays containing all */
 /* possible PFs and VFs - we need a constant for this size */
 #define MAX_FUNCTION_NUMBER_BB	(MAX_NUM_PFS + MAX_NUM_VFS_BB)
 #define MAX_FUNCTION_NUMBER_K2	(MAX_NUM_PFS + MAX_NUM_VFS_K2)
-#define MAX_FUNCTION_NUMBER		(MAX_NUM_PFS + E4_MAX_NUM_VFS)
+#define MAX_FUNCTION_NUMBER_E4	(MAX_NUM_PFS + MAX_NUM_VFS_E4)
+#define MAX_FUNCTION_NUMBER_E5	(MAX_NUM_PFS + MAX_NUM_VFS_E5)
+#define COMMON_MAX_FUNCTION_NUMBER	(MAX_NUM_PFS + MAX_NUM_VFS_E5)
 
 #define MAX_NUM_VPORTS_K2		(208)
 #define MAX_NUM_VPORTS_BB		(160)
-#define MAX_NUM_VPORTS			(MAX_NUM_VPORTS_K2)
+#define MAX_NUM_VPORTS_E4		(MAX_NUM_VPORTS_K2)
+#define MAX_NUM_VPORTS_E5		(256)
+#define COMMON_MAX_NUM_VPORTS	(MAX_NUM_VPORTS_E5)
 
 #define MAX_NUM_L2_QUEUES_K2	(320)
 #define MAX_NUM_L2_QUEUES_BB	(256)
 #define MAX_NUM_L2_QUEUES		(MAX_NUM_L2_QUEUES_K2)
 
 /* Traffic classes in network-facing blocks (PBF, BTB, NIG, BRB, PRS and QM) */
-// 4-Port K2.
 #define NUM_PHYS_TCS_4PORT_K2	(4)
+#define NUM_PHYS_TCS_4PORT_E5	(6)
 #define NUM_OF_PHYS_TCS			(8)
-
+#define PURE_LB_TC				NUM_OF_PHYS_TCS
 #define NUM_TCS_4PORT_K2		(NUM_PHYS_TCS_4PORT_K2 + 1)
+#define NUM_TCS_4PORT_E5		(NUM_PHYS_TCS_4PORT_E5 + 1)
 #define NUM_OF_TCS				(NUM_OF_PHYS_TCS + 1)
 
-#define LB_TC					(NUM_OF_PHYS_TCS)
-
 /* Num of possible traffic priority values */
 #define NUM_OF_PRIO				(8)
 
-#define MAX_NUM_VOQS_K2			(NUM_TCS_4PORT_K2 * MAX_NUM_PORTS_K2)
-#define MAX_NUM_VOQS_BB         (NUM_OF_TCS * MAX_NUM_PORTS_BB)
-#define MAX_NUM_VOQS			(MAX_NUM_VOQS_K2)
-#define MAX_PHYS_VOQS			(NUM_OF_PHYS_TCS * MAX_NUM_PORTS_BB)
-
 /* CIDs */
-#define E4_NUM_OF_CONNECTION_TYPES (8)
-#define E5_NUM_OF_CONNECTION_TYPES (16)
+#define NUM_OF_CONNECTION_TYPES_E4 (8)
+#define NUM_OF_CONNECTION_TYPES_E5 (16)
 #define NUM_OF_TASK_TYPES		(8)
 #define NUM_OF_LCIDS			(320)
 #define NUM_OF_LTIDS			(320)
@@ -375,11 +375,13 @@
 /* number of TX queues in the QM */
 #define MAX_QM_TX_QUEUES_K2			512
 #define MAX_QM_TX_QUEUES_BB			448
+#define MAX_QM_TX_QUEUES_E5			MAX_QM_TX_QUEUES_K2
 #define MAX_QM_TX_QUEUES			MAX_QM_TX_QUEUES_K2
 
 /* number of Other queues in the QM */
 #define MAX_QM_OTHER_QUEUES_BB		64
 #define MAX_QM_OTHER_QUEUES_K2		128
+#define MAX_QM_OTHER_QUEUES_E5		MAX_QM_OTHER_QUEUES_K2
 #define MAX_QM_OTHER_QUEUES			MAX_QM_OTHER_QUEUES_K2
 
 /* number of queues in a PF queue group */
@@ -413,7 +415,9 @@
 #define CAU_FSM_ETH_TX  1
 
 /* Number of Protocol Indices per Status Block */
-#define PIS_PER_SB    12  
+#define PIS_PER_SB_E4    12
+#define PIS_PER_SB_E5    8
+#define MAX_PIS_PER_SB	 OSAL_MAX_T(u8, PIS_PER_SB_E4, PIS_PER_SB_E5)
 
 
 #define CAU_HC_STOPPED_STATE		3			/* fsm is stopped or not valid for this sb */
@@ -427,7 +431,8 @@
 
 #define MAX_SB_PER_PATH_K2					(368)
 #define MAX_SB_PER_PATH_BB					(288)
-#define MAX_TOT_SB_PER_PATH					MAX_SB_PER_PATH_K2
+#define MAX_SB_PER_PATH_E5					(512)
+#define MAX_TOT_SB_PER_PATH					MAX_SB_PER_PATH_E5
 
 #define MAX_SB_PER_PF_MIMD					129
 #define MAX_SB_PER_PF_SIMD					64
@@ -588,7 +593,7 @@
 // ILT Records
 #define PXP_NUM_ILT_RECORDS_BB 7600
 #define PXP_NUM_ILT_RECORDS_K2 11000
-#define MAX_NUM_ILT_RECORDS MAX(PXP_NUM_ILT_RECORDS_BB,PXP_NUM_ILT_RECORDS_K2)
+#define MAX_NUM_ILT_RECORDS OSAL_MAX_T(u16, PXP_NUM_ILT_RECORDS_BB,PXP_NUM_ILT_RECORDS_K2)
 
 
 // Host Interface
@@ -633,7 +638,8 @@
 /******************/
 
 /* Number of PBF command queue lines. Each line is 32B. */
-#define PBF_MAX_CMD_LINES 3328 
+#define PBF_MAX_CMD_LINES_E4 3328 
+#define PBF_MAX_CMD_LINES_E5 5280  
 
 /* Number of BTB blocks. Each block is 256B. */
 #define BTB_MAX_BLOCKS 1440
@@ -737,8 +743,8 @@ union rdma_eqe_data
  */
 struct malicious_vf_eqe_data
 {
-	u8 vfId /* Malicious VF ID */;
-	u8 errId /* Malicious VF error */;
+	u8 vf_id /* Malicious VF ID */;
+	u8 err_id /* Malicious VF error */;
 	__le16 reserved[3];
 };
 
@@ -747,7 +753,7 @@ struct malicious_vf_eqe_data
  */
 struct initial_cleanup_eqe_data
 {
-	u8 vfId /* VF ID */;
+	u8 vf_id /* VF ID */;
 	u8 reserved[7];
 };
 
@@ -1059,7 +1065,7 @@ struct db_rdma_dpm_data
 {
 	__le16 icid /* internal CID */;
 	__le16 prod_val /* aggregated value to update */;
-	struct db_rdma_dpm_params params /* parameters passed to RDMA firmware */;
+	struct db_rdma_dpm_params params /* parametes passed to RDMA firmware */;
 };
 
 
@@ -1113,25 +1119,25 @@ enum igu_seg_access
 
 
 /*
- * Enumeration for L3 type field of parsing_and_err_flags_union. L3Type: 0 - unknown (not ip) ,1 - Ipv4, 2 - Ipv6 (this field can be filled according to the last-ethertype)
+ * Enumeration for L3 type field of parsing_and_err_flags. L3Type: 0 - unknown (not ip) ,1 - Ipv4, 2 - Ipv6 (this field can be filled according to the last-ethertype)
  */
 enum l3_type
 {
-	e_l3Type_unknown,
-	e_l3Type_ipv4,
-	e_l3Type_ipv6,
+	e_l3_type_unknown,
+	e_l3_type_ipv4,
+	e_l3_type_ipv6,
 	MAX_L3_TYPE
 };
 
 
 /*
- * Enumeration for l4Protocol field of parsing_and_err_flags_union. L4-protocol 0 - none, 1 - TCP, 2- UDP. if the packet is IPv4 fragment, and its not the first fragment, the protocol-type should be set to none.
+ * Enumeration for l4Protocol field of parsing_and_err_flags. L4-protocol 0 - none, 1 - TCP, 2- UDP. if the packet is IPv4 fragment, and its not the first fragment, the protocol-type should be set to none.
  */
 enum l4_protocol
 {
-	e_l4Protocol_none,
-	e_l4Protocol_tcp,
-	e_l4Protocol_udp,
+	e_l4_protocol_none,
+	e_l4_protocol_tcp,
+	e_l4_protocol_udp,
 	MAX_L4_PROTOCOL
 };
 
@@ -1146,11 +1152,11 @@ struct parsing_and_err_flags
 #define PARSING_AND_ERR_FLAGS_L3TYPE_SHIFT                     0
 #define PARSING_AND_ERR_FLAGS_L4PROTOCOL_MASK                  0x3 /* L4-protocol 0 - none, 1 - TCP, 2- UDP. if the packet is IPv4 fragment, and its not the first fragment, the protocol-type should be set to none. (use enum l4_protocol) */
 #define PARSING_AND_ERR_FLAGS_L4PROTOCOL_SHIFT                 2
-#define PARSING_AND_ERR_FLAGS_IPV4FRAG_MASK                    0x1 /* Set if the packet is IPv4 fragment. */
+#define PARSING_AND_ERR_FLAGS_IPV4FRAG_MASK                    0x1 /* Set if the packet is IPv4/IPv6 fragment. */
 #define PARSING_AND_ERR_FLAGS_IPV4FRAG_SHIFT                   4
-#define PARSING_AND_ERR_FLAGS_TAG8021QEXIST_MASK               0x1 /* Set if VLAN tag exists. Invalid if tunnel type are IP GRE or IP GENEVE. */
+#define PARSING_AND_ERR_FLAGS_TAG8021QEXIST_MASK               0x1 /* corresponds to the same 8021q tag that is selected for 8021q-tag fiel. This flag should be set if the tag appears in the packet, regardless of its value. */
 #define PARSING_AND_ERR_FLAGS_TAG8021QEXIST_SHIFT              5
-#define PARSING_AND_ERR_FLAGS_L4CHKSMWASCALCULATED_MASK        0x1 /* Set if L4 checksum was calculated. */
+#define PARSING_AND_ERR_FLAGS_L4CHKSMWASCALCULATED_MASK        0x1 /* Set if L4 checksum was calculated. taken from the EOP descriptor. */
 #define PARSING_AND_ERR_FLAGS_L4CHKSMWASCALCULATED_SHIFT       6
 #define PARSING_AND_ERR_FLAGS_TIMESYNCPKT_MASK                 0x1 /* Set for PTP packet. */
 #define PARSING_AND_ERR_FLAGS_TIMESYNCPKT_SHIFT                7
@@ -1162,11 +1168,11 @@ struct parsing_and_err_flags
 #define PARSING_AND_ERR_FLAGS_L4CHKSMERROR_SHIFT               10
 #define PARSING_AND_ERR_FLAGS_TUNNELEXIST_MASK                 0x1 /* Set if GRE/VXLAN/GENEVE tunnel detected. */
 #define PARSING_AND_ERR_FLAGS_TUNNELEXIST_SHIFT                11
-#define PARSING_AND_ERR_FLAGS_TUNNEL8021QTAGEXIST_MASK         0x1 /* Set if VLAN tag exists in tunnel header. */
+#define PARSING_AND_ERR_FLAGS_TUNNEL8021QTAGEXIST_MASK         0x1 /* This flag should be set if the tag appears in the packet tunnel header, regardless of its value.. */
 #define PARSING_AND_ERR_FLAGS_TUNNEL8021QTAGEXIST_SHIFT        12
 #define PARSING_AND_ERR_FLAGS_TUNNELIPHDRERROR_MASK            0x1 /* Set if either tunnel-ipv4-version-mismatch or tunnel-ipv4-hdr-len-error or tunnel-ipv4-cksm is set or tunneling ipv6 ver mismatch */
 #define PARSING_AND_ERR_FLAGS_TUNNELIPHDRERROR_SHIFT           13
-#define PARSING_AND_ERR_FLAGS_TUNNELL4CHKSMWASCALCULATED_MASK  0x1 /* Set if GRE or VXLAN/GENEVE UDP checksum was calculated. */
+#define PARSING_AND_ERR_FLAGS_TUNNELL4CHKSMWASCALCULATED_MASK  0x1 /* taken from the EOP descriptor. */
 #define PARSING_AND_ERR_FLAGS_TUNNELL4CHKSMWASCALCULATED_SHIFT 14
 #define PARSING_AND_ERR_FLAGS_TUNNELL4CHKSMERROR_MASK          0x1 /* Set if tunnel L4 checksum validation failed. Valid only if tunnel L4 checksum was calculated. */
 #define PARSING_AND_ERR_FLAGS_TUNNELL4CHKSMERROR_SHIFT         15
@@ -1419,21 +1425,42 @@ enum rss_hash_type
 /*
  * status block structure
  */
-struct status_block
+struct status_block_e4
 {
-	__le16 pi_array[PIS_PER_SB];
+	__le16 pi_array[PIS_PER_SB_E4];
 	__le32 sb_num;
-#define STATUS_BLOCK_SB_NUM_MASK      0x1FF
-#define STATUS_BLOCK_SB_NUM_SHIFT     0
-#define STATUS_BLOCK_ZERO_PAD_MASK    0x7F
-#define STATUS_BLOCK_ZERO_PAD_SHIFT   9
-#define STATUS_BLOCK_ZERO_PAD2_MASK   0xFFFF
-#define STATUS_BLOCK_ZERO_PAD2_SHIFT  16
+#define STATUS_BLOCK_E4_SB_NUM_MASK      0x1FF
+#define STATUS_BLOCK_E4_SB_NUM_SHIFT     0
+#define STATUS_BLOCK_E4_ZERO_PAD_MASK    0x7F
+#define STATUS_BLOCK_E4_ZERO_PAD_SHIFT   9
+#define STATUS_BLOCK_E4_ZERO_PAD2_MASK   0xFFFF
+#define STATUS_BLOCK_E4_ZERO_PAD2_SHIFT  16
 	__le32 prod_index;
-#define STATUS_BLOCK_PROD_INDEX_MASK  0xFFFFFF
-#define STATUS_BLOCK_PROD_INDEX_SHIFT 0
-#define STATUS_BLOCK_ZERO_PAD3_MASK   0xFF
-#define STATUS_BLOCK_ZERO_PAD3_SHIFT  24
+#define STATUS_BLOCK_E4_PROD_INDEX_MASK  0xFFFFFF
+#define STATUS_BLOCK_E4_PROD_INDEX_SHIFT 0
+#define STATUS_BLOCK_E4_ZERO_PAD3_MASK   0xFF
+#define STATUS_BLOCK_E4_ZERO_PAD3_SHIFT  24
+};
+
+
+/*
+ * status block structure
+ */
+struct status_block_e5
+{
+	__le16 pi_array[PIS_PER_SB_E5];
+	__le32 sb_num;
+#define STATUS_BLOCK_E5_SB_NUM_MASK      0x1FF
+#define STATUS_BLOCK_E5_SB_NUM_SHIFT     0
+#define STATUS_BLOCK_E5_ZERO_PAD_MASK    0x7F
+#define STATUS_BLOCK_E5_ZERO_PAD_SHIFT   9
+#define STATUS_BLOCK_E5_ZERO_PAD2_MASK   0xFFFF
+#define STATUS_BLOCK_E5_ZERO_PAD2_SHIFT  16
+	__le32 prod_index;
+#define STATUS_BLOCK_E5_PROD_INDEX_MASK  0xFFFFFF
+#define STATUS_BLOCK_E5_PROD_INDEX_SHIFT 0
+#define STATUS_BLOCK_E5_ZERO_PAD3_MASK   0xFF
+#define STATUS_BLOCK_E5_ZERO_PAD3_SHIFT  24
 };
 
 

Modified: projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore.h	Thu Jun 29 23:35:55 2017	(r320484)
+++ projects/pnfs-planb-server-stable11/sys/dev/qlnx/qlnxe/ecore.h	Thu Jun 29 23:52:47 2017	(r320485)
@@ -39,8 +39,8 @@
 #include "mcp_public.h"
 
 #define ECORE_MAJOR_VERSION		8
-#define ECORE_MINOR_VERSION		18
-#define ECORE_REVISION_VERSION		13
+#define ECORE_MINOR_VERSION		30
+#define ECORE_REVISION_VERSION		0
 #define ECORE_ENGINEERING_VERSION	0
 
 #define ECORE_VERSION							\
@@ -110,13 +110,13 @@ do {									\
 #define GET_FIELD(value, name)						\
 	(((value) >> (name##_SHIFT)) & name##_MASK)
 
-#define ECORE_MFW_GET_FIELD(name, field)				\
-	(((name) & (field ## _MASK)) >> (field ## _SHIFT))
+#define GET_MFW_FIELD(name, field)					\
+	(((name) & (field ## _MASK)) >> (field ## _OFFSET))
 
-#define ECORE_MFW_SET_FIELD(name, field, value)				\
+#define SET_MFW_FIELD(name, field, value)				\
 do {									\
-	(name) &= ~((field ## _MASK) << (field ## _SHIFT));		\
-	(name) |= (((value) << (field ## _SHIFT)) & (field ## _MASK));	\
+	(name) &= ~((field ## _MASK) << (field ## _OFFSET));		\
+	(name) |= (((value) << (field ## _OFFSET)) & (field ## _MASK));	\
 } while (0)
 
 static OSAL_INLINE u32 DB_ADDR(u32 cid, u32 DEMS)
@@ -401,6 +401,11 @@ enum ecore_wol_support {
 	ECORE_WOL_SUPPORT_PME,
 };
 
+enum ecore_db_rec_exec {
+	DB_REC_DRY_RUN,
+	DB_REC_REAL_DEAL,
+};
+
 struct ecore_hw_info {
 	/* PCI personality */
 	enum ecore_pci_personality personality;
@@ -450,10 +455,7 @@ struct ecore_hw_info {
 #ifndef ETH_ALEN
 #define ETH_ALEN 6 /* @@@ TBD - define somewhere else for Windows */
 #endif
-
 	unsigned char hw_mac_addr[ETH_ALEN];
-	u64 node_wwn; /* For FCoE only */
-	u64 port_wwn; /* For FCoE only */
 
 	u16 num_iscsi_conns;
 	u16 num_fcoe_conns;
@@ -537,6 +539,12 @@ struct ecore_qm_info {
 	u8			num_pf_rls;
 };
 
+struct ecore_db_recovery_info {
+	osal_list_t list;
+	osal_spinlock_t lock;
+	u32 db_recovery_counter;
+};
+
 struct storm_stats {
 	u32 address;
 	u32 len;
@@ -605,6 +613,11 @@ struct ecore_hwfn {
 	struct ecore_ptt		*p_main_ptt;
 	struct ecore_ptt		*p_dpc_ptt;
 
+	/* PTP will be used only by the leading funtion.
+	 * Usage of all PTP-apis should be synchronized as result.
+	 */
+	struct ecore_ptt		*p_ptp_ptt;
+
 	struct ecore_sb_sp_info		*p_sp_sb;
 	struct ecore_sb_attn_info	*p_sb_attn;
 
@@ -661,6 +674,9 @@ struct ecore_hwfn {
 
 	/* L2-related */
 	struct ecore_l2_info		*p_l2_info;
+
+	/* Mechanism for recovering from doorbell drop */
+	struct ecore_db_recovery_info	db_recovery_info;
 };
 
 enum ecore_mf_mode {
@@ -694,7 +710,7 @@ struct ecore_dev {
 #define ECORE_IS_AH(dev)	((dev)->type == ECORE_DEV_TYPE_AH)
 #define ECORE_IS_K2(dev)	ECORE_IS_AH(dev)
 
-#define ECORE_IS_E5(dev)	false
+#define ECORE_IS_E5(dev)	((dev)->type == ECORE_DEV_TYPE_E5)
 
 #define ECORE_E5_MISSING_CODE	OSAL_BUILD_BUG_ON(false)
 
@@ -703,6 +719,7 @@ struct ecore_dev {
 #define ECORE_DEV_ID_MASK	0xff00
 #define ECORE_DEV_ID_MASK_BB	0x1600
 #define ECORE_DEV_ID_MASK_AH	0x8000
+#define ECORE_DEV_ID_MASK_E5	0x8100
 

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


More information about the svn-src-projects mailing list