svn commit: r321033 - in projects/pnfs-planb-server-stable11/sys: . amd64/ia32 amd64/linux amd64/linux32 arm64/include cam cam/scsi cddl/compat/opensolaris/sys compat/linprocfs compat/linux conf co...

Rick Macklem rmacklem at FreeBSD.org
Sat Jul 15 19:53:02 UTC 2017


Author: rmacklem
Date: Sat Jul 15 19:52:59 2017
New Revision: 321033
URL: https://svnweb.freebsd.org/changeset/base/321033

Log:
  Update the kernel to stable/11/sys.

Added:
  projects/pnfs-planb-server-stable11/sys/contrib/ena-com/
     - copied from r321032, stable/11/sys/contrib/ena-com/
  projects/pnfs-planb-server-stable11/sys/dev/ena/
     - copied from r321032, stable/11/sys/dev/ena/
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/if_bypass.c
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/if_bypass.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/if_fdir.c
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/if_fdir.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/if_sriov.c
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/if_sriov.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_bypass.h
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/ixgbe_bypass.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_fdir.h
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/ixgbe_fdir.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_features.h
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/ixgbe_features.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_netmap.c
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/ixgbe_netmap.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_netmap.h
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/ixgbe_netmap.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_rss.h
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/ixgbe_rss.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_sriov.h
     - copied unchanged from r321032, stable/11/sys/dev/ixgbe/ixgbe_sriov.h
  projects/pnfs-planb-server-stable11/sys/modules/ena/
     - copied from r321032, stable/11/sys/modules/ena/
Modified:
  projects/pnfs-planb-server-stable11/sys/Makefile
  projects/pnfs-planb-server-stable11/sys/amd64/ia32/ia32_reg.c
  projects/pnfs-planb-server-stable11/sys/amd64/linux/linux.h
  projects/pnfs-planb-server-stable11/sys/amd64/linux/linux_sysvec.c
  projects/pnfs-planb-server-stable11/sys/amd64/linux32/linux32_sysvec.c
  projects/pnfs-planb-server-stable11/sys/arm64/include/atomic.h
  projects/pnfs-planb-server-stable11/sys/cam/cam_periph.c
  projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_da.c
  projects/pnfs-planb-server-stable11/sys/cddl/compat/opensolaris/sys/kmem.h
  projects/pnfs-planb-server-stable11/sys/compat/linprocfs/linprocfs.c
  projects/pnfs-planb-server-stable11/sys/compat/linux/linux_stats.c
  projects/pnfs-planb-server-stable11/sys/conf/files
  projects/pnfs-planb-server-stable11/sys/conf/newvers.sh
  projects/pnfs-planb-server-stable11/sys/dev/acpica/Osd/OsdSchedule.c
  projects/pnfs-planb-server-stable11/sys/dev/digi/digi.c
  projects/pnfs-planb-server-stable11/sys/dev/hyperv/input/hv_kbdc.c
  projects/pnfs-planb-server-stable11/sys/dev/ie/if_ie.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/if_ix.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/if_ixv.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ix_txrx.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_82598.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_82598.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_82599.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_82599.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_api.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_api.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_common.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_common.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_dcb.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_dcb.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_dcb_82598.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_dcb_82598.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_dcb_82599.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_dcb_82599.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_mbx.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_mbx.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_osdep.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_osdep.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_phy.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_phy.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_type.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_vf.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_vf.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_x540.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_x540.h
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_x550.c
  projects/pnfs-planb-server-stable11/sys/dev/ixgbe/ixgbe_x550.h
  projects/pnfs-planb-server-stable11/sys/dev/mcd/mcd.c
  projects/pnfs-planb-server-stable11/sys/dev/scd/scd.c
  projects/pnfs-planb-server-stable11/sys/dev/sdhci/sdhci.c
  projects/pnfs-planb-server-stable11/sys/dev/si/si.c
  projects/pnfs-planb-server-stable11/sys/dev/wl/if_wl.c
  projects/pnfs-planb-server-stable11/sys/fs/ext2fs/ext2_inode_cnv.c
  projects/pnfs-planb-server-stable11/sys/fs/ext2fs/ext2fs.h
  projects/pnfs-planb-server-stable11/sys/fs/fuse/fuse_io.c
  projects/pnfs-planb-server-stable11/sys/fs/nfs/nfs_commonkrpc.c
  projects/pnfs-planb-server-stable11/sys/fs/nfs/nfs_commonsubs.c
  projects/pnfs-planb-server-stable11/sys/fs/nfs/nfs_var.h
  projects/pnfs-planb-server-stable11/sys/fs/nfs/nfsport.h
  projects/pnfs-planb-server-stable11/sys/fs/nfs/nfsproto.h
  projects/pnfs-planb-server-stable11/sys/fs/nfsclient/nfs_clcomsubs.c
  projects/pnfs-planb-server-stable11/sys/fs/nfsclient/nfs_clnode.c
  projects/pnfs-planb-server-stable11/sys/fs/nfsclient/nfs_clport.c
  projects/pnfs-planb-server-stable11/sys/fs/nfsclient/nfs_clrpcops.c
  projects/pnfs-planb-server-stable11/sys/fs/nfsclient/nfs_clstate.c
  projects/pnfs-planb-server-stable11/sys/fs/nfsclient/nfs_clvnops.c
  projects/pnfs-planb-server-stable11/sys/fs/nfsclient/nfsnode.h
  projects/pnfs-planb-server-stable11/sys/fs/tmpfs/tmpfs_subr.c
  projects/pnfs-planb-server-stable11/sys/geom/part/g_part.c
  projects/pnfs-planb-server-stable11/sys/i386/i386/trap.c
  projects/pnfs-planb-server-stable11/sys/i386/isa/spic.c
  projects/pnfs-planb-server-stable11/sys/i386/linux/linux_sysvec.c
  projects/pnfs-planb-server-stable11/sys/kern/kern_exec.c
  projects/pnfs-planb-server-stable11/sys/kern/subr_blist.c
  projects/pnfs-planb-server-stable11/sys/kern/subr_param.c
  projects/pnfs-planb-server-stable11/sys/kern/uipc_shm.c
  projects/pnfs-planb-server-stable11/sys/kern/vfs_bio.c
  projects/pnfs-planb-server-stable11/sys/modules/Makefile
  projects/pnfs-planb-server-stable11/sys/modules/ix/Makefile
  projects/pnfs-planb-server-stable11/sys/modules/ixv/Makefile
  projects/pnfs-planb-server-stable11/sys/netpfil/ipfw/nat64/nat64_translate.c
  projects/pnfs-planb-server-stable11/sys/netpfil/ipfw/nptv6/nptv6.c
  projects/pnfs-planb-server-stable11/sys/netpfil/ipfw/pmod/tcpmod.c
  projects/pnfs-planb-server-stable11/sys/ofed/drivers/net/mlx4/en_rx.c
  projects/pnfs-planb-server-stable11/sys/powerpc/booke/pmap.c
  projects/pnfs-planb-server-stable11/sys/sys/bitset.h
  projects/pnfs-planb-server-stable11/sys/sys/blist.h
  projects/pnfs-planb-server-stable11/sys/sys/buf.h
  projects/pnfs-planb-server-stable11/sys/sys/imgact.h
  projects/pnfs-planb-server-stable11/sys/sys/mman.h
  projects/pnfs-planb-server-stable11/sys/sys/param.h
  projects/pnfs-planb-server-stable11/sys/sys/refcount.h
  projects/pnfs-planb-server-stable11/sys/sys/systm.h
  projects/pnfs-planb-server-stable11/sys/sys/vmmeter.h
  projects/pnfs-planb-server-stable11/sys/vm/swap_pager.c
  projects/pnfs-planb-server-stable11/sys/vm/vm.h
  projects/pnfs-planb-server-stable11/sys/vm/vm_fault.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_init.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_kern.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_kern.h
  projects/pnfs-planb-server-stable11/sys/vm/vm_map.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_map.h
  projects/pnfs-planb-server-stable11/sys/vm/vm_meter.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_mmap.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_object.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_page.c
  projects/pnfs-planb-server-stable11/sys/vm/vm_pageout.c
  projects/pnfs-planb-server-stable11/sys/vm/vnode_pager.c
  projects/pnfs-planb-server-stable11/sys/x86/x86/identcpu.c
