DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: fix port segmentation fault when restart
@ 2017-11-15  5:46 Wei Zhao
  2017-11-15  5:55 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  0 siblings, 1 reply; 9+ messages in thread
From: Wei Zhao @ 2017-11-15  5:46 UTC (permalink / raw)
  To: dev; +Cc: Wei Zhao

It will clear all queue region related configuration
when dev stop even if threr is no queue region config,
so this may cause error. So add check when flush queue
region config and delete it when device stop.

Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c  |  3 ---
 drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 811cc9f..7a1290b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
-	/* Remove all the queue region configuration */
-	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
-
 	hw->adapter_stopped = 1;
 }
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index aeb92af..8f94faa 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
 		return 0;
 	}
 
-	info->queue_region_number = 1;
-	info->region[0].queue_num = main_vsi->nb_used_qps;
-	info->region[0].queue_start_index = 0;
+	if (info->queue_region_number) {
+		info->queue_region_number = 1;
+		info->region[0].queue_num = main_vsi->nb_used_qps;
+		info->region[0].queue_start_index = 0;
 
-	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
-	if (ret != I40E_SUCCESS)
-		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
-
-	ret = i40e_dcb_init_configure(dev, TRUE);
-	if (ret != I40E_SUCCESS) {
-		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
-		pf->flags &= ~I40E_FLAG_DCB;
-	}
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+			if (ret != I40E_SUCCESS)
+			PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
 
-	i40e_init_queue_region_conf(dev);
+		ret = i40e_dcb_init_configure(dev, TRUE);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			pf->flags &= ~I40E_FLAG_DCB;
+		}
 
+		i40e_init_queue_region_conf(dev);
+	}
 	return 0;
 }
 
-- 
2.7.4

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

* [dpdk-dev] [PATCH v2] net/i40e: fix port segmentation fault when restart
  2017-11-15  5:46 [dpdk-dev] [PATCH] net/i40e: fix port segmentation fault when restart Wei Zhao
@ 2017-11-15  5:55 ` Wei Zhao
  2017-12-22  3:30   ` Zhang, Qi Z
  2018-01-03  7:17   ` [dpdk-dev] [PATCH v3] " Wei Zhao
  0 siblings, 2 replies; 9+ messages in thread
From: Wei Zhao @ 2017-11-15  5:55 UTC (permalink / raw)
  To: dev; +Cc: Wei Zhao

It will clear all queue region related configuration
when dev stop even if threr is no queue region config,
so this may cause error. So add check when flush queue
region config and delete it when device stop.

Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-fix patch check warning.
---
 drivers/net/i40e/i40e_ethdev.c  |  3 ---
 drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 811cc9f..7a1290b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
-	/* Remove all the queue region configuration */
-	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
-
 	hw->adapter_stopped = 1;
 }
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index aeb92af..c2e2466 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
 		return 0;
 	}
 
-	info->queue_region_number = 1;
-	info->region[0].queue_num = main_vsi->nb_used_qps;
-	info->region[0].queue_start_index = 0;
+	if (info->queue_region_number) {
+		info->queue_region_number = 1;
+		info->region[0].queue_num = main_vsi->nb_used_qps;
+		info->region[0].queue_start_index = 0;
 
-	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
-	if (ret != I40E_SUCCESS)
-		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
-
-	ret = i40e_dcb_init_configure(dev, TRUE);
-	if (ret != I40E_SUCCESS) {
-		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
-		pf->flags &= ~I40E_FLAG_DCB;
-	}
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS)
+			PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
 
-	i40e_init_queue_region_conf(dev);
+		ret = i40e_dcb_init_configure(dev, TRUE);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			pf->flags &= ~I40E_FLAG_DCB;
+		}
 
+		i40e_init_queue_region_conf(dev);
+	}
 	return 0;
 }
 
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix port segmentation fault when restart
  2017-11-15  5:55 ` [dpdk-dev] [PATCH v2] " Wei Zhao
