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 C4A6CA04B5; Thu, 10 Sep 2020 20:49:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7477E1C113; Thu, 10 Sep 2020 20:48:57 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id CDAEB1BFB4 for ; Thu, 10 Sep 2020 20:48:51 +0200 (CEST) IronPort-SDR: V8M6JjJV+sU0IQvNugvUIwW7YRm3uY2aQFBz4kK5uea9dSvSjNjqa48+PK+MXCNl5ERH10Ys4b waxZXEwCzbDw== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="138130659" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="138130659" 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:50 -0700 IronPort-SDR: AZK7jK8EIpX/ffTrD+N9PZApLP3w6FM2LGpREoa/YCih/wEb83cpZuXyjgQStMGjH07Sd4QM5x +88UxwrjGT5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="344371093" Received: from silpixa00400629.ir.intel.com ([10.237.214.135]) by orsmga007.jf.intel.com with ESMTP; 10 Sep 2020 11:48:49 -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:31 +0100 Message-Id: <1599763717-135002-5-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 04/10] sched: update the grinder credit update function 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" Credits are updated by fetching subport profile parameters from subport profile table. Signed-off-by: Savinay Dharmappa Signed-off-by: Jasvinder Singh --- lib/librte_sched/rte_sched.c | 49 ++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index ba5700a..8e66d08 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -124,6 +124,7 @@ struct rte_sched_grinder { uint32_t productive; uint32_t pindex; struct rte_sched_subport *subport; + struct rte_sched_subport_profile *subport_params; struct rte_sched_pipe *pipe; struct rte_sched_pipe_profile *pipe_params; @@ -2280,14 +2281,16 @@ grinder_credits_update(struct rte_sched_port *port, struct rte_sched_grinder *grinder = subport->grinder + pos; struct rte_sched_pipe *pipe = grinder->pipe; struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp_params = grinder->subport_params; uint64_t n_periods; uint32_t i; /* Subport TB */ - n_periods = (port->time - subport->tb_time) / subport->tb_period; - subport->tb_credits += n_periods * subport->tb_credits_per_period; - subport->tb_credits = RTE_MIN(subport->tb_credits, subport->tb_size); - subport->tb_time += n_periods * subport->tb_period; + n_periods = (port->time - subport->tb_time) / sp_params->sp_tb_period; + subport->tb_credits += n_periods * sp_params->sp_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; /* Pipe TB */ n_periods = (port->time - pipe->tb_time) / params->tb_period; @@ -2298,9 +2301,10 @@ grinder_credits_update(struct rte_sched_port *port, /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - subport->tc_credits[i] = subport->tc_credits_per_period[i]; + subport->tc_credits[i] = + sp_params->sp_tc_credits_per_period[i]; - subport->tc_time = port->time + subport->tc_period; + subport->tc_time = port->time + sp_params->sp_tc_period; } /* Pipe TCs */ @@ -2316,8 +2320,10 @@ grinder_credits_update(struct rte_sched_port *port, static inline uint64_t grinder_tc_ov_credits_update(struct rte_sched_port *port, - struct rte_sched_subport *subport) + struct rte_sched_subport *subport, uint32_t pos) { + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_subport_profile *sp_params = grinder->subport_params; uint64_t tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; uint64_t tc_consumption = 0, tc_ov_consumption_max; uint64_t tc_ov_wm = subport->tc_ov_wm; @@ -2327,17 +2333,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] = - subport->tc_credits_per_period[i] - subport->tc_credits[i]; + tc_ov_consumption[i] = sp_params->sp_tc_credits_per_period[i] + - subport->tc_credits[i]; tc_consumption += tc_ov_consumption[i]; } tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] = - subport->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - + sp_params->sp_tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - subport->tc_credits[RTE_SCHED_TRAFFIC_CLASS_BE]; tc_ov_consumption_max = - subport->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - + sp_params->sp_tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - tc_consumption; if (tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] > @@ -2363,14 +2369,16 @@ grinder_credits_update(struct rte_sched_port *port, struct rte_sched_grinder *grinder = subport->grinder + pos; struct rte_sched_pipe *pipe = grinder->pipe; struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp_params = grinder->subport_params; uint64_t n_periods; uint32_t i; /* Subport TB */ - n_periods = (port->time - subport->tb_time) / subport->tb_period; - subport->tb_credits += n_periods * subport->tb_credits_per_period; - subport->tb_credits = RTE_MIN(subport->tb_credits, subport->tb_size); - subport->tb_time += n_periods * subport->tb_period; + n_periods = (port->time - subport->tb_time) / sp_params->sp_tb_period; + subport->tb_credits += n_periods * sp_params->sp_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; /* Pipe TB */ n_periods = (port->time - pipe->tb_time) / params->tb_period; @@ -2380,12 +2388,14 @@ grinder_credits_update(struct rte_sched_port *port, /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { - subport->tc_ov_wm = grinder_tc_ov_credits_update(port, subport); + subport->tc_ov_wm = + grinder_tc_ov_credits_update(port, subport, pos); for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - subport->tc_credits[i] = subport->tc_credits_per_period[i]; + subport->tc_credits[i] = + sp_params->sp_tc_credits_per_period[i]; - subport->tc_time = port->time + subport->tc_period; + subport->tc_time = port->time + sp_params->sp_tc_period; subport->tc_ov_period_id++; } @@ -2908,6 +2918,9 @@ grinder_handle(struct rte_sched_port *port, struct rte_sched_pipe *pipe = grinder->pipe; grinder->pipe_params = subport->pipe_profiles + pipe->profile; + grinder->subport_params = port->subport_profiles + + subport->profile; + grinder_prefetch_tc_queue_arrays(subport, pos); grinder_credits_update(port, subport, pos); -- 2.7.4