From d7ff6aef93fe3e7f9865058a96f5867f3420f58a Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Fri, 22 Jan 2016 10:56:07 +0800 Subject: [PATCH] qcacld-3.0: Update channel width and center freq qcacld-2.0 to qcacld-3.0 propagation "cfg80211_chandef_create" doesn't support channel width "HT80". If create chandef by it, channel width set to HT40 when working on SAP VHT80 mode. Which cause a mismatch between supplicant and host driver. Update channel width and center freq for VHT80 mode Change-Id: I9c5734fca4bcc02436aea8684ca9d0b968eb1dee CRs-Fixed: 944618 --- core/hdd/src/wlan_hdd_hostapd.c | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 9ddd3fd6d48a..97a3142d0fc8 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -619,6 +619,77 @@ hdd_sap_get_phymode(hdd_adapter_t *hostapd_adapter) } #endif +/** + * hdd_update_chandef() - Function to update channel width and center freq + * @hostapd_adapter: hostapd adapter + * @chandef: cfg80211 chan def + * @cb_mode: chan offset + * + * This function will be called to update channel width and center freq + * + * Return: None + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) || defined(WITH_BACKPORTS) +static inline void +hdd_update_chandef(hdd_adapter_t *hostapd_adapter, + struct cfg80211_chan_def *chandef, + ePhyChanBondState cb_mode) +{ + uint16_t ch_width; + hdd_ap_ctx_t *phdd_ap_ctx; + uint8_t center_chan, chan; + + phdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(hostapd_adapter); + ch_width = phdd_ap_ctx->sapConfig.acs_cfg.ch_width; + + switch (ch_width) { + case eHT_CHANNEL_WIDTH_20MHZ: + case eHT_CHANNEL_WIDTH_40MHZ: + hdd_info("ch_width %d, won't update", ch_width); + break; + case eHT_CHANNEL_WIDTH_80MHZ: + chan = cds_freq_to_chan(chandef->chan->center_freq); + chandef->width = NL80211_CHAN_WIDTH_80; + + switch (cb_mode) { + case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: + case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: + center_chan = chan + 2; + break; + case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: + center_chan = chan + 6; + break; + case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: + case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: + center_chan = chan - 2; + break; + case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: + center_chan = chan - 6; + break; + default: + center_chan = chan; + break; + } + + chandef->center_freq1 = cds_chan_to_freq(center_chan); + break; + case eHT_CHANNEL_WIDTH_160MHZ: + default: + /* Todo, please add related codes if support 160MHZ or others */ + hdd_err("unsupport ch_width %d", ch_width); + break; + } + +} +#else +static inline void +hdd_update_chandef(hdd_adapter_t *hostapd_adapter, + struct cfg80211_chan_def *chandef, + ePhyChanBondState cb_mode) +{ +} +#endif + /** * hdd_chan_change_notify() - Function to notify hostapd about channel change * @hostapd_adapter hostapd adapter @@ -689,6 +760,10 @@ CDF_STATUS hdd_chan_change_notify(hdd_adapter_t *hostapd_adapter, cfg80211_chandef_create(&chandef, chan, channel_type); + if ((phy_mode == eCSR_DOT11_MODE_11ac) || + (phy_mode == eCSR_DOT11_MODE_11ac_ONLY)) + hdd_update_chandef(hostapd_adapter, &chandef, cb_mode); + cfg80211_ch_switch_notify(dev, &chandef); return CDF_STATUS_SUCCESS;