Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / lib / libvirtio / virtio-net.h
1 /******************************************************************************
2  * Copyright (c) 2011 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12
13 #ifndef VIRTIO_NET_H
14 #define VIRTIO_NET_H
15
16 #include <netdriver.h>
17
18 #define RX_QUEUE_SIZE           128
19 #define BUFFER_ENTRY_SIZE       1514
20
21 enum {
22         VQ_RX = 0,      /* Receive Queue */
23         VQ_TX = 1,      /* Transmit Queue */
24 };
25
26 struct vqs {
27         uint64_t id;    /* Queue ID */
28         uint32_t size;
29         void *buf_mem;
30         struct vring_desc *desc;
31         struct vring_avail *avail;
32         struct vring_used *used;
33 };
34
35 /* Device is identified by RX queue ID: */
36 #define DEVICE_ID  vq[0].id
37
38 extern net_driver_t *virtionet_open(char *mac_addr, int len, struct virtio_device *dev);
39 extern void virtionet_close(net_driver_t *driver);
40 extern int virtionet_read(char *buf, int len);
41 extern int virtionet_write(char *buf, int len);
42
43 #endif