From: Stephen Hemminger <stephen@networkplumber.org>
To: cristian.dumitrescu@intel.com
Cc: dev@dpdk.org
Subject: [PATCH 1/3] rte_sched: keep track of RED drops
Date: Sun, 29 Nov 2015 10:46:47 -0800 [thread overview]
Message-ID: <1448822809-8350-2-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1448822809-8350-1-git-send-email-stephen@networkplumber.org>
Add new statistic to keep track of drops due to RED.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_sched/rte_sched.c | 20 ++++++++++++++++----
lib/librte_sched/rte_sched.h | 8 ++++++++
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index d47cfc2..16acd6b 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -1071,7 +1071,9 @@ rte_sched_port_update_subport_stats(struct rte_sched_port *port, uint32_t qindex
}
static inline void
-rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
+rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port,
+ uint32_t qindex,
+ struct rte_mbuf *pkt, uint32_t red)
{
struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port));
uint32_t tc_index = (qindex >> 2) & 0x3;
@@ -1079,6 +1081,9 @@ rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, uint32_
s->stats.n_pkts_tc_dropped[tc_index] += 1;
s->stats.n_bytes_tc_dropped[tc_index] += pkt_len;
+#ifdef RTE_SCHED_RED
+ s->stats.n_pkts_red_dropped[tc_index] += red;
+#endif
}
static inline void
@@ -1092,13 +1097,18 @@ rte_sched_port_update_queue_stats(struct rte_sched_port *port, uint32_t qindex,
}
static inline void
-rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt)
+rte_sched_port_update_queue_stats_on_drop(struct rte_sched_port *port,
+ uint32_t qindex,
+ struct rte_mbuf *pkt, uint32_t red)
{
struct rte_sched_queue_extra *qe = port->queue_extra + qindex;
uint32_t pkt_len = pkt->pkt_len;
qe->stats.n_pkts_dropped += 1;
qe->stats.n_bytes_dropped += pkt_len;
+#ifdef RTE_SCHED_RED
+ qe->stats.n_pkts_red_dropped += red;
+#endif
}
#endif /* RTE_SCHED_COLLECT_STATS */
@@ -1229,8 +1239,10 @@ rte_sched_port_enqueue_qwa(struct rte_sched_port *port, uint32_t qindex,
(qlen >= qsize))) {
rte_pktmbuf_free(pkt);
#ifdef RTE_SCHED_COLLECT_STATS
- rte_sched_port_update_subport_stats_on_drop(port, qindex, pkt);
- rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt);
+ rte_sched_port_update_subport_stats_on_drop(port, qindex, pkt,
+ qlen < qsize);
+ rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt,
+ qlen < qsize);
#endif
return 0;
}
diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h
index c0f4ad3..e9c2817 100644
--- a/lib/librte_sched/rte_sched.h
+++ b/lib/librte_sched/rte_sched.h
@@ -162,6 +162,11 @@ struct rte_sched_subport_stats {
/**< Number of bytes successfully written for each traffic class */
uint32_t n_bytes_tc_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
/**< Number of bytes dropped for each traffic class */
+
+#ifdef RTE_SCHED_RED
+ uint32_t n_pkts_red_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
+ /**< Number of packets dropped by red */
+#endif
};
/*
@@ -196,6 +201,9 @@ struct rte_sched_queue_stats {
/* Packets */
uint32_t n_pkts; /**< Packets successfully written */
uint32_t n_pkts_dropped; /**< Packets dropped */
+#ifdef RTE_SCHED_RED
+ uint32_t n_pkts_red_dropped; /**< Packets dropped by RED */
+#endif
/* Bytes */
uint32_t n_bytes; /**< Bytes successfully written */
--
2.1.4
next prev parent reply other threads:[~2015-11-29 18:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-29 18:46 [PATCH 0/3] sched: patches for 2.2 Stephen Hemminger
2015-11-29 18:46 ` Stephen Hemminger [this message]
2015-11-29 22:12 ` [PATCH 1/3] rte_sched: keep track of RED drops Thomas Monjalon
2015-11-30 17:47 ` [PATCH] rte_sched: drop deprecation notice for RED statistics Stephen Hemminger
2015-11-29 18:46 ` [PATCH 2/3] rte_sched: introduce reciprocal divide Stephen Hemminger
2015-12-02 16:45 ` Dumitrescu, Cristian
2015-12-02 16:57 ` Hannes Frederic Sowa
2015-12-02 22:05 ` Stephen Hemminger
2015-11-29 18:46 ` [PATCH 3/3] rte_sched: eliminate floating point in calculating byte clock Stephen Hemminger
2015-12-02 16:48 ` Dumitrescu, Cristian
2015-12-02 22:08 ` Stephen Hemminger
2016-03-04 15:00 ` [PATCH 0/3] sched: patches for 2.2 Thomas Monjalon
2016-03-08 7:49 ` Dumitrescu, Cristian
2016-03-08 16:33 ` Stephen Hemminger
2016-03-08 19:53 ` Dumitrescu, Cristian
2016-03-08 20:40 ` Stephen Hemminger
2016-03-10 18:41 ` Dumitrescu, Cristian
2016-03-10 18:44 ` Stephen Hemminger
2016-03-10 18:51 ` Dumitrescu, Cristian
2016-03-13 22:25 ` Thomas Monjalon
2016-03-13 22:47 ` Dumitrescu, Cristian
2016-03-13 23:09 ` Thomas Monjalon
2016-03-14 14:40 ` Dumitrescu, Cristian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448822809-8350-2-git-send-email-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.