diff --git a/os_if/linux/wifi_pos/src/wlan_cfg80211_wifi_pos.c b/os_if/linux/wifi_pos/src/wlan_cfg80211_wifi_pos.c index 81bca81c98..d2939007c4 100644 --- a/os_if/linux/wifi_pos/src/wlan_cfg80211_wifi_pos.c +++ b/os_if/linux/wifi_pos/src/wlan_cfg80211_wifi_pos.c @@ -39,6 +39,12 @@ void wlan_wifi_pos_cfg80211_set_wiphy_ext_feature(struct wiphy *wiphy, struct wlan_objmgr_psoc *psoc) { + bool enable_rsta_11az_ranging; + + enable_rsta_11az_ranging = ucfg_wifi_pos_get_rsta_11az_ranging_cap(); + if (!enable_rsta_11az_ranging) + return; + if (wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_RTT_11AZ_NTB_SUPPORT)) { wlan_extended_caps_iface[WLAN_EXT_RANGING_CAP_IDX] |= WLAN_EXT_CAPA11_NTB_RANGING_RESPONDER; @@ -82,21 +88,27 @@ wlan_wifi_pos_set_feature_flags(uint8_t *feature_flags, void wlan_wifi_pos_cfg80211_set_features(struct wlan_objmgr_psoc *psoc, uint8_t *feature_flags) { - bool rsta_secure_ltf_support; + bool rsta_secure_ltf_support, enable_rsta_11az_ranging; + enable_rsta_11az_ranging = ucfg_wifi_pos_get_rsta_11az_ranging_cap(); + rsta_secure_ltf_support = enable_rsta_11az_ranging && + wifi_pos_get_rsta_sec_ltf_cap(); if (wlan_psoc_nif_fw_ext2_cap_get(psoc, WLAN_RTT_11AZ_MAC_PHY_SEC_SUPPORT)) { wlan_wifi_pos_set_feature_flags(feature_flags, QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_STA); - rsta_secure_ltf_support = wifi_pos_get_rsta_sec_ltf_cap(); if (rsta_secure_ltf_support) wlan_wifi_pos_set_feature_flags(feature_flags, QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_AP); } if (wlan_psoc_nif_fw_ext2_cap_get(psoc, - WLAN_RTT_11AZ_MAC_SEC_SUPPORT)) + WLAN_RTT_11AZ_MAC_SEC_SUPPORT)) { wlan_wifi_pos_set_feature_flags(feature_flags, QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_STA); + if (rsta_secure_ltf_support) + wlan_wifi_pos_set_feature_flags(feature_flags, + QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_AP); + } } #endif diff --git a/umac/wifi_pos/inc/wifi_pos_api.h b/umac/wifi_pos/inc/wifi_pos_api.h index aee60fe3c5..13a7ed1a64 100644 --- a/umac/wifi_pos/inc/wifi_pos_api.h +++ b/umac/wifi_pos/inc/wifi_pos_api.h @@ -678,7 +678,7 @@ wifi_pos_get_osif_callbacks(struct wlan_objmgr_psoc *psoc); * Return: None **/ void -wifi_pos_set_rsta_sec_ltf_cap(uint32_t val); +wifi_pos_set_rsta_sec_ltf_cap(bool val); /** * wifi_pos_get_rsta_sec_ltf_cap - Get RSTA secure LTF capability @@ -686,5 +686,18 @@ wifi_pos_set_rsta_sec_ltf_cap(uint32_t val); * Return: True or false */ bool wifi_pos_get_rsta_sec_ltf_cap(void); + +/** + * wifi_pos_set_rsta_11az_ranging_cap() - Enable/Disable R-STA 11az ranging + * @val: Value to set + */ +void wifi_pos_set_rsta_11az_ranging_cap(bool val); + +/** + * wifi_pos_get_rsta_11az_ranging_cap() - Get if RSTA 11az ranging is enabled + * + * Return: True if 11az ranging is enabled + */ +bool wifi_pos_get_rsta_11az_ranging_cap(void); #endif #endif /* _WIFI_POS_API_H_ */ diff --git a/umac/wifi_pos/inc/wifi_pos_ucfg_i.h b/umac/wifi_pos/inc/wifi_pos_ucfg_i.h index 6299926002..9cf5628d2b 100644 --- a/umac/wifi_pos/inc/wifi_pos_ucfg_i.h +++ b/umac/wifi_pos/inc/wifi_pos_ucfg_i.h @@ -90,5 +90,11 @@ ucfg_wifi_pos_is_ltf_keyseed_required_for_peer(struct wlan_objmgr_peer *peer) { return wifi_pos_is_ltf_keyseed_required_for_peer(peer); } + +static inline +bool ucfg_wifi_pos_get_rsta_11az_ranging_cap(void) +{ + return wifi_pos_get_rsta_11az_ranging_cap(); +} #endif #endif /* _WIFI_POS_UCFG_H_ */ diff --git a/umac/wifi_pos/inc/wifi_pos_utils_i.h b/umac/wifi_pos/inc/wifi_pos_utils_i.h index 1d762ebb76..f46a2307e9 100644 --- a/umac/wifi_pos/inc/wifi_pos_utils_i.h +++ b/umac/wifi_pos/inc/wifi_pos_utils_i.h @@ -259,6 +259,7 @@ struct wifi_pos_legacy_ops { * @wifi_pos_lock: lock to access wifi pos priv object * @oem_6g_support_disable: oem target 6ghz support is disabled if set * @enable_rsta_secure_ltf_support: Enable RSTA secure LTF support + * @enable_rsta_11az_ranging: Enable RSTA 802.11 az secure ranging support * @wifi_pos_req_handler: function pointer to handle TLV or non-TLV * @wifi_pos_send_rsp: function pointer to send msg to userspace APP * @wifi_pos_get_phy_mode: function pointer to get wlan phymode for given @@ -314,6 +315,7 @@ struct wifi_pos_psoc_priv_obj { qdf_spinlock_t wifi_pos_lock; bool oem_6g_support_disable; bool enable_rsta_secure_ltf_support; + bool enable_rsta_11az_ranging; struct wifi_pos_legacy_ops *legacy_ops; QDF_STATUS (*wifi_pos_req_handler)(struct wlan_objmgr_psoc *psoc, struct wifi_pos_req_msg *req); diff --git a/umac/wifi_pos/src/wifi_pos_api.c b/umac/wifi_pos/src/wifi_pos_api.c index d1dc40b72f..de2724e078 100644 --- a/umac/wifi_pos/src/wifi_pos_api.c +++ b/umac/wifi_pos/src/wifi_pos_api.c @@ -705,7 +705,7 @@ wifi_pos_get_osif_callbacks(struct wlan_objmgr_psoc *psoc) } #if defined(WIFI_POS_CONVERGED) && defined(WLAN_FEATURE_RTT_11AZ_SUPPORT) -void wifi_pos_set_rsta_sec_ltf_cap(uint32_t val) +void wifi_pos_set_rsta_sec_ltf_cap(bool val) { struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc()); @@ -737,4 +737,37 @@ bool wifi_pos_get_rsta_sec_ltf_cap(void) return value; } + +void wifi_pos_set_rsta_11az_ranging_cap(bool val) +{ + struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = + wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc()); + + if (!wifi_pos_psoc) { + wifi_pos_alert("unable to get wifi_pos psoc obj"); + return; + } + + qdf_spin_lock_bh(&wifi_pos_psoc->wifi_pos_lock); + wifi_pos_psoc->enable_rsta_11az_ranging = val; + qdf_spin_unlock_bh(&wifi_pos_psoc->wifi_pos_lock); +} + +bool wifi_pos_get_rsta_11az_ranging_cap(void) +{ + bool value; + struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = + wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc()); + + if (!wifi_pos_psoc) { + wifi_pos_alert("unable to get wifi_pos psoc obj"); + return false; + } + + qdf_spin_lock_bh(&wifi_pos_psoc->wifi_pos_lock); + value = wifi_pos_psoc->enable_rsta_11az_ranging; + qdf_spin_unlock_bh(&wifi_pos_psoc->wifi_pos_lock); + + return value; +} #endif