diff --git a/src/qosmngr.c b/src/qosmngr.c index 86be094574f811a8c6582b048b44e807af8bebe1..45dfaa374d1c82836435db70de3c73c24cee7d15 100644 --- a/src/qosmngr.c +++ b/src/qosmngr.c @@ -203,6 +203,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void { int index; int ret = 0; + int is_read_and_reset; // Initialize global q_stat global struct if (init_flag) { @@ -214,7 +215,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void init_flag = 0; } - ret = qos_get_stats(ifname, qid, stats); + ret = qos_get_stats(ifname, qid, stats, &is_read_and_reset); if (ret != 0) { syslog(LOG_ERR, "blob_get_status: ret %d\n", ret); return ret; @@ -222,10 +223,19 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void index = get_interface_index(ifname); - 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; + /*BCM968 CHIP, stats read from driver is accunulated stats, while in other its read and reset */ + if (!is_read_and_reset) { + 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, "");