net/ice: fix tm configuration cannot be clear

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

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/iol-mellanox-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Kaiwen Deng Aug. 29, 2023, 6:23 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 patch adds a new flag "need_clear" to determine if the
hierarchy configuration needs to be cleared.

Fixes: 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
Cc: stable@dpdk.org

Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
---
 drivers/net/ice/ice_dcf.c       | 2 +-
 drivers/net/ice/ice_dcf.h       | 1 +
 drivers/net/ice/ice_dcf_sched.c | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)
  

Comments

Qi Zhang Sept. 1, 2023, 5:38 a.m. UTC | #1
> -----Original Message-----
> From: Deng, KaiwenX <kaiwenx.deng@intel.com>
> Sent: Tuesday, August 29, 2023 2:24 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] net/ice: fix tm configuration cannot be clear
> 
> When the device is stopped, DPDK resets the commit flag so that we can
> update the hierarchy configuration. 

Why we need to reset commit flag when device is stopped?
If the commit flag indicate all tm configure has been committed, stop device does not change the status, its confusing to reset it.

Can we simply prevent additional commit when device is running by only checking the stop flag? And why we reject a commit if its already committed?

> 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 patch adds a new flag "need_clear" to determine if the hierarchy
> configuration needs to be cleared.
> 
> Fixes: 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
> ---
  
Kaiwen Deng Sept. 5, 2023, 8:14 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Friday, September 1, 2023 1:39 PM
> To: Deng, KaiwenX <kaiwenx.deng@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; Xu, Ting <ting.xu@intel.com>
> Subject: RE: [PATCH] net/ice: fix tm configuration cannot be clear
> 
> 
> 
> > -----Original Message-----
> > From: Deng, KaiwenX <kaiwenx.deng@intel.com>
> > Sent: Tuesday, August 29, 2023 2:24 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] net/ice: fix tm configuration cannot be clear
> >
> > When the device is stopped, DPDK resets the commit flag so that we can
> > update the hierarchy configuration.
> 
> Why we need to reset commit flag when device is stopped?
> If the commit flag indicate all tm configure has been committed, stop device
> does not change the status, its confusing to reset it.
> 
> Can we simply prevent additional commit when device is running by only
> checking the stop flag? And why we reject a commit if its already committed?
>>Thanks for your review, I submitted a new patch that 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.
> 
> > 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 patch adds a new flag "need_clear" to determine if the hierarchy
> > configuration needs to be cleared.
> >
> > Fixes: 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in
> > DCF")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
> > ---
  

Patch

diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 7f8f5163ac..45d44ab73c 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -877,7 +877,7 @@  ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)
 	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
 
 	if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)
-		if (hw->tm_conf.committed) {
+		if (hw->tm_conf.need_clear) {
 			ice_dcf_clear_bw(hw);
 			ice_dcf_tm_conf_uninit(eth_dev);
 		}
diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h
index aa2a723f2a..af23b569f5 100644
--- a/drivers/net/ice/ice_dcf.h
+++ b/drivers/net/ice/ice_dcf.h
@@ -78,6 +78,7 @@  struct ice_dcf_tm_conf {
 	uint32_t nb_tc_node;
 	uint32_t nb_vsi_node;
 	bool committed;
+	bool need_clear;
 };
 
 struct ice_dcf_eth_stats {
diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c
index a231c1e60b..5437fabb58 100644
--- a/drivers/net/ice/ice_dcf_sched.c
+++ b/drivers/net/ice/ice_dcf_sched.c
@@ -51,6 +51,7 @@  ice_dcf_tm_conf_init(struct rte_eth_dev *dev)
 	hw->tm_conf.nb_tc_node = 0;
 	hw->tm_conf.nb_vsi_node = 0;
 	hw->tm_conf.committed = false;
+	hw->tm_conf.need_clear = false;
 }
 
 void
@@ -870,6 +871,8 @@  static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
 		   ICE_NONDMA_TO_NONDMA);
 
 	hw->tm_conf.committed = true;
+	hw->tm_conf.need_clear = true;
+
 	return ret_val;
 
 fail_clear: