diff mbox

[V2,1/2] vhost-user: sync backend features

Message ID 1438200409-27381-2-git-send-email-marcel@redhat.com
State New
Headers show

Commit Message

Marcel Apfelbaum July 29, 2015, 8:06 p.m. UTC
Complete vhost-user negotiation by syncing the features
supported by the backend.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
 hw/virtio/vhost-user.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Michael S. Tsirkin July 30, 2015, 6:47 a.m. UTC | #1
On Wed, Jul 29, 2015 at 11:06:48PM +0300, Marcel Apfelbaum wrote:
> Complete vhost-user negotiation by syncing

synching.

> the features
> supported by the backend.
> 
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
>  hw/virtio/vhost-user.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index c4428a1..b522437 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -22,6 +22,7 @@
>  #include <sys/socket.h>
>  #include <sys/un.h>
>  #include <linux/vhost.h>
> +#include <linux/virtio_net.h>
>  
>  #define VHOST_MEMORY_MAX_NREGIONS    8
>  
> @@ -358,6 +359,22 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque)
>          return err;
>      }
>  
> +    if (__virtio_has_feature(msg.u64, VIRTIO_F_ANY_LAYOUT)) {
> +        dev->backend_features |= 1ULL << VIRTIO_F_ANY_LAYOUT;
> +    }
> +
> +    if (__virtio_has_feature(msg.u64, VIRTIO_F_VERSION_1)) {
> +        dev->backend_features |= 1ULL << VIRTIO_F_VERSION_1;
> +    }
> +
> +    if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MRG_RXBUF)) {
> +        dev->backend_features |= 1ULL << VIRTIO_NET_F_MRG_RXBUF;
> +    }
> +
> +    if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MQ)) {
> +        dev->backend_features |= 1ULL << VIRTIO_NET_F_MQ;
> +    }
> +

A bit too early for MQ, isn't it?

>      if (__virtio_has_feature(msg.u64, VHOST_USER_F_PROTOCOL_FEATURES)) {
>          dev->backend_features |= 1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
>  
> -- 
> 2.1.0
Marcel Apfelbaum July 30, 2015, 7:27 a.m. UTC | #2
On 07/30/2015 09:47 AM, Michael S. Tsirkin wrote:
> On Wed, Jul 29, 2015 at 11:06:48PM +0300, Marcel Apfelbaum wrote:
>> Complete vhost-user negotiation by syncing
>
> synching.
OK, thanks
>
>> the features
>> supported by the backend.
>>
>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>> ---
>>   hw/virtio/vhost-user.c | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
>>
>> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
>> index c4428a1..b522437 100644
>> --- a/hw/virtio/vhost-user.c
>> +++ b/hw/virtio/vhost-user.c
>> @@ -22,6 +22,7 @@
>>   #include <sys/socket.h>
>>   #include <sys/un.h>
>>   #include <linux/vhost.h>
>> +#include <linux/virtio_net.h>
>>
>>   #define VHOST_MEMORY_MAX_NREGIONS    8
>>
>> @@ -358,6 +359,22 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque)
>>           return err;
>>       }
>>
>> +    if (__virtio_has_feature(msg.u64, VIRTIO_F_ANY_LAYOUT)) {
>> +        dev->backend_features |= 1ULL << VIRTIO_F_ANY_LAYOUT;
>> +    }
>> +
>> +    if (__virtio_has_feature(msg.u64, VIRTIO_F_VERSION_1)) {
>> +        dev->backend_features |= 1ULL << VIRTIO_F_VERSION_1;
>> +    }
>> +
>> +    if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MRG_RXBUF)) {
>> +        dev->backend_features |= 1ULL << VIRTIO_NET_F_MRG_RXBUF;
>> +    }
>> +
>> +    if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MQ)) {
>> +        dev->backend_features |= 1ULL << VIRTIO_NET_F_MQ;
>> +    }
>> +
>
> A bit too early for MQ, isn't it?
For a complete solution, until we have it in protocol features

>
>>       if (__virtio_has_feature(msg.u64, VHOST_USER_F_PROTOCOL_FEATURES)) {
>>           dev->backend_features |= 1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
>>
>> --
>> 2.1.0
diff mbox

Patch

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index c4428a1..b522437 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -22,6 +22,7 @@ 
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <linux/vhost.h>
+#include <linux/virtio_net.h>
 
 #define VHOST_MEMORY_MAX_NREGIONS    8
 
@@ -358,6 +359,22 @@  static int vhost_user_init(struct vhost_dev *dev, void *opaque)
         return err;
     }
 
+    if (__virtio_has_feature(msg.u64, VIRTIO_F_ANY_LAYOUT)) {
+        dev->backend_features |= 1ULL << VIRTIO_F_ANY_LAYOUT;
+    }
+
+    if (__virtio_has_feature(msg.u64, VIRTIO_F_VERSION_1)) {
+        dev->backend_features |= 1ULL << VIRTIO_F_VERSION_1;
+    }
+
+    if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MRG_RXBUF)) {
+        dev->backend_features |= 1ULL << VIRTIO_NET_F_MRG_RXBUF;
+    }
+
+    if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MQ)) {
+        dev->backend_features |= 1ULL << VIRTIO_NET_F_MQ;
+    }
+
     if (__virtio_has_feature(msg.u64, VHOST_USER_F_PROTOCOL_FEATURES)) {
         dev->backend_features |= 1ULL << VHOST_USER_F_PROTOCOL_FEATURES;