DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/ice: fix tm configuration cannot be clear
@ 2023-08-29  6:23 Kaiwen Deng
  2023-09-01  5:38 ` Zhang, Qi Z
  2023-09-05  7:34 ` [PATCH v2] net/ice: fix tm configuration cannot be cleared Kaiwen Deng
  0 siblings, 2 replies; 8+ messages in thread
From: Kaiwen Deng @ 2023-08-29  6:23 UTC (permalink / raw)
  To: dev; +Cc: stable, qiming.yang, yidingx.zhou, Kaiwen Deng, Qi Zhang, Ting Xu

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

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:
-- 
2.25.1


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

* RE: [PATCH] net/ice: fix tm configuration cannot be clear
  2023-08-29  6:23 [PATCH] net/ice: fix tm configuration cannot be clear Kaiwen Deng
@ 2023-09-01  5:38 ` Zhang, Qi Z
  2023-09-05  8:14   ` Deng, KaiwenX
  2023-09-05  7:34 ` [PATCH v2] net/ice: fix tm configuration cannot be cleared Kaiwen Deng
  1 sibling, 1 reply; 8+ messages in thread
From: Zhang, Qi Z @ 2023-09-01  5:38 UTC (permalink / raw)
  To: Deng, KaiwenX, dev; +Cc: stable, Yang, Qiming, Zhou, YidingX, Xu, Ting



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


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

* [PATCH v2] net/ice: fix tm configuration cannot be cleared
  2023-08-29  6:23 [PATCH] net/ice: fix tm configuration cannot be clear Kaiwen Deng
  2023-09-01  5:38 ` Zhang, Qi Z
@ 2023-09-05  7:34 ` Kaiwen Deng
  2023-09-06  5:02   ` Zhang, Qi Z
  2023-09-06  7:49   ` [PATCH v3] " Kaiwen Deng
  1 sibling, 2 replies; 8+ messages in thread
From: Kaiwen Deng @ 2023-09-05  7:34 UTC (permalink / raw)
  To: dev; +Cc: stable, qiming.yang, yidingx.zhou, Kaiwen Deng, Qi Zhang, Ting Xu

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

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;
 	}
 
-- 
2.25.1


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

* RE: [PATCH] net/ice: fix tm configuration cannot be clear
  2023-09-01  5:38 ` Zhang, Qi Z
@ 2023-09-05  8:14   ` Deng, KaiwenX
  0 siblings, 0 replies; 8+ messages in thread
From: Deng, KaiwenX @ 2023-09-05  8:14 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: stable, Yang, Qiming, Zhou, YidingX, Xu, Ting



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


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

* RE: [PATCH v2] net/ice: fix tm configuration cannot be cleared
  2023-09-05  7:34 ` [PATCH v2] net/ice: fix tm configuration cannot be cleared Kaiwen Deng
@ 2023-09-06  5:02   ` Zhang, Qi Z
  2023-09-06  7:49   ` [PATCH v3] " Kaiwen Deng
  1 sibling, 0 replies; 8+ messages in thread
From: Zhang, Qi Z @ 2023-09-06  5:02 UTC (permalink / raw)
  To: Deng, KaiwenX, dev; +Cc: stable, Yang, Qiming, Zhou, YidingX



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



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

* [PATCH v3] net/ice: fix tm configuration cannot be cleared
  2023-09-05  7:34 ` [PATCH v2] net/ice: fix tm configuration cannot be cleared Kaiwen Deng
  2023-09-06  5:02   ` Zhang, Qi Z
@ 2023-09-06  7:49   ` Kaiwen Deng
  2023-09-07  2:34     ` Wu, Wenjun1
  1 sibling, 1 reply; 8+ messages in thread
From: Kaiwen Deng @ 2023-09-06  7:49 UTC (permalink / raw)
  To: dev; +Cc: stable, qiming.yang, yidingx.zhou, Kaiwen Deng, Qi Zhang, Ting Xu

When the device is stopped, the PMD 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 the PMD exits, it always stops the device first and also resets
the commit flag result in the hierarchy configuration is not cleared.

This commit changes the PMD 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 v2:
- Replace DPDK with the PMD in commit log.

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

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;
 	}
 
-- 
2.25.1


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

* RE: [PATCH v3] net/ice: fix tm configuration cannot be cleared
  2023-09-06  7:49   ` [PATCH v3] " Kaiwen Deng
@ 2023-09-07  2:34     ` Wu, Wenjun1
  2023-09-07  7:51       ` Zhang, Qi Z
  0 siblings, 1 reply; 8+ messages in thread
From: Wu, Wenjun1 @ 2023-09-07  2:34 UTC (permalink / raw)
  To: Deng, KaiwenX, dev
  Cc: stable, Yang, Qiming, Zhou, YidingX, Deng, KaiwenX, Zhang, Qi Z,
	Xu,  Ting



> -----Original Message-----
> From: Kaiwen Deng <kaiwenx.deng@intel.com>
> Sent: Wednesday, September 6, 2023 3:50 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 v3] net/ice: fix tm configuration cannot be cleared
> 
> When the device is stopped, the PMD 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 the PMD exits, it always stops the device first and also resets the
> commit flag result in the hierarchy configuration is not cleared.
> 
> This commit changes the PMD 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 v2:
> - Replace DPDK with the PMD in commit log.
> 
> 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(-)
> 
> 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;
>  	}
> 
> --
> 2.25.1

Acked-by: Wenjun Wu <wenjun1.wu@intel.com>

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

* RE: [PATCH v3] net/ice: fix tm configuration cannot be cleared
  2023-09-07  2:34     ` Wu, Wenjun1
@ 2023-09-07  7:51       ` Zhang, Qi Z
  0 siblings, 0 replies; 8+ messages in thread
From: Zhang, Qi Z @ 2023-09-07  7:51 UTC (permalink / raw)
  To: Wu, Wenjun1, Deng, KaiwenX, dev
  Cc: stable, Yang, Qiming, Zhou, YidingX, Deng, KaiwenX, Xu, Ting



> -----Original Message-----
> From: Wu, Wenjun1 <wenjun1.wu@intel.com>
> Sent: Thursday, September 7, 2023 10:35 AM
> 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>; Deng, KaiwenX <kaiwenx.deng@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>; Xu, Ting <ting.xu@intel.com>
> Subject: RE: [PATCH v3] net/ice: fix tm configuration cannot be cleared
> 
> 
> 
> > -----Original Message-----
> > From: Kaiwen Deng <kaiwenx.deng@intel.com>
> > Sent: Wednesday, September 6, 2023 3:50 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 v3] net/ice: fix tm configuration cannot be cleared
> >
> > When the device is stopped, the PMD 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 the PMD exits, it always stops the device first and also resets
> > the commit flag result in the hierarchy configuration is not cleared.
> >
> > This commit changes the PMD 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 v2:
> > - Replace DPDK with the PMD in commit log.
> >
> > 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(-)
> >
> > 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;
> >  	}
> >
> > --
> > 2.25.1
> 
> Acked-by: Wenjun Wu <wenjun1.wu@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2023-09-07  7:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29  6:23 [PATCH] net/ice: fix tm configuration cannot be clear Kaiwen Deng
2023-09-01  5:38 ` Zhang, Qi Z
2023-09-05  8:14   ` Deng, KaiwenX
2023-09-05  7:34 ` [PATCH v2] net/ice: fix tm configuration cannot be cleared Kaiwen Deng
2023-09-06  5:02   ` Zhang, Qi Z
2023-09-06  7:49   ` [PATCH v3] " Kaiwen Deng
2023-09-07  2:34     ` Wu, Wenjun1
2023-09-07  7:51       ` Zhang, Qi Z

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