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 | |
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')
-rw-r--r-- | sys/i386/isa/if_ed.c | 13 | ||||
-rw-r--r-- | sys/i386/isa/if_eg.c | 6 | ||||
-rw-r--r-- | sys/i386/isa/if_el.c | 5 | ||||
-rw-r--r-- | sys/i386/isa/if_elreg.h | 4 | ||||
-rw-r--r-- | sys/i386/isa/if_epreg.h | 8 | ||||
-rw-r--r-- | sys/i386/isa/if_fe.c | 31 | ||||
-rw-r--r-- | sys/i386/isa/if_ix.c | 14 | ||||
-rw-r--r-- | sys/i386/isa/if_ixreg.h | 18 | ||||
-rw-r--r-- | sys/i386/isa/if_lnc.c | 3 | ||||
-rw-r--r-- | sys/i386/isa/if_ze.c | 7 | ||||
-rw-r--r-- | sys/i386/isa/if_zp.c | 7 | ||||
-rw-r--r-- | sys/i386/isa/if_zpreg.h | 4 |
12 files changed, 34 insertions, 86 deletions
diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index 4b009fe..9418e76 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/if_ed.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ed.c,v 1.101 1996/06/25 20:30:05 bde Exp $ + * $Id: if_ed.c,v 1.102 1996/08/04 10:57:29 phk Exp $ */ /* @@ -325,11 +325,6 @@ static unsigned short ed_790_intr_mask[] = { IRQ15 }; -#define ETHER_MIN_LEN 60 -#define ETHER_MAX_LEN 1514 -#define ETHER_ADDR_LEN 6 -#define ETHER_HDR_SIZE 14 - static struct kern_devconf kdc_ed_template = { 0, 0, 0, /* filled in by dev_attach */ "ed", 0, { MDDT_ISA, 0, "net" }, @@ -1944,7 +1939,7 @@ outloop: goto outloop; } - sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN); + sc->txb_len[sc->txb_new] = max(len, (ETHER_MIN_LEN-ETHER_CRC_LEN)); sc->txb_inuse++; @@ -2020,8 +2015,8 @@ ed_rint(sc) ed_pio_readmem(sc, (int)packet_ptr, (char *) &packet_hdr, sizeof(packet_hdr)); len = packet_hdr.count; - if (len > (ETHER_MAX_LEN + sizeof(struct ed_ring)) || - len < (ETHER_HDR_SIZE + sizeof(struct ed_ring))) { + if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring)) || + len < (ETHER_MIN_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring))) { /* * Length is a wild value. There's a good chance that * this was caused by the NIC being old and buggy. diff --git a/sys/i386/isa/if_eg.c b/sys/i386/isa/if_eg.c index 829a63039..ec21fba 100644 --- a/sys/i386/isa/if_eg.c +++ b/sys/i386/isa/if_eg.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_eg.c,v 1.15 1996/08/04 10:58:16 phk Exp $ + * $Id: if_eg.c,v 1.16 1996/08/04 20:04:11 phk Exp $ * * Support for 3Com 3c505 Etherlink+ card. */ @@ -88,10 +88,6 @@ #define dprintf(x) #endif -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 -#define ETHER_ADDR_LEN 6 - #define EG_INLEN 10 #define EG_BUFLEN 0x0670 diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c index 80c6e4d..9a2e232 100644 --- a/sys/i386/isa/if_el.c +++ b/sys/i386/isa/if_el.c @@ -6,7 +6,7 @@ * * Questions, comments, bug reports and fixes to kimmel@cs.umass.edu. * - * $Id: if_el.c,v 1.23 1996/02/06 18:50:40 wollman Exp $ + * $Id: if_el.c,v 1.24 1996/06/18 01:22:20 bde Exp $ */ /* Except of course for the portions of code lifted from other FreeBSD * drivers (mainly elread, elget and el_ioctl) @@ -64,9 +64,6 @@ #include <i386/isa/isa_device.h> #include <i386/isa/if_elreg.h> -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 - /* For debugging convenience */ #ifdef EL_DEBUG #define dprintf(x) printf x diff --git a/sys/i386/isa/if_elreg.h b/sys/i386/isa/if_elreg.h index f4e8d3b..c8aea65 100644 --- a/sys/i386/isa/if_elreg.h +++ b/sys/i386/isa/if_elreg.h @@ -4,7 +4,7 @@ * of the software, derivative works or modified versions, and any * portions thereof. * - * $Id: if_elreg.h,v 1.2 1994/08/02 07:39:34 davidg Exp $ + * $Id: if_elreg.h,v 1.3 1996/01/30 22:55:41 mpp Exp $ */ /* 3COM Etherlink 3C501 Register Definitions */ @@ -74,5 +74,3 @@ /* Packet buffer size */ #define EL_BUFSIZ 2048 - -#define ETHER_ADDR_LEN 6 diff --git a/sys/i386/isa/if_epreg.h b/sys/i386/isa/if_epreg.h index e88a5f0..3767676 100644 --- a/sys/i386/isa/if_epreg.h +++ b/sys/i386/isa/if_epreg.h @@ -31,7 +31,7 @@ */ /* - * $Id: if_epreg.h,v 1.14 1996/06/14 22:11:38 nate Exp $ + * $Id: if_epreg.h,v 1.15 1996/07/19 13:20:05 amurai Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -107,10 +107,6 @@ struct ep_board { /* * Some global constants */ -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 -#define ETHER_ADDR_LEN 6 - #define TX_INIT_RATE 16 #define TX_INIT_MAX_RATE 64 #define RX_INIT_LATENCY 64 @@ -455,8 +451,6 @@ struct ep_board { #define BNC 0x2 #define UTP 0x4 -#define ETHER_ADDR_LEN 6 -#define ETHER_MAX 1536 #define RX_BYTES_MASK (u_short) (0x07ff) extern struct ep_board ep_board[]; 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++; /* diff --git a/sys/i386/isa/if_ix.c b/sys/i386/isa/if_ix.c index b392fff..2275622 100644 --- a/sys/i386/isa/if_ix.c +++ b/sys/i386/isa/if_ix.c @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_ix.c,v 1.20 1996/06/12 05:03:41 gpalmer Exp $ + * $Id: if_ix.c,v 1.21 1996/06/25 20:30:18 bde Exp $ */ #include "ix.h" @@ -598,8 +598,8 @@ ixattach(struct isa_device *dvp) { ifp->if_ioctl = ixioctl; ifp->if_watchdog = ixwatchdog; ifp->if_type = IFT_ETHER; - ifp->if_addrlen = ETHER_ADDRESS_LENGTH; - ifp->if_hdrlen = ETHER_HEADER_LENGTH; + ifp->if_addrlen = ETHER_ADDR_LEN; + ifp->if_hdrlen = ETHER_HDR_LEN; #ifdef IXCOUNTERS /* * ZZZ more counters added, but bzero gets them @@ -751,7 +751,7 @@ ixinit(int unit) { cb_ias->common.status = 0; cb_ias->common.command = CB_CMD_EL | CB_CMD_IAS; - bcopy(sc->arpcom.ac_enaddr, cb_ias->source, ETHER_ADDRESS_LENGTH); + bcopy(sc->arpcom.ac_enaddr, cb_ias->source, ETHER_ADDR_LEN); scb->command = SCB_CUC_START; ixchannel_attention(unit); status |= ix_cb_wait((cb_t *)cb_ias, "IAS"); @@ -1385,9 +1385,9 @@ ixstart(struct ifnet *ifp) { length += m_temp->m_len; } m_freem(m); - if (length < ETHER_MIN_LENGTH) length = ETHER_MIN_LENGTH; + if (length < ETHER_MIN_LEN) length = ETHER_MIN_LEN; #ifdef DIAGNOSTIC - if (length > ETHER_MAX_LENGTH) { + if (length > ETHER_MAX_LEN) { /* XXX * This should never ever happen, if it does * we probable screwed up all sorts of board data @@ -1396,7 +1396,7 @@ ixstart(struct ifnet *ifp) { * something is real wrong */ printf("ix%d: ixstart: Packet length=%d > MTU=%d\n", - unit, length, ETHER_MAX_LENGTH); + unit, length, ETHER_MAX_LEN); } #endif /* DIAGNOSTIC */ tbd->act_count = TBD_STAT_EOF | length; diff --git a/sys/i386/isa/if_ixreg.h b/sys/i386/isa/if_ixreg.h index 8b2743b..d46011d 100644 --- a/sys/i386/isa/if_ixreg.h +++ b/sys/i386/isa/if_ixreg.h @@ -28,21 +28,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_ixreg.h,v 1.6 1995/05/30 08:02:17 rgrimes Exp $ + * $Id: if_ixreg.h,v 1.7 1996/01/30 22:55:52 mpp Exp $ */ /* * These really belong some place else, but I can't find them right * now. I'll look again latter */ -#define ETHER_ADDRESS_LENGTH 6 /* Length of an ethernet address */ -#define ETHER_HEADER_LENGTH 14 /* Length of an ethernet header */ -#define ETHER_DATA_LENGTH ETHERMTU -#define ETHER_CRC_LENGTH 4 -#define ETHER_MIN_LENGTH 64 /* Minimum length of an ethernet packet */ -#define ETHER_MAX_LENGTH (ETHER_HEADER_LENGTH + \ - ETHERMTU + \ - ETHER_CRC_LENGTH) #define IX_IO_PORTS 16 /* Number of I/O ports used, note * this is not true, due to shadow @@ -134,14 +126,14 @@ #define SCB_ADDR (ISCP_ADDR - sizeof(scb_t)) #define TB_COUNT 3 /* How many transfer buffers in the TFA */ -#define TB_SIZE (ETHER_MAX_LENGTH) /* size of transmit buffer */ +#define TB_SIZE (ETHER_MAX_LEN) /* size of transmit buffer */ #define TFA_START 0x0000 /* Start of the TFA */ #define TFA_SIZE (TB_COUNT * \ (sizeof(cb_transmit_t) + sizeof(tbd_t) + TB_SIZE)) #define RFA_START (TFA_SIZE) #define RFA_SIZE (SCP_ADDR - RFA_START) -#define RB_SIZE (ETHER_MAX_LENGTH) /* size of receive buffer */ +#define RB_SIZE (ETHER_MAX_LEN) /* size of receive buffer */ typedef struct /* System Configuration Pointer */ { @@ -250,7 +242,7 @@ typedef struct /* command block - nop (also the common part of cb's */ typedef struct /* command block - individual address setup command */ { cb_t common; /* common part of all command blocks */ - u_char source[ETHER_ADDRESS_LENGTH]; + u_char source[ETHER_ADDR_LEN]; /* ethernet hardware address */ } cb_ias_t; @@ -269,7 +261,7 @@ typedef struct /* command block - transmit command */ { cb_t common; /* common part of all command blocks */ u_short tbd_offset; /* transmit buffer descriptor offset */ - u_char destination[ETHER_ADDRESS_LENGTH]; + u_char destination[ETHER_ADDR_LEN]; /* ethernet destination address field */ u_short length; /* ethernet length field */ u_char byte[16]; /* XXX stupid fill tell I fix the ixinit diff --git a/sys/i386/isa/if_lnc.c b/sys/i386/isa/if_lnc.c index 754a89c..abc3b74 100644 --- a/sys/i386/isa/if_lnc.c +++ b/sys/i386/isa/if_lnc.c @@ -68,10 +68,7 @@ /* Some defines that should really be in generic locations */ #define FCS_LEN 4 -#define ETHER_ADDR_LEN 6 -#define ETHER_HDR_LEN 14 #define MULTICAST_FILTER_LEN 8 -#define ETHER_MIN_LEN 64 #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/i386/isa/if_ze.c b/sys/i386/isa/if_ze.c index 736b54a..7eb6abe 100644 --- a/sys/i386/isa/if_ze.c +++ b/sys/i386/isa/if_ze.c @@ -47,7 +47,7 @@ */ /* - * $Id: if_ze.c,v 1.31 1996/06/25 20:30:30 bde Exp $ + * $Id: if_ze.c,v 1.32 1996/07/12 04:11:23 bde Exp $ */ #include "ze.h" @@ -173,11 +173,6 @@ struct isa_driver zedriver = { "ze" }; -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 -#define ETHER_ADDR_LEN 6 -#define ETHER_HDR_SIZE 14 - static unsigned char enet_addr[6]; static unsigned char card_info[256]; diff --git a/sys/i386/isa/if_zp.c b/sys/i386/isa/if_zp.c index 0746ee4..9bd47d6 100644 --- a/sys/i386/isa/if_zp.c +++ b/sys/i386/isa/if_zp.c @@ -34,7 +34,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * From: if_ep.c,v 1.9 1994/01/25 10:46:29 deraadt Exp $ - * $Id: if_zp.c,v 1.22 1996/06/25 20:30:34 bde Exp $ + * $Id: if_zp.c,v 1.23 1996/07/12 04:11:24 bde Exp $ */ /*- * TODO: @@ -155,11 +155,6 @@ #include <machine/apm_bios.h> #endif /* NAPM > 0 */ -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 -#define ETHER_ADDR_LEN 6 - - /***************************************************************************** * Driver for Ethernet Adapter * diff --git a/sys/i386/isa/if_zpreg.h b/sys/i386/isa/if_zpreg.h index b036510..72aa736 100644 --- a/sys/i386/isa/if_zpreg.h +++ b/sys/i386/isa/if_zpreg.h @@ -21,7 +21,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_zpreg.h,v 1.2 1995/05/30 08:02:33 rgrimes Exp $ + * $Id: if_zpreg.h,v 1.3 1996/01/30 22:55:55 mpp Exp $ */ /************************************************************************** * * @@ -288,8 +288,6 @@ #define EEPROM_BUSY (1<<15) #define EEPROM_TST_MODE (1<<14) #define READ_EEPROM (1<<7) -#define ETHER_ADDR_LEN 6 -#define ETHER_MAX 1536 #define ENABLE_UTP 0xc0 #define DISABLE_UTP 0x0 #define RX_BYTES_MASK (u_short) (0x07ff) |