Directory Properties:
  projects/pnfs-planb-server-stable11/sys/   (props changed)

Modified: projects/pnfs-planb-server-stable11/sys/Makefile
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/Makefile	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/Makefile	Sat Jul 15 19:52:59 2017	(r321033)
@@ -59,19 +59,7 @@ TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files
 	rm -f ${.CURDIR}/TAGS
 	cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscope.files
 
-# You need the textproc/glimpse ports for this.
-glimpse:
-.if !exists(${.CURDIR}/.glimpse_exclude)
-	echo .svn > ${.CURDIR}/.glimpse_exclude
-	echo /compile/ >> ${.CURDIR}/.glimpse_exclude
-.endif
-	cd ${.CURDIR}; glimpseindex -H . -B -f -o .
-
-glimpse-clean:
-	cd ${.CURDIR}; rm -f .glimpse_*
-
-.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS) || \
-    make(glimpse) || make(glimpse-clean))
+.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS))
 .include <src.opts.mk>
 
 # The boot loader

Modified: projects/pnfs-planb-server-stable11/sys/amd64/ia32/ia32_reg.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/amd64/ia32/ia32_reg.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/amd64/ia32/ia32_reg.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -156,7 +156,7 @@ fill_fpregs32(struct thread *td, struct fpreg32 *regs)
 	/* FPU control/status */
 	penv_87->en_cw = penv_xmm->en_cw;
 	penv_87->en_sw = penv_xmm->en_sw;
-	penv_87->en_tw = penv_xmm->en_tw;
+
 	/*
 	 * XXX for en_fip/fcs/foo/fos, check if the fxsave format
 	 * uses the old-style layout for 32 bit user apps.  If so,
@@ -170,9 +170,13 @@ fill_fpregs32(struct thread *td, struct fpreg32 *regs)
 	/* Entry into the kernel always sets TF_HASSEGS */
 	penv_87->en_fos = td->td_frame->tf_ds;
 
-	/* FPU registers */
-	for (i = 0; i < 8; ++i)
+	/* FPU registers and tags */
+	penv_87->en_tw = 0xffff;
+	for (i = 0; i < 8; ++i) {
 		sv_87->sv_ac[i] = sv_fpu->sv_fp[i].fp_acc;
+		if ((penv_xmm->en_tw & (1 << i)) != 0)
+			penv_87->en_tw &= ~(3 << i * 2);
+	}
 
 	return (0);
 }
