Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Sep 2004 21:11:41 GMT
From:      Julian Elischer <julian@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 60885 for review
Message-ID:  <200409022111.i82LBfXL000464@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=60885

Change 60885 by julian@julian_ref on 2004/09/02 21:11:11

	IFC @60880

Affected files ...

.. //depot/projects/nsched/sys/alpha/include/param.h#5 integrate
.. //depot/projects/nsched/sys/amd64/include/param.h#5 integrate
.. //depot/projects/nsched/sys/conf/NOTES#15 integrate
.. //depot/projects/nsched/sys/conf/files#22 integrate
.. //depot/projects/nsched/sys/conf/options#16 integrate
.. //depot/projects/nsched/sys/dev/acpica/Osd/OsdDebug.c#4 integrate
.. //depot/projects/nsched/sys/dev/acpica/acpi_pci_link.c#7 integrate
.. //depot/projects/nsched/sys/dev/ata/ata-chipset.c#10 integrate
.. //depot/projects/nsched/sys/dev/ata/ata-disk.c#7 integrate
.. //depot/projects/nsched/sys/dev/em/if_em.c#6 integrate
.. //depot/projects/nsched/sys/dev/em/if_em.h#3 integrate
.. //depot/projects/nsched/sys/dev/em/if_em_hw.c#2 integrate
.. //depot/projects/nsched/sys/dev/em/if_em_hw.h#2 integrate
.. //depot/projects/nsched/sys/dev/tga/tga_pci.c#4 integrate
.. //depot/projects/nsched/sys/fs/autofs/autofs_util.c#2 integrate
.. //depot/projects/nsched/sys/fs/autofs/autofs_vfsops.c#2 integrate
.. //depot/projects/nsched/sys/fs/autofs/autofs_vnops.c#2 integrate
.. //depot/projects/nsched/sys/fs/pseudofs/pseudofs_vnops.c#4 integrate
.. //depot/projects/nsched/sys/i386/i386/pmap.c#17 integrate
.. //depot/projects/nsched/sys/i386/include/param.h#6 integrate
.. //depot/projects/nsched/sys/ia64/conf/GENERIC#7 integrate
.. //depot/projects/nsched/sys/kern/kern_mutex.c#6 integrate
.. //depot/projects/nsched/sys/kern/kern_shutdown.c#9 integrate
.. //depot/projects/nsched/sys/kern/kern_switch.c#8 integrate
.. //depot/projects/nsched/sys/kern/sched_ule.c#22 integrate
.. //depot/projects/nsched/sys/kern/subr_smp.c#7 integrate
.. //depot/projects/nsched/sys/modules/Makefile#10 integrate
.. //depot/projects/nsched/sys/net/if.c#10 integrate
.. //depot/projects/nsched/sys/net/if.h#7 integrate
.. //depot/projects/nsched/sys/netgraph/ng_ksocket.c#7 integrate
.. //depot/projects/nsched/sys/netinet6/raw_ip6.c#4 integrate
.. //depot/projects/nsched/sys/netkey/key.c#3 integrate
.. //depot/projects/nsched/sys/pc98/conf/NOTES#9 integrate
.. //depot/projects/nsched/sys/vm/vm_fault.c#5 integrate
.. //depot/projects/nsched/sys/vm/vm_mmap.c#6 integrate
.. //depot/projects/nsched/sys/vm/vm_zeroidle.c#5 integrate

Differences ...

==== //depot/projects/nsched/sys/alpha/include/param.h#5 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/alpha/include/param.h,v 1.35 2004/08/01 14:31:45 scottl Exp $ */
+/* $FreeBSD: src/sys/alpha/include/param.h,v 1.36 2004/09/02 18:59:14 scottl Exp $ */
 /* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */
 
 /*
@@ -113,11 +113,6 @@
 #define	SSIZE		1		/* initial stack size/NBPG */
 #define	SINCR		1		/* increment of stack/NBPG */
 
-/* PREEMPTION exposes scheduler bugs that need to be fixed. */
-#if 0
-#define	PREEMPTION
-#endif
-
 #ifndef	KSTACK_PAGES
 #define	KSTACK_PAGES	2		/* pages of kstack (with pcb) */
 #endif

==== //depot/projects/nsched/sys/amd64/include/param.h#5 (text+ko) ====

@@ -36,7 +36,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)param.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/amd64/include/param.h,v 1.13 2004/08/01 14:31:45 scottl Exp $
+ * $FreeBSD: src/sys/amd64/include/param.h,v 1.14 2004/09/02 18:59:14 scottl Exp $
  */
 
 /*
@@ -119,11 +119,6 @@
 #define	NBPML4		(1ul<<PML4SHIFT)/* bytes/page map lev4 table */
 #define	PML4MASK	(NBPML4-1)
 
-/* PREEMPTION exposes scheduler bugs that need to be fixed. */
-#if 0
-#define	PREEMPTION
-#endif
-
 #define IOPAGES	2		/* pages of i/o permission bitmap */
 
 #ifndef	KSTACK_PAGES

