diff --git a/umac/tdls/core/src/wlan_tdls_cmds_process.c b/umac/tdls/core/src/wlan_tdls_cmds_process.c index 30bbe01e0885..8570484c2de4 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 e2c73a49bdd4..7c44278af44f 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 7e2f7e597b91..b761646d0c04 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 8f1e045fb9af..cb5a8f816e44 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 d071dc0cd622..442fb5c9f989 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);