qcacmn: Add support to set 11az ext feature flags

Add support to set 11az ext feature flags
Read the firmware capability for 11az features and
advertise the corresponding wiphy flags.

Change-Id: I85f6cc2f65a5d9892830f66a726cffc823093bca
CRs-Fixed: 3150584
This commit is contained in:
Pragaspathi Thilagaraj
2022-02-09 01:44:30 +05:30
committed by Madan Koyyalamudi
parent 8d44eccea7
commit aa27094cab
6 changed files with 208 additions and 0 deletions

View File

@@ -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 <linux/version.h>
#include <linux/netdevice.h>
#include <net/netlink.h>
#include <net/cfg80211.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);
#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_ */

View File

@@ -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

View File

@@ -84,6 +84,36 @@ init_deinit_update_rssi_dbm_conv_support(struct wmi_unified *wmi_handle,
{} {}
#endif #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, static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle,
uint8_t *event, uint8_t *event,
uint32_t data_len) 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_psoc_nif_fw_ext_cap_set(psoc,
WLAN_SOC_CEXT_CSA_TX_OFFLOAD); WLAN_SOC_CEXT_CSA_TX_OFFLOAD);
init_deinit_update_wifi_pos_caps(wmi_handle, psoc);
/* override derived value, if it exceeds max peer count */ /* override derived value, if it exceeds max peer count */
if ((wlan_psoc_get_max_peer_count(psoc) > if ((wlan_psoc_get_max_peer_count(psoc) >
tgt_hdl->info.wlan_res_cfg.num_active_peers) && tgt_hdl->info.wlan_res_cfg.num_active_peers) &&

View File

@@ -224,6 +224,22 @@
/* MGMT Rx REO feature capability */ /* MGMT Rx REO feature capability */
#define WLAN_SOC_F_MGMT_RX_REO_CAPABLE 0x40000000 #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 */ /* PSOC op flags */
/* Invalid VHT cap */ /* Invalid VHT cap */
@@ -283,6 +299,7 @@ struct wlan_objmgr_psoc_user_config {
* @phy_type: OL/DA type * @phy_type: OL/DA type
* @soc_fw_caps: FW capabilities * @soc_fw_caps: FW capabilities
* @soc_fw_ext_caps: FW ext capabilities * @soc_fw_ext_caps: FW ext capabilities
* @soc_fw_ext2_caps: FW ext2 capabilities
* @soc_feature_caps:Feature capabilities * @soc_feature_caps:Feature capabilities
* @soc_op_flags: Flags to set/reset during operation * @soc_op_flags: Flags to set/reset during operation
* @soc_hw_macaddr[]:HW MAC address * @soc_hw_macaddr[]:HW MAC address
@@ -293,6 +310,7 @@ struct wlan_objmgr_psoc_nif {
WLAN_DEV_TYPE phy_type; WLAN_DEV_TYPE phy_type;
uint32_t soc_fw_caps; uint32_t soc_fw_caps;
uint32_t soc_fw_ext_caps; uint32_t soc_fw_ext_caps;
uint32_t soc_fw_ext2_caps;
uint32_t soc_feature_caps; uint32_t soc_feature_caps;
uint32_t soc_op_flags; uint32_t soc_op_flags;
uint8_t soc_hw_macaddr[QDF_MAC_ADDR_SIZE]; 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; 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 * wlan_psoc_nif_feat_cap_set() - set feature caps
* @psoc: PSOC object * @psoc: PSOC object

View File

@@ -5581,6 +5581,12 @@ typedef enum {
wmi_service_pn_replay_check_support, wmi_service_pn_replay_check_support,
#ifdef QCA_RSSI_DB2DBM #ifdef QCA_RSSI_DB2DBM
wmi_service_pdev_rssi_dbm_conv_event_support, 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 #endif
wmi_services_max, wmi_services_max,
} wmi_conv_service_ids; } wmi_conv_service_ids;

View File

@@ -18637,6 +18637,16 @@ static void populate_tlv_service(uint32_t *wmi_service)
WMI_SERVICE_SCAN_CONFIG_PER_CHANNEL; WMI_SERVICE_SCAN_CONFIG_PER_CHANNEL;
wmi_service[wmi_service_csa_beacon_template] = wmi_service[wmi_service_csa_beacon_template] =
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 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
wmi_service[wmi_service_igmp_offload_support] = wmi_service[wmi_service_igmp_offload_support] =
WMI_SERVICE_IGMP_OFFLOAD_SUPPORT; WMI_SERVICE_IGMP_OFFLOAD_SUPPORT;