@ 2017-12-22  3:30   ` Zhang, Qi Z
  2018-01-03  6:10     ` Zhao1, Wei
  2018-01-03  7:17   ` [dpdk-dev] [PATCH v3] " Wei Zhao
  1 sibling, 1 reply; 9+ messages in thread
From: Zhang, Qi Z @ 2017-12-22  3:30 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Zhao1, Wei

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
> Sent: Wednesday, November 15, 2017 1:55 PM
> To: dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix port segmentation fault when
> restart
> 
> It will clear all queue region related configuration when dev stop even if threr

s/threr/there

> is no queue region config, so this may cause error. So add check when flush
> queue region config and delete it when device stop.
> 
> Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> ---
> 
> v2:
> -fix patch check warning.
> ---
>  drivers/net/i40e/i40e_ethdev.c  |  3 ---
> drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
>  2 files changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 811cc9f..7a1290b 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
>  	/* reset hierarchy commit */
>  	pf->tm_conf.committed = false;
> 
> -	/* Remove all the queue region configuration */
> -	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
> -
>From the commit log, the reason you remove above line is because the function can't handle the situation when no queue region config, 
but what about the case that queue region config does exist? Could you add more message to explain why this not be impacted.

>  	hw->adapter_stopped = 1;
>  }
> 
> diff --git a/drivers/net/i40e/rte_pmd_i40e.c
> b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.c
> +++ b/drivers/net/i40e/rte_pmd_i40e.c
> @@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct
> rte_eth_dev *dev,
>  		return 0;
>  	}
> 
> -	info->queue_region_number = 1;
> -	info->region[0].queue_num = main_vsi->nb_used_qps;
> -	info->region[0].queue_start_index = 0;
> +	if (info->queue_region_number) {
> +		info->queue_region_number = 1;
> +		info->region[0].queue_num = main_vsi->nb_used_qps;
> +		info->region[0].queue_start_index = 0;
> 
> -	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> -	if (ret != I40E_SUCCESS)
> -		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
> -
> -	ret = i40e_dcb_init_configure(dev, TRUE);
> -	if (ret != I40E_SUCCESS) {
> -		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> -		pf->flags &= ~I40E_FLAG_DCB;
> -	}
> +		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> +		if (ret != I40E_SUCCESS)
> +			PMD_DRV_LOG(INFO, "Failed to flush queue region
> mapping.");

WARNING: line over 80 characters

Regards
Qi

> 
> -	i40e_init_queue_region_conf(dev);
> +		ret = i40e_dcb_init_configure(dev, TRUE);
> +		if (ret != I40E_SUCCESS) {
> +			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> +			pf->flags &= ~I40E_FLAG_DCB;
> +		}
> 
> +		i40e_init_queue_region_conf(dev);
> +	}
>  	return 0;
>  }
> 
> --
> 2.7.4

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix port segmentation fault when restart
  2017-12-22  3:30   ` Zhang, Qi Z
