From patchwork Tue Oct 18 01:45:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taekyung Kim X-Patchwork-Id: 119040 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 366BEA0542; Mon, 24 Oct 2022 17:34:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6221642C01; Mon, 24 Oct 2022 17:33:18 +0200 (CEST) Received: from cvbackendsmtp001.nmdf.navercorp.com (cvbackendsmtp001.nmdf.navercorp.com [125.209.246.148]) by mails.dpdk.org (Postfix) with ESMTP id 6E14F4021E for ; Tue, 18 Oct 2022 03:45:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=navercorp.com; s=s20171120; t=1666057539; bh=03W03VsQtV0pZ55Aq6ydQ1M+1bmcwzVv4I2UzOwOv/8=; h=From:To:Subject:Date:Message-Id:From:Subject:Feedback-ID: X-Works-Security; b=Rja4/efoNWs4bBy83gMRsOD0ADaTX4e1yL8ZUo10GLBsTVwTcpsRK1gY1AXQD50GH G3idROR2CHqwhgZwtxP++dzf1xKvNp5NwKbzuMThsKGZSRgCYQTooKd4dkmZ6f9bVj zFWAohu/W708KUKbpP4URQ2Uwn4iYdLaNaukHnXX+7YkTvlohmZvj+chmv2SBUZY7U aC/5PpaT+XAXGL4XyPB0lOHhxJx8w5QrlW5s+3hs1Vu2eHdmebXqlS2Sj1CgUUx73x 1tW7TgFeD56Z5FiuVroh2rtiAdfO114OGgvrzV9PDOhg9d72gLTA+deuMT9ROBfCFH lqkS0z01zY1fg== X-Session-ID: e2l0O-PBS5O33tUHNjDWow X-Works-Smtp-Source: 9rbZKAMrFoJCpNmlKqu9WHF0 Received: from dev-tkkim-git-send-email-ncl.nfra.io ([10.113.149.62]) by cvbackendsmtp001.nmdf.navercorp.com with ESMTP id e2l0O-PBS5O33tUHNjDWow for ; Tue, 18 Oct 2022 01:45:39 -0000 From: Taekyung Kim To: dev@dpdk.org Cc: Taekyung Kim , Xiao Wang Subject: [PATCH] vdpa/ifc: fix update datapath error handling Date: Tue, 18 Oct 2022 10:45:11 +0900 Message-Id: <20221018014511.106207-1-kim.tae.kyung@navercorp.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 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);