Skip to content
Snippets Groups Projects

qosmngr: accumulation of stats done based on driver does read and reset of stats or read.

Merged Amit Kumar requested to merge qos_stats_5437 into devel
All threads resolved!
+ 17
5
@@ -203,6 +203,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
@@ -203,6 +203,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
{
{
int index;
int index;
int ret = 0;
int ret = 0;
 
char is_read_and_reset;
// Initialize global q_stat global struct
// Initialize global q_stat global struct
if (init_flag) {
if (init_flag) {
@@ -214,7 +215,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
@@ -214,7 +215,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
init_flag = 0;
init_flag = 0;
}
}
ret = qos_get_stats(ifname, qid, stats);
ret = qos_get_stats(ifname, qid, stats, &is_read_and_reset);
if (ret != 0) {
if (ret != 0) {
syslog(LOG_ERR, "blob_get_status: ret %d\n", ret);
syslog(LOG_ERR, "blob_get_status: ret %d\n", ret);
return ret;
return ret;
@@ -222,10 +223,21 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
@@ -222,10 +223,21 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
index = get_interface_index(ifname);
index = get_interface_index(ifname);
q_stat[index][qid].tx_packets += stats->tx_packets;
/*BCM968 CHIP, stats read from driver is accunulated stats, while in other its read and reset */
q_stat[index][qid].tx_bytes += stats->tx_bytes;
if (!is_read_and_reset)
q_stat[index][qid].tx_dropped_packets += stats->tx_dropped_packets;
{
q_stat[index][qid].tx_dropped_bytes += stats->tx_dropped_bytes;
q_stat[index][qid].tx_packets = stats->tx_packets;
 
q_stat[index][qid].tx_bytes = stats->tx_bytes;
 
q_stat[index][qid].tx_dropped_packets = stats->tx_dropped_packets;
 
q_stat[index][qid].tx_dropped_bytes = stats->tx_dropped_bytes;
 
}
 
else
 
{
 
q_stat[index][qid].tx_packets += stats->tx_packets;
 
q_stat[index][qid].tx_bytes += stats->tx_bytes;
 
q_stat[index][qid].tx_dropped_packets += stats->tx_dropped_packets;
 
q_stat[index][qid].tx_dropped_bytes += stats->tx_dropped_bytes;
 
}
dd = blobmsg_open_table(b, "");
dd = blobmsg_open_table(b, "");
Loading