Blame SOURCES/0001-net-i40e-fix-port-segmentation-fault-when-restart.patch

ab2f3a
From aca851c907f7450672fe2b5fecfcbcc3d602bf9c Mon Sep 17 00:00:00 2001
ab2f3a
From: Wei Zhao <wei.zhao1@intel.com>
ab2f3a
Date: Fri, 12 Jan 2018 14:59:19 +0800
ab2f3a
Subject: [PATCH] net/i40e: fix port segmentation fault when restart
ab2f3a
ab2f3a
[ upstream commit 37b68eacfc9901f9c30f2127c68ef806e2bd2a61 ]
ab2f3a
ab2f3a
This patch will go into the process of clear all queue region
ab2f3a
related configuration when dev stop even if there is no queue region
ab2f3a
command before, so this is a bug, it may cause error. So add code
ab2f3a
to check if there is queue configuration exist when flush queue
ab2f3a
region config and remove this process when device stop. Queue region
ab2f3a
clear only do when device initialization or PMD get flush command.
ab2f3a
ab2f3a
Fixes: 7cbecc2f7424 ("net/i40e: support queue region set and flush")
ab2f3a
ab2f3a
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
ab2f3a
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
ab2f3a
---
ab2f3a
 drivers/net/i40e/i40e_ethdev.c  |  3 ---
ab2f3a
 drivers/net/i40e/rte_pmd_i40e.c | 27 ++++++++++++++-------------
ab2f3a
 2 files changed, 14 insertions(+), 16 deletions(-)
ab2f3a
ab2f3a
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
ab2f3a
index 5f1faf1..bd83e7b 100644
ab2f3a
--- a/drivers/net/i40e/i40e_ethdev.c
ab2f3a
+++ b/drivers/net/i40e/i40e_ethdev.c
ab2f3a
@@ -2155,7 +2155,4 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)
ab2f3a
 	pf->tm_conf.committed = false;
ab2f3a
 
ab2f3a
-	/* Remove all the queue region configuration */
ab2f3a
-	i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
ab2f3a
-
ab2f3a
 	hw->adapter_stopped = 1;
ab2f3a
 }
ab2f3a
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
ab2f3a
index aeb92af..c2e2466 100644
ab2f3a
--- a/drivers/net/i40e/rte_pmd_i40e.c
ab2f3a
+++ b/drivers/net/i40e/rte_pmd_i40e.c
ab2f3a
@@ -2846,20 +2846,21 @@ int rte_pmd_i40e_flow_type_mapping_get(
ab2f3a
 	}
ab2f3a
 
ab2f3a
-	info->queue_region_number = 1;
ab2f3a
-	info->region[0].queue_num = main_vsi->nb_used_qps;
ab2f3a
-	info->region[0].queue_start_index = 0;
ab2f3a
+	if (info->queue_region_number) {
ab2f3a
+		info->queue_region_number = 1;
ab2f3a
+		info->region[0].queue_num = main_vsi->nb_used_qps;
ab2f3a
+		info->region[0].queue_start_index = 0;
ab2f3a
 
ab2f3a
-	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
ab2f3a
-	if (ret != I40E_SUCCESS)
ab2f3a
-		PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
ab2f3a
+		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
ab2f3a
+		if (ret != I40E_SUCCESS)
ab2f3a
+			PMD_DRV_LOG(INFO, "Failed to flush queue region mapping.");
ab2f3a
 
ab2f3a
-	ret = i40e_dcb_init_configure(dev, TRUE);
ab2f3a
-	if (ret != I40E_SUCCESS) {
ab2f3a
-		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
ab2f3a
-		pf->flags &= ~I40E_FLAG_DCB;
ab2f3a
+		ret = i40e_dcb_init_configure(dev, TRUE);
ab2f3a
+		if (ret != I40E_SUCCESS) {
ab2f3a
+			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
ab2f3a
+			pf->flags &= ~I40E_FLAG_DCB;
ab2f3a
+		}
ab2f3a
+
ab2f3a
+		i40e_init_queue_region_conf(dev);
ab2f3a
 	}
ab2f3a
-
ab2f3a
-	i40e_init_queue_region_conf(dev);
ab2f3a
-
ab2f3a
 	return 0;
ab2f3a
 }
ab2f3a
-- 
ab2f3a
1.8.3.1
ab2f3a