diff options
| author | Chandrasekaran, Manishekar <cmshekar@qti.qualcomm.com> | 2014-01-25 00:37:51 +0530 |
|---|---|---|
| committer | Prakash Dhavali <pdhavali@qca.qualcomm.com> | 2014-01-31 17:28:11 -0800 |
| commit | e3ecf322a421590b47f208bbeea2be278e16d448 (patch) | |
| tree | db4c9dd8daa6f7155c716456b3a8350ab290c254 | |
| parent | 67c03aa508fec9c689cf76649e4de0a0b397ea1f (diff) | |
qcacld: Implementation of scan timeout on the host driver
When the FW does not send response to the scan command,
the host will be in wait state and will not process any
further commands from the userspace. To avoid this,
timeout is implemented for the scan command on the host
driver. This change is done on the premise that WMA
does not receive any further scan command from the UMAC
until the previous scan command is processed back to the
userspace.
CRs-Fixed: 605502
Depends-on: 598919 588153
Change-Id: I1885fa0f64211b589a2a40f1d858a93235cb7bb2
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 87 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.h | 8 |
2 files changed, 95 insertions, 0 deletions
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 3044440246cd..6dc319adf387 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -3788,7 +3788,21 @@ VOS_STATUS wma_start_scan(tp_wma_handle wma_handle, if (msg_type == WDA_CHNL_SWITCH_REQ) { wma_handle->roam_preauth_scan_id = cmd->scan_id; } + WMA_LOGI("WMA --> WMI_START_SCAN_CMDID"); + + /* Start the timer for scan completion */ + vos_status = vos_timer_start(&wma_handle->wma_scan_comp_timer, + WMA_HW_DEF_SCAN_MAX_DURATION); + if (vos_status != VOS_STATUS_SUCCESS ) { + WMA_LOGE("Failed to start the scan completion timer"); + vos_status = VOS_STATUS_E_FAILURE; + goto error; + } + /* Update the scan parameters for handler */ + wma_handle->wma_scan_timer_info.vdev_id = cmd->vdev_id; + wma_handle->wma_scan_timer_info.scan_id = cmd->scan_id; + return VOS_STATUS_SUCCESS; error: wma_reset_scan_info(wma_handle, cmd->vdev_id); @@ -14397,6 +14411,7 @@ static int wma_scan_event_callback(WMA_HANDLE handle, u_int8_t *data, tSirScanOffloadEvent *scan_event; u_int8_t vdev_id; v_U32_t scan_id; + VOS_STATUS vos_status = VOS_STATUS_SUCCESS; param_buf = (WMI_SCAN_EVENTID_param_tlvs *) data; wmi_event = param_buf->fixed_param; @@ -14455,6 +14470,17 @@ static int wma_scan_event_callback(WMA_HANDLE handle, u_int8_t *data, WMA_LOGP("Unexpected Scan Event %lu", wmi_event->event); break; } + + /* Stop the scan completion timeout if the event is WMI_SCAN_EVENT_COMPLETED */ + if (scan_event->event == (tSirScanEventType)WMI_SCAN_EVENT_COMPLETED) { + WMA_LOGI("Received WMI_SCAN_EVENT_COMPLETED, Stoping the scan timer"); + vos_status = vos_timer_stop(&wma_handle->wma_scan_comp_timer); + if (vos_status != VOS_STATUS_SUCCESS) { + WMA_LOGE("Failed to stop the scan completion timeout"); + return -EPERM; + } + } + wma_send_msg(wma_handle, WDA_RX_SCAN_EVENT, (void *) scan_event, 0) ; return 0; } @@ -15261,6 +15287,50 @@ static int wma_channel_avoid_evt_handler(void *handle, u_int8_t *event, } #endif /* FEATURE_WLAN_CH_AVOID */ +/* function : wma_scan_completion_timeout + * Descriptin : + * Args : + * Returns : + */ +void wma_scan_completion_timeout(void *data) +{ + tp_wma_handle wma_handle; + tSirScanOffloadEvent *scan_event; + u_int8_t vdev_id; + + WMA_LOGE("%s: Timeout occured for scan command", __func__); + + wma_handle = (tp_wma_handle) data; + + scan_event = (tSirScanOffloadEvent *) vos_mem_malloc + (sizeof(tSirScanOffloadEvent)); + if (!scan_event) { + WMA_LOGE("%s: Memory allocation failed for tSirScanOffloadEvent", __func__); + return; + } + + vdev_id = wma_handle->wma_scan_timer_info.vdev_id; + + if (wma_handle->wma_scan_timer_info.scan_id != + wma_handle->interfaces[vdev_id].scan_info.scan_id) { + vos_mem_free(scan_event); + WMA_LOGE("%s: Scan ID mismatch", __func__); + return; + } + + scan_event->event = WMI_SCAN_EVENT_COMPLETED; + scan_event->reasonCode = eSIR_SME_SCAN_FAILED; + scan_event->scanId = wma_handle->wma_scan_timer_info.scan_id; + scan_event->p2pScanType = wma_handle->interfaces[vdev_id].scan_info.p2p_scan_type; + scan_event->sessionId = vdev_id; + + /* Reset scan info in interfaces table */ + wma_reset_scan_info(wma_handle, vdev_id); + + wma_send_msg(wma_handle, WDA_RX_SCAN_EVENT, (void *) scan_event, 0) ; + return; +} + /* function : wma_start * Descriptin : * Args : @@ -15435,6 +15505,17 @@ VOS_STATUS wma_start(v_VOID_t *vos_ctx) WMA_LOGP("Failed to register tx management"); goto end; } + + /* Initialize scan completion timeout */ + vos_status = vos_timer_init(&wma_handle->wma_scan_comp_timer, + VOS_TIMER_TYPE_SW, + wma_scan_completion_timeout, + wma_handle); + if (vos_status != VOS_STATUS_SUCCESS) { + WMA_LOGE("Failed to initialize scan completion timeout"); + goto end; + } + end: WMA_LOGD("%s: Exit", __func__); return vos_status; @@ -15479,6 +15560,12 @@ VOS_STATUS wma_stop(v_VOID_t *vos_ctx, tANI_U8 reason) wma_handle->ack_work_ctx = NULL; } + /* Destroy the timer for scan completion */ + vos_status = vos_timer_destroy(&wma_handle->wma_scan_comp_timer); + if (vos_status != VOS_STATUS_SUCCESS) { + WMA_LOGE("Failed to destroy the scan completion timer"); + } + #ifdef QCA_WIFI_ISOC wma_hal_stop_isoc(wma_handle); #else diff --git a/CORE/SERVICES/WMA/wma.h b/CORE/SERVICES/WMA/wma.h index 53524d1c943f..88cc390e85f1 100644 --- a/CORE/SERVICES/WMA/wma.h +++ b/CORE/SERVICES/WMA/wma.h @@ -453,6 +453,11 @@ struct utf_event_info { #endif typedef struct { + u_int8_t vdev_id; + u_int32_t scan_id; +}scan_timer_info; + +typedef struct { void *wmi_handle; void *htc_handle; void *vos_context; @@ -562,6 +567,9 @@ typedef struct { #endif vos_wake_lock_t wow_wake_lock; + vos_timer_t wma_scan_comp_timer; + scan_timer_info wma_scan_timer_info; + }t_wma_handle, *tp_wma_handle; struct wma_target_cap { |