@ 2018-01-03  6:10     ` Zhao1, Wei
  0 siblings, 0 replies; 9+ messages in thread
From: Zhao1, Wei @ 2018-01-03  6:10 UTC (permalink / raw)
  To: Zhang, Qi Z, dev

Hi, zhangqi

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Friday, December 22, 2017 11:31 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v2] net/i40e: fix port segmentation fault
> when restart
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
> > Sent: Wednesday, November 15, 2017 1:55 PM
> > To: dev@dpdk.org
> > Cc: Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix port segmentation fault
> > when restart
> >
> > It will clear all queue region related configuration when dev stop
> > even if threr
> 
> s/threr/there
> 
> > is no queue region config, so this may cause error. So add check when
> > flush queue region config and delete it when device stop.
> >
> > Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> >
> > ---
> >
> > v2:
> > -fix patch check warning.
> > ---
> >  drivers/net/i40e/i40e_ethdev.c  |  3 ---
> > drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
> >  2 files changed, 14 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 811cc9f..7a1290b 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
> >  	/* reset hierarchy commit */
> >  	pf->tm_conf.committed = false;
> >
> > -	/* Remove all the queue region configuration */
> > -	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
> > -
> From the commit log, the reason you remove above line is because the
> function can't handle the situation when no queue region config, but what
> about the case that queue region config does exist? Could you add more
> message to explain why this not be impacted.

Ok, I will add some more info about when queue region config does exist.
In this case, it treat no queue region config as queue region config does exist.



> 
> >  	hw->adapter_stopped = 1;
> >  }
> >
> > diff --git a/drivers/net/i40e/rte_pmd_i40e.c
> > b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644
> > --- a/drivers/net/i40e/rte_pmd_i40e.c
> > +++ b/drivers/net/i40e/rte_pmd_i40e.c
> > @@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct
> > rte_eth_dev *dev,
> >  		return 0;
> >  	}
> >
> > -	info->queue_region_number = 1;
> > -	info->region[0].queue_num = main_vsi->nb_used_qps;
> > -	info->region[0].queue_start_index = 0;
> > +	if (info->queue_region_number) {
> > +		info->queue_region_number = 1;
> > +		info->region[0].queue_num = main_vsi->nb_used_qps;
> > +		info->region[0].queue_start_index = 0;
> >
> > -	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> > -	if (ret != I40E_SUCCESS)
> > -		PMD_DRV_LOG(INFO, "Failed to flush queue region
> mapping.");
> > -
> > -	ret = i40e_dcb_init_configure(dev, TRUE);
> > -	if (ret != I40E_SUCCESS) {
> > -		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> > -		pf->flags &= ~I40E_FLAG_DCB;
> > -	}
> > +		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> > +		if (ret != I40E_SUCCESS)
> > +			PMD_DRV_LOG(INFO, "Failed to flush queue region
> > mapping.");
> 
> WARNING: line over 80 characters

There is a new rule that I has been told by Ferruh Yigit, log message in double quotation marks can over 80 characters.
 
> Regards
> Qi
> 
> >
> > -	i40e_init_queue_region_conf(dev);
> > +		ret = i40e_dcb_init_configure(dev, TRUE);
> > +		if (ret != I40E_SUCCESS) {
> > +			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> > +			pf->flags &= ~I40E_FLAG_DCB;
> > +		}
> >
> > +		i40e_init_queue_region_conf(dev);
> > +	}
> >  	return 0;
> >  }
> >
> > --
> > 2.7.4


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

* [dpdk-dev] [PATCH v3] net/i40e: fix port segmentation fault when restart
  2017-11-15  5:55 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  2017-12-22  3:30   ` Zhang, Qi Z
@ 2018-01-03  7:17   ` Wei Zhao
  2018-01-03  8:19     ` Zhang, Qi Z
  2018-01-12  6:59     ` [dpdk-dev] [PATCH v4] " Wei Zhao
  1 sibling, 2 replies; 9+ messages in thread
From: Wei Zhao @ 2018-01-03  7:17 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

This patch will clear all queue region related configuration
when dev stop even if threr is no queue region config,
so this may cause error. So add check if there is queue
configuration exist when flush queue region config and
remove this process when device stop. Queue region clear
only do when device initialization or PMD get flush command.

Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-fix patch check warning.

v3:
-add more log message.
---
 drivers/net/i40e/i40e_ethdev.c  |  3 ---
 drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 811cc9f..7a1290b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
-	/* Remove all the queue region configuration */
-	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
-
 	hw->adapter_stopped = 1;
 }
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index aeb92af..c2e2466 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
 		return 0;
 	}
 
-	info->queue_region_number = 1;
-	info->region[0].queue_num = main_vsi->nb_used_qps;
-	info->region[0].queue_start_index = 0;
+	if (info->queue_region_number) {
+		info->queue_region_number = 1;
+		info->region[0].queue_num = main_vsi->nb_used_qps;
+		info->region[0].queue_start_index = 0;
 
-	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
-	if (ret != I40E_SUCCESS)
-		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
-
-	ret = i40e_dcb_init_configure(dev, TRUE);
-	if (ret != I40E_SUCCESS) {
-		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
-		pf->flags &= ~I40E_FLAG_DCB;
-	}
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS)
+			PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
 
-	i40e_init_queue_region_conf(dev);
+		ret = i40e_dcb_init_configure(dev, TRUE);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			pf->flags &= ~I40E_FLAG_DCB;
+		}
 
+		i40e_init_queue_region_conf(dev);
+	}
 	return 0;
 }
 
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH v3] net/i40e: fix port segmentation fault when restart
  2018-01-03  7:17   ` [dpdk-dev] [PATCH v3] " Wei Zhao
