From e5213aa282d7913560e60ed9c3c313776dc422bf Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Fri, 30 Apr 2021 17:31:38 -0700 Subject: [PATCH] qcacld-3.0: Send 6G HE caps to userspace New checks have been added in userspace to verify the 6GHz HE capabilities before allowing the connection. These capabilities are not currently being shared by host. Add logic to send the 6GHz HE capabilities to userspace. Also, add APIs to get capabilities from MLME component. Change-Id: I3d2bbe0d87be6094b6fc74ce01d0e418873cbc6f CRs-fixed: 2931130 --- .../mlme/dispatcher/inc/wlan_mlme_api.h | 10 +++++ .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 20 +++++++++ .../mlme/dispatcher/src/wlan_mlme_api.c | 42 +++++++++++++++++++ core/hdd/src/wlan_hdd_main.c | 38 +++++++++++++++++ 4 files changed, 110 insertions(+) diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index a5587a1a3845..401bd9c549e5 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -1468,6 +1468,16 @@ QDF_STATUS wlan_mlme_cfg_set_vht_max_mpdu_len(struct wlan_objmgr_psoc *psoc, uint8_t value); +/** + * wlan_mlme_cfg_get_ht_smps() - gets HT SM Power Save mode from cfg item + * @psoc: psoc context + * @value: data to be set + * + * Return: QDF_STATUS + */ +QDF_STATUS wlan_mlme_cfg_get_ht_smps(struct wlan_objmgr_psoc *psoc, + uint8_t *value); + /** * wlan_mlme_cfg_get_vht_chan_width() - gets vht supported channel width from * cfg item diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index bbf3c454e0c1..5906cf82d9d4 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -4262,4 +4262,24 @@ ucfg_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc) return wlan_mlme_is_sta_mon_conc_supported(psoc); } +static inline QDF_STATUS +ucfg_mlme_cfg_get_vht_ampdu_len_exp(struct wlan_objmgr_psoc *psoc, + uint8_t *value) +{ + return wlan_mlme_cfg_get_vht_ampdu_len_exp(psoc, value); +} + +static inline QDF_STATUS +ucfg_mlme_cfg_get_vht_max_mpdu_len(struct wlan_objmgr_psoc *psoc, + uint8_t *value) +{ + return wlan_mlme_cfg_get_vht_max_mpdu_len(psoc, value); +} + +static inline QDF_STATUS +ucfg_mlme_cfg_get_ht_smps(struct wlan_objmgr_psoc *psoc, + uint8_t *value) +{ + return wlan_mlme_cfg_get_ht_smps(psoc, value); +} #endif /* _WLAN_MLME_UCFG_API_H_ */ diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index ca69d7cfd051..dd930d969742 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -1314,6 +1314,48 @@ QDF_STATUS wlan_mlme_get_wmm_uapsd_vo_sus_intv(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS wlan_mlme_cfg_get_vht_ampdu_len_exp(struct wlan_objmgr_psoc *psoc, + uint8_t *value) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return QDF_STATUS_E_FAILURE; + + *value = mlme_obj->cfg.vht_caps.vht_cap_info.ampdu_len_exponent; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_mlme_cfg_get_vht_max_mpdu_len(struct wlan_objmgr_psoc *psoc, + uint8_t *value) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return QDF_STATUS_E_FAILURE; + + *value = mlme_obj->cfg.vht_caps.vht_cap_info.ampdu_len; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_mlme_cfg_get_ht_smps(struct wlan_objmgr_psoc *psoc, + uint8_t *value) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return QDF_STATUS_E_FAILURE; + + *value = mlme_obj->cfg.ht_caps.smps; + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS wlan_mlme_get_wmm_dir_ac_vi(struct wlan_objmgr_psoc *psoc, uint8_t *value) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a641e3b6fd7e..0badff3f2236 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2255,6 +2255,42 @@ static void hdd_extract_fw_version_info(struct hdd_context *hdd_ctx) #if defined(WLAN_FEATURE_11AX) && \ (defined(CFG80211_SBAND_IFTYPE_DATA_BACKPORT) || \ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))) + +#if defined(CONFIG_BAND_6GHZ) && (KERNEL_VERSION(5, 8, 0) <= LINUX_VERSION_CODE) +static void hdd_update_wiphy_he_6ghz_capa(struct hdd_context *hdd_ctx) +{ + uint16_t he_6ghz_capa = 0; + uint8_t min_mpdu_start_spacing; + uint8_t max_ampdu_len_exp; + uint8_t max_mpdu_len; + uint8_t sm_pow_save; + + ucfg_mlme_get_ht_mpdu_density(hdd_ctx->psoc, &min_mpdu_start_spacing); + he_6ghz_capa |= FIELD_PREP(IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START, + min_mpdu_start_spacing); + + ucfg_mlme_cfg_get_vht_ampdu_len_exp(hdd_ctx->psoc, &max_ampdu_len_exp); + he_6ghz_capa |= FIELD_PREP(IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP, + max_ampdu_len_exp); + + ucfg_mlme_cfg_get_vht_max_mpdu_len(hdd_ctx->psoc, &max_mpdu_len); + he_6ghz_capa |= FIELD_PREP(IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN, + max_mpdu_len); + + ucfg_mlme_cfg_get_ht_smps(hdd_ctx->psoc, &sm_pow_save); + he_6ghz_capa |= FIELD_PREP(IEEE80211_HE_6GHZ_CAP_SM_PS, sm_pow_save); + + he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS; + he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS; + + hdd_ctx->iftype_data_6g->he_6ghz_capa.capa = he_6ghz_capa; +} +#else +static inline void hdd_update_wiphy_he_6ghz_capa(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 @@ -2295,6 +2331,8 @@ hdd_update_wiphy_he_caps_6ghz(struct hdd_context *hdd_ctx, if (he_cap_cfg->twt_responder) mac_info_6g[0] |= IEEE80211_HE_MAC_CAP0_TWT_RES; + hdd_update_wiphy_he_6ghz_capa(hdd_ctx); + band_6g->iftype_data = hdd_ctx->iftype_data_6g; } #else