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 5B7DB45501; Wed, 26 Jun 2024 14:07:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7F94B43488; Wed, 26 Jun 2024 13:57:39 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id C699D42E95 for ; Wed, 26 Jun 2024 13:45:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719402355; x=1750938355; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hr38o6wT1jbs/Sc2qzEZRKGSq0MzbwMzhnG2s6Ic98U=; b=lxXCOC30X6ZhijzNMk10vqzZEOEkPVVACPizMbjPvP/Xe4HMTu6W8fdl mBJof7TUyKansE5ScbNOwDQDSX5JFLPaKwt61wIjaZM5YQFc1kPBGiY3Q t/otEoHZtWuOaLpp/f1HJ59Rw+lDEoLqKIfdPgLYh3SQtm6j6VXwJpO+4 /44TVs7D7WU0+xjk+pjRRML+ZsLEp2nSgPnv+ZJHCoBBrwnQQWSWDV68n GvQvCoHZk8soQOgqJLU8eLBDAbGRaloEu2gKwp7Qj6lu2dcg64dT3XSG1 xRx5ISfCbWVUV8i99W2Gwj3J4K4gEk696FoOE3sSdxVRAhFRBpITYSMZi g==; X-CSE-ConnectionGUID: OsObNO7DSQqBvVV1dNGffg== X-CSE-MsgGUID: KRGNM3fRRy+tw7BAVwQiLA== X-IronPort-AV: E=McAfee;i="6700,10204,11114"; a="38979637" X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="38979637" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2024 04:45:54 -0700 X-CSE-ConnectionGUID: 9NtRw6NwRhS9iWCZDAC/pw== X-CSE-MsgGUID: xqBfetQVQFy5rdVYKK+YZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="43874882" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa010.jf.intel.com with ESMTP; 26 Jun 2024 04:45:53 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Michal Wilczynski , ian.stokes@intel.com, bruce.richardson@intel.com Subject: [PATCH v4 101/103] net/ice/base: introduce new functions in ice_sched_node Date: Wed, 26 Jun 2024 12:42:29 +0100 Message-ID: <67bf0cd3aec18bd21230882f7368e09365ae9277.1719401848.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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: Michal Wilczynski Add new functions to configure the hardware with new parameters. Signed-off-by: Michal Wilczynski Signed-off-by: Ian Stokes --- drivers/net/ice/base/ice_sched.c | 52 ++++++++++++++++++++++++++++++++ drivers/net/ice/base/ice_sched.h | 9 ++++++ 2 files changed, 61 insertions(+) diff --git a/drivers/net/ice/base/ice_sched.c b/drivers/net/ice/base/ice_sched.c index 353316cd0e..373c32a518 100644 --- a/drivers/net/ice/base/ice_sched.c +++ b/drivers/net/ice/base/ice_sched.c @@ -4418,6 +4418,58 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, ICE_AQC_RL_PROFILE_TYPE_M, old_id); } +/** + * ice_sched_set_node_priority - set node's priority + * @pi: port information structure + * @node: tree node + * @priority: number 0-7 representing priority among siblings + * + * This function sets priority of a node among it's siblings. + */ +int +ice_sched_set_node_priority(struct ice_port_info *pi, struct ice_sched_node *node, + u16 priority) +{ + struct ice_aqc_txsched_elem_data buf; + struct ice_aqc_txsched_elem *data; + + buf = node->info; + data = &buf.data; + + data->valid_sections |= ICE_AQC_ELEM_VALID_GENERIC; + data->generic |= ICE_AQC_ELEM_GENERIC_PRIO_M & + (priority << ICE_AQC_ELEM_GENERIC_PRIO_S); + + return ice_sched_update_elem(pi->hw, node, &buf); +} + +/** + * ice_sched_set_node_weight - set node's weight + * @pi: port information structure + * @node: tree node + * @weight: number 1-200 representing weight for WFQ + * + * This function sets weight of the node for WFQ algorithm. + */ +int +ice_sched_set_node_weight(struct ice_port_info *pi, struct ice_sched_node *node, u16 weight) +{ + struct ice_aqc_txsched_elem_data buf; + struct ice_aqc_txsched_elem *data; + + buf = node->info; + data = &buf.data; + + data->valid_sections = ICE_AQC_ELEM_VALID_CIR | ICE_AQC_ELEM_VALID_EIR | + ICE_AQC_ELEM_VALID_GENERIC; + data->cir_bw.bw_alloc = CPU_TO_LE16(weight); + data->eir_bw.bw_alloc = CPU_TO_LE16(weight); + data->generic |= ICE_AQC_ELEM_GENERIC_SP_M & + (0x0 << ICE_AQC_ELEM_GENERIC_SP_S); + + return ice_sched_update_elem(pi->hw, node, &buf); +} + /** * ice_sched_set_node_bw_lmt - set node's BW limit * @pi: port information structure diff --git a/drivers/net/ice/base/ice_sched.h b/drivers/net/ice/base/ice_sched.h index 0037cbf76f..9f78516dfb 100644 --- a/drivers/net/ice/base/ice_sched.h +++ b/drivers/net/ice/base/ice_sched.h @@ -7,6 +7,8 @@ #include "ice_common.h" +#define SCHED_NODE_NAME_MAX_LEN 32 + #define ICE_SCHED_5_LAYERS 5 #define ICE_SCHED_9_LAYERS 9 @@ -120,6 +122,13 @@ int ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, u16 num_items, u32 *list); +int +ice_sched_set_node_priority(struct ice_port_info *pi, struct ice_sched_node *node, + u16 priority); +int +ice_sched_set_node_weight(struct ice_port_info *pi, struct ice_sched_node *node, + u16 weight); + int ice_sched_init_port(struct ice_port_info *pi); int ice_sched_query_res_alloc(struct ice_hw *hw); void ice_sched_get_psm_clk_freq(struct ice_hw *hw); -- 2.43.0