@ 2018-01-03  8:19     ` Zhang, Qi Z
  2018-01-13  6:04       ` Zhang, Helin
  2018-01-12  6:59     ` [dpdk-dev] [PATCH v4] " Wei Zhao
  1 sibling, 1 reply; 9+ messages in thread
From: Zhang, Qi Z @ 2018-01-03  8:19 UTC (permalink / raw)
  To: Zhao1, Wei, dev



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Wednesday, January 3, 2018 3:17 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v3] net/i40e: fix port segmentation fault when restart
> 
> This patch will clear all queue region related configuration when dev stop even
> if threr is no queue region config, so this may cause error. So add check if there
> is queue configuration exist when flush queue region config and remove this
> process when device stop. Queue region clear only do when device
> initialization or PMD get flush command.
> 
> Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> ---
> 
> v2:
> -fix patch check warning.
> 
> v3:
> -add more log message.
> ---
>  drivers/net/i40e/i40e_ethdev.c  |  3 ---  drivers/net/i40e/rte_pmd_i40e.c
> | 27 ++++++++++++++-------------
>  2 files changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 811cc9f..7a1290b 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
>  	/* reset hierarchy commit */
>  	pf->tm_conf.committed = false;
> 
> -	/* Remove all the queue region configuration */
> -	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
> -
>  	hw->adapter_stopped = 1;
>  }
> 
> diff --git a/drivers/net/i40e/rte_pmd_i40e.c
> b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.c
> +++ b/drivers/net/i40e/rte_pmd_i40e.c
> @@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct
> rte_eth_dev *dev,
>  		return 0;
>  	}
> 
> -	info->queue_region_number = 1;
> -	info->region[0].queue_num = main_vsi->nb_used_qps;
> -	info->region[0].queue_start_index = 0;
> +	if (info->queue_region_number) {
> +		info->queue_region_number = 1;
> +		info->region[0].queue_num = main_vsi->nb_used_qps;
> +		info->region[0].queue_start_index = 0;
> 
> -	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> -	if (ret != I40E_SUCCESS)
> -		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
> -
> -	ret = i40e_dcb_init_configure(dev, TRUE);
> -	if (ret != I40E_SUCCESS) {
> -		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> -		pf->flags &= ~I40E_FLAG_DCB;
> -	}
> +		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> +		if (ret != I40E_SUCCESS)
> +			PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
> 
> -	i40e_init_queue_region_conf(dev);
> +		ret = i40e_dcb_init_configure(dev, TRUE);
> +		if (ret != I40E_SUCCESS) {
> +			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> +			pf->flags &= ~I40E_FLAG_DCB;
> +		}
> 
> +		i40e_init_queue_region_conf(dev);
> +	}
>  	return 0;
>  }
> 
> --
> 2.9.3

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

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

* [dpdk-dev] [PATCH v4] net/i40e: fix port segmentation fault when restart
  2018-01-03  7:17   ` [dpdk-dev] [PATCH v3] " Wei Zhao
  2018-01-03  8:19     ` Zhang, Qi Z
@ 2018-01-12  6:59     ` Wei Zhao
  2018-01-13 15:29       ` Zhang, Helin
  1 sibling, 1 reply; 9+ messages in thread
From: Wei Zhao @ 2018-01-12  6:59 UTC (permalink / raw)
  To: dev; +Cc: helin.zhang, Wei Zhao

This patch will go into the process of clear all queue region
related configuration when dev stop even if there is no queue region
command before, so this is a bug, it may cause error. So add code
to check if there is queue configuration exist when flush queue
region config and remove this process when device stop. Queue region
clear only do when device initialization or PMD get flush command.

Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>

---

v2:
-fix patch check warning.

v3:
-add more log message.

v4:
-add more log message.
---
 drivers/net/i40e/i40e_ethdev.c  |  3 ---
 drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d80671a..5d1b916 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2144,9 +2144,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
-	/* Remove all the queue region configuration */
-	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
-
 	hw->adapter_stopped = 1;
 }
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 55ae2fe..2cb22d4 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -2816,22 +2816,23 @@ i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
 		return 0;
 	}
 
-	info->queue_region_number = 1;
-	info->region[0].queue_num = main_vsi->nb_used_qps;
-	info->region[0].queue_start_index = 0;
+	if (info->queue_region_number) {
+		info->queue_region_number = 1;
+		info->region[0].queue_num = main_vsi->nb_used_qps;
+		info->region[0].queue_start_index = 0;
 
-	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
-	if (ret != I40E_SUCCESS)
-		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
-
-	ret = i40e_dcb_init_configure(dev, TRUE);
-	if (ret != I40E_SUCCESS) {
-		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
-		pf->flags &= ~I40E_FLAG_DCB;
-	}
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
+		if (ret != I40E_SUCCESS)
+			PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
 
-	i40e_init_queue_region_conf(dev);
+		ret = i40e_dcb_init_configure(dev, TRUE);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
+			pf->flags &= ~I40E_FLAG_DCB;
+		}
 
+		i40e_init_queue_region_conf(dev);
+	}
 	return 0;
 }
 
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH v3] net/i40e: fix port segmentation fault when restart
  2018-01-03  8:19     ` Zhang, Qi Z
