From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A51C04AB6 for ; Tue, 28 May 2019 12:10:00 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id A62102081C for ; Tue, 28 May 2019 12:09:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A62102081C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EACDC1B9A7; Tue, 28 May 2019 14:08:29 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id C56AD1B952 for ; Tue, 28 May 2019 14:08:19 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 May 2019 05:08:19 -0700 X-ExtLoop1: 1 Received: from lkrakowx-mobl.ger.corp.intel.com ([10.103.104.99]) by fmsmga001.fm.intel.com with ESMTP; 28 May 2019 05:08:17 -0700 From: Lukasz Krakowiak To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org, Jasvinder Singh , Abraham Tovar , Lukasz Krakowiak Date: Tue, 28 May 2019 14:05:34 +0200 Message-Id: <20190528120553.2992-9-lukaszx.krakowiak@intel.com> X-Mailer: git-send-email 2.19.2.windows.1 In-Reply-To: <20190528120553.2992-1-lukaszx.krakowiak@intel.com> References: <20190528120553.2992-1-lukaszx.krakowiak@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 08/27] sched: update pipe config api 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" From: Jasvinder Singh Update the pipe configuration api implementation of the scheduler 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 | 58 ++++++++++++++++++++++-------------- lib/librte_sched/rte_sched.h | 2 +- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index c1079cdaa..4b1959bb4 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -1206,38 +1206,43 @@ rte_sched_pipe_config(struct rte_sched_port *port, if (port == NULL || subport_id >= port->n_subports_per_port || - pipe_id >= port->n_pipes_per_subport || - (!deactivate && profile >= port->n_pipe_profiles)) + pipe_id >= port->subports[subport_id]->n_subport_pipes || + (!deactivate && profile >= + port->subports[subport_id]->n_pipe_profiles)) return -1; /* Check that subport configuration is valid */ - s = port->subport + subport_id; + s = port->subports[subport_id]; if (s->tb_period == 0) return -2; - p = port->pipe + (subport_id * port->n_pipes_per_subport + pipe_id); + p = s->pipe + pipe_id; /* Handle the case when pipe already has a valid configuration */ if (p->tb_time) { - params = port->pipe_profiles + p->profile; + params = s->pipe_profiles + p->profile; #ifdef RTE_SCHED_SUBPORT_TC_OV - double subport_tc3_rate = (double) s->tc_credits_per_period[3] + double subport_tc_be_rate = + (double) s->tc_credits_per_period[ + RTE_SCHED_TRAFFIC_CLASS_BE] / (double) s->tc_period; - double pipe_tc3_rate = (double) params->tc_credits_per_period[3] + double pipe_tc_be_rate = + (double) params->tc_credits_per_period[ + RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc3_ov = s->tc_ov; + uint32_t tc_be_ov = s->tc_ov; /* Unplug pipe from its subport */ s->tc_ov_n -= params->tc_ov_weight; - s->tc_ov_rate -= pipe_tc3_rate; - s->tc_ov = s->tc_ov_rate > subport_tc3_rate; + s->tc_ov_rate -= pipe_tc_be_rate; + s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; - if (s->tc_ov != tc3_ov) { + if (s->tc_ov != tc_be_ov) { RTE_LOG(DEBUG, SCHED, - "Subport %u TC3 oversubscription is OFF (%.4lf >= %.4lf)\n", - subport_id, subport_tc3_rate, s->tc_ov_rate); + "Subport %u Best effort TC oversubscription is OFF (%.4lf >= %.4lf)\n", + subport_id, subport_tc_be_rate, s->tc_ov_rate); } #endif @@ -1250,34 +1255,41 @@ rte_sched_pipe_config(struct rte_sched_port *port, /* Apply the new pipe configuration */ p->profile = profile; - params = port->pipe_profiles + p->profile; + params = s->pipe_profiles + p->profile; /* Token Bucket (TB) */ p->tb_time = port->time; p->tb_credits = params->tb_size / 2; /* Traffic Classes (TCs) */ + p->n_sp_queues = params->n_sp_queues; + p->n_be_queues = params->n_be_queues; p->tc_time = port->time + params->tc_period; for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) - p->tc_credits[i] = params->tc_credits_per_period[i]; + if (s->qsize[i]) + p->tc_credits[i] = params->tc_credits_per_period[i]; #ifdef RTE_SCHED_SUBPORT_TC_OV { /* Subport TC3 oversubscription */ - double subport_tc3_rate = (double) s->tc_credits_per_period[3] + double subport_tc_be_rate = + (double) s->tc_credits_per_period[ + RTE_SCHED_TRAFFIC_CLASS_BE] / (double) s->tc_period; - double pipe_tc3_rate = (double) params->tc_credits_per_period[3] + double pipe_tc_be_rate = + (double) params->tc_credits_per_period[ + RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc3_ov = s->tc_ov; + uint32_t tc_be_ov = s->tc_ov; s->tc_ov_n += params->tc_ov_weight; - s->tc_ov_rate += pipe_tc3_rate; - s->tc_ov = s->tc_ov_rate > subport_tc3_rate; + s->tc_ov_rate += pipe_tc_be_rate; + s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; - if (s->tc_ov != tc3_ov) { + if (s->tc_ov != tc_be_ov) { RTE_LOG(DEBUG, SCHED, - "Subport %u TC3 oversubscription is ON (%.4lf < %.4lf)\n", - subport_id, subport_tc3_rate, s->tc_ov_rate); + "Subport %u Best effort TC oversubscription is ON (%.4lf < %.4lf)\n", + subport_id, subport_tc_be_rate, s->tc_ov_rate); } p->tc_ov_period_id = s->tc_ov_period_id; p->tc_ov_credits = s->tc_ov_wm; diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index 51f801098..da5790fc4 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -319,7 +319,7 @@ rte_sched_subport_config(struct rte_sched_port *port, * @param pipe_id * Pipe ID within subport * @param pipe_profile - * ID of port-level pre-configured pipe profile + * ID of subport-level pre-configured pipe profile * @return * 0 upon success, error code otherwise */ -- 2.20.1