PERFORCE change 32666 for review
John Baldwin
jhb at FreeBSD.org
Fri Jun 6 09:58:34 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=32666
Change 32666 by jhb at jhb_laptop on 2003/06/06 09:57:53
IFC @32661.
Affected files ...
.. //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#22 integrate
.. //depot/projects/smpng/sys/amd64/amd64/vm_machdep.c#4 integrate
.. //depot/projects/smpng/sys/amd64/include/param.h#3 integrate
.. //depot/projects/smpng/sys/boot/i386/kgzldr/Makefile#7 integrate
.. //depot/projects/smpng/sys/debugscripts/.gdbinit#1 branch
.. //depot/projects/smpng/sys/debugscripts/gdbinit.i386#1 branch
.. //depot/projects/smpng/sys/debugscripts/gdbinit.kernel#1 branch
.. //depot/projects/smpng/sys/debugscripts/gdbinit.vinum#1 branch
.. //depot/projects/smpng/sys/dev/em/README#7 integrate
.. //depot/projects/smpng/sys/dev/em/if_em.c#22 integrate
.. //depot/projects/smpng/sys/dev/em/if_em.h#14 integrate
.. //depot/projects/smpng/sys/dev/em/if_em_hw.c#9 integrate
.. //depot/projects/smpng/sys/dev/em/if_em_hw.h#9 integrate
.. //depot/projects/smpng/sys/dev/en/midway.c#14 integrate
.. //depot/projects/smpng/sys/dev/exca/excareg.h#4 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewire.c#18 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwmem.c#9 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohci_pci.c#12 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohcireg.h#7 integrate
.. //depot/projects/smpng/sys/dev/firewire/sbp.c#18 integrate
.. //depot/projects/smpng/sys/dev/hifn/hifn7751.c#8 integrate
.. //depot/projects/smpng/sys/dev/hifn/hifn7751var.h#3 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpilib/mpi.h#3 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpilib/mpi_cnfg.h#3 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpilib/mpi_init.h#3 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpilib/mpi_ioc.h#3 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpilib/mpi_raid.h#3 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpt.c#4 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpt.h#3 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpt_freebsd.c#7 integrate
.. //depot/projects/smpng/sys/dev/mpt/mpt_freebsd.h#4 integrate
.. //depot/projects/smpng/sys/dev/pccbb/pccbb.c#29 integrate
.. //depot/projects/smpng/sys/dev/pccbb/pccbbvar.h#9 integrate
.. //depot/projects/smpng/sys/dev/pci/pci.c#25 integrate
.. //depot/projects/smpng/sys/geom/geom.h#29 integrate
.. //depot/projects/smpng/sys/geom/geom_ccd.c#1 branch
.. //depot/projects/smpng/sys/geom/geom_ctl.c#13 integrate
.. //depot/projects/smpng/sys/geom/geom_subr.c#28 integrate
.. //depot/projects/smpng/sys/i386/i386/vm_machdep.c#38 integrate
.. //depot/projects/smpng/sys/i386/include/acpica_machdep.h#3 integrate
.. //depot/projects/smpng/sys/ia64/ia64/mem.c#12 integrate
.. //depot/projects/smpng/sys/ia64/ia64/vm_machdep.c#26 integrate
.. //depot/projects/smpng/sys/kern/init_sysent.c#29 integrate
.. //depot/projects/smpng/sys/kern/kern_thr.c#8 integrate
.. //depot/projects/smpng/sys/kern/kern_thread.c#35 integrate
.. //depot/projects/smpng/sys/kern/kern_timeout.c#11 integrate
.. //depot/projects/smpng/sys/kern/subr_mbuf.c#34 integrate
.. //depot/projects/smpng/sys/kern/syscalls.c#29 integrate
.. //depot/projects/smpng/sys/kern/syscalls.master#28 integrate
.. //depot/projects/smpng/sys/kern/vfs_syscalls.c#57 integrate
.. //depot/projects/smpng/sys/kern/vfs_vnops.c#38 integrate
.. //depot/projects/smpng/sys/kern/vnode_if.src#13 integrate
.. //depot/projects/smpng/sys/modules/geom/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/geom/geom_vol_ffs/Makefile#1 branch
.. //depot/projects/smpng/sys/netinet/ip_dummynet.c#16 integrate
.. //depot/projects/smpng/sys/netinet/ip_fw.h#13 integrate
.. //depot/projects/smpng/sys/netinet/ip_fw2.c#13 integrate
.. //depot/projects/smpng/sys/netinet/tcp_timer.c#12 integrate
.. //depot/projects/smpng/sys/nfsserver/nfs_syscalls.c#17 integrate
.. //depot/projects/smpng/sys/powerpc/powerpc/vm_machdep.c#24 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/vm_machdep.c#31 integrate
.. //depot/projects/smpng/sys/sys/extattr.h#7 integrate
.. //depot/projects/smpng/sys/sys/kse.h#9 integrate
.. //depot/projects/smpng/sys/sys/proc.h#90 integrate
.. //depot/projects/smpng/sys/sys/syscall.h#29 integrate
.. //depot/projects/smpng/sys/sys/syscall.mk#29 integrate
.. //depot/projects/smpng/sys/sys/sysproto.h#31 integrate
.. //depot/projects/smpng/sys/ufs/ffs/ffs_vnops.c#19 integrate
.. //depot/projects/smpng/sys/ufs/ufs/ufs_extattr.c#24 integrate
.. //depot/projects/smpng/sys/vm/vm_object.c#38 integrate
.. //depot/projects/smpng/sys/vm/vm_object.h#20 integrate
.. //depot/projects/smpng/sys/vm/vm_swap.c#23 integrate
Differences ...
==== //depot/projects/smpng/sys/alpha/alpha/vm_machdep.c#22 (text+ko) ====
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $FreeBSD: src/sys/alpha/alpha/vm_machdep.c,v 1.84 2003/04/17 21:57:16 jhb Exp $
+ * $FreeBSD: src/sys/alpha/alpha/vm_machdep.c,v 1.85 2003/06/04 21:13:19 marcel Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -262,7 +262,7 @@
}
void
-cpu_set_upcall(struct thread *td, void *pcb)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
struct pcb *pcb2;
@@ -282,7 +282,7 @@
* at this time (see the matching comment below for
* more analysis) (need a good safe default).
*/
- bcopy(pcb, pcb2, sizeof(*pcb2));
+ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
/*
* Create a new fresh stack for the new thread.
@@ -291,7 +291,7 @@
* The contexts are filled in at the time we actually DO the
* upcall as only then do we know which KSE we got.
*/
- td->td_frame = (struct trapframe *)((caddr_t)pcb2) - 1;
+ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
/*
* Arrange for continuation at fork_return(), which
==== //depot/projects/smpng/sys/amd64/amd64/vm_machdep.c#4 (text+ko) ====
@@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.209 2003/05/23 05:04:54 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.210 2003/06/04 22:46:27 marcel Exp $
*/
#include "opt_isa.h"
@@ -219,7 +219,7 @@
* such as those generated in thread_userret() itself.
*/
void
-cpu_set_upcall(struct thread *td, void *pcb)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
}
==== //depot/projects/smpng/sys/amd64/include/param.h#3 (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.5 2003/05/23 05:04:54 peter Exp $
+ * $FreeBSD: src/sys/amd64/include/param.h,v 1.6 2003/06/04 02:15:13 peter Exp $
*/
/*
@@ -87,7 +87,7 @@
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
-#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER((p),(t))
+#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t)
/* Size of the level 1 page table units */
==== //depot/projects/smpng/sys/boot/i386/kgzldr/Makefile#7 (text+ko) ====
@@ -1,21 +1,25 @@
-# $FreeBSD: src/sys/boot/i386/kgzldr/Makefile,v 1.12 2002/09/30 20:37:57 peter Exp $
+# $FreeBSD: src/sys/boot/i386/kgzldr/Makefile,v 1.13 2003/06/06 13:49:51 kuriyama Exp $
-FILES= kgzldr.o
SRCS= start.s boot.c inflate.c lib.c crt.s sio.s
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
CFLAGS= -ffreestanding
CFLAGS+=-Os
CFLAGS+=-DKZIP
LDFLAGS=-nostdlib -static -r
-BINDIR= /usr/lib
.PATH: ${.CURDIR}/../../../kern
-CLEANFILES=${FILES}
+CLEANFILES=kgzldr.o
BOOT_COMCONSOLE_PORT?= 0x3f8
AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT}
+all: ${OBJS} kgzldr.o
+
kgzldr.o: ${OBJS}
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS}
-.include <bsd.prog.mk>
+realinstall:
+ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ kgzldr.o ${DESTDIR}${LIBDIR}
+
+.include <bsd.lib.mk>
==== //depot/projects/smpng/sys/dev/em/README#7 (text+ko) ====
@@ -1,8 +1,8 @@
-$FreeBSD: src/sys/dev/em/README,v 1.6 2003/03/21 21:47:30 pdeuskar Exp $
+$FreeBSD: src/sys/dev/em/README,v 1.7 2003/06/05 17:51:37 pdeuskar Exp $
FreeBSD* Driver for the Intel(R) PRO/1000 Family of Adapters
============================================================
-February 5, 2003
+April 13, 2003
Contents
@@ -65,6 +65,8 @@
82546 PRO/1000 MF Dual Port Server Adapter A91620-xxx
+ 82546EB PRO/1000 MT Quad Port Server Adapter C11227-xxx
+
To verify your Intel adapter is supported, find the board ID number on the
@@ -126,7 +128,7 @@
cp if_em* /usr/src/sys/dev/em
- cp Makefile /usr/src/sys/modules/em
+ cp Makefile.kernel /usr/src/sys/modules/em/Makefile
Edit the /usr/src/sys/conf/files.i386 file, and add the following lines:
==== //depot/projects/smpng/sys/dev/em/if_em.c#22 (text+ko) ====
@@ -31,7 +31,7 @@
***************************************************************************/
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.25 2003/05/06 03:55:12 des Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.26 2003/06/05 17:51:37 pdeuskar Exp $*/
#include <dev/em/if_em.h>
@@ -51,7 +51,7 @@
* Driver version
*********************************************************************/
-char em_driver_version[] = "1.5.31";
+char em_driver_version[] = "1.6.6";
/*********************************************************************
@@ -87,6 +87,7 @@
{ 0x8086, 0x1018, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, 0x1019, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, 0x101A, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, 0x101D, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, 0x101E, PCI_ANY_ID, PCI_ANY_ID, 0},
/* required last entry */
{ 0, 0, 0, 0, 0}
@@ -158,6 +159,10 @@
static int em_dma_malloc(struct adapter *, bus_size_t,
struct em_dma_alloc *, int);
static void em_dma_free(struct adapter *, struct em_dma_alloc *);
+static void em_print_debug_info(struct adapter *);
+static int em_is_valid_ether_addr(u_int8_t *);
+static int em_sysctl_stats(SYSCTL_HANDLER_ARGS);
+static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS);
/*********************************************************************
* FreeBSD Device Interface Entry Points
@@ -249,6 +254,7 @@
struct adapter * adapter;
int s;
int tsize, rsize;
+ int error = 0;
INIT_DEBUGOUT("em_attach: begin");
s = splimp();
@@ -269,6 +275,31 @@
adapter->next = em_adapter_list;
em_adapter_list = adapter;
+ /* SYSCTL stuff */
+ sysctl_ctx_init(&adapter->sysctl_ctx);
+ adapter->sysctl_tree = SYSCTL_ADD_NODE(&adapter->sysctl_ctx,
+ SYSCTL_STATIC_CHILDREN(_hw),
+ OID_AUTO,
+ device_get_nameunit(dev),
+ CTLFLAG_RD,
+ 0, "");
+ if (adapter->sysctl_tree == NULL) {
+ error = EIO;
+ goto err_sysctl;
+ }
+
+ SYSCTL_ADD_PROC(&adapter->sysctl_ctx,
+ SYSCTL_CHILDREN(adapter->sysctl_tree),
+ OID_AUTO, "debug_info", CTLTYPE_INT|CTLFLAG_RW,
+ (void *)adapter, 0,
+ em_sysctl_debug_info, "I", "Debug Information");
+
+ SYSCTL_ADD_PROC(&adapter->sysctl_ctx,
+ SYSCTL_CHILDREN(adapter->sysctl_tree),
+ OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW,
+ (void *)adapter, 0,
+ em_sysctl_stats, "I", "Statistics");
+
callout_handle_init(&adapter->timer_handle);
callout_handle_init(&adapter->tx_fifo_timer_handle);
@@ -288,9 +319,10 @@
adapter->hw.tbi_compatibility_en = TRUE;
adapter->rx_buffer_len = EM_RXBUFFER_2048;
- /* These parameters control the automatic generation(Tx) and
- * response(Rx) to Ethernet PAUSE frames.
- */
+ /*
+ * These parameters control the automatic generation(Tx) and
+ * response(Rx) to Ethernet PAUSE frames.
+ */
adapter->hw.fc_high_water = FC_DEFAULT_HI_THRESH;
adapter->hw.fc_low_water = FC_DEFAULT_LO_THRESH;
adapter->hw.fc_pause_time = FC_DEFAULT_TX_TIMER;
@@ -319,9 +351,8 @@
if (em_allocate_pci_resources(adapter)) {
printf("em%d: Allocation of PCI resources failed\n",
adapter->unit);
- em_free_pci_resources(adapter);
- splx(s);
- return(ENXIO);
+ error = ENXIO;
+ goto err_pci;
}
@@ -335,9 +366,8 @@
if (em_dma_malloc(adapter, tsize, &adapter->txdma, BUS_DMA_NOWAIT)) {
printf("em%d: Unable to allocate tx_desc memory\n",
adapter->unit);
- em_free_pci_resources(adapter);
- splx(s);
- return(ENOMEM);
+ error = ENOMEM;
+ goto err_tx_desc;
}
adapter->tx_desc_base = (struct em_tx_desc *) adapter->txdma.dma_vaddr;
@@ -348,10 +378,8 @@
if (em_dma_malloc(adapter, rsize, &adapter->rxdma, BUS_DMA_NOWAIT)) {
printf("em%d: Unable to allocate rx_desc memory\n",
adapter->unit);
- em_free_pci_resources(adapter);
- em_dma_free(adapter, &adapter->txdma);
- splx(s);
- return(ENOMEM);
+ error = ENOMEM;
+ goto err_rx_desc;
}
adapter->rx_desc_base = (struct em_rx_desc *) adapter->rxdma.dma_vaddr;
@@ -359,24 +387,24 @@
if (em_hardware_init(adapter)) {
printf("em%d: Unable to initialize the hardware\n",
adapter->unit);
- em_free_pci_resources(adapter);
- em_dma_free(adapter, &adapter->txdma);
- em_dma_free(adapter, &adapter->rxdma);
- splx(s);
- return(EIO);
+ error = EIO;
+ goto err_hw_init;
}
/* Copy the permanent MAC address out of the EEPROM */
if (em_read_mac_addr(&adapter->hw) < 0) {
printf("em%d: EEPROM read error while reading mac address\n",
adapter->unit);
- em_free_pci_resources(adapter);
- em_dma_free(adapter, &adapter->txdma);
- em_dma_free(adapter, &adapter->rxdma);
- splx(s);
- return(EIO);
+ error = EIO;
+ goto err_mac_addr;
}
+ if (!em_is_valid_ether_addr(adapter->hw.mac_addr)) {
+ printf("em%d: Invalid mac address\n", adapter->unit);
+ error = EIO;
+ goto err_mac_addr;
+ }
+
bcopy(adapter->hw.mac_addr, adapter->interface_data.ac_enaddr,
ETHER_ADDR_LEN);
@@ -403,6 +431,20 @@
INIT_DEBUGOUT("em_attach: end");
splx(s);
return(0);
+
+err_mac_addr:
+err_hw_init:
+ em_dma_free(adapter, &adapter->rxdma);
+err_rx_desc:
+ em_dma_free(adapter, &adapter->txdma);
+err_tx_desc:
+err_pci:
+ em_free_pci_resources(adapter);
+ sysctl_ctx_free(&adapter->sysctl_ctx);
+err_sysctl:
+ splx(s);
+ return(error);
+
}
/*********************************************************************
@@ -579,9 +621,13 @@
if (ifp->if_flags & IFF_RUNNING) {
em_disable_intr(adapter);
em_set_multi(adapter);
- if (adapter->hw.mac_type == em_82542_rev2_0)
+ if (adapter->hw.mac_type == em_82542_rev2_0) {
em_initialize_receive_unit(adapter);
- em_enable_intr(adapter);
+ }
+#ifdef DEVICE_POLLING
+ if (!(ifp->if_ipending & IFF_POLLING))
+#endif
+ em_enable_intr(adapter);
}
break;
case SIOCSIFMEDIA:
@@ -787,31 +833,30 @@
}
#endif /* DEVICE_POLLING */
+ reg_icr = E1000_READ_REG(&adapter->hw, ICR);
+ if (!reg_icr) {
+ return;
+ }
- em_disable_intr(adapter);
- while (loop_cnt > 0 &&
- (reg_icr = E1000_READ_REG(&adapter->hw, ICR)) != 0) {
+ /* Link status change */
+ if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
+ untimeout(em_local_timer, adapter,
+ adapter->timer_handle);
+ adapter->hw.get_link_status = 1;
+ em_check_for_link(&adapter->hw);
+ em_print_link_status(adapter);
+ adapter->timer_handle =
+ timeout(em_local_timer, adapter, 2*hz);
+ }
- /* Link status change */
- if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
- untimeout(em_local_timer, adapter,
- adapter->timer_handle);
- adapter->hw.get_link_status = 1;
- em_check_for_link(&adapter->hw);
- em_print_link_status(adapter);
- adapter->timer_handle =
- timeout(em_local_timer, adapter, 2*hz);
- }
-
+ while (loop_cnt > 0) {
if (ifp->if_flags & IFF_RUNNING) {
em_process_receive_interrupts(adapter, -1);
em_clean_transmit_interrupts(adapter);
}
loop_cnt--;
}
-
- em_enable_intr(adapter);
-
+
if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL)
em_start(ifp);
@@ -1915,32 +1960,23 @@
E1000_READ_REG(&adapter->hw, TDBAL),
E1000_READ_REG(&adapter->hw, TDLEN));
-
/* Set the default values for the Tx Inter Packet Gap timer */
switch (adapter->hw.mac_type) {
- case em_82543:
- case em_82544:
- case em_82540:
- case em_82545:
- case em_82546:
- case em_82541:
- case em_82547:
- if (adapter->hw.media_type == em_media_type_fiber)
- reg_tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
- else
- reg_tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
- reg_tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
- reg_tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
- break;
case em_82542_rev2_0:
- case em_82542_rev2_1:
- reg_tipg = DEFAULT_82542_TIPG_IPGT;
- reg_tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
- reg_tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
- break;
- default:
- printf("em%d: Invalid mac type detected\n", adapter->unit);
- }
+ case em_82542_rev2_1:
+ reg_tipg = DEFAULT_82542_TIPG_IPGT;
+ reg_tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
+ reg_tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
+ break;
+ default:
+ if (adapter->hw.media_type == em_media_type_fiber)
+ reg_tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
+ else
+ reg_tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
+ reg_tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
+ reg_tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
+ }
+
E1000_WRITE_REG(&adapter->hw, TIPG, reg_tipg);
E1000_WRITE_REG(&adapter->hw, TIDV, adapter->tx_int_delay);
if(adapter->hw.mac_type >= em_82540)
@@ -2100,6 +2136,7 @@
int i, num_avail;
struct em_buffer *tx_buffer;
struct em_tx_desc *tx_desc;
+ struct ifnet *ifp = &adapter->interface_data.ac_if;
if (adapter->num_tx_desc_avail == adapter->num_tx_desc)
return;
@@ -2120,7 +2157,7 @@
num_avail++;
if (tx_buffer->m_head) {
-
+ ifp->if_opackets++;
bus_dmamap_sync(adapter->txtag, tx_buffer->map,
BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(adapter->txtag, tx_buffer->map);
@@ -2128,7 +2165,6 @@
m_freem(tx_buffer->m_head);
tx_buffer->m_head = NULL;
-
}
if (++i == adapter->num_tx_desc)
@@ -2146,9 +2182,7 @@
* If there are no pending descriptors, clear the timeout. Otherwise,
* if some descriptors have been freed, restart the timeout.
*/
- if (num_avail > EM_TX_CLEANUP_THRESHOLD) {
- struct ifnet *ifp = &adapter->interface_data.ac_if;
-
+ if (num_avail > EM_TX_CLEANUP_THRESHOLD) {
ifp->if_flags &= ~IFF_OACTIVE;
if (num_avail == adapter->num_tx_desc)
ifp->if_timer = 0;
@@ -2535,6 +2569,7 @@
if (eop) {
adapter->fmp->m_pkthdr.rcvif = ifp;
+ ifp->if_ipackets++;
#if __FreeBSD_version < 500000
eh = mtod(adapter->fmp, struct ether_header *);
@@ -2664,6 +2699,18 @@
return;
}
+static int
+em_is_valid_ether_addr(u_int8_t *addr)
+{
+ char zero_addr[6] = { 0, 0, 0, 0, 0, 0 };
+
+ if ((addr[0] & 1) || (!bcmp(addr, zero_addr, ETHER_ADDR_LEN))) {
+ return (FALSE);
+ }
+
+ return(TRUE);
+}
+
void
em_write_pci_cfg(struct em_hw *hw,
uint32_t reg,
@@ -2798,8 +2845,6 @@
ifp = &adapter->interface_data.ac_if;
/* Fill out the OS statistics structure */
- ifp->if_ipackets = adapter->stats.gprc;
- ifp->if_opackets = adapter->stats.gptc;
ifp->if_ibytes = adapter->stats.gorcl;
ifp->if_obytes = adapter->stats.gotcl;
ifp->if_imcasts = adapter->stats.mprc;
@@ -2828,68 +2873,123 @@
*
**********************************************************************/
static void
-em_print_hw_stats(struct adapter *adapter)
+em_print_debug_info(struct adapter *adapter)
{
- int unit = adapter->unit;
+ int unit = adapter->unit;
#ifdef DBG_STATS
- printf("em%d: Packets not Avail = %ld\n", unit,
- adapter->no_pkts_avail);
- printf("em%d: CleanTxInterrupts = %ld\n", unit,
- adapter->clean_tx_interrupts);
+ printf("em%d: Packets not Avail = %ld\n", unit,
+ adapter->no_pkts_avail);
+ printf("em%d: CleanTxInterrupts = %ld\n", unit,
+ 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);
+ printf("em%d: hw tdh = %d, hw tdt = %d\n", unit,
+ E1000_READ_REG(&adapter->hw, TDH),
+ E1000_READ_REG(&adapter->hw, TDT));
+ printf("em%d: Num Tx descriptors avail = %d\n", unit,
+ adapter->num_tx_desc_avail);
+ printf("em%d: Tx Descriptors not avail1 = %ld\n", unit,
+ adapter->no_tx_desc_avail1);
+ printf("em%d: Tx Descriptors not avail2 = %ld\n", unit,
+ adapter->no_tx_desc_avail2);
+ printf("em%d: Std mbuf failed = %ld\n", unit,
+ adapter->mbuf_alloc_failed);
+ printf("em%d: Std mbuf cluster failed = %ld\n", unit,
+ adapter->mbuf_cluster_failed);
+ printf("em%d: Driver dropped packets = %ld\n", unit,
+ adapter->dropped_pkts);
+
+ return;
+}
+
+static void
+em_print_hw_stats(struct adapter *adapter)
+{
+ int unit = adapter->unit;
+
+ printf("em%d: Excessive collisions = %lld\n", unit,
+ (long long)adapter->stats.ecol);
+ printf("em%d: Symbol errors = %lld\n", unit,
+ (long long)adapter->stats.symerrs);
+ printf("em%d: Sequence errors = %lld\n", unit,
+ (long long)adapter->stats.sec);
+ printf("em%d: Defer count = %lld\n", unit,
+ (long long)adapter->stats.dc);
+
+ printf("em%d: Missed Packets = %lld\n", unit,
+ (long long)adapter->stats.mpc);
+ printf("em%d: Receive No Buffers = %lld\n", unit,
+ (long long)adapter->stats.rnbc);
+ printf("em%d: Receive length errors = %lld\n", unit,
+ (long long)adapter->stats.rlec);
+ printf("em%d: Receive errors = %lld\n", unit,
+ (long long)adapter->stats.rxerrc);
+ printf("em%d: Crc errors = %lld\n", unit,
+ (long long)adapter->stats.crcerrs);
+ printf("em%d: Alignment errors = %lld\n", unit,
+ (long long)adapter->stats.algnerrc);
+ printf("em%d: Carrier extension errors = %lld\n", unit,
+ (long long)adapter->stats.cexterr);
- printf("em%d: fifo workaround = %lld, fifo_reset = %lld\n", unit,
- (long long)adapter->tx_fifo_wrk,
- (long long)adapter->tx_fifo_reset);
- printf("em%d: hw tdh = %d, hw tdt = %d\n", unit,
- E1000_READ_REG(&adapter->hw, TDH),
- E1000_READ_REG(&adapter->hw, TDT));
- printf("em%d: Excessive collisions = %lld\n", unit,
- (long long)adapter->stats.ecol);
- printf("em%d: Tx Descriptors not avail1 = %ld\n", unit,
- adapter->no_tx_desc_avail1);
- printf("em%d: Tx Descriptors not avail2 = %ld\n", unit,
- adapter->no_tx_desc_avail2);
+ printf("em%d: XON Rcvd = %lld\n", unit,
+ (long long)adapter->stats.xonrxc);
+ printf("em%d: XON Xmtd = %lld\n", unit,
+ (long long)adapter->stats.xontxc);
+ printf("em%d: XOFF Rcvd = %lld\n", unit,
+ (long long)adapter->stats.xoffrxc);
+ printf("em%d: XOFF Xmtd = %lld\n", unit,
+ (long long)adapter->stats.xofftxc);
+
+ printf("em%d: Good Packets Rcvd = %lld\n", unit,
+ (long long)adapter->stats.gprc);
+ printf("em%d: Good Packets Xmtd = %lld\n", unit,
+ (long long)adapter->stats.gptc);
+
+ return;
+}
- printf("em%d: Symbol errors = %lld\n", unit,
- (long long)adapter->stats.symerrs);
- printf("em%d: Sequence errors = %lld\n", unit,
- (long long)adapter->stats.sec);
- printf("em%d: Defer count = %lld\n", unit,
- (long long)adapter->stats.dc);
+static int
+em_sysctl_debug_info(SYSCTL_HANDLER_ARGS)
+{
+ int error;
+ int result;
+ struct adapter *adapter;
- printf("em%d: Missed Packets = %lld\n", unit,
- (long long)adapter->stats.mpc);
- printf("em%d: Receive No Buffers = %lld\n", unit,
- (long long)adapter->stats.rnbc);
- printf("em%d: Receive length errors = %lld\n", unit,
- (long long)adapter->stats.rlec);
- printf("em%d: Receive errors = %lld\n", unit,
- (long long)adapter->stats.rxerrc);
- printf("em%d: Crc errors = %lld\n", unit,
- (long long)adapter->stats.crcerrs);
- printf("em%d: Alignment errors = %lld\n", unit,
- (long long)adapter->stats.algnerrc);
- printf("em%d: Carrier extension errors = %lld\n", unit,
- (long long)adapter->stats.cexterr);
- printf("em%d: Driver dropped packets = %ld\n", unit,
- adapter->dropped_pkts);
+ result = -1;
+ error = sysctl_handle_int(oidp, &result, 0, req);
- printf("em%d: XON Rcvd = %lld\n", unit,
- (long long)adapter->stats.xonrxc);
- printf("em%d: XON Xmtd = %lld\n", unit,
- (long long)adapter->stats.xontxc);
- printf("em%d: XOFF Rcvd = %lld\n", unit,
- (long long)adapter->stats.xoffrxc);
- printf("em%d: XOFF Xmtd = %lld\n", unit,
- (long long)adapter->stats.xofftxc);
+ if (error || !req->newptr)
+ return (error);
- printf("em%d: Good Packets Rcvd = %lld\n", unit,
- (long long)adapter->stats.gprc);
- printf("em%d: Good Packets Xmtd = %lld\n", unit,
- (long long)adapter->stats.gptc);
+ if (result == 1) {
+ adapter = (struct adapter *)arg1;
+ em_print_debug_info(adapter);
+ }
- return;
+ return error;
}
+
+static int
+em_sysctl_stats(SYSCTL_HANDLER_ARGS)
+{
+ int error;
+ int result;
+ struct adapter *adapter;
+
+ result = -1;
+ error = sysctl_handle_int(oidp, &result, 0, req);
+
+ if (error || !req->newptr)
+ return (error);
+
+ if (result == 1) {
+ adapter = (struct adapter *)arg1;
+ em_print_hw_stats(adapter);
+ }
+
+ return error;
+}
==== //depot/projects/smpng/sys/dev/em/if_em.h#14 (text+ko) ====
@@ -31,7 +31,7 @@
***************************************************************************/
-/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.15 2003/05/03 07:35:47 pdeuskar Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.h,v 1.16 2003/06/05 17:51:38 pdeuskar Exp $*/
#ifndef _EM_H_DEFINED_
#define _EM_H_DEFINED_
@@ -72,6 +72,8 @@
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#include <sys/endian.h>
+#include <sys/proc.h>
+#include <sys/sysctl.h>
#include "opt_bdg.h"
#include <dev/em/if_em_hw.h>
@@ -81,7 +83,7 @@
/*
* TxDescriptors
* Valid Range: 80-256 for 82542 and 82543-based adapters
- * 80-4096 for 82540, 82544, 82545, and 82546-based adapters
+ * 80-4096 for others
* Default Value: 256
* This value is the number of transmit descriptors allocated by the driver.
* Increasing this value allows the driver to queue more transmits. Each
@@ -92,7 +94,7 @@
/*
* RxDescriptors
* Valid Range: 80-256 for 82542 and 82543-based adapters
- * 80-4096 for 82540, 82544, 82545, and 82546-based adapters
+ * 80-4096 for others
* Default Value: 256
* This value is the number of receive descriptors allocated by the driver.
* Increasing this value allows the driver to buffer more incoming packets.
@@ -115,7 +117,7 @@
#define EM_TIDV 64
/*
- * TxAbsIntDelay (82540, 82545, and 82546-based adapters only)
+ * TxAbsIntDelay (Not valid for 82542 and 82543)
* Valid Range: 0-65535 (0=off)
* Default Value: 64
* This value, in units of 1.024 microseconds, limits the delay in which a
@@ -149,7 +151,7 @@
#define EM_RDTR 0
/*
- * RxAbsIntDelay (82540, 82545, and 82546-based adapters only)
+ * RxAbsIntDelay (Not valid for 82542 and 82543)
* Valid Range: 0-65535 (0=off)
* Default Value: 64
* This value, in units of 1.024 microseconds, limits the delay in which a
@@ -198,7 +200,7 @@
* 1 - Wait for autonegotiation to complete
* 0 - Don't wait for autonegotiation to complete
*/
-#define WAIT_FOR_AUTO_NEG_DEFAULT 1
+#define WAIT_FOR_AUTO_NEG_DEFAULT 0
/* Tunables -- End */
@@ -371,6 +373,9 @@
u_int16_t tx_fifo_head;
+ struct sysctl_ctx_list sysctl_ctx;
+ struct sysctl_oid *sysctl_tree;
+
/* Misc stats maintained by the driver */
unsigned long dropped_pkts;
unsigned long mbuf_alloc_failed;
==== //depot/projects/smpng/sys/dev/em/if_em_hw.c#9 (text+ko) ====
@@ -31,11 +31,11 @@
*******************************************************************************/
-/*$FreeBSD: src/sys/dev/em/if_em_hw.c,v 1.8 2003/05/02 21:17:08 pdeuskar Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em_hw.c,v 1.9 2003/06/05 17:51:38 pdeuskar Exp $*/
/* if_em_hw.c
* Shared functions for accessing and configuring the MAC
*/
-
+
#include <dev/em/if_em_hw.h>
static int32_t em_set_phy_type(struct em_hw *hw);
@@ -191,6 +191,7 @@
break;
case E1000_DEV_ID_82546EB_COPPER:
case E1000_DEV_ID_82546EB_FIBER:
+ case E1000_DEV_ID_82546EB_QUAD_COPPER:
hw->mac_type = em_82546;
break;
case E1000_DEV_ID_82541EI:
@@ -260,14 +261,24 @@
/* Must reset the PHY before resetting the MAC */
if((hw->mac_type == em_82541) || (hw->mac_type == em_82547)) {
- E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST));
+ E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_PHY_RST));
msec_delay(5);
}
- if((hw->mac_type > em_82543) && (hw->mac_type != em_82547))
- E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST));
- else
- E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST));
+ switch(hw->mac_type) {
+ case em_82544:
+ case em_82540:
+ case em_82545:
+ case em_82546:
+ case em_82541:
+ /* These controllers can't ack the 64-bit write when issuing the
+ * reset, so use IO-mapping as a workaround to issue the reset */
+ E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST));
+ break;
+ default:
+ E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST));
+ break;
+ }
/* Force a reload from the EEPROM if necessary */
if(hw->mac_type < em_82540) {
@@ -294,9 +305,7 @@
/* Configure activity LED after PHY reset */
led_ctrl = E1000_READ_REG(hw, LEDCTL);
led_ctrl &= IGP_ACTIVITY_LED_MASK;
- led_ctrl |= IGP_ACTIVITY_LED_ENABLE;
- if(hw->mac_type == em_82547)
- led_ctrl |= IGP_LED3_MODE;
+ led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE);
E1000_WRITE_REG(hw, LEDCTL, led_ctrl);
}
@@ -694,7 +703,8 @@
static int32_t
em_setup_copper_link(struct em_hw *hw)
{
- uint32_t ctrl, led_ctrl;
+ uint32_t ctrl;
+ uint32_t led_ctrl;
int32_t ret_val;
uint16_t i;
uint16_t phy_data;
@@ -724,144 +734,146 @@
}
DEBUGOUT1("Phy ID = %x \n", hw->phy_id);
-if (hw->phy_type == em_phy_igp) {
+ if (hw->phy_type == em_phy_igp) {
+
+ ret_val = em_phy_reset(hw);
+ if(ret_val < 0) {
+ DEBUGOUT("Error Resetting the PHY\n");
+ return ret_val;
+ }
- ret_val = em_phy_reset(hw);
- if(ret_val < 0) {
- DEBUGOUT("Error Resetting the PHY\n");
- return ret_val;
- }
+ /* Wait 10ms for MAC to configure PHY from eeprom settings */
+ msec_delay(15);
- /* Wait 10ms for MAC to configure PHY from eeprom settings */
- msec_delay(15);
+ if(em_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0000) < 0) {
+ DEBUGOUT("PHY Write Error\n");
+ return -E1000_ERR_PHY;
+ }
- if(em_write_phy_reg(hw, IGP01E1000_PHY_PAGE_SELECT, 0x0000) < 0) {
- DEBUGOUT("PHY Write Error\n");
- return -E1000_ERR_PHY;
- }
+ /* Configure activity LED after PHY reset */
+ led_ctrl = E1000_READ_REG(hw, LEDCTL);
+ led_ctrl &= IGP_ACTIVITY_LED_MASK;
+ led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE);
+ E1000_WRITE_REG(hw, LEDCTL, led_ctrl);
- /* Configure activity LED after PHY reset */
- led_ctrl = E1000_READ_REG(hw, LEDCTL);
- led_ctrl &= IGP_ACTIVITY_LED_MASK;
- led_ctrl |= IGP_ACTIVITY_LED_ENABLE;
- if(hw->mac_type == em_82547)
- led_ctrl |= IGP_LED3_MODE;
- E1000_WRITE_REG(hw, LEDCTL, led_ctrl);
+ if(hw->autoneg_advertised == ADVERTISE_1000_FULL) {
+ /* Disable SmartSpeed */
+ if(em_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+ &phy_data) < 0) {
+ DEBUGOUT("PHY Read Error\n");
+ return -E1000_ERR_PHY;
+ }
+ phy_data &= ~IGP01E1000_PSCFR_SMART_SPEED;
+ if(em_write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+ phy_data) < 0) {
+ DEBUGOUT("PHY Write Error\n");
+ return -E1000_ERR_PHY;
+ }
+ /* Set auto Master/Slave resolution process */
+ if(em_read_phy_reg(hw, PHY_1000T_CTRL, &phy_data) < 0) {
+ DEBUGOUT("PHY Read Error\n");
+ return -E1000_ERR_PHY;
+ }
+ phy_data &= ~CR_1000T_MS_ENABLE;
+ if(em_write_phy_reg(hw, PHY_1000T_CTRL, phy_data) < 0) {
+ DEBUGOUT("PHY Write Error\n");
+ return -E1000_ERR_PHY;
+ }
+ }
- if(hw->autoneg_advertised == ADVERTISE_1000_FULL) {
- /* Disable SmartSpeed */
- if(em_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data) < 0) {
+ if(em_read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data) < 0) {
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list