From 96bdde1b075ce7aea394de6ad1006d6209541ee6 Mon Sep 17 00:00:00 2001 From: Bala Venkatesh Date: Tue, 5 Jun 2018 16:24:14 +0530 Subject: [PATCH] qcacmn: Fix TDLS tear down issue on initiator The tdls peer sta id is allocated as part of wma_create_peer. In HDD, as part of change interface, wlan_hdd_tdls_disable_offchan_and_teardown_links API is called. Here driver checks for valid TDLS peers based on staid. Here HDD assumes staid zero as invalid and non zero values as valid ID. This is not correct as staid zero also is a valid staid. Due to this teardown status is not informed to upper layers. Use 0xFF as invalid sta id for tdls peer to fix this issue. Change-Id: I3827df9a63081952b2d443c175ef5a59eab85e43 CRs-Fixed: 2258171 --- umac/tdls/core/src/wlan_tdls_cmds_process.c | 6 +++--- umac/tdls/core/src/wlan_tdls_ct.c | 7 ++++--- umac/tdls/core/src/wlan_tdls_peer.c | 2 +- umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h | 3 ++- umac/tdls/dispatcher/src/wlan_tdls_ucfg_api.c | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/umac/tdls/core/src/wlan_tdls_cmds_process.c b/umac/tdls/core/src/wlan_tdls_cmds_process.c index 30bbe01e08..8570484c2d 100644 --- a/umac/tdls/core/src/wlan_tdls_cmds_process.c +++ b/umac/tdls/core/src/wlan_tdls_cmds_process.c @@ -1398,7 +1398,7 @@ static QDF_STATUS tdls_add_peer_rsp(struct tdls_add_sta_rsp *rsp) conn_rec = soc_obj->tdls_conn_info; for (sta_idx = 0; sta_idx < soc_obj->max_num_tdls_sta; sta_idx++) { - if (0 == conn_rec[sta_idx].sta_id) { + if (INVALID_TDLS_PEER_ID == conn_rec[sta_idx].sta_id) { conn_rec[sta_idx].session_id = rsp->session_id; conn_rec[sta_idx].sta_id = rsp->sta_id; qdf_copy_macaddr(&conn_rec[sta_idx].peer_mac, @@ -1510,7 +1510,7 @@ QDF_STATUS tdls_process_del_peer_rsp(struct tdls_del_sta_rsp *rsp) } } tdls_reset_peer(vdev_obj, macaddr); - conn_rec[sta_idx].sta_id = 0; + conn_rec[sta_idx].sta_id = INVALID_TDLS_PEER_ID; conn_rec[sta_idx].session_id = 0xff; qdf_mem_zero(&conn_rec[sta_idx].peer_mac, QDF_MAC_ADDR_SIZE); @@ -2190,7 +2190,7 @@ static int tdls_teardown_links(struct tdls_soc_priv_obj *soc_obj, uint32_t mode) conn_rec = soc_obj->tdls_conn_info; for (staidx = 0; staidx < soc_obj->max_num_tdls_sta; staidx++) { - if (conn_rec[staidx].sta_id == 0) + if (conn_rec[staidx].sta_id == INVALID_TDLS_PEER_ID) continue; curr_peer = tdls_find_all_peer(soc_obj, diff --git a/umac/tdls/core/src/wlan_tdls_ct.c b/umac/tdls/core/src/wlan_tdls_ct.c index e2c73a49bd..7c44278af4 100644 --- a/umac/tdls/core/src/wlan_tdls_ct.c +++ b/umac/tdls/core/src/wlan_tdls_ct.c @@ -587,7 +587,7 @@ tdls_ct_process_idle_handler( &tdls_soc_obj)) return; - if (!tdls_info->sta_id) { + if (INVALID_TDLS_PEER_ID == tdls_info->sta_id) { tdls_err("peer (staidx %u) doesn't exists", tdls_info->sta_id); return; } @@ -1252,7 +1252,8 @@ void tdls_disable_offchan_and_teardown_links( for (staidx = 0; staidx < tdls_soc->max_num_tdls_sta; staidx++) { - if (!tdls_soc->tdls_conn_info[staidx].sta_id) + if (tdls_soc->tdls_conn_info[staidx].sta_id + == INVALID_TDLS_PEER_ID) continue; curr_peer = tdls_find_all_peer(tdls_soc, @@ -1280,7 +1281,7 @@ void tdls_disable_offchan_and_teardown_links( wlan_vdev_get_id(vdev), curr_peer->sta_id); tdls_decrement_peer_count(tdls_soc); - tdls_soc->tdls_conn_info[staidx].sta_id = 0; + tdls_soc->tdls_conn_info[staidx].sta_id = INVALID_TDLS_PEER_ID; tdls_soc->tdls_conn_info[staidx].session_id = 255; qdf_mem_zero(&tdls_soc->tdls_conn_info[staidx].peer_mac, diff --git a/umac/tdls/core/src/wlan_tdls_peer.c b/umac/tdls/core/src/wlan_tdls_peer.c index 7e2f7e597b..b761646d0c 100644 --- a/umac/tdls/core/src/wlan_tdls_peer.c +++ b/umac/tdls/core/src/wlan_tdls_peer.c @@ -756,7 +756,7 @@ QDF_STATUS tdls_reset_peer(struct tdls_vdev_priv_obj *vdev_obj, tdls_set_peer_link_status(curr_peer, TDLS_LINK_IDLE, TDLS_LINK_UNSPECIFIED); - curr_peer->sta_id = 0; + curr_peer->sta_id = INVALID_TDLS_PEER_ID; return QDF_STATUS_SUCCESS; } diff --git a/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h b/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h index 8f1e045fb9..cb5a8f816e 100644 --- a/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h +++ b/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h @@ -74,8 +74,9 @@ #define TDLS_TEARDOWN_PEER_UNREACHABLE 25 #define TDLS_TEARDOWN_PEER_UNSPEC_REASON 26 +#define INVALID_TDLS_PEER_ID 0xFF #define TDLS_STA_INDEX_CHECK(sta_id) \ - (((sta_id) >= 1) && ((sta_id) < 0xFF)) + (((sta_id) >= 0) && ((sta_id) < 0xFF)) /** * enum tdls_conc_cap - tdls concurrency support * @TDLS_SUPPORTED_ONLY_ON_STA: only support sta tdls diff --git a/umac/tdls/dispatcher/src/wlan_tdls_ucfg_api.c b/umac/tdls/dispatcher/src/wlan_tdls_ucfg_api.c index d071dc0cd6..442fb5c9f9 100644 --- a/umac/tdls/dispatcher/src/wlan_tdls_ucfg_api.c +++ b/umac/tdls/dispatcher/src/wlan_tdls_ucfg_api.c @@ -137,7 +137,7 @@ static QDF_STATUS tdls_global_init(struct tdls_soc_priv_obj *soc_obj) soc_obj->max_num_tdls_sta = WLAN_TDLS_STA_MAX_NUM; for (sta_idx = 0; sta_idx < soc_obj->max_num_tdls_sta; sta_idx++) { - soc_obj->tdls_conn_info[sta_idx].sta_id = 0; + soc_obj->tdls_conn_info[sta_idx].sta_id = INVALID_TDLS_PEER_ID; soc_obj->tdls_conn_info[sta_idx].session_id = 255; qdf_mem_zero(&soc_obj->tdls_conn_info[sta_idx].peer_mac, QDF_MAC_ADDR_SIZE);