[solved]Qemu Problem with RTL8139 NIC emulation
Posted: Sat Jul 20, 2013 11:50 am
Hi,
I am currently writing a driver for RTL8139 NIC and I'm testing it under qemu. Sending packets seems to work well, but receiving is a bit more problematical. In order to test network under qemu, I have set up a tap device and given it an IPv4 address so as to be able to ping my guest machine from the host. I also use Wireshark to sniff the incoming (and outcoming) packets on the tap. When I ping my guest OS, my tap interface does receive ICMP (and also ARP) packets according to Wireshark. qemu also reacts : I get an interrupt with "Reception OK" flag in the Interrupt Status Register of the NIC. The problem is even though an interrupt has been raised to notify an incoming packet, the whole receive buffer is still filled with zeros (as it was initialized at the OS startup). It seems the receive buffer has not been filled with the incoming bytes.
I know there has been a similar issue on the forum (http://forum.osdev.org/viewtopic.php?f=1&t=26555). However, this has not been solved. There's also another point: I have not only tested my driver on qemu but also on real machine. And on real machine, it worked as expected: it dumped as many incoming packets as I wanted, and the dumped bytes were accurate (I could check it with Wireshark again). The NIC I use on my real PC is a RTL8139C. So maybe my driver is not compatible with all the variants of the RTL8139, and in particular not compatible with the version emulated by qemu... But this last assumption is hard to check and I hope there's a simpler explanation.
What do you think about it ?
Thanks in advance.
I am currently writing a driver for RTL8139 NIC and I'm testing it under qemu. Sending packets seems to work well, but receiving is a bit more problematical. In order to test network under qemu, I have set up a tap device and given it an IPv4 address so as to be able to ping my guest machine from the host. I also use Wireshark to sniff the incoming (and outcoming) packets on the tap. When I ping my guest OS, my tap interface does receive ICMP (and also ARP) packets according to Wireshark. qemu also reacts : I get an interrupt with "Reception OK" flag in the Interrupt Status Register of the NIC. The problem is even though an interrupt has been raised to notify an incoming packet, the whole receive buffer is still filled with zeros (as it was initialized at the OS startup). It seems the receive buffer has not been filled with the incoming bytes.
I know there has been a similar issue on the forum (http://forum.osdev.org/viewtopic.php?f=1&t=26555). However, this has not been solved. There's also another point: I have not only tested my driver on qemu but also on real machine. And on real machine, it worked as expected: it dumped as many incoming packets as I wanted, and the dumped bytes were accurate (I could check it with Wireshark again). The NIC I use on my real PC is a RTL8139C. So maybe my driver is not compatible with all the variants of the RTL8139, and in particular not compatible with the version emulated by qemu... But this last assumption is hard to check and I hope there's a simpler explanation.
What do you think about it ?
Thanks in advance.