From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7A855A046B for ; Tue, 25 Jun 2019 17:35:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 358B01BBB4; Tue, 25 Jun 2019 17:32:46 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 7A91B1BB09 for ; Tue, 25 Jun 2019 17:32:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2019 08:32:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,416,1557212400"; d="scan'208";a="166711587" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.223.4]) by orsmga006.jf.intel.com with ESMTP; 25 Jun 2019 08:32:22 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Abraham Tovar , Lukasz Krakowiak Date: Tue, 25 Jun 2019 16:32:06 +0100 Message-Id: <20190625153217.24301-18-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625153217.24301-1-jasvinder.singh@intel.com> References: <20190528120553.2992-2-lukaszx.krakowiak@intel.com> <20190625153217.24301-1-jasvinder.singh@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 17/28] sched: modify credits 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" Modify credits update function of scheduler grinder to allow configuration flexiblity for pipe traffic classes and queues, and subport level configuration of the pipe parameters. Signed-off-by: Jasvinder Singh Signed-off-by: Abraham Tovar Signed-off-by: Lukasz Krakowiak --- lib/librte_sched/rte_sched.c | 75 +++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 90c41e549..8b440637d 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -1958,13 +1958,14 @@ rte_sched_port_enqueue(struct rte_sched_port *port, struct rte_mbuf **pkts, #ifndef RTE_SCHED_SUBPORT_TC_OV static inline void -grinder_credits_update(struct rte_sched_port *port, uint32_t pos) +grinder_credits_update(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) { - struct rte_sched_grinder *grinder = port->grinder + pos; - struct rte_sched_subport *subport = grinder->subport; + struct rte_sched_grinder *grinder = subport->grinder + pos; struct rte_sched_pipe *pipe = grinder->pipe; struct rte_sched_pipe_profile *params = grinder->pipe_params; uint64_t n_periods; + uint32_t i; /* Subport TB */ n_periods = (port->time - subport->tb_time) / subport->tb_period; @@ -1980,19 +1981,17 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t pos) /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { - subport->tc_credits[0] = subport->tc_credits_per_period[0]; - subport->tc_credits[1] = subport->tc_credits_per_period[1]; - subport->tc_credits[2] = subport->tc_credits_per_period[2]; - subport->tc_credits[3] = subport->tc_credits_per_period[3]; + for (i = 0; i <= RTE_SCHED_TRAFFIC_CLASS_BE; i++) + subport->tc_credits[i] = subport->tc_credits_per_period[i]; + subport->tc_time = port->time + subport->tc_period; } /* Pipe TCs */ if (unlikely(port->time >= pipe->tc_time)) { - pipe->tc_credits[0] = params->tc_credits_per_period[0]; - pipe->tc_credits[1] = params->tc_credits_per_period[1]; - pipe->tc_credits[2] = params->tc_credits_per_period[2]; - pipe->tc_credits[3] = params->tc_credits_per_period[3]; + for (i = 0; i <= RTE_SCHED_TRAFFIC_CLASS_BE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; } } @@ -2000,26 +1999,34 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t pos) #else static inline uint32_t -grinder_tc_ov_credits_update(struct rte_sched_port *port, uint32_t pos) +grinder_tc_ov_credits_update(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) { - struct rte_sched_grinder *grinder = port->grinder + pos; - struct rte_sched_subport *subport = grinder->subport; + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; uint32_t tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; - uint32_t tc_ov_consumption_max; + uint32_t tc_consumption = 0, tc_ov_consumption_max; uint32_t tc_ov_wm = subport->tc_ov_wm; + uint32_t i; if (subport->tc_ov == 0) return subport->tc_ov_wm_max; - tc_ov_consumption[0] = subport->tc_credits_per_period[0] - subport->tc_credits[0]; - tc_ov_consumption[1] = subport->tc_credits_per_period[1] - subport->tc_credits[1]; - tc_ov_consumption[2] = subport->tc_credits_per_period[2] - subport->tc_credits[2]; - tc_ov_consumption[3] = subport->tc_credits_per_period[3] - subport->tc_credits[3]; + 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_consumption += tc_ov_consumption[i]; + } - tc_ov_consumption_max = subport->tc_credits_per_period[3] - - (tc_ov_consumption[0] + tc_ov_consumption[1] + tc_ov_consumption[2]); + tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] = + subport->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - + subport->tc_credits[RTE_SCHED_TRAFFIC_CLASS_BE]; - if (tc_ov_consumption[3] > (tc_ov_consumption_max - port->mtu)) { + tc_ov_consumption_max = + subport->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] - tc_consumption; + + if (tc_ov_consumption[RTE_SCHED_TRAFFIC_CLASS_BE] > + (tc_ov_consumption_max - port->mtu)) { tc_ov_wm -= tc_ov_wm >> 7; if (tc_ov_wm < subport->tc_ov_wm_min) tc_ov_wm = subport->tc_ov_wm_min; @@ -2035,13 +2042,14 @@ grinder_tc_ov_credits_update(struct rte_sched_port *port, uint32_t pos) } static inline void -grinder_credits_update(struct rte_sched_port *port, uint32_t pos) +grinder_credits_update(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) { - struct rte_sched_grinder *grinder = port->grinder + pos; - struct rte_sched_subport *subport = grinder->subport; + struct rte_sched_grinder *grinder = subport->grinder + pos; struct rte_sched_pipe *pipe = grinder->pipe; struct rte_sched_pipe_profile *params = grinder->pipe_params; uint64_t n_periods; + uint32_t i; /* Subport TB */ n_periods = (port->time - subport->tb_time) / subport->tb_period; @@ -2057,12 +2065,10 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t pos) /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { - subport->tc_ov_wm = grinder_tc_ov_credits_update(port, pos); + subport->tc_ov_wm = grinder_tc_ov_credits_update(port, subport, pos); - subport->tc_credits[0] = subport->tc_credits_per_period[0]; - subport->tc_credits[1] = subport->tc_credits_per_period[1]; - subport->tc_credits[2] = subport->tc_credits_per_period[2]; - subport->tc_credits[3] = subport->tc_credits_per_period[3]; + for (i = 0; i <= RTE_SCHED_TRAFFIC_CLASS_BE; i++) + subport->tc_credits[i] = subport->tc_credits_per_period[i]; subport->tc_time = port->time + subport->tc_period; subport->tc_ov_period_id++; @@ -2070,10 +2076,9 @@ grinder_credits_update(struct rte_sched_port *port, uint32_t pos) /* Pipe TCs */ if (unlikely(port->time >= pipe->tc_time)) { - pipe->tc_credits[0] = params->tc_credits_per_period[0]; - pipe->tc_credits[1] = params->tc_credits_per_period[1]; - pipe->tc_credits[2] = params->tc_credits_per_period[2]; - pipe->tc_credits[3] = params->tc_credits_per_period[3]; + for (i = 0; i <= RTE_SCHED_TRAFFIC_CLASS_BE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; } @@ -2599,7 +2604,7 @@ grinder_handle(struct rte_sched_port *port, uint32_t pos) grinder->pipe_params = port->pipe_profiles + pipe->profile; grinder_prefetch_tc_queue_arrays(port, pos); - grinder_credits_update(port, pos); + grinder_credits_update(port, port->subport, pos); grinder->state = e_GRINDER_PREFETCH_MBUF; return 0; -- 2.21.0