==== //depot/projects/nsched/sys/conf/NOTES#15 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1271 2004/09/01 01:19:51 brooks Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1273 2004/09/02 20:44:56 alfred Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -196,12 +196,16 @@
 
 # SMP Debugging Options:
 #
+# PREEMPTION allows the threads that are in the kernel to be preempted
+#	  by higher priority threads.  It helps with interactivity and
+#	  allows interrupt threads to run sooner rather than waiting.
+#	  WARNING! Only tested on alpha, amd64, and i386.
 # FULL_PREEMPTION instructs the kernel to preempt non-realtime kernel
 #	  threads.  It sole use is to expose race conditions and other
 #	  bugs during development.  Enabling this option will reduce
 #	  performance and increase the frequency of kernel panics by
 #	  design.  If you aren't sure that you need it then you don't.
-#         DON'T TURN THIS ON.
+#	  Relies on the PREEMPTION option.  DON'T TURN THIS ON.
 # MUTEX_DEBUG enables various extra assertions in the mutex code.
 # SLEEPQUEUE_PROFILING enables rudimentary profiling of the hash table
 #	  used to hold active sleep queues.
@@ -213,6 +217,7 @@
 #	  a lock hierarchy violation occurs or if locks are held when going to
 #	  sleep.
 # WITNESS_SKIPSPIN disables the witness checks on spin mutexes.
+options		PREEMPTION
 options 	FULL_PREEMPTION
 options 	MUTEX_DEBUG
 options 	WITNESS
@@ -739,6 +744,7 @@
 options 	NFSCLIENT		#Network File System client
 
 # The rest are optional:
+options		AUTOFS			#Auto File System
 options 	CD9660			#ISO 9660 filesystem
 options 	FDESCFS			#File descriptor filesystem
 options 	HPFS			#OS/2 File system

==== //depot/projects/nsched/sys/conf/files#22 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.948 2004/08/30 23:03:56 peter Exp $
+# $FreeBSD: src/sys/conf/files,v 1.949 2004/09/02 20:44:56 alfred Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -858,6 +858,9 @@
 dev/zs/zs.c			optional zs
 dev/zs/zs_sbus.c		optional zs fhc
 dev/zs/zs_sbus.c		optional zs sbus
+fs/autofs/autofs_vnops.c	optional autofs
+fs/autofs/autofs_vfsops.c	optional autofs
+fs/autofs/autofs_util.c		optional autofs
 fs/deadfs/dead_vnops.c	standard
 fs/devfs/devfs_devs.c		standard
 fs/devfs/devfs_rule.c		standard

==== //depot/projects/nsched/sys/conf/options#16 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options,v 1.481 2004/09/01 01:19:52 brooks Exp $
+# $FreeBSD: src/sys/conf/options,v 1.483 2004/09/02 20:44:56 alfred Exp $
 #
 #        On the handling of kernel options
 #
@@ -66,7 +66,8 @@
 CONSPEED	opt_comconsole.h
 CY_PCI_FASTINTR
 DIRECTIO	opt_directio.h
-FULL_PREEMPTION
+FULL_PREEMPTION	opt_sched.h
+PREEMPTION	opt_sched.h
 GEOM_AES	opt_geom.h
 GEOM_APPLE	opt_geom.h
 GEOM_BDE	opt_geom.h
@@ -160,6 +161,7 @@
 # time, since the corresponding lkms cannot work if there are any static
 # dependencies.  Unusability is enforced by hiding the defines for the
 # options in a never-included header.
+AUTOFS		opt_dontuse.h
 CD9660		opt_dontuse.h
 CODA		opt_dontuse.h
 EXT2FS		opt_dontuse.h

