qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] ne2000 bug? buffer full/empty


From: Marcel Block
Subject: [Qemu-devel] ne2000 bug? buffer full/empty
Date: Tue, 27 Mar 2007 08:58:44 +0200
User-agent: Icedove 1.5.0.9 (X11/20061220)

Hi qemu-devers,

this is my first post here, so please be kind :-)

i believe i found a bug in qemu's ne2000 code. i'm currently working on a ne2000 driver for my little hobby-os and i'm having some troubles getting it to receive any packets when running on qemu. but it works fine on bochs and on _real_ ne2000-hardware (rtl8029-pci in my case).

i believe the case "current page register == boundary register" should be interpreted as 'buffer empty' instead of 'buffer full'. this was changed last year or so by dr. han zhu, i tried to send him a email but it looks like the email-address he used back then is no longer available.

the current code looks like this: (hw/ne2000.c):
static int ne2000_buffer_full(NE2000State *s)
{
  int avail, index, boundary;

  index = s->curpag << 8;
  boundary = s->boundary << 8;
  if (index <= boundary)
      avail = boundary - index;
  else
      avail = (s->stop - s->start) - (index - boundary);
  if (avail < (MAX_ETH_FRAME_SIZE + 4))
      return 1;
  return 0;
}

that way qemu thinks the buffer is full if index==boundary. if i change the "if(index <= boundary)" back to "if(index < boundary)" my driver appears to work fine.

all the specs i read so far tend to initialize those two registers to the same value. so it appears logical that index==boundary should be interpreted as 'buffer empty'.

i'm waiting for your feedback :-)

best regards,
marcel block




reply via email to

[Prev in Thread] Current Thread [Next in Thread]