diff --git a/os_if/linux/wifi_pos/inc/wlan_cfg80211_wifi_pos.h b/os_if/linux/wifi_pos/inc/wlan_cfg80211_wifi_pos.h index 5628df6305..d987b037ee 100644 --- a/os_if/linux/wifi_pos/inc/wlan_cfg80211_wifi_pos.h +++ b/os_if/linux/wifi_pos/inc/wlan_cfg80211_wifi_pos.h @@ -29,15 +29,27 @@ #include #include -#if defined(CFG80211_PASN_SUPPORT) && defined(WIFI_POS_CONVERGED) && \ - defined(WLAN_FEATURE_RTT_11AZ_SUPPORT) +#if defined(WIFI_POS_CONVERGED) && defined(WLAN_FEATURE_RTT_11AZ_SUPPORT) void wlan_wifi_pos_cfg80211_set_wiphy_ext_feature(struct wiphy *wiphy, struct wlan_objmgr_psoc *psoc); + +/** + * wlan_wifi_pos_cfg80211_set_features - Set the vendor feature flags + * @psoc: Global PSOC pointer + * @feature_flags: feature flags + */ +void wlan_wifi_pos_cfg80211_set_features(struct wlan_objmgr_psoc *psoc, + uint8_t *feature_flags); #else +static inline +void wlan_wifi_pos_cfg80211_set_features(struct wlan_objmgr_psoc *psoc, + uint8_t *feature_flags) +{} + static inline void wlan_wifi_pos_cfg80211_set_wiphy_ext_feature(struct wiphy *wiphy, struct wlan_objmgr_psoc *psoc) {} -#endif /* WIFI_POS_CONVERGED */ +#endif /* WIFI_POS_CONVERGED && WLAN_FEATURE_RTT_11AZ_SUPPORT*/ #endif /* _WLAN_CFG80211_WIFI_POS_H_ */ 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 285960cfea..eb3cbd69ef 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 @@ -24,21 +24,71 @@ #include "wlan_cfg80211.h" #include "wlan_objmgr_psoc_obj.h" #include "wlan_cfg80211_wifi_pos.h" +#include "wlan_cmn_ieee80211.h" -#if defined(CFG80211_PASN_SUPPORT) && defined(WIFI_POS_CONVERGED) && \ - defined(WLAN_FEATURE_RTT_11AZ_SUPPORT) +#if defined(WIFI_POS_CONVERGED) && defined(WLAN_FEATURE_RTT_11AZ_SUPPORT) + +u8 wlan_extended_caps_iface[WLAN_EXTCAP_IE_MAX_LEN] = {0}; +u8 wlan_extended_caps_iface_mask[WLAN_EXTCAP_IE_MAX_LEN] = {0}; + +struct wiphy_iftype_ext_capab iftype_ext_cap; + +#define WLAN_EXT_RANGING_CAP_IDX 11 void wlan_wifi_pos_cfg80211_set_wiphy_ext_feature(struct wiphy *wiphy, struct wlan_objmgr_psoc *psoc) { - if (wlan_psoc_nif_fw_ext2_cap_get(psoc, - WLAN_RTT_11AZ_MAC_SEC_SUPPORT)) { - wiphy_ext_feature_set(wiphy, - NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE); + 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; + wlan_extended_caps_iface_mask[WLAN_EXT_RANGING_CAP_IDX] |= + WLAN_EXT_CAPA11_NTB_RANGING_RESPONDER; } + if (wlan_psoc_nif_fw_ext2_cap_get(psoc, WLAN_RTT_11AZ_TB_SUPPORT)) { + wlan_extended_caps_iface[WLAN_EXT_RANGING_CAP_IDX] |= + WLAN_EXT_CAPA11_TB_RANGING_RESPONDER; + wlan_extended_caps_iface_mask[WLAN_EXT_RANGING_CAP_IDX] |= + WLAN_EXT_CAPA11_TB_RANGING_RESPONDER; + } + + iftype_ext_cap.iftype = NL80211_IFTYPE_AP; + iftype_ext_cap.extended_capabilities = + wlan_extended_caps_iface, + iftype_ext_cap.extended_capabilities_mask = + wlan_extended_caps_iface_mask, + iftype_ext_cap.extended_capabilities_len = + ARRAY_SIZE(wlan_extended_caps_iface), + + wiphy->num_iftype_ext_capab = 0; + wiphy->iftype_ext_capab = &iftype_ext_cap; + wiphy->num_iftype_ext_capab++; +} + +#define NUM_BITS_IN_BYTE 8 +static void +wlan_wifi_pos_set_feature_flags(uint8_t *feature_flags, + enum qca_wlan_vendor_features feature) +{ + uint32_t index; + uint8_t bit_mask; + + index = feature / NUM_BITS_IN_BYTE; + bit_mask = 1 << (feature % NUM_BITS_IN_BYTE); + feature_flags[index] |= bit_mask; +} + +void wlan_wifi_pos_cfg80211_set_features(struct wlan_objmgr_psoc *psoc, + uint8_t *feature_flags) +{ if (wlan_psoc_nif_fw_ext2_cap_get(psoc, WLAN_RTT_11AZ_MAC_PHY_SEC_SUPPORT)) - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_SECURE_LTF); + wlan_wifi_pos_set_feature_flags(feature_flags, + QCA_WLAN_VENDOR_FEATURE_SECURE_LTF_STA); + + if (wlan_psoc_nif_fw_ext2_cap_get(psoc, + WLAN_RTT_11AZ_MAC_SEC_SUPPORT)) + wlan_wifi_pos_set_feature_flags(feature_flags, + QCA_WLAN_VENDOR_FEATURE_PROT_RANGE_NEGO_AND_MEASURE_STA); } #endif diff --git a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h index e839455862..15b4c15449 100644 --- a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h +++ b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h @@ -369,6 +369,12 @@ #define WLAN_BSS_MEMBERSHIP_SELECTOR_SAE_H2E 123 #define WLAN_BSS_MEMBERSHIP_SELECTOR_HE_PHY 122 +/* EXT cap bit definitions based on IEEE 802.11az D4.0 - 9.4.2.26 */ +#define WLAN_EXT_CAPA11_NTB_RANGING_RESPONDER BIT(2) +#define WLAN_EXT_CAPA11_TB_RANGING_RESPONDER BIT(3) +#define WLAN_EXT_CAPA11_PASSIVE_TB_RANGING_RESPONDER BIT(4) +#define WLAN_EXT_CAPA11_PASSIVE_TB_RANGING_INITIATOR BIT(5) + #define WLAN_CHAN_IS_5GHZ(chanidx) \ ((chanidx > 30) ? true : false) #define WLAN_CHAN_IS_2GHZ(chanidx) \