@@ -189,15 +193,19 @@ set_fpregs32(struct thread *td, struct fpreg32 *regs)
 	/* FPU control/status */
 	penv_xmm->en_cw = penv_87->en_cw;
 	penv_xmm->en_sw = penv_87->en_sw;
-	penv_xmm->en_tw = penv_87->en_tw;
 	penv_xmm->en_rip = penv_87->en_fip;
 	/* penv_87->en_fcs and en_fos ignored, see above */
 	penv_xmm->en_opcode = penv_87->en_opcode;
 	penv_xmm->en_rdp = penv_87->en_foo;
 
-	/* FPU registers */
-	for (i = 0; i < 8; ++i)
+	/* FPU registers and tags */
+	penv_xmm->en_tw = 0;
+	for (i = 0; i < 8; ++i) {
 		sv_fpu->sv_fp[i].fp_acc = sv_87->sv_ac[i];
+		if ((penv_87->en_tw & (3 << i * 2)) != (3 << i * 2))
+			penv_xmm->en_tw |= 1 << i;
+	}
+
 	for (i = 8; i < 16; ++i)
 		bzero(&sv_fpu->sv_fp[i].fp_acc, sizeof(sv_fpu->sv_fp[i].fp_acc));
 	fpuuserinited(td);

Modified: projects/pnfs-planb-server-stable11/sys/amd64/linux/linux.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/amd64/linux/linux.h	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/amd64/linux/linux.h	Sat Jul 15 19:52:59 2017	(r321033)
@@ -101,9 +101,6 @@ typedef struct {
 /*
  * Miscellaneous
  */
-#define	LINUX_NAME_MAX		255
-#define	LINUX_CTL_MAXNAME	10
-
 #define LINUX_AT_COUNT		19	/* Count of used aux entry types. */
 
 struct l___sysctl_args
@@ -117,11 +114,6 @@ struct l___sysctl_args
 	l_ulong		__spare[4];
 };
 
-/* Scheduling policies */
-#define	LINUX_SCHED_OTHER	0
-#define	LINUX_SCHED_FIFO	1
-#define	LINUX_SCHED_RR		2
-
 /* Resource limits */
 #define	LINUX_RLIMIT_CPU	0
 #define	LINUX_RLIMIT_FSIZE	1
@@ -455,20 +447,6 @@ struct l_pollfd {
 	l_short		events;
 	l_short		revents;
 };
-
-
-#define	LINUX_CLONE_VM			0x00000100
-#define	LINUX_CLONE_FS			0x00000200
-#define	LINUX_CLONE_FILES		0x00000400
-#define	LINUX_CLONE_SIGHAND		0x00000800
-#define	LINUX_CLONE_PID			0x00001000	/* No longer exist in Linux */
-#define	LINUX_CLONE_VFORK		0x00004000
-#define	LINUX_CLONE_PARENT		0x00008000
-#define	LINUX_CLONE_THREAD		0x00010000
-#define	LINUX_CLONE_SETTLS		0x00080000
-#define	LINUX_CLONE_PARENT_SETTID	0x00100000
-#define	LINUX_CLONE_CHILD_CLEARTID	0x00200000
-#define	LINUX_CLONE_CHILD_SETTID	0x01000000
 
 #define LINUX_ARCH_SET_GS		0x1001
 #define LINUX_ARCH_SET_FS		0x1002

Modified: projects/pnfs-planb-server-stable11/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/amd64/linux/linux_sysvec.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/amd64/linux/linux_sysvec.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -921,9 +921,22 @@ static Elf64_Brandinfo linux_glibc2brandshort = {
 	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
 };
 
