From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1F9C0A0507; Wed, 27 Apr 2022 11:18:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3393E42844; Wed, 27 Apr 2022 11:17:01 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id C4CB24281E for ; Wed, 27 Apr 2022 11:16:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651051014; x=1682587014; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=1y6KqWowvtH1fe0AsCdYRP4lfrjY0EivF0010G/JchA=; b=CUzqvQkHxQvlQjyAshknIlP7ii7VKtaRTkKSWsKbjICc39y2NbmeJ0Xv 1e1SZOINTV3dQDCx+js5xkZ//d63cebUvBUi+NPgD459nj7NXd4y1NBtC onRxYAiCZTRoAkAaxr++n8yP/RQBvL+6U0phNbwuEuZnN8/v3Y0dHfE7x T1kgF00aNmELidCxoyha+uEXdDskPnrx5I9ANM8ptCJSjP8d/r9Mh3lTj rdDIrb/iExebeDhKEiW7dQX1qaghLEN/V73MoTg6qhCi0oKpbuh5UVZHx 4HTPpJzNaHctRltUn/QOK13W3l2ehF0Zyjadz/4hz+PpD5TErVqpwlB+z A==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="352308392" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="352308392" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2022 02:16:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="580488847" Received: from dpdk-dipei.sh.intel.com ([10.67.110.238]) by orsmga008.jf.intel.com with ESMTP; 27 Apr 2022 02:16:51 -0700 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com, changpeng.liu@intel.com Subject: [PATCH v7 17/18] vdpa/ifc: blk device pause without no inflight IO Date: Wed, 27 Apr 2022 16:30:05 +0800 Message-Id: <1651048206-282372-18-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1651048206-282372-1-git-send-email-andy.pei@intel.com> References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> <1651048206-282372-1-git-send-email-andy.pei@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When virtio blk device is pause, make sure hardware last_avail_idx and last_used_idx are the same. Signed-off-by: Andy Pei --- drivers/vdpa/ifc/ifcvf_vdpa.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 4923bc1..def6adf 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -314,12 +314,12 @@ struct rte_vdpa_dev_info { vdpa_ifcvf_stop(struct ifcvf_internal *internal) { struct ifcvf_hw *hw = &internal->hw; - struct rte_vhost_vring vq; uint32_t i; int vid; uint64_t features = 0; uint64_t log_base = 0, log_size = 0; uint64_t len; + u32 ring_state = 0; vid = internal->vid; @@ -328,13 +328,22 @@ struct rte_vdpa_dev_info { */ if (internal->device_type == IFCVF_BLK) { for (i = 0; i < hw->nr_vring; i++) { - rte_vhost_get_vhost_vring(internal->vid, i, &vq); - while (vq.avail->idx != vq.used->idx) { - ifcvf_notify_queue(hw, i); - usleep(10); - } - hw->vring[i].last_avail_idx = vq.avail->idx; - hw->vring[i].last_used_idx = vq.used->idx; + do { + if (hw->lm_cfg != NULL) + ring_state = *(u32 *)(hw->lm_cfg + + IFCVF_LM_RING_STATE_OFFSET + + i * IFCVF_LM_CFG_SIZE); + hw->vring[i].last_avail_idx = + (u16)(ring_state & IFCVF_16_BIT_MASK); + hw->vring[i].last_used_idx = + (u16)(ring_state >> 16); + if (hw->vring[i].last_avail_idx != + hw->vring[i].last_used_idx) { + ifcvf_notify_queue(hw, i); + usleep(10); + } + } while (hw->vring[i].last_avail_idx != + hw->vring[i].last_used_idx); } } -- 1.8.3.1