DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion
@ 2018-10-31 10:26 Maxime Coquelin
  2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 1/2] vhost: add packed ring support to vring base requests Maxime Coquelin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Maxime Coquelin @ 2018-10-31 10:26 UTC (permalink / raw)
  To: dev, jfreimann, tiwei.bie, zhihong.wang, jasowang, mst, wexu
  Cc: Maxime Coquelin

In this v4, it restores back to only save last avail index and
its wrap counter value at get time, and restore both used
and avail indexes to avail values at set time.
The change compared to v1 is that wrap counter value is
saved into bit 15, so that it is consistent with the event
suppression structure format.

Initial series ading packed ring layout support to the
vhost library was missing the save and restore of the
wrap counters and indexs on vring base requests used for
migration.

First patch saves/restores the used and avail indexes and their
wrap counters values into/from the vring state num field.

Maxime Coquelin (2):
  vhost: add packed ring support to vring base requests
  vhost: advertize packed ring layout support

 lib/librte_vhost/vhost.h      |  3 ++-
 lib/librte_vhost/vhost_user.c | 40 +++++++++++++++++++++++++++++------
 2 files changed, 36 insertions(+), 7 deletions(-)

-- 
2.17.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v4 1/2] vhost: add packed ring support to vring base requests
  2018-10-31 10:26 [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Maxime Coquelin
@ 2018-10-31 10:26 ` Maxime Coquelin
  2018-11-02  8:21   ` Jens Freimann
  2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 2/2] vhost: advertize packed ring layout support Maxime Coquelin
  2018-11-02 13:42 ` [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Tiwei Bie
  2 siblings, 1 reply; 7+ messages in thread
From: Maxime Coquelin @ 2018-10-31 10:26 UTC (permalink / raw)
  To: dev, jfreimann, tiwei.bie, zhihong.wang, jasowang, mst, wexu
  Cc: Maxime Coquelin

For packed ring layout, we need save avail index and its wrap
counter value. At restore time, the used index and its wrap counter
are set to available's ones, as the ring procressing is stopped
at vring base get time.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 40 +++++++++++++++++++++++++++++------
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 508228a3c..cc154f312 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -696,10 +696,27 @@ vhost_user_set_vring_base(struct virtio_net **pdev,
 			int main_fd __rte_unused)
 {
 	struct virtio_net *dev = *pdev;
-	dev->virtqueue[msg->payload.state.index]->last_used_idx  =
-			msg->payload.state.num;
-	dev->virtqueue[msg->payload.state.index]->last_avail_idx =
-			msg->payload.state.num;
+	struct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index];
+	uint64_t val = msg->payload.state.num;
+
+	if (vq_is_packed(dev)) {
+		/*
+		 * Bit[0:14]: avail index
+		 * Bit[15]: avail wrap counter
+		 */
+		vq->last_avail_idx = val & 0x7fff;
+		vq->avail_wrap_counter = !!(val & (0x1 << 15));
+		/*
+		 * Set used index to same value as available one, as
+		 * their values should be the same since ring processing
+		 * was stopped at get time.
+		 */
+		vq->last_used_idx = vq->last_avail_idx;
+		vq->used_wrap_counter = vq->avail_wrap_counter;
+	} else {
+		vq->last_used_idx = msg->payload.state.num;
+		vq->last_avail_idx = msg->payload.state.num;
+	}
 
 	return VH_RESULT_OK;
 }
@@ -1208,6 +1225,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev,
 {
 	struct virtio_net *dev = *pdev;
 	struct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index];
+	uint64_t val;
 
 	/* We have to stop the queue (virtio) if it is running. */
 	vhost_destroy_device_notify(dev);
@@ -1215,8 +1233,18 @@ vhost_user_get_vring_base(struct virtio_net **pdev,
 	dev->flags &= ~VIRTIO_DEV_READY;
 	dev->flags &= ~VIRTIO_DEV_VDPA_CONFIGURED;
 
-	/* Here we are safe to get the last avail index */
-	msg->payload.state.num = vq->last_avail_idx;
+	/* Here we are safe to get the indexes */
+	if (vq_is_packed(dev)) {
+		/*
+		 * Bit[0:14]: avail index
+		 * Bit[15]: avail wrap counter
+		 */
+		val = vq->last_avail_idx & 0x7fff;
+		val |= vq->avail_wrap_counter << 15;
+		msg->payload.state.num = val;
+	} else {
+		msg->payload.state.num = vq->last_avail_idx;
+	}
 
 	RTE_LOG(INFO, VHOST_CONFIG,
 		"vring base idx:%d file:%d\n", msg->payload.state.index,
-- 
2.17.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v4 2/2] vhost: advertize packed ring layout support
  2018-10-31 10:26 [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Maxime Coquelin
  2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 1/2] vhost: add packed ring support to vring base requests Maxime Coquelin
@ 2018-10-31 10:26 ` Maxime Coquelin
  2018-11-02  8:23   ` Jens Freimann
  2018-11-02 13:42 ` [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Tiwei Bie
  2 siblings, 1 reply; 7+ messages in thread
From: Maxime Coquelin @ 2018-10-31 10:26 UTC (permalink / raw)
  To: dev, jfreimann, tiwei.bie, zhihong.wang, jasowang, mst, wexu
  Cc: Maxime Coquelin

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index b4abad30c..760f42192 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -275,7 +275,8 @@ struct vring_packed_desc_event {
 				(1ULL << VIRTIO_RING_F_EVENT_IDX) | \
 				(1ULL << VIRTIO_NET_F_MTU)  | \
 				(1ULL << VIRTIO_F_IN_ORDER) | \
-				(1ULL << VIRTIO_F_IOMMU_PLATFORM))
+				(1ULL << VIRTIO_F_IOMMU_PLATFORM) | \
+				(1ULL << VIRTIO_F_RING_PACKED))
 
 
 struct guest_page {
-- 
2.17.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/2] vhost: add packed ring support to vring base requests
  2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 1/2] vhost: add packed ring support to vring base requests Maxime Coquelin
