From 47b3a1d16637c79da7f238ce54b06dd9f39ea9c1 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Tue, 27 Apr 2021 17:10:20 +0530 Subject: [PATCH] qcacld-3.0: Handle TDLS peer count logic for SSR scenario Always decrement tdls_soc_obj->set_state_info.set_state_cnt in case TDLS is disconnected due to STA disconnection triggered as part of SSR. If it is not, then for SSR, after the system restarts, this count is used and can be interpreted as second tdls connection. Currently, multiple tdls links are not supported, so TDLS set state CMD (WMI_TDLS_SET_STATE_CMDID) won't be sent to fw, although peer create and peer assoc will go to firmware which results in crash. Change-Id: Ib764cd04a04fab237840cdffafa9752fbe202418 CRs-Fixed: 2931199 --- components/tdls/core/src/wlan_tdls_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/components/tdls/core/src/wlan_tdls_main.c b/components/tdls/core/src/wlan_tdls_main.c index a08bba0e9a39..d8e8a55656ef 100644 --- a/components/tdls/core/src/wlan_tdls_main.c +++ b/components/tdls/core/src/wlan_tdls_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021 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 @@ -1187,6 +1187,15 @@ void tdls_send_update_to_fw(struct tdls_vdev_priv_obj *tdls_vdev_obj, tdls_info_to_fw->tdls_discovery_wake_timeout = tdls_soc_obj->tdls_configs.tdls_discovery_wake_timeout; + /** + * set_state_cnt should always decrement in case of sta disconnection. + * If it is not, then in case where STA disconnection happens due to + * SSR where tdls_update_fw_tdls_state() will return failure, + * tdls count has to be decremented irrepective of success or failure + */ + if (!sta_connect_event) + tdls_soc_obj->set_state_info.set_state_cnt--; + status = tdls_update_fw_tdls_state(tdls_soc_obj, tdls_info_to_fw); if (QDF_STATUS_SUCCESS != status) goto done; @@ -1194,8 +1203,6 @@ void tdls_send_update_to_fw(struct tdls_vdev_priv_obj *tdls_vdev_obj, if (sta_connect_event) { tdls_soc_obj->set_state_info.set_state_cnt++; tdls_soc_obj->set_state_info.vdev_id = session_id; - } else { - tdls_soc_obj->set_state_info.set_state_cnt--; } tdls_debug("TDLS Set state cnt %d",