From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 2AA1A1B46A; Wed, 28 Nov 2018 10:55:54 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2018 01:55:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,290,1539673200"; d="scan'208";a="112891149" Received: from dpdk-xiao-1.sh.intel.com ([10.67.111.106]) by orsmga001.jf.intel.com with ESMTP; 28 Nov 2018 01:55:52 -0800 From: Xiao Wang To: tiwei.bie@intel.com, maxime.coquelin@redhat.com Cc: dev@dpdk.org, zhihong.wang@intel.com, xiaolong.ye@intel.com, Xiao Wang , stable@dpdk.org Date: Wed, 28 Nov 2018 17:46:02 +0800 Message-Id: <20181128094607.106173-5-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20181128094607.106173-1-xiao.w.wang@intel.com> References: <20181128094607.106173-1-xiao.w.wang@intel.com> Subject: [dpdk-dev] [PATCH 4/9] net/ifc: store only registered device instance 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: , X-List-Received-Date: Wed, 28 Nov 2018 09:55:54 -0000 If driver fails to register ifc VF device into vhost lib, then this device should not be stored. Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") cc: stable@dpdk.org Signed-off-by: Xiao Wang --- 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 aacd5f9bf..6fcd50b73 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -781,10 +781,6 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, internal->dev_addr.type = PCI_ADDR; list->internal = internal; - pthread_mutex_lock(&internal_list_lock); - TAILQ_INSERT_TAIL(&internal_list, list, next); - pthread_mutex_unlock(&internal_list_lock); - internal->did = rte_vdpa_register_device(&internal->dev_addr, &ifcvf_ops); if (internal->did < 0) { @@ -792,6 +788,10 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, goto error; } + pthread_mutex_lock(&internal_list_lock); + TAILQ_INSERT_TAIL(&internal_list, list, next); + pthread_mutex_unlock(&internal_list_lock); + rte_atomic32_set(&internal->started, 1); update_datapath(internal); -- 2.15.1