From patchwork Fri Sep 14 01:25:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Wang X-Patchwork-Id: 44705 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7375E7CB0; Fri, 14 Sep 2018 03:32:09 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id BB26D5F65 for ; Fri, 14 Sep 2018 03:32:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Sep 2018 18:32:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,371,1531810800"; d="scan'208";a="91592862" Received: from dpdk-xiao-1.sh.intel.com ([10.67.111.123]) by orsmga002.jf.intel.com with ESMTP; 13 Sep 2018 18:31:57 -0700 From: Xiao Wang To: xiaolong.ye@intel.com Cc: tiwei.bie@intel.com, dev@dpdk.org, Xiao Wang Date: Fri, 14 Sep 2018 09:25:17 +0800 Message-Id: <20180914012517.44977-1-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180910110531.138449-1-xiao.w.wang@intel.com> References: <20180910110531.138449-1-xiao.w.wang@intel.com> Subject: [dpdk-dev] [PATCH v2] net/ifc: do not notify before HW ready 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" If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the relay thread kicks it before HW is properly re-configured, a bad DMA request may happen. Besides, the notify_addr which is used by the relay thread is set in the vdpa_ifcvf_start function, if a kick relay happens before vdpa_ifcvf_start finishes, a null addr is accessed. Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") Signed-off-by: Xiao Wang Reviewed-by: Ye Xiaolong --- v2: * Add description for the fix in the commit log. --- drivers/net/ifc/ifcvf_vdpa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c index 3c5430dc0..7d3085d8d 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal) if (ret) goto err; - ret = setup_notify_relay(internal); + ret = vdpa_ifcvf_start(internal); if (ret) goto err; - ret = vdpa_ifcvf_start(internal); + ret = setup_notify_relay(internal); if (ret) goto err; @@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) } else if (rte_atomic32_read(&internal->running) && (!rte_atomic32_read(&internal->started) || !rte_atomic32_read(&internal->dev_attached))) { - vdpa_ifcvf_stop(internal); - ret = unset_notify_relay(internal); if (ret) goto err; + vdpa_ifcvf_stop(internal); + ret = vdpa_disable_vfio_intr(internal); if (ret) goto err;