diff options
author | phk <phk@FreeBSD.org> | 1996-08-06 21:14:36 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1996-08-06 21:14:36 +0000 |
commit | 5ac19ff3ee101aa4e4a4b1116882a4b5e5a11161 (patch) | |
tree | f630f4ed06a1ba25dccda323532d5e93e6a9d6f3 /sys/i386/isa/if_fe.c | |
parent | 954270700febe9302cf12727a332d854d9b4188e (diff) | |
download | FreeBSD-src-5ac19ff3ee101aa4e4a4b1116882a4b5e5a11161.zip FreeBSD-src-5ac19ff3ee101aa4e4a4b1116882a4b5e5a11161.tar.gz |
Megacommit to straigthen out ETHER_ mess.
I'm pretty convinced after looking at this that the majority of our
drivers are confused about the in/exclusion of ETHER_CRC_LEN :-(
Diffstat (limited to 'sys/i386/isa/if_fe.c')
-rw-r--r-- | sys/i386/isa/if_fe.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/sys/i386/isa/if_fe.c b/sys/i386/isa/if_fe.c index 9b0556c..7648902 100644 --- a/sys/i386/isa/if_fe.c +++ b/sys/i386/isa/if_fe.c @@ -21,7 +21,7 @@ */ /* - * $Id: if_fe.c,v 1.15 1996/06/12 05:03:40 gpalmer Exp $ + * $Id: if_fe.c,v 1.16 1996/06/18 01:22:21 bde Exp $ * * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. * To be used with FreeBSD 2.x @@ -272,14 +272,6 @@ static void fe_loadmar ( struct fe_softc * ); static void fe_dump ( int, struct fe_softc *, char * ); #endif -/* Ethernet constants. To be defined in if_ehter.h? FIXME. */ -#define ETHER_MIN_LEN 60 /* with header, without CRC. */ -#define ETHER_MAX_LEN 1514 /* with header, without CRC. */ -#define ETHER_ADDR_LEN 6 /* number of bytes in an address. */ -#define ETHER_TYPE_LEN 2 /* number of bytes in a data type field. */ -#define ETHER_HDR_SIZE 14 /* src addr, dst addr, and data type. */ -#define ETHER_CRC_LEN 4 /* number of bytes in CRC field. */ - /* Driver struct used in the config code. This must be public (external.) */ struct isa_driver fedriver = { @@ -1826,7 +1818,7 @@ fe_start ( struct ifnet *ifp ) * (i.e., minimum packet sized) packets rapidly. An 8KB * buffer can hold 130 blocks of 62 bytes long... */ - if ( sc->txb_free < ETHER_MAX_LEN + FE_DATA_LEN_LEN ) { + if ( sc->txb_free < ETHER_MAX_LEN - ETHER_CRC_LEN + FE_DATA_LEN_LEN ) { /* No room. */ goto indicate_active; } @@ -2125,12 +2117,12 @@ fe_rint ( struct fe_softc * sc, u_char rstat ) * * Is this statement true? FIXME. */ - if ( len > ETHER_MAX_LEN || len < ETHER_HDR_SIZE ) { + if ( len > ETHER_MAX_LEN - ETHER_CRC_LEN || len < ETHER_MIN_LEN- ETHER_CRC_LEN ) { #if FE_DEBUG >= 2 log( LOG_WARNING, "fe%d: received a %s packet? (%u bytes)\n", sc->sc_unit, - len < ETHER_HDR_SIZE ? "partial" : "big", + len < ETHER_MIN_SIZE- ETHER_CRC_SIZE ? "partial" : "big", len ); #endif sc->sc_if.if_ierrors++; @@ -2145,7 +2137,7 @@ fe_rint ( struct fe_softc * sc, u_char rstat ) * if it carries data for upper layer. */ #if FE_DEBUG >= 2 - if ( len < ETHER_MIN_LEN ) { + if ( len < ETHER_MIN_LEN - ETHER_CRC_LEN) { log( LOG_WARNING, "fe%d: received a short packet? (%u bytes)\n", sc->sc_unit, len ); @@ -2505,7 +2497,7 @@ fe_get_packet ( struct fe_softc * sc, u_short len ) * however. If the following #error message were printed upon * compile, you need to rewrite this function. */ -#if ( MCLBYTES < ETHER_MAX_LEN + NFS_MAGIC_OFFSET ) +#if ( MCLBYTES < ETHER_MAX_LEN - ETHER_CRC_LEN + NFS_MAGIC_OFFSET ) #error "Too small MCLBYTES to use fe driver." #endif @@ -2658,11 +2650,10 @@ fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) * it should be a bug of upper layer. We just ignore it. * ... Partial (too short) packets, neither. */ - if ( length > ETHER_MAX_LEN || length < ETHER_HDR_SIZE ) { + if ( ETHER_IS_VALID_LEN(length + ETHER_CRC_LEN)) { log( LOG_ERR, - "fe%d: got a %s packet (%u bytes) to send\n", - sc->sc_unit, - length < ETHER_HDR_SIZE ? "partial" : "big", length ); + "fe%d: got a out-of-spes packet (%u bytes) to send\n", + sc->sc_unit, length ); sc->sc_if.if_oerrors++; return; } @@ -2676,14 +2667,14 @@ fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) * packet in the transmission buffer, we can skip the * padding process. It may gain performance slightly. FIXME. */ - outw( addr_bmpr8, max( length, ETHER_MIN_LEN ) ); + outw( addr_bmpr8, max( length, ETHER_MIN_LEN - ETHER_CRC_LEN ) ); /* * Update buffer status now. * Truncate the length up to an even number, since we use outw(). */ length = ( length + 1 ) & ~1; - sc->txb_free -= FE_DATA_LEN_LEN + max( length, ETHER_MIN_LEN ); + sc->txb_free -= FE_DATA_LEN_LEN + max( length, ETHER_MIN_LEN - ETHER_CRC_LEN); sc->txb_count++; /* |