From 692455f0216cc5804886efa8a29f0c95c0fef266 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Fri, 9 Aug 2019 17:59:46 +0800 Subject: [PATCH] qcacld-3.0: Populate 6GHz channel list to wiphy Use separate band - NL80211_BAND_6GHZ for 6GHz channel list population. And 6GHz channels are reported only when CFG80211_6GHZ_BAND_SUPPORTED and CONFIG_BAND_6GHZ feature flags are defined. Change-Id: Ieec30b304a7c3e8e856f290afdb4177206aeb2c7 CRs-Fixed: 2524262 --- core/hdd/inc/wlan_hdd_main.h | 5 +++ core/hdd/src/wlan_hdd_cfg80211.c | 58 ++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_regulatory.c | 20 +++++++++-- 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index f7241cad11..99cc0c962c 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -168,6 +168,11 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); } #define HDD_NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS) #endif +#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ + (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) +#define HDD_NL80211_BAND_6GHZ NL80211_BAND_6GHZ +#endif + #define TSF_GPIO_PIN_INVALID 255 /** Length of the TX queue for the netdev */ diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 9a27db5e04..2561509e22 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -372,6 +372,62 @@ static struct ieee80211_supported_band wlan_hdd_band_5_ghz = { .vht_cap.vht_supported = 1, }; +#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ + (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) + +static struct ieee80211_channel hdd_channels_6_ghz[NUM_6GHZ_CHANNELS]; + +static struct ieee80211_supported_band wlan_hdd_band_6_ghz = { + .channels = NULL, + .n_channels = 0, + .band = HDD_NL80211_BAND_6GHZ, + .bitrates = a_mode_rates, + .n_bitrates = a_mode_rates_size, + .ht_cap.ht_supported = 1, + .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 + | IEEE80211_HT_CAP_GRN_FLD + | IEEE80211_HT_CAP_DSSSCCK40 + | IEEE80211_HT_CAP_LSIG_TXOP_PROT + | IEEE80211_HT_CAP_SGI_40 + | IEEE80211_HT_CAP_SUP_WIDTH_20_40, + .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, + .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, + .ht_cap.mcs.rx_mask = {0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, + .ht_cap.mcs.rx_highest = cpu_to_le16(72), + .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, + .vht_cap.vht_supported = 1, +}; + +#define HDD_SET_6GHZCHAN(ch, freq, chan, flag) { \ + (ch).band = HDD_NL80211_BAND_6GHZ; \ + (ch).center_freq = (freq); \ + (ch).hw_value = (chan); \ + (ch).flags = (flag); \ + (ch).max_antenna_gain = 0; \ + (ch).max_power = 0; \ +} + +static void hdd_init_6ghz(struct hdd_context *hdd_ctx) +{ + uint32_t i; + struct wiphy *wiphy = hdd_ctx->wiphy; + struct ieee80211_channel *chlist = hdd_channels_6_ghz; + uint32_t num = ARRAY_SIZE(hdd_channels_6_ghz); + + qdf_mem_zero(chlist, sizeof(*chlist) * num); + for (i = 0; i < num; i++) + HDD_SET_6GHZCHAN(chlist[i], 5945 + i * 20, 1 + i * 4, \ + IEEE80211_CHAN_DISABLED); + wiphy->bands[HDD_NL80211_BAND_6GHZ] = &wlan_hdd_band_6_ghz; + wiphy->bands[HDD_NL80211_BAND_6GHZ]->channels = chlist; + wiphy->bands[HDD_NL80211_BAND_6GHZ]->n_channels = num; +} +#else +static void hdd_init_6ghz(struct hdd_context *hdd_ctx) +{ +} +#endif + /* This structure contain information what kind of frame are expected in * TX/RX direction for each kind of interface */ @@ -15067,6 +15123,8 @@ QDF_STATUS wlan_hdd_update_wiphy_supported_band(struct hdd_context *hdd_ctx) HDD_NL80211_BAND_5GHZ]->channels + len_5g_ch, len_srd_ch); + hdd_init_6ghz(hdd_ctx); + return QDF_STATUS_SUCCESS; } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 508269b13c..ec38cb55bd 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1357,6 +1357,22 @@ void hdd_send_wiphy_regd_sync_event(struct hdd_context *hdd_ctx) } #endif +#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ + (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) +static void +fill_wiphy_6ghz_band_channels(struct wiphy *wiphy, + struct regulatory_channel *chan_list) +{ + fill_wiphy_band_channels(wiphy, chan_list, NL80211_BAND_6GHZ); +} +#else +static void +fill_wiphy_6ghz_band_channels(struct wiphy *wiphy, + struct regulatory_channel *chan_list) +{ +} +#endif + static void hdd_regulatory_dyn_cbk(struct wlan_objmgr_psoc *psoc, struct wlan_objmgr_pdev *pdev, struct regulatory_channel *chan_list, @@ -1377,7 +1393,7 @@ static void hdd_regulatory_dyn_cbk(struct wlan_objmgr_psoc *psoc, fill_wiphy_band_channels(wiphy, chan_list, NL80211_BAND_2GHZ); fill_wiphy_band_channels(wiphy, chan_list, NL80211_BAND_5GHZ); - + fill_wiphy_6ghz_band_channels(wiphy, chan_list); cc_src = ucfg_reg_get_cc_and_src(hdd_ctx->psoc, alpha2); qdf_mem_copy(hdd_ctx->reg.alpha2, alpha2, REG_ALPHA2_LEN + 1); sme_set_cc_src(hdd_ctx->mac_handle, cc_src); @@ -1440,7 +1456,7 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy) NL80211_BAND_2GHZ); fill_wiphy_band_channels(wiphy, cur_chan_list, NL80211_BAND_5GHZ); - + fill_wiphy_6ghz_band_channels(wiphy, cur_chan_list); cc_src = ucfg_reg_get_cc_and_src(hdd_ctx->psoc, alpha2); qdf_mem_copy(hdd_ctx->reg.alpha2, alpha2, REG_ALPHA2_LEN + 1); sme_set_cc_src(hdd_ctx->mac_handle, cc_src);