diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2008-03-30 14:08:47 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2008-03-30 14:08:47 +0000 |
commit | 1995fc4054f7986a6550f5f144b1628736e45727 (patch) | |
tree | 8e4a9be08c8726feac1f042f82d725ab13c465b3 /sys/dev | |
parent | d977b27b58ebebee5f26f451084235b136651c4a (diff) |
Pad the RXD buffer so that packets are aligned on a 128-byte boundary. This
prevents the chip from hard locking the machine when receiving packets.
Diff committed from an ASUS EeePC using lii(4).
From NetBSD.
ok dlg@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_lii.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c index d41a4bf0ac5..61ddf963aef 100644 --- a/sys/dev/pci/if_lii.c +++ b/sys/dev/pci/if_lii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lii.c,v 1.6 2008/01/05 07:51:04 deraadt Exp $ */ +/* $OpenBSD: if_lii.c,v 1.7 2008/03/30 14:08:46 jsing Exp $ */ /* * Copyright (c) 2007 The NetBSD Foundation. @@ -187,6 +187,9 @@ void atl2_txintr(struct atl2_softc *); #define AT_TXD_BUFFER_SIZE 8192 #define AT_RXD_NUM 64 +/* Pad the RXD buffer so that the packets are on a 128-byte boundary. */ +#define AT_RXD_PADDING 120 + int atl2_match(struct device *parent, void *match, void *aux) { @@ -566,7 +569,8 @@ atl2_init(struct ifnet *ifp) sc->sc_ringmap->dm_segs[0].ds_addr >> 32); */ AT_WRITE_4(sc, ATL2_RXD_BASE_ADDR_LO, - sc->sc_ringmap->dm_segs[0].ds_addr & 0xffffffff); + (sc->sc_ringmap->dm_segs[0].ds_addr & 0xffffffff) + + AT_RXD_PADDING); AT_WRITE_4(sc, ATL2_TXS_BASE_ADDR_LO, sc->sc_txsp & 0xffffffff); AT_WRITE_4(sc, ATL2_TXD_BASE_ADDR_LO, @@ -918,7 +922,8 @@ atl2_alloc_rings(struct atl2_softc *sc) * and only 8kb for transmitting up to 64 Ethernet frames. */ - sc->sc_ringsize = bs = AT_RXD_NUM * sizeof(struct rx_pkt) + sc->sc_ringsize = bs = AT_RXD_PADDING + + AT_RXD_NUM * sizeof(struct rx_pkt) + AT_TXD_NUM * sizeof(struct tx_pkt_status) + AT_TXD_BUFFER_SIZE; @@ -946,9 +951,9 @@ atl2_alloc_rings(struct atl2_softc *sc) goto fail2; } - sc->sc_rxp = (void *)sc->sc_ring; - sc->sc_txs = - (void *)(sc->sc_ring + AT_RXD_NUM * sizeof(struct rx_pkt)); + sc->sc_rxp = (void *)(sc->sc_ring + AT_RXD_PADDING); + sc->sc_txs = (void *)(sc->sc_ring + AT_RXD_PADDING + + AT_RXD_NUM * sizeof(struct rx_pkt)); sc->sc_txdbase = ((char *)sc->sc_txs) + AT_TXD_NUM * sizeof(struct tx_pkt_status); sc->sc_txsp = sc->sc_ringmap->dm_segs[0].ds_addr |