From f0fa2f5bebc40da0c3613fe502d4eca8051e2b33 Mon Sep 17 00:00:00 2001 From: Amir Patel Date: Fri, 31 May 2019 12:52:10 +0530 Subject: [PATCH] qcacmn: Compute client inactive time from last one second tx/rx activity If client is having non-zero tx/rx packets in last one second, reset inactive time to zero, else increment inactive time. Change-Id: Ie25fb43adec252e93ebc1bb1a7aa0fa207e7af1e --- dp/cmn_dp_api/dp_cal_client_api.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dp/cmn_dp_api/dp_cal_client_api.c b/dp/cmn_dp_api/dp_cal_client_api.c index 37217434ac6f..c6360d689e8d 100644 --- a/dp/cmn_dp_api/dp_cal_client_api.c +++ b/dp/cmn_dp_api/dp_cal_client_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -147,6 +147,14 @@ void dp_cal_client_update_peer_stats(struct cdp_peer_stats *peer_stats) peer_stats->tx.tx_data_ucast_rate = temp_tx_ucast_pkts - peer_stats->tx.tx_data_ucast_last; + /* Check tx and rx packets in last one second, and increment + * inactive time for peer + */ + if (peer_stats->tx.tx_data_rate || peer_stats->rx.rx_data_rate) + peer_stats->tx.inactive_time = 0; + else + peer_stats->tx.inactive_time++; + peer_stats->rx.rx_bytes_success_last = temp_rx_bytes; peer_stats->rx.rx_data_success_last = temp_rx_data; peer_stats->tx.tx_bytes_success_last = temp_tx_bytes;