net/ice: allow setting CIR

Message ID 20230706114514.106330-1-markus.theil@tu-ilmenau.de (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/ice: allow setting CIR |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Markus Theil July 6, 2023, 11:45 a.m. UTC
  From: Michael Rossberg <michael.rossberg@tu-ilmenau.de>

ice only allowed to set peak information rate (PIR), while the hardware
also supports setting committed information rate (CIR). In many use
cases both values are needed, therefore add support for CIR.

Signed-off-by: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
---
 drivers/net/ice/ice_tm.c | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)
  

Comments

Wenjun Wu July 11, 2023, 5:25 a.m. UTC | #1
> -----Original Message-----
> From: markus.theil@tu-ilmenau.de <markus.theil@tu-ilmenau.de>
> Sent: Thursday, July 6, 2023 7:45 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Michael Rossberg <michael.rossberg@tu-
> ilmenau.de>
> Subject: [PATCH] net/ice: allow setting CIR
> 
> From: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
> 
> ice only allowed to set peak information rate (PIR), while the hardware also
> supports setting committed information rate (CIR). In many use cases both
> values are needed, therefore add support for CIR.
> 
> Signed-off-by: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
> --
> 2.41.0

Acked-by: Wenjun Wu <wenjun1.wu@intel.com>
  
Qi Zhang July 11, 2023, 7:08 a.m. UTC | #2
> -----Original Message-----
> From: Wu, Wenjun1 <wenjun1.wu@intel.com>
> Sent: Tuesday, July 11, 2023 1:25 PM
> To: markus.theil@tu-ilmenau.de; dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Michael Rossberg <michael.rossberg@tu-ilmenau.de>
> Subject: RE: [PATCH] net/ice: allow setting CIR
> 
> > -----Original Message-----
> > From: markus.theil@tu-ilmenau.de <markus.theil@tu-ilmenau.de>
> > Sent: Thursday, July 6, 2023 7:45 PM
> > To: dev@dpdk.org
> > Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Michael Rossberg <michael.rossberg@tu-
> > ilmenau.de>
> > Subject: [PATCH] net/ice: allow setting CIR
> >
> > From: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
> >
> > ice only allowed to set peak information rate (PIR), while the
> > hardware also supports setting committed information rate (CIR). In
> > many use cases both values are needed, therefore add support for CIR.
> >
> > Signed-off-by: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
> > --
> > 2.41.0
> 
> Acked-by: Wenjun Wu <wenjun1.wu@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 34a0bfcff8..f5ea47ae83 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -693,6 +693,7 @@  static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 	struct ice_vsi *vsi;
 	int ret_val = ICE_SUCCESS;
 	uint64_t peak = 0;
+	uint64_t committed = 0;
 	uint8_t priority;
 	uint32_t i;
 	uint32_t idx_vsi_child;
@@ -801,17 +802,33 @@  static int ice_hierarchy_commit(struct rte_eth_dev *dev,
 		q_teid = txq->q_teid;
 		if (tm_node->shaper_profile) {
 			/* Transfer from Byte per seconds to Kbps */
-			peak = tm_node->shaper_profile->profile.peak.rate;
-			peak = peak / 1000 * BITS_PER_BYTE;
-			ret_val = ice_cfg_q_bw_lmt(hw->port_info, vsi->idx,
-						   tm_node->tc, tm_node->id,
-						   ICE_MAX_BW, (u32)peak);
-			if (ret_val) {
-				error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
-				PMD_DRV_LOG(ERR,
-					    "configure queue %u bandwidth failed",
-					    tm_node->id);
-				goto fail_clear;
+			if (tm_node->shaper_profile->profile.peak.rate > 0) {
+				peak = tm_node->shaper_profile->profile.peak.rate;
+				peak = peak / 1000 * BITS_PER_BYTE;
+				ret_val = ice_cfg_q_bw_lmt(hw->port_info, vsi->idx,
+							   tm_node->tc, tm_node->id,
+							   ICE_MAX_BW, (u32)peak);
+				if (ret_val) {
+					error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
+					PMD_DRV_LOG(ERR,
+						    "configure queue %u peak bandwidth failed",
+						    tm_node->id);
+					goto fail_clear;
+				}
+			}
+			if (tm_node->shaper_profile->profile.committed.rate > 0) {
+				committed = tm_node->shaper_profile->profile.committed.rate;
+				committed = committed / 1000 * BITS_PER_BYTE;
+				ret_val = ice_cfg_q_bw_lmt(hw->port_info, vsi->idx,
+							   tm_node->tc, tm_node->id,
+							   ICE_MIN_BW, (u32)committed);
+				if (ret_val) {
+					error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
+					PMD_DRV_LOG(ERR,
+						    "configure queue %u committed bandwidth failed",
+						    tm_node->id);
+					goto fail_clear;
+				}
 			}
 		}
 		priority = 7 - tm_node->priority;