==== //depot/projects/nsched/sys/dev/acpica/Osd/OsdDebug.c#4 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/Osd/OsdDebug.c,v 1.8 2004/07/10 20:56:43 marcel Exp $
+ *	$FreeBSD: src/sys/dev/acpica/Osd/OsdDebug.c,v 1.9 2004/09/02 04:28:05 njl Exp $
  */
 
 /*
@@ -73,8 +73,7 @@
 AcpiOsSignal(UINT32 Function, void *Info)
 {
     ACPI_SIGNAL_FATAL_INFO	*fatal;
-    char			*message;
-    
+
     switch (Function) {
     case ACPI_SIGNAL_FATAL:
 	fatal = (ACPI_SIGNAL_FATAL_INFO *)Info;
@@ -82,10 +81,11 @@
 	      fatal->Type, fatal->Code, fatal->Argument);
 	kdb_enter("AcpiOsSignal");
 	break;
-	
+
     case ACPI_SIGNAL_BREAKPOINT:
-	message = (char *)Info;
-	kdb_enter(message);
+#ifdef ACPI_DEBUG
+	kdb_enter((char *)Info);
+#endif
 	break;
 
     default:

==== //depot/projects/nsched/sys/dev/acpica/acpi_pci_link.c#7 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.28 2004/08/27 00:53:11 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.29 2004/09/01 17:59:29 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -373,18 +373,6 @@
 		link->initial_irq = 0;
 	}
 
-	/*
-	 * Try to disable this link.  If successful, set the current IRQ to
-	 * zero and flags to indicate this link is not routed.  If we can't
-	 * run _DIS (i.e., the method doesn't exist), assume the initial
-	 * IRQ was routed by the BIOS.
-	 */
-	if (ACPI_SUCCESS(AcpiEvaluateObject(handle, "_DIS", NULL, NULL))) {
-		link->current_irq = 0;
-		link->flags = ACPI_LINK_NONE;
-	} else
-		link->flags = ACPI_LINK_ROUTED;
-
 	error = AcpiGetPossibleResources(handle, &buf);
 	if (ACPI_FAILURE(error)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -426,6 +414,18 @@
 	}
 
 	/*
+	 * Try to disable this link.  If successful, set the current IRQ to
+	 * zero and flags to indicate this link is not routed.  If we can't
+	 * run _DIS (i.e., the method doesn't exist), assume the initial
+	 * IRQ was routed by the BIOS.
+	 */
+	if (ACPI_SUCCESS(AcpiEvaluateObject(handle, "_DIS", NULL, NULL))) {
+		link->current_irq = 0;
+		link->flags = ACPI_LINK_NONE;
+	} else
+		link->flags = ACPI_LINK_ROUTED;
+
+	/*
 	 * If the initial IRQ is invalid (not in _PRS), set it to 0 and
 	 * mark this link as not routed.  We won't use it as the preferred
 	 * interrupt later when we route.

==== //depot/projects/nsched/sys/dev/ata/ata-chipset.c#10 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.83 2004/08/27 12:54:58 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.84 2004/09/01 12:15:44 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -188,13 +188,16 @@
      * Marvell 88SX8030 SATA->PATA converters and UDMA6/ATA133.
      */
     if (atadev->param->satacapabilities != 0x0000 &&
-	atadev->param->satacapabilities != 0xffff)
-	mode = ata_limit_mode(atadev, mode, ATA_UDMA6);
-    else
+	atadev->param->satacapabilities != 0xffff) {
+        if (!ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0,
+			    ata_limit_mode(atadev, mode, ATA_UDMA6)))
+	    atadev->mode = ATA_SA150;
+    }
+    else {
 	mode = ata_limit_mode(atadev, mode, ATA_UDMA5);
-
-    if (!ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode))
-	atadev->mode = mode;
+	if (!ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode))
+	    atadev->mode = mode;
+    }
 }
 
 /*

==== //depot/projects/nsched/sys/dev/ata/ata-disk.c#7 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.176 2004/08/27 12:03:18 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.177 2004/09/01 12:15:44 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -393,7 +393,7 @@
     }
     else {
 	ata_prtdev(adp->device,
-		   "%lluMB <%.40s/%.8s> [%lld/%d/%d] at ata%d-%s %s",
+		   "%lluMB <%.40s/%.8s> [%lld/%d/%d] at ata%d-%s %s%s\n",
 		   (unsigned long long)(adp->total_secs /
 					((1024L * 1024L) / DEV_BSIZE)),
 		   adp->device->param->model, adp->device->param->revision,
@@ -402,13 +402,8 @@
 		   adp->heads, adp->sectors,
 		   device_get_unit(adp->device->channel->dev),
 		   (adp->device->unit == ATA_MASTER) ? "master" : "slave",
-		   (adp->flags & AD_F_TAG_ENABLED) ? "tagged " : "");
-	
-	if (adp->device->param->satacapabilities != 0x0000 &&
-            adp->device->param->satacapabilities != 0xffff)
-	    printf("SATA150\n");
-	else
-	    printf("%s\n", ata_mode2str(adp->device->mode));
+		   (adp->flags & AD_F_TAG_ENABLED) ? "tagged " : "",
+		   ata_mode2str(adp->device->mode));
     }
 }
 

==== //depot/projects/nsched/sys/dev/em/if_em.c#6 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.44 2004/07/02 12:16:01 mlaier Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.45 2004/09/01 23:22:41 pdeuskar Exp $*/
 
 #include <dev/em/if_em.h>
 
@@ -51,7 +51,7 @@
  *  Driver version
  *********************************************************************/
 
-char em_driver_version[] = "1.7.25";
+char em_driver_version[] = "1.7.35";
 
 
 /*********************************************************************
@@ -80,7 +80,6 @@
         { 0x8086, 0x1011, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1012, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1013, PCI_ANY_ID, PCI_ANY_ID, 0},
-        { 0x8086, 0x1014, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1015, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1016, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1017, PCI_ANY_ID, PCI_ANY_ID, 0},
@@ -99,6 +98,7 @@
         { 0x8086, 0x1079, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x107A, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x107B, PCI_ANY_ID, PCI_ANY_ID, 0},
+        { 0x8086, 0x107C, PCI_ANY_ID, PCI_ANY_ID, 0},
         /* required last entry */
         { 0, 0, 0, 0, 0}
 };
@@ -742,7 +742,7 @@
 			em_init(adapter);
 		break;
 	default:
