From 587fdeec253d7865d928ac941458a78b9d23c8c8 Mon Sep 17 00:00:00 2001 From: Jianmin Zhu Date: Tue, 11 Feb 2020 23:41:32 +0800 Subject: [PATCH] qcacmn: Fix get station stats cmd timeout Request is cleared before response for race condition between request thread wificond and response work thread. 1. wificond thread sent cp_stats_get request and waited for response. 2. worker thread got response from F/W, completed the request. 3. Wificond got the response, finished the request. 4. wificond triggered another cp_stats_get request, created new request, set pending request bit TYPE_STATION_STATS. 5. Kworker thread clear the pending request bit TYPE_STATION_STATS. 6. Cleared request TYPE_STATION_STATS couldn't be completed any more, wificond thread waited for 1.6s, timeout happened. Fix: Clear pending request bit TYPE_STATION_STATS before complete the request, make sure old pending request bit is cleared before new request of same type is set. Change-Id: I7b89571b1e95a6e17aec9d649bd3adfccf3eb02e CRs-Fixed: 2619370 --- umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c index e1fb014a4c6b..f5d1abd9e8e3 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020 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 @@ -882,9 +882,9 @@ static void tgt_mc_cp_stats_extract_station_stats( * reset type_map bit for station stats . */ if (tgt_mc_cp_stats_is_last_event(ev, TYPE_STATION_STATS)) { + ucfg_mc_cp_stats_reset_pending_req(psoc, TYPE_STATION_STATS); tgt_mc_cp_stats_prepare_n_send_raw_station_stats(psoc, &last_req); - ucfg_mc_cp_stats_reset_pending_req(psoc, TYPE_STATION_STATS); } }