From patchwork Fri Sep 11 13:19:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 77418 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 534B7A04B7; Fri, 11 Sep 2020 15:22:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB0E21C235; Fri, 11 Sep 2020 15:16:59 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 978211C210 for ; Fri, 11 Sep 2020 15:16:46 +0200 (CEST) IronPort-SDR: 1eGFjVZxNxi6sH4nBtQIMJuCy8qSUMTCYflGia83M0nYUpVdl/d7yKfhVrJZcpU2UaigvM7V8j nVmdfJxl8tCg== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="146482385" X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="146482385" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 06:16:45 -0700 IronPort-SDR: ahJ8cZPQlwVExJf0RMCdCtg1fdl6n3Z82ix5x1AObr7IDj8FEJpiJUS/z8tbOHCDHAz8LXQ6fz IBuZ9BhgH8Rg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="342296729" Received: from dpdk51.sh.intel.com ([10.67.111.82]) by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2020 06:16:44 -0700 From: Qi Zhang To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Qi Zhang , Shibin Koikkara Reeny Date: Fri, 11 Sep 2020 21:19:45 +0800 Message-Id: <20200911131954.15999-32-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200911131954.15999-1-qi.z.zhang@intel.com> References: <20200907112826.48493-1-qi.z.zhang@intel.com> <20200911131954.15999-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 31/40] net/ice/base: adjust rate limit profile ids runtime database X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Moving the runtime profile ids database/storage to the hw structure. Signed-off-by: Shibin Koikkara Reeny Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/base/ice_sched.c | 54 +++++++++++++++++++--------------------- drivers/net/ice/base/ice_type.h | 4 +-- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/drivers/net/ice/base/ice_sched.c b/drivers/net/ice/base/ice_sched.c index 1374b9a09..4be449f61 100644 --- a/drivers/net/ice/base/ice_sched.c +++ b/drivers/net/ice/base/ice_sched.c @@ -727,15 +727,15 @@ ice_sched_del_rl_profile(struct ice_hw *hw, static void ice_sched_clear_rl_prof(struct ice_port_info *pi) { u16 ln; + struct ice_hw *hw = pi->hw; - for (ln = 0; ln < pi->hw->num_tx_sched_layers; ln++) { + for (ln = 0; ln < hw->num_tx_sched_layers; ln++) { struct ice_aqc_rl_profile_info *rl_prof_elem; struct ice_aqc_rl_profile_info *rl_prof_tmp; LIST_FOR_EACH_ENTRY_SAFE(rl_prof_elem, rl_prof_tmp, - &pi->rl_prof_list[ln], + &hw->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) { - struct ice_hw *hw = pi->hw; enum ice_status status; rl_prof_elem->prof_id_ref = 0; @@ -1260,7 +1260,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi) pi->port_state = ICE_SCHED_PORT_STATE_READY; ice_init_lock(&pi->sched_lock); for (i = 0; i < ICE_AQC_TOPO_MAX_LEVEL_NUM; i++) - INIT_LIST_HEAD(&pi->rl_prof_list[i]); + INIT_LIST_HEAD(&hw->rl_prof_list[i]); err_init_port: if (status && pi->root) { @@ -2868,24 +2868,24 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, /** * ice_sched_rm_unused_rl_prof - remove unused RL profile - * @pi: port information structure + * @hw: pointer to the hardware structure * * This function removes unused rate limit profiles from the HW and * SW DB. The caller needs to hold scheduler lock. */ -static void ice_sched_rm_unused_rl_prof(struct ice_port_info *pi) +static void ice_sched_rm_unused_rl_prof(struct ice_hw *hw) { u16 ln; - for (ln = 0; ln < pi->hw->num_tx_sched_layers; ln++) { + for (ln = 0; ln < hw->num_tx_sched_layers; ln++) { struct ice_aqc_rl_profile_info *rl_prof_elem; struct ice_aqc_rl_profile_info *rl_prof_tmp; LIST_FOR_EACH_ENTRY_SAFE(rl_prof_elem, rl_prof_tmp, - &pi->rl_prof_list[ln], + &hw->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) { - if (!ice_sched_del_rl_profile(pi->hw, rl_prof_elem)) - ice_debug(pi->hw, ICE_DBG_SCHED, "Removed rl profile\n"); + if (!ice_sched_del_rl_profile(hw, rl_prof_elem)) + ice_debug(hw, ICE_DBG_SCHED, "Removed rl profile\n"); } } } @@ -3031,7 +3031,7 @@ enum ice_status ice_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id) ice_free(pi->hw, agg_info); /* Remove unused RL profile IDs from HW and SW DB */ - ice_sched_rm_unused_rl_prof(pi); + ice_sched_rm_unused_rl_prof(pi->hw); exit_ice_rm_agg_cfg: ice_release_lock(&pi->sched_lock); @@ -3852,7 +3852,7 @@ ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw, /** * ice_sched_add_rl_profile - add RL profile - * @pi: port information structure + * @hw: pointer to the hardware structure * @rl_type: type of rate limit BW - min, max, or shared * @bw: bandwidth in Kbps - Kilo bits per sec * @layer_num: specifies in which layer to create profile @@ -3864,14 +3864,13 @@ ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw, * The caller needs to hold the scheduler lock. */ static struct ice_aqc_rl_profile_info * -ice_sched_add_rl_profile(struct ice_port_info *pi, - enum ice_rl_type rl_type, u32 bw, u8 layer_num) +ice_sched_add_rl_profile(struct ice_hw *hw, enum ice_rl_type rl_type, + u32 bw, u8 layer_num) { struct ice_aqc_rl_profile_info *rl_prof_elem; u16 profiles_added = 0, num_profiles = 1; struct ice_aqc_rl_profile_elem *buf; enum ice_status status; - struct ice_hw *hw; u8 profile_type; if (layer_num >= ICE_AQC_TOPO_MAX_LEVEL_NUM) @@ -3890,10 +3889,9 @@ ice_sched_add_rl_profile(struct ice_port_info *pi, return NULL; } - if (!pi) + if (!hw) return NULL; - hw = pi->hw; - LIST_FOR_EACH_ENTRY(rl_prof_elem, &pi->rl_prof_list[layer_num], + LIST_FOR_EACH_ENTRY(rl_prof_elem, &hw->rl_prof_list[layer_num], ice_aqc_rl_profile_info, list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) == profile_type && rl_prof_elem->bw == bw) @@ -3926,7 +3924,7 @@ ice_sched_add_rl_profile(struct ice_port_info *pi, /* Good entry - add in the list */ rl_prof_elem->prof_id_ref = 0; - LIST_ADD(&rl_prof_elem->list_entry, &pi->rl_prof_list[layer_num]); + LIST_ADD(&rl_prof_elem->list_entry, &hw->rl_prof_list[layer_num]); return rl_prof_elem; exit_add_rl_prof: @@ -4105,7 +4103,7 @@ ice_sched_get_srl_node(struct ice_sched_node *node, u8 srl_layer) /** * ice_sched_rm_rl_profile - remove RL profile ID - * @pi: port information structure + * @hw: pointer to the hardware structure * @layer_num: layer number where profiles are saved * @profile_type: profile type like EIR, CIR, or SRL * @profile_id: profile ID to remove @@ -4115,7 +4113,7 @@ ice_sched_get_srl_node(struct ice_sched_node *node, u8 srl_layer) * scheduler lock. */ static enum ice_status -ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type, +ice_sched_rm_rl_profile(struct ice_hw *hw, u8 layer_num, u8 profile_type, u16 profile_id) { struct ice_aqc_rl_profile_info *rl_prof_elem; @@ -4124,7 +4122,7 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type, if (layer_num >= ICE_AQC_TOPO_MAX_LEVEL_NUM) return ICE_ERR_PARAM; /* Check the existing list for RL profile */ - LIST_FOR_EACH_ENTRY(rl_prof_elem, &pi->rl_prof_list[layer_num], + LIST_FOR_EACH_ENTRY(rl_prof_elem, &hw->rl_prof_list[layer_num], ice_aqc_rl_profile_info, list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) == profile_type && @@ -4134,9 +4132,9 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type, rl_prof_elem->prof_id_ref--; /* Remove old profile ID from database */ - status = ice_sched_del_rl_profile(pi->hw, rl_prof_elem); + status = ice_sched_del_rl_profile(hw, rl_prof_elem); if (status && status != ICE_ERR_IN_USE) - ice_debug(pi->hw, ICE_DBG_SCHED, "Remove rl profile failed\n"); + ice_debug(hw, ICE_DBG_SCHED, "Remove rl profile failed\n"); break; } if (status == ICE_ERR_IN_USE) @@ -4196,7 +4194,7 @@ ice_sched_set_node_bw_dflt(struct ice_port_info *pi, old_id == ICE_SCHED_INVAL_PROF_ID) return ICE_SUCCESS; - return ice_sched_rm_rl_profile(pi, layer_num, profile_type, old_id); + return ice_sched_rm_rl_profile(hw, layer_num, profile_type, old_id); } /** @@ -4265,7 +4263,7 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, struct ice_hw *hw = pi->hw; u16 old_id, rl_prof_id; - rl_prof_info = ice_sched_add_rl_profile(pi, rl_type, bw, layer_num); + rl_prof_info = ice_sched_add_rl_profile(hw, rl_type, bw, layer_num); if (!rl_prof_info) return status; @@ -4287,7 +4285,7 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, old_id == ICE_SCHED_INVAL_PROF_ID || old_id == rl_prof_id) return ICE_SUCCESS; - return ice_sched_rm_rl_profile(pi, layer_num, + return ice_sched_rm_rl_profile(hw, layer_num, rl_prof_info->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M, old_id); } @@ -4316,7 +4314,7 @@ ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node, return ICE_ERR_PARAM; hw = pi->hw; /* Remove unused RL profile IDs from HW and SW DB */ - ice_sched_rm_unused_rl_prof(pi); + ice_sched_rm_unused_rl_prof(hw); layer_num = ice_sched_get_rl_prof_layer(pi, rl_type, node->tx_sched_layer); if (layer_num >= hw->num_tx_sched_layers) diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index f80e19df9..9c2fb560e 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -782,8 +782,6 @@ struct ice_port_info { struct ice_lock sched_lock; /* protect access to TXSched tree */ struct ice_sched_node * sib_head[ICE_MAX_TRAFFIC_CLASS][ICE_AQC_TOPO_MAX_LEVEL_NUM]; - /* List contain profile ID(s) and other params per layer */ - struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM]; struct ice_bw_type_info root_node_bw_t_info; struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS]; struct ice_qos_cfg qos_cfg; @@ -834,6 +832,8 @@ struct ice_hw { u8 sw_entry_point_layer; u16 max_children[ICE_AQC_TOPO_MAX_LEVEL_NUM]; struct LIST_HEAD_TYPE agg_list; /* lists all aggregator */ + /* List contain profile ID(s) and other params per layer */ + struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM]; struct ice_vsi_ctx *vsi_ctx[ICE_MAX_VSI]; u8 evb_veb; /* true for VEB, false for VEPA */ u8 reset_ongoing; /* true if HW is in reset, false otherwise */