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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Zerith
Posts: 14
Joined: Sun Jul 05, 2009 4:01 pm

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

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

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

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Zerith
Posts: 14
Joined: Sun Jul 05, 2009 4:01 pm

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

Post 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.
Zerith
Posts: 14
Joined: Sun Jul 05, 2009 4:01 pm

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

Post 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.
Post Reply