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 91651A046B for ; Tue, 25 Jun 2019 17:37:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78D1F1BBEE; Tue, 25 Jun 2019 17:32:55 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id C09961BADD for ; Tue, 25 Jun 2019 17:32:31 +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:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,416,1557212400"; d="scan'208";a="166711651" 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:30 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Abraham Tovar , Lukasz Krakowiak Date: Tue, 25 Jun 2019 16:32:11 +0100 Message-Id: <20190625153217.24301-23-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 22/28] sched: update sched queue stats 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" Update queue stats read 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 | 59 ++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 63073aad0..cc1dcf7ab 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -284,16 +284,6 @@ enum rte_sched_subport_array { e_RTE_SCHED_SUBPORT_ARRAY_TOTAL, }; -#ifdef RTE_SCHED_COLLECT_STATS - -static inline uint32_t -rte_sched_port_queues_per_subport(struct rte_sched_port *port) -{ - return RTE_SCHED_QUEUES_PER_PIPE * port->n_pipes_per_subport; -} - -#endif - static inline uint32_t rte_sched_subport_queues(struct rte_sched_subport *subport) { @@ -318,9 +308,14 @@ rte_sched_subport_qsize(struct rte_sched_subport *subport, uint32_t qindex) } static inline uint32_t -rte_sched_port_queues_per_port(struct rte_sched_port *port) +rte_sched_port_queues(struct rte_sched_port *port) { - return RTE_SCHED_QUEUES_PER_PIPE * port->n_pipes_per_subport * port->n_subports_per_port; + uint32_t n_queues = 0, i; + + for (i = 0; i < port->n_subports_per_port; i++) + n_queues += rte_sched_subport_queues(port->subports[i]); + + return n_queues; } static int @@ -1470,18 +1465,42 @@ rte_sched_queue_read_stats(struct rte_sched_port *port, struct rte_sched_queue_stats *stats, uint16_t *qlen) { + uint32_t subport_id, qindex; + struct rte_sched_subport *s; struct rte_sched_queue *q; struct rte_sched_queue_extra *qe; /* Check user parameters */ - if ((port == NULL) || - (queue_id >= rte_sched_port_queues_per_port(port)) || - (stats == NULL) || - (qlen == NULL)) { - return -1; - } - q = port->queue + queue_id; - qe = port->queue_extra + queue_id; + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port \n", __func__); + return -EINVAL; + } + + if (queue_id >= rte_sched_port_queues(port)) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for queue id \n", __func__); + return -EINVAL; + } + + if (stats == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter stats \n", __func__); + return -EINVAL; + } + + if (qlen == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter qlen \n", __func__); + return -EINVAL; + } + + subport_id = (queue_id >> (port->max_subport_pipes_log2 + 4)) & + (port->n_subports_per_port - 1); + s = port->subports[subport_id]; + qindex = ((1 << (port->max_subport_pipes_log2 + 4)) - 1) & queue_id; + q = s->queue + qindex; + qe = s->queue_extra + qindex; /* Copy queue stats and clear */ memcpy(stats, &qe->stats, sizeof(struct rte_sched_queue_stats)); -- 2.21.0