qcacmn: Fix last_per overflow issue

Check if ucast pkts count is more than success pkts count,
compute last packet error rate only if ucast is less than success
pkts.

Change-Id: I0aa4d41d09b1691e4d554beab2f2ed7a7f2ceb1e
CRs-Fixed: 2343479
This commit is contained in:
Amir Patel
2018-11-27 20:11:58 +05:30
committed by nshrivas
parent c1ec49e685
commit d577d09497

View File

@@ -153,10 +153,17 @@ void dp_cal_client_update_peer_stats(struct cdp_peer_stats *peer_stats)
peer_stats->tx.tx_data_success_last = temp_tx_data; peer_stats->tx.tx_data_success_last = temp_tx_data;
peer_stats->tx.tx_data_ucast_last = temp_tx_ucast_pkts; peer_stats->tx.tx_data_ucast_last = temp_tx_ucast_pkts;
if (peer_stats->tx.tx_data_ucast_rate) if (peer_stats->tx.tx_data_ucast_rate) {
peer_stats->tx.last_per = ((peer_stats->tx.tx_data_ucast_last - if (peer_stats->tx.tx_data_ucast_rate >
peer_stats->tx.tx_data_success_last) * 100) / peer_stats->tx.tx_data_rate)
peer_stats->tx.tx_data_ucast_last; peer_stats->tx.last_per =
((peer_stats->tx.tx_data_ucast_rate -
peer_stats->tx.tx_data_rate) * 100) /
peer_stats->tx.tx_data_ucast_rate;
else
peer_stats->tx.last_per = 0;
}
} }
qdf_export_symbol(dp_cal_client_update_peer_stats); qdf_export_symbol(dp_cal_client_update_peer_stats);