qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Block <marcelblock@googlemail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Ne2000 bug?, buffer full/empty
Date: Mon, 26 Mar 2007 20:05:52 +0200	[thread overview]
Message-ID: <46080B80.6030908@gmail.com> (raw)

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	other threads:[~2007-03-26 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 18:05 Marcel Block [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-03-27  6:58 [Qemu-devel] ne2000 bug? buffer full/empty Marcel Block
2007-04-02  1:21 Marcel Block

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46080B80.6030908@gmail.com \
    --to=marcelblock@googlemail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).