From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6F96C42DE7; Thu, 6 Jul 2023 13:45:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44635410FA; Thu, 6 Jul 2023 13:45:19 +0200 (CEST) Received: from smail.rz.tu-ilmenau.de (smail.rz.tu-ilmenau.de [141.24.186.67]) by mails.dpdk.org (Postfix) with ESMTP id E5FAC40A79 for ; Thu, 6 Jul 2023 13:45:17 +0200 (CEST) Received: from localhost.localdomain (unknown [91.137.0.140]) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPA id 839135800A9; Thu, 6 Jul 2023 13:45:17 +0200 (CEST) From: markus.theil@tu-ilmenau.de To: dev@dpdk.org Cc: Qiming Yang , Qi Zhang , Michael Rossberg Subject: [PATCH] net/ice: allow setting CIR Date: Thu, 6 Jul 2023 13:45:14 +0200 Message-ID: <20230706114514.106330-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Michael Rossberg 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 --- 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