On Fri, Nov 22, 2013 at 06:47:49PM +0400, Dmitry Smagin wrote: > From: Antony Pavlov <antonynpav...@gmail.com> > > This patch adds emulation of DEC/Intel Tulip 21143 with some external chips: > * Intel LXT971A 10/100 Mbps PHY MII Tranceiver; > * Microchip 93LC46B 1K Microwire Compatible Serial EEPROM. > > Restrictions and TODOs: > - Tulip always work in promisc-mode with no packet filtering > (TODO: check qemu packet filtering interfaces) > > - Address errors in packet descriptors are not checked > > - Tulip is bound to PCI, no other bus is possible for now > (TODO: Rewrite code to permit Tulip to live on buses other than PCI) > > - Internal transceiver is not emulated > The reason: internal transceiver works with 10 Mbps but we need 100Mbps > which only external transceivers can give. > > - Link status is not emulated, it's always ON > (TODO: use standard qemu interface) > > - Incorrect behavior of the Tulip driver is not checked and there's no error > signaling via register CSR5 > > - Only transfer/receive (TI/RI) interrupts are emulated > > - Subsystem IDs in EEPROM image are not good > (TODO: find proper IDs)
The NIC needs to tell QEMU when it transitions from a rx descriptors exhausted state to a rx refilled state. For example, the e1000 NIC calls qemu_flush_queued_packets(qemu_get_queue(s->nic)) when the RDT hardware register is written to by the guest. This is necessary since the netdev (e.g. tap) disables receive when the NIC runs out of rx descriptors. > +static const VMStateDescription vmstate_tulip = { > + .name = "tulip", > + .version_id = 2, > + .minimum_version_id = 1, > + .minimum_version_id_old = 1, > + .fields = (VMStateField[]) { > + VMSTATE_PCI_DEVICE(dev, TulipState), > + VMSTATE_MACADDR(conf.macaddr, TulipState), This looks a little sparse :). Other hardware registers probably need to be saved/loaded too.