-		IOCTL_DEBUGOUT1("ioctl received: UNKNOWN (0x%x)\n", (int)command);
+		IOCTL_DEBUGOUT1("ioctl received: UNKNOWN (0x%x)", (int)command);
 		error = EINVAL;
 	}
 
@@ -797,6 +797,7 @@
 {
 	struct ifnet   *ifp;
 
+	uint32_t	pba;
 	ifp = &adapter->interface_data.ac_if;
 
 	INIT_DEBUGOUT("em_init: begin");
@@ -805,6 +806,36 @@
 
 	em_stop(adapter);
 
+	/* Packet Buffer Allocation (PBA)
+	 * Writing PBA sets the receive portion of the buffer
+	 * the remainder is used for the transmit buffer.
+	 *
+	 * Devices before the 82547 had a Packet Buffer of 64K.
+	 *   Default allocation: PBA=48K for Rx, leaving 16K for Tx.
+	 * After the 82547 the buffer was reduced to 40K.
+	 *   Default allocation: PBA=30K for Rx, leaving 10K for Tx.
+	 *   Note: default does not leave enough room for Jumbo Frame >10k.
+	 */
+	if(adapter->hw.mac_type < em_82547) {
+		/* Total FIFO is 64K */
+		if(adapter->rx_buffer_len > EM_RXBUFFER_8192)
+			pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */
+		else
+			pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */
+	} else {
+		/* Total FIFO is 40K */
+		if(adapter->hw.max_frame_size > EM_RXBUFFER_8192) {
+			pba = E1000_PBA_22K; /* 22K for Rx, 18K for Tx */
+		} else {
+		        pba = E1000_PBA_30K; /* 30K for Rx, 10K for Tx */
+		}
+		adapter->tx_fifo_head = 0;
+		adapter->tx_head_addr = pba << EM_TX_HEAD_ADDR_SHIFT;
+		adapter->tx_fifo_size = (E1000_PBA_40K - pba) << EM_PBA_BYTES_SHIFT;
+	}
+	INIT_DEBUGOUT1("em_init: pba=%dK",pba);
+	E1000_WRITE_REG(&adapter->hw, PBA, pba);
+	
 	/* Get the latest mac address, User can use a LAA */
         bcopy(adapter->interface_data.ac_enaddr, adapter->hw.mac_addr,
               ETHER_ADDR_LEN);
@@ -1138,10 +1169,6 @@
         bcopy(seg, q->segs, nsegs * sizeof(seg[0]));
 }
 
-#define EM_FIFO_HDR              0x10
-#define EM_82547_PKT_THRESH      0x3e0
-#define EM_82547_TX_FIFO_SIZE    0x2800
-#define EM_82547_TX_FIFO_BEGIN   0xf00
 /*********************************************************************
  *
  *  This routine maps the mbufs to tx descriptors.
@@ -1356,7 +1383,7 @@
 
 		if(eop) {
 			if (em_82547_fifo_workaround(adapter, length)) {
-				adapter->tx_fifo_wrk++;
+				adapter->tx_fifo_wrk_cnt++;
 				callout_reset(&adapter->tx_fifo_timer, 1,
 					em_82547_move_tail, adapter);
 				break;
@@ -1387,7 +1414,7 @@
 	fifo_pkt_len = EM_ROUNDUP(len + EM_FIFO_HDR, EM_FIFO_HDR);
 
 	if (adapter->link_duplex == HALF_DUPLEX) {
-		fifo_space = EM_82547_TX_FIFO_SIZE - adapter->tx_fifo_head;
+		fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head;
 
 		if (fifo_pkt_len >= (EM_82547_PKT_THRESH + fifo_space)) {
 			if (em_82547_tx_fifo_reset(adapter)) {
@@ -1409,8 +1436,8 @@
 	
 	/* tx_fifo_head is always 16 byte aligned */
 	adapter->tx_fifo_head += fifo_pkt_len;
-	if (adapter->tx_fifo_head >= EM_82547_TX_FIFO_SIZE) {
-		adapter->tx_fifo_head -= EM_82547_TX_FIFO_SIZE;
+	if (adapter->tx_fifo_head >= adapter->tx_fifo_size) {
+		adapter->tx_fifo_head -= adapter->tx_fifo_size;
 	}
 
 	return;
@@ -1435,17 +1462,17 @@
 		E1000_WRITE_REG(&adapter->hw, TCTL, tctl & ~E1000_TCTL_EN);
 
 		/* Reset FIFO pointers */
-		E1000_WRITE_REG(&adapter->hw, TDFT, EM_82547_TX_FIFO_BEGIN);
-		E1000_WRITE_REG(&adapter->hw, TDFH, EM_82547_TX_FIFO_BEGIN);
-		E1000_WRITE_REG(&adapter->hw, TDFTS, EM_82547_TX_FIFO_BEGIN);
-		E1000_WRITE_REG(&adapter->hw, TDFHS, EM_82547_TX_FIFO_BEGIN);
+		E1000_WRITE_REG(&adapter->hw, TDFT,  adapter->tx_head_addr);
+		E1000_WRITE_REG(&adapter->hw, TDFH,  adapter->tx_head_addr);
+		E1000_WRITE_REG(&adapter->hw, TDFTS, adapter->tx_head_addr);
+		E1000_WRITE_REG(&adapter->hw, TDFHS, adapter->tx_head_addr);
 
 		/* Re-enable TX unit */
 		E1000_WRITE_REG(&adapter->hw, TCTL, tctl);
 		E1000_WRITE_FLUSH(&adapter->hw);
 
 		adapter->tx_fifo_head = 0;
-		adapter->tx_fifo_reset++;
+		adapter->tx_fifo_reset_cnt++;
 
 		return(TRUE);
 	}