@ 2018-11-02  8:21   ` Jens Freimann
  0 siblings, 0 replies; 7+ messages in thread
From: Jens Freimann @ 2018-11-02  8:21 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, tiwei.bie, zhihong.wang, jasowang, mst, wexu

On Wed, Oct 31, 2018 at 11:26:39AM +0100, Maxime Coquelin wrote:
>For packed ring layout, we need save avail index and its wrap
>counter value. At restore time, the used index and its wrap counter
>are set to available's ones, as the ring procressing is stopped
>at vring base get time.
>
>Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>---
> lib/librte_vhost/vhost_user.c | 40 +++++++++++++++++++++++++++++------
> 1 file changed, 34 insertions(+), 6 deletions(-)
>

Reviewed-by: Jens Freimann <jfreimann@redhat.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/2] vhost: advertize packed ring layout support
  2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 2/2] vhost: advertize packed ring layout support Maxime Coquelin
@ 2018-11-02  8:23   ` Jens Freimann
  0 siblings, 0 replies; 7+ messages in thread
From: Jens Freimann @ 2018-11-02  8:23 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, tiwei.bie, zhihong.wang, jasowang, mst, wexu

On Wed, Oct 31, 2018 at 11:26:40AM +0100, Maxime Coquelin wrote:
>Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>---
> lib/librte_vhost/vhost.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Jens Freimann <jfreimann@redhat.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion
  2018-10-31 10:26 [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Maxime Coquelin
  2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 1/2] vhost: add packed ring support to vring base requests Maxime Coquelin
  2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 2/2] vhost: advertize packed ring layout support Maxime Coquelin
@ 2018-11-02 13:42 ` Tiwei Bie
  2018-11-02 14:48   ` Maxime Coquelin
  2 siblings, 1 reply; 7+ messages in thread
From: Tiwei Bie @ 2018-11-02 13:42 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, jfreimann, zhihong.wang, jasowang, mst, wexu

On Wed, Oct 31, 2018 at 11:26:38AM +0100, Maxime Coquelin wrote:
> In this v4, it restores back to only save last avail index and
> its wrap counter value at get time, and restore both used
> and avail indexes to avail values at set time.
> The change compared to v1 is that wrap counter value is
> saved into bit 15, so that it is consistent with the event
> suppression structure format.
> 
> Initial series ading packed ring layout support to the
> vhost library was missing the save and restore of the
> wrap counters and indexs on vring base requests used for
> migration.
> 
> First patch saves/restores the used and avail indexes and their
> wrap counters values into/from the vring state num field.
> 
> Maxime Coquelin (2):
>   vhost: add packed ring support to vring base requests
>   vhost: advertize packed ring layout support
> 
>  lib/librte_vhost/vhost.h      |  3 ++-
>  lib/librte_vhost/vhost_user.c | 40 +++++++++++++++++++++++++++++------
>  2 files changed, 36 insertions(+), 7 deletions(-)
> 
> -- 
> 2.17.2
> 

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion
  2018-11-02 13:42 ` [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Tiwei Bie
@ 2018-11-02 14:48   ` Maxime Coquelin
  0 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2018-11-02 14:48 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: dev, jfreimann, zhihong.wang, jasowang, mst, wexu



On 11/2/18 2:42 PM, Tiwei Bie wrote:
> On Wed, Oct 31, 2018 at 11:26:38AM +0100, Maxime Coquelin wrote:
>> In this v4, it restores back to only save last avail index and
>> its wrap counter value at get time, and restore both used
>> and avail indexes to avail values at set time.
>> The change compared to v1 is that wrap counter value is
>> saved into bit 15, so that it is consistent with the event
>> suppression structure format.
>>
>> Initial series ading packed ring layout support to the
>> vhost library was missing the save and restore of the
>> wrap counters and indexs on vring base requests used for
>> migration.
>>
>> First patch saves/restores the used and avail indexes and their
>> wrap counters values into/from the vring state num field.
>>
>> Maxime Coquelin (2):
>>    vhost: add packed ring support to vring base requests
>>    vhost: advertize packed ring layout support
>>
>>   lib/librte_vhost/vhost.h      |  3 ++-
>>   lib/librte_vhost/vhost_user.c | 40 +++++++++++++++++++++++++++++------
>>   2 files changed, 36 insertions(+), 7 deletions(-)
>>
>> -- 
>> 2.17.2
>>
> 
> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
> 
> Thanks!
> 

Applied to dpdk-next-virtio/master

Maxime

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-02 14:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 10:26 [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Maxime Coquelin
2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 1/2] vhost: add packed ring support to vring base requests Maxime Coquelin
2018-11-02  8:21   ` Jens Freimann
2018-10-31 10:26 ` [dpdk-dev] [PATCH v4 2/2] vhost: advertize packed ring layout support Maxime Coquelin
2018-11-02  8:23   ` Jens Freimann
2018-11-02 13:42 ` [dpdk-dev] [PATCH v4 0/2] vhost: packed ring support completion Tiwei Bie
2018-11-02 14:48   ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).