[v11,6/7] net/ice: support queue weight configuration

Message ID 20220517050932.4078968-7-wenjun1.wu@intel.com (mailing list archive)
State Accepted, 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 May 17, 2022, 5:09 a.m. UTC
  This patch adds queue weight configuration support.

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 doc/guides/rel_notes/release_22_07.rst |  1 +
 drivers/net/ice/ice_tm.c               | 13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
  

Patch

diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index c5bfc52368..a0eb6ab61b 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -76,6 +76,7 @@  New Features
  * Added support for VLAN filter and offload configuration in DCF mode.
  * Added Tx QoS queue / queue group rate limitation configure support.
  * Added Tx QoS queue / queue group priority configuration support.
+ * Added Tx QoS queue weight configuration support.
 
 * **Updated Mellanox mlx5 driver.**
 
diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 105455f3cc..f604523ead 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;
 	}
 
@@ -813,6 +813,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;