@@ -1459,13 +1486,23 @@
 {
 
 	u_int32_t       reg_rctl;
+	u_int32_t       ctrl;
 	struct ifnet   *ifp = &adapter->interface_data.ac_if;
 
 	reg_rctl = E1000_READ_REG(&adapter->hw, RCTL);
+	ctrl = E1000_READ_REG(&adapter->hw, CTRL);
 
 	if (ifp->if_flags & IFF_PROMISC) {
 		reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 		E1000_WRITE_REG(&adapter->hw, RCTL, reg_rctl);
+		
+		/* Disable VLAN stripping in promiscous mode 
+		 * This enables bridging of vlan tagged frames to occur 
+		 * and also allows vlan tags to be seen in tcpdump
+		 */
+		ctrl &= ~E1000_CTRL_VME; 
+		E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
+
 	} else if (ifp->if_flags & IFF_ALLMULTI) {
 		reg_rctl |= E1000_RCTL_MPE;
 		reg_rctl &= ~E1000_RCTL_UPE;
@@ -1486,6 +1523,7 @@
 	reg_rctl &=  (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(&adapter->hw, RCTL, reg_rctl);
 
+	em_enable_vlans(adapter);
 	return;
 }
 
@@ -3169,6 +3207,10 @@
 	uint8_t *hw_addr = adapter->hw.hw_addr;
  
 	printf("em%d: Adapter hardware address = %p \n", unit, hw_addr);
+	printf("em%d:CTRL  = 0x%x\n", unit, 
+		E1000_READ_REG(&adapter->hw, CTRL)); 
+	printf("em%d:RCTL  = 0x%x PS=(0x8402)\n", unit, 
+		E1000_READ_REG(&adapter->hw, RCTL)); 
 	printf("em%d:tx_int_delay = %d, tx_abs_int_delay = %d\n", unit, 
               E1000_READ_REG(&adapter->hw, TIDV),
 	      E1000_READ_REG(&adapter->hw, TADV));
@@ -3183,8 +3225,8 @@
                adapter->clean_tx_interrupts);
 #endif
         printf("em%d: fifo workaround = %lld, fifo_reset = %lld\n", unit,
-               (long long)adapter->tx_fifo_wrk,
-               (long long)adapter->tx_fifo_reset);
+               (long long)adapter->tx_fifo_wrk_cnt, 
+               (long long)adapter->tx_fifo_reset_cnt);
         printf("em%d: hw tdh = %d, hw tdt = %d\n", unit,
                E1000_READ_REG(&adapter->hw, TDH),
                E1000_READ_REG(&adapter->hw, TDT));

==== //depot/projects/nsched/sys/dev/em/if_em.h#3 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.25 2004/05/30 20:08:30 phk Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.26 2004/09/01 23:22:41 pdeuskar Exp $*/
 
 #ifndef _EM_H_DEFINED_
 #define _EM_H_DEFINED_
@@ -399,8 +399,6 @@
 	struct mbuf        *fmp;
 	struct mbuf        *lmp;
 
-	u_int16_t          tx_fifo_head;
-
 	struct sysctl_ctx_list sysctl_ctx;
         struct sysctl_oid *sysctl_tree;
 
@@ -412,8 +410,21 @@
 	unsigned long   no_tx_desc_avail2;
 	unsigned long   no_tx_map_avail;
         unsigned long   no_tx_dma_setup;
-	u_int64_t       tx_fifo_reset;
-	u_int64_t       tx_fifo_wrk;
+
+	/* Used in for 82547 10Mb Half workaround */
+	#define EM_PBA_BYTES_SHIFT	0xA
+	#define EM_TX_HEAD_ADDR_SHIFT	7
+	#define EM_PBA_TX_MASK		0xFFFF0000
+	#define EM_FIFO_HDR              0x10
+
+	#define EM_82547_PKT_THRESH      0x3e0
+
+	u_int32_t       tx_fifo_size;
+	u_int32_t       tx_fifo_head;
+	u_int32_t       tx_fifo_head_addr;
+	u_int64_t       tx_fifo_reset_cnt;
+	u_int64_t       tx_fifo_wrk_cnt;
+	u_int32_t       tx_head_addr;
 
         /* For 82544 PCIX Workaround */
         boolean_t       pcix_82544;

==== //depot/projects/nsched/sys/dev/em/if_em_hw.c#2 (text+ko) ====

