From 42dade0dd8f04a4acd0231c39e4403719bcacd4a Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Fri, 12 May 2017 19:20:37 +0800 Subject: [PATCH] qcacld-3.0: Associate in 1x1 when connected to a certain Vendor AP When connected to a certain Vendor AP that cannot handle SMPS frame, only connect in 1x1. Change-Id: Ieae25191df8340a582e81dc716b9a1aee6a71921 CRs-Fixed: 2047347 --- core/hdd/src/wlan_hdd_main.c | 4 ++ core/mac/inc/sir_mac_prot_def.h | 2 + core/mac/src/pe/lim/lim_prop_exts_utils.c | 45 +++++++++++++++++++++++ core/wma/src/wma_dev_if.c | 6 +-- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index e34e8166af20..9795a9bc8103 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9281,6 +9281,10 @@ int hdd_wlan_startup(struct device *dev) set_value, PDEV_CMD); } + if (hdd_ctx->config->is_force_1x1) + wma_cli_set_command(0, (int)WMI_PDEV_PARAM_SET_IOT_PATTERN, + 1, PDEV_CMD); + qdf_mc_timer_start(&hdd_ctx->iface_change_timer, hdd_ctx->config->iface_change_wait_time * 5000); diff --git a/core/mac/inc/sir_mac_prot_def.h b/core/mac/inc/sir_mac_prot_def.h index dc7745a41552..091dff10b518 100644 --- a/core/mac/inc/sir_mac_prot_def.h +++ b/core/mac/inc/sir_mac_prot_def.h @@ -617,6 +617,8 @@ #define BA_INITIATOR 2 #define BA_BOTH_DIRECTIONS 3 +#define SIR_MAC_VENDOR_AP_1_OUI "\x00\x0C\x43" +#define SIR_MAC_VENDOR_AP_1_OUI_LEN 3 /* / Status Code (present in Management response frames) enum */ typedef enum eSirMacStatusCodes { diff --git a/core/mac/src/pe/lim/lim_prop_exts_utils.c b/core/mac/src/pe/lim/lim_prop_exts_utils.c index c30da045ea7d..ab8682fc008a 100644 --- a/core/mac/src/pe/lim/lim_prop_exts_utils.c +++ b/core/mac/src/pe/lim/lim_prop_exts_utils.c @@ -88,6 +88,39 @@ static void get_local_power_constraint_probe_response( } #endif +/** + * lim_get_nss_supported_by_beacon() - finds out nss from beacom + * @bcn: beacon structure pointer + * @session: pointer to pe session + * + * Return: number of nss advertised by beacon + */ +static uint8_t lim_get_nss_supported_by_beacon(tpSchBeaconStruct bcn, + tpPESession session) +{ + if (session->vhtCapability && bcn->VHTCaps.present) { + if ((bcn->VHTCaps.rxMCSMap & 0xC0) != 0xC0) + return 4; + + if ((bcn->VHTCaps.rxMCSMap & 0x30) != 0x30) + return 3; + + if ((bcn->VHTCaps.rxMCSMap & 0x0C) != 0x0C) + return 2; + } else if (session->htCapability && bcn->HTCaps.present) { + if (bcn->HTCaps.supportedMCSSet[3]) + return 4; + + if (bcn->HTCaps.supportedMCSSet[2]) + return 3; + + if (bcn->HTCaps.supportedMCSSet[1]) + return 2; + } + + return 1; +} + /** * lim_extract_ap_capability() - extract AP's HCF/WME/WSM capability * @mac_ctx: Pointer to Global MAC structure @@ -138,6 +171,18 @@ lim_extract_ap_capability(tpAniSirGlobal mac_ctx, uint8_t *p_ie, qdf_mem_free(beacon_struct); return; } + + if (mac_ctx->roam.configParam.is_force_1x1 && + cfg_get_vendor_ie_ptr_from_oui(mac_ctx, SIR_MAC_VENDOR_AP_1_OUI, + SIR_MAC_VENDOR_AP_1_OUI_LEN, p_ie, ie_len) && + lim_get_nss_supported_by_beacon(beacon_struct, session) == 2) { + session->supported_nss_1x1 = true; + session->vdev_nss = 1; + session->nss = 1; + pe_debug("For special ap, NSS: %d", session->nss); + } + + if (beacon_struct->wmeInfoPresent || beacon_struct->wmeEdcaPresent || beacon_struct->HTCaps.present) diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 4d2170dd9ea3..b1d6546f266d 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -3157,7 +3157,7 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss) if (!QDF_IS_STATUS_SUCCESS(status)) WMA_LOGE("policy_mgr_get_current_hw_mode failed"); - if ((add_bss->nss == 2) && !hw_mode.dbs_cap) { + if (add_bss->nss == 2) { req.preferred_rx_streams = 2; req.preferred_tx_streams = 2; } else { @@ -3306,7 +3306,7 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, tpAddBssParams add_bss) if (!QDF_IS_STATUS_SUCCESS(status)) WMA_LOGE("policy_mgr_get_current_hw_mode failed"); - if ((add_bss->nss == 2) && !hw_mode.dbs_cap) { + if (add_bss->nss == 2) { req.preferred_rx_streams = 2; req.preferred_tx_streams = 2; } else { @@ -3491,7 +3491,7 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss) if (!QDF_IS_STATUS_SUCCESS(status)) WMA_LOGE("policy_mgr_get_current_hw_mode failed"); - if ((add_bss->nss == 2) && !hw_mode.dbs_cap) { + if (add_bss->nss == 2) { req.preferred_rx_streams = 2; req.preferred_tx_streams = 2; } else {