diff options
| author | Sachin Ahuja <sahuja@qti.qualcomm.com> | 2014-06-18 12:52:47 +0530 |
|---|---|---|
| committer | Akash Patel <c_akashp@qca.qualcomm.com> | 2014-06-19 20:51:25 -0700 |
| commit | fa84536d885fcbf7986741541a0891ed136444bf (patch) | |
| tree | dd50d61bc956ad5ebcf962192510018b54cc9629 | |
| parent | fdcbd508df2843b9345b3e55a93b7302dbb7b27e (diff) | |
qcacld: Serialize the wma tbtt offset update event
Currently the wma tbtt offset update event is not serialized to
VosMC thread.So the crash is seen during the race conditions.
Changes are done to serialize this event to MC thread to avoid
the crash.
Change-Id: I3be0c1698fba6b882065361bb304f4e723381269
CRs-Fixed: 680907
| -rw-r--r-- | CORE/MAC/src/include/sirParams.h | 1 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 94 | ||||
| -rw-r--r-- | CORE/SYS/legacy/src/utils/src/macTrace.c | 1 | ||||
| -rw-r--r-- | CORE/WDA/inc/wlan_qct_wda.h | 1 |
4 files changed, 83 insertions, 14 deletions
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h index 5200c0d1c8a5..ebb0099c4845 100644 --- a/CORE/MAC/src/include/sirParams.h +++ b/CORE/MAC/src/include/sirParams.h @@ -683,6 +683,7 @@ typedef struct sSirMbMsgP2p #define SIR_HAL_ROAM_PREAUTH_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 264) +#define SIR_HAL_TBTT_UPDATE_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 265) #define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF) // CFG message types diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index c7168c00cac1..fc78eee43efa 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -11870,32 +11870,47 @@ VOS_STATUS wma_store_bcn_tmpl(tp_wma_handle wma, u_int8_t vdev_id, return VOS_STATUS_SUCCESS; } -static int wma_tbttoffset_update_event_handler(void *handle, u_int8_t *event, - u_int32_t len) + + +static int wma_tbtt_update_ind(tp_wma_handle wma, u_int8_t *buf) { - tp_wma_handle wma = (tp_wma_handle) handle; - WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; - wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; - struct wma_txrx_node *intf = wma->interfaces; + struct wma_txrx_node *intf; struct beacon_info *bcn; tSendbeaconParams bcn_info; - u_int32_t *adjusted_tsf; + u_int32_t *adjusted_tsf = NULL; u_int32_t if_id = 0, vdev_map; - - param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *)event; - if(!param_buf) { - WMA_LOGE("Invalid tbtt update event buffer"); + u_int32_t num_tbttoffset_list; + wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; + WMA_LOGI("%s: Enter", __func__); + if (!buf) { + WMA_LOGE("Invalid event buffer"); return -EINVAL; } - tbtt_offset_event = param_buf->fixed_param; + if (!wma) { + WMA_LOGE("Invalid wma handle"); + return -EINVAL; + } + intf = wma->interfaces; + tbtt_offset_event = (wmi_tbtt_offset_event_fixed_param *)buf; vdev_map = tbtt_offset_event->vdev_map; - adjusted_tsf = param_buf->tbttoffset_list; + num_tbttoffset_list = *(u_int32_t *)(buf + sizeof(wmi_tbtt_offset_event_fixed_param)); + adjusted_tsf = (u_int32_t *) ((u_int8_t *)buf + + sizeof(wmi_tbtt_offset_event_fixed_param) + + sizeof (u_int32_t)); + if (!adjusted_tsf) { + WMA_LOGE("%s: Invalid adjusted_tsf", __func__); + return -EINVAL; + } for ( ;(vdev_map); vdev_map >>= 1, if_id++) { if (!(vdev_map & 0x1) || (!(intf[if_id].handle))) continue; bcn = intf[if_id].beacon; + if (!bcn) { + WMA_LOGE("%s: Invalid beacon", __func__); + return -EINVAL; + } if (!bcn->buf) { WMA_LOGE("%s: Invalid beacon buffer", __func__); return -EINVAL; @@ -11914,7 +11929,55 @@ static int wma_tbttoffset_update_event_handler(void *handle, u_int8_t *event, /* Update beacon template in firmware */ wmi_unified_bcn_tmpl_send(wma, if_id, &bcn_info, 0); } + return 0; +} +static int wma_tbttoffset_update_event_handler(void *handle, u_int8_t *event, + u_int32_t len) +{ + WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf; + wmi_tbtt_offset_event_fixed_param *tbtt_offset_event; + u_int8_t *buf, *tempBuf; + vos_msg_t vos_msg = {0}; + + param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *)event; + if(!param_buf) { + WMA_LOGE("Invalid tbtt update event buffer"); + return -EINVAL; + } + + tbtt_offset_event = param_buf->fixed_param; + buf = vos_mem_malloc(sizeof(wmi_tbtt_offset_event_fixed_param) + + sizeof (u_int32_t) + + (param_buf->num_tbttoffset_list * sizeof (u_int32_t))); + if (!buf) { + WMA_LOGE("%s: Failed alloc memory for buf", __func__); + return -EINVAL; + } + + tempBuf = buf; + vos_mem_zero(buf, (sizeof(wmi_tbtt_offset_event_fixed_param) + + sizeof (u_int32_t) + + (param_buf->num_tbttoffset_list * sizeof (u_int32_t)))); + vos_mem_copy(buf, (u_int8_t *)tbtt_offset_event, sizeof (wmi_tbtt_offset_event_fixed_param)); + buf += sizeof (wmi_tbtt_offset_event_fixed_param); + + vos_mem_copy(buf, (u_int8_t *) ¶m_buf->num_tbttoffset_list, sizeof (u_int32_t)); + buf += sizeof(u_int32_t); + + vos_mem_copy(buf, (u_int8_t *)param_buf->tbttoffset_list, (param_buf->num_tbttoffset_list * sizeof(u_int32_t))); + + vos_msg.type = WDA_TBTT_UPDATE_IND; + vos_msg.bodyptr = tempBuf; + vos_msg.bodyval = 0; + + if (VOS_STATUS_SUCCESS != + vos_mq_post_message(VOS_MQ_ID_WDA, &vos_msg)) { + WMA_LOGP("%s: Failed to post WDA_TBTT_UPDATE_IND msg", __func__); + vos_mem_free(buf); + return -1; + } + WMA_LOGD("WDA_TBTT_UPDATE_IND posted"); return 0; } @@ -17593,7 +17656,10 @@ VOS_STATUS wma_mc_process_msg(v_VOID_t *vos_context, vos_msg_t *msg) wma_roam_preauth_ind(wma_handle, msg->bodyptr); vos_mem_free(msg->bodyptr); break; - + case WDA_TBTT_UPDATE_IND: + wma_tbtt_update_ind(wma_handle, msg->bodyptr); + vos_mem_free(msg->bodyptr); + break; default: WMA_LOGD("unknow msg type %x", msg->type); /* Do Nothing? MSG Body should be freed at here */ diff --git a/CORE/SYS/legacy/src/utils/src/macTrace.c b/CORE/SYS/legacy/src/utils/src/macTrace.c index 6c90886962a5..eda102e28536 100644 --- a/CORE/SYS/legacy/src/utils/src/macTrace.c +++ b/CORE/SYS/legacy/src/utils/src/macTrace.c @@ -806,6 +806,7 @@ tANI_U8* macTraceGetWdaMsgString( tANI_U16 wdaMsg ) CASE_RETURN_STRING(WDA_SET_SAP_INTRABSS_DIS); CASE_RETURN_STRING(WDA_FW_STATS_IND); CASE_RETURN_STRING(WDA_VDEV_STOP_IND); + CASE_RETURN_STRING(WDA_TBTT_UPDATE_IND); default: return((tANI_U8*) "UNKNOWN" ); break; diff --git a/CORE/WDA/inc/wlan_qct_wda.h b/CORE/WDA/inc/wlan_qct_wda.h index 3c8726bea64f..97e14490a24b 100644 --- a/CORE/WDA/inc/wlan_qct_wda.h +++ b/CORE/WDA/inc/wlan_qct_wda.h @@ -1352,6 +1352,7 @@ tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb); #define WDA_ROAM_PREAUTH_IND SIR_HAL_ROAM_PREAUTH_IND +#define WDA_TBTT_UPDATE_IND SIR_HAL_TBTT_UPDATE_IND tSirRetStatus wdaPostCtrlMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg); #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 // Bit 6 will be used to control BD rate for Management frames |
