From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9d574933688b2383b1d5edee3deb7236@quanstro.net> From: erik quanstrom Date: Tue, 31 Mar 2009 08:54:40 -0400 To: 9fans@9fans.net In-Reply-To: <3840643f-ce10-46dc-891a-7a31f6d489c4@l1g2000yqk.googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: Re: [9fans] Latest pull killed my server Topicbox-Message-UUID: ce2b356c-ead4-11e9-9d60-3106f5b1d025 /* compute log10(ether->mbps) into lg */ for(lg = 0, mb = ether->mbps; mb >= 10; lg++) mb /= 10; if (lg > 0) lg--; if (lg > 14) /* 2^(14+17) = 2⁳ⁱ */ lg = 14; /* allocate larger output queues for higher-speed interfaces */ bsz = 1UL << (lg + 17); /* 2ⁱ⁷ = 128K, bsz = 2ⁿ × 128K */ while (bsz > mainmem->maxsize / 8 && bsz > 128*1024) bsz /= 2; netifinit(ether, name, Ntypes, bsz); >> while (ether->oq == nil && bsz > 128*1024) { bsz /= 2; ether->oq = qopen(bsz, Qmsg, 0, 0); ether->limit = bsz; } if(ether->oq == nil) panic("etherreset %s", name); the simple fix would be to change the > on the marked line to >=. but i think the while loop could be tossed since malloc panics on failure and since qopen only allocates sizeof(Queue) regardless of the limit argument. i had this code when i wrote the myricom driver (qio sets q->limit itself). j = ether->mbps; if(j > 1000) j *= 10; for(i = 0; j >= 100; i++) j /= 10; i = (128<oq == nil) ether->oq = qopen(i, Qmsg, 0, 0); if(ether->oq == nil) panic("etherreset %s", name); by the way, a quick scan shows ether2114x etherrhine are capable of setting mbps to 0 on startup. this should be legal, since ethernet can be connected after boot. - erik