[v7,7/9] net/ice: support queue weight configuration

Message ID 20220422005746.2300736-8-wenjun1.wu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series Enable ETS-based TX QoS on PF |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Wenjun Wu April 22, 2022, 12:57 a.m. UTC
  This patch adds queue weight configuration support.

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 drivers/net/ice/ice_tm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 91e420d653..4d7bb9102c 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -153,9 +153,9 @@  ice_node_param_check(struct ice_pf *pf, uint32_t node_id,
 		return -EINVAL;
 	}
 
-	if (weight != 1) {
+	if (weight > 200 || weight < 1) {
 		error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
-		error->message = "weight must be 1";
+		error->message = "weight must be between 1 and 200";
 		return -EINVAL;
 	}
 
@@ -804,6 +804,15 @@  static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 			PMD_DRV_LOG(ERR, "configure queue %u priority failed", tm_node->priority);
 			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);
+		if (ret_val) {
+			error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT;
+			PMD_DRV_LOG(ERR, "configure queue %u weight failed", tm_node->weight);
+			goto fail_clear;
+		}
 	}
 
 	return ret_val;