1 #ifndef _VIRTIO_RING_H_ 2 # define _VIRTIO_RING_H_ 9 #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 11 #define VIRTIO_CONFIG_S_DRIVER 2 13 #define VIRTIO_CONFIG_S_DRIVER_OK 4 15 #define VIRTIO_CONFIG_S_FEATURES_OK 8 17 #define VIRTIO_CONFIG_S_FAILED 0x80 21 #define VIRTIO_F_ANY_LAYOUT 27 23 #define VIRTIO_F_VERSION_1 32 24 #define VIRTIO_F_IOMMU_PLATFORM 33 26 #define MAX_QUEUE_NUM (256) 28 #define VRING_DESC_F_NEXT 1 29 #define VRING_DESC_F_WRITE 2 31 #define VRING_AVAIL_F_NO_INTERRUPT 1 33 #define VRING_USED_F_NO_NOTIFY 1 70 #define vring_size(num) \ 71 (((((sizeof(struct vring_desc) * num) + \ 72 (sizeof(struct vring_avail) + sizeof(u16) * num)) \ 73 + PAGE_MASK) & ~PAGE_MASK) + \ 74 (sizeof(struct vring_used) + sizeof(struct vring_used_elem) * num)) 97 unsigned int num,
unsigned char *
queue)
118 for (i = 0; i <
num - 1; i++)
150 unsigned int out,
unsigned int in,
151 void *
index,
int num_added);
static int vring_more_used(struct vring_virtqueue *vq)
void vring_detach(struct vring_virtqueue *vq, unsigned int head)
#define PAGE_MASK
Page mask.
struct vring_avail * avail
struct vring_used_elem ring[]
static void vring_disable_cb(struct vring_virtqueue *vq)
static void vring_enable_cb(struct vring_virtqueue *vq)
static void vring_init(struct vring *vr, unsigned int num, unsigned char *queue)
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
static __always_inline void * phys_to_virt(unsigned long phys_addr)
Convert physical address to a virtual address.
static unsigned long ioaddr
struct virtio_pci_region notification
#define VRING_AVAIL_F_NO_INTERRUPT
struct virtio_net_hdr_modern * empty_header
void vring_add_buf(struct vring_virtqueue *vq, struct vring_list list[], unsigned int out, unsigned int in, void *index, int num_added)
void vring_kick(struct virtio_pci_modern_device *vdev, unsigned int ioaddr, struct vring_virtqueue *vq, int num_added)
void * vring_get_buf(struct vring_virtqueue *vq, unsigned int *len)