summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-02-24 21:10:15 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-02-24 21:10:15 +0000
commit3a222b827ce3693e6f7bb8634f9e26a8b9215fc4 (patch)
tree97f64ef330aba1934feb719cfe00a7ecf0100db8 /sys/dev
parentd00dc34206321967da73d214bbe089eaf8140fe4 (diff)
The original SiS chips seem to have an bug that marks VLAN tagged packets
with an rx error (SIS_RXSTAT_GIANT) eventhough everything is fine. Change code to clear this error on RX if the size of the packet is smaller then 1532 bytes. From FreeBSD via Brad. Tested on the more common National chips by me. Ok deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_sis.c14
-rw-r--r--sys/dev/pci/if_sisreg.h7
2 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index 5a0c12e71d1..b4e54cbcdbf 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.86 2008/12/04 23:05:32 oga Exp $ */
+/* $OpenBSD: if_sis.c,v 1.87 2009/02/24 21:10:14 claudio Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -1307,9 +1307,13 @@ sis_rxeof(struct sis_softc *sc)
* If an error occurs, update stats, clear the
* status word and leave the mbuf cluster in place:
* it should simply get re-used next time this descriptor
- * comes up in the ring.
+ * comes up in the ring. However, don't report long
+ * frames as errors since they could be VLANs.
*/
- if (!(rxstat & SIS_CMDSTS_PKT_OK)) {
+ if (rxstat & SIS_RXSTAT_GIANT &&
+ total_len <= (ETHER_MAX_DIX_LEN - ETHER_CRC_LEN))
+ rxstat &= ~SIS_RXSTAT_GIANT;
+ if (SIS_RXSTAT_ERROR(rxstat)) {
ifp->if_ierrors++;
if (rxstat & SIS_RXSTAT_COLL)
ifp->if_collisions++;
@@ -1493,10 +1497,10 @@ sis_intr(void *arg)
if (status &
(SIS_ISR_RX_DESC_OK | SIS_ISR_RX_OK |
- SIS_ISR_RX_IDLE))
+ SIS_ISR_RX_ERR | SIS_ISR_RX_IDLE))
sis_rxeof(sc);
- if (status & (SIS_ISR_RX_ERR | SIS_ISR_RX_OFLOW))
+ if (status & SIS_ISR_RX_OFLOW)
sis_rxeoc(sc);
#if 0
diff --git a/sys/dev/pci/if_sisreg.h b/sys/dev/pci/if_sisreg.h
index 771c52309c6..1770a1576ec 100644
--- a/sys/dev/pci/if_sisreg.h
+++ b/sys/dev/pci/if_sisreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sisreg.h,v 1.27 2007/05/28 17:51:26 ckuethe Exp $ */
+/* $OpenBSD: if_sisreg.h,v 1.28 2009/02/24 21:10:14 claudio Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -356,6 +356,11 @@ struct sis_desc {
#define SIS_RXSTAT_OVERRUN 0x02000000
#define SIS_RXSTAT_RX_ABORT 0x04000000
+#define SIS_RXSTAT_ERROR(x) \
+ ((x) & (SIS_RXSTAT_RX_ABORT | SIS_RXSTAT_OVERRUN | \
+ SIS_RXSTAT_GIANT | SIS_RXSTAT_SYMBOLERR | SIS_RXSTAT_RUNT | \
+ SIS_RXSTAT_CRCERR | SIS_RXSTAT_ALIGNERR))
+
#define SIS_DSTCLASS_REJECT 0x00000000
#define SIS_DSTCLASS_UNICAST 0x00800000
#define SIS_DSTCLASS_MULTICAST 0x01000000