net/ice: fix deadlock on flow redirect

Message ID 20211011073850.378080-1-dapengx.yu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/ice: fix deadlock on flow redirect |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Yu, DapengX Oct. 11, 2021, 7:38 a.m. UTC
  From: Dapeng Yu <dapengx.yu@intel.com>

If flow redirect failed, the spinlock will not be unlocked.
This patch fixes it.

Fixes: bc9201388d56 ("net/ice: support flow redirect")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
 drivers/net/ice/ice_generic_flow.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Qi Zhang Oct. 13, 2021, 10:51 a.m. UTC | #1
> -----Original Message-----
> From: Yu, DapengX <dapengx.yu@intel.com>
> Sent: Monday, October 11, 2021 3:39 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/ice: fix deadlock on flow redirect
> 
> From: Dapeng Yu <dapengx.yu@intel.com>
> 
> If flow redirect failed, the spinlock will not be unlocked.
> This patch fixes it.
> 
> Fixes: bc9201388d56 ("net/ice: support flow redirect")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 3e6ed7005b..02f854666a 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -2542,7 +2542,7 @@  ice_flow_redirect(struct ice_adapter *ad,
 	struct ice_pf *pf = &ad->pf;
 	struct rte_flow *p_flow;
 	void *temp;
-	int ret;
+	int ret = 0;
 
 	rte_spinlock_lock(&pf->flow_ops_lock);
 
@@ -2552,11 +2552,11 @@  ice_flow_redirect(struct ice_adapter *ad,
 		ret = p_flow->engine->redirect(ad, p_flow, rd);
 		if (ret) {
 			PMD_DRV_LOG(ERR, "Failed to redirect flows");
-			return ret;
+			break;
 		}
 	}
 
 	rte_spinlock_unlock(&pf->flow_ops_lock);
 
-	return 0;
+	return ret;
 }