From fe696d2bac46770da744e0575509c5c93cdfc30a Mon Sep 17 00:00:00 2001 From: "Selvaraj, Sridhar" Date: Wed, 3 Aug 2016 21:34:51 +0530 Subject: [PATCH] qcacld-3.0: Update RRM scan results to user space qcacld-2.0 to qcacld-3.0 propagation Currently RRM scan results are sent out to the requesting AP, but are not updated to the kernel. Update the results to the kernel so that it will be useful in future in the userspace if a BTM request is received and the lookup of scan cache can fetch a result for the target AP and an additional scan can be avoided. Git-commit: 3075ac910c015ce525bf8badd1eb4a277286b28f Change-Id: Ie56b86e5c54910648cb2ae8bf2a7dac2ee873e00 CRs-Fixed: 1010596 --- core/hdd/src/wlan_hdd_assoc.c | 15 +++++++++++++++ core/hdd/src/wlan_hdd_cfg80211.c | 5 ++--- core/hdd/src/wlan_hdd_cfg80211.h | 2 ++ core/sme/inc/csr_api.h | 1 + core/sme/src/rrm/sme_rrm.c | 20 +++++++++++++++++++- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index bed513cd29ae..9c64dd789caa 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -4605,6 +4605,7 @@ hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, QDF_STATUS status = QDF_STATUS_SUCCESS; hdd_context_t *pHddCtx = NULL; struct hdd_chan_change_params chan_change; + struct cfg80211_bss *bss_status; hddLog(LOG2, "CSR Callback: status= %d result= %d roamID=%d", @@ -4966,6 +4967,20 @@ hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, if (QDF_IS_STATUS_ERROR(status)) hdd_info("set hw mode change not done"); break; + case eCSR_ROAM_UPDATE_SCAN_RESULT: + if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { + bss_status = wlan_hdd_cfg80211_inform_bss_frame( + pAdapter, pRoamInfo->pBssDesc); + if (NULL == bss_status) + hdd_info("UPDATE_SCAN_RESULT returned NULL"); + else + cfg80211_put_bss( +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) + (WLAN_HDD_GET_CTX(pAdapter))->wiphy, +#endif + bss_status); + } + break; case eCSR_ROAM_NDP_STATUS_UPDATE: hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, roamResult); diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index f05f29f40856..c3891254d4c6 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -9612,9 +9612,8 @@ struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_list(hdd_adapter_t *pAdapter, * * Return: struct cfg80211_bss pointer */ -static struct cfg80211_bss * -wlan_hdd_cfg80211_inform_bss_frame(hdd_adapter_t *pAdapter, - tSirBssDescription *bss_desc) +struct cfg80211_bss *wlan_hdd_cfg80211_inform_bss_frame(hdd_adapter_t *pAdapter, + tSirBssDescription *bss_desc) { /* * cfg80211_inform_bss() is not updating ie field of bss entry, if entry diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index 3edf6cbceda9..3191adce1a8d 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -2900,4 +2900,6 @@ static inline void wlan_hdd_cfg80211_indicate_disconnect(struct net_device *dev, GFP_KERNEL); } #endif +struct cfg80211_bss *wlan_hdd_cfg80211_inform_bss_frame(hdd_adapter_t *pAdapter, + tSirBssDescription *bss_desc); #endif diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 668b3700db8e..9c0e6d0fc329 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -512,6 +512,7 @@ typedef enum { eCSR_ROAM_ENABLE_QUEUES, eCSR_ROAM_STA_CHANNEL_SWITCH, eCSR_ROAM_NDP_STATUS_UPDATE, + eCSR_ROAM_UPDATE_SCAN_RESULT, } eRoamCmdStatus; /* comment inside indicates what roaming callback gets */ diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c index cae3250233ea..83809cc7cbc0 100644 --- a/core/sme/src/rrm/sme_rrm.c +++ b/core/sme/src/rrm/sme_rrm.c @@ -429,6 +429,7 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx, uint8_t counter = 0; tpRrmSMEContext rrm_ctx = &mac_ctx->rrm.rrmSmeContext; uint32_t session_id; + tCsrRoamInfo *roam_info; qdf_mem_zero(&filter, sizeof(filter)); qdf_mem_zero(scanresults_arr, @@ -519,16 +520,31 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx, NULL, measurementdone, 0); } counter = 0; + + roam_info = qdf_mem_malloc(sizeof(*roam_info)); + if (NULL == roam_info) { + sms_log(mac_ctx, LOGP, FL("vos_mem_malloc failed")); + status = QDF_STATUS_E_NOMEM; + goto rrm_send_scan_results_done; + } + while (scan_results) { next_result = sme_scan_result_get_next(mac_ctx, result_handle); sms_log(mac_ctx, LOG1, "Scan res timer:%lu, rrm scan timer:%lu", scan_results->timer, rrm_scan_timer); - if (scan_results->timer >= rrm_scan_timer) + if (scan_results->timer >= rrm_scan_timer) { + qdf_mem_zero(roam_info, sizeof(*roam_info)); + roam_info->pBssDesc = &scan_results->BssDescriptor; + csr_roam_call_callback(mac_ctx, session_id, roam_info, + 0, eCSR_ROAM_UPDATE_SCAN_RESULT, + eCSR_ROAM_RESULT_NONE); scanresults_arr[counter++] = scan_results; + } scan_results = next_result; if (counter >= SIR_BCN_REPORT_MAX_BSS_DESC) break; } + qdf_mem_free(roam_info); /* * The beacon report should be sent whether the counter is zero or * non-zero. There might be a few scan results in the cache but not @@ -554,6 +570,8 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx, scanresults_arr, measurementdone, counter); } + +rrm_send_scan_results_done: sme_scan_result_purge(mac_ctx, result_handle); return status; }