[v2] net/ice: fix tm configuration cannot be cleared

Message ID 20230905073444.708799-1-kaiwenx.deng@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/ice: fix tm configuration cannot be cleared |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Kaiwen Deng Sept. 5, 2023, 7:34 a.m. UTC
  When the device is stopped, DPDK resets the commit flag so that
we can update the hierarchy configuration. The commit flag is also
used to determine if the hierarchy configuration needs to be cleared.
When DPDK exits, it always stops the device first and also resets
the commit flag result in the hierarchy configuration is not cleared.

This commit changes DPDK to not reset the commit flag when the
device is stopped. And we prevent additional commit when device is
running by only checking the stop flag.

Fixes: f5ec6a3a1987 ("net/ice: fix TM hierarchy commit flag reset")
Cc: stable@dpdk.org

Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
---
Changes since v1:
- Prevent additional commit when device is running.
---
---
 drivers/net/ice/ice_dcf_ethdev.c |  2 --
 drivers/net/ice/ice_dcf_sched.c  | 14 ++++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
  

Comments

Qi Zhang Sept. 6, 2023, 5:02 a.m. UTC | #1
> -----Original Message-----
> From: Deng, KaiwenX <kaiwenx.deng@intel.com>
> Sent: Tuesday, September 5, 2023 3:35 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; Deng, KaiwenX <kaiwenx.deng@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>; Xu, Ting <ting.xu@intel.com>
> Subject: [PATCH v2] net/ice: fix tm configuration cannot be cleared
> 
> When the device is stopped, DPDK resets the commit flag so that we can

This is not a DPDK general implementation, its all about the ice PMD, please use "the PMD" to replace the "DPDK".
  

Patch

diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 30ad18d8fc..065ec728c2 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -670,7 +670,6 @@  ice_dcf_dev_stop(struct rte_eth_dev *dev)
 	struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
 	struct ice_adapter *ad = &dcf_ad->parent;
-	struct ice_dcf_hw *hw = &dcf_ad->real_hw;
 
 	if (ad->pf.adapter_stopped == 1) {
 		PMD_DRV_LOG(DEBUG, "Port is already stopped");
@@ -697,7 +696,6 @@  ice_dcf_dev_stop(struct rte_eth_dev *dev)
 
 	dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
-	hw->tm_conf.committed = false;
 
 	return 0;
 }
diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c
index a231c1e60b..b08bc5f1de 100644
--- a/drivers/net/ice/ice_dcf_sched.c
+++ b/drivers/net/ice/ice_dcf_sched.c
@@ -237,6 +237,7 @@  ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	enum ice_dcf_tm_node_type node_type = ICE_DCF_TM_NODE_TYPE_MAX;
 	struct ice_dcf_tm_shaper_profile *shaper_profile = NULL;
 	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_adapter *ad = &adapter->parent;
 	struct ice_dcf_hw *hw = &adapter->real_hw;
 	struct ice_dcf_tm_node *parent_node;
 	struct ice_dcf_tm_node *tm_node;
@@ -246,10 +247,10 @@  ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	if (!params || !error)
 		return -EINVAL;
 
-	/* if already committed */
-	if (hw->tm_conf.committed) {
+	/* if port is running */
+	if (!ad->pf.adapter_stopped) {
 		error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
-		error->message = "already committed";
+		error->message = "port is running";
 		return -EINVAL;
 	}
 
@@ -400,16 +401,17 @@  ice_dcf_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 {
 	enum ice_dcf_tm_node_type node_type = ICE_DCF_TM_NODE_TYPE_MAX;
 	struct ice_dcf_adapter *adapter = dev->data->dev_private;
+	struct ice_adapter *ad = &adapter->parent;
 	struct ice_dcf_hw *hw = &adapter->real_hw;
 	struct ice_dcf_tm_node *tm_node;
 
 	if (!error)
 		return -EINVAL;
 
-	/* if already committed */
-	if (hw->tm_conf.committed) {
+	/* if port is running */
+	if (!ad->pf.adapter_stopped) {
 		error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
-		error->message = "already committed";
+		error->message = "port is running";
 		return -EINVAL;
 	}