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 79BEA437FC; Tue, 2 Jan 2024 12:21:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06CD9406B4; Tue, 2 Jan 2024 12:21:39 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 593DE40693 for ; Tue, 2 Jan 2024 12:21:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704194497; x=1735730497; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mcVLa7N/oJz/TmJiiK9jr9W2e7Jhp4z39o7X61Dzmy8=; b=OzHL7tF/TE4JHlVgu3ohFFp9kW48GETNpqdW11WkcSJ1RDRdgQwYkAgh EszQwoOQFr2gCaOCqTvFxFkBYTQM6bBQVQfZFjRJmeHQE4ZhNpmlhQtLw UqzphBy+wd8gFAt209exyy3SsYi5k8POAfmnoVPz4CgZ/dsZNpaqS6Dxv FfS9DGiN9cGlHv72FZmNVH6oKQNwI3f3HBd+vgHkwfl17TTHLUV77FOHx cTTIfNgCrNACyp1u0Z2vF8Hrhr1y+5RZhLxfordCWvLSq5z9ODo+iFH6M E5OwpmT7087DhkDCo2R+aCMf1FHe3to51Gf/RsVTY/bSmCANlZaIz5xpU g==; X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="10256794" X-IronPort-AV: E=Sophos;i="6.04,324,1695711600"; d="scan'208";a="10256794" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 03:21:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="952895247" X-IronPort-AV: E=Sophos;i="6.04,324,1695711600"; d="scan'208";a="952895247" Received: from dpdk-qzhan15-test02.sh.intel.com ([10.67.115.37]) by orsmga005.jf.intel.com with ESMTP; 02 Jan 2024 03:21:35 -0800 From: Qi Zhang To: qiming.yang@intel.com, wenjun1.wu@intel.com Cc: dev@dpdk.org, Qi Zhang Subject: [PATCH 4/6] net/ice: refactor hardware Tx sched node config Date: Tue, 2 Jan 2024 14:42:30 -0500 Message-Id: <20240102194232.3614305-5-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240102194232.3614305-1-qi.z.zhang@intel.com> References: <20240102194232.3614305-1-qi.z.zhang@intel.com> 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 Consolidate Tx scheduler node configuration into a function: 'ice_cfg_hw_node", where rate limit, weight, priority will be configured for queue group level and queue level. Signed-off-by: Qi Zhang --- drivers/net/ice/ice_tm.c | 97 ++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index 604d045e2c..20cc47fff1 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -713,6 +713,49 @@ static int ice_set_node_rate(struct ice_hw *hw, return 0; } +static int ice_cfg_hw_node(struct ice_hw *hw, + struct ice_tm_node *tm_node, + struct ice_sched_node *sched_node) +{ + enum ice_status status; + uint8_t priority; + uint16_t weight; + int ret; + + ret = ice_set_node_rate(hw, tm_node, sched_node); + if (ret) { + PMD_DRV_LOG(ERR, + "configure queue group %u bandwidth failed", + sched_node->info.node_teid); + return ret; + } + + priority = tm_node ? (7 - tm_node->priority) : 0; + status = ice_sched_cfg_sibl_node_prio(hw->port_info, + sched_node, + priority); + if (status) { + PMD_DRV_LOG(ERR, "configure node %u priority %u failed", + sched_node->info.node_teid, + priority); + return -EINVAL; + } + + weight = tm_node ? (uint16_t)tm_node->weight : 4; + + status = ice_sched_cfg_node_bw_alloc(hw, sched_node, + ICE_MAX_BW, + weight); + if (status) { + PMD_DRV_LOG(ERR, "configure node %u weight %u failed", + sched_node->info.node_teid, + weight); + return -EINVAL; + } + + return 0; +} + static int ice_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, __rte_unused struct rte_tm_error *error) @@ -726,8 +769,7 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev, struct ice_sched_node *vsi_node = NULL; struct ice_sched_node *queue_node; struct ice_tx_queue *txq; - int ret_val = ICE_SUCCESS; - uint8_t priority; + int ret_val = 0; uint32_t i; uint32_t idx_vsi_child; uint32_t idx_qg; @@ -801,36 +843,15 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev, } } - ret_val = ice_set_node_rate(hw, tm_node, qgroup_sched_node); + ret_val = ice_cfg_hw_node(hw, tm_node, qgroup_sched_node); if (ret_val) { error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; PMD_DRV_LOG(ERR, - "configure queue group %u bandwidth failed", + "configure queue group node %u failed", tm_node->id); goto reset_vsi; } - priority = 7 - tm_node->priority; - ret_val = ice_sched_cfg_sibl_node_prio_lock(hw->port_info, qgroup_sched_node, - priority); - if (ret_val) { - error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY; - PMD_DRV_LOG(ERR, "configure queue group %u priority failed", - tm_node->priority); - goto fail_clear; - } - - ret_val = ice_sched_cfg_node_bw_alloc(hw, qgroup_sched_node, - ICE_MAX_BW, - (uint16_t)tm_node->weight); - if (ret_val) { - error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT; - PMD_DRV_LOG(ERR, "configure queue group %u weight %u failed", - tm_node->id, - tm_node->weight); - goto fail_clear; - } - idx_qg++; if (idx_qg >= nb_qg) { idx_qg = 0; @@ -847,36 +868,16 @@ static int ice_hierarchy_commit(struct rte_eth_dev *dev, qid = tm_node->id; txq = dev->data->tx_queues[qid]; q_teid = txq->q_teid; - queue_node = ice_sched_get_node(hw->port_info, q_teid); - ret_val = ice_set_node_rate(hw, tm_node, queue_node); + + ret_val = ice_cfg_hw_node(hw, tm_node, queue_node); if (ret_val) { error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; PMD_DRV_LOG(ERR, - "configure queue %u bandwidth failed", + "configure queue group node %u failed", tm_node->id); goto reset_vsi; } - - priority = 7 - tm_node->priority; - ret_val = ice_cfg_vsi_q_priority(hw->port_info, 1, - &q_teid, &priority); - if (ret_val) { - error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY; - PMD_DRV_LOG(ERR, "configure queue %u priority failed", tm_node->priority); - goto fail_clear; - } - - queue_node = ice_sched_get_node(hw->port_info, q_teid); - ret_val = ice_sched_cfg_node_bw_alloc(hw, queue_node, ICE_MAX_BW, - (uint16_t)tm_node->weight); - if (ret_val) { - error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT; - PMD_DRV_LOG(ERR, "configure queue %u weight %u failed", - tm_node->id, - tm_node->weight); - goto fail_clear; - } } return ret_val; -- 2.31.1