@ 2018-01-13  6:04       ` Zhang, Helin
  0 siblings, 0 replies; 9+ messages in thread
From: Zhang, Helin @ 2018-01-13  6:04 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhao1, Wei, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang, Qi Z
> Sent: Wednesday, January 3, 2018 4:20 PM
> To: Zhao1, Wei; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: fix port segmentation fault when
> restart
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Wednesday, January 3, 2018 3:17 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > <wei.zhao1@intel.com>
> > Subject: [PATCH v3] net/i40e: fix port segmentation fault when restart
> >
> > This patch will clear all queue region related configuration when dev
> > stop even if threr is no queue region config, so this may cause error.
> > So add check if there is queue configuration exist when flush queue
> > region config and remove this process when device stop. Queue region
> > clear only do when device initialization or PMD get flush command.
> >
> > Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> >
> > ---
> >
> > v2:
> > -fix patch check warning.
> >
> > v3:
> > -add more log message.
> > ---
> >  drivers/net/i40e/i40e_ethdev.c  |  3 ---
> > drivers/net/i40e/rte_pmd_i40e.c
> > | 27 ++++++++++++++-------------
> >  2 files changed, 14 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 811cc9f..7a1290b 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
> >  	/* reset hierarchy commit */
> >  	pf->tm_conf.committed = false;
> >
> > -	/* Remove all the queue region configuration */
> > -	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
> > -
> >  	hw->adapter_stopped = 1;
> >  }
> >
> > diff --git a/drivers/net/i40e/rte_pmd_i40e.c
> > b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644
> > --- a/drivers/net/i40e/rte_pmd_i40e.c
> > +++ b/drivers/net/i40e/rte_pmd_i40e.c
> > @@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct
> > rte_eth_dev *dev,
> >  		return 0;
> >  	}
> >
> > -	info->queue_region_number = 1;
> > -	info->region[0].queue_num = main_vsi->nb_used_qps;
> > -	info->region[0].queue_start_index = 0;
> > +	if (info->queue_region_number) {
> > +		info->queue_region_number = 1;
> > +		info->region[0].queue_num = main_vsi->nb_used_qps;
> > +		info->region[0].queue_start_index = 0;
> >
> > -	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> > -	if (ret != I40E_SUCCESS)
> > -		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
> > -
> > -	ret = i40e_dcb_init_configure(dev, TRUE);
> > -	if (ret != I40E_SUCCESS) {
> > -		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> > -		pf->flags &= ~I40E_FLAG_DCB;
> > -	}
> > +		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> > +		if (ret != I40E_SUCCESS)
> > +			PMD_DRV_LOG(INFO, "Failed to flush queue region
> mapping.");
> >
> > -	i40e_init_queue_region_conf(dev);
> > +		ret = i40e_dcb_init_configure(dev, TRUE);
> > +		if (ret != I40E_SUCCESS) {
> > +			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> > +			pf->flags &= ~I40E_FLAG_DCB;
> > +		}
> >
> > +		i40e_init_queue_region_conf(dev);
> > +	}
> >  	return 0;
> >  }
> >
> > --
> > 2.9.3
> 
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel, with minor commit log changes, thanks!

/Helin
> 

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

* Re: [dpdk-dev] [PATCH v4] net/i40e: fix port segmentation fault when restart
  2018-01-12  6:59     ` [dpdk-dev] [PATCH v4] " Wei Zhao
