summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-09-23 20:03:02 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-09-23 20:03:02 +0000
commit50acd538c77a8bcf4826ddbc719a0c02cc1ba5fb (patch)
tree96f84340e75254461a25c283f5083028ae059475 /sys/dev
parent4383da9eebccf2a26aa760442925195663331d96 (diff)
solve mtu problem a little more elegantly (ramdisk works on blade100 and
u5 now).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/gem.c14
-rw-r--r--sys/dev/ic/gemreg.h7
-rw-r--r--sys/dev/ic/hme.c29
-rw-r--r--sys/dev/ic/hmereg.h8
4 files changed, 24 insertions, 34 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 1291126b92f..a487bc5ed59 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -748,12 +748,8 @@ if (gem_opdebug) printf("in init\n");
/* step 4. TX MAC registers & counters */
gem_init_regs(sc);
- v = ETHERMTU + sizeof(struct ether_header) + 50 +
-#if NVLAN > 0
- EVL_ENCAPLEN +
-#endif
- 0;
- bus_space_write_4(t, h, GEM_MAC_MAC_MAX_FRAME, (v) | (0x2000<<16));
+ v = (GEM_MTU) | (0x2000 << 16) /* Burst size */;
+ bus_space_write_4(t, h, GEM_MAC_MAC_MAX_FRAME, v);
/* step 5. RX MAC registers & counters */
gem_setladrf(sc);
@@ -891,11 +887,7 @@ gem_init_regs(struct gem_softc *sc)
bus_space_write_4(t, h, GEM_MAC_MAC_MIN_FRAME, ETHER_MIN_LEN);
/* Max frame and max burst size */
- v = ((ETHERMTU + sizeof(struct ether_header) + 50 +
-#if NVLAN > 0
- EVL_ENCAPLEN +
-#endif
- 0) | (0x2000<<16) /* Burst size */);
+ v = (GEM_MTU) | (0x2000 << 16) /* Burst size */;
bus_space_write_4(t, h, GEM_MAC_MAC_MAX_FRAME, v);
bus_space_write_4(t, h, GEM_MAC_PREAMBLE_LEN, 0x7);
bus_space_write_4(t, h, GEM_MAC_JAM_SIZE, 0x4);
diff --git a/sys/dev/ic/gemreg.h b/sys/dev/ic/gemreg.h
index ff983484230..53169b9b64a 100644
--- a/sys/dev/ic/gemreg.h
+++ b/sys/dev/ic/gemreg.h
@@ -530,4 +530,11 @@ struct gem_desc {
#define GEM_RD_BUFSHIFT 16
#define GEM_RD_BUFLEN(x) (((x)&GEM_RD_BUFSIZE)>>GEM_RD_BUFSHIFT)
+#ifndef EVL_ENCAPLEN /* defined if NVLAN > 0 */
+#define EVL_ENCAPLEN 0
#endif
+
+#define GEM_MTU \
+ (ETHERMTU + EVL_ENCAPLEN + sizeof(u_int32_t) + sizeof(struct ether_header))
+
+#endif /* _IF_GEMREG_H */
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index 651a6e8c8ca..44c5a83061b 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hme.c,v 1.5 2001/09/20 17:58:33 jason Exp $ */
+/* $OpenBSD: hme.c,v 1.6 2001/09/23 20:03:01 jason Exp $ */
/* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */
/*-
@@ -84,13 +84,13 @@
#include <machine/bus.h>
-#include <dev/ic/hmereg.h>
-#include <dev/ic/hmevar.h>
-
#if NVLAN > 0
#include <net/if_vlan_var.h>
#endif
+#include <dev/ic/hmereg.h>
+#include <dev/ic/hmevar.h>
+
struct cfdriver hme_cd = {
NULL, "hme", DV_IFNET
};
@@ -495,12 +495,7 @@ hme_init(sc)
bus_space_write_4(t, mac, HME_MACI_FCCNT, 0);
bus_space_write_4(t, mac, HME_MACI_EXCNT, 0);
bus_space_write_4(t, mac, HME_MACI_LTCNT, 0);
- v = ETHERMTU + sizeof(struct ether_header) +
-#if NVLAN > 0
- EVL_ENCAPLEN +
-#endif
- 0;
- bus_space_write_4(t, mac, HME_MACI_TXSIZE, v);
+ bus_space_write_4(t, mac, HME_MACI_TXSIZE, HME_MTU);
/* Load station MAC address */
ea = sc->sc_enaddr;
@@ -527,12 +522,7 @@ hme_init(sc)
bus_space_write_4(t, etx, HME_ETXI_RSIZE, sc->sc_rb.rb_ntbuf);
bus_space_write_4(t, erx, HME_ERXI_RING, sc->sc_rb.rb_rxddma);
- v = ETHERMTU + sizeof(struct ether_header) +
-#if NVLAN > 0
- EVL_ENCAPLEN +
-#endif
- 0;
- bus_space_write_4(t, mac, HME_MACI_RXSIZE, v);
+ bus_space_write_4(t, mac, HME_MACI_RXSIZE, HME_MTU);
/* step 8. Global Configuration & Interrupt Mask */
bus_space_write_4(t, seb, HME_SEBI_IMASK,
@@ -737,12 +727,7 @@ hme_read(sc, ix, len)
struct mbuf *m;
if (len <= sizeof(struct ether_header) ||
- (len > ETHERMTU + sizeof(struct ether_header) +
-#if NVLAN > 1
- EVL_ENCAPLEN +
-#endif
- 0
- )) {
+ (len > HME_MTU)) {
#ifdef HMEDEBUG
printf("%s: invalid packet size %d; dropping\n",
sc->sc_dev.dv_xname, len);
diff --git a/sys/dev/ic/hmereg.h b/sys/dev/ic/hmereg.h
index 72cc52e2e3b..31a1fd015ff 100644
--- a/sys/dev/ic/hmereg.h
+++ b/sys/dev/ic/hmereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hmereg.h,v 1.3 2001/09/20 18:36:43 jason Exp $ */
+/* $OpenBSD: hmereg.h,v 1.4 2001/09/23 20:03:01 jason Exp $ */
/* $NetBSD: hmereg.h,v 1.8 2001/04/30 12:22:42 bouyer Exp $ */
/*-
@@ -306,3 +306,9 @@ struct hme_xd {
#define HME_XD_DECODE_TSIZE(flags) \
(((flags) & HME_XD_TXLENMSK) >> 0)
+#ifndef EVL_ENCAPLEN /* defined if NVLAN > 0 */
+#define EVL_ENCAPLEN 0
+#endif
+
+#define HME_MTU \
+ (ETHERMTU + EVL_ENCAPLEN + sizeof(u_int32_t) + sizeof(struct ether_header))