diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 6e06194b9939..90d3b988c243 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1603,6 +1603,11 @@ struct hdd_context { struct ieee80211_sband_iftype_data *iftype_data_5g; #endif +#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ + (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) + + struct ieee80211_sband_iftype_data *iftype_data_6g; +#endif /* Completion variable to indicate Mc Thread Suspended */ struct completion mc_sus_event_var; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index edf0ed9a6f90..1a1e7a84e486 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -395,19 +395,6 @@ static struct ieee80211_supported_band wlan_hdd_band_6_ghz = { .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) { \ @@ -14969,6 +14956,27 @@ wlan_hdd_populate_srd_chan_info(struct hdd_context *hdd_ctx, uint32_t index) #endif +#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ + (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) +static QDF_STATUS +wlan_hdd_iftype_data_alloc_6ghz(struct hdd_context *hdd_ctx) +{ + hdd_ctx->iftype_data_6g = + qdf_mem_malloc(sizeof(*hdd_ctx->iftype_data_6g)); + + if (!hdd_ctx->iftype_data_6g) + return QDF_STATUS_E_NOMEM; + + return QDF_STATUS_SUCCESS; +} +#else +static inline QDF_STATUS +wlan_hdd_iftype_data_alloc_6ghz(struct hdd_context *hdd_ctx) +{ + return QDF_STATUS_SUCCESS; +} +#endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) static QDF_STATUS wlan_hdd_iftype_data_alloc(struct hdd_context *hdd_ctx) @@ -14990,6 +14998,15 @@ wlan_hdd_iftype_data_alloc(struct hdd_context *hdd_ctx) return QDF_STATUS_E_NOMEM; } + if (QDF_IS_STATUS_ERROR(wlan_hdd_iftype_data_alloc_6ghz(hdd_ctx))) { + hdd_err("mem alloc failed for 6g iftype data"); + qdf_mem_free(hdd_ctx->iftype_data_5g); + qdf_mem_free(hdd_ctx->iftype_data_2g); + hdd_ctx->iftype_data_2g = NULL; + hdd_ctx->iftype_data_5g = NULL; + return QDF_STATUS_E_NOMEM; + } + return QDF_STATUS_SUCCESS; } #else @@ -15000,10 +15017,26 @@ wlan_hdd_iftype_data_alloc(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 +wlan_hdd_iftype_data_mem_free_6ghz(struct hdd_context *hdd_ctx) +{ + qdf_mem_free(hdd_ctx->iftype_data_6g); + hdd_ctx->iftype_data_6g = NULL; +} +#else +static inline void +wlan_hdd_iftype_data_mem_free_6ghz(struct hdd_context *hdd_ctx) +{ +} +#endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) static void wlan_hdd_iftype_data_mem_free(struct hdd_context *hdd_ctx) { + wlan_hdd_iftype_data_mem_free_6ghz(hdd_ctx); qdf_mem_free(hdd_ctx->iftype_data_5g); qdf_mem_free(hdd_ctx->iftype_data_2g); hdd_ctx->iftype_data_5g = NULL; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 840a206a1beb..217b0e183422 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1939,6 +1939,46 @@ static void hdd_extract_fw_version_info(struct hdd_context *hdd_ctx) HDD_FW_VER_REL_ID(hdd_ctx->target_fw_vers_ext); } +#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ + (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) +static void +hdd_update_wiphy_he_caps_6ghz(struct hdd_context *hdd_ctx) +{ + struct ieee80211_supported_band *band_6g = + hdd_ctx->wiphy->bands[HDD_NL80211_BAND_6GHZ]; + uint8_t *phy_info = + hdd_ctx->iftype_data_6g->he_cap.he_cap_elem.phy_cap_info; + uint8_t max_fw_bw = sme_get_vht_ch_width(); + + if (!band_6g || !phy_info) { + hdd_debug("6ghz not supported in wiphy"); + return; + } + + hdd_ctx->iftype_data_6g->types_mask = + (BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP)); + hdd_ctx->iftype_data_6g->he_cap.has_he = true; + band_6g->n_iftype_data = 1; + + if (max_fw_bw >= WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) + phy_info[0] |= + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G; + if (max_fw_bw >= WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) + phy_info[0] |= + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G; + if (max_fw_bw >= WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ) + phy_info[0] |= + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G; + + band_6g->iftype_data = hdd_ctx->iftype_data_6g; +} +#else +static inline void +hdd_update_wiphy_he_caps_6ghz(struct hdd_context *hdd_ctx) +{ +} +#endif + #if defined(WLAN_FEATURE_11AX) && \ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) static void hdd_update_wiphy_he_cap(struct hdd_context *hdd_ctx) @@ -1969,6 +2009,7 @@ static void hdd_update_wiphy_he_cap(struct hdd_context *hdd_ctx) band_5g->n_iftype_data = 1; band_5g->iftype_data = hdd_ctx->iftype_data_5g; } + hdd_update_wiphy_he_caps_6ghz(hdd_ctx); } #else static void hdd_update_wiphy_he_cap(struct hdd_context *hdd_ctx)