vhost-net: allow configuring extended features

Use the extended feature type for 'acked_features' and implement
two new ioctls operation allowing the user-space to set/query an
unbounded amount of features.

The actual number of processed features is limited by VIRTIO_FEATURES_MAX
and attempts to set features above such limit fail with
EOPNOTSUPP.

Note that: the legacy ioctls implicitly truncate the negotiated
features to the lower 64 bits range and the 'acked_backend_features'
field don't need conversion, as the only negotiated feature there
is in the low 64 bit range.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Paolo Abeni
2025-07-08 18:05:23 +02:00
parent 69b9461512
commit 333c515d18
5 changed files with 82 additions and 23 deletions
+7
View File
@@ -235,4 +235,11 @@
*/
#define VHOST_VDPA_GET_VRING_SIZE _IOWR(VHOST_VIRTIO, 0x82, \
struct vhost_vring_state)
/* Extended features manipulation */
#define VHOST_GET_FEATURES_ARRAY _IOR(VHOST_VIRTIO, 0x83, \
struct vhost_features_array)
#define VHOST_SET_FEATURES_ARRAY _IOW(VHOST_VIRTIO, 0x83, \
struct vhost_features_array)
#endif
+5
View File
@@ -110,6 +110,11 @@ struct vhost_msg_v2 {
};
};
struct vhost_features_array {
__u64 count; /* number of entries present in features array */
__u64 features[] __counted_by(count);
};
struct vhost_memory_region {
__u64 guest_phys_addr;
__u64 memory_size; /* bytes */