From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mba1S-000149-6L for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:07:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mba1M-000120-VS for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:07:13 -0400 Received: from [199.232.76.173] (port=39897 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mba1M-00010z-6W for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:07:08 -0400 Received: from mail.gmx.net ([213.165.64.20]:42859) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Mba1L-0000Ja-G2 for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:07:07 -0400 Resent-Message-ID: <20090813130703.GB19891@1und1.de> Resent-To: qemu-devel@nongnu.org Date: Thu, 13 Aug 2009 15:06:38 +0200 From: Reimar =?iso-8859-1?Q?D=F6ffinger?= Subject: Re: [Qemu-devel] [PATCH] hw/eepro100.c: Use extended TBD only where applicable Message-ID: <20090813130638.GA19891@1und1.de> References: <4A840090.8050304@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <4A840090.8050304@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Naphtali Sprei On Thu, Aug 13, 2009 at 03:01:20PM +0300, Naphtali Sprei wrote: > I don't feel 100% OK with the "s->device >= i82558B" condition > since it relies on the numeric (hex) value of those defines, which currently > is correct, but changes (which I don't forsee now) might break it. I think it might be best to add a switch (device) to nic_init and set a flag in the device context there. There is other device-dependent stuff that needs to be added to fix some issues, e.g. I have just added this code in order to fix the statistics counters: @@ -1772,6 +1751,23 @@ static void nic_init(PCIDevice *pci_dev, uint32_t device) s = &d->eepro100; s->device = device; s->pci_dev = &d->dev; + s->stats_size = 64; + switch (device) { + case i82551: + break; + case i82557B: + case i82557C: + break; + case i82558B: + s->stats_size = 76; + break; + case i82559C: + case i82559ER: + s->stats_size = 80; + break; + default: + assert(!"Unknown device set"); + } pci_reset(s);