bzero the part of the buffer used to pad the packet to
ETHER_MIN_LEN - ETHER_CRC_LEN.
This commit is contained in:
parent
1299d1b74c
commit
4bce909c04
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ie.c,v 1.10 2002/10/02 03:31:59 thorpej Exp $ */
|
||||
/* $NetBSD: if_ie.c,v 1.11 2003/01/20 14:59:27 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Melvin Tang-Richardson.
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: if_ie.c,v 1.10 2002/10/02 03:31:59 thorpej Exp $");
|
||||
__RCSID("$NetBSD: if_ie.c,v 1.11 2003/01/20 14:59:27 bouyer Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -1552,8 +1552,12 @@ iestart(ifp)
|
||||
#endif
|
||||
|
||||
m_freem(m0);
|
||||
len = max(len, ETHER_MIN_LEN);
|
||||
|
||||
if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
|
||||
memset(buffer, 0, ETHER_MIN_LEN - ETHER_CRC_LEN - len);
|
||||
len = ETHER_MIN_LEN - ETHER_CRC_LEN;
|
||||
buffer += ETHER_MIN_LEN - ETHER_CRC_LEN;
|
||||
}
|
||||
|
||||
/* When we write directly to the card we dont need this */
|
||||
if (len&1)
|
||||
host2ie(sc, txbuf, sc->xmit_cbuffs[sc->xchead], len+1 );
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ed.c,v 1.42 2003/01/06 13:04:58 wiz Exp $ */
|
||||
/* $NetBSD: if_ed.c,v 1.43 2003/01/20 15:00:38 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
|
||||
@ -19,7 +19,7 @@
|
||||
#include "opt_ns.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ed.c,v 1.42 2003/01/06 13:04:58 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ed.c,v 1.43 2003/01/20 15:00:38 bouyer Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -124,6 +124,7 @@ static inline caddr_t ed_ring_copy(struct ed_softc *, caddr_t, caddr_t,
|
||||
static inline void NIC_PUT(struct ed_softc *, int, u_char);
|
||||
static inline u_char NIC_GET(struct ed_softc *, int);
|
||||
static inline void word_copy(caddr_t, caddr_t, int);
|
||||
static inline void word_zero(caddr_t, int);
|
||||
struct mbuf *ed_ring_to_mbuf(struct ed_softc *, caddr_t, struct mbuf *,
|
||||
u_short);
|
||||
|
||||
@ -175,6 +176,19 @@ word_copy(caddr_t a, caddr_t b, int len)
|
||||
*y++ = *x++;
|
||||
}
|
||||
|
||||
/*
|
||||
* zero memory, one word at time.
|
||||
*/
|
||||
static inline void
|
||||
word_zero(caddr_t a, int len)
|
||||
{
|
||||
u_short *x = (u_short *)a;
|
||||
|
||||
len >>= 1;
|
||||
while (len--)
|
||||
*x++ = 0;
|
||||
}
|
||||
|
||||
int
|
||||
ed_zbus_match(struct device *parent, struct cfdata *cfp, void *aux)
|
||||
{
|
||||
@ -524,7 +538,7 @@ outloop:
|
||||
|
||||
len = ed_put(sc, m, buffer);
|
||||
|
||||
sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
|
||||
sc->txb_len[sc->txb_new] = len;
|
||||
sc->txb_inuse++;
|
||||
|
||||
/* Point to next buffer slot and wrap if necessary. */
|
||||
@ -1196,6 +1210,10 @@ ed_put(struct ed_softc *sc, struct mbuf *m, caddr_t buf)
|
||||
word_copy(savebyte, buf, 2);
|
||||
buf += 2;
|
||||
}
|
||||
if (totlen < ETHER_MIN_LEN - ETHER_CRC_LEN) {
|
||||
word_zero(buf, totlen < ETHER_MIN_LEN - ETHER_CRC_LEN);
|
||||
totlen = ETHER_MIN_LEN - ETHER_CRC_LEN;
|
||||
}
|
||||
|
||||
return (totlen);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_xe.c,v 1.11 2002/10/02 04:22:52 thorpej Exp $ */
|
||||
/* $NetBSD: if_xe.c,v 1.12 2003/01/20 15:01:44 bouyer Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1998 Darrin B. Jewell
|
||||
* All rights reserved.
|
||||
@ -501,11 +501,6 @@ xe_dma_tx_mbuf (sc, m)
|
||||
|
||||
buflen = m->m_pkthdr.len;
|
||||
|
||||
/* Fix runt packets, @@@ memory overrun */
|
||||
if (buflen < ETHERMIN+sizeof(struct ether_header)) {
|
||||
buflen = ETHERMIN+sizeof(struct ether_header);
|
||||
}
|
||||
|
||||
{
|
||||
u_char *p = buf;
|
||||
for (m=xsc->sc_tx_mb_head; m; m = m->m_next) {
|
||||
@ -513,6 +508,12 @@ xe_dma_tx_mbuf (sc, m)
|
||||
bcopy(mtod(m, u_char *), p, m->m_len);
|
||||
p += m->m_len;
|
||||
}
|
||||
/* Fix runt packets */
|
||||
if (buflen < ETHER_MIN_LEN - ETHER_CRC_LEN) {
|
||||
memset(p, 0,
|
||||
ETHER_MIN_LEN - ETHER_CRC_LEN - buflen);
|
||||
buflen = ETHER_MIN_LEN - ETHER_CRC_LEN;
|
||||
}
|
||||
}
|
||||
|
||||
error = bus_dmamap_load(xsc->sc_txdma->sc_dmat, xsc->sc_tx_dmamap,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ec.c,v 1.6 2002/10/02 16:02:22 thorpej Exp $ */
|
||||
/* $NetBSD: if_ec.c,v 1.7 2003/01/20 15:03:03 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -325,7 +325,7 @@ ec_start(ifp)
|
||||
struct ec_softc *sc = ifp->if_softc;
|
||||
struct mbuf *m, *m0;
|
||||
int s;
|
||||
u_int count;
|
||||
u_int count, realcount;
|
||||
bus_size_t off;
|
||||
|
||||
s = splnet();
|
||||
@ -353,11 +353,16 @@ ec_start(ifp)
|
||||
count -= m->m_len;
|
||||
|
||||
/* Copy the packet into the xmit buffer. */
|
||||
count = MIN(count, EC_PKT_MAXTDOFF);
|
||||
bus_space_write_2(sc->sc_iot, sc->sc_ioh, ECREG_TBUF, count);
|
||||
for (off = count, m = m0; m != 0; off += m->m_len, m = m->m_next)
|
||||
realcount = MIN(count, EC_PKT_MAXTDOFF);
|
||||
bus_space_write_2(sc->sc_iot, sc->sc_ioh, ECREG_TBUF, realcount);
|
||||
for (off = realcount, m = m0; m != 0; off += m->m_len, m = m->m_next)
|
||||
ec_copyout(sc, mtod(m, u_int8_t *), ECREG_TBUF + off, m->m_len);
|
||||
m_freem(m0);
|
||||
#if 0
|
||||
bus_space_set_region_1(sc->sc_iot, sc->sc_ioh, ECREG_TBUF + off, 0,
|
||||
count - realcount);
|
||||
#endif
|
||||
w16zero((u_int8_t *)(ECREG_TBUF + off), count - realcount);
|
||||
|
||||
/* Enable the transmitter. */
|
||||
ECREG_CSR_WR((ECREG_CSR_RD & EC_CSR_PA) | EC_CSR_TBSW | EC_CSR_TINT | EC_CSR_JINT);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ie.c,v 1.37 2001/09/05 13:55:27 tsutsui Exp $ */
|
||||
/* $NetBSD: if_ie.c,v 1.38 2003/01/20 15:03:45 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
|
||||
@ -1121,7 +1121,12 @@ iestart(ifp)
|
||||
(sc->sc_memcpy)(buffer, mtod(m, caddr_t), m->m_len);
|
||||
buffer += m->m_len;
|
||||
}
|
||||
len = max(m0->m_pkthdr.len, ETHER_MIN_LEN);
|
||||
if (m0->m_pkthdr.len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
|
||||
sc->sc_memset(buffer, 0,
|
||||
ETHER_MIN_LEN - ETHER_CRC_LEN - m0->m_pkthdr.len);
|
||||
len = ETHER_MIN_LEN - ETHER_CRC_LEN;
|
||||
} else
|
||||
len = m0->m_pkthdr.len;
|
||||
|
||||
m_freem(m0);
|
||||
sc->xmit_buffs[sc->xchead]->ie_xmit_flags = SWAP(len);
|
||||
|
Loading…
Reference in New Issue
Block a user