net/ifc: fix mediated vring initialization
authorXiao Wang <xiao.w.wang@intel.com>
Mon, 15 Apr 2019 07:56:24 +0000 (15:56 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 19 Apr 2019 12:51:54 +0000 (14:51 +0200)
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")
Cc: stable@dpdk.org
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
drivers/net/ifc/ifcvf_vdpa.c

index 619cdc2..9e729ff 100644 (file)
@@ -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);