summaryrefslogtreecommitdiff
path: root/sys/dev/ic/i82596.c
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2003-01-27 20:03:36 +0000
committerJason Wright <jason@cvs.openbsd.org>2003-01-27 20:03:36 +0000
commit55b3b04ac6260246ce699135a264c70bcddb55a7 (patch)
treed94d6df5267bf97812b0f00ee45f904c539fd0dd /sys/dev/ic/i82596.c
parentebeda1c33db0cbc9e37f74acdcf161a4be321b6e (diff)
pad tx buffer on < minimum length frames; based on NetBSD; tested on hppa.
Diffstat (limited to 'sys/dev/ic/i82596.c')
-rw-r--r--sys/dev/ic/i82596.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c
index d5e28c2592b..6f897ca0854 100644
--- a/sys/dev/ic/i82596.c
+++ b/sys/dev/ic/i82596.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i82596.c,v 1.19 2003/01/07 08:25:23 mickey Exp $ */
+/* $OpenBSD: i82596.c,v 1.20 2003/01/27 20:03:35 jason Exp $ */
/* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */
/*-
@@ -175,6 +175,8 @@ Mode of operation:
#include <dev/ic/i82596reg.h>
#include <dev/ic/i82596var.h>
+static char *padbuf;
+
void i82596_reset(struct ie_softc *, int);
void i82596_watchdog(struct ifnet *);
int i82596_init(struct ie_softc *);
@@ -320,6 +322,16 @@ i82596_attach(sc, name, etheraddr, media, nmedia, defmedia)
ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL);
}
+ if (padbuf == NULL) {
+ padbuf = malloc(ETHER_MIN_LEN - ETHER_CRC_LEN, M_DEVBUF,
+ M_NOWAIT);
+ if (padbuf == NULL) {
+ printf("%s: can't allocate pad buffer\n");
+ return;
+ }
+ bzero(padbuf, ETHER_MIN_LEN - ETHER_CRC_LEN);
+ }
+
/* Attach the interface. */
if_attach(ifp);
ether_ifattach(ifp);
@@ -1273,12 +1285,19 @@ i82596_start(ifp)
buffer += m->m_len;
}
+ len = m0->m_pkthdr.len;
+ if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
+ (sc->memcopyout)(sc, padbuf, buffer,
+ ETHER_MIN_LEN - ETHER_CRC_LEN - len);
+ buffer += ETHER_MIN_LEN - ETHER_CRC_LEN - len;
+ len = ETHER_MIN_LEN - ETHER_CRC_LEN;
+ }
+
#ifdef I82596_DEBUG
if (sc->sc_debug & IED_ENQ)
printf("\n");
#endif
- len = max(m0->m_pkthdr.len, ETHER_MIN_LEN);
m_freem(m0);
/*