Skip to contentSkip to conversation

e1000 emulation code

PATCH In review Dor Laor 7 participants 10 messages Jan 9, 2008 – Jan 11, 2008 5 messages not in the archive KVM

lore
Share & tools
lore

Dor Laor

author
#0 lore raw

PATCH 1/1 e1000 emulation code

It which supports TCP/UDP and IP transmit checksum, as well as TSO. It has been tested with Linux (2.6.18|22|23|24)++ and Windows XP (using the driver supplied at the intel download site).
Windows Vista recognizes it but there is no traffic.

Checksum calculation is currently naïve and unoptimized (the host kernel does it better). But when working in conjuction to tso the performance is drastically better.

Some figures: Linux rx 350Mbps, tx 150bps, Windows rx 700mbps, tx 100 mbps.

The e1000_hw.h is copied from Linux kernel.
Also attached is the pxe boot option rom that works with netboot.

---
 qemu/Makefile.target |    1 +
 qemu/hw/e1000.c      | 1000 +++++++++++++++
 qemu/hw/e1000_hw.h   | 3411 ++++++++++++++++++++++++++++++++++++++++++++++++++
 qemu/hw/pci.c        |    2 +
 qemu/hw/pci.h        |    4 +
 5 files changed, 4418 insertions(+), 0 deletions(-)
 create mode 100644 qemu/hw/e1000.c
 create mode 100644 qemu/hw/e1000_hw.h
qemu/Makefile.target +1 -0
index bb7be0f..a39662c 100644
@@ -459,6 +459,7 @@ VL_OBJS += eepro100.o
 VL_OBJS += ne2000.o
 VL_OBJS += pcnet.o
 VL_OBJS += rtl8139.o
+VL_OBJS += e1000.o
 
 # PCI Hypercall
 VL_OBJS+= hypercall.o
qemu/hw/e1000.c new file +1000 -0

1,000 lines not on this page · raw message

qemu/hw/e1000_hw.h new file +3411 -0

1,993 lines not on this page · raw message

qemu/hw/pci.c +2 -0
index 545901c..00ddc7c 100644

Lines of this file are not shown. View the raw message.

qemu/hw/pci.h +4 -0
index 96bb213..32d0b99 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.5.3.3

Part of the diff is not shown here. View the raw message.

A message that is not in the archive (sent off-list or not yet received): 1199896975.4382.31.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#2 lore raw
Quoted 1 line

Windows Vista recognizes it but there is no traffic.

I should note, that there is no traffic only with Microsoft's built-in drivers. Vista works with e1000 drivers downloaded from www.intel.com

Additionally, tested Linux 2.4 guest kernel (Mandrake Linux 9.2) and Solaris 10 (U3) guest - they work too...

Signature · 1 line
-Alexey Eremenko "Technologov"

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Dor Laor

It which supports TCP/UDP and IP transmit checksum, as well as TSO. It has been tested with Linux (2.6.18|22|23|24)++ and Windows XP (using the driver supplied at the intel download site).
Windows Vista recognizes it but there is no traffic.

Quoted 8 lines

Checksum calculation is currently naïve and unoptimized (the host kernel does it better). But when working in conjuction to tso the performance is drastically better.

Some figures: Linux rx 350Mbps, tx 150bps, Windows rx 700mbps, tx 100 mbps.

The e1000_hw.h is copied from Linux kernel.
Also attached is the pxe boot option rom that works with netboot.

Nice! I did the trivial port of this to Xen and tested that it works
with both Linux and Windows guests on ia64 (Windows Server 2003 with drivers from intel.com, 2008 with shipped drivers). Port attached below for anyone else that wants to try it. We should definitely pick this up in Xen when it goes upstream too. Thanks,

Alex

Signature · 1 line
Alex Williamson                             HP Open Source & Linux Org.
tools/ioemu/Makefile.target +1 -1
diff -r 15cfd1f8fa38 tools/ioemu/Makefile.target
@@ -399,7 +399,7 @@ VL_OBJS+= usb.o usb-hub.o usb-linux.o us
 VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
 
 # PCI network cards
-VL_OBJS+= ne2000.o rtl8139.o pcnet.o e100.o
+VL_OBJS+= ne2000.o rtl8139.o pcnet.o e100.o e1000.o
 
 ifeq ($(TARGET_BASE_ARCH), i386)
 # Hardware support
tools/ioemu/hw/e1000.c new file +998 -0

998 lines not on this page · raw message

tools/ioemu/hw/e1000_hw.h new file +3411 -0

1,994 lines not on this page · raw message

tools/ioemu/hw/pci.c +2 -0
diff -r 15cfd1f8fa38 tools/ioemu/hw/pci.c

Lines of this file are not shown. View the raw message.

tools/ioemu/vl.h +5 -0
diff -r 15cfd1f8fa38 tools/ioemu/vl.h

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Part of the diff is not shown here. View the raw message.

#4 lore raw
In reply to a message not in the archive
Quoted 1 line · Dor Laor

