summaryrefslogtreecommitdiffstats
path: root/sys/dev/sis
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2008-12-09 04:30:47 +0000
committeryongari <yongari@FreeBSD.org>2008-12-09 04:30:47 +0000
commitfe87e41d4b91dfb3adbee3f606fb0a9811a0eaf3 (patch)
tree7c09670894769b2490373d69ef3c37f53b2d020e /sys/dev/sis
parent0f0a18ff385a40e92c6697f4e97d1ba683582a8c (diff)
downloadFreeBSD-src-fe87e41d4b91dfb3adbee3f606fb0a9811a0eaf3.zip
FreeBSD-src-fe87e41d4b91dfb3adbee3f606fb0a9811a0eaf3.tar.gz
Fix a long standing VLAN tagged frame handling bug.
When VLAN tagged frame is received the hardware sets 'LONG' bit of Rx status word. It is always set when the size of received frame exceeded 1518 bytes, including CRC. This VLAN tagged frame clears 'OK' bit of Rx status word such that driver should not rely on 'OK' bit of Rx status word to pass the VLAN tagged frame to upper stack. To fix the bug, don't use SIS_CMDSTS_PKT_OK for Rx error check and introduce SIS_RXSTAT_ERROR macro that checks Rx errors. If we are configured to accept VLAN tagged frames and the received frame size is less than or equal to maximum allowed length of VLAN tagged frame, clear 'LONG' bit of Rx status word before checking Rx errors. Reported by: Vladimir Ermako < samflanker <> gmail DOT com > Tested by: Vladimir Ermako < samflanker <> gmail DOT com >
Diffstat (limited to 'sys/dev/sis')
-rw-r--r--sys/dev/sis/if_sis.c6
-rw-r--r--sys/dev/sis/if_sisreg.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/sis/if_sis.c b/sys/dev/sis/if_sis.c
index 90cd430..8da95af 100644
--- a/sys/dev/sis/if_sis.c
+++ b/sys/dev/sis/if_sis.c
@@ -1432,7 +1432,11 @@ sis_rxeof(struct sis_softc *sc)
* it should simply get re-used next time this descriptor
* comes up in the ring.
*/
- if (!(rxstat & SIS_CMDSTS_PKT_OK)) {
+ if ((ifp->if_capenable & IFCAP_VLAN_MTU) != 0 &&
+ total_len <= (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN -
+ ETHER_CRC_LEN))
+ rxstat &= ~SIS_RXSTAT_GIANT;
+ if (SIS_RXSTAT_ERROR(rxstat) != 0) {
ifp->if_ierrors++;
if (rxstat & SIS_RXSTAT_COLL)
ifp->if_collisions++;
diff --git a/sys/dev/sis/if_sisreg.h b/sys/dev/sis/if_sisreg.h
index 7f93062..927bd58 100644
--- a/sys/dev/sis/if_sisreg.h
+++ b/sys/dev/sis/if_sisreg.h
@@ -348,6 +348,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
OpenPOWER on IntegriCloud