From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EF60C10F0E for ; Mon, 15 Apr 2019 08:12:28 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 1D95120674 for ; Mon, 15 Apr 2019 08:12:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D95120674 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org 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" 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