DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vdpa/ifc: fix update_datapath error handling
@ 2022-10-18  7:22 Taekyung Kim
  2022-11-02  9:12 ` Maxime Coquelin
  0 siblings, 1 reply; 26+ messages in thread
From: Taekyung Kim @ 2022-10-18  7:22 UTC (permalink / raw)
  To: dev; +Cc: Maxime Coquelin, Taekyung Kim

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 <kim.tae.kyung@navercorp.com>
---
 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)


^ permalink raw reply	[flat|nested] 26+ messages in thread
* [PATCH] vdpa/ifc: fix update datapath error handling
@ 2022-10-18  1:45 Taekyung Kim
  0 siblings, 0 replies; 26+ messages in thread
From: Taekyung Kim @ 2022-10-18  1:45 UTC (permalink / raw)
  To: dev; +Cc: Taekyung Kim, Xiao Wang

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 <kim.tae.kyung@navercorp.com>
---
 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)


^ permalink raw reply	[flat|nested] 26+ messages in thread
* [PATCH] vdpa/ifc: fix update_datapath error handling
@ 2022-10-14 13:18 Taekyung Kim
  0 siblings, 0 replies; 26+ messages in thread
From: Taekyung Kim @ 2022-10-14 13:18 UTC (permalink / raw)
  To: dev; +Cc: Taekyung Kim, Xiao Wang

Stop and return the error code when 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 <kim.tae.kyung@navercorp.com>
---
 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.37.0 (Apple Git-136)


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-11-10  9:45 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18  7:22 [PATCH] vdpa/ifc: fix update_datapath error handling Taekyung Kim
2022-11-02  9:12 ` Maxime Coquelin
2022-11-07  5:34   ` [PATCH v2] " Taekyung Kim
2022-11-07  8:59     ` [PATCH v3] " Taekyung Kim
2022-11-08  1:46       ` Xia, Chenbo
2022-11-08  7:30         ` Taekyung Kim
2022-11-08  7:39         ` Pei, Andy
2022-11-08  7:56           ` Xia, Chenbo
2022-11-08  8:27             ` Taekyung Kim
2022-11-08  8:56             ` [PATCH v4] " Taekyung Kim
2022-11-08 13:49               ` Maxime Coquelin
2022-11-09 10:45                 ` Taekyung Kim
2022-11-09  2:39               ` Pei, Andy
2022-11-09 10:47                 ` Taekyung Kim
2022-11-10  1:53               ` Xia, Chenbo
2022-11-10  4:02                 ` Taekyung Kim
2022-11-10  9:20                   ` Maxime Coquelin
2022-11-10  9:34                     ` Ali Alnubani
2022-11-10  9:38                       ` David Marchand
2022-11-10  9:45                         ` Taekyung Kim
2022-11-10  9:42                       ` Maxime Coquelin
2022-11-10  4:09                 ` [PATCH v5] " Taekyung Kim
2022-11-10  6:12                   ` Xia, Chenbo
2022-11-10  7:02                   ` Xia, Chenbo
  -- strict thread matches above, loose matches on Subject: below --
2022-10-18  1:45 [PATCH] vdpa/ifc: fix update datapath " Taekyung Kim
2022-10-14 13:18 [PATCH] vdpa/ifc: fix update_datapath " Taekyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).