From owner-freebsd-tokenring Mon Oct 23 10:12: 9 2000 Delivered-To: freebsd-tokenring@freebsd.org Received: from Draculina.otdel-1.org (Draculina.Otdel-1.ORG [195.230.65.30]) by hub.freebsd.org (Postfix) with ESMTP id 7C6E137B479; Mon, 23 Oct 2000 10:12:05 -0700 (PDT) Received: by Draculina.otdel-1.org (Postfix, from userid 1002) id 7C8001BD; Mon, 23 Oct 2000 21:12:03 +0400 (MSD) Date: Mon, 23 Oct 2000 21:12:03 +0400 From: Nikolai Saoukh To: lile@freebsd.org Cc: freebsd-tokenring@freebsd.org Subject: recent problems with oltr at 4.x-stable Message-ID: <20001023211203.A37445@Draculina.otdel-1.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-tokenring@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG The work memory for trlld was present in wrong time. The patch is below. Spelling corrected too ;-) --- if_oltr.c.orig Tue Oct 10 04:47:12 2000 +++ if_oltr.c Mon Oct 23 20:49:53 2000 @@ -290,5 +290,5 @@ { int i, s, rc = 0, rid, - scratch_size, work_size; + scratch_size; int media = IFM_TOKEN|IFM_TOK_UTP16; u_long command; @@ -340,24 +340,4 @@ } - switch(sc->config.type) { - case TRLLD_ADAPTER_PCI4: /* OC-3139 */ - work_size = 32 * 1024; - break; - case TRLLD_ADAPTER_PCI7: /* OC-3540 */ - work_size = 256; - break; - default: - work_size = 0; - } - - if (work_size) { - if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) { - device_printf(dev, "failed to allocate work memory.\n"); - } else { - TRlldAddMemory(sc->TRlldAdapter, sc->work_memory, - vtophys(sc->work_memory), work_size); - } - } - /* * Allocate RX/TX Pools @@ -546,5 +526,5 @@ oltr_pci_attach(pcici_t config_id, int unit) { - int i, s, rc = 0, scratch_size, work_size; + int i, s, rc = 0, scratch_size; int media = IFM_TOKEN|IFM_TOK_UTP16; u_long command; @@ -601,24 +581,4 @@ } - switch(sc->config.type) { - case TRLLD_ADAPTER_PCI4: /* OC-3139 */ - work_size = 32 * 1024; - break; - case TRLLD_ADAPTER_PCI7: /* OC-3540 */ - work_size = 256; - break; - default: - work_size = 0; - } - - if (work_size) { - if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) { - printf("oltr%d: failed to allocate work memory.\n", unit); - } else { - TRlldAddMemory(sc->TRlldAdapter, sc->work_memory, - vtophys(sc->work_memory), work_size); - } - } - /* * Allocate RX/TX Pools @@ -844,4 +804,5 @@ struct ifmedia *ifm = &sc->ifmedia; int poll = 0, i, rc = 0, s; + int work_size; /* @@ -881,4 +842,24 @@ sc->state = OL_INIT; + switch(sc->config.type) { + case TRLLD_ADAPTER_PCI4: /* OC-3139 */ + work_size = 32 * 1024; + break; + case TRLLD_ADAPTER_PCI7: /* OC-3540 */ + work_size = 256; + break; + default: + work_size = 0; + } + + if (work_size) { + if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) { + printf("oltr%d: failed to allocate work memory (%d octets).\n", sc->unit, work_size); + } else { + TRlldAddMemory(sc->TRlldAdapter, sc->work_memory, + vtophys(sc->work_memory), work_size); + } + } + switch(IFM_SUBTYPE(ifm->ifm_media)) { case IFM_AUTO: @@ -993,5 +974,5 @@ return; default: - printf("oltr%d: unkown open error (%d)\n", sc->unit, rc); + printf("oltr%d: unknown open error (%d)\n", sc->unit, rc); (void)splx(s); return; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-tokenring" in the body of the message