DPDK patches and discussions
 help / color / mirror / Atom feed
From: markus.theil@tu-ilmenau.de
To: dev@dpdk.org
Cc: Qiming Yang <qiming.yang@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Michael Rossberg <michael.rossberg@tu-ilmenau.de>
Subject: [PATCH] net/ice: allow setting CIR
Date: Thu,  6 Jul 2023 13:45:14 +0200	[thread overview]
Message-ID: <20230706114514.106330-1-markus.theil@tu-ilmenau.de> (raw)

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(-)

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;
-- 
2.41.0


             reply	other threads:[~2023-07-06 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 11:45 markus.theil [this message]
2023-07-11  5:25 ` Wu, Wenjun1
2023-07-11  7:08   ` Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230706114514.106330-1-markus.theil@tu-ilmenau.de \
    --to=markus.theil@tu-ilmenau.de \
    --cc=dev@dpdk.org \
    --cc=michael.rossberg@tu-ilmenau.de \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).