From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3AB8AA00E6 for ; Mon, 15 Apr 2019 10:12:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 341121B128; Mon, 15 Apr 2019 10:12:12 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 84BEF1B11A for ; Mon, 15 Apr 2019 10:12:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 01:12:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,352,1549958400"; d="scan'208";a="161962082" Received: from dpdk-xiao-1.sh.intel.com ([10.67.111.145]) by fmsmga004.fm.intel.com with ESMTP; 15 Apr 2019 01:12:09 -0700 From: Xiao Wang To: maxime.coquelin@redhat.com Cc: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com, zhe.wan@intel.com, Xiao Wang Date: Mon, 15 Apr 2019 15:56:25 +0800 Message-Id: <20190415075625.109948-4-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20190415075625.109948-1-xiao.w.wang@intel.com> References: <20190415075625.109948-1-xiao.w.wang@intel.com> Subject: [dpdk-dev] [PATCH 3/3] net/ifc: fix used ring update X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190415075625.1UU6uDr5ZE81bArHXNNTJu-dGHX3C3RWmsokgb675-A@z> The vring relay thread is created after HW datapath start and is canceled before HW datapath stop, so we need to take care of the ring update when the relay thread is not on duty. Fixes: 4bb531e152d3 ("net/ifc: support SW assisted VDPA live migration") Signed-off-by: Xiao Wang --- drivers/net/ifc/ifcvf_vdpa.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c index 9e729ff72..e59084034 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -81,6 +81,8 @@ static struct internal_list_head internal_list = static pthread_mutex_t internal_list_lock = PTHREAD_MUTEX_INITIALIZER; +static void update_used_ring(struct ifcvf_internal *internal, uint16_t qid); + static struct internal_list * find_internal_resource_by_did(int did) { @@ -666,6 +668,10 @@ m_ifcvf_stop(struct ifcvf_internal *internal) ifcvf_stop_hw(hw); for (i = 0; i < hw->nr_vring; i++) { + /* synchronize remaining new used entries if any */ + if ((i & 1) == 0) + update_used_ring(internal, i); + rte_vhost_get_vhost_vring(vid, i, &vq); len = IFCVF_USED_RING_LEN(vq.size); rte_vhost_log_used_vring(vid, i, 0, len); @@ -735,6 +741,7 @@ vring_relay(void *arg) DRV_LOG(ERR, "epoll add error: %s", strerror(errno)); return NULL; } + update_used_ring(internal, qid); } /* start relay with a first kick */ -- 2.15.1