net/virtio: add packed virtqueue defines
Signed-off-by: Jens Freimann <jfreimann@redhat.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
parent
276d63505b
commit
4c3f5822eb
@ -113,6 +113,7 @@ struct virtnet_ctl;
|
||||
|
||||
#define VIRTIO_F_VERSION_1 32
|
||||
#define VIRTIO_F_IOMMU_PLATFORM 33
|
||||
#define VIRTIO_F_RING_PACKED 34
|
||||
|
||||
/*
|
||||
* Some VirtIO feature bits (currently bits 28 through 31) are
|
||||
|
@ -15,6 +15,10 @@
|
||||
#define VRING_DESC_F_WRITE 2
|
||||
/* This means the buffer contains a list of buffer descriptors. */
|
||||
#define VRING_DESC_F_INDIRECT 4
|
||||
/* This flag means the descriptor was made available by the driver */
|
||||
#define VRING_DESC_F_AVAIL(b) ((uint16_t)(b) << 7)
|
||||
/* This flag means the descriptor was used by the device */
|
||||
#define VRING_DESC_F_USED(b) ((uint16_t)(b) << 15)
|
||||
|
||||
/* The Host uses this in used->flags to advise the Guest: don't kick me
|
||||
* when you add a buffer. It's unreliable, so it's simply an
|
||||
@ -54,6 +58,32 @@ struct vring_used {
|
||||
struct vring_used_elem ring[0];
|
||||
};
|
||||
|
||||
/* For support of packed virtqueues in Virtio 1.1 the format of descriptors
|
||||
* looks like this.
|
||||
*/
|
||||
struct vring_packed_desc {
|
||||
uint64_t addr;
|
||||
uint32_t len;
|
||||
uint16_t id;
|
||||
uint16_t flags;
|
||||
};
|
||||
|
||||
#define RING_EVENT_FLAGS_ENABLE 0x0
|
||||
#define RING_EVENT_FLAGS_DISABLE 0x1
|
||||
#define RING_EVENT_FLAGS_DESC 0x2
|
||||
struct vring_packed_desc_event {
|
||||
uint16_t desc_event_off_wrap;
|
||||
uint16_t desc_event_flags;
|
||||
};
|
||||
|
||||
struct vring_packed {
|
||||
unsigned int num;
|
||||
struct vring_packed_desc *desc_packed;
|
||||
struct vring_packed_desc_event *driver_event;
|
||||
struct vring_packed_desc_event *device_event;
|
||||
|
||||
};
|
||||
|
||||
struct vring {
|
||||
unsigned int num;
|
||||
struct vring_desc *desc;
|
||||
|
@ -161,11 +161,17 @@ struct virtio_pmd_ctrl {
|
||||
struct vq_desc_extra {
|
||||
void *cookie;
|
||||
uint16_t ndescs;
|
||||
uint16_t next;
|
||||
};
|
||||
|
||||
struct virtqueue {
|
||||
struct virtio_hw *hw; /**< virtio_hw structure pointer. */
|
||||
struct vring vq_ring; /**< vring keeping desc, used and avail */
|
||||
struct vring_packed ring_packed; /**< vring keeping descs */
|
||||
bool avail_wrap_counter;
|
||||
bool used_wrap_counter;
|
||||
uint16_t event_flags_shadow;
|
||||
uint16_t avail_used_flags;
|
||||
/**
|
||||
* Last consumed descriptor in the used table,
|
||||
* trails vq_ring.used->idx.
|
||||
|
Loading…
x
Reference in New Issue
Block a user