From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by dpdk.org (Postfix) with ESMTP id 3A5CDCE7 for ; Mon, 8 Dec 2014 18:51:45 +0100 (CET) Received: by mail-pa0-f46.google.com with SMTP id lj1so5596164pab.5 for ; Mon, 08 Dec 2014 09:51:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:mime-version:content-type:content-disposition; bh=PLPfg66oZYp7pnwnlRS3Fu012CrLCUcykX5P1mw/JGo=; b=inPHu6zxo1httzifdNfK/8Gmy3lhuWBO26I3XSunnf4ML7+InRNPkadZlt+9LkBx8m 5MosSN7nge7Cp7KLzCNLmV0PGOXm098VK+9vsIxI15lJeW9tcKV46pKvlokaJqp6RqaM tVgQMbeiaDVa4Ztj/7kFkiGUR3VXJ+YjZk49HN2nLI4M3ceCECVlGKy3rnoHIkh2KuIP j1U3L8RwKHhbGWVP2u3xtnFWNP94JFjTKspOHDNg/RM4Pl9IyO0Hm9huyAuiSME2u9y1 PyZP+KDnLBv0DM3PJXOlFuKU9SpvIz3zPZXhFAO/DR+BgleTq7sSDYAKqI0++4uG4S5R wC8g== X-Gm-Message-State: ALoCoQl2UMF0SsZvRsrNvV3le/lbdNF0NVrQetjjo7/43c7+xoWvZfLqYYmIF8+AFNxlh2mfY6pp X-Received: by 10.66.119.175 with SMTP id kv15mr57015843pab.30.1418061104622; Mon, 08 Dec 2014 09:51:44 -0800 (PST) Received: from localhost (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id gh6sm16046316pbd.28.2014.12.08.09.51.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Dec 2014 09:51:43 -0800 (PST) X-Mailman-Approved-At: Mon, 08 Dec 2014 20:36:25 +0100 Subject: [dpdk-dev] (no subject) 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: , Date: Mon, 08 Dec 2014 17:51:45 -0000 X-List-Received-Date: Mon, 08 Dec 2014 17:51:45 -0000 Content-Type: text/plain; charset="UTF-8" Message-ID: <20141208175145.dXoQPQxx-ZLsYryPTGwb5GLkX67iUSBAZ0qe5boJj68@z> >>From stephen@networkplumber.org Mon Dec 8 09:46:51 2014 Message-Id: <20141208174651.282719331@networkplumber.org> User-Agent: quilt/0.63-1 Date: Mon, 08 Dec 2014 09:45:59 -0800 From: Stephen Hemminger To: Thomas Monjalon Cc: dev@dpdk.org, Stephen Hemminger Subject: [PATCH 5/6] rte_sched: dont clear statistics when read References: <20141208174554.889069531@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=qos-no-clear.patch Make rte_sched statistics API work like the ethernet statistics API. Don't auto-clear statistics when read. Signed-off-by: Stephen Hemminger --- a/lib/librte_sched/rte_sched.c 2014-12-08 09:29:49.014821607 -0800 +++ b/lib/librte_sched/rte_sched.c 2014-12-08 09:35:45.568568267 -0800 @@ -924,9 +924,8 @@ rte_sched_subport_read_stats(struct rte_ } s = port->subport + subport_id; - /* Copy subport stats and clear */ - memcpy(stats, &s->stats, sizeof(struct rte_sched_subport_stats)); - memset(&s->stats, 0, sizeof(struct rte_sched_subport_stats)); + /* Copy subport stats */ + *stats = s->stats; /* Subport TC ovesubscription status */ *tc_ov = s->tc_ov; @@ -935,6 +934,21 @@ rte_sched_subport_read_stats(struct rte_ } 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, @@ -953,9 +967,8 @@ rte_sched_queue_read_stats(struct rte_sc q = port->queue + queue_id; qe = port->queue_extra + queue_id; - /* Copy queue stats and clear */ - memcpy(stats, &qe->stats, sizeof(struct rte_sched_queue_stats)); - memset(&qe->stats, 0, sizeof(struct rte_sched_queue_stats)); + /* Copy queue stats */ + *stats = qe->stats; /* Queue length */ *qlen = q->qw - q->qr; @@ -963,6 +976,21 @@ rte_sched_queue_read_stats(struct rte_sc 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) { --- a/lib/librte_sched/rte_sched.h 2014-12-08 09:29:49.014821607 -0800 +++ b/lib/librte_sched/rte_sched.h 2014-12-08 09:30:29.426977482 -0800 @@ -312,6 +312,21 @@ rte_sched_subport_read_stats(struct rte_ 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 * @@ -333,6 +348,20 @@ rte_sched_queue_read_stats(struct rte_sc 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 *