From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by dpdk.org (Postfix) with ESMTP id 582D8B406 for ; Thu, 5 Feb 2015 07:14:17 +0100 (CET) Received: by mail-pa0-f54.google.com with SMTP id eu11so7743675pac.13 for ; Wed, 04 Feb 2015 22:14:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fh3QQsI/c9Dih1CYZtxmZZ0QxAb8XW2O6fBMAZ9U6zQ=; b=KVgO1G1f27VBJZTMZRXcbS1o7EC6dHxn+QKRKzzlDT97Xv9/v1WlJPiD39B+kIzcv3 Grp64xqfAMo7C4xPkheArKJ0V7JQUABPR30XYpPETxIjlrbEftxmDrm9E7dOiTEDbeOI QBX7X2PUvfhPQQaO6+cCzYOPvlgOeNQtYpx7ZsUP3kOAA5EjgPeKA85LA9DfHkTh6GWG 8az+/63AxmEtva7OAnr/zgnZdyPTNBglxCpR1SJLZnfV8GQf5dWNO+tHtos2gM/j92zc tO5viDF8ZY+2E2cOriX4bQJP8XL/n5JxGaHlnzk4seTxaDUUQFdF9V5RLFSoPYTjYOSk aqDQ== X-Gm-Message-State: ALoCoQlvKRKtb6EZyklICqeviImGaNSsCct5Dn0kMyS8OgOl5taUNo07c0TdbwKzKiiK3dKmhgBJ X-Received: by 10.66.118.109 with SMTP id kl13mr3153290pab.19.1423116856560; Wed, 04 Feb 2015 22:14:16 -0800 (PST) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id ib3sm3848178pbc.41.2015.02.04.22.14.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 22:14:15 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Wed, 4 Feb 2015 22:13:58 -0800 Message-Id: <1423116841-19799-4-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH v2 4/7] rte_sched: don't clear statistics when read X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2015 06:14:17 -0000 From: Stephen Hemminger Make rte_sched statistics API work like the ethernet statistics API. Don't auto-clear statistics. Signed-off-by: Stephen Hemminger --- lib/librte_sched/rte_sched.c | 30 ++++++++++++++++++++++++++++++ lib/librte_sched/rte_sched.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 8cb8bf1..d891e50 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -935,6 +935,21 @@ rte_sched_subport_read_stats(struct rte_sched_port *port, } int +rte_sched_subport_stats_reset(struct rte_sched_port *port, + uint32_t subport_id) +{ + struct rte_sched_subport *s; + + /* Check user parameters */ + if (port == NULL || subport_id >= port->n_subports_per_port) + return -1; + + s = port->subport + subport_id; + memset(&s->stats, 0, sizeof(struct rte_sched_subport_stats)); + return 0; +} + +int rte_sched_queue_read_stats(struct rte_sched_port *port, uint32_t queue_id, struct rte_sched_queue_stats *stats, @@ -963,6 +978,21 @@ rte_sched_queue_read_stats(struct rte_sched_port *port, return 0; } +int +rte_sched_queue_stats_reset(struct rte_sched_port *port, + uint32_t queue_id) +{ + struct rte_sched_queue_extra *qe; + + /* Check user parameters */ + if (port == NULL || queue_id >= rte_sched_port_queues_per_port(port)) + return -1; + + qe = port->queue_extra + queue_id; + memset(&qe->stats, 0, sizeof(struct rte_sched_queue_stats)); + return 0; +} + static inline uint32_t rte_sched_port_qindex(struct rte_sched_port *port, uint32_t subport, uint32_t pipe, uint32_t traffic_class, uint32_t queue) { diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h index e9bf18a..3d007e4 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -317,6 +317,21 @@ rte_sched_subport_read_stats(struct rte_sched_port *port, struct rte_sched_subport_stats *stats, uint32_t *tc_ov); + +/** + * Hierarchical scheduler subport statistics reset + * + * @param port + * Handle to port scheduler instance + * @param subport_id + * Subport ID + * @return + * 0 upon success, error code otherwise + */ +int +rte_sched_subport_stats_reset(struct rte_sched_port *port, + uint32_t subport_id); + /** * Hierarchical scheduler queue statistics read * @@ -338,6 +353,20 @@ rte_sched_queue_read_stats(struct rte_sched_port *port, struct rte_sched_queue_stats *stats, uint16_t *qlen); +/** + * Hierarchical scheduler queue statistics reset + * + * @param port + * Handle to port scheduler instance + * @param queue_id + * Queue ID within port scheduler + * @return + * 0 upon success, error code otherwise + */ +int +rte_sched_queue_stats_reset(struct rte_sched_port *port, + uint32_t queue_id); + /* * Run-time * -- 2.1.4