From 06f59685fceda209df277cbbb344aa44f6e22ba5 Mon Sep 17 00:00:00 2001 From: DARAM SUDHA Date: Wed, 18 Mar 2015 15:50:59 +0530 Subject: qcacld: acquire lock of remain_on_chan_ctx_lock before unlocking In wlan_hdd_cleanup_remain_on_channel_ctx, while cleaning up the RoC context at hdd_stop_adapter() in driver unload path, lock needs to be aquired before break. Change-Id: I386fcc2eb433ec0067d5973b7401fbb34d167647 CRs-Fixed: 809190 --- CORE/HDD/src/wlan_hdd_p2p.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c index dce1b00c4bd5..ded3f8c2fc5b 100644 --- a/CORE/HDD/src/wlan_hdd_p2p.c +++ b/CORE/HDD/src/wlan_hdd_p2p.c @@ -473,12 +473,13 @@ void wlan_hdd_cleanup_remain_on_channel_ctx(hdd_adapter_t *pAdapter) pAdapter->is_roc_inprogress = FALSE; } mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - } + /* hold the lock before break from the loop */ + mutex_lock(&cfgState->remain_on_chan_ctx_lock); break; } mutex_lock(&cfgState->remain_on_chan_ctx_lock); - } + } /* end of while */ mutex_unlock(&cfgState->remain_on_chan_ctx_lock); } -- cgit v1.2.3 From 9136f4d1ec6d5d206ebe2287775a149d82e591ce Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 25 Mar 2015 20:00:31 +0800 Subject: qcacld: htc: fix a memory leak while unloading wlan driver This change fixes a memory leak in HTC layer while unloading wlan driver. Change-Id: I93d4ef719b8ec0eef60676e0fdfec1efcd322bdf CRs-Fixed: 812958 --- CORE/SERVICES/HTC/htc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CORE/SERVICES/HTC/htc.c b/CORE/SERVICES/HTC/htc.c index 2ff489aa1af6..2fb5d910c627 100644 --- a/CORE/SERVICES/HTC/htc.c +++ b/CORE/SERVICES/HTC/htc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2013, 2014, 2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -143,7 +143,7 @@ void HTCDump(HTC_HANDLE HTCHandle, u_int8_t CmdId, bool start) static void HTCCleanup(HTC_TARGET *target) { HTC_PACKET *pPacket; - //adf_nbuf_t netbuf; + adf_nbuf_t netbuf; if (target->hif_dev != NULL) { HIFDetachHTC(target->hif_dev); @@ -164,6 +164,12 @@ static void HTCCleanup(HTC_TARGET *target) pPacket = target->pBundleFreeTxList; while (pPacket) { HTC_PACKET *pPacketTmp = (HTC_PACKET *)pPacket->ListLink.pNext; + if(pPacket->pContext != NULL) { + A_FREE(pPacket->pContext); + } + netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket); + if(netbuf != NULL) + adf_nbuf_free(netbuf); A_FREE(pPacket); pPacket = pPacketTmp; } -- cgit v1.2.3 From e07769822d6f77c3bd7fc2bb7fc855c298cc3440 Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Mon, 23 Mar 2015 01:10:52 -0700 Subject: qcacld-2.0: Configuration for Extended Roaming Params. There are few more roaming parameters added for roaming enhancements. The input is expected from the middleware and this is saved into the session. The parameters are passed down to the firmware via the roaming update commands. CRs-Fixed: 812974 Change-Id: Ie26b171ebf974b6aa2e9bcfa5f082084482dec45 --- CORE/HDD/src/wlan_hdd_cfg80211.c | 284 ++++++++++++++++++++++++++++++++++++++ CORE/MAC/inc/sirApi.h | 28 +++- CORE/SERVICES/WMA/wma.c | 200 ++++++++++++++++++++++++--- CORE/SME/inc/csrInternal.h | 1 + CORE/SME/inc/csrNeighborRoam.h | 5 + CORE/SME/inc/sme_Api.h | 3 +- CORE/SME/src/csr/csrApiRoam.c | 4 +- CORE/SME/src/sme_common/sme_Api.c | 75 ++++++++++ 8 files changed, 581 insertions(+), 19 deletions(-) diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index 078aa5d94ca2..fcda50ca04f7 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -1476,6 +1476,283 @@ max_buffer_err: return -EINVAL; } +static int +wlan_hdd_cfg80211_set_ext_roam_params(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, + int data_len) +{ + struct net_device *dev = wdev->netdev; + hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); + hdd_context_t *pHddCtx = wiphy_priv(wiphy); + uint8_t session_id; + struct roam_ext_params roam_params; + uint32_t cmd_type, req_id; + struct nlattr *curr_attr; + struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX + 1]; + struct nlattr *tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX + 1]; + int rem,i, buf_len; + uint8_t *buf; + if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX, + data, data_len, + NULL)) { + hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); + return -EINVAL; + } + /* Parse and fetch Command Type*/ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_SUBCMD]) { + hddLog(VOS_TRACE_LEVEL_ERROR, FL("roam cmd type failed")); + goto fail; + } + session_id = pAdapter->sessionId; + vos_mem_set(&roam_params, sizeof(roam_params),0); + cmd_type = nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_ROAMING_SUBCMD]); + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_REQ_ID]) { + hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); + goto fail; + } + req_id = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_REQ_ID]); + hddLog(VOS_TRACE_LEVEL_DEBUG, FL("Req Id (%d)"), req_id); + hddLog(VOS_TRACE_LEVEL_DEBUG, FL("Cmd Type (%d)"), cmd_type); + switch(cmd_type) { + case QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_SSID_WHITE_LIST: + /* Parse and fetch number of allowed ssid */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_NUM_NETWORKS]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("attr num of allowed ssid failed")); + goto fail; + } + roam_params.num_ssid_allowed_list = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_NUM_NETWORKS]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("Num of Allowed SSID (%d)"), + roam_params.num_ssid_allowed_list); + i = 0; + nla_for_each_nested(curr_attr, + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID_LIST], + rem) { + if (nla_parse(tb2, + QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_MAX, + nla_data(curr_attr), nla_len(curr_attr), + NULL)) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("nla_parse failed")); + goto fail; + } + /* Parse and Fetch allowed SSID list*/ + if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("attr allowed ssid failed")); + goto fail; + } + buf = nla_data(tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID]); + buf_len = nla_len(tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID]); + nla_strlcpy(roam_params.ssid_allowed_list[i].ssId, + tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_WHITE_LIST_SSID], + buf_len); + roam_params.ssid_allowed_list[i].length = + buf_len - 1; + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("SSID[%d]: %s,length = %d"), i, + roam_params.ssid_allowed_list[i].ssId, + roam_params.ssid_allowed_list[i].length); + i++; + } + sme_update_roam_params(pHddCtx->hHal, session_id, + roam_params, REASON_ROAM_SET_SSID_ALLOWED); + break; + case QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_SET_EXTSCAN_ROAM_PARAMS: + /* Parse and fetch 5G Boost Threshold */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_BOOST_THRESHOLD]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("5G boost threshold failed")); + goto fail; + } + roam_params.raise_rssi_thresh_5g = nla_get_s32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_BOOST_THRESHOLD]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("5G Boost Threshold (%d)"), + roam_params.raise_rssi_thresh_5g); + /* Parse and fetch 5G Penalty Threshold */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_PENALTY_THRESHOLD]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("5G penalty threshold failed")); + goto fail; + } + roam_params.drop_rssi_thresh_5g = nla_get_s32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_PENALTY_THRESHOLD]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("5G Penalty Threshold (%d)"), + roam_params.drop_rssi_thresh_5g); + /* Parse and fetch 5G Boost Factor */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_BOOST_FACTOR]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("5G boost Factor failed")); + goto fail; + } + roam_params.raise_factor_5g = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_BOOST_FACTOR]); + hddLog(VOS_TRACE_LEVEL_DEBUG, FL("5G Boost Factor (%d)"), + roam_params.raise_factor_5g); + /* Parse and fetch 5G Penalty factor */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_PENALTY_FACTOR]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("5G Penalty Factor failed")); + goto fail; + } + roam_params.drop_factor_5g = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_PENALTY_FACTOR]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("5G Penalty factor (%d)"), + roam_params.drop_factor_5g); + /* Parse and fetch 5G Max Boost */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_MAX_BOOST]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("5G Max Boost failed")); + goto fail; + } + roam_params.max_raise_rssi_5g = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_A_BAND_MAX_BOOST]); + hddLog(VOS_TRACE_LEVEL_DEBUG, FL("5G Max Boost (%d)"), + roam_params.max_raise_rssi_5g); + /* Parse and fetch Rssi Diff */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_LAZY_ROAM_HISTERESYS]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("Rssi Diff failed")); + goto fail; + } + roam_params.rssi_diff = nla_get_s32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_LAZY_ROAM_HISTERESYS]); + hddLog(VOS_TRACE_LEVEL_DEBUG, FL("RSSI Diff (%d)"), + roam_params.rssi_diff); + /* Parse and fetch Good Rssi Threshold */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_ALERT_ROAM_RSSI_TRIGGER]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("Good Rssi Threshold failed")); + goto fail; + } + roam_params.good_rssi_threshold = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_ALERT_ROAM_RSSI_TRIGGER]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("Good RSSI Threshold (%d)"), + roam_params.good_rssi_threshold); + sme_update_roam_params(pHddCtx->hHal, session_id, + roam_params, + REASON_ROAM_EXT_SCAN_PARAMS_CHANGED); + break; + case QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_SET_LAZY_ROAM: + /* Parse and fetch Activate Good Rssi Roam */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_ENABLE]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("Activate Good Rssi Roam failed")); + goto fail; + } + roam_params.good_rssi_roam = nla_get_s32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_ENABLE]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("Activate Good Rssi Roam (%d)"), + roam_params.good_rssi_roam); + sme_update_roam_params(pHddCtx->hHal, session_id, + roam_params, REASON_ROAM_GOOD_RSSI_CHANGED); + break; + case QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_SET_BSSID_PREFS: + /* Parse and fetch number of preferred BSSID */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_NUM_BSSID]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("attr num of preferred bssid failed")); + goto fail; + } + roam_params.num_bssid_favored = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_NUM_BSSID]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("Num of Preferred BSSID (%d)"), + roam_params.num_bssid_favored); + i = 0; + nla_for_each_nested(curr_attr, + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PREFS], + rem) { + if (nla_parse(tb2, + QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX, + nla_data(curr_attr), nla_len(curr_attr), + NULL)) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("nla_parse failed")); + goto fail; + } + /* Parse and fetch MAC address */ + if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_BSSID]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("attr mac address failed")); + goto fail; + } + nla_memcpy(roam_params.bssid_favored[i], + tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_BSSID], + sizeof(tSirMacAddr)); + hddLog(VOS_TRACE_LEVEL_DEBUG, MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(roam_params.bssid_favored[i])); + /* Parse and fetch preference factor*/ + if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_RSSI_MODIFIER]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("BSSID Preference score failed")); + goto fail; + } + roam_params.bssid_favored_factor[i] = nla_get_u32( + tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_LAZY_ROAM_RSSI_MODIFIER]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("BSSID Preference score (%d)"), + roam_params.bssid_favored_factor[i]); + i++; + } + sme_update_roam_params(pHddCtx->hHal, session_id, + roam_params, REASON_ROAM_SET_FAVORED_BSSID); + break; + case QCA_WLAN_VENDOR_ATTR_ROAM_SUBCMD_SET_BLACKLIST_BSSID: + /* Parse and fetch number of blacklist BSSID */ + if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_NUM_BSSID]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("attr num of blacklist bssid failed")); + goto fail; + } + roam_params.num_bssid_avoid_list = nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_NUM_BSSID]); + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("Num of blacklist BSSID (%d)"), + roam_params.num_bssid_avoid_list); + i = 0; + nla_for_each_nested(curr_attr, + tb[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS], + rem) { + if (nla_parse(tb2, + QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX, + nla_data(curr_attr), nla_len(curr_attr), + NULL)) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("nla_parse failed")); + goto fail; + } + /* Parse and fetch MAC address */ + if (!tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID]) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("attr blacklist addr failed")); + goto fail; + } + nla_memcpy(roam_params.bssid_avoid_list[i], + tb2[QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_SET_BSSID_PARAMS_BSSID], + sizeof(tSirMacAddr)); + hddLog(VOS_TRACE_LEVEL_DEBUG, MAC_ADDRESS_STR, + MAC_ADDR_ARRAY( + roam_params.bssid_avoid_list[i])); + i++; + } + sme_update_roam_params(pHddCtx->hHal, session_id, + roam_params, REASON_ROAM_SET_BLACKLIST_BSSID); + break; + } + return 0; +fail: + return -EINVAL; +} #ifdef WLAN_FEATURE_STATS_EXT static int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy, @@ -5923,6 +6200,13 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = WIPHY_VENDOR_CMD_NEED_RUNNING, .doit = (void *)wlan_hdd_cfg80211_wifi_configuration_set }, + { + .info.vendor_id = QCA_NL80211_VENDOR_ID, + .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAM, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV, + .doit = (void *)wlan_hdd_cfg80211_set_ext_roam_params + }, }; diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h index 4d8cd7c9ceb2..aff408675f12 100644 --- a/CORE/MAC/inc/sirApi.h +++ b/CORE/MAC/inc/sirApi.h @@ -3700,6 +3700,30 @@ typedef enum { SIR_ROAMING_DFS_CHANNEL_ENABLED_NORMAL = 1, SIR_ROAMING_DFS_CHANNEL_ENABLED_ACTIVE = 2 } eSirDFSRoamScanMode; +#define MAX_SSID_ALLOWED_LIST 4 +#define MAX_BSSID_AVOID_LIST 16 +#define MAX_BSSID_FAVORED 16 +struct roam_ext_params { + uint8_t num_bssid_avoid_list; + uint8_t num_ssid_allowed_list; + uint8_t num_bssid_favored; + tSirMacSSid ssid_allowed_list[MAX_SSID_ALLOWED_LIST]; + tSirMacAddr bssid_avoid_list[MAX_BSSID_AVOID_LIST]; + tSirMacAddr bssid_favored[MAX_BSSID_FAVORED]; + uint8_t bssid_favored_factor[MAX_BSSID_FAVORED]; + int raise_rssi_thresh_5g; + int drop_rssi_thresh_5g; + uint8_t raise_rssi_type_5g; + uint8_t raise_factor_5g; + uint8_t drop_rssi_type_5g; + uint8_t drop_factor_5g; + int max_raise_rssi_5g; + int max_drop_rssi_5g; + int good_rssi_threshold; + int rssi_diff; + int good_rssi_roam; + bool is_5g_pref_enabled; +}; typedef struct sSirRoamOffloadScanReq { @@ -3712,7 +3736,7 @@ typedef struct sSirRoamOffloadScanReq tANI_U8 RoamRssiDiff; tANI_U8 ChannelCacheType; tANI_U8 Command; - tANI_U8 StartScanReason; + tANI_U8 reason; tANI_U16 NeighborScanTimerPeriod; tANI_U16 NeighborRoamScanRefreshPeriod; tANI_U16 NeighborScanChannelMinTime; @@ -3759,6 +3783,8 @@ typedef struct sSirRoamOffloadScanReq tANI_U32 R0KH_ID_Length; tANI_U8 RoamKeyMgmtOffloadEnabled; #endif + struct roam_ext_params roam_params; + } tSirRoamOffloadScanReq, *tpSirRoamOffloadScanReq; typedef struct sSirRoamOffloadScanRsp diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index a1bafd877439..a58f80764e4e 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -8214,19 +8214,24 @@ error: * Returns : */ VOS_STATUS wma_roam_scan_offload_rssi_thresh(tp_wma_handle wma_handle, - A_INT32 rssi_thresh, - A_INT32 rssi_thresh_diff, - u_int32_t vdev_id) + tSirRoamOffloadScanReq *roam_req) { VOS_STATUS vos_status = VOS_STATUS_SUCCESS; wmi_buf_t buf = NULL; int status = 0; - int len; + int len, rssi_thresh, rssi_thresh_diff; u_int8_t *buf_ptr; wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp; + wmi_roam_scan_extended_threshold_param *ext_thresholds = NULL; + struct roam_ext_params *roam_params; /* Send rssi threshold */ + roam_params = &roam_req->roam_params; + rssi_thresh = roam_req->LookupThreshold - WMA_NOISE_FLOOR_DBM_DEFAULT; + rssi_thresh_diff = roam_req->OpportunisticScanThresholdDiff; len = sizeof(wmi_roam_scan_rssi_threshold_fixed_param); + len += WMI_TLV_HDR_SIZE; /* TLV for ext_thresholds*/ + len += sizeof(wmi_roam_scan_extended_threshold_param); buf = wmi_buf_alloc(wma_handle->wmi_handle, len); if (!buf) { WMA_LOGE("%s : wmi_buf_alloc failed", __func__); @@ -8240,10 +8245,39 @@ VOS_STATUS wma_roam_scan_offload_rssi_thresh(tp_wma_handle wma_handle, WMITLV_GET_STRUCT_TLVLEN( wmi_roam_scan_rssi_threshold_fixed_param)); /* fill in threshold values */ - rssi_threshold_fp->vdev_id = vdev_id; + rssi_threshold_fp->vdev_id = roam_req->sessionId; rssi_threshold_fp->roam_scan_rssi_thresh = rssi_thresh & 0x000000ff; rssi_threshold_fp->roam_rssi_thresh_diff = rssi_thresh_diff & 0x000000ff; - + buf_ptr += sizeof(wmi_roam_scan_rssi_threshold_fixed_param); + WMITLV_SET_HDR(buf_ptr, + WMITLV_TAG_ARRAY_STRUC, + sizeof(wmi_roam_scan_extended_threshold_param)); + buf_ptr += WMI_TLV_HDR_SIZE; + ext_thresholds = (wmi_roam_scan_extended_threshold_param *) buf_ptr; + ext_thresholds->boost_threshold_5g = + (roam_params->raise_rssi_thresh_5g - WMA_NOISE_FLOOR_DBM_DEFAULT) & + 0x000000ff; + ext_thresholds->penalty_threshold_5g = + (roam_params->drop_rssi_thresh_5g - WMA_NOISE_FLOOR_DBM_DEFAULT) & + 0x000000ff; + ext_thresholds->boost_algorithm_5g = WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; + ext_thresholds->boost_factor_5g = roam_params->raise_factor_5g; + ext_thresholds->penalty_algorithm_5g = + WMI_ROAM_5G_BOOST_PENALIZE_ALGO_LINEAR; + ext_thresholds->penalty_factor_5g = roam_params->drop_factor_5g; + ext_thresholds->max_boost_5g = + (roam_params->max_raise_rssi_5g - WMA_NOISE_FLOOR_DBM_DEFAULT) & + 0x000000ff; + ext_thresholds->max_penalty_5g = + (roam_params->max_drop_rssi_5g - WMA_NOISE_FLOOR_DBM_DEFAULT) & + 0x000000ff; + ext_thresholds->good_rssi_threshold = + (roam_params->good_rssi_threshold - WMA_NOISE_FLOOR_DBM_DEFAULT) & + 0x000000ff; + WMITLV_SET_HDR(&ext_thresholds->tlv_header, + WMITLV_TAG_STRUC_wmi_roam_scan_extended_threshold_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_roam_scan_extended_threshold_param)); status = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, WMI_ROAM_SCAN_RSSI_THRESHOLD); if (status != EOK) { @@ -8789,6 +8823,131 @@ error: return vos_status; } +VOS_STATUS wma_roam_scan_filter(tp_wma_handle wma_handle, + tSirRoamOffloadScanReq *roam_req) +{ + wmi_buf_t buf = NULL; + int status = 0, i; + uint32_t len, num_bssid_black_list = 0, num_ssid_white_list = 0, + num_bssid_preferred_list = 0; + uint32_t op_bitmap = 0; + uint8_t *buf_ptr; + wmi_roam_filter_fixed_param *roam_filter; + uint8_t *bssid_src_ptr = NULL; + wmi_mac_addr *bssid_dst_ptr = NULL; + wmi_ssid *ssid_ptr = NULL; + uint32_t *bssid_preferred_factor_ptr = NULL; + struct roam_ext_params *roam_params; + + roam_params = &roam_req->roam_params; + len = sizeof(wmi_roam_filter_fixed_param); + len += WMI_TLV_HDR_SIZE; + switch (roam_req->reason) { + case REASON_ROAM_SET_BLACKLIST_BSSID: + op_bitmap |= 0x1; + num_bssid_black_list = roam_params->num_bssid_avoid_list; + len += num_bssid_black_list * sizeof(wmi_mac_addr); + len += WMI_TLV_HDR_SIZE; + break; + case REASON_ROAM_SET_SSID_ALLOWED: + op_bitmap |= 0x2; + num_ssid_white_list = roam_params->num_ssid_allowed_list; + len += num_ssid_white_list * sizeof(wmi_ssid); + len += WMI_TLV_HDR_SIZE; + break; + case REASON_ROAM_SET_FAVORED_BSSID: + op_bitmap |= 0x4; + num_bssid_preferred_list = roam_params->num_bssid_favored; + len += num_bssid_preferred_list * sizeof(wmi_mac_addr); + len += WMI_TLV_HDR_SIZE; + len += num_bssid_preferred_list * sizeof(A_UINT32); + break; + default: + WMA_LOGD("%s : Roam Filter need not be sent", __func__); + return VOS_STATUS_SUCCESS; + break; + } + + buf = wmi_buf_alloc(wma_handle->wmi_handle, len); + if (!buf) { + WMA_LOGE("%s : wmi_buf_alloc failed", __func__); + return VOS_STATUS_E_NOMEM; + } + + buf_ptr = (u_int8_t *) wmi_buf_data(buf); + roam_filter = (wmi_roam_filter_fixed_param *) buf_ptr; + WMITLV_SET_HDR(&roam_filter->tlv_header, + WMITLV_TAG_STRUC_wmi_roam_filter_fixed_param, + WMITLV_GET_STRUCT_TLVLEN(wmi_roam_filter_fixed_param)); + /* fill in fixed values */ + roam_filter->vdev_id = roam_req->sessionId; + roam_filter->flags = 0; + roam_filter->op_bitmap = op_bitmap; + roam_filter->num_bssid_black_list = num_bssid_black_list; + roam_filter->num_ssid_white_list = num_ssid_white_list; + roam_filter->num_bssid_preferred_list = num_bssid_preferred_list; + buf_ptr += sizeof(wmi_roam_filter_fixed_param); + + WMITLV_SET_HDR((buf_ptr), + WMITLV_TAG_ARRAY_FIXED_STRUC, + (num_bssid_black_list * sizeof(wmi_mac_addr))); + bssid_src_ptr = (uint8_t *)&roam_params->bssid_avoid_list; + bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); + for(i=0; issid, &roam_params->ssid_allowed_list[i].ssId, + roam_params->ssid_allowed_list[i].length); + ssid_ptr->ssid_len = roam_params->ssid_allowed_list[i].length; + WMA_LOGD("%s: Passing SSID of length=%d", __func__,ssid_ptr->ssid_len); + VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_DEBUG, + (uint8_t *)ssid_ptr->ssid, + ssid_ptr->ssid_len); + ssid_ptr++; + } + buf_ptr += WMI_TLV_HDR_SIZE + (num_ssid_white_list * sizeof(wmi_ssid)); + WMITLV_SET_HDR((buf_ptr), + WMITLV_TAG_ARRAY_FIXED_STRUC, + (num_bssid_preferred_list * sizeof(wmi_mac_addr))); + bssid_src_ptr = (uint8_t *)&roam_params->bssid_favored; + bssid_dst_ptr = (wmi_mac_addr *)(buf_ptr + WMI_TLV_HDR_SIZE); + for(i=0; ibssid_favored_factor[i]; + bssid_preferred_factor_ptr++; + } + buf_ptr += WMI_TLV_HDR_SIZE + (num_bssid_preferred_list * sizeof(uint32_t)); + status = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, + len, WMI_ROAM_FILTER_CMDID); + if (status != EOK) { + WMA_LOGE("wmi_unified_cmd_send WMI_ROAM_FILTER_CMDID returned Error %d", + status); + goto error; + } + return VOS_STATUS_SUCCESS; +error: + wmi_buf_free(buf); + return VOS_STATUS_E_FAILURE; +} + VOS_STATUS wma_roam_scan_bmiss_cnt(tp_wma_handle wma_handle, A_INT32 first_bcnt, A_UINT32 final_bcnt, @@ -8883,7 +9042,7 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, struct wma_txrx_node *intr = NULL; WMA_LOGI("%s: command 0x%x, reason %d", __func__, roam_req->Command, - roam_req->StartScanReason); + roam_req->reason); if (NULL == pMac) { @@ -8914,9 +9073,7 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, wma_handle->suitable_ap_hb_failure = FALSE; vos_status = wma_roam_scan_offload_rssi_thresh(wma_handle, - (roam_req->LookupThreshold - WMA_NOISE_FLOOR_DBM_DEFAULT), - roam_req->OpportunisticScanThresholdDiff, - roam_req->sessionId); + roam_req); if (vos_status != VOS_STATUS_SUCCESS) { break; } @@ -8984,6 +9141,14 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, roam_req, mode, roam_req->sessionId); + if (vos_status != VOS_STATUS_SUCCESS) { + break; + } + vos_status = wma_roam_scan_filter(wma_handle, roam_req); + if (vos_status != VOS_STATUS_SUCCESS) { + WMA_LOGE("Sending start for roam scan filter failed"); + break; + } break; case ROAM_SCAN_OFFLOAD_STOP: @@ -8999,7 +9164,7 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, roam_req->sessionId); } - if (roam_req->StartScanReason == REASON_OS_REQUESTED_ROAMING_NOW) { + if (roam_req->reason == REASON_OS_REQUESTED_ROAMING_NOW) { vos_msg_t vosMsg; tSirRoamOffloadScanRsp *scan_offload_rsp; scan_offload_rsp = vos_mem_malloc(sizeof(*scan_offload_rsp)); @@ -9010,7 +9175,7 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, } vosMsg.type = eWNI_SME_ROAM_SCAN_OFFLOAD_RSP; scan_offload_rsp->sessionId = roam_req->sessionId; - scan_offload_rsp->reason = roam_req->StartScanReason; + scan_offload_rsp->reason = roam_req->reason; vosMsg.bodyptr = scan_offload_rsp; /* * Since REASSOC request is processed in Roam_Scan_Offload_Rsp @@ -9042,7 +9207,7 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, * and WMI_ROAM_REASON_SUITABLE_AP event was received earlier, * now it is time to call it heartbeat failure. */ - if ((roam_req->StartScanReason == REASON_PREAUTH_FAILED_FOR_ALL) + if ((roam_req->reason == REASON_PREAUTH_FAILED_FOR_ALL) && wma_handle->suitable_ap_hb_failure) { WMA_LOGE("%s: Sending heartbeat failure after preauth failures", __func__); @@ -9073,6 +9238,11 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, if (vos_status != VOS_STATUS_SUCCESS) { break; } + vos_status = wma_roam_scan_filter(wma_handle, roam_req); + if (vos_status != VOS_STATUS_SUCCESS) { + WMA_LOGE("Sending update for roam scan filter failed"); + break; + } /* * Runtime (after association) changes to rssi thresholds and other parameters. @@ -9087,9 +9257,7 @@ VOS_STATUS wma_process_roam_scan_req(tp_wma_handle wma_handle, } vos_status = wma_roam_scan_offload_rssi_thresh(wma_handle, - (roam_req->LookupThreshold - WMA_NOISE_FLOOR_DBM_DEFAULT), - roam_req->OpportunisticScanThresholdDiff, - roam_req->sessionId); + roam_req); if (vos_status != VOS_STATUS_SUCCESS) { break; } diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h index a9f1619410b3..34fba0eab423 100644 --- a/CORE/SME/inc/csrInternal.h +++ b/CORE/SME/inc/csrInternal.h @@ -675,6 +675,7 @@ typedef struct tagCsrConfig v_U8_t conc_custom_rule1; v_U8_t conc_custom_rule2; v_U8_t is_sta_connection_in_5gz_enabled; + struct roam_ext_params roam_params; }tCsrConfig; typedef struct tagCsrChannelPowerInfo diff --git a/CORE/SME/inc/csrNeighborRoam.h b/CORE/SME/inc/csrNeighborRoam.h index ed999d820a49..c28b86ca7337 100644 --- a/CORE/SME/inc/csrNeighborRoam.h +++ b/CORE/SME/inc/csrNeighborRoam.h @@ -323,6 +323,11 @@ VOS_STATUS csrNeighborRoamMergeChannelLists(tpAniSirGlobal pMac, #define REASON_ROAM_BEACON_RSSI_WEIGHT_CHANGED 22 #define REASON_ROAM_DFS_SCAN_MODE_CHANGED 23 #define REASON_ROAM_ABORT_ROAM_SCAN 24 +#define REASON_ROAM_EXT_SCAN_PARAMS_CHANGED 25 +#define REASON_ROAM_SET_SSID_ALLOWED 26 +#define REASON_ROAM_SET_FAVORED_BSSID 27 +#define REASON_ROAM_GOOD_RSSI_CHANGED 28 +#define REASON_ROAM_SET_BLACKLIST_BSSID 29 eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 sessionId, tANI_U8 command, tANI_U8 reason); eHalStatus csrNeighborRoamCandidateFoundIndHdlr(tpAniSirGlobal pMac, diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h index 6dba4a5c1120..ca5fb7080066 100644 --- a/CORE/SME/inc/sme_Api.h +++ b/CORE/SME/inc/sme_Api.h @@ -378,7 +378,8 @@ void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode); eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId, csrRoamSessionCloseCallback callback, void *pContext); - +eHalStatus sme_update_roam_params(tHalHandle hHal, uint8_t session_id, + struct roam_ext_params roam_params_src, int update_param); /*-------------------------------------------------------------------------- diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 80b46879179f..35bd55933fc3 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -16681,7 +16681,7 @@ eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 sessionId, pRequestBuf->RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff; pRequestBuf->Command = command; - pRequestBuf->StartScanReason = reason; + pRequestBuf->reason = reason; pRequestBuf->NeighborScanTimerPeriod = pNeighborRoamInfo->cfgParams.neighborScanPeriod; pRequestBuf->NeighborRoamScanRefreshPeriod = @@ -16900,6 +16900,8 @@ eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 sessionId, csrRoamOffload(pMac, pRequestBuf, pSession); } #endif + vos_mem_copy(&pRequestBuf->roam_params, &pMac->roam.configParam.roam_params, + sizeof(pRequestBuf->roam_params)); msg.type = WDA_ROAM_SCAN_OFFLOAD_REQ; msg.reserved = 0; msg.bodyptr = pRequestBuf; diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index 895434f9a1dd..c01dfe364836 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -1676,6 +1676,81 @@ eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams) return status; } +/** + * sme_update_roam_params - Store/Update the roaming params + * @hHal Handle for Hal layer + * @session_id SME Session ID + * @roam_params_src The source buffer to copy + * @update_param Type of parameter to be updated + * + * Return: Return the status of the updation. + */ +eHalStatus sme_update_roam_params(tHalHandle hHal, + uint8_t session_id, struct roam_ext_params roam_params_src, + int update_param) +{ + tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + struct roam_ext_params *roam_params_dst; + uint8_t i; + + roam_params_dst = &pMac->roam.configParam.roam_params; + switch(update_param) { + case REASON_ROAM_EXT_SCAN_PARAMS_CHANGED: + roam_params_dst->raise_rssi_thresh_5g = + roam_params_src.raise_rssi_thresh_5g; + roam_params_dst->drop_rssi_thresh_5g = + roam_params_src.drop_rssi_thresh_5g; + roam_params_dst->raise_factor_5g= + roam_params_src.raise_factor_5g; + roam_params_dst->drop_factor_5g = + roam_params_src.drop_factor_5g; + roam_params_dst->max_drop_rssi_5g= + roam_params_src.max_drop_rssi_5g; + roam_params_dst->is_5g_pref_enabled = true; + break; + case REASON_ROAM_SET_SSID_ALLOWED: + vos_mem_set(&roam_params_dst->ssid_allowed_list, 0, + sizeof(tSirMacSSid) * MAX_SSID_ALLOWED_LIST); + roam_params_dst->num_ssid_allowed_list= + roam_params_src.num_ssid_allowed_list; + for (i=0; inum_ssid_allowed_list; i++) { + roam_params_dst->ssid_allowed_list[i].length = + roam_params_src.ssid_allowed_list[i].length; + vos_mem_copy(roam_params_dst->ssid_allowed_list[i].ssId, + roam_params_src.ssid_allowed_list[i].ssId, + roam_params_dst->ssid_allowed_list[i].length); + } + break; + case REASON_ROAM_SET_FAVORED_BSSID: + vos_mem_set(&roam_params_dst->bssid_favored, 0, + sizeof(tSirMacAddr) * MAX_BSSID_FAVORED); + roam_params_dst->num_bssid_favored= + roam_params_src.num_bssid_favored; + for (i=0; inum_bssid_favored; i++) { + vos_mem_copy(&roam_params_dst->bssid_favored[i], + &roam_params_src.bssid_favored[i], + sizeof(tSirMacAddr)); + roam_params_dst->bssid_favored_factor[i] = + roam_params_src.bssid_favored_factor[i]; + } + break; + case REASON_ROAM_SET_BLACKLIST_BSSID: + vos_mem_set(&roam_params_dst->bssid_avoid_list, 0, + sizeof(tSirMacAddr) * MAX_BSSID_AVOID_LIST); + roam_params_dst->num_bssid_avoid_list = + roam_params_src.num_bssid_avoid_list; + for (i=0; inum_bssid_avoid_list; i++) { + vos_mem_copy(&roam_params_dst->bssid_avoid_list[i], + &roam_params_src.bssid_avoid_list[i], + sizeof(tSirMacAddr)); + } + default: + break; + } + csrRoamOffloadScan(pMac, session_id, ROAM_SCAN_OFFLOAD_UPDATE_CFG, + update_param); + return 0; +} #ifdef WLAN_FEATURE_GTK_OFFLOAD void sme_ProcessGetGtkInfoRsp( tHalHandle hHal, tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) -- cgit v1.2.3 From 647d891fc6552733f56aa370e33c5565d4398039 Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Mon, 23 Mar 2015 01:33:29 -0700 Subject: qcacld-2.0: Roaming enhancement to allow multiple ssid This feature enables the device to roam to different SSID which has the same security parameters CRs-Fixed: 813148 Change-Id: If4953e64f9e0485edec85167a7bc1dd6ca7c2047 --- CORE/HDD/src/wlan_hdd_assoc.c | 50 +++++++++++++++++++++-- CORE/MAC/src/pe/lim/limSendSmeRspMessages.c | 28 +++++++++++-- CORE/SME/inc/csrApi.h | 6 +++ CORE/SME/src/csr/csrApiRoam.c | 37 ++++++++++++++++- CORE/SME/src/csr/csrNeighborRoam.c | 61 +++++++++++++++++++++-------- 5 files changed, 157 insertions(+), 25 deletions(-) diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c index 57568958c4df..c85838323b20 100644 --- a/CORE/HDD/src/wlan_hdd_assoc.c +++ b/CORE/HDD/src/wlan_hdd_assoc.c @@ -1286,6 +1286,12 @@ static void hdd_SendReAssocEvent(struct net_device *dev, tANI_U32 rspRsnLength = 0; struct ieee80211_channel *chan; hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); + uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes for EID and len */ + uint8_t *buf_ptr, ssid_ie_len; + struct cfg80211_bss *bss = NULL; + uint8_t *final_req_ie = NULL; + tCsrRoamConnectedProfile roam_profile; + tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(pAdapter); if (!rspRsnIe) { hddLog(LOGE, FL("Unable to allocate RSN IE")); @@ -1329,14 +1335,50 @@ static void hdd_SendReAssocEvent(struct net_device *dev, chan = ieee80211_get_channel(pAdapter->wdev.wiphy, (int)pCsrRoamInfo->pBssDesc->channelId); - cfg80211_roamed(dev, chan, pCsrRoamInfo->bssid, - reqRsnIe, reqRsnLength, - rspRsnIe, rspRsnLength,GFP_KERNEL); + memset(&roam_profile, 0, sizeof(tCsrRoamConnectedProfile)); + sme_RoamGetConnectProfile(hal_handle, pAdapter->sessionId, &roam_profile); + bss = cfg80211_get_bss(pAdapter->wdev.wiphy, chan, pCsrRoamInfo->bssid, + &roam_profile.SSID.ssId[0], roam_profile.SSID.length, + WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); + + if (bss == NULL) + hddLog(LOGE, FL("Get BSS returned NULL")); + buf_ptr = buf_ssid_ie; + *buf_ptr = SIR_MAC_SSID_EID; + buf_ptr++; + *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ + buf_ptr++; + vos_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], + roam_profile.SSID.length); + ssid_ie_len = 2 + roam_profile.SSID.length; + hddLog(LOG2, FL("SSIDIE:")); + VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG, + buf_ssid_ie, ssid_ie_len); + final_req_ie = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL); + if (final_req_ie == NULL) + goto done; + buf_ptr = final_req_ie; + vos_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); + buf_ptr += ssid_ie_len; + vos_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); + memcpy(rspRsnIe, pFTAssocRsp, len); + memset(final_req_ie + (ssid_ie_len + reqRsnLength), 0, + IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); + hddLog(LOG2, FL("Req RSN IE:")); + VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG, + final_req_ie, (ssid_ie_len +reqRsnLength)); + cfg80211_roamed_bss(dev, bss, + final_req_ie, (ssid_ie_len + reqRsnLength), + rspRsnIe, rspRsnLength, GFP_KERNEL); + wlan_hdd_send_roam_auth_event(pHddCtx, pCsrRoamInfo->bssid, reqRsnIe, reqRsnLength, rspRsnIe, rspRsnLength, pCsrRoamInfo); done: - kfree(rspRsnIe); + sme_RoamFreeConnectProfile(hal_handle, &roam_profile); + if (final_req_ie) + kfree(final_req_ie); + kfree(rspRsnIe); } void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter) diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c index 86fdb9086082..5ab432737b48 100644 --- a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c +++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c @@ -966,12 +966,16 @@ limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length, tpSirSmeScanRsp pSirSmeScanRsp=NULL; tLimScanResultNode *ptemp = NULL; tANI_U16 msgLen, allocLength, curMsgLen = 0; - tANI_U16 i, bssCount; + tANI_U16 i, bssCount, j; tANI_U8 *pbBuf; tSirBssDescription *pDesc; tANI_S16 scanEntriesLeft = 0; tANI_U8 *currentBssid = pMac->roam.roamSession[smesessionId].connectedProfile.bssid; + struct roam_ext_params *roam_params; + bool ssid_list_match = false; + + roam_params = &pMac->roam.configParam.roam_params; limLog(pMac, LOG1, FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"), @@ -1080,9 +1084,22 @@ limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length, ptemp = pMac->lim.gLimCachedScanHashTable[i]; while(ptemp) { - if(vos_mem_compare((tANI_U8* ) ptemp->bssDescription.ieFields+1, - (tANI_U8 *) &pSsid->length, - (tANI_U8) (pSsid->length + 1))) + ssid_list_match = false; + for (j = 0; j < roam_params->num_ssid_allowed_list; j++) { + if(vos_mem_compare((tANI_U8* ) ptemp->bssDescription.ieFields+1, + (tANI_U8 *) &roam_params->ssid_allowed_list[j].length, + (tANI_U8) (roam_params->ssid_allowed_list[j].length + 1))) { + VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG, + FL("SSID Match with allowedlist")); + ssid_list_match = true; + break; + } + } + + if(ssid_list_match || + vos_mem_compare((tANI_U8* ) ptemp->bssDescription.ieFields+1, + (tANI_U8 *) &pSsid->length, + (tANI_U8) (pSsid->length + 1))) { if (vos_mem_compare(ptemp->bssDescription.bssId, currentBssid, @@ -1148,6 +1165,9 @@ limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length, pSirSmeScanRsp->sessionId = smesessionId; pSirSmeScanRsp->transcationId = smetranscationId; + } else { + PELOG2(limLog(pMac, LOG2, FL("SSID Mismatch with BSSID")); + limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);) } ptemp = ptemp->next; } //while(ptemp) diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h index e8f8de697fb1..c505aaebfff3 100644 --- a/CORE/SME/inc/csrApi.h +++ b/CORE/SME/inc/csrApi.h @@ -411,6 +411,12 @@ typedef struct tagCsrScanResultFilter tANI_U8 MFPRequired; tANI_U8 MFPCapable; #endif + /* The following flag is used to distinguish the + * roaming case while building the scan filter and + * applying it on to the scan results. This is mainly + * used to support whitelist ssid feature. + */ + uint8_t scan_filter_for_roam; }tCsrScanResultFilter; diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 35bd55933fc3..dd323b309478 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -8452,6 +8452,7 @@ void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisass if(HAL_STATUS_SUCCESS(status)) { vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); + pScanFilter->scan_filter_for_roam = 1; status = csrRoamPrepareFilterFromProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile, pScanFilter); @@ -9347,8 +9348,12 @@ eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile tCsrScanResultFilter *pScanFilter) { eHalStatus status = eHAL_STATUS_SUCCESS; - tANI_U32 size = 0; + uint32_t size = 0; tANI_U8 index = 0; + struct roam_ext_params *roam_params; + uint8_t i; + + roam_params = &pMac->roam.configParam.roam_params; do { @@ -9379,6 +9384,35 @@ eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join pScanFilter->SSIDs.numOfSSIDs = 1; } + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, + FL("No of Allowed List:%d"), roam_params->num_ssid_allowed_list); + if (pScanFilter->scan_filter_for_roam + && roam_params->num_ssid_allowed_list) { + pScanFilter->SSIDs.numOfSSIDs = + (1 + roam_params->num_ssid_allowed_list); + size = sizeof(tCsrSSIDInfo) * pScanFilter->SSIDs.numOfSSIDs; + pScanFilter->SSIDs.SSIDList = vos_mem_malloc(size); + if ( NULL == pScanFilter->SSIDs.SSIDList) + status = eHAL_STATUS_FAILURE; + else + status = eHAL_STATUS_SUCCESS; + if(!HAL_STATUS_SUCCESS(status)) + break; + for (i=0; inum_ssid_allowed_list; i++) { + vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList[i].SSID.ssId, + roam_params->ssid_allowed_list[i].ssId, + roam_params->ssid_allowed_list[i].length); + pScanFilter->SSIDs.SSIDList[i].SSID.length = + roam_params->ssid_allowed_list[i].length; + pScanFilter->SSIDs.SSIDList[i].handoffPermitted = 1; + pScanFilter->SSIDs.SSIDList[i].ssidHidden = 0; + } + vos_mem_copy(pScanFilter->SSIDs.SSIDList[i].SSID.ssId, + pProfile->SSIDs.SSIDList->SSID.ssId, + pProfile->SSIDs.SSIDList->SSID.length); + pScanFilter->SSIDs.SSIDList[i].handoffPermitted = 1; + pScanFilter->SSIDs.SSIDList[i].ssidHidden = 0; + } else { size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; pScanFilter->SSIDs.SSIDList = vos_mem_malloc(size); if ( NULL == pScanFilter->SSIDs.SSIDList ) @@ -9391,6 +9425,7 @@ eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile } vos_mem_copy(pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, size); + } } if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) { diff --git a/CORE/SME/src/csr/csrNeighborRoam.c b/CORE/SME/src/csr/csrNeighborRoam.c index 59d8bc506a2b..73d0609e29a0 100644 --- a/CORE/SME/src/csr/csrNeighborRoam.c +++ b/CORE/SME/src/csr/csrNeighborRoam.c @@ -1782,6 +1782,7 @@ csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, &pMac->roam.neighborRoamInfo[sessionId]; tCsrRoamConnectedProfile *pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile; tANI_U8 i = 0; + struct roam_ext_params *roam_params; VOS_ASSERT(pScanFilter != NULL); if (pScanFilter == NULL) @@ -1789,9 +1790,10 @@ csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter)); + roam_params = &pMac->roam.configParam.roam_params; /* We dont want to set BSSID based Filter */ pScanFilter->BSSIDs.numOfBSSIDs = 0; - + pScanFilter->scan_filter_for_roam = 1; //only for HDD requested handoff fill in the BSSID in the filter #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD if (pNeighborRoamInfo->uOsRequestedHandoff) @@ -1814,24 +1816,51 @@ csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, } } #endif - /* Populate all the information from the connected profile */ - pScanFilter->SSIDs.numOfSSIDs = 1; - pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); - if (NULL == pScanFilter->SSIDs.SSIDList) - { - smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed")); - return eHAL_STATUS_FAILED_ALLOC; - } - pScanFilter->SSIDs.SSIDList->handoffPermitted = 1; - pScanFilter->SSIDs.SSIDList->ssidHidden = 0; - pScanFilter->SSIDs.SSIDList->SSID.length = pCurProfile->SSID.length; - vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length); + VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, + FL("No of Allowed SSID List:%d"), roam_params->num_ssid_allowed_list); + if (roam_params->num_ssid_allowed_list) { + pScanFilter->SSIDs.numOfSSIDs = (1 + roam_params->num_ssid_allowed_list); + pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * pScanFilter->SSIDs.numOfSSIDs); + if (NULL == pScanFilter->SSIDs.SSIDList) { + smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed")); + return eHAL_STATUS_FAILED_ALLOC; + } + for(i = 0; i < roam_params->num_ssid_allowed_list; i++) { + pScanFilter->SSIDs.SSIDList[i].handoffPermitted = 1; + pScanFilter->SSIDs.SSIDList[i].ssidHidden = 0; + vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList[i].SSID.ssId, + roam_params->ssid_allowed_list[i].ssId, + roam_params->ssid_allowed_list[i].length); + pScanFilter->SSIDs.SSIDList[i].SSID.length = + roam_params->ssid_allowed_list[i].length; + } + vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList[i].SSID.ssId, + (void *)pCurProfile->SSID.ssId, + pCurProfile->SSID.length); + pScanFilter->SSIDs.SSIDList[i].SSID.length = + pCurProfile->SSID.length; + pScanFilter->SSIDs.SSIDList[i].handoffPermitted = 1; + pScanFilter->SSIDs.SSIDList[i].ssidHidden = 0; + } else { + /* Populate all the information from the connected profile */ + pScanFilter->SSIDs.numOfSSIDs = 1; + pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); + if (NULL == pScanFilter->SSIDs.SSIDList) { + smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed")); + return eHAL_STATUS_FAILED_ALLOC; + } + pScanFilter->SSIDs.SSIDList->handoffPermitted = 1; + pScanFilter->SSIDs.SSIDList->ssidHidden = 0; + pScanFilter->SSIDs.SSIDList->SSID.length = pCurProfile->SSID.length; + vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, + (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length); NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Filtering for SSID %.*s from scan results," "length of SSID = %u"), pScanFilter->SSIDs.SSIDList->SSID.length, pScanFilter->SSIDs.SSIDList->SSID.ssId, pScanFilter->SSIDs.SSIDList->SSID.length); + } pScanFilter->authType.numEntries = 1; pScanFilter->authType.authType[0] = pCurProfile->AuthType; @@ -2044,7 +2073,7 @@ csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac, if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi)) { /* Do not roam to an AP with worse RSSI than the current */ - VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, + VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "%s: [INFOLOG]Current AP rssi=%d new ap rssi " "worse=%d", __func__, CurrAPRssi, @@ -2058,7 +2087,7 @@ csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac, */ if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff) { - VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, + VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "%s: [INFOLOG]Current AP rssi=%d new ap " "rssi=%d not good enough, roamRssiDiff=%d", __func__, @@ -2067,7 +2096,7 @@ csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac, RoamRssiDiff); continue; } else { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "%s: [INFOLOG]Current AP rssi=%d new ap " "rssi better=%d", __func__, -- cgit v1.2.3 From 69fed0a7bc96f664eee7768ecb4f5170c0efdd6c Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Mon, 23 Mar 2015 01:44:47 -0700 Subject: qcacld-2.0: Avoid connecting to BSSIDs in black list Do not attempt to make connections to the BSSID's which are present in the blacklist. Avoid them. CRs-Fixed: 813201 Change-Id: I19fe24ca94d34b79a5d86c1313cf24f2db9b4f4c --- CORE/SME/src/csr/csrUtil.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/CORE/SME/src/csr/csrUtil.c b/CORE/SME/src/csr/csrUtil.c index 739837b36b02..bf2ed06df7ec 100644 --- a/CORE/SME/src/csr/csrUtil.c +++ b/CORE/SME/src/csr/csrUtil.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -4857,7 +4857,10 @@ tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrSca tANI_U32 i; tDot11fBeaconIEs *pIes = NULL; tANI_U8 *pb; + tCsrBssid *blacklist_bssid = NULL; + struct roam_ext_params *roam_params; + roam_params = &pMac->roam.configParam.roam_params; do { if( ( NULL == ppIes ) || ( *ppIes ) == NULL ) { @@ -4877,7 +4880,24 @@ tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrSca fCheck = (!pFilter->p2pResult || pIes->P2PBeaconProbeRes.present); if(!fCheck) break; - if(pIes->SSID.present) + /* Check for Blacklist BSSID's and avoid connections */ + fCheck = false; + blacklist_bssid = (tCsrBssid *)&roam_params->bssid_avoid_list; + for (i = 0; i < roam_params->num_bssid_avoid_list; i++) { + if (csrIsMacAddressEqual(pMac, blacklist_bssid, + (tCsrBssid *)pBssDesc->bssId)) { + fCheck = true; + break; + } + blacklist_bssid++; + } + if(fCheck) { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + "Do not Attempt connection to blacklist bssid"); + break; + } + + if(pIes->SSID.present) { for(i = 0; i < pFilter->SSIDs.numOfSSIDs; i++) { @@ -4903,7 +4923,6 @@ tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrSca } } if(!fCheck) break; - fCheck = eANI_BOOLEAN_TRUE; for(i = 0; i < pFilter->ChannelInfo.numOfChannels; i++) { -- cgit v1.2.3 From 0662e730814bab0092c1808ebdcdcd776c755894 Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Wed, 25 Mar 2015 12:12:45 -0700 Subject: qcacld-2.0: Roaming enhancements for candidate selection 1) Prefer 5G Bssid over 2.4G based on the roaming parameters 2) Give preference to the BSSID that is present in the preferred BSSID list CRs-Fixed: 813244 Change-Id: I801cffcbab239484b36348cc370d069428ad84e8 --- CORE/SME/inc/csrInternal.h | 4 ++ CORE/SME/src/csr/csrApiScan.c | 119 +++++++++++++++++++++++++++++++++--------- 2 files changed, 97 insertions(+), 26 deletions(-) diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h index 34fba0eab423..432f3cbdff95 100644 --- a/CORE/SME/inc/csrInternal.h +++ b/CORE/SME/inc/csrInternal.h @@ -80,6 +80,10 @@ ( \ (((pMac)->roam.configParam.nSelect5GHzMargin)?eANI_BOOLEAN_TRUE:eANI_BOOLEAN_FALSE) \ ) +#define CSR_IS_SELECT_5G_PREFERRED(pMac) \ +( \ + (((pMac)->roam.configParam.roam_params.is_5g_pref_enabled)?eANI_BOOLEAN_TRUE:eANI_BOOLEAN_FALSE) \ +) #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) #define CSR_IS_ROAM_PREFER_5GHZ( pMac ) \ diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c index 8590d6bff524..71e7289cb063 100644 --- a/CORE/SME/src/csr/csrApiScan.c +++ b/CORE/SME/src/csr/csrApiScan.c @@ -1921,22 +1921,69 @@ eHalStatus csrScanResultPurge(tpAniSirGlobal pMac, tScanResultHandle hScanList) } -static tANI_U32 csrGetBssPreferValue(tpAniSirGlobal pMac, int rssi) -{ - tANI_U32 ret = 0; - int i = CSR_NUM_RSSI_CAT - 1; - - while(i >= 0) - { - if(rssi >= pMac->roam.configParam.RSSICat[i]) - { - ret = pMac->roam.configParam.BssPreferValue[i]; - break; - } - i--; - }; - - return (ret); +static tANI_U32 csrGetBssPreferValue(tpAniSirGlobal pMac, int rssi, + int roaming_scan, tCsrBssid *bssid, int channel_id) +{ + tANI_U32 ret = 0; + int i, modified_thresh; + struct roam_ext_params *roam_params; + + if (roaming_scan) { + roam_params = &pMac->roam.configParam.roam_params; + /* If the 5G pref feature is enabled, apply the roaming + * parameters to boost or penalize the rssi.*/ + if (CSR_IS_SELECT_5G_PREFERRED(pMac) && + CSR_IS_CHANNEL_5GHZ(channel_id)) { + /* + * Boost Factor = + * boost_factor * (Actual RSSI - boost Threshold) + * Penalty Factor = + * penalty factor * (penalty threshold - Actual RSSI) + */ + /* Check and boost the threshold*/ + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, + FL("Actual RSSI: %d"), rssi); + if (rssi > roam_params->raise_rssi_thresh_5g) { + modified_thresh = roam_params->raise_factor_5g * + (rssi - roam_params->raise_rssi_thresh_5g); + rssi += CSR_MAX(roam_params->max_raise_rssi_5g, + modified_thresh); + } + /* Check and penalize the threshold */ + else if(rssi < roam_params->drop_rssi_thresh_5g) { + modified_thresh = roam_params->drop_factor_5g * + (roam_params->drop_rssi_thresh_5g - rssi); + rssi -= CSR_MAX(roam_params->max_drop_rssi_5g, + modified_thresh); + } + } + /* Check if there are preferred bssid and then apply the + * preferred score*/ + if (roam_params->num_bssid_favored) { + for (i=0; inum_bssid_favored; i++) { + if (csrIsMacAddressEqual(pMac, + &roam_params->bssid_favored[i], + bssid)) { + rssi += roam_params->bssid_favored_factor[i]; + } + } + } + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, + FL("Modified RSSI: %d"), rssi); + } + + i = CSR_NUM_RSSI_CAT - 1; + while(i >= 0) + { + if(rssi >= pMac->roam.configParam.RSSICat[i]) + { + ret = pMac->roam.configParam.BssPreferValue[i]; + break; + } + i--; + }; + + return (ret); } @@ -1945,7 +1992,7 @@ static tANI_U32 csrGetBssCapValue(tpAniSirGlobal pMac, tSirBssDescription *pBssD { tANI_U32 ret = CSR_BSS_CAP_VALUE_NONE; #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) - if(CSR_IS_ROAM_PREFER_5GHZ(pMac)) + if(CSR_IS_ROAM_PREFER_5GHZ(pMac) || CSR_IS_SELECT_5G_PREFERRED(pMac)) { if((pBssDesc) && CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) { @@ -2046,9 +2093,8 @@ static void csrScanAddResult(tpAniSirGlobal pMac, tCsrScanResult *pResult, tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; #endif - - pResult->preferValue = - csrGetBssPreferValue(pMac, (int)pResult->Result.BssDescriptor.rssi); + pResult->preferValue = csrGetBssPreferValue(pMac, + (int)pResult->Result.BssDescriptor.rssi, 0, NULL, 0); pResult->capValue = csrGetBssCapValue(pMac, &pResult->Result.BssDescriptor, pIes); csrLLInsertTail( &pMac->scan.scanResultList, &pResult->Link, LL_ACCESS_LOCK ); @@ -2078,21 +2124,31 @@ eHalStatus csrScanGetResult(tpAniSirGlobal pMac, tCsrScanResultFilter *pFilter, tDot11fBeaconIEs *pIes, *pNewIes; tANI_BOOLEAN fMatch; tANI_U16 i = 0; + struct roam_ext_params *roam_params = NULL; if(phResult) { *phResult = CSR_INVALID_SCANRESULT_HANDLE; } - if (pMac->roam.configParam.nSelect5GHzMargin) + if (pMac->roam.configParam.nSelect5GHzMargin || + (CSR_IS_SELECT_5G_PREFERRED(pMac) && pFilter->scan_filter_for_roam)) { pMac->scan.inScanResultBestAPRssi = -128; + roam_params = &pMac->roam.configParam.roam_params; #ifdef WLAN_DEBUG_ROAM_OFFLOAD - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("nSelect5GHzMargin")); #endif csrLLLock(&pMac->scan.scanResultList); - + /* For roaming scans and 5G preferred roaming, there is no + * need to check the filter match and also re-program the + * RSSI bucket categories, since we use the RSSI values + * while setting the preference value for the BSS. + * There is no need to check the match for roaming since + * it is already done.*/ + if(!(CSR_IS_SELECT_5G_PREFERRED(pMac) + && pFilter->scan_filter_for_roam)) { /* Find out the best AP Rssi going thru the scan results */ pEntry = csrLLPeekHead(&pMac->scan.scanResultList, LL_ACCESS_NOLOCK); while ( NULL != pEntry) @@ -2100,6 +2156,7 @@ eHalStatus csrScanGetResult(tpAniSirGlobal pMac, tCsrScanResultFilter *pFilter, pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); fMatch = FALSE; + if (pFilter) for(i = 0; i < pFilter->SSIDs.numOfSSIDs; i++) { @@ -2160,19 +2217,29 @@ eHalStatus csrScanGetResult(tpAniSirGlobal pMac, tCsrScanResultFilter *pFilter, } pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); } + } - if ( -128 != pMac->scan.inScanResultBestAPRssi) + if ((-128 != pMac->scan.inScanResultBestAPRssi) || + (CSR_IS_SELECT_5G_PREFERRED(pMac) && + pFilter->scan_filter_for_roam)) { smsLog(pMac, LOG1, FL("Best AP Rssi is %d"), pMac->scan.inScanResultBestAPRssi); /* Modify Rssi category based on best AP Rssi */ + if (-128 != pMac->scan.inScanResultBestAPRssi) csrAssignRssiForCategory(pMac, pMac->scan.inScanResultBestAPRssi, pMac->roam.configParam.bCatRssiOffset); + pEntry = csrLLPeekHead(&pMac->scan.scanResultList, LL_ACCESS_NOLOCK); while ( NULL != pEntry) { pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); - /* re-assign preference value based on modified rssi bucket */ - pBssDesc->preferValue = csrGetBssPreferValue(pMac, (int)pBssDesc->Result.BssDescriptor.rssi); + /* re-assign preference value based on (modified rssi bucket (or) + * prefer 5G feature.*/ + pBssDesc->preferValue = csrGetBssPreferValue(pMac, + (int)pBssDesc->Result.BssDescriptor.rssi, + pFilter->scan_filter_for_roam, + &pBssDesc->Result.BssDescriptor.bssId, + pBssDesc->Result.BssDescriptor.channelId); smsLog(pMac, LOG2, FL("BSSID("MAC_ADDRESS_STR ") Rssi(%d) Chnl(%d) PrefVal(%u) SSID=%.*s"), -- cgit v1.2.3 From 2f13baef77385588ee9db7f65431b6d576c612be Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Wed, 25 Mar 2015 12:32:51 -0700 Subject: qcacld: extscan: enhancements to get_capabilities Extend the existing extscan get capabilities to return max_hotlist_ssids, max_number_epno_networks, max_number_epno_networks_by_ssid and max_number_of_white_listed_ssid Change-Id: Ica2175613ce2cf678f239bf6779630042cc3789e CRs-Fixed: 813267 --- CORE/HDD/src/wlan_hdd_cfg80211.c | 163 +++++++++++++++++++++++---------------- CORE/MAC/inc/sirApi.h | 15 +++- CORE/SERVICES/WMA/wma.c | 21 ++++- 3 files changed, 126 insertions(+), 73 deletions(-) diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index fcda50ca04f7..91babae7499f 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -16774,85 +16774,112 @@ int wlan_hdd_cfg80211_set_ap_channel_width(struct wiphy *wiphy, #endif #ifdef FEATURE_WLAN_EXTSCAN - +/** + * wlan_hdd_cfg80211_extscan_get_capabilities_ind() - get capabilities ind + * @ctx: hdd global context + * @data: capabilities data + * + * Return: none + */ static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, - tpSirExtScanCapabilitiesEvent pData) + tpSirExtScanCapabilitiesEvent data) { - hdd_context_t *pHddCtx = (hdd_context_t *)ctx; - struct sk_buff *skb = NULL; - - ENTER(); + hdd_context_t *pHddCtx = (hdd_context_t *)ctx; + struct sk_buff *skb = NULL; - if (wlan_hdd_validate_context(pHddCtx) || !pData) { - hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " - "or pData(%p) is null"), pData); - return; - } + ENTER(); - skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, - NULL, - EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, - QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, - GFP_KERNEL); + if (wlan_hdd_validate_context(pHddCtx) || !data) { + hddLog(LOGE, FL("HDD context is invalid or data(%p) is null"), + data); + return; + } - if (!skb) { - hddLog(VOS_TRACE_LEVEL_ERROR, - FL("cfg80211_vendor_event_alloc failed")); - return; - } + skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, + NULL, + EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, + QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, + GFP_KERNEL); - hddLog(LOG1, "Req Id (%u)", pData->requestId); - hddLog(LOG1, "Scan cache size (%u)", pData->max_scan_cache_size); - hddLog(LOG1, "Scan buckets (%u)", pData->max_scan_buckets); - hddLog(LOG1, "Max AP per scan (%u)", pData->max_ap_cache_per_scan); - hddLog(LOG1, "max_rssi_sample_size (%u)", - pData->max_rssi_sample_size); - hddLog(LOG1, "max_scan_reporting_threshold (%u)", - pData->max_scan_reporting_threshold); - hddLog(LOG1, "max_hotlist_aps (%u)", pData->max_hotlist_aps); - hddLog(LOG1, "max_significant_wifi_change_aps (%u)", - pData->max_significant_wifi_change_aps); - hddLog(LOG1, "max_bssid_history_entries (%u)", - pData->max_bssid_history_entries); + if (!skb) { + hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); + return; + } - if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, - pData->requestId) || - nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, - pData->max_scan_cache_size) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, - pData->max_scan_buckets) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, - pData->max_ap_cache_per_scan) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, - pData->max_rssi_sample_size) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, - pData->max_scan_reporting_threshold) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS, - pData->max_hotlist_aps) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, - pData->max_significant_wifi_change_aps) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, - pData->max_bssid_history_entries)) { - hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); - goto nla_put_failure; - } + hddLog(LOG1, "Req Id (%u)", data->requestId); + hddLog(LOG1, "Scan cache size (%u)", data->max_scan_cache_size); + hddLog(LOG1, "Scan buckets (%u)", data->max_scan_buckets); + hddLog(LOG1, "Max AP per scan (%u)", data->max_ap_cache_per_scan); + hddLog(LOG1, "max_rssi_sample_size (%u)", + data->max_rssi_sample_size); + hddLog(LOG1, "max_scan_reporting_threshold (%u)", + data->max_scan_reporting_threshold); + hddLog(LOG1, "max_hotlist_bssids (%u)", data->max_hotlist_bssids); + hddLog(LOG1, "max_significant_wifi_change_aps (%u)", + data->max_significant_wifi_change_aps); + hddLog(LOG1, "max_bssid_history_entries (%u)", + data->max_bssid_history_entries); + hddLog(LOG1, "max_hotlist_ssids (%u)", data->max_hotlist_ssids); + hddLog(LOG1, "max_number_epno_networks (%u)", + data->max_number_epno_networks); + hddLog(LOG1, "max_number_epno_networks_by_ssid (%u)", + data->max_number_epno_networks_by_ssid); + hddLog(LOG1, "max_number_of_white_listed_ssid (%u)", + data->max_number_of_white_listed_ssid); + + if (nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, + data->requestId) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, + data->status) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, + data->max_scan_cache_size) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, + data->max_scan_buckets) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, + data->max_ap_cache_per_scan) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, + data->max_rssi_sample_size) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, + data->max_scan_reporting_threshold) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS, + data->max_hotlist_bssids) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, + data->max_significant_wifi_change_aps) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, + data->max_bssid_history_entries) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_SSIDS, + data->max_hotlist_ssids) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_EPNO_NETS, + data->max_number_epno_networks) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_EPNO_NETS_BY_SSID, + data->max_number_epno_networks_by_ssid) || + nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_WHITELISTED_SSID, + data->max_number_of_white_listed_ssid)) { + hddLog(LOGE, FL("nla put fail")); + goto nla_put_failure; + } - cfg80211_vendor_event(skb, GFP_KERNEL); - return; + cfg80211_vendor_event(skb, GFP_KERNEL); + return; nla_put_failure: - kfree_skb(skb); - return; + kfree_skb(skb); + return; } diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h index aff408675f12..16b32c6995da 100644 --- a/CORE/MAC/inc/sirApi.h +++ b/CORE/MAC/inc/sirApi.h @@ -4874,10 +4874,17 @@ typedef struct * @max_ap_cache_per_scan: maximum number of APs that can be stored per scan * @max_rssi_sample_size: number of RSSI samples used for averaging RSSI * @ax_scan_reporting_threshold: max possible report_threshold - * @max_hotlist_aps: maximum number of entries for hotlist APs + * @max_hotlist_bssids: maximum number of entries for hotlist APs * @max_significant_wifi_change_aps: maximum number of entries for * significant wifi change APs * @max_bssid_history_entries: number of BSSID/RSSI entries that device can hold + * @max_hotlist_ssids: maximum number of entries for hotlist SSIDs + * @max_number_epno_networks: max number of epno entries + * @max_number_epno_networks_by_ssid: max number of epno entries + * if ssid is specified, that is, epno entries for + * which an exact match is required, + * or entries corresponding to hidden ssids + * @max_number_of_white_listed_ssid: max number of white listed SSIDs */ typedef struct { @@ -4890,10 +4897,14 @@ typedef struct uint32_t max_rssi_sample_size; uint32_t max_scan_reporting_threshold; - uint32_t max_hotlist_aps; + uint32_t max_hotlist_bssids; uint32_t max_significant_wifi_change_aps; uint32_t max_bssid_history_entries; + uint32_t max_hotlist_ssids; + uint32_t max_number_epno_networks; + uint32_t max_number_epno_networks_by_ssid; + uint32_t max_number_of_white_listed_ssid; } tSirExtScanCapabilitiesEvent, *tpSirExtScanCapabilitiesEvent; diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index a58f80764e4e..5a338f1cef06 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -2832,20 +2832,35 @@ static int wma_extscan_capabilities_event_handler (void *handle, dest_capab->max_scan_reporting_threshold = src_cache->max_table_usage_threshold; - dest_capab->max_hotlist_aps = src_hotlist->max_hotlist_entries; + dest_capab->max_hotlist_bssids = src_hotlist->max_hotlist_entries; dest_capab->max_rssi_sample_size = src_change->max_rssi_averaging_samples; dest_capab->max_bssid_history_entries = src_change->max_rssi_history_entries; dest_capab->max_significant_wifi_change_aps = src_change->max_wlan_change_entries; + dest_capab->max_hotlist_ssids = + event->num_extscan_hotlist_ssid; + dest_capab->max_number_epno_networks = + event->num_epno_networks; + dest_capab->max_number_epno_networks_by_ssid = + event->num_epno_networks; + dest_capab->max_number_of_white_listed_ssid = + event->num_roam_ssid_whitelist; dest_capab->status = 0; WMA_LOGD("%s: Capabilities: max_scan_buckets: %d," - "max_hotlist_aps: %d,max_scan_cache_size: %d", + "max_hotlist_bssids: %d, max_scan_cache_size: %d", __func__, dest_capab->max_scan_buckets, - dest_capab->max_hotlist_aps, + dest_capab->max_hotlist_bssids, dest_capab->max_scan_cache_size); + WMA_LOGD("%s: Capabilities: max_hotlist_ssids: %d," + "max_number_epno_networks: %d, max_number_epno_networks_by_ssid: %d," + "max_number_of_white_listed_ssid: %d", + __func__, dest_capab->max_hotlist_ssids, + dest_capab->max_number_epno_networks, + dest_capab->max_number_epno_networks_by_ssid, + dest_capab->max_number_of_white_listed_ssid); pMac->sme.pExtScanIndCb(pMac->hHdd, eSIR_EXTSCAN_GET_CAPABILITIES_IND, -- cgit v1.2.3 From 7a6ce42fc4d0e15e1bfc15ff50890eb3c654b01a Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Wed, 25 Mar 2015 19:36:41 -0700 Subject: qcacld: extscan: update timestamp granularity Firmware now passes timestamp in msec instead of sec, hence the fix to update the timestamp appropriately. Change-Id: Ifaabea7ed9d68618000e836896975a42775508fd CRs-Fixed: 813484 --- CORE/SERVICES/WMA/wma.c | 2 +- CORE/SERVICES/WMA/wma.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 5a338f1cef06..00f2df090b6a 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -3089,7 +3089,7 @@ static int wma_extscan_cached_results_event_handler(void *handle, dest_ap = &dest_result->ap[0]; } dest_ap->channel = src_hotlist->channel; - dest_ap->ts = src_rssi->tstamp * WMA_SEC_TO_USEC; + dest_ap->ts = WMA_MSEC_TO_USEC(src_rssi->tstamp); dest_ap->rtt = src_hotlist->rtt; dest_ap->rtt_sd = src_hotlist->rtt_sd; dest_ap->beaconPeriod = src_hotlist->beacon_interval; diff --git a/CORE/SERVICES/WMA/wma.h b/CORE/SERVICES/WMA/wma.h index dfa249e08cdb..a419219322c3 100644 --- a/CORE/SERVICES/WMA/wma.h +++ b/CORE/SERVICES/WMA/wma.h @@ -1269,6 +1269,7 @@ VOS_STATUS wma_send_snr_request(tp_wma_handle wma_handle, void *pGetRssiReq, #define WMA_NLO_FREQ_THRESH 1000 /* in MHz */ #define WMA_SEC_TO_MSEC(sec) (sec * 1000) /* sec to msec */ +#define WMA_MSEC_TO_USEC(msec) (msec * 1000) /* msec to usec */ /* Default rssi threshold defined in CFG80211 */ #define WMA_RSSI_THOLD_DEFAULT -300 -- cgit v1.2.3 From e184390adc800cc1eea8fa6b15c6adda70bf349a Mon Sep 17 00:00:00 2001 From: AnjaneeDevi Kapparapu Date: Thu, 26 Mar 2015 13:21:12 +0530 Subject: Cafstaging Release 4.0.10.62 Cafstaging Release 4.0.10.62 Change-Id: I68e3e04d1550ad6bd8e9ec348e2268dbcce09111 CRs-Fixed: 688141 --- CORE/MAC/inc/qwlan_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CORE/MAC/inc/qwlan_version.h b/CORE/MAC/inc/qwlan_version.h index 1d60a6cb29be..91aa353cb4df 100644 --- a/CORE/MAC/inc/qwlan_version.h +++ b/CORE/MAC/inc/qwlan_version.h @@ -42,9 +42,9 @@ BRIEF DESCRIPTION: #define QWLAN_VERSION_MINOR 0 #define QWLAN_VERSION_PATCH 10 #define QWLAN_VERSION_EXTRA "" -#define QWLAN_VERSION_BUILD 61 +#define QWLAN_VERSION_BUILD 62 -#define QWLAN_VERSIONSTR "4.0.10.61" +#define QWLAN_VERSIONSTR "4.0.10.62" #define AR6320_REV1_VERSION 0x5000000 -- cgit v1.2.3