mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
virtio-net: make VirtIOFeature usable for other virtio devices
In order to use VirtIOFeature also in other virtio devices, we move its declaration and the endof() macro (renamed in virtio_endof()) in virtio.h. We add virtio_feature_get_config_size() function to iterate the array of VirtIOFeature and to return the config size depending on the features enabled. (as virtio_net_set_config_size() did) Suggested-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-id: 20190221103314.58500-5-sgarzare@redhat.com Message-Id: <20190221103314.58500-5-sgarzare@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
5c81161f80
commit
ba550851f5
3 changed files with 37 additions and 24 deletions
|
@ -37,6 +37,21 @@ static inline hwaddr vring_align(hwaddr addr,
|
|||
return QEMU_ALIGN_UP(addr, align);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the number of bytes up to and including the given 'field' of
|
||||
* 'container'.
|
||||
*/
|
||||
#define virtio_endof(container, field) \
|
||||
(offsetof(container, field) + sizeof_field(container, field))
|
||||
|
||||
typedef struct VirtIOFeature {
|
||||
uint64_t flags;
|
||||
size_t end;
|
||||
} VirtIOFeature;
|
||||
|
||||
size_t virtio_feature_get_config_size(VirtIOFeature *features,
|
||||
uint64_t host_features);
|
||||
|
||||
typedef struct VirtQueue VirtQueue;
|
||||
|
||||
#define VIRTQUEUE_MAX_SIZE 1024
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue