From a3516d65a3abd014a4223eadaa0e199d18679214 Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Tue, 18 Feb 2020 15:43:34 +0530 Subject: [PATCH] qcacld-3.0: Send proper reason code for STA kickout disconnections Currently, driver send a generic reason code eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON to userspace when a STA kickout happens. Send eSIR_MAC_SA_QUERY_TIMEOUT when STA kickout happens due to SA query timeout. Send eSIR_MAC_PEER_XRETRY_FAIL when STA kickout happens due to XRETRY failure. Still host sends deauth frame with reason code eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON. Change-Id: I72fa7406ef1b131ef3519bb6bef21cc52bc548cb CRs-Fixed: 2624948 --- .../mac/src/pe/lim/lim_link_monitoring_algo.c | 19 +++++++-- core/wma/inc/wma_if.h | 4 +- core/wma/src/wma_mgmt.c | 39 ++++++------------- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/core/mac/src/pe/lim/lim_link_monitoring_algo.c b/core/mac/src/pe/lim/lim_link_monitoring_algo.c index 434e35030d82..11565c337910 100644 --- a/core/mac/src/pe/lim/lim_link_monitoring_algo.c +++ b/core/mac/src/pe/lim/lim_link_monitoring_algo.c @@ -186,6 +186,7 @@ void lim_delete_sta_context(struct mac_context *mac_ctx, tpDeleteStaContext msg = (tpDeleteStaContext) lim_msg->bodyptr; struct pe_session *session_entry; tpDphHashNode sta_ds; + enum eSirMacReasonCodes reason_code; if (!msg) { pe_err("Invalid body pointer in message"); @@ -200,6 +201,8 @@ void lim_delete_sta_context(struct mac_context *mac_ctx, switch (msg->reasonCode) { case HAL_DEL_STA_REASON_CODE_KEEP_ALIVE: + case HAL_DEL_STA_REASON_CODE_SA_QUERY_TIMEOUT: + case HAL_DEL_STA_REASON_CODE_XRETRY: if (LIM_IS_STA_ROLE(session_entry) && !msg->is_tdls) { if (!((session_entry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) && @@ -226,10 +229,18 @@ void lim_delete_sta_context(struct mac_context *mac_ctx, lim_send_deauth_mgmt_frame(mac_ctx, eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON, msg->addr2, session_entry, false); + if (msg->reasonCode == + HAL_DEL_STA_REASON_CODE_SA_QUERY_TIMEOUT) + reason_code = eSIR_MAC_SA_QUERY_TIMEOUT; + else if (msg->reasonCode == + HAL_DEL_STA_REASON_CODE_XRETRY) + reason_code = eSIR_MAC_PEER_XRETRY_FAIL; + else + reason_code = eSIR_MAC_PEER_INACTIVITY; lim_tear_down_link_with_ap(mac_ctx, - session_entry->peSessionId, - eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON, - eLIM_LINK_MONITORING_DEAUTH); + session_entry->peSessionId, + reason_code, + eLIM_LINK_MONITORING_DEAUTH); /* only break for STA role (non TDLS) */ break; } @@ -254,7 +265,7 @@ void lim_delete_sta_context(struct mac_context *mac_ctx, return; } lim_send_deauth_mgmt_frame(mac_ctx, - eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON, + eSIR_MAC_BSS_TRANSITION_DISASSOC, session_entry->bssId, session_entry, false); lim_tear_down_link_with_ap(mac_ctx, session_entry->peSessionId, eSIR_MAC_BSS_TRANSITION_DISASSOC, diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index 9b4afccaf590..14520ce4b668 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -402,7 +402,9 @@ typedef enum eDelStaReasonCode { HAL_DEL_STA_REASON_CODE_TIM_BASED = 0x2, HAL_DEL_STA_REASON_CODE_RA_BASED = 0x3, HAL_DEL_STA_REASON_CODE_UNKNOWN_A2 = 0x4, - HAL_DEL_STA_REASON_CODE_BTM_DISASSOC_IMMINENT = 0x5 + HAL_DEL_STA_REASON_CODE_BTM_DISASSOC_IMMINENT = 0x5, + HAL_DEL_STA_REASON_CODE_SA_QUERY_TIMEOUT = 0x6, + HAL_DEL_STA_REASON_CODE_XRETRY = 0x7, } tDelStaReasonCode; typedef enum eSmpsModeValue { diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 2d884f4f6728..3396c43847d2 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -394,31 +394,6 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event, (void *)del_sta_ctx, 0); goto exit_handler; #endif /* FEATURE_WLAN_TDLS */ - case WMI_PEER_STA_KICKOUT_REASON_XRETRY: - if (wma->interfaces[vdev_id].type == WMI_VDEV_TYPE_STA && - (wma->interfaces[vdev_id].sub_type == 0 || - wma->interfaces[vdev_id].sub_type == - WMI_UNIFIED_VDEV_SUBTYPE_P2P_CLIENT) && - !qdf_mem_cmp(bssid, - macaddr, QDF_MAC_ADDR_SIZE)) { - wma_sta_kickout_event(HOST_STA_KICKOUT_REASON_XRETRY, - vdev_id, macaddr); - /* - * KICKOUT event is for current station-AP connection. - * Treat it like final beacon miss. Station may not have - * missed beacons but not able to transmit frames to AP - * for a long time. Must disconnect to get out of - * this sticky situation. - * In future implementation, roaming module will also - * handle this event and perform a scan. - */ - WMA_LOGW("%s: WMI_PEER_STA_KICKOUT_REASON_XRETRY event for STA", - __func__); - wma_beacon_miss_handler(wma, vdev_id, - kickout_event->rssi); - goto exit_handler; - } - break; case WMI_PEER_STA_KICKOUT_REASON_UNSPECIFIED: /* @@ -449,6 +424,7 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event, } break; + case WMI_PEER_STA_KICKOUT_REASON_XRETRY: case WMI_PEER_STA_KICKOUT_REASON_INACTIVITY: /* * Handle SA query kickout is same as inactivity kickout. @@ -473,15 +449,22 @@ int wma_peer_sta_kickout_event_handler(void *handle, uint8_t *event, del_sta_ctx->vdev_id = vdev_id; qdf_mem_copy(del_sta_ctx->addr2, macaddr, QDF_MAC_ADDR_SIZE); qdf_mem_copy(del_sta_ctx->bssId, addr, QDF_MAC_ADDR_SIZE); - del_sta_ctx->reasonCode = HAL_DEL_STA_REASON_CODE_KEEP_ALIVE; + if (kickout_event->reason == + WMI_PEER_STA_KICKOUT_REASON_SA_QUERY_TIMEOUT) + del_sta_ctx->reasonCode = + HAL_DEL_STA_REASON_CODE_SA_QUERY_TIMEOUT; + else if (kickout_event->reason == WMI_PEER_STA_KICKOUT_REASON_XRETRY) + del_sta_ctx->reasonCode = HAL_DEL_STA_REASON_CODE_XRETRY; + else + del_sta_ctx->reasonCode = HAL_DEL_STA_REASON_CODE_KEEP_ALIVE; + if (wmi_service_enabled(wma->wmi_handle, wmi_service_hw_db2dbm_support)) del_sta_ctx->rssi = kickout_event->rssi; else del_sta_ctx->rssi = kickout_event->rssi + WMA_TGT_NOISE_FLOOR_DBM; - wma_sta_kickout_event(HOST_STA_KICKOUT_REASON_KEEP_ALIVE, - vdev_id, macaddr); + wma_sta_kickout_event(del_sta_ctx->reasonCode, vdev_id, macaddr); wma_send_msg(wma, SIR_LIM_DELETE_STA_CONTEXT_IND, (void *)del_sta_ctx, 0); wma_lost_link_info_handler(wma, vdev_id, del_sta_ctx->rssi);