On Thu, Oct 25, 2018 at 03:51:19PM +0200, Maxime Coquelin wrote:


On 10/25/18 3:48 PM, Jens Freimann wrote:
On Thu, Oct 25, 2018 at 05:21:15PM +0800, Tiwei Bie wrote:
On Wed, Oct 24, 2018 at 04:32:29PM +0200, Jens Freimann wrote:
Signed-off-by: Jens Freimann <jfreim...@redhat.com>
??struct vring {
???????? unsigned int num;
-?????? struct vring_desc?? *desc;
-?????? struct vring_avail *avail;
-?????? struct vring_used?? *used;
+?????? union {
+?????????????? struct vring_desc_packed *desc_packed;
+?????????????? struct vring_desc *desc;
+?????? };
+?????? union {
+?????????????? struct vring_avail *avail;
+?????????????? struct vring_packed_desc_event *driver_event;
+?????? };
+?????? union {
+?????????????? struct vring_used?? *used;
+?????????????? struct vring_packed_desc_event *device_event;
+?????? };
??};


We should define a new `vring` structure for packed ring.

I think it was requested to have it as a union before, but I can do
it.

I guess oyu vcan have a union between struct vring and struct
vring_packed?

Like this?

struct vring {
         unsigned int num;
         union {
                struct vring_split *split;
_                struct vring_packed *packed;
         };
 };

We will have to write vq->vq_ring.split.avail->flags and vq->vq_ring.packed.desc[xx] and similar things in a lot of places, no?

Should we just add both vring_split and vring_packed to struct
virtqueue instead? Only one of them will have memory allocated per virtqueue
anyway.

regards,
Jens

Reply via email to