summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>1998-12-31 02:35:15 +0000
committerJason Wright <jason@cvs.openbsd.org>1998-12-31 02:35:15 +0000
commit7d641a6b034e26b5804f88053e74c0af90faf0af (patch)
treeec2c75f18ba8964fa3bdac7b9f43ed74a8d961d3 /sys/dev/pci
parent7e848352972602356839b145055f8200b7e94d96 (diff)
Trim CRC off of rx'd packets; freebsd.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_rl.c17
-rw-r--r--sys/dev/pci/if_rlreg.h10
2 files changed, 22 insertions, 5 deletions
diff --git a/sys/dev/pci/if_rl.c b/sys/dev/pci/if_rl.c
index 5f11a9eba49..9d73e342759 100644
--- a/sys/dev/pci/if_rl.c
+++ b/sys/dev/pci/if_rl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rl.c,v 1.9 1998/12/22 04:23:58 jason Exp $ */
+/* $OpenBSD: if_rl.c,v 1.10 1998/12/31 02:35:14 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -31,7 +31,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: if_rl.c,v 1.7 1998/12/14 06:32:55 dillon Exp $
+ * $FreeBSD: if_rl.c,v 1.8 1998/12/24 18:39:48 wpaul Exp $
*/
/*
@@ -698,6 +698,15 @@ static void rl_rxeof(sc)
rx_bytes += total_len + 4;
/*
+ * XXX The RealTek chip includes the CRC with every
+ * received frame, and there's no way to turn this
+ * behavior off (at least, I can't find anything in
+ * the manual that explains how to do it) so we have
+ * to trim off the CRC manually.
+ */
+ total_len -= ETHER_CRC_LEN;
+
+ /*
* Avoid trying to read more bytes than we know
* the chip has prepared for us.
*/
@@ -719,12 +728,12 @@ static void rl_rxeof(sc)
else
m_copyback(m, wrap, total_len - wrap,
sc->rl_cdata.rl_rx_buf);
- cur_rx = (total_len - wrap);
+ cur_rx = (total_len - wrap + ETHER_CRC_LEN);
} else {
m = m_devget(rxbufpos, total_len, 0, ifp, NULL);
if (m == NULL)
ifp->if_ierrors++;
- cur_rx += total_len + 4;
+ cur_rx += total_len + 4 + ETHER_CRC_LEN;
}
/*
diff --git a/sys/dev/pci/if_rlreg.h b/sys/dev/pci/if_rlreg.h
index 069203c3720..d1b89e6e7b7 100644
--- a/sys/dev/pci/if_rlreg.h
+++ b/sys/dev/pci/if_rlreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rlreg.h,v 1.5 1998/12/22 04:23:59 jason Exp $ */
+/* $OpenBSD: if_rlreg.h,v 1.6 1998/12/31 02:35:14 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -552,3 +552,11 @@ struct rl_softc {
#define PHY_BMSR_LINKSTAT 0x0004
#define PHY_BMSR_JABBER 0x0002
#define PHY_BMSR_EXTENDED 0x0001
+
+/*
+ * FreeBSDism
+ */
+#ifndef ETHER_CRC_LEN
+#define ETHER_CRC_LEN 4
+#endif
+