[PATCH 16/16] vhost-net: vq reset feature bit support

Kangjie Xu posted 16 patches 3 years, 6 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
[PATCH 16/16] vhost-net: vq reset feature bit support
Posted by Kangjie Xu 3 years, 6 months ago
Add support for negotation of vq reset feature bit.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
 hw/net/vhost_net.c  | 1 +
 hw/net/virtio-net.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 4f5f034c11..de910f6466 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -73,6 +73,7 @@ static const int user_feature_bits[] = {
     VIRTIO_NET_F_MTU,
     VIRTIO_F_IOMMU_PLATFORM,
     VIRTIO_F_RING_PACKED,
+    VIRTIO_F_RING_RESET,
     VIRTIO_NET_F_RSS,
     VIRTIO_NET_F_HASH_REPORT,
 
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 0747ffe71c..a8b299067a 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -757,6 +757,8 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
 
     virtio_add_feature(&features, VIRTIO_NET_F_MAC);
 
+    virtio_add_feature(&features, VIRTIO_F_RING_RESET);
+
     if (!peer_has_vnet_hdr(n)) {
         virtio_clear_feature(&features, VIRTIO_NET_F_CSUM);
         virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO4);
@@ -777,7 +779,6 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
     }
 
     if (!get_vhost_net(nc->peer)) {
-        virtio_add_feature(&features, VIRTIO_F_RING_RESET);
         return features;
     }
 
-- 
2.32.0
Re: [PATCH 16/16] vhost-net: vq reset feature bit support
Posted by Jason Wang 3 years, 6 months ago
在 2022/7/18 19:17, Kangjie Xu 写道:
> Add support for negotation of vq reset feature bit.
>
> Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>


I'd suggest to add support for vhost-net kernel as well. It looks much 
more easier than vhost-user (I guess a stop/start would do the trick).

Thanks


> ---
>   hw/net/vhost_net.c  | 1 +
>   hw/net/virtio-net.c | 3 ++-
>   2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 4f5f034c11..de910f6466 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -73,6 +73,7 @@ static const int user_feature_bits[] = {
>       VIRTIO_NET_F_MTU,
>       VIRTIO_F_IOMMU_PLATFORM,
>       VIRTIO_F_RING_PACKED,
> +    VIRTIO_F_RING_RESET,
>       VIRTIO_NET_F_RSS,
>       VIRTIO_NET_F_HASH_REPORT,
>   
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 0747ffe71c..a8b299067a 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -757,6 +757,8 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
>   
>       virtio_add_feature(&features, VIRTIO_NET_F_MAC);
>   
> +    virtio_add_feature(&features, VIRTIO_F_RING_RESET);
> +
>       if (!peer_has_vnet_hdr(n)) {
>           virtio_clear_feature(&features, VIRTIO_NET_F_CSUM);
>           virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO4);
> @@ -777,7 +779,6 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
>       }
>   
>       if (!get_vhost_net(nc->peer)) {
> -        virtio_add_feature(&features, VIRTIO_F_RING_RESET);
>           return features;
>       }
>   


Re: [PATCH 16/16] vhost-net: vq reset feature bit support
Posted by Kangjie Xu 3 years, 6 months ago
在 2022/7/26 12:28, Jason Wang 写道:
>
> 在 2022/7/18 19:17, Kangjie Xu 写道:
>> Add support for negotation of vq reset feature bit.
>>
>> Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
>> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
>
>
> I'd suggest to add support for vhost-net kernel as well. It looks much 
> more easier than vhost-user (I guess a stop/start would do the trick).
>
> Thanks
>
>
Yeah, we've planned to support it in the future.

Thanks

>> ---
>>   hw/net/vhost_net.c  | 1 +
>>   hw/net/virtio-net.c | 3 ++-
>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
>> index 4f5f034c11..de910f6466 100644
>> --- a/hw/net/vhost_net.c
>> +++ b/hw/net/vhost_net.c
>> @@ -73,6 +73,7 @@ static const int user_feature_bits[] = {
>>       VIRTIO_NET_F_MTU,
>>       VIRTIO_F_IOMMU_PLATFORM,
>>       VIRTIO_F_RING_PACKED,
>> +    VIRTIO_F_RING_RESET,
>>       VIRTIO_NET_F_RSS,
>>       VIRTIO_NET_F_HASH_REPORT,
>>   diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index 0747ffe71c..a8b299067a 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -757,6 +757,8 @@ static uint64_t 
>> virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
>>         virtio_add_feature(&features, VIRTIO_NET_F_MAC);
>>   +    virtio_add_feature(&features, VIRTIO_F_RING_RESET);
>> +
>>       if (!peer_has_vnet_hdr(n)) {
>>           virtio_clear_feature(&features, VIRTIO_NET_F_CSUM);
>>           virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO4);
>> @@ -777,7 +779,6 @@ static uint64_t 
>> virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
>>       }
>>         if (!get_vhost_net(nc->peer)) {
>> -        virtio_add_feature(&features, VIRTIO_F_RING_RESET);
>>           return features;
>>       }

Re: [PATCH 16/16] vhost-net: vq reset feature bit support
Posted by Jason Wang 3 years, 6 months ago
On Tue, Jul 26, 2022 at 2:24 PM Kangjie Xu <kangjie.xu@linux.alibaba.com> wrote:
>
>
> 在 2022/7/26 12:28, Jason Wang 写道:
> >
> > 在 2022/7/18 19:17, Kangjie Xu 写道:
> >> Add support for negotation of vq reset feature bit.
> >>
> >> Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
> >> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> >
> >
> > I'd suggest to add support for vhost-net kernel as well. It looks much
> > more easier than vhost-user (I guess a stop/start would do the trick).
> >
> > Thanks
> >
> >
> Yeah, we've planned to support it in the future.

If it's possible, I suggest to implement in this series. It would be
easier since it current kernel support it already (via SET_BACKEND).

Thanks

>
> Thanks
>
> >> ---
> >>   hw/net/vhost_net.c  | 1 +
> >>   hw/net/virtio-net.c | 3 ++-
> >>   2 files changed, 3 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> >> index 4f5f034c11..de910f6466 100644
> >> --- a/hw/net/vhost_net.c
> >> +++ b/hw/net/vhost_net.c
> >> @@ -73,6 +73,7 @@ static const int user_feature_bits[] = {
> >>       VIRTIO_NET_F_MTU,
> >>       VIRTIO_F_IOMMU_PLATFORM,
> >>       VIRTIO_F_RING_PACKED,
> >> +    VIRTIO_F_RING_RESET,
> >>       VIRTIO_NET_F_RSS,
> >>       VIRTIO_NET_F_HASH_REPORT,
> >>   diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> >> index 0747ffe71c..a8b299067a 100644
> >> --- a/hw/net/virtio-net.c
> >> +++ b/hw/net/virtio-net.c
> >> @@ -757,6 +757,8 @@ static uint64_t
> >> virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
> >>         virtio_add_feature(&features, VIRTIO_NET_F_MAC);
> >>   +    virtio_add_feature(&features, VIRTIO_F_RING_RESET);
> >> +
> >>       if (!peer_has_vnet_hdr(n)) {
> >>           virtio_clear_feature(&features, VIRTIO_NET_F_CSUM);
> >>           virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO4);
> >> @@ -777,7 +779,6 @@ static uint64_t
> >> virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
> >>       }
> >>         if (!get_vhost_net(nc->peer)) {
> >> -        virtio_add_feature(&features, VIRTIO_F_RING_RESET);
> >>           return features;
> >>       }
>
Re: [PATCH 16/16] vhost-net: vq reset feature bit support
Posted by Kangjie Xu 3 years, 6 months ago
在 2022/7/27 12:53, Jason Wang 写道:
> On Tue, Jul 26, 2022 at 2:24 PM Kangjie Xu <kangjie.xu@linux.alibaba.com> wrote:
>>
>> 在 2022/7/26 12:28, Jason Wang 写道:
>>> 在 2022/7/18 19:17, Kangjie Xu 写道:
>>>> Add support for negotation of vq reset feature bit.
>>>>
>>>> Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
>>>> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
>>>
>>> I'd suggest to add support for vhost-net kernel as well. It looks much
>>> more easier than vhost-user (I guess a stop/start would do the trick).
>>>
>>> Thanks
>>>
>>>
>> Yeah, we've planned to support it in the future.
> If it's possible, I suggest to implement in this series. It would be
> easier since it current kernel support it already (via SET_BACKEND).
>
> Thanks

Okay, in the next version, we will add the implementation for 
vhost-kernel vq reset.

Thanks

>> Thanks
>>
>>>> ---
>>>>    hw/net/vhost_net.c  | 1 +
>>>>    hw/net/virtio-net.c | 3 ++-
>>>>    2 files changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
>>>> index 4f5f034c11..de910f6466 100644
>>>> --- a/hw/net/vhost_net.c
>>>> +++ b/hw/net/vhost_net.c
>>>> @@ -73,6 +73,7 @@ static const int user_feature_bits[] = {
>>>>        VIRTIO_NET_F_MTU,
>>>>        VIRTIO_F_IOMMU_PLATFORM,
>>>>        VIRTIO_F_RING_PACKED,
>>>> +    VIRTIO_F_RING_RESET,
>>>>        VIRTIO_NET_F_RSS,
>>>>        VIRTIO_NET_F_HASH_REPORT,
>>>>    diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>>>> index 0747ffe71c..a8b299067a 100644
>>>> --- a/hw/net/virtio-net.c
>>>> +++ b/hw/net/virtio-net.c
>>>> @@ -757,6 +757,8 @@ static uint64_t
>>>> virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
>>>>          virtio_add_feature(&features, VIRTIO_NET_F_MAC);
>>>>    +    virtio_add_feature(&features, VIRTIO_F_RING_RESET);
>>>> +
>>>>        if (!peer_has_vnet_hdr(n)) {
>>>>            virtio_clear_feature(&features, VIRTIO_NET_F_CSUM);
>>>>            virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO4);
>>>> @@ -777,7 +779,6 @@ static uint64_t
>>>> virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
>>>>        }
>>>>          if (!get_vhost_net(nc->peer)) {
>>>> -        virtio_add_feature(&features, VIRTIO_F_RING_RESET);
>>>>            return features;
>>>>        }