Skip to contentSkip to conversation

net/ice: fix TM hierarchy commit flag not reset correctly

PATCH Superseded Ting Xu 2 participants 4 messages Oct 14, 2021 – Oct 21, 2021 Network drivers

lore
Share & tools
lore

Ting Xu

author
#0 lore raw

PATCH 1/1 net/ice: fix TM hierarchy commit flag not reset correctly

After DCF commits TM hierarchy configuration, the commit flag is set to avoid duplicated commit. But the flag is not reset after device stop, which prevents the update of hierarchy configuration unless close the device. It is not reasonable. This patch fix to reset the commit flag after device stop. Then users can delete and add nodes to commit a new TM hierarchy configuration.

Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
---
 drivers/net/ice/ice_dcf_ethdev.c | 7 +++++++
 drivers/net/ice/ice_dcf_sched.c  | 8 ++++++++
 2 files changed, 15 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +7 -0
index 3eb3b077e6..23e2d91c13 100644
@@ -529,6 +529,11 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return -EIO;
 	}
 
+	if (hw->tm_conf.root && !hw->tm_conf.committed) {
+		PMD_DRV_LOG(ERR, "please call hierarchy_commit() before starting the port");
+		return -EIO;
+	}
+
 	ad->pf.adapter_stopped = 0;
 
 	hw->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
@@ -620,6 +625,7 @@ 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");
@@ -640,6 +646,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
+	hw->tm_conf.committed = false;
 
 	return 0;
 }
drivers/net/ice/ice_dcf_sched.c +8 -0
index dcf2723494..65c4c82a5b 100644
@@ -754,6 +754,13 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
 	uint8_t num_elem = 0;
 	int i, ret_val;
 
+	/* check if port is stopped */
+	if (adapter->parent.pf.adapter_stopped != 1) {
+		PMD_DRV_LOG(ERR, "Please stop port first");
+		ret_val = ICE_ERR_NOT_READY;
+		goto err;
+	}
+
 	ret_val = ice_dcf_commit_check(hw);
 	if (ret_val)
 		goto fail_clear;
@@ -871,5 +878,6 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
 		ice_dcf_tm_conf_uninit(dev);
 		ice_dcf_tm_conf_init(dev);
 	}
+err:
 	return ret_val;
 }
Signature · 1 line
2.25.1
#1 lore raw
Quoted 63 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Thursday, October 14, 2021 2:52 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Xu, Ting <[email protected]>; [email protected]
Subject: [PATCH] net/ice: fix TM hierarchy commit flag not reset correctly

After DCF commits TM hierarchy configuration, the commit flag is set to avoid duplicated commit. But the flag is not reset after device stop, which prevents the update of hierarchy configuration unless close the device. It is not reasonable. This patch fix to reset the commit flag after device stop. Then users can delete and add nodes to commit a new TM hierarchy configuration.

Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
---
 drivers/net/ice/ice_dcf_ethdev.c | 7 +++++++
drivers/net/ice/ice_dcf_sched.c  | 8 ++++++++
 2 files changed, 15 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +5 -0
index 3eb3b077e6..23e2d91c13 100644
@@ -529,6 +529,11 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return -EIO;
 	}
 
+	if (hw->tm_conf.root && !hw->tm_conf.committed) {
+		PMD_DRV_LOG(ERR, "please call hierarchy_commit() before starting
 the port");
+		return -EIO;
+	}
+
 	ad->pf.adapter_stopped = 0;
 
drivers/net/ice/ice_dcf_ethdev.c +4 -0
 	hw->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues, @@ -620,6
+625,7 @@ 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"); @@ -640,6
+646,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
+	hw->tm_conf.committed = false;
 
 	return 0;
 }
drivers/net/ice/ice_dcf_sched.c +0 -0
index dcf2723494..65c4c82a5b 100644

drivers/net/ice/ice_dcf_sched.c static int ice_dcf_hierarchy_commit(struct · line 759

Quoted 6 lines
drivers/net/ice/ice_dcf_sched.c +2 -0
@@ -754,6 +754,13 @@ static int ice_dcf_hierarchy_commit(struct
 rte_eth_dev *dev,
 	uint8_t num_elem = 0;
 	int i, ret_val;
 
+	/* check if port is stopped */
+	if (adapter->parent.pf.adapter_stopped != 1) {

adapter_stopped is defined as a boolean

Quoted 18 lines
drivers/net/ice/ice_dcf_sched.c +5 -0
+		PMD_DRV_LOG(ERR, "Please stop port first");
+		ret_val = ICE_ERR_NOT_READY;
+		goto err;
+	}
+
 	ret_val = ice_dcf_commit_check(hw);
 	if (ret_val)
drivers/net/ice/ice_dcf_sched.c +1 -0
 		goto fail_clear;
@@ -871,5 +878,6 @@ static int ice_dcf_hierarchy_commit(struct
 rte_eth_dev *dev,
 		ice_dcf_tm_conf_uninit(dev);
 		ice_dcf_tm_conf_init(dev);
 	}
+err:
 	return ret_val;

}
--
2.25.1

author
#2 lore raw

PATCH v2 1/1 net/ice: fix TM hierarchy commit flag not reset correctly

In reply to Ting Xu

After DCF commits TM hierarchy configuration, the commit flag is set to avoid duplicated commit. But the flag is not reset after device stop, which prevents the update of hierarchy configuration unless close the device. It is not reasonable. This patch fix to reset the commit flag after device stop. Then users can delete and add nodes to commit a new TM hierarchy configuration.

Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
---
 drivers/net/ice/ice_dcf_ethdev.c | 7 +++++++
 drivers/net/ice/ice_dcf_sched.c  | 8 ++++++++
 2 files changed, 15 insertions(+)
drivers/net/ice/ice_dcf_ethdev.c +7 -0
index b8a537cb85..12bdd745df 100644
@@ -528,6 +528,11 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)
 		return -EIO;
 	}
 
+	if (hw->tm_conf.root && !hw->tm_conf.committed) {
+		PMD_DRV_LOG(ERR, "please call hierarchy_commit() before starting the port");
+		return -EIO;
+	}
+
 	ad->pf.adapter_stopped = 0;
 
 	hw->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues,
@@ -619,6 +624,7 @@ 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");
@@ -639,6 +645,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev)
 	ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false);
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	ad->pf.adapter_stopped = 1;
+	hw->tm_conf.committed = false;
 
 	return 0;
 }
drivers/net/ice/ice_dcf_sched.c +8 -0
index dcf2723494..a231c1e60b 100644
@@ -754,6 +754,13 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
 	uint8_t num_elem = 0;
 	int i, ret_val;
 
+	/* check if port is stopped */
+	if (!adapter->parent.pf.adapter_stopped) {
+		PMD_DRV_LOG(ERR, "Please stop port first");
+		ret_val = ICE_ERR_NOT_READY;
+		goto err;
+	}
+
 	ret_val = ice_dcf_commit_check(hw);
 	if (ret_val)
 		goto fail_clear;
@@ -871,5 +878,6 @@ static int ice_dcf_hierarchy_commit(struct rte_eth_dev *dev,
 		ice_dcf_tm_conf_uninit(dev);
 		ice_dcf_tm_conf_init(dev);
 	}
+err:
 	return ret_val;
 }
Signature · 1 line
2.25.1
Acked-by on v2 1/1 Applied
#3 lore raw
Quoted 16 lines

-----Original Message-----
From: Xu, Ting <[email protected]>
Sent: Thursday, October 21, 2021 1:54 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Xu, Ting <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix TM hierarchy commit flag not reset correctly

After DCF commits TM hierarchy configuration, the commit flag is set to avoid duplicated commit. But the flag is not reset after device stop, which prevents the update of hierarchy configuration unless close the device. It is not reasonable. This patch fix to reset the commit flag after device stop. Then users can delete and add nodes to commit a new TM hierarchy configuration.

Quoted 4 lines
Fixes 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")

Applied to dpdk-next-net-intel.

Thanks
Qi