From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by dpdk.org (Postfix) with ESMTP id 0BDA32E8F for ; Sun, 1 Feb 2015 11:04:10 +0100 (CET) Received: by mail-la0-f44.google.com with SMTP id s18so32918572lam.3 for ; Sun, 01 Feb 2015 02:04:09 -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:in-reply-to :references; bh=jIjcRJ9KXPv9v4mvBP4ULXlbNqx8GU0s9AuaHOdeYlA=; b=fhYXTfevnAPuzb5HnEW40ahfEGRORtGlEdazm93yURsK7pMvph5kZkxtd30vWGP7Cw a4Mw8cni/nA0XZ5icy6IGZu+b2RuqX4UPItW+CdVYUABmvMKX9HAuI9QD8pEHs+Xqq4P PnUsNPkFpfhNP3u7IjaZUiOk2cLWWFD3c3MITtH7JMOT1e5v+FWnYcGIuB20JFamN3id w1PqFA13J+EcLrVnWKFWB/+RKqXnEdoi3eilmPfqE8qfiUkL2H3ui7/qw45uqz3aZqMa 9qnl9Ule2gyY5O1O6f6roRzOoZnV0IsZaZnDxnez8ssHYjXNqc1ip7Of2yCA7mWs9J6E Myfw== X-Gm-Message-State: ALoCoQl0l21KjrC7WCzdHdLt0tZWqHl+/GChaZCu0HgM0g8m15rc0H5n/bt9flEk1MfQuUEYKlPs X-Received: by 10.112.217.68 with SMTP id ow4mr14201597lbc.97.1422785049888; Sun, 01 Feb 2015 02:04:09 -0800 (PST) Received: from uryu.fosdem.net. ([2001:67c:1810:f0ff:c685:8ff:feca:841f]) by mx.google.com with ESMTPSA id c4sm1608100lbp.32.2015.02.01.02.04.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 01 Feb 2015 02:04:08 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Sun, 1 Feb 2015 10:03:48 +0000 Message-Id: <1422785031-11494-4-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1422785031-11494-1-git-send-email-stephen@networkplumber.org> References: <1422785031-11494-1-git-send-email-stephen@networkplumber.org> Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH 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: Sun, 01 Feb 2015 10:04:10 -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 d5a1d5b..64b4dd6 100644 --- a/lib/librte_sched/rte_sched.h +++ b/lib/librte_sched/rte_sched.h @@ -316,6 +316,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 * @@ -337,6 +352,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