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 new file mode 100644 index 0000000000..de42a54205 --- /dev/null +++ b/os_if/linux/wifi_pos/inc/wlan_cfg80211_wifi_pos.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_wifi_pos.h + * declares wifi pos module driver functions interfacing with linux kernel + */ + +#ifndef _WLAN_CFG80211_WIFI_POS_H_ +#define _WLAN_CFG80211_WIFI_POS_H_ + +#include +#include +#include +#include + +#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)) || \ + defined(CFG80211_PASN_SUPPORT)) && \ + defined(WIFI_POS_CONVERGED) +void +wlan_wifi_pos_cfg80211_set_wiphy_ext_feature(struct wiphy *wiphy, + struct wlan_objmgr_psoc *psoc); +#else +static inline void +wlan_wifi_pos_cfg80211_set_wiphy_ext_feature(struct wiphy *wiphy, + struct wlan_objmgr_psoc *psoc) +{} +#endif /* WIFI_POS_CONVERGED */ +#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 new file mode 100644 index 0000000000..74d46c2edf --- /dev/null +++ b/os_if/linux/wifi_pos/src/wlan_cfg80211_wifi_pos.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_wifi_pos.c + * defines wifi-pos module related driver functions interfacing with linux + * kernel + */ +#include "wlan_cfg80211.h" +#include "wlan_objmgr_psoc_obj.h" +#include "wlan_cfg80211_wifi_pos.h" + +#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)) || \ + defined(CFG80211_PASN_SUPPORT)) && \ + defined(WIFI_POS_CONVERGED) +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_SECURE_RTT); + wiphy_ext_feature_set(wiphy, + NL80211_EXT_FEATURE_PROTECTION_OF_RANGING_NEGOTIATION); + } + + 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); + + if (wlan_psoc_nif_fw_ext_cap_get(psoc, WLAN_RTT_11AZ_NTB_SUPPORT)) + wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_NTB_RANGING); + + if (wlan_psoc_nif_fw_ext2_cap_get(psoc, WLAN_RTT_11AZ_TB_SUPPORT)) + wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TB_RANGING); +} +#endif diff --git a/target_if/init_deinit/src/init_event_handler.c b/target_if/init_deinit/src/init_event_handler.c index 9fd136703d..0abfb9d2e0 100644 --- a/target_if/init_deinit/src/init_event_handler.c +++ b/target_if/init_deinit/src/init_event_handler.c @@ -84,6 +84,36 @@ init_deinit_update_rssi_dbm_conv_support(struct wmi_unified *wmi_handle, {} #endif +#ifdef WIFI_POS_CONVERGED +static inline void +init_deinit_update_wifi_pos_caps(struct wmi_unified *wmi_handle, + struct wlan_objmgr_psoc *psoc) +{ + if (wmi_service_enabled(wmi_handle, wmi_service_rtt_11az_ntb_support)) + wlan_psoc_nif_fw_ext_cap_set(psoc, + WLAN_RTT_11AZ_NTB_SUPPORT); + + if (wmi_service_enabled(wmi_handle, wmi_service_rtt_11az_tb_support)) + wlan_psoc_nif_fw_ext2_cap_set(psoc, + WLAN_RTT_11AZ_TB_SUPPORT); + + if (wmi_service_enabled(wmi_handle, + wmi_service_rtt_11az_mac_sec_support)) + wlan_psoc_nif_fw_ext2_cap_set(psoc, + WLAN_RTT_11AZ_MAC_SEC_SUPPORT); + + if (wmi_service_enabled(wmi_handle, + wmi_service_rtt_11az_mac_phy_sec_support)) + wlan_psoc_nif_fw_ext2_cap_set( + psoc, WLAN_RTT_11AZ_MAC_PHY_SEC_SUPPORT); +} +#else +static inline void +init_deinit_update_wifi_pos_caps(struct wmi_unified *wmi_handle, + struct wlan_objmgr_psoc *psoc) +{} +#endif + static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle, uint8_t *event, uint32_t data_len) @@ -234,6 +264,8 @@ static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle, wlan_psoc_nif_fw_ext_cap_set(psoc, WLAN_SOC_CEXT_CSA_TX_OFFLOAD); + init_deinit_update_wifi_pos_caps(wmi_handle, psoc); + /* override derived value, if it exceeds max peer count */ if ((wlan_psoc_get_max_peer_count(psoc) > tgt_hdl->info.wlan_res_cfg.num_active_peers) && diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h index c99a0aef10..78a4ce2afd 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h @@ -224,6 +224,22 @@ /* MGMT Rx REO feature capability */ #define WLAN_SOC_F_MGMT_RX_REO_CAPABLE 0x40000000 +/* 11AZ Secure ranging Feature flags */ +/* 11AZ Non-Trigger based ranging support */ +#define WLAN_RTT_11AZ_NTB_SUPPORT 0x80000000 + +/* + * Feature flags are exhausted. Add EXT feature caps below to extend + * the feature flags + */ + +/* 11AZ Trigger based ranging support */ +#define WLAN_RTT_11AZ_TB_SUPPORT 0x00000001 +/* 11AZ Secure ranging PASN Support */ +#define WLAN_RTT_11AZ_MAC_SEC_SUPPORT 0x00000002 +/* 11AZ Secure ranging PHY Security support */ +#define WLAN_RTT_11AZ_MAC_PHY_SEC_SUPPORT 0x00000004 + /* PSOC op flags */ /* Invalid VHT cap */ @@ -283,6 +299,7 @@ struct wlan_objmgr_psoc_user_config { * @phy_type: OL/DA type * @soc_fw_caps: FW capabilities * @soc_fw_ext_caps: FW ext capabilities + * @soc_fw_ext2_caps: FW ext2 capabilities * @soc_feature_caps:Feature capabilities * @soc_op_flags: Flags to set/reset during operation * @soc_hw_macaddr[]:HW MAC address @@ -293,6 +310,7 @@ struct wlan_objmgr_psoc_nif { WLAN_DEV_TYPE phy_type; uint32_t soc_fw_caps; uint32_t soc_fw_ext_caps; + uint32_t soc_fw_ext2_caps; uint32_t soc_feature_caps; uint32_t soc_op_flags; uint8_t soc_hw_macaddr[QDF_MAC_ADDR_SIZE]; @@ -1310,6 +1328,52 @@ static inline uint8_t wlan_psoc_nif_fw_ext_cap_get( return (psoc->soc_nif.soc_fw_ext_caps & ext_cap) ? 1 : 0; } +/** + * wlan_psoc_nif_fw_ext2_cap_set() - set fw ext2 caps + * @psoc: PSOC object + * @ext2_cap: capability flag to be set + * + * API to set fw ext caps in psoc + * + * Return: void + */ +static inline void wlan_psoc_nif_fw_ext2_cap_set(struct wlan_objmgr_psoc *psoc, + uint32_t ext2_cap) +{ + psoc->soc_nif.soc_fw_ext2_caps |= ext2_cap; +} + +/** + * wlan_psoc_nif_fw_ext2_cap_clear() - clear fw ext2 caps + * @psoc: PSOC object + * @ext2_cap: capability flag to be cleared + * + * API to clear fw ext caps in psoc + * + * Return: void + */ +static inline void +wlan_psoc_nif_fw_ext2_cap_clear(struct wlan_objmgr_psoc *psoc, + uint32_t ext2_cap) +{ + psoc->soc_nif.soc_fw_ext2_caps &= ~ext2_cap; +} + +/** + * wlan_psoc_nif_fw_ext2_cap_get() - get fw caps + * @psoc: PSOC object + * @ext2_cap: capability flag to be checked + * + * API to know, whether particular fw caps flag is set in psoc + * + * Return: 1 (for set) or 0 (for not set) + */ +static inline uint8_t +wlan_psoc_nif_fw_ext2_cap_get(struct wlan_objmgr_psoc *psoc, uint32_t ext2_cap) +{ + return (psoc->soc_nif.soc_fw_ext2_caps & ext2_cap) ? 1 : 0; +} + /** * wlan_psoc_nif_feat_cap_set() - set feature caps * @psoc: PSOC object diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 2c2a9f79da..3e9b2b1769 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5581,6 +5581,12 @@ typedef enum { wmi_service_pn_replay_check_support, #ifdef QCA_RSSI_DB2DBM wmi_service_pdev_rssi_dbm_conv_event_support, +#endif +#ifdef WIFI_POS_CONVERGED + wmi_service_rtt_11az_mac_phy_sec_support, + wmi_service_rtt_11az_mac_sec_support, + wmi_service_rtt_11az_ntb_support, + wmi_service_rtt_11az_tb_support, #endif wmi_services_max, } wmi_conv_service_ids; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 4c9680ca0f..1d49e14e1c 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -18637,6 +18637,16 @@ static void populate_tlv_service(uint32_t *wmi_service) WMI_SERVICE_SCAN_CONFIG_PER_CHANNEL; wmi_service[wmi_service_csa_beacon_template] = WMI_SERVICE_CSA_BEACON_TEMPLATE; +#if defined(WIFI_POS_CONVERGED) && defined(WLAN_FEATURE_RTT_11AZ_SUPPORT) + wmi_service[wmi_service_rtt_11az_ntb_support] = + WMI_SERVICE_RTT_11AZ_NTB_SUPPORT; + wmi_service[wmi_service_rtt_11az_tb_support] = + WMI_SERVICE_RTT_11AZ_TB_SUPPORT; + wmi_service[wmi_service_rtt_11az_mac_sec_support] = + WMI_SERVICE_RTT_11AZ_MAC_SEC_SUPPORT; + wmi_service[wmi_service_rtt_11az_mac_phy_sec_support] = + WMI_SERVICE_RTT_11AZ_MAC_PHY_SEC_SUPPORT; +#endif #ifdef WLAN_FEATURE_IGMP_OFFLOAD wmi_service[wmi_service_igmp_offload_support] = WMI_SERVICE_IGMP_OFFLOAD_SUPPORT;