Some figures: Linux rx 350Mbps, tx 150bps, Windows rx 700mbps, tx 100 mbps.

very nice!

in a related note, the VMWare tools package, which is supposed to 'enhance performance' by installing 'specially tuned' drivers into a guest, doesn't include net or HD drivers for linux! i was surprised, but it simply said that using e1000 emulation on 64bit linux was optimised enough. since i saw good performance (no hard benchmarks, but definitely not bad); i thought that they do some paravirtualizification at runtime as part of their software recompiling (because they're much older than HVM-capable processors).

now it seems that there are higher-level hardware that can be emulated far more efficiently than the original set of QEMU hardware.

the next step would be to emulate LSI SCSI chips, eh?

Signature · 1 line
Javier

A message that is not in the archive (sent off-list or not yet received): 200801092308.46482.javier-796Irmz5ZkZBDgjK7y7TUQ@public.gmane.org

author
#6 lore raw
Quoted 8 lines · Javier Guerra Giraldez
Quoted 1 line · Dor Laor

Some figures: Linux rx 350Mbps, tx 150bps, Windows rx 700mbps, tx 100 mbps.

very nice!

in a related note, the VMWare tools package, which is supposed to 'enhance performance' by installing 'specially tuned' drivers into a guest, doesn't include net or HD drivers for linux! i was surprised, but it simply said

Vmware has a nice trick to online change an emulated amd nic into a pv mode nic.

Quoted 7 lines

that using e1000 emulation on 64bit linux was optimised enough. since i saw good performance (no hard benchmarks, but definitely not bad); i thought that they do some paravirtualizification at runtime as part of their software recompiling (because they're much older than HVM-capable processors).

now it seems that there are higher-level hardware that can be emulated far more efficiently than the original set of QEMU hardware.

This is just a newer device with some coalescing abilities and tso, pv driver can always be better since they are not bound to any specification.

btw: I wonder when qemu will get virtio drivers.

Quoted 3 lines

the next step would be to emulate LSI SCSI chips, eh?

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
In reply to a message not in the archive

Hi,

Quoted 10 lines · Dor Laor

It which supports TCP/UDP and IP transmit checksum, as well as TSO. It has been tested with Linux (2.6.18|22|23|24)++ and Windows XP (using the driver supplied at the intel download site).
Windows Vista recognizes it but there is no traffic.

Checksum calculation is currently naïve and unoptimized (the host kernel does it better). But when working in conjuction to tso the performance is drastically better.

Some figures: Linux rx 350Mbps, tx 150bps, Windows rx 700mbps, tx 100 mbps.

That will be great to have in qemu.

Quoted 2 lines

The e1000_hw.h is copied from Linux kernel.

Would it be possible to pick only the useful stuff from the header and put it into the same file, rather than maintaining a copy of a linux header (which is 3.5 bigger than the actual emulation in kLoC)? Qemu has avoided that until now.

Quoted 2 lines

qemu/hw/e1000.c | 1000 +++++++++++++++
qemu/hw/e1000_hw.h | 3411 ++++++++++++++++++++++++++++++++++++++++++++++++++

Regards.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): fb249edb0801100858h7d91f1d7u3ac6ec67ff7d31ef-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#12 lore raw
Quoted 19 lines · andrzej zaborowski

Hi,

Quoted 11 lines · Dor Laor

It which supports TCP/UDP and IP transmit checksum, as well as TSO. It has been tested with Linux (2.6.18|22|23|24)++ and Windows XP (using the driver supplied at the intel download site).
Windows Vista recognizes it but there is no traffic.

Checksum calculation is currently naïve and unoptimized (the host kernel does it better). But when working in conjuction to tso the performance is drastically better.

Some figures: Linux rx 350Mbps, tx 150bps, Windows rx 700mbps, tx 100 mbps.

That will be great to have in qemu.

Quoted 9 lines
Quoted 2 lines

The e1000_hw.h is copied from Linux kernel.

Would it be possible to pick only the useful stuff from the header and put it into the same file, rather than maintaining a copy of a linux header (which is 3.5 bigger than the actual emulation in kLoC)? Qemu has avoided that until now.

I can but then how can you compile qemu for OS's which do not have Linux/ or linux headers?

Quoted 6 lines
Quoted 3 lines

qemu/hw/e1000.c | 1000 +++++++++++++++
qemu/hw/e1000_hw.h | 3411 ++++++++++++++++++++++++++++++++++++++++++++++++++

Regards.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 4786A66F.1010509-atKUWr5tajBWk0Htik3J/[email protected]

#14 lore raw
Quoted 9 lines · Dor Laor
Quoted 6 lines · andrzej zaborowski

Would it be possible to pick only the useful stuff from the header and put it into the same file, rather than maintaining a copy of a linux header (which is 3.5 bigger than the actual emulation in kLoC)? Qemu has avoided that until now.

I can but then how can you compile qemu for OS's which do not have Linux/ or linux headers?

I don't mean using the Linux header. I mean having all the necessary definitions in e1000.c or a different file but not with 3000 lines of unused definitions.
Regards

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace