[dpdk-dev] [PATCH 1/3] vhost: Fix return value of GET_VRING_BASE message

2015-10-08 Thread Yuanhan Liu
On Wed, Aug 19, 2015 at 06:51:07PM +0900, Tetsuya Mukawa wrote:
> When vhost-user frontend sends GET_VRING_BASE, last used index of vring
> should be returned. In DPDK vhost library, 'last_used_idx' represents it.
> But the value can be over max index value.

That's true, and I guess it's a design. If you look at the linux
kernel vhost code, you will find that there is no such wrap, either.

> To return correct value to
> vhost frontend, it's needed to be masked.

So, it's the frontend job to get the right value, by wrapping it
within vring size.

--yliu
> 
> Signed-off-by: Tetsuya Mukawa 
> ---
>  lib/librte_vhost/virtio-net.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> index b520ec5..144f301 100644
> --- a/lib/librte_vhost/virtio-net.c
> +++ b/lib/librte_vhost/virtio-net.c
> @@ -661,7 +661,8 @@ get_vring_base(struct vhost_device_ctx ctx, uint32_t 
> index,
>  
>   state->index = index;
>   /* State->index refers to the queue index. The txq is 1, rxq is 0. */
> - state->num = dev->virtqueue[state->index]->last_used_idx;
> + state->num = dev->virtqueue[state->index]->last_used_idx
> + & (dev->virtqueue[state->index]->size - 1);
>  
>   return 0;
>  }
> -- 
> 2.1.4


[dpdk-dev] [PATCH 1/3] vhost: Fix return value of GET_VRING_BASE message

2015-09-28 Thread Xie, Huawei
On 9/25/2015 9:15 PM, Thomas Monjalon wrote:
> Huawei, Changchun,
> Please could you review this series?
> Thanks
>
>
Sorry, recently quite busy. Would check this and Pavel's patch after
Chinese Holiday(Oct.1-Oct.7).
Btw, Changchun left Intel and could be no longer reached by this mail
address. I think he will show up with another address soon.


[dpdk-dev] [PATCH 1/3] vhost: Fix return value of GET_VRING_BASE message

2015-09-25 Thread Thomas Monjalon
Huawei, Changchun,
Please could you review this series?
Thanks



[dpdk-dev] [PATCH 1/3] vhost: Fix return value of GET_VRING_BASE message

2015-08-19 Thread Tetsuya Mukawa
When vhost-user frontend sends GET_VRING_BASE, last used index of vring
should be returned. In DPDK vhost library, 'last_used_idx' represents it.
But the value can be over max index value. To return correct value to
vhost frontend, it's needed to be masked.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_vhost/virtio-net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index b520ec5..144f301 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -661,7 +661,8 @@ get_vring_base(struct vhost_device_ctx ctx, uint32_t index,

state->index = index;
/* State->index refers to the queue index. The txq is 1, rxq is 0. */
-   state->num = dev->virtqueue[state->index]->last_used_idx;
+   state->num = dev->virtqueue[state->index]->last_used_idx
+   & (dev->virtqueue[state->index]->size - 1);

return 0;
 }
-- 
2.1.4