From 7d641a6b034e26b5804f88053e74c0af90faf0af Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Thu, 31 Dec 1998 02:35:15 +0000 Subject: Trim CRC off of rx'd packets; freebsd. --- sys/dev/pci/if_rl.c | 17 +++++++++++++---- sys/dev/pci/if_rlreg.h | 10 +++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'sys/dev/pci') 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 $ */ /* @@ -697,6 +697,15 @@ static void rl_rxeof(sc) total_len = rxstat >> 16; 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 + -- cgit v1.2.3