Page 1 of 1

[NE-2000] RTL8029. Problems with both Bochs and QEMU

Posted: Fri Sep 30, 2011 12:41 pm
by Zerith
Hello.
I've recently written a driver for the RTL8029 PCI network card.
I'm having a few problems with Bochs and QEMU:

Bochs:
[+] The driver works great for sending packets.
[+] I ran Wireshark in the host OS and it indeed does see the packets being received.

But when i receive a packet and try to read it off the cards memory, I get all 0xFF's.
I'm pretty much certain that my code is fine because i've compared it to other NE2K drivers and the receiving of packets
and initialization of the card is pretty much the same.

QEMU:
[+] QEMU Emulates the same exact card as Bochs

When i try to send a packet, the controller says its all fine, but I don't get any real traffic (the packet isn't really being sent, i can't see it in Wireshark and i don't get any responses).
I think the problem is with some settings of QEMU that doesn't properly 'connect' to my real network card.


I would be glad if you can help me with any of those problems, thanks in advance.

Re: [NE-2000] RTL8029. Problems with both Bochs and QEMU

Posted: Fri Sep 30, 2011 3:12 pm
by Combuster
I have no personal experience with the NE2000 device, but someone who does will probably want to see the following:

1) what are the values of the registers, which of those did you set manually
2) what are the values after a packet has been received/sent, are they as expected?
3) did you get an interrupt where expected
4) what are the differences between the register values read in qemu and bochs
5) do you have an repository for browsing?

In other words, provide sufficient details so we can reproduce your problem.

Re: [NE-2000] RTL8029. Problems with both Bochs and QEMU

Posted: Sat Oct 01, 2011 1:28 am
by Zerith
Combuster: thank you for your reply.

These are my register values at Bochs and Qemu:
Bochs:
[+] Register values at initialization
Boundary Pointer: 0x10
PSTART: 0x10
PSTOP: 0x77
CURR: 0x10
__NextPacketPtr(local): 0x10 //This is a pointer to the next packet i will read off DMA
[+] Register values after packet is SENT
Boundary Pointer: 0x10
PSTART: 0x10
PSTOP 0x77
CURR: 0x12 //Wtf? i just noticed this now
__NextPacketPtr(local): 0x10
[+] Register values after packet is RECEIVED (before reading it off DMA)
Boundary ptr: 0x10
PSTART: 0x10
PSTOP: 0x77
CURR: 0X12
__NextPacketPtr(local): 0x10

After a packet is sent, the Current page (CURR) register shouldn't be modified as far as i know, so this is weird..
QEMU:
[+] Register values at initialization
Boundary Pointer: 0x10
PSTART: 0x10
PSTOP: 0x77
CURR: 0x10
Next: 0x10
[+] Register values after packet is sent
Boundary Pointer: 0x10
PSTART: 0x10
PSTOP 0x77
CURR: 0x10 //Right how it should be
__NextPacketPtr(local): 0x10

//No values after reception..because there is no reception.

In addition, the packets in Bochs are succesfuly sent because i can view them in Wireshark. I can also view the packets received in response.
In QEMU, the controller indicates successful transmission of packet through an Interrupt.

Re: [NE-2000] RTL8029. Problems with both Bochs and QEMU

Posted: Sat Oct 01, 2011 4:02 am
by Zerith
Alright, I've got QEMU to send and receive packets using a bridge.

So now I've got the same exact problem in QEMU as in Bochs.