diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-10-09 18:46:45 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-10-09 18:46:45 +0000 |
commit | 4d12400f85ba5fc1e76f23b4fb8735e540bde0a2 (patch) | |
tree | 370e6cedceb1fcf8707c1a37f7ccaba88612bf1a /sys/dev | |
parent | a7cac1597d578bcecbdb951a102a6ac9b672d019 (diff) |
The mickey (/brad) jumbo allocation avoidance patch triggers the same
ami bug "on a particular machine" as the uvm anon change that needed
to be backed out on jul 13.
at least now you are getting close to knowing whether this is a uvm
bug or an ami bug or somewhere else; something starves or cuts memory
up badly enough to cause a big problem.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_bge.c | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index ab8f3236432..554f58055fd 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.186 2006/10/07 23:08:50 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.187 2006/10/09 18:46:44 deraadt Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -591,10 +591,6 @@ bge_alloc_jumbo_mem(struct bge_softc *sc) int i, rseg, state, error; struct bge_jpool_entry *entry; - /* Check to see if Jumbo memory is already allocated */ - if (sc->bge_cdata.bge_jumbo_buf) - return (0); - state = error = 0; /* Grab a big chunk o' storage. */ @@ -647,7 +643,6 @@ bge_alloc_jumbo_mem(struct bge_softc *sc) entry = malloc(sizeof(struct bge_jpool_entry), M_DEVBUF, M_NOWAIT); if (entry == NULL) { - sc->bge_cdata.bge_jumbo_buf = NULL; printf("%s: no memory for jumbo buffer queue!\n", sc->bge_dev.dv_xname); error = ENOBUFS; @@ -1225,7 +1220,6 @@ int bge_blockinit(struct bge_softc *sc) { volatile struct bge_rcb *rcb; - struct ifnet *ifp = &sc->arpcom.ac_if; vaddr_t rcb_addr; int i; bge_hostaddr taddr; @@ -1261,16 +1255,9 @@ bge_blockinit(struct bge_softc *sc) /* Configure mbuf pool watermarks */ /* new Broadcom docs strongly recommend these: */ if (!(BGE_IS_5705_OR_BEYOND(sc))) { - if (ifp->if_mtu > ETHER_MAX_LEN) { - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); - } else { - /* Values from Linux driver... */ - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 304); - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 152); - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 380); - } + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); } else { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10); @@ -1906,6 +1893,16 @@ bge_attach(struct device *parent, struct device *self, void *aux) bzero(sc->bge_rdata, sizeof(struct bge_ring_data)); + /* + * Try to allocate memory for Jumbo buffers. + */ + if (BGE_IS_JUMBO_CAPABLE(sc)) { + if (bge_alloc_jumbo_mem(sc)) { + printf(": jumbo buffer allocation failed\n"); + goto fail_5; + } + } + /* Set default tuneable values. */ sc->bge_stat_ticks = BGE_TICKS_PER_SEC; sc->bge_rx_coal_ticks = 150; @@ -2860,17 +2857,6 @@ bge_init(void *xsc) bge_chipinit(sc); /* - * Try to allocate memory for Jumbo buffers. - */ - if (BGE_IS_JUMBO_CAPABLE(sc) && ifp->if_mtu > ETHERMTU && - bge_alloc_jumbo_mem(sc)) { - printf("%s: jumbo buffer allocation failed\n", - sc->bge_dev.dv_xname); - splx(s); - return; - } - - /* * Init the various state machines, ring * control blocks and firmware. */ @@ -2883,8 +2869,12 @@ bge_init(void *xsc) ifp = &sc->arpcom.ac_if; /* Specify MRU. */ - CSR_WRITE_4(sc, BGE_RX_MTU, ifp->if_mtu + - ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN); + if (BGE_IS_JUMBO_CAPABLE(sc)) + CSR_WRITE_4(sc, BGE_RX_MTU, + BGE_JUMBO_FRAMELEN + ETHER_VLAN_ENCAP_LEN); + else + CSR_WRITE_4(sc, BGE_RX_MTU, + ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN); /* Load our MAC address. */ m = (u_int16_t *)&sc->arpcom.ac_enaddr[0]; @@ -3079,10 +3069,8 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case SIOCSIFMTU: if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) { + else if (ifp->if_mtu != ifr->ifr_mtu) ifp->if_mtu = ifr->ifr_mtu; - bge_init(sc); - } break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { |