Skip to contentSkip to conversation

net/ice improve qos

PATCH In review Qi Zhang 2 participants 9 messages Jan 2, 2024 – Jan 4, 2024 Network drivers

lore
Share & tools
lore

Qi Zhang

author
#0 lore raw

cover net/ice improve qos

The patchset enhanced ice rte_tm implemenations

Qi Zhang (6):
net/ice: remove redundent code
net/ice: support VSI level bandwidth config net/ice: support queue group weight configure net/ice: refactor hardware Tx sched node config net/ice: reset Tx sched node during commit net/ice: support Tx sched commit before dev_start

 drivers/net/ice/base/ice_sched.c |   4 +-
 drivers/net/ice/base/ice_sched.h |   7 +-
 drivers/net/ice/ice_ethdev.c     |   9 +
 drivers/net/ice/ice_ethdev.h     |   5 +
 drivers/net/ice/ice_tm.c         | 361 +++++++++++++++++++++----------
 5 files changed, 269 insertions(+), 117 deletions(-)
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 1/6 net/ice: remove redundent code

The committed flag for tx schedular configuration is not used in PF only mode, remove the redundent code.

---
 drivers/net/ice/ice_tm.c | 14 --------------
 1 file changed, 14 deletions(-)
drivers/net/ice/ice_tm.c +0 -14
index f5ea47ae83..9e2f981fa3 100644
@@ -390,13 +390,6 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	if (!params || !error)
 		return -EINVAL;
 
-	/* if already committed */
-	if (pf->tm_conf.committed) {
-		error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
-		error->message = "already committed";
-		return -EINVAL;
-	}
-
 	ret = ice_node_param_check(pf, node_id, priority, weight,
 				    params, error);
 	if (ret)
@@ -579,13 +572,6 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 	if (!error)
 		return -EINVAL;
 
-	/* if already committed */
-	if (pf->tm_conf.committed) {
-		error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
-		error->message = "already committed";
-		return -EINVAL;
-	}
-
 	if (node_id == RTE_TM_NODE_ID_NULL) {
 		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
 		error->message = "invalid node id";
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH 2/6 net/ice: support VSI level bandwidth config

In reply to Qi Zhang

Enable the configuration of peak and committed rates for a Tx scheduler node at the VSI level. This patch also consolidate rate configuration across various levels into a single function 'ice_set_node_rate.'

---
 drivers/net/ice/base/ice_sched.c |   2 +-
 drivers/net/ice/base/ice_sched.h |   4 +-
 drivers/net/ice/ice_tm.c         | 142 +++++++++++++++++++------------
 3 files changed, 91 insertions(+), 57 deletions(-)
drivers/net/ice/base/ice_sched.c +1 -1
index a4d31647fe..23cc1ee50a 100644
@@ -4429,7 +4429,7 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node,
  * NOTE: Caller provides the correct SRL node in case of shared profile
  * settings.
  */
-static enum ice_status
+enum ice_status
 ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,
 			  enum ice_rl_type rl_type, u32 bw)
 {
drivers/net/ice/base/ice_sched.h +3 -1
index 4b68f3f535..a600ff9a24 100644
@@ -237,5 +237,7 @@ enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle);
 enum ice_status ice_sched_replay_root_node_bw(struct ice_port_info *pi);
 enum ice_status
 ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx);
-
+enum ice_status
+ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,
+			  enum ice_rl_type rl_type, u32 bw);
 #endif /* _ICE_SCHED_H_ */
drivers/net/ice/ice_tm.c +87 -55

204 lines not on this page · raw message

Signature · 1 line
2.31.1
author
#3 lore raw

PATCH 3/6 net/ice: support queue group weight configure

In reply to Qi Zhang

Enable the configuration of weight for Tx scheduler node at the queue group level. This patch also consolidate weight configuration across various levels by exposing the base code API 'ice_sched_cfg_node_bw_alloc'.

---
 drivers/net/ice/base/ice_sched.c |  2 +-
 drivers/net/ice/base/ice_sched.h |  3 +++
 drivers/net/ice/ice_tm.c         | 27 ++++++++++++++++++++-------
 3 files changed, 24 insertions(+), 8 deletions(-)
drivers/net/ice/base/ice_sched.c +1 -1
index 23cc1ee50a..a1dd0c6ace 100644
@@ -3020,7 +3020,7 @@ ice_sched_update_elem(struct ice_hw *hw, struct ice_sched_node *node,
  *
  * This function configures node element's BW allocation.
  */
-static enum ice_status
+enum ice_status
 ice_sched_cfg_node_bw_alloc(struct ice_hw *hw, struct ice_sched_node *node,
 			    enum ice_rl_type rl_type, u16 bw_alloc)
 {
drivers/net/ice/base/ice_sched.h +3 -0
index a600ff9a24..5b35fd564e 100644
@@ -240,4 +240,7 @@ ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx);
 enum ice_status
 ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,
 			  enum ice_rl_type rl_type, u32 bw);
+enum ice_status
+ice_sched_cfg_node_bw_alloc(struct ice_hw *hw, struct ice_sched_node *node,
+			    enum ice_rl_type rl_type, u16 bw_alloc);
 #endif /* _ICE_SCHED_H_ */
drivers/net/ice/ice_tm.c +20 -7
index d9187af8af..604d045e2c 100644
@@ -529,7 +529,8 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 		PMD_DRV_LOG(WARNING, "priority != 0 not supported in level %d",
 			    level_id);
 
-	if (tm_node->weight != 1 && level_id != ICE_TM_NODE_TYPE_QUEUE)
+	if (tm_node->weight != 1 &&
+	    level_id != ICE_TM_NODE_TYPE_QUEUE && level_id != ICE_TM_NODE_TYPE_QGROUP)
 		PMD_DRV_LOG(WARNING, "weight != 1 not supported in level %d",
 			    level_id);
 
@@ -725,7 +726,6 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 	struct ice_sched_node *vsi_node = NULL;
 	struct ice_sched_node *queue_node;
 	struct ice_tx_queue *txq;
-	struct ice_vsi *vsi;
 	int ret_val = ICE_SUCCESS;
 	uint8_t priority;
 	uint32_t i;
@@ -819,6 +819,18 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 				    tm_node->priority);
 			goto fail_clear;
 		}
+
+		ret_val = ice_sched_cfg_node_bw_alloc(hw, qgroup_sched_node,
+						      ICE_MAX_BW,
+						      (uint16_t)tm_node->weight);
+		if (ret_val) {
+			error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
+			PMD_DRV_LOG(ERR, "configure queue group %u weight %u failed",
+				    tm_node->id,
+				    tm_node->weight);
+			goto fail_clear;
+		}
+
 		idx_qg++;
 		if (idx_qg >= nb_qg) {
 			idx_qg = 0;
@@ -834,7 +846,6 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 	TAILQ_FOREACH(tm_node, queue_list, node) {
 		qid = tm_node->id;
 		txq = dev->data->tx_queues[qid];
-		vsi = txq->vsi;
 		q_teid = txq->q_teid;
 
 		queue_node = ice_sched_get_node(hw->port_info, q_teid);
@@ -856,12 +867,14 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 			goto fail_clear;
 		}
 
-		ret_val = ice_cfg_q_bw_alloc(hw->port_info, vsi->idx,
-					     tm_node->tc, tm_node->id,
-					     ICE_MAX_BW, (u32)tm_node->weight);
+		queue_node = ice_sched_get_node(hw->port_info, q_teid);
+		ret_val = ice_sched_cfg_node_bw_alloc(hw, queue_node, ICE_MAX_BW,
+						      (uint16_t)tm_node->weight);
 		if (ret_val) {
 			error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
-			PMD_DRV_LOG(ERR, "configure queue %u weight failed", tm_node->weight);
+			PMD_DRV_LOG(ERR, "configure queue %u weight %u failed",
+				    tm_node->id,
+				    tm_node->weight);
 			goto fail_clear;
 		}
 	}
Signature · 1 line
2.31.1
author
#4 lore raw

PATCH 4/6 net/ice: refactor hardware Tx sched node config

In reply to Qi Zhang

Consolidate Tx scheduler node configuration into a function:
'ice_cfg_hw_node", where rate limit, weight, priority will be configured for queue group level and queue level.

---
 drivers/net/ice/ice_tm.c | 97 ++++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 48 deletions(-)
drivers/net/ice/ice_tm.c +49 -48
index 604d045e2c..20cc47fff1 100644
@@ -713,6 +713,49 @@ static int ice_set_node_rate(struct ice_hw *hw,
 	return 0;
 }
 
+static int ice_cfg_hw_node(struct ice_hw *hw,
+			   struct ice_tm_node *tm_node,
+			   struct ice_sched_node *sched_node)
+{
+	enum ice_status status;
+	uint8_t priority;
+	uint16_t weight;
+	int ret;
+
+	ret = ice_set_node_rate(hw, tm_node, sched_node);
+	if (ret) {
+		PMD_DRV_LOG(ERR,
+			    "configure queue group %u bandwidth failed",
+			    sched_node->info.node_teid);
+		return ret;
+	}
+
+	priority = tm_node ? (7 - tm_node->priority) : 0;
+	status = ice_sched_cfg_sibl_node_prio(hw->port_info,
+					      sched_node,
+					      priority);
+	if (status) {
+		PMD_DRV_LOG(ERR, "configure node %u priority %u failed",
+			    sched_node->info.node_teid,
+			    priority);
+		return -EINVAL;
+	}
+
+	weight = tm_node ? (uint16_t)tm_node->weight : 4;
+
+	status = ice_sched_cfg_node_bw_alloc(hw, sched_node,
+					     ICE_MAX_BW,
+					     weight);
+	if (status) {
+		PMD_DRV_LOG(ERR, "configure node %u weight %u failed",
+			    sched_node->info.node_teid,
+			    weight);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 				 int clear_on_fail,
 				 __rte_unused struct rte_tm_error *error)
@@ -726,8 +769,7 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 	struct ice_sched_node *vsi_node = NULL;
 	struct ice_sched_node *queue_node;
 	struct ice_tx_queue *txq;
-	int ret_val = ICE_SUCCESS;
-	uint8_t priority;
+	int ret_val = 0;
 	uint32_t i;
 	uint32_t idx_vsi_child;
 	uint32_t idx_qg;
@@ -801,36 +843,15 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 			}
 		}
 
-		ret_val = ice_set_node_rate(hw, tm_node, qgroup_sched_node);
+		ret_val = ice_cfg_hw_node(hw, tm_node, qgroup_sched_node);
 		if (ret_val) {
 			error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
 			PMD_DRV_LOG(ERR,
-				    "configure queue group %u bandwidth failed",
+				    "configure queue group node %u failed",
 				    tm_node->id);
 			goto reset_vsi;
 		}
 
-		priority = 7 - tm_node->priority;
-		ret_val = ice_sched_cfg_sibl_node_prio_lock(hw->port_info, qgroup_sched_node,
-							    priority);
-		if (ret_val) {
-			error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY;
-			PMD_DRV_LOG(ERR, "configure queue group %u priority failed",
-				    tm_node->priority);
-			goto fail_clear;
-		}
-
-		ret_val = ice_sched_cfg_node_bw_alloc(hw, qgroup_sched_node,
-						      ICE_MAX_BW,
-						      (uint16_t)tm_node->weight);
-		if (ret_val) {
-			error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
-			PMD_DRV_LOG(ERR, "configure queue group %u weight %u failed",
-				    tm_node->id,
-				    tm_node->weight);
-			goto fail_clear;
-		}
-
 		idx_qg++;
 		if (idx_qg >= nb_qg) {
 			idx_qg = 0;
@@ -847,36 +868,16 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 		qid = tm_node->id;
 		txq = dev->data->tx_queues[qid];
 		q_teid = txq->q_teid;
-
 		queue_node = ice_sched_get_node(hw->port_info, q_teid);
-		ret_val = ice_set_node_rate(hw, tm_node, queue_node);
+
+		ret_val = ice_cfg_hw_node(hw, tm_node, queue_node);
 		if (ret_val) {
 			error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
 			PMD_DRV_LOG(ERR,
-				    "configure queue %u bandwidth failed",
+				    "configure queue group node %u failed",
 				    tm_node->id);
 			goto reset_vsi;
 		}
-
-		priority = 7 - tm_node->priority;
-		ret_val = ice_cfg_vsi_q_priority(hw->port_info, 1,
-						 &q_teid, &priority);
-		if (ret_val) {
-			error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY;
-			PMD_DRV_LOG(ERR, "configure queue %u priority failed", tm_node->priority);
-			goto fail_clear;
-		}
-
-		queue_node = ice_sched_get_node(hw->port_info, q_teid);
-		ret_val = ice_sched_cfg_node_bw_alloc(hw, queue_node, ICE_MAX_BW,
-						      (uint16_t)tm_node->weight);
-		if (ret_val) {
-			error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
-			PMD_DRV_LOG(ERR, "configure queue %u weight %u failed",
-				    tm_node->id,
-				    tm_node->weight);
-			goto fail_clear;
-		}
 	}
 
 	return ret_val;
Signature · 1 line
2.31.1
author
#5 lore raw

PATCH 5/6 net/ice: reset Tx sched node during commit

In reply to Qi Zhang

1. Always reset all Tx scheduler at the beginning of a commit action. This prevent unexpected remains from previous commit.
2. Reset all Tx scheduler nodes if a commit failed.

For leaf node, stop queues which will remove sched node from scheduler tree, then start queues which will add sched node back to default topo.
For noleaf node, simply reset to default parameters.

---
 drivers/net/ice/ice_ethdev.h |   1 +
 drivers/net/ice/ice_tm.c     | 130 ++++++++++++++++++++++++++++-------
 2 files changed, 107 insertions(+), 24 deletions(-)
drivers/net/ice/ice_ethdev.h +1 -0
index 1338c80d14..3b2db6aaa6 100644
@@ -478,6 +478,7 @@ struct ice_tm_node {
 	struct ice_tm_node **children;
 	struct ice_tm_shaper_profile *shaper_profile;
 	struct rte_tm_node_params params;
+	struct ice_sched_node *sched_node;
 };
 
 /* node type of Traffic Manager */
drivers/net/ice/ice_tm.c +106 -24

206 lines not on this page · raw message

Signature · 1 line
2.31.1
author
#6 lore raw

PATCH 6/6 net/ice: support Tx sched commit before device start

In reply to Qi Zhang

Currently Tx hierarchy commit only take effect if device already be started, as after a dev start / stop cycle, queues has been removed and added back which cause the Tx scheduler tree return to original topo.

In this patch, the hierarchy commit function will simply return if device has not be started yet and all the commit actions will be deferred to dev_start.

---
 drivers/net/ice/ice_ethdev.c |  9 +++++++++
 drivers/net/ice/ice_ethdev.h |  4 ++++
 drivers/net/ice/ice_tm.c     | 25 ++++++++++++++++++++++---
 3 files changed, 35 insertions(+), 3 deletions(-)
drivers/net/ice/ice_ethdev.c +9 -0
index 3c3bc49dc2..72e13f95f8 100644
@@ -3717,6 +3717,7 @@ ice_dev_start(struct rte_eth_dev *dev)
 	int mask, ret;
 	uint8_t timer = hw->func_caps.ts_func_info.tmr_index_owned;
 	uint32_t pin_idx = ad->devargs.pin_idx;
+	struct rte_tm_error tm_err;
 
 	/* program Tx queues' context in hardware */
 	for (nb_txq = 0; nb_txq < data->nb_tx_queues; nb_txq++) {
@@ -3746,6 +3747,14 @@ ice_dev_start(struct rte_eth_dev *dev)
 		}
 	}
 
+	if (pf->tm_conf.committed) {
+		ret = ice_do_hierarchy_commit(dev, pf->tm_conf.clear_on_fail, &tm_err);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to commit Tx scheduler");
+			goto rx_err;
+		}
+	}
+
 	ice_set_rx_function(dev);
 	ice_set_tx_function(dev);
 
