From 745f9e7d1fb239642e51bc9da5a3ce897eee0799 Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Thu, 19 Mar 2020 16:04:10 -0700 Subject: [PATCH] qcacld-3.0: Update phymode before starting SAP and STA Check phymode to verify it is allowed for the current country before starting SAP or connecting STA. Change-Id: Ica5e70bbd421c4dc18a34545f63e436bc482fc46 CRs-fixed: 2658294 --- core/hdd/src/wlan_hdd_cfg80211.c | 6 ++++++ core/hdd/src/wlan_hdd_hostapd.c | 8 ++++++++ core/sap/inc/sap_api.h | 1 + 3 files changed, 15 insertions(+) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index fbbcab295e0e1..273365b34face 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -17667,6 +17667,7 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, uint8_t value = 0; struct wlan_objmgr_vdev *vdev; uint32_t channel_bonding_mode; + enum reg_phymode phy_mode; hdd_ctx = WLAN_HDD_GET_CTX(adapter); hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); @@ -17889,6 +17890,11 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, } } + phy_mode = wlan_reg_get_max_phymode(hdd_ctx->pdev, + REG_PHYMODE_MAX, + oper_freq); + roam_profile->phyMode = csr_convert_from_reg_phy_mode(phy_mode); + if ((policy_mgr_is_hw_dbs_capable(hdd_ctx->psoc) == true) && (false == wlan_hdd_handle_sap_sta_dfs_conc(adapter, roam_profile))) { diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 17e0da62e4010..b4113474ded4f 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -5061,6 +5061,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, bool bval = false; bool enable_dfs_scan = true; struct s_ext_cap *p_ext_cap; + enum reg_phymode reg_phy_mode, updated_phy_mode; hdd_enter(); @@ -5556,6 +5557,13 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, config->SapHw_mode = eCSR_DOT11_MODE_11n; } + config->sap_orig_hw_mode = config->SapHw_mode; + reg_phy_mode = csr_convert_to_reg_phy_mode(config->SapHw_mode, + config->chan_freq); + updated_phy_mode = wlan_reg_get_max_phymode(hdd_ctx->pdev, reg_phy_mode, + config->chan_freq); + config->SapHw_mode = csr_convert_from_reg_phy_mode(updated_phy_mode); + qdf_mem_zero(sme_config, sizeof(*sme_config)); sme_get_config_param(mac_handle, sme_config); /* Override hostapd.conf wmm_enabled only for 11n and 11AC configs (IOT) diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 676ac49a43784..403835abd0468 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -474,6 +474,7 @@ enum sap_acs_dfs_mode { struct sap_config { tSap_SSIDInfo_t SSIDinfo; + eCsrPhyMode sap_orig_hw_mode; /* Previous wireless Mode */ eCsrPhyMode SapHw_mode; /* Wireless Mode */ eSapMacAddrACL SapMacaddr_acl; struct qdf_mac_addr accept_mac[MAX_ACL_MAC_ADDRESS]; /* MAC filtering */