Eliminate use of M_HASFCS.

This commit is contained in:
thorpej 2005-01-30 19:03:23 +00:00
parent 0fa67488f7
commit a7ba88252d
4 changed files with 21 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bm.c,v 1.24 2005/01/26 20:51:47 kleink Exp $ */
/* $NetBSD: if_bm.c,v 1.25 2005/01/30 19:13:08 thorpej Exp $ */
/*-
* Copyright (C) 1998, 1999, 2000 Tsubai Masanari. All rights reserved.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.24 2005/01/26 20:51:47 kleink Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.25 2005/01/30 19:13:08 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@ -512,8 +512,11 @@ bmac_rint(v)
/* XXX Sometimes bmac reads one extra byte. */
if (datalen == ETHER_MAX_LEN + 1)
datalen--;
m = bmac_get(sc, data, datalen);
/* Trim the CRC. */
datalen -= ETHER_CRC_LEN;
m = bmac_get(sc, data, datalen);
if (m == NULL) {
ifp->if_ierrors++;
goto next;
@ -682,7 +685,6 @@ bmac_get(sc, pkt, totlen)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
return 0;
m->m_flags |= M_HASFCS;
m->m_pkthdr.rcvif = &sc->sc_if;
m->m_pkthdr.len = totlen;
len = MHLEN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb8795.c,v 1.35 2005/01/19 01:58:21 chs Exp $ */
/* $NetBSD: mb8795.c,v 1.36 2005/01/30 19:10:16 thorpej Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.35 2005/01/19 01:58:21 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.36 2005/01/30 19:10:16 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ccitt.h"
@ -327,8 +327,8 @@ mb8795_rint(struct mb8795_softc *sc)
s = spldma();
while ((m = MBDMA_RX_MBUF (sc))) {
m->m_pkthdr.len = m->m_len;
m->m_flags |= M_HASFCS;
/* CRC is included with the packet; trim it. */
m->m_pkthdr.len = m->m_len = m->m_len - ETHER_CRC_LEN;
m->m_pkthdr.rcvif = ifp;
/* Find receive length, keep crc */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_emac.c,v 1.21 2005/01/21 15:19:09 simonb Exp $ */
/* $NetBSD: if_emac.c,v 1.22 2005/01/30 19:03:23 thorpej Exp $ */
/*
* Copyright 2001, 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.21 2005/01/21 15:19:09 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.22 2005/01/30 19:03:23 thorpej Exp $");
#include "bpfilter.h"
@ -1341,7 +1341,7 @@ emac_rxeob_intr(void *arg)
* No errors; receive the packet. Note, the 405GP emac
* includes the CRC with every packet.
*/
len = sc->sc_rxdescs[i].md_data_len;
len = sc->sc_rxdescs[i].md_data_len - ETHER_CRC_LEN;
/*
* If the packet is small enough to fit in a
@ -1379,7 +1379,6 @@ emac_rxeob_intr(void *arg)
}
ifp->if_ipackets++;
m->m_flags |= M_HASFCS;
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len = len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_mec.c,v 1.3 2004/11/24 17:31:58 tsutsui Exp $ */
/* $NetBSD: if_mec.c,v 1.4 2005/01/30 19:05:56 thorpej Exp $ */
/*
* Copyright (c) 2004 Izumi Tsutsui.
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.3 2004/11/24 17:31:58 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.4 2005/01/30 19:05:56 thorpej Exp $");
#include "opt_ddb.h"
#include "bpfilter.h"
@ -1344,6 +1344,12 @@ mec_rxintr(struct mec_softc *sc)
goto dropit;
}
/*
* The MEC includes the CRC with every packet. Trim
* it off here.
*/
len -= ETHER_CRC_LEN;
/*
* now allocate an mbuf (and possibly a cluster) to hold
* the received packet.
@ -1381,7 +1387,6 @@ mec_rxintr(struct mec_softc *sc)
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len = len;
m->m_flags |= M_HASFCS;
ifp->if_ipackets++;