X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fvirtio%2Fvirtio_ring.h;h=0f6574f684e2483857521855f75ad462b98115f5;hb=5d9b711da51c5760d0a64f8233200b3df576f98d;hp=5a37629fe5d9e9af1abd23bd2812e0042e1e11f9;hpb=ba72caa0472f494c61573f65e41bdc6f3bdfc891;p=dpdk.git diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h index 5a37629fe5..0f6574f684 100644 --- a/drivers/net/virtio/virtio_ring.h +++ b/drivers/net/virtio/virtio_ring.h @@ -15,10 +15,15 @@ #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) +#define VRING_PACKED_DESC_F_AVAIL (1 << 7) /* This flag means the descriptor was used by the device */ -#define VRING_DESC_F_USED(b) ((uint16_t)(b) << 15) +#define VRING_PACKED_DESC_F_USED (1 << 15) + +/* Frequently used combinations */ +#define VRING_PACKED_DESC_F_AVAIL_USED (VRING_PACKED_DESC_F_AVAIL | \ + VRING_PACKED_DESC_F_USED) /* 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,7 +59,7 @@ struct vring_used_elem { struct vring_used { uint16_t flags; - volatile uint16_t idx; + uint16_t idx; struct vring_used_elem ring[0]; }; @@ -78,10 +83,9 @@ struct vring_packed_desc_event { 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_packed_desc *desc; + struct vring_packed_desc_event *driver; + struct vring_packed_desc_event *device; }; struct vring { @@ -161,11 +165,11 @@ vring_init_packed(struct vring_packed *vr, uint8_t *p, unsigned long align, unsigned int num) { vr->num = num; - vr->desc_packed = (struct vring_packed_desc *)p; - vr->driver_event = (struct vring_packed_desc_event *)(p + + vr->desc = (struct vring_packed_desc *)p; + vr->driver = (struct vring_packed_desc_event *)(p + vr->num * sizeof(struct vring_packed_desc)); - vr->device_event = (struct vring_packed_desc_event *) - RTE_ALIGN_CEIL(((uintptr_t)vr->driver_event + + vr->device = (struct vring_packed_desc_event *) + RTE_ALIGN_CEIL(((uintptr_t)vr->driver + sizeof(struct vring_packed_desc_event)), align); }