@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/em/if_em_hw.c,v 1.13 2004/02/10 21:31:09 pdeuskar Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/em/if_em_hw.c,v 1.14 2004/09/01 23:22:41 pdeuskar Exp $");
 
 #include <dev/em/if_em_hw.h>
 
@@ -73,6 +73,7 @@
 static void em_standby_eeprom(struct em_hw *hw);
 static int32_t em_id_led_init(struct em_hw * hw);
 static int32_t em_set_vco_speed(struct em_hw *hw);
+static int32_t em_set_phy_mode(struct em_hw *hw);
 
 /* IGP cable length table */
 static const
@@ -258,6 +259,7 @@
         break;
     case E1000_DEV_ID_82541ER:
     case E1000_DEV_ID_82541GI:
+    case E1000_DEV_ID_82541GI_LF:
     case E1000_DEV_ID_82541GI_MOBILE:
         hw->mac_type = em_82541_rev_2;
         break;
@@ -477,11 +479,11 @@
     uint16_t pcix_stat_hi_word;
     uint16_t cmd_mmrbc;
     uint16_t stat_mmrbc;
-
     DEBUGFUNC("em_init_hw");
 
     /* Initialize Identification LED */
-    if((ret_val = em_id_led_init(hw))) {
+    ret_val = em_id_led_init(hw);
+    if(ret_val) {
         DEBUGOUT("Error Initializing Identification LED\n");
         return ret_val;
     }
@@ -602,16 +604,16 @@
         return E1000_SUCCESS;
     }
 
-    if ((ret_val = em_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1,
-                                     &eeprom_data))) {
+    ret_val = em_read_eeprom(hw, EEPROM_SERDES_AMPLITUDE, 1, &eeprom_data);
+    if (ret_val) {
         return ret_val;
     }
 
     if(eeprom_data != EEPROM_RESERVED_WORD) {
         /* Adjust SERDES output amplitude only. */
         eeprom_data &= EEPROM_SERDES_AMPLITUDE_MASK; 
-        if((ret_val = em_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL,
-                                          eeprom_data)))
+        ret_val = em_write_phy_reg(hw, M88E1000_PHY_EXT_CTRL, eeprom_data);
+        if(ret_val)
             return ret_val;
     }
 
@@ -760,14 +762,16 @@
     if(hw->media_type == em_media_type_fiber)
         signal = (hw->mac_type > em_82544) ? E1000_CTRL_SWDPIN1 : 0;
 
-    if((ret_val = em_adjust_serdes_amplitude(hw)))
+    ret_val = em_adjust_serdes_amplitude(hw);
+    if(ret_val)
         return ret_val;
 
     /* Take the link out of reset */
     ctrl &= ~(E1000_CTRL_LRST);
 
     /* Adjust VCO speed to improve BER performance */
-    if((ret_val = em_set_vco_speed(hw)))
+    ret_val = em_set_vco_speed(hw);
+    if(ret_val)
         return ret_val;
 
     em_config_collision_dist(hw);
@@ -854,7 +858,8 @@
              * we detect a signal. This will allow us to communicate with
              * non-autonegotiating link partners.
              */
-            if((ret_val = em_check_for_link(hw))) {
+            ret_val = em_check_for_link(hw);
+            if(ret_val) {
                 DEBUGOUT("Error while checking for link\n");
                 return ret_val;
             }
@@ -901,12 +906,25 @@
     }
 
     /* Make sure we have a valid PHY */
-    if((ret_val = em_detect_gig_phy(hw))) {
+    ret_val = em_detect_gig_phy(hw);
+    if(ret_val) {
         DEBUGOUT("Error, did not detect valid phy.\n");
         return ret_val;
     }
     DEBUGOUT1("Phy ID = %x \n", hw->phy_id);
 
+    /* Set PHY to class A mode (if necessary) */
+    ret_val = em_set_phy_mode(hw);
+    if(ret_val)
+        return ret_val;
+
+    if((hw->mac_type == em_82545_rev_3) ||
+       (hw->mac_type == em_82546_rev_3)) {
+        ret_val = em_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
+        phy_data |= 0x00000008;
+        ret_val = em_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
+    }
+
     if(hw->mac_type <= em_82543 ||
        hw->mac_type == em_82541 || hw->mac_type == em_82547 ||
        hw->mac_type == em_82541_rev_2 || hw->mac_type == em_82547_rev_2)
@@ -915,7 +933,8 @@
     if(!hw->phy_reset_disable) {
         if (hw->phy_type == em_phy_igp) {
 
-            if((ret_val = em_phy_reset(hw))) {
+            ret_val = em_phy_reset(hw);
+            if(ret_val) {
                 DEBUGOUT("Error Resetting the PHY\n");
                 return ret_val;
             }
@@ -930,14 +949,16 @@
             E1000_WRITE_REG(hw, LEDCTL, led_ctrl);
 
             /* disable lplu d3 during driver init */
-            if((ret_val = em_set_d3_lplu_state(hw, FALSE))) {
+            ret_val = em_set_d3_lplu_state(hw, FALSE);
+            if(ret_val) {
                 DEBUGOUT("Error Disabling LPLU D3\n");
                 return ret_val;
             }
 
             /* Configure mdi-mdix settings */
-            if((ret_val = em_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
-                                             &phy_data)))
+            ret_val = em_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
+                                         &phy_data);
+            if(ret_val)
                 return ret_val;
 
             if((hw->mac_type == em_82541) || (hw->mac_type == em_82547)) {
@@ -964,8 +985,9 @@
                     break;
                 }
             }
-            if((ret_val = em_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
-                                              phy_data)))
+            ret_val = em_write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
+                                          phy_data);
+            if(ret_val)
                 return ret_val;
 
             /* set auto-master slave resolution settings */
