[2/3] net/ifc: fix mediated vring initialization

Message ID 20190415075625.109948-3-xiao.w.wang@intel.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • net/ifc: SW relay improvement and fix
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Xiao Wang April 15, 2019, 7:56 a.m.
The mediated vring's index should be set as initial value before enabling
HW datapath.

Fixes: 4bb531e152d3 ("net/ifc: support SW assisted VDPA live migration")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ifc/ifcvf_vdpa.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
index 619cdc245..9e729ff72 100644
--- a/drivers/net/ifc/ifcvf_vdpa.c
+++ b/drivers/net/ifc/ifcvf_vdpa.c
@@ -631,6 +631,10 @@  m_ifcvf_start(struct ifcvf_internal *internal)
 
 		hw->vring[i].size = vq.size;
 
+		rte_vhost_get_vring_base(vid, i,
+				&internal->m_vring[i].avail->idx,
+				&internal->m_vring[i].used->idx);
+
 		rte_vhost_get_vring_base(vid, i, &hw->vring[i].last_avail_idx,
 				&hw->vring[i].last_used_idx);
 
@@ -702,11 +706,6 @@  vring_relay(void *arg)
 
 	vid = internal->vid;
 	q_num = rte_vhost_get_vring_num(vid);
-	/* prepare the mediated vring */
-	for (qid = 0; qid < q_num; qid++)
-		rte_vhost_get_vring_base(vid, qid,
-				&internal->m_vring[qid].avail->idx,
-				&internal->m_vring[qid].used->idx);
 
 	/* add notify fd and interrupt fd to epoll */
 	epfd = epoll_create(IFCVF_MAX_QUEUES * 2);