From 28d3dfd5e004ff637100854f3b32df6b79fbeb5f Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Sun, 2 Aug 2020 17:34:17 +0530 Subject: [PATCH] qcacld-3.0: De-initialize idle timer on tdls peer reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently idle timer does not gets de-initialize on tdls peer reset because of which there could be a possibility that in case of multiple tdls connection and disconnection with multiple peers, this timer might get assigned and re-assigned to different peers which may lead to an issue where this timer never gets started for the required peer. In current scenario whenever the first TDLS connection (Peer a with sta_idx 0) happens, tdls peer idle timer object is initialized with “&tdls_soc->tdls_conn_info[0];”. Now if this peer a gets disconnected and peer b gets connected and peer gets the same sta_idx 0, then peer will be associated with timer “&tdls_soc->tdls_conn_info[0];”,hence 2 timer init happens with the same sta_idx for peer a and peer b. (here peer a is in disconnected state and peer b is in connected state) Now if peer a gets connected it will get the sta_idx 1, as timer initialization is already done for peer a with sta index 0 so timer initialization will not be done again. Now if peer b gets disconnected it will set the tdls_info for sta_idx 0 to invalid (INVALID_TDLS_PEER_INDEX). Now for peer a timer will be started and when timer expires in timer handler function “tdls_ct_idle_handler” will not be invoked as sta_idx is already set to INVALID_TDLS_PEER_INDEX. To address above issue, de-initialize the idle timer for tdls peer on every tdls peer reset. CRs-Fixed: 2746046 Change-Id: Icc2e64a9299852d5b29d26dec79b7f1efb2594b8 --- components/tdls/core/src/wlan_tdls_cmds_process.c | 6 +++--- components/tdls/core/src/wlan_tdls_ct.c | 9 +++++++-- components/tdls/core/src/wlan_tdls_peer.c | 8 ++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/components/tdls/core/src/wlan_tdls_cmds_process.c b/components/tdls/core/src/wlan_tdls_cmds_process.c index 23c580951808..4ca57dc8216e 100644 --- a/components/tdls/core/src/wlan_tdls_cmds_process.c +++ b/components/tdls/core/src/wlan_tdls_cmds_process.c @@ -1402,8 +1402,8 @@ static QDF_STATUS tdls_add_peer_rsp(struct tdls_add_sta_rsp *rsp) conn_rec[sta_idx].index = sta_idx; qdf_copy_macaddr(&conn_rec[sta_idx].peer_mac, &rsp->peermac); - tdls_debug("TDLS: Add sta mac " - QDF_MAC_ADDR_STR, + tdls_debug("TDLS: Add sta mac at idx %d" + QDF_MAC_ADDR_STR, sta_idx, QDF_MAC_ADDR_ARRAY (rsp->peermac.bytes)); break; @@ -1487,7 +1487,7 @@ QDF_STATUS tdls_process_del_peer_rsp(struct tdls_del_sta_rsp *rsp) continue; macaddr = rsp->peermac.bytes; - tdls_debug("TDLS: del STA"); + tdls_debug("TDLS: del STA with sta_idx %d", sta_idx); curr_peer = tdls_find_peer(vdev_obj, macaddr); if (curr_peer) { tdls_debug(QDF_MAC_ADDR_STR " status is %d", diff --git a/components/tdls/core/src/wlan_tdls_ct.c b/components/tdls/core/src/wlan_tdls_ct.c index db88afc66186..ba334aea89c3 100644 --- a/components/tdls/core/src/wlan_tdls_ct.c +++ b/components/tdls/core/src/wlan_tdls_ct.c @@ -570,7 +570,9 @@ tdls_get_conn_info(struct tdls_soc_priv_obj *tdls_soc, if (!qdf_mem_cmp( tdls_soc->tdls_conn_info[sta_idx].peer_mac.bytes, peer_mac->bytes, QDF_MAC_ADDR_SIZE)) { - tdls_debug("tdls peer exists %pM", peer_mac->bytes); + tdls_debug("tdls peer exists idx %d " QDF_MAC_ADDR_STR, + sta_idx, + QDF_MAC_ADDR_ARRAY(peer_mac->bytes)); tdls_soc->tdls_conn_info[sta_idx].index = sta_idx; return &tdls_soc->tdls_conn_info[sta_idx]; } @@ -647,8 +649,11 @@ void tdls_ct_idle_handler(void *user_data) return; idx = tdls_info->index; - if (idx == INVALID_TDLS_PEER_INDEX || idx >= WLAN_TDLS_STA_MAX_NUM) + if (idx == INVALID_TDLS_PEER_INDEX || idx >= WLAN_TDLS_STA_MAX_NUM) { + tdls_debug("invalid peer index %d" QDF_MAC_ADDR_STR, idx, + QDF_MAC_ADDR_ARRAY(tdls_info->peer_mac.bytes)); return; + } tdls_soc_obj = qdf_container_of(tdls_info, struct tdls_soc_priv_obj, tdls_conn_info[idx]); diff --git a/components/tdls/core/src/wlan_tdls_peer.c b/components/tdls/core/src/wlan_tdls_peer.c index 6320583122ea..1107f8956b3e 100644 --- a/components/tdls/core/src/wlan_tdls_peer.c +++ b/components/tdls/core/src/wlan_tdls_peer.c @@ -867,6 +867,14 @@ QDF_STATUS tdls_reset_peer(struct tdls_vdev_priv_obj *vdev_obj, ®_bw_offset); } + if (curr_peer->is_peer_idle_timer_initialised) { + tdls_debug(QDF_MAC_ADDR_STR ": destroy idle timer ", + QDF_MAC_ADDR_ARRAY(curr_peer->peer_mac.bytes)); + qdf_mc_timer_stop(&curr_peer->peer_idle_timer); + qdf_mc_timer_destroy(&curr_peer->peer_idle_timer); + curr_peer->is_peer_idle_timer_initialised = false; + } + tdls_set_peer_link_status(curr_peer, TDLS_LINK_IDLE, TDLS_LINK_UNSPECIFIED); curr_peer->valid_entry = false;