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

This first non-RFC version is just a rebase.

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

First patch saves/restores the wrap counter value into/
from bit 31 of the vring state num field.

Patch 2 advertise support for the packed ring.

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 | 17 +++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

-- 
2.17.1

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

* [dpdk-dev] [PATCH 1/2] vhost: add packed ring support to vring base requests
  2018-10-02 13:30 [dpdk-dev] [PATCH 0/2] vhost: packed ring support completion Maxime Coquelin
@ 2018-10-02 13:30 ` Maxime Coquelin
  2018-10-02 13:30 ` [dpdk-dev] [PATCH 2/2] vhost: advertize packed ring layout support Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2018-10-02 13:30 UTC (permalink / raw)
  To: dev, jfreimann, tiwei.bie, zhihong.wang; +Cc: Maxime Coquelin

For consistency with Vhost kernel backend, save the wrap
counter value into bit 31 of num's vring state field.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 7ef3fb4a4..e671ed0ba 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -677,10 +677,16 @@ vhost_user_set_vring_base(struct virtio_net **pdev,
 			  struct VhostUserMsg *msg)
 {
 	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];
+
+	if (dev->features & (1ULL << VIRTIO_F_RING_PACKED)) {
+		vq->avail_wrap_counter = msg->payload.state.num >> 31;
+		vq->used_wrap_counter = vq->avail_wrap_counter;
+		msg->payload.state.num &= ~(1 << 31);
+	}
+
+	vq->last_used_idx = msg->payload.state.num;
+	vq->last_avail_idx = msg->payload.state.num;
 
 	return VH_RESULT_OK;
 }
@@ -1128,6 +1134,9 @@ vhost_user_get_vring_base(struct virtio_net **pdev,
 	/* Here we are safe to get the last avail index */
 	msg->payload.state.num = vq->last_avail_idx;
 
+	if (dev->features & (1ULL << VIRTIO_F_RING_PACKED))
+		msg->payload.state.num |= vq->avail_wrap_counter << 31;
+
 	RTE_LOG(INFO, VHOST_CONFIG,
 		"vring base idx:%d file:%d\n", msg->payload.state.index,
 		msg->payload.state.num);
-- 
2.17.1

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

* [dpdk-dev] [PATCH 2/2] vhost: advertize packed ring layout support
  2018-10-02 13:30 [dpdk-dev] [PATCH 0/2] vhost: packed ring support completion Maxime Coquelin
  2018-10-02 13:30 ` [dpdk-dev] [PATCH 1/2] vhost: add packed ring support to vring base requests Maxime Coquelin
@ 2018-10-02 13:30 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2018-10-02 13:30 UTC (permalink / raw)
  To: dev, jfreimann, tiwei.bie, zhihong.wang; +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 25ffd7614..4ad6afcf9 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.1

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

end of thread, other threads:[~2018-10-02 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 13:30 [dpdk-dev] [PATCH 0/2] vhost: packed ring support completion Maxime Coquelin
2018-10-02 13:30 ` [dpdk-dev] [PATCH 1/2] vhost: add packed ring support to vring base requests Maxime Coquelin
2018-10-02 13:30 ` [dpdk-dev] [PATCH 2/2] vhost: advertize packed ring layout support 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).