From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E11B2A04B5; Thu, 10 Sep 2020 20:49:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C7281C11A; Thu, 10 Sep 2020 20:48:58 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 9F1B91BFB4 for ; Thu, 10 Sep 2020 20:48:52 +0200 (CEST) IronPort-SDR: RRx75giP6n8VrXQ0EVInTVZBpwyw2AJLAmBtTs5pcB22dFBld/A9qinCwiEMqP0v/AnMbsScVS C4z7rZFEzQ4Q== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="138130665" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="138130665" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 11:48:52 -0700 IronPort-SDR: 6zQUXZp8Bmz46gk7N+YIdbAm+M1XhgctN4ZMviGJdP5UOZIMV850RnsDbJ46zlNuu38/uNpypu UElWK2h/y0TA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="344371101" Received: from silpixa00400629.ir.intel.com ([10.237.214.135]) by orsmga007.jf.intel.com with ESMTP; 10 Sep 2020 11:48:50 -0700 From: Savinay Dharmappa To: jasvinder.singh@intel.com, cristian.dumitrescu@intel.com, dev@dpdk.org Cc: savinay.dharmappa@intel.com Date: Thu, 10 Sep 2020 19:48:32 +0100 Message-Id: <1599763717-135002-6-git-send-email-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599763717-135002-1-git-send-email-savinay.dharmappa@intel.com> References: <1599037006-3931-1-git-send-email-savinay.dharmappa@intel.com> <1599763717-135002-1-git-send-email-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v2 05/10] sched: update the pipe config api implementation 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" Subport profile parameters are fetched from subport profile table to calculate the subport best effort tc rate. Signed-off-by: Savinay Dharmappa Signed-off-by: Jasvinder Singh --- lib/librte_sched/rte_sched.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 8e66d08..9ff67e0 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -1403,6 +1403,7 @@ rte_sched_pipe_config(struct rte_sched_port *port, int32_t pipe_profile) { struct rte_sched_subport *s; + struct rte_sched_subport_profile *sp; struct rte_sched_pipe *p; struct rte_sched_pipe_profile *params; uint32_t n_subports = subport_id + 1; @@ -1443,14 +1444,15 @@ rte_sched_pipe_config(struct rte_sched_port *port, return -EINVAL; } + sp = port->subport_profiles + s->profile; /* Handle the case when pipe already has a valid configuration */ p = s->pipe + pipe_id; if (p->tb_time) { params = s->pipe_profiles + p->profile; double subport_tc_be_rate = - (double) s->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - / (double) s->tc_period; + (double)sp->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] + / (double) sp->tc_period; double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; @@ -1492,8 +1494,8 @@ rte_sched_pipe_config(struct rte_sched_port *port, { /* Subport best effort tc oversubscription */ double subport_tc_be_rate = - (double) s->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - / (double) s->tc_period; + (double)sp->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] + / (double) sp->tc_period; double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; @@ -2286,11 +2288,11 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t i; /* Subport TB */ - n_periods = (port->time - subport->tb_time) / sp_params->sp_tb_period; - subport->tb_credits += n_periods * sp_params->sp_tb_credits_per_period; + n_periods = (port->time - subport->tb_time) / sp_params->tb_period; + subport->tb_credits += n_periods * sp_params->tb_credits_per_period; subport->tb_credits = RTE_MIN(subport->tb_credits, - sp_params->sp_tb_size); - subport->tb_time += n_periods * sp_params->sp_tb_period; + sp_params->tb_size); + subport->tb_time += n_periods * sp_params->tb_period; /* Pipe TB */ n_periods = (port->time - pipe->tb_time) / params->tb_period; @@ -2302,9 +2304,9 @@ grinder_credits_update(struct rte_sched_port *port, if (unlikely(port->time >= subport->tc_time)) { for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) subport->tc_credits[i] = - sp_params->sp_tc_credits_per_period[i]; + sp_params->tc_credits_per_period[i]; - subport->tc_time = port->time + sp_params->sp_tc_period; + subport->tc_time = port->time + sp_params->tc_period; } /* Pipe TCs */ @@ -2333,17 +2335,17 @@ grinder_tc_ov_credits_update(struct rte_sched_port *port, return subport->tc_ov_wm_max; for (i = 0; i < RTE_SCHED_TRAFFIC_CLASS_BE; i++) { - tc_ov_consumption[i] = sp_params->sp_tc_credits_per_period[i] + tc_ov_consumption[i] = sp_params->tc_credits_per_period[i] - subport->tc_credits[i]; tc_consumption += tc_ov_consumption[i]; } tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] = - sp_params->sp_tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - + sp_params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - subport->tc_credits[RTE_SCHED_TRAFFIC_CLASS_BE]; tc_ov_consumption_max = - sp_params->sp_tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - + sp_params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - tc_consumption; if (tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] > @@ -2374,11 +2376,11 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t i; /* Subport TB */ - n_periods = (port->time - subport->tb_time) / sp_params->sp_tb_period; - subport->tb_credits += n_periods * sp_params->sp_tb_credits_per_period; + n_periods = (port->time - subport->tb_time) / sp_params->tb_period; + subport->tb_credits += n_periods * sp_params->tb_credits_per_period; subport->tb_credits = RTE_MIN(subport->tb_credits, - sp_params->sp_tb_size); - subport->tb_time += n_periods * sp_params->sp_tb_period; + sp_params->tb_size); + subport->tb_time += n_periods * sp_params->tb_period; /* Pipe TB */ n_periods = (port->time - pipe->tb_time) / params->tb_period; @@ -2393,9 +2395,9 @@ grinder_credits_update(struct rte_sched_port *port, for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) subport->tc_credits[i] = - sp_params->sp_tc_credits_per_period[i]; + sp_params->tc_credits_per_period[i]; - subport->tc_time = port->time + sp_params->sp_tc_period; + subport->tc_time = port->time + sp_params->tc_period; subport->tc_ov_period_id++; } -- 2.7.4