aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1996-08-06 21:14:36 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1996-08-06 21:14:36 +0000
commit26a8b0bf7e0b0c3ed382481b849b7d1d873d460a (patch)
treef630f4ed06a1ba25dccda323532d5e93e6a9d6f3 /sys/dev
parent590dbfbf6a2aa5e142795a422ceaf6ee6e724dea (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ed/if_ed.c13
-rw-r--r--sys/dev/ep/if_epreg.h8
-rw-r--r--sys/dev/fe/if_fe.c31
-rw-r--r--sys/dev/lnc/if_lnc.c3
4 files changed, 16 insertions, 39 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c
index 4b009fe640681..9418e7651ce26 100644
--- a/sys/dev/ed/if_ed.c
+++ b/sys/dev/ed/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/dev/ep/if_epreg.h b/sys/dev/ep/if_epreg.h
index e88a5f0e913d0..37676769a9102 100644
--- a/sys/dev/ep/if_epreg.h
+++ b/sys/dev/ep/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/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c
index 9b0556cd96bec..7648902cb7e4e 100644
--- a/sys/dev/fe/if_fe.c
+++ b/sys/dev/fe/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/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c
index 754a89c0e0be3..abc3b74c645e2 100644
--- a/sys/dev/lnc/if_lnc.c
+++ b/sys/dev/lnc/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>