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 D9DDCA0542; Mon, 24 Oct 2022 17:34:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 319AB42C07; Mon, 24 Oct 2022 17:33:20 +0200 (CEST) Received: from cvbackendsmtp001.nmdf.navercorp.com (cvbackendsmtp001.nmdf.navercorp.com [125.209.246.147]) by mails.dpdk.org (Postfix) with ESMTP id 6C8CF40143 for ; Tue, 18 Oct 2022 09:22:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=navercorp.com; s=s20171120; t=1666077767; bh=03W03VsQtV0pZ55Aq6ydQ1M+1bmcwzVv4I2UzOwOv/8=; h=From:To:Subject:Date:Message-Id:From:Subject:Feedback-ID: X-Works-Security; b=a4hbIxrUnWLkmTGHLcpkdvP3elph1IbRubJXmmEzk2fmALacAKm2rz6cVMlMelMfn jd0TueUTRL27BDtZeCL/kxMAnCBOLDVq2zuXo7zdv1Cbq3Zl3BJ6Khr4KBM1TwNoVT fQAnhhew4chMQf+TbndJt8/r/gRQ4B5tKmRyBNbxSmumcDPwv+0KUDnDyEGVQH3Mte PLE6ucBUGskvgLspWNtXNgRZDAY/1NHBMZSB1GAAZKMUzWhZ0n2CF6f60nBFWAoOui VSSUcndsuWVz0Kmevs46GAuOt2h7vvcrYzE8hR4XXQ16rncnUG7YATBSA+Q+KUUiaj EAlm8GzP7c33g== X-Session-ID: FRn0LCCAQS+mzfTXHen+vQ X-Works-Smtp-Source: XXKdKAMrFoJCpNmXFoK9WHF0 Received: from dev-tkkim-git-send-email-ncl.nfra.io ([10.113.149.62]) by cvbackendsmtp001.nmdf.navercorp.com with ESMTP id FRn0LCCAQS+mzfTXHen+vQ for ; Tue, 18 Oct 2022 07:22:47 -0000 From: Taekyung Kim To: dev@dpdk.org Cc: Maxime Coquelin , Taekyung Kim Subject: [PATCH] vdpa/ifc: fix update_datapath error handling Date: Tue, 18 Oct 2022 16:22:40 +0900 Message-Id: <20221018072240.128791-1-kim.tae.kyung@navercorp.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 24 Oct 2022 17:33:00 +0200 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 Stop and return the error code if update_datapath fails. update_datapath prepares resources for the vdpa device. The driver should not perform any further actions if update_datapath returns an error. Signed-off-by: Taekyung Kim --- drivers/vdpa/ifc/ifcvf_vdpa.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index d5ac583589..795967e998 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1063,7 +1063,10 @@ ifcvf_dev_config(int vid) internal = list->internal; internal->vid = vid; rte_atomic32_set(&internal->dev_attached, 1); - update_datapath(internal); + if (update_datapath(internal) < 0) { + DRV_LOG(ERR, "failed to update datapath: %p", vdev); + return -1; + } if (rte_vhost_host_notifier_ctrl(vid, RTE_VHOST_QUEUE_ALL, true) != 0) DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", @@ -1105,7 +1108,10 @@ ifcvf_dev_close(int vid) internal->sw_fallback_running = false; } else { rte_atomic32_set(&internal->dev_attached, 0); - update_datapath(internal); + if (update_datapath(internal) < 0) { + DRV_LOG(ERR, "failed to update datapath: %p", vdev); + return -1; + } } internal->configured = 0; @@ -1632,7 +1638,10 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, pthread_mutex_unlock(&internal_list_lock); rte_atomic32_set(&internal->started, 1); - update_datapath(internal); + if (update_datapath(internal) < 0) { + DRV_LOG(ERR, "failed to update datapath: %s", pci_dev->name); + return -1; + } rte_kvargs_free(kvlist); return 0; @@ -1661,7 +1670,10 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev) internal = list->internal; rte_atomic32_set(&internal->started, 0); - update_datapath(internal); + if (update_datapath(internal) < 0) { + DRV_LOG(ERR, "failed to update datapath: %s", pci_dev->name); + return -1; + } rte_pci_unmap_device(internal->pdev); rte_vfio_container_destroy(internal->vfio_container_fd); -- 2.30.1 (Apple Git-130)