DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: Fix reset_owner message handling not to clear callfd
@ 2015-11-19  6:23 Tetsuya Mukawa
  2015-11-19  7:03 ` Yuanhan Liu
  2015-11-19  9:07 ` [dpdk-dev] [PATCH v2] " Tetsuya Mukawa
  0 siblings, 2 replies; 9+ messages in thread
From: Tetsuya Mukawa @ 2015-11-19  6:23 UTC (permalink / raw)
  To: dev, yuanhan.liu; +Cc: ann.zhuangyanying

The patch fixes reset_owner message handling not to clear callfd,
because callfd will be valid while connection is establihed.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 lib/librte_vhost/virtio-net.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 886c104..ae1e4bd 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -322,6 +322,25 @@ init_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx)
 	init_vring_queue(dev->virtqueue[base_idx + VIRTIO_TXQ], qp_idx);
 }
 
+static void
+reset_vring_queue(struct vhost_virtqueue *vq, int qp_idx)
+{
+	int callfd;
+
+	callfd = vq->callfd;
+	init_vring_queue(vq, qp_idx);
+	vq->callfd = callfd;
+}
+
+static void
+reset_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx)
+{
+	uint32_t base_idx = qp_idx * VIRTIO_QNUM;
+
+	reset_vring_queue(dev->virtqueue[base_idx + VIRTIO_RXQ], qp_idx);
+	reset_vring_queue(dev->virtqueue[base_idx + VIRTIO_TXQ], qp_idx);
+}
+
 static int
 alloc_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx)
 {
@@ -362,7 +381,7 @@ reset_device(struct virtio_net *dev)
 	dev->flags = 0;
 
 	for (i = 0; i < dev->virt_qp_nb; i++)
-		init_vring_queue_pair(dev, i);
+		reset_vring_queue_pair(dev, i);
 }
 
 /*
-- 
2.1.4

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

end of thread, other threads:[~2015-11-24 19:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-19  6:23 [dpdk-dev] [PATCH] vhost: Fix reset_owner message handling not to clear callfd Tetsuya Mukawa
2015-11-19  7:03 ` Yuanhan Liu
2015-11-19  7:12   ` Tetsuya Mukawa
2015-11-19  9:07 ` [dpdk-dev] [PATCH v2] " Tetsuya Mukawa
2015-11-20 11:21   ` Yuanhan Liu
2015-11-24  4:42     ` Tetsuya Mukawa
2015-11-24  6:45   ` [dpdk-dev] [PATCH v3] " Tetsuya Mukawa
2015-11-24  7:15     ` Yuanhan Liu
2015-11-24 19:04       ` Thomas Monjalon

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).