Thread (59 messages) 59 messages, 5 authors, 2025-06-03

Re: [PATCH net-next 3/8] vhost-net: allow configuring extended features

From: Jason Wang <jasowang@redhat.com>
Date: 2025-05-26 00:48:09

On Wed, May 21, 2025 at 6:33 PM Paolo Abeni [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Use the extended feature type for 'acked_features' and implement
two new ioctls operation to get and set the extended features.

Note that the legacy ioctls implicitly truncate the negotiated
features to the lower 64 bits range.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 drivers/vhost/net.c        | 26 +++++++++++++++++++++++++-
 drivers/vhost/vhost.h      |  2 +-
 include/uapi/linux/vhost.h |  8 ++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 7cbfc7d718b3f..b894685dded3e 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -77,6 +77,10 @@ enum {
                         (1ULL << VIRTIO_F_RING_RESET)
 };

+#ifdef VIRTIO_HAS_EXTENDED_FEATURES
+#define VHOST_NET_FEATURES_EX VHOST_NET_FEATURES
+#endif
+
 enum {
        VHOST_NET_BACKEND_FEATURES = (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2)
 };
@@ -1614,7 +1618,7 @@ static long vhost_net_reset_owner(struct vhost_net *n)
        return err;
 }

-static int vhost_net_set_features(struct vhost_net *n, u64 features)
+static int vhost_net_set_features(struct vhost_net *n, virtio_features_t features)
 {
        size_t vhost_hlen, sock_hlen, hdr_len;
        int i;
@@ -1704,6 +1708,26 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
                if (features & ~VHOST_NET_FEATURES)
                        return -EOPNOTSUPP;
                return vhost_net_set_features(n, features);
+#ifdef VIRTIO_HAS_EXTENDED_FEATURES
Vhost doesn't depend on virtio. But this invents a dependency, and I
don't understand why we need to do that.

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help