[v3] net/ice: fix segmentation fault with a wrong package
diff mbox series

Message ID 1573105623-231389-1-git-send-email-simei.su@intel.com
State Accepted
Delegated to: xiaolong ye
Headers show
Series
  • [v3] net/ice: fix segmentation fault with a wrong package
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Simei Su Nov. 7, 2019, 5:47 a.m. UTC
This patch fixes core dump issue when entering safe mode with a
wrong ice.pkg. In safe mode, rte_flow is not supported and it
won't initialize any flow engine.

Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Qi Zhang Nov. 7, 2019, 6:14 a.m. UTC | #1
> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Thursday, November 7, 2019 1:47 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>;
> Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Su, Simei <simei.su@intel.com>
> Subject: [PATCH v3] net/ice: fix segmentation fault with a wrong package
> 
> This patch fixes core dump issue when entering safe mode with a wrong
> ice.pkg. In safe mode, rte_flow is not supported and it won't initialize any flow
> engine.
> 
> Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")
> 
> Signed-off-by: Simei Su <simei.su@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Ye Xiaolong Nov. 11, 2019, 9:06 a.m. UTC | #2
Hi, simei

On 11/07, Simei Su wrote:
>This patch fixes core dump issue when entering safe mode with a
>wrong ice.pkg. In safe mode, rte_flow is not supported and it
>won't initialize any flow engine.
>
>Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")
>
>Signed-off-by: Simei Su <simei.su@intel.com>
>---
> drivers/net/ice/ice_ethdev.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
>index d81eb5e..2a28d8e 100644
>--- a/drivers/net/ice/ice_ethdev.c
>+++ b/drivers/net/ice/ice_ethdev.c
>@@ -2164,10 +2164,12 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
> 	/* get base queue pairs index  in the device */
> 	ice_base_queue_get(pf);
> 
>-	ret = ice_flow_init(ad);
>-	if (ret) {
>-		PMD_INIT_LOG(ERR, "Failed to initialize flow");
>-		return ret;
>+	if (!ad->is_safe_mode) {
>+		ret = ice_flow_init(ad);
>+		if (ret) {
>+			PMD_INIT_LOG(ERR, "Failed to initialize flow");
>+			return ret;
>+		}

Do we need to print out some message indicates that now ice is in safe mode? 

Thanks,
Xiaolong

> 	}
> 
> 	ret = ice_reset_fxp_resource(hw);
>@@ -2311,7 +2313,8 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
> 
> 	ice_dev_stop(dev);
> 
>-	ice_flow_uninit(ad);
>+	if (!ad->is_safe_mode)
>+		ice_flow_uninit(ad);
> 
> 	/* release all queue resource */
> 	ice_free_queues(dev);
>-- 
>1.8.3.1
>
Simei Su Nov. 12, 2019, 4:40 a.m. UTC | #3
Hi, xiaolong

> -----Original Message-----
> From: Ye, Xiaolong <xiaolong.ye@intel.com>
> Sent: Monday, November 11, 2019 5:06 PM
> To: Su, Simei <simei.su@intel.com>
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; dev@dpdk.org
> Subject: Re: [PATCH v3] net/ice: fix segmentation fault with a wrong package
> 
> Hi, simei
> 
> On 11/07, Simei Su wrote:
> >This patch fixes core dump issue when entering safe mode with a wrong
> >ice.pkg. In safe mode, rte_flow is not supported and it won't
> >initialize any flow engine.
> >
> >Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")
> >
> >Signed-off-by: Simei Su <simei.su@intel.com>
> >---
> > drivers/net/ice/ice_ethdev.c | 13 ++++++++-----
> > 1 file changed, 8 insertions(+), 5 deletions(-)
> >
> >diff --git a/drivers/net/ice/ice_ethdev.c
> >b/drivers/net/ice/ice_ethdev.c index d81eb5e..2a28d8e 100644
> >--- a/drivers/net/ice/ice_ethdev.c
> >+++ b/drivers/net/ice/ice_ethdev.c
> >@@ -2164,10 +2164,12 @@ static int ice_parse_devargs(struct rte_eth_dev
> *dev)
> > 	/* get base queue pairs index  in the device */
> > 	ice_base_queue_get(pf);
> >
> >-	ret = ice_flow_init(ad);
> >-	if (ret) {
> >-		PMD_INIT_LOG(ERR, "Failed to initialize flow");
> >-		return ret;
> >+	if (!ad->is_safe_mode) {
> >+		ret = ice_flow_init(ad);
> >+		if (ret) {
> >+			PMD_INIT_LOG(ERR, "Failed to initialize flow");
> >+			return ret;
> >+		}
> 
> Do we need to print out some message indicates that now ice is in safe mode?
> 

  We already have print info when ice is in safe mode. Thanks!

  Br
  Simei

> Thanks,
> Xiaolong
> 
> > 	}
> >
> > 	ret = ice_reset_fxp_resource(hw);
> >@@ -2311,7 +2313,8 @@ static int ice_parse_devargs(struct rte_eth_dev
> >*dev)
> >
> > 	ice_dev_stop(dev);
> >
> >-	ice_flow_uninit(ad);
> >+	if (!ad->is_safe_mode)
> >+		ice_flow_uninit(ad);
> >
> > 	/* release all queue resource */
> > 	ice_free_queues(dev);
> >--
> >1.8.3.1
> >
Ye Xiaolong Nov. 13, 2019, 2:07 a.m. UTC | #4
On 11/07, Simei Su wrote:
>This patch fixes core dump issue when entering safe mode with a
>wrong ice.pkg. In safe mode, rte_flow is not supported and it
>won't initialize any flow engine.
>
>Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")
>
>Signed-off-by: Simei Su <simei.su@intel.com>
>---
> drivers/net/ice/ice_ethdev.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
>index d81eb5e..2a28d8e 100644
>--- a/drivers/net/ice/ice_ethdev.c
>+++ b/drivers/net/ice/ice_ethdev.c
>@@ -2164,10 +2164,12 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
> 	/* get base queue pairs index  in the device */
> 	ice_base_queue_get(pf);
> 
>-	ret = ice_flow_init(ad);
>-	if (ret) {
>-		PMD_INIT_LOG(ERR, "Failed to initialize flow");
>-		return ret;
>+	if (!ad->is_safe_mode) {
>+		ret = ice_flow_init(ad);
>+		if (ret) {
>+			PMD_INIT_LOG(ERR, "Failed to initialize flow");
>+			return ret;
>+		}
> 	}
> 
> 	ret = ice_reset_fxp_resource(hw);
>@@ -2311,7 +2313,8 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
> 
> 	ice_dev_stop(dev);
> 
>-	ice_flow_uninit(ad);
>+	if (!ad->is_safe_mode)
>+		ice_flow_uninit(ad);
> 
> 	/* release all queue resource */
> 	ice_free_queues(dev);
>-- 
>1.8.3.1
>

Applied to dpdk-next-net-intel. Thanks.

Patch
diff mbox series

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index d81eb5e..2a28d8e 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2164,10 +2164,12 @@  static int ice_parse_devargs(struct rte_eth_dev *dev)
 	/* get base queue pairs index  in the device */
 	ice_base_queue_get(pf);
 
-	ret = ice_flow_init(ad);
-	if (ret) {
-		PMD_INIT_LOG(ERR, "Failed to initialize flow");
-		return ret;
+	if (!ad->is_safe_mode) {
+		ret = ice_flow_init(ad);
+		if (ret) {
+			PMD_INIT_LOG(ERR, "Failed to initialize flow");
+			return ret;
+		}
 	}
 
 	ret = ice_reset_fxp_resource(hw);
@@ -2311,7 +2313,8 @@  static int ice_parse_devargs(struct rte_eth_dev *dev)
 
 	ice_dev_stop(dev);
 
-	ice_flow_uninit(ad);
+	if (!ad->is_safe_mode)
+		ice_flow_uninit(ad);
 
 	/* release all queue resource */
 	ice_free_queues(dev);