Skip to contentSkip to conversation

net/i40e: fix port segmentation fault when restart

PATCH Superseded Wei Zhao 3 participants 9 messages Nov 15, 2017 – Jan 13, 2018 Network drivers

lore
Share & tools
lore

Wei Zhao

author
#0 lore raw

PATCH 1/1 net/i40e: fix port segmentation fault when restart

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")
---
 drivers/net/i40e/i40e_ethdev.c  |  3 ---
 drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
 2 files changed, 14 insertions(+), 16 deletions(-)
drivers/net/i40e/i40e_ethdev.c +0 -3
index 811cc9f..7a1290b 100644
@@ -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;
 }
 
drivers/net/i40e/rte_pmd_i40e.c +14 -13
index aeb92af..8f94faa 100644
@@ -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;
 }
 
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/1 net/i40e: fix port segmentation fault when restart

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

---

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(-)
drivers/net/i40e/i40e_ethdev.c +0 -3
index 811cc9f..7a1290b 100644
@@ -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;
 }
 
drivers/net/i40e/rte_pmd_i40e.c +14 -13
index aeb92af..c2e2466 100644
@@ -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;
 }
 
Signature · 1 line
2.7.4
#2 lore raw
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, November 15, 2017 1:55 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
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

Quoted 21 lines

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

---

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(-)
drivers/net/i40e/i40e_ethdev.c +0 -0
index 811cc9f..7a1290b 100644

drivers/net/i40e/i40e_ethdev.c i40e_dev_stop(struct rte_eth_dev *dev) · line 2157

Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c +0 -3
@@ -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.

Quoted 23 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 	hw->adapter_stopped = 1;
 }
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644

drivers/net/i40e/rte_pmd_i40e.c +4 -6
@@ -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.");

drivers/net/i40e/rte_pmd_i40e.c i40e_flush_queue_region_all_conf(struct · line 2857

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -6
-
-	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

Quoted 15 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -2
-	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

author
#3 lore raw

Hi, zhangqi

Quoted 45 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, December 22, 2017 11:31 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: Zhao1, Wei <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2] net/i40e: fix port segmentation fault when restart

Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wei Zhao
Sent: Wednesday, November 15, 2017 1:55 PM
To: [email protected]
Cc: Zhao1, Wei <[email protected]>
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

Quoted 24 lines

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

---

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(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 811cc9f..7a1290b 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -2154,9 +2154,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
 
Quoted 7 lines

drivers/net/i40e/i40e_ethdev.c i40e_dev_stop(struct rte_eth_dev *dev) · line 2159

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0 -3
-	/* 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.

Quoted 25 lines
Quoted 14 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 	hw->adapter_stopped = 1;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644

drivers/net/i40e/rte_pmd_i40e.c +0 -1
@@ -2845,22 +2845,23 @@ i40e_flush_queue_region_all_conf(struct
 rte_eth_dev *dev,
 		return 0;
 	}
 
-	info->queue_region_number = 1;

drivers/net/i40e/rte_pmd_i40e.c i40e_flush_queue_region_all_conf(struct · line 2855

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +4 -5
-	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.");

Quoted 12 lines

drivers/net/i40e/rte_pmd_i40e.c i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -6
-
-	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.

Quoted 18 lines

Regards
Qi

Quoted 15 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -2
-	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

author
#4 lore raw

PATCH v3 1/1 net/i40e: fix port segmentation fault when restart

In reply to 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")

---

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(-)
drivers/net/i40e/i40e_ethdev.c +0 -3
index 811cc9f..7a1290b 100644
@@ -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;
 }
 
drivers/net/i40e/rte_pmd_i40e.c +14 -13
index aeb92af..c2e2466 100644
@@ -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;
 }
 
Signature · 1 line
2.9.3
Acked-by on v3 1/1
#5 lore raw
Quoted 88 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, January 3, 2018 3:17 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Zhao1, Wei <[email protected]>
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")

---

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(-)
drivers/net/i40e/i40e_ethdev.c +0 -3
index 811cc9f..7a1290b 100644
@@ -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;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644

drivers/net/i40e/rte_pmd_i40e.c +14 -14
@@ -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;
 }
 
--
Quoted 1 line

2.9.3

author
#7 lore raw

PATCH v4 1/1 net/i40e: fix port segmentation fault when restart

In reply to 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")

---

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(-)
drivers/net/i40e/i40e_ethdev.c +0 -3
index d80671a..5d1b916 100644
@@ -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;
 }
 
drivers/net/i40e/rte_pmd_i40e.c +14 -13
index 55ae2fe..2cb22d4 100644
@@ -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;
 }
 
Signature · 1 line
2.9.3
Applied
#6 lore raw
In reply to Zhang, Qi Z
Quoted 99 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Zhang, Qi Z
Sent: Wednesday, January 3, 2018 4:20 PM
To: Zhao1, Wei; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] net/i40e: fix port segmentation fault when restart

Quoted 64 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, January 3, 2018 3:17 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Zhao1, Wei <[email protected]>
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")

---

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(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 811cc9f..7a1290b 100644

drivers/net/i40e/i40e_ethdev.c +0 -3
@@ -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;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index aeb92af..c2e2466 100644

drivers/net/i40e/rte_pmd_i40e.c +4 -5
@@ -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)

drivers/net/i40e/rte_pmd_i40e.c i40e_flush_queue_region_all_conf(struct · line 2856

Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.c +3 -7
-		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.");

Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.c +7 -1
-	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;
 }
 
Quoted 4 lines
Quoted 2 lines

--
2.9.3

Applied to dpdk-next-net-intel, with minor commit log changes, thanks!

/Helin

Quoted 1 line
Applied
#8 lore raw
In reply to Wei Zhao
Quoted 16 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, January 12, 2018 2:59 PM
To: [email protected]
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.

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

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

Quoted 75 lines

---

v2:
-fix patch check warning.

v3:
-add more log message.

v4:

(quoted diff) +1 -2
-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(-)
drivers/net/i40e/i40e_ethdev.c +0 -3
index d80671a..5d1b916 100644
@@ -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;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index 55ae2fe..2cb22d4 100644

drivers/net/i40e/rte_pmd_i40e.c +14 -13
@@ -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