drivers/net/ice/ice_ethdev.h +4 -0
index 3b2db6aaa6..fa4981ed14 100644
@@ -504,6 +504,7 @@ struct ice_tm_conf {
 	uint32_t nb_qgroup_node;
 	uint32_t nb_queue_node;
 	bool committed;
+	bool clear_on_fail;
 };
 
 struct ice_pf {
@@ -686,6 +687,9 @@ int ice_rem_rss_cfg_wrap(struct ice_pf *pf, uint16_t vsi_id,
 			 struct ice_rss_hash_cfg *cfg);
 void ice_tm_conf_init(struct rte_eth_dev *dev);
 void ice_tm_conf_uninit(struct rte_eth_dev *dev);
+int ice_do_hierarchy_commit(struct rte_eth_dev *dev,
+			    int clear_on_fail,
+			    struct rte_tm_error *error);
 extern const struct rte_tm_ops ice_tm_ops;
 
 static inline int
drivers/net/ice/ice_tm.c +22 -3
index 4d8dbff2dc..aa012897ed 100644
@@ -52,6 +52,7 @@ ice_tm_conf_init(struct rte_eth_dev *dev)
 	pf->tm_conf.nb_qgroup_node = 0;
 	pf->tm_conf.nb_queue_node = 0;
 	pf->tm_conf.committed = false;
+	pf->tm_conf.clear_on_fail = false;
 }
 
 void
@@ -832,9 +833,9 @@ static int ice_add_leaf_nodes(struct rte_eth_dev *dev)
 	return ret;
 }
 
-static int ice_hierarchy_commit(struct rte_eth_dev *dev,
-				 int clear_on_fail,
-				 struct rte_tm_error *error)
+int ice_do_hierarchy_commit(struct rte_eth_dev *dev,
+			    int clear_on_fail,
+			    struct rte_tm_error *error)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -959,6 +960,8 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 		}
 	}
 
+	pf->tm_conf.committed = true;
+
 	return ret_val;
 
 reset_leaf:
@@ -974,3 +977,19 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 	}
 	return ret_val;
 }
+
+static int ice_hierarchy_commit(struct rte_eth_dev *dev,
+				 int clear_on_fail,
+				 struct rte_tm_error *error)
+{
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	/* if device not started, simply set committed flag and return. */
+	if (!dev->data->dev_started) {
+		pf->tm_conf.committed = true;
+		pf->tm_conf.clear_on_fail = clear_on_fail;
+		return 0;
+	}
+
+	return ice_do_hierarchy_commit(dev, clear_on_fail, error);
+}
Signature · 1 line
2.31.1
Acked-by on the v1 series
#7 lore raw
In reply to Qi Zhang
Quoted 25 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, January 3, 2024 3:42 AM
To: Yang, Qiming <[email protected]>; Wu, Wenjun1 <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 0/6] net/ice improve qos

The patchset enhanced ice rte_tm implemenations

Qi Zhang (6):
net/ice: remove redundent code
net/ice: support VSI level bandwidth config net/ice: support queue group weight configure net/ice: refactor hardware Tx sched node config net/ice: reset Tx sched node during commit net/ice: support Tx sched commit before dev_start

 drivers/net/ice/base/ice_sched.c |   4 +-
 drivers/net/ice/base/ice_sched.h |   7 +-
 drivers/net/ice/ice_ethdev.c     |   9 +
 drivers/net/ice/ice_ethdev.h     |   5 +
 drivers/net/ice/ice_tm.c         | 361 +++++++++++++++++++++----------
 5 files changed, 269 insertions(+), 117 deletions(-)
Quoted 2 lines

--
2.31.1

author Applied
#8 lore raw
Quoted 35 lines

-----Original Message-----
From: Wu, Wenjun1 <[email protected]>
Sent: Thursday, January 4, 2024 10:29 AM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH 0/6] net/ice improve qos

Quoted 25 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, January 3, 2024 3:42 AM
To: Yang, Qiming <[email protected]>; Wu, Wenjun1 <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 0/6] net/ice improve qos

The patchset enhanced ice rte_tm implemenations

Qi Zhang (6):
net/ice: remove redundent code
net/ice: support VSI level bandwidth config net/ice: support queue group weight configure net/ice: refactor hardware Tx sched node config net/ice: reset Tx sched node during commit net/ice: support Tx sched commit before dev_start

 drivers/net/ice/base/ice_sched.c |   4 +-
 drivers/net/ice/base/ice_sched.h |   7 +-
 drivers/net/ice/ice_ethdev.c     |   9 +
 drivers/net/ice/ice_ethdev.h     |   5 +
 drivers/net/ice/ice_tm.c         | 361 +++++++++++++++++++++----------
 5 files changed, 269 insertions(+), 117 deletions(-)
Quoted 4 lines
Quoted 2 lines

--
2.31.1

Applied to dpdk-next-net-intel after fix the CI typo warning in PATCH 1/6.

Thanks
Qi