@@ -983,27 +1005,28 @@
                  * resolution as hardware default. */
                 if(hw->autoneg_advertised == ADVERTISE_1000_FULL) {
                     /* Disable SmartSpeed */
-                    if((ret_val = em_read_phy_reg(hw,
-                                                    IGP01E1000_PHY_PORT_CONFIG,
-                                                    &phy_data)))
+                    ret_val = em_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+                                                 &phy_data);
+                    if(ret_val)
                         return ret_val;
                     phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
-                    if((ret_val = em_write_phy_reg(hw,
-                                                     IGP01E1000_PHY_PORT_CONFIG,
-                                                     phy_data)))
+                    ret_val = em_write_phy_reg(hw,
+                                                  IGP01E1000_PHY_PORT_CONFIG,
+                                                  phy_data);
+                    if(ret_val)
                         return ret_val;
                     /* Set auto Master/Slave resolution process */
-                    if((ret_val = em_read_phy_reg(hw, PHY_1000T_CTRL,
-                                                     &phy_data)))
+                    ret_val = em_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data);
+                    if(ret_val)
                         return ret_val;
                     phy_data &= ~CR_1000T_MS_ENABLE;
-                    if((ret_val = em_write_phy_reg(hw, PHY_1000T_CTRL,
-                                                      phy_data)))
+                    ret_val = em_write_phy_reg(hw, PHY_1000T_CTRL, phy_data);
+                    if(ret_val)
                         return ret_val;
                 }
 
-                if((ret_val = em_read_phy_reg(hw, PHY_1000T_CTRL,
-                                                 &phy_data)))
+                ret_val = em_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data);
+                if(ret_val)
                     return ret_val;
 
                 /* load defaults for future use */
@@ -1026,14 +1049,15 @@
                 default:
                     break;
                 }
-                if((ret_val = em_write_phy_reg(hw, PHY_1000T_CTRL,
-                                                  phy_data)))
+                ret_val = em_write_phy_reg(hw, PHY_1000T_CTRL, phy_data);
+                if(ret_val)
                     return ret_val;
             }
         } else {
             /* Enable CRS on TX. This must be set for half-duplex operation. */
-            if((ret_val = em_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                             &phy_data)))
+            ret_val = em_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
+                                         &phy_data);
+            if(ret_val)
                 return ret_val;
 
             phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
@@ -1072,15 +1096,17 @@
             phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL;
             if(hw->disable_polarity_correction == 1)
                 phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
-            if((ret_val = em_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                              phy_data)))
+            ret_val = em_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
+                                          phy_data);
+            if(ret_val)
                 return ret_val;
 
             /* Force TX_CLK in the Extended PHY Specific Control Register
              * to 25MHz clock.
              */
-            if((ret_val = em_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
-                                             &phy_data)))
+            ret_val = em_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
+                                         &phy_data);
+            if(ret_val)
                 return ret_val;
 
             phy_data |= M88E1000_EPSCR_TX_CLK_25;
@@ -1091,14 +1117,15 @@
                               M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK);
                 phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
                              M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X);
-                if((ret_val = em_write_phy_reg(hw,
-                                                  M88E1000_EXT_PHY_SPEC_CTRL,
-                                                  phy_data)))
+                ret_val = em_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
+                                              phy_data);
+                if(ret_val)
                     return ret_val;
             }
 
             /* SW Reset the PHY so all changes take effect */