+static Elf64_Brandinfo linux_muslbrand = {
+	.brand		= ELFOSABI_LINUX,
+	.machine	= EM_X86_64,
+	.compat_3_brand	= "Linux",
+	.emul_path	= "/compat/linux",
+	.interp_path	= "/lib/ld-musl-x86_64.so.1",
+	.sysvec		= &elf_linux_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &linux64_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
 Elf64_Brandinfo *linux_brandlist[] = {
 	&linux_glibc2brand,
 	&linux_glibc2brandshort,
+	&linux_muslbrand,
 	NULL
 };
 

Modified: projects/pnfs-planb-server-stable11/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/amd64/linux32/linux32_sysvec.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/amd64/linux32/linux32_sysvec.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -1139,9 +1139,22 @@ static Elf32_Brandinfo linux_glibc2brand = {
 	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
 };
 
+static Elf32_Brandinfo linux_muslbrand = {
+	.brand		= ELFOSABI_LINUX,
+	.machine	= EM_386,
+	.compat_3_brand	= "Linux",
+	.emul_path	= "/compat/linux",
+	.interp_path	= "/lib/ld-musl-i386.so.1",
+	.sysvec		= &elf_linux_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &linux32_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
 Elf32_Brandinfo *linux_brandlist[] = {
 	&linux_brand,
 	&linux_glibc2brand,
+	&linux_muslbrand,
 	NULL
 };
 

Modified: projects/pnfs-planb-server-stable11/sys/arm64/include/atomic.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/arm64/include/atomic.h	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/arm64/include/atomic.h	Sat Jul 15 19:52:59 2017	(r321033)
@@ -385,7 +385,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val
 
 #define	atomic_add_rel_int		atomic_add_rel_32
 #define	atomic_fcmpset_rel_int		atomic_fcmpset_rel_32
-#define	atomic_clear_rel_int		atomic_add_rel_32
+#define	atomic_clear_rel_int		atomic_clear_rel_32
 #define	atomic_cmpset_rel_int		atomic_cmpset_rel_32
 #define	atomic_set_rel_int		atomic_set_rel_32
 #define	atomic_subtract_rel_int		atomic_subtract_rel_32
@@ -413,7 +413,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val
 
 #define	atomic_add_acq_long		atomic_add_acq_64
 #define	atomic_fcmpset_acq_long		atomic_fcmpset_acq_64
-#define	atomic_clear_acq_long		atomic_add_acq_64
+#define	atomic_clear_acq_long		atomic_clear_acq_64
 #define	atomic_cmpset_acq_long		atomic_cmpset_acq_64
 #define	atomic_load_acq_long		atomic_load_acq_64
 #define	atomic_set_acq_long		atomic_set_acq_64
@@ -421,7 +421,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val
 
 #define	atomic_add_acq_ptr		atomic_add_acq_64
 #define	atomic_fcmpset_acq_ptr		atomic_fcmpset_acq_64
-#define	atomic_clear_acq_ptr		atomic_add_acq_64
+#define	atomic_clear_acq_ptr		atomic_clear_acq_64
 #define	atomic_cmpset_acq_ptr		atomic_cmpset_acq_64
 #define	atomic_load_acq_ptr		atomic_load_acq_64
 #define	atomic_set_acq_ptr		atomic_set_acq_64

Modified: projects/pnfs-planb-server-stable11/sys/cam/cam_periph.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/cam/cam_periph.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/cam/cam_periph.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -654,6 +654,7 @@ static void
 camperiphfree(struct cam_periph *periph)
 {
 	struct periph_driver **p_drv;
+	struct periph_driver *drv;
 
 	cam_periph_assert(periph, MA_OWNED);
 	KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating",
@@ -666,6 +667,15 @@ camperiphfree(struct cam_periph *periph)
 		printf("camperiphfree: attempt to free non-existant periph\n");
 		return;
 	}
+	/*
+	 * Cache a pointer to the periph_driver structure.  If a
+	 * periph_driver is added or removed from the array (see
+	 * periphdriver_register()) while we drop the toplogy lock
+	 * below, p_drv may change.  This doesn't protect against this
+	 * particular periph_driver going away.  That will require full
+	 * reference counting in the periph_driver infrastructure.
+	 */
+	drv = *p_drv;
 
 	/*
 	 * We need to set this flag before dropping the topology lock, to
@@ -701,8 +711,8 @@ camperiphfree(struct cam_periph *periph)
 	 */
 	xpt_lock_buses();
 
-	TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
-	(*p_drv)->generation++;
+	TAILQ_REMOVE(&drv->units, periph, unit_links);
+	drv->generation++;
 
 	xpt_remove_periph(periph);
 

Modified: projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_da.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_da.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/cam/scsi/scsi_da.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -5748,6 +5748,7 @@ scsi_zbc_in(struct ccb_scsiio *csio, uint32_t retries,
 	scsi_cmd = (struct scsi_zbc_in *)&csio->cdb_io.cdb_bytes;
 	scsi_cmd->opcode = ZBC_IN;
 	scsi_cmd->service_action = service_action;
+	scsi_ulto4b(dxfer_len, scsi_cmd->length);
 	scsi_u64to8b(zone_start_lba, scsi_cmd->zone_start_lba);
 	scsi_cmd->zone_options = zone_options;
 

Modified: projects/pnfs-planb-server-stable11/sys/cddl/compat/opensolaris/sys/kmem.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/cddl/compat/opensolaris/sys/kmem.h	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/cddl/compat/opensolaris/sys/kmem.h	Sat Jul 15 19:52:59 2017	(r321033)
@@ -77,7 +77,7 @@ void kmem_reap(void);
 int kmem_debugging(void);
 void *calloc(size_t n, size_t s);
 
-#define	freemem				(vm_cnt.v_free_count + vm_cnt.v_cache_count)
+#define	freemem				vm_cnt.v_free_count
 #define	minfree				vm_cnt.v_free_min
 #define	heap_arena			kmem_arena
 #define	kmem_alloc(size, kmflags)	zfs_kmem_alloc((size), (kmflags))

Modified: projects/pnfs-planb-server-stable11/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/compat/linprocfs/linprocfs.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/compat/linprocfs/linprocfs.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -176,7 +176,7 @@ linprocfs_domeminfo(PFS_FILL_ARGS)
 	 * like unstaticizing it just for linprocfs's sake.
 	 */
 	buffers = 0;
-	cached = vm_cnt.v_cache_count * PAGE_SIZE;
+	cached = vm_cnt.v_inactive_count * PAGE_SIZE;
 
 	sbuf_printf(sb,
 	    "MemTotal: %9lu kB\n"

Modified: projects/pnfs-planb-server-stable11/sys/compat/linux/linux_stats.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/compat/linux/linux_stats.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/compat/linux/linux_stats.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -318,6 +318,7 @@ struct l_statfs {
 #define	LINUX_NTFS_SUPER_MAGIC	0x5346544EL
 #define	LINUX_PROC_SUPER_MAGIC	0x9fa0L
 #define	LINUX_UFS_SUPER_MAGIC	0x00011954L	/* XXX - UFS_MAGIC in Linux */
+#define	LINUX_ZFS_SUPER_MAGIC	0x2FC12FC1
 #define LINUX_DEVFS_SUPER_MAGIC	0x1373L
 #define	LINUX_SHMFS_MAGIC	0x01021994
 
@@ -327,6 +328,7 @@ bsd_to_linux_ftype(const char *fstypename)
 	int i;
 	static struct {const char *bsd_name; long linux_type;} b2l_tbl[] = {
 		{"ufs",     LINUX_UFS_SUPER_MAGIC},
+		{"zfs",     LINUX_ZFS_SUPER_MAGIC},
 		{"cd9660",  LINUX_ISOFS_SUPER_MAGIC},
 		{"nfs",     LINUX_NFS_SUPER_MAGIC},
 		{"ext2fs",  LINUX_EXT2_SUPER_MAGIC},

Modified: projects/pnfs-planb-server-stable11/sys/conf/files
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/conf/files	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/conf/files	Sat Jul 15 19:52:59 2017	(r321033)
@@ -1547,6 +1547,12 @@ dev/e1000/e1000_mbx.c		optional em | igb \
 dev/e1000/e1000_osdep.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/et/if_et.c			optional et
+dev/ena/ena.c			optional ena \
+	compile-with "${NORMAL_C} -I$S/contrib"
+dev/ena/ena_sysctl.c 		optional ena \
+	compile-with "${NORMAL_C} -I$S/contrib"
+contrib/ena-com/ena_com.c	optional ena
+contrib/ena-com/ena_eth_com.c	optional ena
 dev/en/if_en_pci.c		optional en pci
 dev/en/midway.c			optional en
 dev/ep/if_ep.c			optional ep
@@ -2070,6 +2076,14 @@ dev/ixgbe/if_ix.c		optional ix inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP"
 dev/ixgbe/if_ixv.c		optional ixv inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP"
+dev/ixgbe/if_bypass.c		optional ix inet \
+	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
+dev/ixgbe/ixgbe_netmap.c	optional ix inet \
+	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
+dev/ixgbe/if_fdir.c		optional ix inet | ixv inet \
+	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
+dev/ixgbe/if_sriov.c		optional ix inet | ixv inet \
+	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ix_txrx.c		optional ix inet | ixv inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_osdep.c		optional ix inet | ixv inet \

Modified: projects/pnfs-planb-server-stable11/sys/conf/newvers.sh
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/conf/newvers.sh	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/conf/newvers.sh	Sat Jul 15 19:52:59 2017	(r321033)
@@ -44,7 +44,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.1"
-BRANCH="BETA3"
+BRANCH="PRERELEASE"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
 	BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: projects/pnfs-planb-server-stable11/sys/dev/acpica/Osd/OsdSchedule.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/acpica/Osd/OsdSchedule.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/dev/acpica/Osd/OsdSchedule.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -128,7 +128,7 @@ acpi_taskq_init(void *arg)
     acpi_taskq_started = 1;
 }
 
-SYSINIT(acpi_taskq, SI_SUB_CONFIGURE, SI_ORDER_SECOND, acpi_taskq_init, NULL);
+SYSINIT(acpi_taskq, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, acpi_taskq_init, NULL);
 
 /*
  * Bounce through this wrapper function since ACPI-CA doesn't understand

Modified: projects/pnfs-planb-server-stable11/sys/dev/digi/digi.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/digi/digi.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/dev/digi/digi.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -1458,6 +1458,8 @@ digi_attach(struct digi_softc *sc)
 	digi_loadmoduledata(sc);
 	digi_init(sc);
 	digi_freemoduledata(sc);
+	device_printf(dev,
+	    "WARNING: This driver is deprecated and will be removed.\n");
 
 	return (0);
 }

Modified: projects/pnfs-planb-server-stable11/sys/dev/hyperv/input/hv_kbdc.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/hyperv/input/hv_kbdc.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/dev/hyperv/input/hv_kbdc.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/kbio.h>
 #include <dev/kbd/kbdreg.h>
-#include <dev/kbd/kbdtables.h>
 
 #include <dev/hyperv/include/hyperv.h>
 #include <dev/hyperv/utilities/hv_utilreg.h>

Modified: projects/pnfs-planb-server-stable11/sys/dev/ie/if_ie.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/dev/ie/if_ie.c	Sat Jul 15 19:43:02 2017	(r321032)
+++ projects/pnfs-planb-server-stable11/sys/dev/ie/if_ie.c	Sat Jul 15 19:52:59 2017	(r321033)
@@ -327,6 +327,8 @@ ie_attach(device_t dev)
 		mtx_destroy(&sc->lock);
 		return (error);
 	}
+	device_printf(dev,
+	    "WARNING: This driver is deprecated and will be removed.\n");
 
 	return (0);
 }

Copied: projects/pnfs-planb-server-stable11/sys/dev/ixgbe/if_bypass.c (from r321032, stable/11/sys/dev/ixgbe/if_bypass.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pnfs-planb-server-stable11/sys/dev/ixgbe/if_bypass.c	Sat Jul 15 19:52:59 2017	(r321033, copy of r321032, stable/11/sys/dev/ixgbe/if_bypass.c)
@@ -0,0 +1,808 @@
+/******************************************************************************
+
+  Copyright (c) 2001-2017, Intel 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.
+
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+   3. Neither the name of the Intel Corporation nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+  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.
+
+******************************************************************************/
+/*$FreeBSD$*/
+
+
+#include "ixgbe.h"
+
+/************************************************************************
+ * ixgbe_bypass_mutex_enter
+ *
+ *   Mutex support for the bypass feature. Using a dual lock
+ *   to facilitate a privileged access to the watchdog update
+ *   over other threads.
+ ************************************************************************/
+static void
+ixgbe_bypass_mutex_enter(struct adapter *adapter)
+{
+	while (atomic_cmpset_int(&adapter->bypass.low, 0, 1) == 0)
+		usec_delay(3000);
+	while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0)
+		usec_delay(3000);
+	return;
+} /* ixgbe_bypass_mutex_enter */
+
+/************************************************************************
+ * ixgbe_bypass_mutex_clear
+ ************************************************************************/
+static void
+ixgbe_bypass_mutex_clear(struct adapter *adapter)
+{
+	while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0)
+		usec_delay(6000);
+	while (atomic_cmpset_int(&adapter->bypass.low, 1, 0) == 0)
+		usec_delay(6000);
+	return;
+} /* ixgbe_bypass_mutex_clear */
+
+/************************************************************************
+ * ixgbe_bypass_wd_mutex_enter
+ *
+ *   Watchdog entry is allowed to simply grab the high priority
+ ************************************************************************/
+static void
+ixgbe_bypass_wd_mutex_enter(struct adapter *adapter)
+{
+	while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0)
+		usec_delay(3000);
+	return;
+} /* ixgbe_bypass_wd_mutex_enter */
+
+/************************************************************************
+ * ixgbe_bypass_wd_mutex_clear
+ ************************************************************************/
+static void
+ixgbe_bypass_wd_mutex_clear(struct adapter *adapter)
+{
+	while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0)
+		usec_delay(6000);
+	return;
+} /* ixgbe_bypass_wd_mutex_clear */
+
+/************************************************************************
+ * ixgbe_get_bypass_time
+ ************************************************************************/
+static void
+ixgbe_get_bypass_time(u32 *year, u32 *sec)
+{
+	struct timespec current;
+
+	*year = 1970;           /* time starts at 01/01/1970 */
+	nanotime(&current);
+	*sec = current.tv_sec;
+
+	while(*sec > SEC_THIS_YEAR(*year)) {
+		*sec -= SEC_THIS_YEAR(*year);
+		(*year)++;
+	}
+} /* ixgbe_get_bypass_time */
+
+/************************************************************************
+ * ixgbe_bp_version
+ *
+ *   Display the feature version
+ ************************************************************************/
+static int
+ixgbe_bp_version(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error = 0;
+	static int      version = 0;
+	u32             cmd;
+
+	ixgbe_bypass_mutex_enter(adapter);
+	cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
+	cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) &
+	    BYPASS_CTL2_OFFSET_M;
+	if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0))
+		goto err;
+	msec_delay(100);
+	cmd &= ~BYPASS_WE;
+	if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0))
+		goto err;
+	ixgbe_bypass_mutex_clear(adapter);
+	version &= BYPASS_CTL2_DATA_M;
+	error = sysctl_handle_int(oidp, &version, 0, req);
+	return (error);
+err:
+	ixgbe_bypass_mutex_clear(adapter);
+	return (error);
+
+} /* ixgbe_bp_version */
+
+/************************************************************************
+ * ixgbe_bp_set_state
+ *
+ *   Show/Set the Bypass State:
+ *	1 = NORMAL
+ *	2 = BYPASS
+ *	3 = ISOLATE
+ *
+ *	With no argument the state is displayed,
+ *	passing a value will set it.
+ ************************************************************************/
+static int
+ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error = 0;
+	static int      state = 0;
+
+	/* Get the current state */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw,
+	    BYPASS_PAGE_CTL0, &state);
+	ixgbe_bypass_mutex_clear(adapter);
+	if (error)
+		return (error);
+	state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3;
+
+	error = sysctl_handle_int(oidp, &state, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	/* Sanity check new state */
+	switch (state) {
+	case BYPASS_NORM:
+	case BYPASS_BYPASS:
+	case BYPASS_ISOLATE:
+		break;
+	default:
+		return (EINVAL);
+	}
+	ixgbe_bypass_mutex_enter(adapter);
+	if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+	    BYPASS_MODE_OFF_M, state) != 0))
+		goto out;
+	/* Set AUTO back on so FW can receive events */
+	error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+	    BYPASS_MODE_OFF_M, BYPASS_AUTO);
+out:
+	ixgbe_bypass_mutex_clear(adapter);
+	usec_delay(6000);
+	return (error);
+} /* ixgbe_bp_set_state */
+
+/************************************************************************
+ * The following routines control the operational
+ * "rules" of the feature, what behavior will occur
+ * when particular events occur.
+ * 	Values are:
+ *		0 - no change for the event (NOP)
+ *		1 - go to Normal operation
+ *		2 - go to Bypass operation
+ *		3 - go to Isolate operation
+ * Calling the entry with no argument just displays
+ * the current rule setting.
+ ************************************************************************/
+
+/************************************************************************
+ * ixgbe_bp_timeout
+ *
+ * This is to set the Rule for the watchdog,
+ * not the actual watchdog timeout value.
+ ************************************************************************/
+static int
+ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error = 0;
+	static int      timeout = 0;
+
+	/* Get the current value */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout);
+	ixgbe_bypass_mutex_clear(adapter);
+	if (error)
+		return (error);
+	timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3;
+
+	error = sysctl_handle_int(oidp, &timeout, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	/* Sanity check on the setting */
+	switch (timeout) {
+	case BYPASS_NOP:
+	case BYPASS_NORM:
+	case BYPASS_BYPASS:
+	case BYPASS_ISOLATE:
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	/* Set the new state */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+	    BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT);
+	ixgbe_bypass_mutex_clear(adapter);
+	usec_delay(6000);
+	return (error);
+} /* ixgbe_bp_timeout */
+
+/************************************************************************
+ * ixgbe_bp_main_on
+ ************************************************************************/
+static int
+ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error = 0;
+	static int      main_on = 0;
+
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on);
+	main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3;
+	ixgbe_bypass_mutex_clear(adapter);
+	if (error)
+		return (error);
+
+	error = sysctl_handle_int(oidp, &main_on, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	/* Sanity check on the setting */
+	switch (main_on) {
+	case BYPASS_NOP:
+	case BYPASS_NORM:
+	case BYPASS_BYPASS:
+	case BYPASS_ISOLATE:
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	/* Set the new state */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+	    BYPASS_MAIN_ON_M, main_on << BYPASS_MAIN_ON_SHIFT);
+	ixgbe_bypass_mutex_clear(adapter);
+	usec_delay(6000);
+	return (error);
+} /* ixgbe_bp_main_on */
+
+/************************************************************************
+ * ixgbe_bp_main_off
+ ************************************************************************/
+static int
+ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error = 0;
+	static int      main_off = 0;
+
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off);
+	ixgbe_bypass_mutex_clear(adapter);
+	if (error)
+		return (error);
+	main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3;
+
+	error = sysctl_handle_int(oidp, &main_off, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	/* Sanity check on the setting */
+	switch (main_off) {
+	case BYPASS_NOP:
+	case BYPASS_NORM:
+	case BYPASS_BYPASS:
+	case BYPASS_ISOLATE:
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	/* Set the new state */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+	    BYPASS_MAIN_OFF_M, main_off << BYPASS_MAIN_OFF_SHIFT);
+	ixgbe_bypass_mutex_clear(adapter);
+	usec_delay(6000);
+	return (error);
+} /* ixgbe_bp_main_off */
+
+/************************************************************************
+ * ixgbe_bp_aux_on
+ ************************************************************************/
+static int
+ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error = 0;
+	static int      aux_on = 0;
+
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on);
+	ixgbe_bypass_mutex_clear(adapter);
+	if (error)
+		return (error);
+	aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3;
+
+	error = sysctl_handle_int(oidp, &aux_on, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	/* Sanity check on the setting */
+	switch (aux_on) {
+	case BYPASS_NOP:
+	case BYPASS_NORM:
+	case BYPASS_BYPASS:
+	case BYPASS_ISOLATE:
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	/* Set the new state */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+	    BYPASS_AUX_ON_M, aux_on << BYPASS_AUX_ON_SHIFT);
+	ixgbe_bypass_mutex_clear(adapter);
+	usec_delay(6000);
+	return (error);
+} /* ixgbe_bp_aux_on */
+
+/************************************************************************
+ * ixgbe_bp_aux_off
+ ************************************************************************/
+static int
+ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error = 0;
+	static int      aux_off = 0;
+
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off);
+	ixgbe_bypass_mutex_clear(adapter);
+	if (error)
+		return (error);
+	aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3;
+
+	error = sysctl_handle_int(oidp, &aux_off, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	/* Sanity check on the setting */
+	switch (aux_off) {
+	case BYPASS_NOP:
+	case BYPASS_NORM:
+	case BYPASS_BYPASS:
+	case BYPASS_ISOLATE:
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	/* Set the new state */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+	    BYPASS_AUX_OFF_M, aux_off << BYPASS_AUX_OFF_SHIFT);
+	ixgbe_bypass_mutex_clear(adapter);
+	usec_delay(6000);
+	return (error);
+} /* ixgbe_bp_aux_off */
+
+/************************************************************************
+ * ixgbe_bp_wd_set - Set the Watchdog timer value
+ *
+ *   Valid settings are:
+ *	- 0 will disable the watchdog
+ *	- 1, 2, 3, 4, 8, 16, 32
+ *	- anything else is invalid and will be ignored
+ ************************************************************************/
+static int
+ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int             error, tmp;
+	static int      timeout = 0;
+	u32             mask, arg = BYPASS_PAGE_CTL0;
+
+	/* Get the current hardware value */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp);
+	ixgbe_bypass_mutex_clear(adapter);
+	if (error)
+		return (error);
+	/*
+	 * If armed keep the displayed value,
+	 * else change the display to zero.
+	 */
+	if ((tmp & (0x1 << BYPASS_WDT_ENABLE_SHIFT)) == 0)
+		timeout = 0;
+
+	error = sysctl_handle_int(oidp, &timeout, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	mask = BYPASS_WDT_ENABLE_M;
+	switch (timeout) {
+		case 0: /* disables the timer */
+			break;
+		case 1:
+			arg = BYPASS_WDT_1_5 << BYPASS_WDT_TIME_SHIFT;
+			arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT;
+			mask |= BYPASS_WDT_VALUE_M;
+			break;
+		case 2:
+			arg = BYPASS_WDT_2 << BYPASS_WDT_TIME_SHIFT;
+			arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT;
+			mask |= BYPASS_WDT_VALUE_M;
+			break;
+		case 3:
+			arg = BYPASS_WDT_3 << BYPASS_WDT_TIME_SHIFT;
+			arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT;
+			mask |= BYPASS_WDT_VALUE_M;
+			break;
+		case 4:
+			arg = BYPASS_WDT_4 << BYPASS_WDT_TIME_SHIFT;
+			arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT;
+			mask |= BYPASS_WDT_VALUE_M;
+			break;
+		case 8:
+			arg = BYPASS_WDT_8 << BYPASS_WDT_TIME_SHIFT;
+			arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT;
+			mask |= BYPASS_WDT_VALUE_M;
+			break;
+		case 16:
+			arg = BYPASS_WDT_16 << BYPASS_WDT_TIME_SHIFT;
+			arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT;
+			mask |= BYPASS_WDT_VALUE_M;
+			break;
+		case 32:
+			arg = BYPASS_WDT_32 << BYPASS_WDT_TIME_SHIFT;
+			arg |= 0x1 << BYPASS_WDT_ENABLE_SHIFT;
+			mask |= BYPASS_WDT_VALUE_M;
+			break;
+		default:
+			return (EINVAL);
+	}
+	/* Set the new watchdog */
+	ixgbe_bypass_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg);
+	ixgbe_bypass_mutex_clear(adapter);
+
+	return (error);
+} /* ixgbe_bp_wd_set */
+
+/************************************************************************
+ * ixgbe_bp_wd_reset - Reset the Watchdog timer
+ *
+ *    To activate this it must be called with any argument.
+ ************************************************************************/
+static int
+ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter  *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32             sec, year;
+	int             cmd, count = 0, error = 0;
+	int             reset_wd = 0;
+
+	error = sysctl_handle_int(oidp, &reset_wd, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	cmd = BYPASS_PAGE_CTL1 | BYPASS_WE | BYPASS_CTL1_WDT_PET;
+
+	/* Resync the FW time while writing to CTL1 anyway */
+	ixgbe_get_bypass_time(&year, &sec);
+
+	cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID;
+	cmd |= BYPASS_CTL1_OFFTRST;
+
+	ixgbe_bypass_wd_mutex_enter(adapter);
+	error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd);
+
+	/* Read until it matches what we wrote, or we time out */
+	do {
+		if (count++ > 10) {
+			error = IXGBE_BYPASS_FW_WRITE_FAILURE;
+			break;
+		}
+		if (hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL1, &reset_wd)) {
+			error = IXGBE_ERR_INVALID_ARGUMENT;
+			break;
+		}
+	} while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd));
+
+	reset_wd = 0;
+	ixgbe_bypass_wd_mutex_clear(adapter);
+	return (error);
+} /* ixgbe_bp_wd_reset */
+
+/************************************************************************
+ * ixgbe_bp_log - Display the bypass log
+ *
+ *   You must pass a non-zero arg to sysctl
+ ************************************************************************/
+static int
+ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter             *adapter = (struct adapter *) arg1;
+	struct ixgbe_hw            *hw = &adapter->hw;
+	u32                        cmd, base, head;
+	u32                        log_off, count = 0;
+	static int                 status = 0;
+	u8                         data;
+	struct ixgbe_bypass_eeprom eeprom[BYPASS_MAX_LOGS];
+	int                        i, error = 0;
+
+	error = sysctl_handle_int(oidp, &status, 0, req);
+	if ((error) || (req->newptr == NULL))
+		return (error);
+
+	/* Keep the log display single-threaded */
+	while (atomic_cmpset_int(&adapter->bypass.log, 0, 1) == 0)
+		usec_delay(3000);
+
+	ixgbe_bypass_mutex_enter(adapter);
+
+	/* Find Current head of the log eeprom offset */
+	cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
+	cmd |= (0x1 << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M;
+	error = hw->mac.ops.bypass_rw(hw, cmd, &status);
+	if (error)
+		goto unlock_err;
+
+	/* wait for the write to stick */
+	msec_delay(100);
+
+	/* Now read the results */
+	cmd &= ~BYPASS_WE;
+	error = hw->mac.ops.bypass_rw(hw, cmd, &status);
+	if (error)
+		goto unlock_err;
+
+	ixgbe_bypass_mutex_clear(adapter);
+
+	base = status & BYPASS_CTL2_DATA_M;
+	head = (status & BYPASS_CTL2_HEAD_M) >> BYPASS_CTL2_HEAD_SHIFT;
+
+	/* address of the first log */
+	log_off = base + (head * 5);
+
+	/* extract all the log entries */
+	while (count < BYPASS_MAX_LOGS) {
+		eeprom[count].logs = 0;
+		eeprom[count].actions = 0;
+
+		/* Log 5 bytes store in on u32 and a u8 */
+		for (i = 0; i < 4; i++) {
+			ixgbe_bypass_mutex_enter(adapter);
+			error = hw->mac.ops.bypass_rd_eep(hw, log_off + i,
+			    &data);
+			ixgbe_bypass_mutex_clear(adapter);
+			if (error)
+				return (-EINVAL);
+			eeprom[count].logs += data << (8 * i);
+		}
+
+		ixgbe_bypass_mutex_enter(adapter);
+		error = hw->mac.ops.bypass_rd_eep(hw,
+		    log_off + i, &eeprom[count].actions);
+		ixgbe_bypass_mutex_clear(adapter);
+		if (error)
+			return (-EINVAL);
+
+		/* Quit if not a unread log */

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


More information about the svn-src-projects mailing list