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 662AA454EF; Tue, 25 Jun 2024 13:30:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C37443384; Tue, 25 Jun 2024 13:21:47 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id EABCB42FE1 for ; Tue, 25 Jun 2024 13:18:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314305; x=1750850305; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hr38o6wT1jbs/Sc2qzEZRKGSq0MzbwMzhnG2s6Ic98U=; b=NnmzxA3+5CWwFaNVTuVuEHHUlz0LxuDRd9Euyp6mAWOehnJpbJg5Nm6T Z6Mpky4bWvCHHujR5OcR3TeXvsWHcf/dNC4cQ0SbnTNw86zYMWgQdZCe0 Nu9fb/L+PVaCeGzl6cuT/peMQoR1+fy26/2Jp8znCl+4aaXkEh17yxtac EkuyUgLPXSarqAw/11Pgp83hfbRq+ATHvwHyN00LHGnBhXDEw1x5fRGOb FizUbvOz+wJnxYCttdCf2Dcu3JCoUnj1y9x0tSSsu/XZ3ZhcZNdTKqXOb DDf8ZiTW29AEBhImIlGZvNa42LTqdWyLgza2DVkOvYY8STss4BWlaPVYz w==; X-CSE-ConnectionGUID: 7f4Y5t6xTce7lO/pUMZtVA== X-CSE-MsgGUID: 7zs7HHBbRDSnc9QNiieYZw== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080689" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080689" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:18:24 -0700 X-CSE-ConnectionGUID: I9nALYpmS9iS225TfoHujA== X-CSE-MsgGUID: +4ZHUfmdSXOV93U6dD2aUQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719826" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:18:24 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Michal Wilczynski , bruce.richardson@intel.com, ian.stokes@intel.com Subject: [PATCH v3 127/129] net/ice/base: introduce new functions in ice_sched_node Date: Tue, 25 Jun 2024 12:14:12 +0100 Message-ID: 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