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 0D116A045E for ; Tue, 28 May 2019 14:15:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E2F41B9FB; Tue, 28 May 2019 14:08:55 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3DF341B9D3 for ; Tue, 28 May 2019 14:08:44 +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:43 -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:41 -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:48 +0200 Message-Id: <20190528120553.2992-23-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 22/27] 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" From: Jasvinder Singh 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 | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 116e6a627..563161713 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -306,16 +306,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) { @@ -340,9 +330,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 @@ -1366,18 +1361,25 @@ 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)) || + (queue_id >= rte_sched_port_queues(port)) || (stats == NULL) || (qlen == NULL)) { return -1; } - q = port->queue + queue_id; - qe = port->queue_extra + queue_id; + + subport_id = (queue_id >> (port->n_max_subport_pipes_log2 + 4)) & + (port->n_subports_per_port - 1); + s = port->subports[subport_id]; + qindex = ((1 << (port->n_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)); @@ -1392,9 +1394,10 @@ rte_sched_queue_read_stats(struct rte_sched_port *port, #ifdef RTE_SCHED_DEBUG static inline int -rte_sched_port_queue_is_empty(struct rte_sched_port *port, uint32_t qindex) +rte_sched_port_queue_is_empty(struct rte_sched_subport *subport, + uint32_t qindex) { - struct rte_sched_queue *queue = port->queue + qindex; + struct rte_sched_queue *queue = subport->queue + qindex; return queue->qr == queue->qw; } @@ -1535,7 +1538,7 @@ rte_sched_port_set_queue_empty_timestamp(struct rte_sched_port *port __rte_unuse #ifdef RTE_SCHED_DEBUG static inline void -debug_check_queue_slab(struct rte_sched_port *port, uint32_t bmp_pos, +debug_check_queue_slab(struct rte_sched_subport *subport, uint32_t bmp_pos, uint64_t bmp_slab) { uint64_t mask; @@ -1547,7 +1550,7 @@ debug_check_queue_slab(struct rte_sched_port *port, uint32_t bmp_pos, panic = 0; for (i = 0, mask = 1; i < 64; i++, mask <<= 1) { if (mask & bmp_slab) { - if (rte_sched_port_queue_is_empty(port, bmp_pos + i)) { + if (rte_sched_port_queue_is_empty(subport, bmp_pos + i)) { printf("Queue %u (slab offset %u) is empty\n", bmp_pos + i, i); panic = 1; } -- 2.20.1