diff options
| author | Stefan Hajnoczi | 2010-07-02 20:15:47 +0200 |
|---|---|---|
| committer | Michael Brown | 2010-07-17 18:07:14 +0200 |
| commit | e4419ff97cdc6cf69c251ef1f768274f0a71c9d0 (patch) | |
| tree | d079c3c2255de618df612a7c6841a3c3ae81e80f /src/include/ipxe/virtio-ring.h | |
| parent | [errcode] Remove unused contrib/errcode scripts (diff) | |
| download | ipxe-e4419ff97cdc6cf69c251ef1f768274f0a71c9d0.tar.gz ipxe-e4419ff97cdc6cf69c251ef1f768274f0a71c9d0.tar.xz ipxe-e4419ff97cdc6cf69c251ef1f768274f0a71c9d0.zip | |
[virtio] Replace virtio-net with native iPXE driver
This patch adds a native iPXE virtio-net driver and removes the legacy
Etherboot virtio-net driver. The main reasons for doing this are:
1. Multiple virtio-net NICs are now supported by iPXE. The legacy
driver kept global state and caused issues in virtual machines with
more than one virtio-net device.
2. Faster downloads. The native iPXE driver downloads 100 MB over
HTTP in 12s, the legacy Etherboot driver in 37s. This simple
benchmark uses KVM with tap networking and the Python
SimpleHTTPServer both running on the same host.
Changes to core virtio code reduce vring descriptors to 256 (QEMU uses
128 for virtio-blk and 256 for virtio-net) and change the opaque token
from u16 to void*. Lowering the descriptor count reduces memory
consumption. The void* opaque token change makes driver code simpler.
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/virtio-ring.h')
| -rw-r--r-- | src/include/ipxe/virtio-ring.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/ipxe/virtio-ring.h b/src/include/ipxe/virtio-ring.h index e96dd371d..0afe8bab7 100644 --- a/src/include/ipxe/virtio-ring.h +++ b/src/include/ipxe/virtio-ring.h @@ -14,7 +14,7 @@ /* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80 -#define MAX_QUEUE_NUM (512) +#define MAX_QUEUE_NUM (256) #define VRING_DESC_F_NEXT 1 #define VRING_DESC_F_WRITE 2 @@ -71,7 +71,7 @@ struct vring_virtqueue { struct vring vring; u16 free_head; u16 last_used_idx; - u16 vdata[MAX_QUEUE_NUM]; + void *vdata[MAX_QUEUE_NUM]; /* PCI */ int queue_index; }; @@ -133,10 +133,10 @@ static inline int vring_more_used(struct vring_virtqueue *vq) } void vring_detach(struct vring_virtqueue *vq, unsigned int head); -int vring_get_buf(struct vring_virtqueue *vq, unsigned int *len); +void *vring_get_buf(struct vring_virtqueue *vq, unsigned int *len); void vring_add_buf(struct vring_virtqueue *vq, struct vring_list list[], unsigned int out, unsigned int in, - int index, int num_added); + void *index, int num_added); void vring_kick(unsigned int ioaddr, struct vring_virtqueue *vq, int num_added); #endif /* _VIRTIO_RING_H_ */ |