@ 2018-01-13 15:29       ` Zhang, Helin
  0 siblings, 0 replies; 9+ messages in thread
From: Zhang, Helin @ 2018-01-13 15:29 UTC (permalink / raw)
  To: Zhao1, Wei, dev, Zhang, Qi Z



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Friday, January 12, 2018 2:59 PM
> To: dev@dpdk.org
> Cc: Zhang, Helin; Zhao1, Wei
> Subject: [PATCH v4] net/i40e: fix port segmentation fault when restart
> 
> This patch will go into the process of clear all queue region related
> configuration when dev stop even if there is no queue region command before,
> so this is a bug, it may cause error. So add code to check if there is queue
> configuration exist when flush queue region config and remove this process
> when device stop. Queue region clear only do when device initialization or
> PMD get flush command.
> 
> Fixes: 7cbecc2f742 ("net/i40e: support queue region set and flush")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel, with minor commit log changes. Thanks!
BTW, I replied v3 email with a mistake, though v4 just modifed the commit log a bit.
Sorry for any confusing!

/Helin
> 
> ---
> 
> v2:
> -fix patch check warning.
> 
> v3:
> -add more log message.
> 
> v4:
> -add more log message.
> ---
>  drivers/net/i40e/i40e_ethdev.c  |  3 ---  drivers/net/i40e/rte_pmd_i40e.c | 27
> ++++++++++++++-------------
>  2 files changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index d80671a..5d1b916 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -2144,9 +2144,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
>  	/* reset hierarchy commit */
>  	pf->tm_conf.committed = false;
> 
> -	/* Remove all the queue region configuration */
> -	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
> -
>  	hw->adapter_stopped = 1;
>  }
> 
> diff --git a/drivers/net/i40e/rte_pmd_i40e.c
> b/drivers/net/i40e/rte_pmd_i40e.c index 55ae2fe..2cb22d4 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.c
> +++ b/drivers/net/i40e/rte_pmd_i40e.c
> @@ -2816,22 +2816,23 @@ i40e_flush_queue_region_all_conf(struct
> rte_eth_dev *dev,
>  		return 0;
>  	}
> 
> -	info->queue_region_number = 1;
> -	info->region[0].queue_num = main_vsi->nb_used_qps;
> -	info->region[0].queue_start_index = 0;
> +	if (info->queue_region_number) {
> +		info->queue_region_number = 1;
> +		info->region[0].queue_num = main_vsi->nb_used_qps;
> +		info->region[0].queue_start_index = 0;
> 
> -	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> -	if (ret != I40E_SUCCESS)
> -		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
> -
> -	ret = i40e_dcb_init_configure(dev, TRUE);
> -	if (ret != I40E_SUCCESS) {
> -		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> -		pf->flags &= ~I40E_FLAG_DCB;
> -	}
> +		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> +		if (ret != I40E_SUCCESS)
> +			PMD_DRV_LOG(INFO, "Failed to flush queue region
> mapping.");
> 
> -	i40e_init_queue_region_conf(dev);
> +		ret = i40e_dcb_init_configure(dev, TRUE);
> +		if (ret != I40E_SUCCESS) {
> +			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> +			pf->flags &= ~I40E_FLAG_DCB;
> +		}
> 
> +		i40e_init_queue_region_conf(dev);
> +	}
>  	return 0;
>  }
> 
> --
> 2.9.3

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

end of thread, other threads:[~2018-01-13 15:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15  5:46 [dpdk-dev] [PATCH] net/i40e: fix port segmentation fault when restart Wei Zhao
2017-11-15  5:55 ` [dpdk-dev] [PATCH v2] " Wei Zhao
2017-12-22  3:30   ` Zhang, Qi Z
2018-01-03  6:10     ` Zhao1, Wei
2018-01-03  7:17   ` [dpdk-dev] [PATCH v3] " Wei Zhao
2018-01-03  8:19     ` Zhang, Qi Z
2018-01-13  6:04       ` Zhang, Helin
2018-01-12  6:59     ` [dpdk-dev] [PATCH v4] " Wei Zhao
2018-01-13 15:29       ` Zhang, Helin

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).