-            if((ret_val = em_phy_reset(hw))) {
+            ret_val = em_phy_reset(hw);
+            if(ret_val) {
                 DEBUGOUT("Error Resetting the PHY\n");
                 return ret_val;
             }
@@ -1132,7 +1159,8 @@
                 hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT;
 
             DEBUGOUT("Reconfiguring auto-neg advertisement params\n");
-            if((ret_val = em_phy_setup_autoneg(hw))) {
+            ret_val = em_phy_setup_autoneg(hw);
+            if(ret_val) {
                 DEBUGOUT("Error Setting up Auto-Negotiation\n");
                 return ret_val;
             }
@@ -1141,18 +1169,21 @@
             /* Restart auto-negotiation by setting the Auto Neg Enable bit and
              * the Auto Neg Restart bit in the PHY control register.
              */
-            if((ret_val = em_read_phy_reg(hw, PHY_CTRL, &phy_data)))
+            ret_val = em_read_phy_reg(hw, PHY_CTRL, &phy_data);
+            if(ret_val)
                 return ret_val;
 
             phy_data |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
-            if((ret_val = em_write_phy_reg(hw, PHY_CTRL, phy_data)))
+            ret_val = em_write_phy_reg(hw, PHY_CTRL, phy_data);
+            if(ret_val)
                 return ret_val;
 
             /* Does the user want to wait for Auto-Neg to complete here, or
              * check at a later time (for example, callback routine).
              */
             if(hw->wait_autoneg_complete) {
-                if((ret_val = em_wait_autoneg(hw))) {
+                ret_val = em_wait_autoneg(hw);
+                if(ret_val) {
                     DEBUGOUT("Error while waiting for autoneg to complete\n");
                     return ret_val;
                 }
@@ -1160,7 +1191,8 @@
             hw->get_link_status = TRUE;
         } else {
             DEBUGOUT("Forcing speed and duplex\n");
-            if((ret_val = em_phy_force_speed_duplex(hw))) {
+            ret_val = em_phy_force_speed_duplex(hw);
+            if(ret_val) {
                 DEBUGOUT("Error Forcing Speed and Duplex\n");
                 return ret_val;
             }
@@ -1171,9 +1203,11 @@
      * valid.
      */
     for(i = 0; i < 10; i++) {
-        if((ret_val = em_read_phy_reg(hw, PHY_STATUS, &phy_data)))
+        ret_val = em_read_phy_reg(hw, PHY_STATUS, &phy_data);
+        if(ret_val)
             return ret_val;
-        if((ret_val = em_read_phy_reg(hw, PHY_STATUS, &phy_data)))
+        ret_val = em_read_phy_reg(hw, PHY_STATUS, &phy_data);
+        if(ret_val)
             return ret_val;
 
         if(phy_data & MII_SR_LINK_STATUS) {
@@ -1188,19 +1222,22 @@
             if(hw->mac_type >= em_82544) {
                 em_config_collision_dist(hw);
             } else {
-                if((ret_val = em_config_mac_to_phy(hw))) {
+                ret_val = em_config_mac_to_phy(hw);
+                if(ret_val) {
                     DEBUGOUT("Error configuring MAC to PHY settings\n");
                     return ret_val;
                 }
             }
-            if((ret_val = em_config_fc_after_link_up(hw))) {
+            ret_val = em_config_fc_after_link_up(hw);
+            if(ret_val) {
                 DEBUGOUT("Error Configuring Flow Control\n");
                 return ret_val;
             }
             DEBUGOUT("Valid link established!!!\n");
 
             if(hw->phy_type == em_phy_igp) {
-                if((ret_val = em_config_dsp_after_link_change(hw, TRUE))) {
+                ret_val = em_config_dsp_after_link_change(hw, TRUE);
+                if(ret_val) {
                     DEBUGOUT("Error Configuring DSP after link up\n");
                     return ret_val;
                 }
@@ -1230,12 +1267,13 @@
     DEBUGFUNC("em_phy_setup_autoneg");
 
     /* Read the MII Auto-Neg Advertisement Register (Address 4). */
-    if((ret_val = em_read_phy_reg(hw, PHY_AUTONEG_ADV,
-                                     &mii_autoneg_adv_reg)))
+    ret_val = em_read_phy_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg);
+    if(ret_val)
         return ret_val;
 
     /* Read the MII 1000Base-T Control Register (Address 9). */
-    if((ret_val = em_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg)))
+    ret_val = em_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg);
+    if(ret_val)
         return ret_val;
 
     /* Need to parse both autoneg_advertised and fc and set up
@@ -1342,13 +1380,14 @@
         return -E1000_ERR_CONFIG;
     }
 
-    if((ret_val = em_write_phy_reg(hw, PHY_AUTONEG_ADV,
-                                      mii_autoneg_adv_reg)))
+    ret_val = em_write_phy_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg);
+    if(ret_val)
         return ret_val;
 
     DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
 
-    if((ret_val = em_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg)))
+    ret_val = em_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg);
+    if(ret_val)
         return ret_val;
 
     return E1000_SUCCESS;
@@ -1387,7 +1426,8 @@
     ctrl &= ~E1000_CTRL_ASDE;
 
     /* Read the MII Control Register. */
-    if((ret_val = em_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg)))
+    ret_val = em_read_phy_reg(hw, PHY_CTRL, &mii_ctrl_reg);
+    if(ret_val)
         return ret_val;
 
     /* We need to disable autoneg in order to force link and duplex. */
@@ -1489,10 +1529,12 @@
             /* Read the MII Status Register and wait for Auto-Neg Complete bit
              * to be set.
              */
-            if((ret_val = em_read_phy_reg(hw, PHY_STATUS, &mii_status_reg)))
+            ret_val = em_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
+            if(ret_val)
                 return ret_val;
 
-            if((ret_val = em_read_phy_reg(hw, PHY_STATUS, &mii_status_reg)))
+            ret_val = em_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
+            if(ret_val)
                 return ret_val;
 
             if(mii_status_reg & MII_SR_LINK_STATUS) break;
@@ -1500,7 +1542,8 @@

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409022111.i82LBfXL000464>